Skip to content

Instantly share code, notes, and snippets.

@elect86
Last active January 12, 2024 11:54
Show Gist options
  • Save elect86/caec71acf83abd3b0aac918c33e93a98 to your computer and use it in GitHub Desktop.
Save elect86/caec71acf83abd3b0aac918c33e93a98 to your computer and use it in GitHub Desktop.
import io.lakefs.clients.sdk.ApiClient
import io.lakefs.clients.sdk.ApiException
import io.lakefs.clients.sdk.Configuration
import io.lakefs.clients.sdk.auth.*
import io.lakefs.clients.sdk.models.*
import io.lakefs.clients.sdk.ActionsApi
fun main() {
val defaultClient = Configuration.default { basePath = Api.v1 }
// Configure HTTP basic authorization: basic_auth
val basicAuth = defaultClient.authentication<HttpBasicAuth>("basic_auth") {
username = "YOUR USERNAME"
password = "YOUR PASSWORD"
}
// Configure API key authorization: cookie_auth
val cookieAuth = defaultClient.authentication<ApiKeyAuth>("cookie_auth") {
apiKey = "YOUR API KEY"
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//apiKeyPrefix = "Token"
}
// Configure API key authorization: oidc_auth
val oidcAuth = defaultClient.authentication<ApiKeyAuth>("oidc_auth") {
apiKey = "YOUR API KEY"
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//apiKeyPrefix = "Token"
}
// Configure API key authorization: saml_auth
val samlAuth = defaultClient.authentication<ApiKeyAuth>("saml_auth") {
apiKey = "YOUR API KEY"
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//apiKeyPrefix = "Token"
}
// Configure HTTP bearer authorization: jwt_token
val jwtToken = defaultClient.authentication<HttpBearerAuth>("jwt_token") {
bearerToken = "BEARER TOKEN"
}
ActionsApi apiInstance = new ActionsApi(defaultClient)
val repository = "repository_example" // String |
val runId = "runId_example" // String |
try {
val result = apiInstance.getRun(repository, runId)
.execute()
println(result)
} catch (e: ApiException) {
println("""
Exception when calling ActionsApi#getRun
Status code: ${e.code}
Reason: ${e.responseBody}
Response headers: ${e.responseHeaders}""")
e.printStackTrace()
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment