
commonMain.aws.sdk.kotlin.services.dynamodb.model.Put.kt Maven / Gradle / Ivy
// Code generated by smithy-kotlin-codegen. DO NOT EDIT!
package aws.sdk.kotlin.services.dynamodb.model
/**
* Represents a request to perform a `PutItem` operation.
*/
public class Put private constructor(builder: Builder) {
/**
* A condition that must be satisfied in order for a conditional update to succeed.
*/
public val conditionExpression: kotlin.String? = builder.conditionExpression
/**
* One or more substitution tokens for attribute names in an expression.
*/
public val expressionAttributeNames: Map? = builder.expressionAttributeNames
/**
* One or more values that can be substituted in an expression.
*/
public val expressionAttributeValues: Map? = builder.expressionAttributeValues
/**
* A map of attribute name to attribute values, representing the primary key of the item to be written by `PutItem`. All of the table's primary key attributes must be specified, and their data types must match those of the table's key schema. If any attributes are present in the item that are part of an index key schema for the table, their types must match the index key schema.
*/
public val item: Map = requireNotNull(builder.item) { "A non-null value must be provided for item" }
/**
* Use `ReturnValuesOnConditionCheckFailure` to get the item attributes if the `Put` condition fails. For `ReturnValuesOnConditionCheckFailure`, the valid values are: NONE and ALL_OLD.
*/
public val returnValuesOnConditionCheckFailure: aws.sdk.kotlin.services.dynamodb.model.ReturnValuesOnConditionCheckFailure? = builder.returnValuesOnConditionCheckFailure
/**
* Name of the table in which to write the item.
*/
public val tableName: kotlin.String = requireNotNull(builder.tableName) { "A non-null value must be provided for tableName" }
public companion object {
public operator fun invoke(block: Builder.() -> kotlin.Unit): aws.sdk.kotlin.services.dynamodb.model.Put = Builder().apply(block).build()
}
override fun toString(): kotlin.String = buildString {
append("Put(")
append("conditionExpression=$conditionExpression,")
append("expressionAttributeNames=$expressionAttributeNames,")
append("expressionAttributeValues=$expressionAttributeValues,")
append("item=$item,")
append("returnValuesOnConditionCheckFailure=$returnValuesOnConditionCheckFailure,")
append("tableName=$tableName")
append(")")
}
override fun hashCode(): kotlin.Int {
var result = conditionExpression?.hashCode() ?: 0
result = 31 * result + (expressionAttributeNames?.hashCode() ?: 0)
result = 31 * result + (expressionAttributeValues?.hashCode() ?: 0)
result = 31 * result + (item.hashCode())
result = 31 * result + (returnValuesOnConditionCheckFailure?.hashCode() ?: 0)
result = 31 * result + (tableName.hashCode())
return result
}
override fun equals(other: kotlin.Any?): kotlin.Boolean {
if (this === other) return true
if (other == null || this::class != other::class) return false
other as Put
if (conditionExpression != other.conditionExpression) return false
if (expressionAttributeNames != other.expressionAttributeNames) return false
if (expressionAttributeValues != other.expressionAttributeValues) return false
if (item != other.item) return false
if (returnValuesOnConditionCheckFailure != other.returnValuesOnConditionCheckFailure) return false
if (tableName != other.tableName) return false
return true
}
public inline fun copy(block: Builder.() -> kotlin.Unit = {}): aws.sdk.kotlin.services.dynamodb.model.Put = Builder(this).apply(block).build()
public class Builder {
/**
* A condition that must be satisfied in order for a conditional update to succeed.
*/
public var conditionExpression: kotlin.String? = null
/**
* One or more substitution tokens for attribute names in an expression.
*/
public var expressionAttributeNames: Map? = null
/**
* One or more values that can be substituted in an expression.
*/
public var expressionAttributeValues: Map? = null
/**
* A map of attribute name to attribute values, representing the primary key of the item to be written by `PutItem`. All of the table's primary key attributes must be specified, and their data types must match those of the table's key schema. If any attributes are present in the item that are part of an index key schema for the table, their types must match the index key schema.
*/
public var item: Map? = null
/**
* Use `ReturnValuesOnConditionCheckFailure` to get the item attributes if the `Put` condition fails. For `ReturnValuesOnConditionCheckFailure`, the valid values are: NONE and ALL_OLD.
*/
public var returnValuesOnConditionCheckFailure: aws.sdk.kotlin.services.dynamodb.model.ReturnValuesOnConditionCheckFailure? = null
/**
* Name of the table in which to write the item.
*/
public var tableName: kotlin.String? = null
@PublishedApi
internal constructor()
@PublishedApi
internal constructor(x: aws.sdk.kotlin.services.dynamodb.model.Put) : this() {
this.conditionExpression = x.conditionExpression
this.expressionAttributeNames = x.expressionAttributeNames
this.expressionAttributeValues = x.expressionAttributeValues
this.item = x.item
this.returnValuesOnConditionCheckFailure = x.returnValuesOnConditionCheckFailure
this.tableName = x.tableName
}
@PublishedApi
internal fun build(): aws.sdk.kotlin.services.dynamodb.model.Put = Put(this)
internal fun correctErrors(): Builder {
if (item == null) item = emptyMap()
if (tableName == null) tableName = ""
return this
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy