commonMain.aws.sdk.kotlin.hll.dynamodbmapper.operations.DeleteItem.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of dynamodb-mapper-jvm Show documentation
Show all versions of dynamodb-mapper-jvm Show documentation
High level DynamoDbMapper client
// Code generated by dynamodb-mapper-ops-codegen. DO NOT EDIT!
package aws.sdk.kotlin.hll.dynamodbmapper.operations
import aws.sdk.kotlin.hll.dynamodbmapper.expressions.internal.ParameterizingExpressionVisitor
import aws.sdk.kotlin.hll.dynamodbmapper.internal.withWrappedClient
import aws.sdk.kotlin.hll.dynamodbmapper.items.ItemSchema
import aws.sdk.kotlin.hll.dynamodbmapper.model.TableSpec
import aws.sdk.kotlin.hll.dynamodbmapper.model.toItem
import aws.sdk.kotlin.hll.dynamodbmapper.pipeline.internal.HReqContextImpl
import aws.sdk.kotlin.hll.dynamodbmapper.pipeline.internal.MapperContextImpl
import aws.sdk.kotlin.hll.dynamodbmapper.pipeline.internal.Operation
import aws.sdk.kotlin.services.dynamodb.model.ConsumedCapacity
import aws.sdk.kotlin.services.dynamodb.model.ItemCollectionMetrics
import aws.sdk.kotlin.services.dynamodb.model.ReturnConsumedCapacity
import aws.sdk.kotlin.services.dynamodb.model.ReturnItemCollectionMetrics
import aws.sdk.kotlin.services.dynamodb.model.ReturnValue
import aws.sdk.kotlin.services.dynamodb.model.ReturnValuesOnConditionCheckFailure
import aws.smithy.kotlin.runtime.ExperimentalApi
import aws.sdk.kotlin.services.dynamodb.model.DeleteItemRequest as LowLevelDeleteItemRequest
import aws.sdk.kotlin.services.dynamodb.model.DeleteItemResponse as LowLevelDeleteItemResponse
@ExperimentalApi
public interface DeleteItemRequest {
@ExperimentalApi
public companion object { }
public val key: T?
public val returnConsumedCapacity: ReturnConsumedCapacity?
public val returnItemCollectionMetrics: ReturnItemCollectionMetrics?
public val returnValues: ReturnValue?
public val returnValuesOnConditionCheckFailure: ReturnValuesOnConditionCheckFailure?
}
private data class DeleteItemRequestImpl(
override val key: T?,
override val returnConsumedCapacity: ReturnConsumedCapacity?,
override val returnItemCollectionMetrics: ReturnItemCollectionMetrics?,
override val returnValues: ReturnValue?,
override val returnValuesOnConditionCheckFailure: ReturnValuesOnConditionCheckFailure?,
): DeleteItemRequest
/**
* A DSL-style builder for instances of [DeleteItemRequest]
*/
@ExperimentalApi
public class DeleteItemRequestBuilder {
public var key: T? = null
public var returnConsumedCapacity: ReturnConsumedCapacity? = null
public var returnItemCollectionMetrics: ReturnItemCollectionMetrics? = null
public var returnValues: ReturnValue? = null
public var returnValuesOnConditionCheckFailure: ReturnValuesOnConditionCheckFailure? = null
public fun build(): DeleteItemRequest {
val key = key
val returnConsumedCapacity = returnConsumedCapacity
val returnItemCollectionMetrics = returnItemCollectionMetrics
val returnValues = returnValues
val returnValuesOnConditionCheckFailure = returnValuesOnConditionCheckFailure
return DeleteItemRequestImpl(
key,
returnConsumedCapacity,
returnItemCollectionMetrics,
returnValues,
returnValuesOnConditionCheckFailure,
)
}
}
@ExperimentalApi
public fun DeleteItemRequest.toBuilder(): DeleteItemRequestBuilder = DeleteItemRequestBuilder().apply {
key = [email protected]
returnConsumedCapacity = [email protected]
returnItemCollectionMetrics = [email protected]
returnValues = [email protected]
returnValuesOnConditionCheckFailure = [email protected]
}
@ExperimentalApi
public fun DeleteItemRequest.copy(block: DeleteItemRequestBuilder.() -> Unit): DeleteItemRequest =
toBuilder().apply(block).build()
@ExperimentalApi
public fun DeleteItemRequest(block: DeleteItemRequestBuilder.() -> Unit): DeleteItemRequest =
DeleteItemRequestBuilder().apply(block).build()
private fun DeleteItemRequest.convert(
tableName: String?,
schema: ItemSchema,
) = LowLevelDeleteItemRequest {
returnConsumedCapacity = [email protected]
returnItemCollectionMetrics = [email protected]
returnValues = [email protected]
returnValuesOnConditionCheckFailure = [email protected]
[email protected]?.let { key = schema.converter.convertTo(it, schema.keyAttributeNames) }
this.tableName = tableName
val expressionVisitor = ParameterizingExpressionVisitor()
expressionAttributeNames = expressionVisitor.expressionAttributeNames()
expressionAttributeValues = expressionVisitor.expressionAttributeValues()
}
@ExperimentalApi
public interface DeleteItemResponse {
@ExperimentalApi
public companion object { }
public val attributes: T?
public val consumedCapacity: ConsumedCapacity?
public val itemCollectionMetrics: ItemCollectionMetrics?
}
private data class DeleteItemResponseImpl(
override val attributes: T?,
override val consumedCapacity: ConsumedCapacity?,
override val itemCollectionMetrics: ItemCollectionMetrics?,
): DeleteItemResponse
/**
* A DSL-style builder for instances of [DeleteItemResponse]
*/
@ExperimentalApi
public class DeleteItemResponseBuilder {
public var attributes: T? = null
public var consumedCapacity: ConsumedCapacity? = null
public var itemCollectionMetrics: ItemCollectionMetrics? = null
public fun build(): DeleteItemResponse {
val attributes = attributes
val consumedCapacity = consumedCapacity
val itemCollectionMetrics = itemCollectionMetrics
return DeleteItemResponseImpl(
attributes,
consumedCapacity,
itemCollectionMetrics,
)
}
}
@ExperimentalApi
public fun DeleteItemResponse.toBuilder(): DeleteItemResponseBuilder = DeleteItemResponseBuilder().apply {
attributes = [email protected]
consumedCapacity = [email protected]
itemCollectionMetrics = [email protected]
}
@ExperimentalApi
public fun DeleteItemResponse.copy(block: DeleteItemResponseBuilder.() -> Unit): DeleteItemResponse =
toBuilder().apply(block).build()
@ExperimentalApi
public fun DeleteItemResponse(block: DeleteItemResponseBuilder.() -> Unit): DeleteItemResponse =
DeleteItemResponseBuilder().apply(block).build()
private fun LowLevelDeleteItemResponse.convert(schema: ItemSchema) = DeleteItemResponse {
consumedCapacity = [email protected]
itemCollectionMetrics = [email protected]
attributes = [email protected]?.toItem()?.let(schema.converter::convertFrom)
}
internal fun deleteItemOperation(spec: TableSpec) = Operation(
initialize = { highLevelReq: DeleteItemRequest -> HReqContextImpl(highLevelReq, spec.schema, MapperContextImpl(spec, "DeleteItem")) },
serialize = { highLevelReq, schema -> highLevelReq.convert(spec.tableName, schema) },
lowLevelInvoke = { lowLevelReq ->
spec.mapper.client.withWrappedClient { client ->
client.deleteItem(lowLevelReq)
}
},
deserialize = LowLevelDeleteItemResponse::convert,
interceptors = spec.mapper.config.interceptors,
)
© 2015 - 2024 Weber Informatics LLC | Privacy Policy