
commonMain.aws.sdk.kotlin.services.macie.DefaultMacieClient.kt Maven / Gradle / Ivy
// Code generated by smithy-kotlin-codegen. DO NOT EDIT!
package aws.sdk.kotlin.services.macie
import aws.sdk.kotlin.runtime.client.AwsClientOption
import aws.sdk.kotlin.runtime.http.ApiMetadata
import aws.sdk.kotlin.runtime.http.AwsUserAgentMetadata
import aws.sdk.kotlin.runtime.http.middleware.AwsRetryHeaderMiddleware
import aws.sdk.kotlin.runtime.http.middleware.RecursionDetection
import aws.sdk.kotlin.runtime.http.middleware.UserAgent
import aws.sdk.kotlin.runtime.http.retries.AwsDefaultRetryPolicy
import aws.sdk.kotlin.runtime.protocol.json.AwsJsonProtocol
import aws.sdk.kotlin.services.macie.endpoints.internal.ResolveEndpoint
import aws.sdk.kotlin.services.macie.endpoints.internal.bindAwsBuiltins
import aws.sdk.kotlin.services.macie.model.*
import aws.sdk.kotlin.services.macie.model.AssociateMemberAccountRequest
import aws.sdk.kotlin.services.macie.model.AssociateS3ResourcesRequest
import aws.sdk.kotlin.services.macie.model.DisassociateMemberAccountRequest
import aws.sdk.kotlin.services.macie.model.DisassociateS3ResourcesRequest
import aws.sdk.kotlin.services.macie.model.ListMemberAccountsRequest
import aws.sdk.kotlin.services.macie.model.ListS3ResourcesRequest
import aws.sdk.kotlin.services.macie.model.UpdateS3ResourcesRequest
import aws.sdk.kotlin.services.macie.transform.*
import aws.smithy.kotlin.runtime.auth.awssigning.AwsHttpSigner
import aws.smithy.kotlin.runtime.auth.awssigning.AwsSigningAttributes
import aws.smithy.kotlin.runtime.client.ExecutionContext
import aws.smithy.kotlin.runtime.client.SdkClientOption
import aws.smithy.kotlin.runtime.http.SdkHttpClient
import aws.smithy.kotlin.runtime.http.engine.DefaultHttpEngine
import aws.smithy.kotlin.runtime.http.operation.SdkHttpOperation
import aws.smithy.kotlin.runtime.http.operation.context
import aws.smithy.kotlin.runtime.http.operation.roundTrip
import aws.smithy.kotlin.runtime.http.operation.sdkRequestId
import aws.smithy.kotlin.runtime.http.sdkHttpClient
import aws.smithy.kotlin.runtime.io.Closeable
import aws.smithy.kotlin.runtime.tracing.withRootTraceSpan
import aws.smithy.kotlin.runtime.util.putIfAbsent
import kotlin.coroutines.coroutineContext
public const val ServiceId: String = "Macie"
public const val ServiceApiVersion: String = "2017-12-19"
public const val SdkVersion: String = "0.19.5-beta"
internal class DefaultMacieClient(override val config: MacieClient.Config) : MacieClient {
private val client: SdkHttpClient
init {
val httpClientEngine = config.httpClientEngine ?: DefaultHttpEngine()
client = sdkHttpClient(httpClientEngine, manageEngine = config.httpClientEngine == null)
}
private val awsUserAgentMetadata = AwsUserAgentMetadata.fromEnvironment(ApiMetadata(ServiceId, SdkVersion))
/**
* (Discontinued) Associates a specified Amazon Web Services account with Amazon Macie Classic as a member account.
*/
override suspend fun associateMemberAccount(input: AssociateMemberAccountRequest): AssociateMemberAccountResponse {
val op = SdkHttpOperation.build {
serializer = AssociateMemberAccountOperationSerializer()
deserializer = AssociateMemberAccountOperationDeserializer()
context {
expectedHttpStatus = 200
service = serviceName
operationName = "AssociateMemberAccount"
}
}
op.execution.retryStrategy = config.retryStrategy
op.execution.retryPolicy = AwsDefaultRetryPolicy
mergeServiceDefaults(op.context)
op.interceptors.add(ResolveEndpoint(config.endpointProvider) {
bindAwsBuiltins(config)
})
op.install(AwsRetryHeaderMiddleware())
op.install(AwsJsonProtocol("MacieService", "1.1"))
op.install(UserAgent(awsUserAgentMetadata))
op.install(RecursionDetection())
op.execution.signer = AwsHttpSigner {
this.signer = config.signer
this.credentialsProvider = config.credentialsProvider
this.service = "macie"
}
op.interceptors.addAll(config.interceptors)
val rootSpan = config.tracer.createRootSpan("AssociateMemberAccount-${op.context.sdkRequestId}")
return coroutineContext.withRootTraceSpan(rootSpan) {
op.roundTrip(client, input)
}
}
/**
* (Discontinued) Associates specified S3 resources with Amazon Macie Classic for monitoring and data classification. If `memberAccountId` isn't specified, the action associates specified S3 resources with Macie Classic for the current Macie Classic administrator account. If `memberAccountId` is specified, the action associates specified S3 resources with Macie Classic for the specified member account.
*/
override suspend fun associateS3Resources(input: AssociateS3ResourcesRequest): AssociateS3ResourcesResponse {
val op = SdkHttpOperation.build {
serializer = AssociateS3ResourcesOperationSerializer()
deserializer = AssociateS3ResourcesOperationDeserializer()
context {
expectedHttpStatus = 200
service = serviceName
operationName = "AssociateS3Resources"
}
}
op.execution.retryStrategy = config.retryStrategy
op.execution.retryPolicy = AwsDefaultRetryPolicy
mergeServiceDefaults(op.context)
op.interceptors.add(ResolveEndpoint(config.endpointProvider) {
bindAwsBuiltins(config)
})
op.install(AwsRetryHeaderMiddleware())
op.install(AwsJsonProtocol("MacieService", "1.1"))
op.install(UserAgent(awsUserAgentMetadata))
op.install(RecursionDetection())
op.execution.signer = AwsHttpSigner {
this.signer = config.signer
this.credentialsProvider = config.credentialsProvider
this.service = "macie"
}
op.interceptors.addAll(config.interceptors)
val rootSpan = config.tracer.createRootSpan("AssociateS3Resources-${op.context.sdkRequestId}")
return coroutineContext.withRootTraceSpan(rootSpan) {
op.roundTrip(client, input)
}
}
/**
* (Discontinued) Removes the specified member account from Amazon Macie Classic.
*/
override suspend fun disassociateMemberAccount(input: DisassociateMemberAccountRequest): DisassociateMemberAccountResponse {
val op = SdkHttpOperation.build {
serializer = DisassociateMemberAccountOperationSerializer()
deserializer = DisassociateMemberAccountOperationDeserializer()
context {
expectedHttpStatus = 200
service = serviceName
operationName = "DisassociateMemberAccount"
}
}
op.execution.retryStrategy = config.retryStrategy
op.execution.retryPolicy = AwsDefaultRetryPolicy
mergeServiceDefaults(op.context)
op.interceptors.add(ResolveEndpoint(config.endpointProvider) {
bindAwsBuiltins(config)
})
op.install(AwsRetryHeaderMiddleware())
op.install(AwsJsonProtocol("MacieService", "1.1"))
op.install(UserAgent(awsUserAgentMetadata))
op.install(RecursionDetection())
op.execution.signer = AwsHttpSigner {
this.signer = config.signer
this.credentialsProvider = config.credentialsProvider
this.service = "macie"
}
op.interceptors.addAll(config.interceptors)
val rootSpan = config.tracer.createRootSpan("DisassociateMemberAccount-${op.context.sdkRequestId}")
return coroutineContext.withRootTraceSpan(rootSpan) {
op.roundTrip(client, input)
}
}
/**
* (Discontinued) Removes specified S3 resources from being monitored by Amazon Macie Classic. If `memberAccountId` isn't specified, the action removes specified S3 resources from Macie Classic for the current Macie Classic administrator account. If `memberAccountId` is specified, the action removes specified S3 resources from Macie Classic for the specified member account.
*/
override suspend fun disassociateS3Resources(input: DisassociateS3ResourcesRequest): DisassociateS3ResourcesResponse {
val op = SdkHttpOperation.build {
serializer = DisassociateS3ResourcesOperationSerializer()
deserializer = DisassociateS3ResourcesOperationDeserializer()
context {
expectedHttpStatus = 200
service = serviceName
operationName = "DisassociateS3Resources"
}
}
op.execution.retryStrategy = config.retryStrategy
op.execution.retryPolicy = AwsDefaultRetryPolicy
mergeServiceDefaults(op.context)
op.interceptors.add(ResolveEndpoint(config.endpointProvider) {
bindAwsBuiltins(config)
})
op.install(AwsRetryHeaderMiddleware())
op.install(AwsJsonProtocol("MacieService", "1.1"))
op.install(UserAgent(awsUserAgentMetadata))
op.install(RecursionDetection())
op.execution.signer = AwsHttpSigner {
this.signer = config.signer
this.credentialsProvider = config.credentialsProvider
this.service = "macie"
}
op.interceptors.addAll(config.interceptors)
val rootSpan = config.tracer.createRootSpan("DisassociateS3Resources-${op.context.sdkRequestId}")
return coroutineContext.withRootTraceSpan(rootSpan) {
op.roundTrip(client, input)
}
}
/**
* (Discontinued) Lists all Amazon Macie Classic member accounts for the current Macie Classic administrator account.
*/
override suspend fun listMemberAccounts(input: ListMemberAccountsRequest): ListMemberAccountsResponse {
val op = SdkHttpOperation.build {
serializer = ListMemberAccountsOperationSerializer()
deserializer = ListMemberAccountsOperationDeserializer()
context {
expectedHttpStatus = 200
service = serviceName
operationName = "ListMemberAccounts"
}
}
op.execution.retryStrategy = config.retryStrategy
op.execution.retryPolicy = AwsDefaultRetryPolicy
mergeServiceDefaults(op.context)
op.interceptors.add(ResolveEndpoint(config.endpointProvider) {
bindAwsBuiltins(config)
})
op.install(AwsRetryHeaderMiddleware())
op.install(AwsJsonProtocol("MacieService", "1.1"))
op.install(UserAgent(awsUserAgentMetadata))
op.install(RecursionDetection())
op.execution.signer = AwsHttpSigner {
this.signer = config.signer
this.credentialsProvider = config.credentialsProvider
this.service = "macie"
}
op.interceptors.addAll(config.interceptors)
val rootSpan = config.tracer.createRootSpan("ListMemberAccounts-${op.context.sdkRequestId}")
return coroutineContext.withRootTraceSpan(rootSpan) {
op.roundTrip(client, input)
}
}
/**
* (Discontinued) Lists all the S3 resources associated with Amazon Macie Classic. If `memberAccountId` isn't specified, the action lists the S3 resources associated with Macie Classic for the current Macie Classic administrator account. If `memberAccountId` is specified, the action lists the S3 resources associated with Macie Classic for the specified member account.
*/
override suspend fun listS3Resources(input: ListS3ResourcesRequest): ListS3ResourcesResponse {
val op = SdkHttpOperation.build {
serializer = ListS3ResourcesOperationSerializer()
deserializer = ListS3ResourcesOperationDeserializer()
context {
expectedHttpStatus = 200
service = serviceName
operationName = "ListS3Resources"
}
}
op.execution.retryStrategy = config.retryStrategy
op.execution.retryPolicy = AwsDefaultRetryPolicy
mergeServiceDefaults(op.context)
op.interceptors.add(ResolveEndpoint(config.endpointProvider) {
bindAwsBuiltins(config)
})
op.install(AwsRetryHeaderMiddleware())
op.install(AwsJsonProtocol("MacieService", "1.1"))
op.install(UserAgent(awsUserAgentMetadata))
op.install(RecursionDetection())
op.execution.signer = AwsHttpSigner {
this.signer = config.signer
this.credentialsProvider = config.credentialsProvider
this.service = "macie"
}
op.interceptors.addAll(config.interceptors)
val rootSpan = config.tracer.createRootSpan("ListS3Resources-${op.context.sdkRequestId}")
return coroutineContext.withRootTraceSpan(rootSpan) {
op.roundTrip(client, input)
}
}
/**
* (Discontinued) Updates the classification types for the specified S3 resources. If `memberAccountId` isn't specified, the action updates the classification types of the S3 resources associated with Amazon Macie Classic for the current Macie Classic administrator account. If `memberAccountId` is specified, the action updates the classification types of the S3 resources associated with Macie Classic for the specified member account.
*/
override suspend fun updateS3Resources(input: UpdateS3ResourcesRequest): UpdateS3ResourcesResponse {
val op = SdkHttpOperation.build {
serializer = UpdateS3ResourcesOperationSerializer()
deserializer = UpdateS3ResourcesOperationDeserializer()
context {
expectedHttpStatus = 200
service = serviceName
operationName = "UpdateS3Resources"
}
}
op.execution.retryStrategy = config.retryStrategy
op.execution.retryPolicy = AwsDefaultRetryPolicy
mergeServiceDefaults(op.context)
op.interceptors.add(ResolveEndpoint(config.endpointProvider) {
bindAwsBuiltins(config)
})
op.install(AwsRetryHeaderMiddleware())
op.install(AwsJsonProtocol("MacieService", "1.1"))
op.install(UserAgent(awsUserAgentMetadata))
op.install(RecursionDetection())
op.execution.signer = AwsHttpSigner {
this.signer = config.signer
this.credentialsProvider = config.credentialsProvider
this.service = "macie"
}
op.interceptors.addAll(config.interceptors)
val rootSpan = config.tracer.createRootSpan("UpdateS3Resources-${op.context.sdkRequestId}")
return coroutineContext.withRootTraceSpan(rootSpan) {
op.roundTrip(client, input)
}
}
override fun close() {
client.close()
(config.credentialsProvider as? Closeable)?.close()
}
/**
* merge the defaults configured for the service into the execution context before firing off a request
*/
private suspend fun mergeServiceDefaults(ctx: ExecutionContext) {
ctx.putIfAbsent(AwsClientOption.Region, config.region)
ctx.putIfAbsent(SdkClientOption.ServiceName, serviceName)
ctx.putIfAbsent(SdkClientOption.LogMode, config.sdkLogMode)
ctx.putIfAbsent(AwsSigningAttributes.SigningService, "macie")
ctx.putIfAbsent(AwsSigningAttributes.Signer, config.signer)
ctx.putIfAbsent(AwsSigningAttributes.SigningRegion, config.region)
ctx.putIfAbsent(AwsSigningAttributes.CredentialsProvider, config.credentialsProvider)
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy