
commonMain.aws.sdk.kotlin.services.dynamodb.model.Update.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 an `UpdateItem` operation.
*/
public class Update 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
/**
* The primary key of the item to be updated. Each element consists of an attribute name and a value for that attribute.
*/
public val key: Map = requireNotNull(builder.key) { "A non-null value must be provided for key" }
/**
* Use `ReturnValuesOnConditionCheckFailure` to get the item attributes if the `Update` 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 for the `UpdateItem` request.
*/
public val tableName: kotlin.String = requireNotNull(builder.tableName) { "A non-null value must be provided for tableName" }
/**
* An expression that defines one or more attributes to be updated, the action to be performed on them, and new value(s) for them.
*/
public val updateExpression: kotlin.String = requireNotNull(builder.updateExpression) { "A non-null value must be provided for updateExpression" }
public companion object {
public operator fun invoke(block: Builder.() -> kotlin.Unit): aws.sdk.kotlin.services.dynamodb.model.Update = Builder().apply(block).build()
}
override fun toString(): kotlin.String = buildString {
append("Update(")
append("conditionExpression=$conditionExpression,")
append("expressionAttributeNames=$expressionAttributeNames,")
append("expressionAttributeValues=$expressionAttributeValues,")
append("key=$key,")
append("returnValuesOnConditionCheckFailure=$returnValuesOnConditionCheckFailure,")
append("tableName=$tableName,")
append("updateExpression=$updateExpression")
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 + (key.hashCode())
result = 31 * result + (returnValuesOnConditionCheckFailure?.hashCode() ?: 0)
result = 31 * result + (tableName.hashCode())
result = 31 * result + (updateExpression.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 Update
if (conditionExpression != other.conditionExpression) return false
if (expressionAttributeNames != other.expressionAttributeNames) return false
if (expressionAttributeValues != other.expressionAttributeValues) return false
if (key != other.key) return false
if (returnValuesOnConditionCheckFailure != other.returnValuesOnConditionCheckFailure) return false
if (tableName != other.tableName) return false
if (updateExpression != other.updateExpression) return false
return true
}
public inline fun copy(block: Builder.() -> kotlin.Unit = {}): aws.sdk.kotlin.services.dynamodb.model.Update = 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
/**
* The primary key of the item to be updated. Each element consists of an attribute name and a value for that attribute.
*/
public var key: Map? = null
/**
* Use `ReturnValuesOnConditionCheckFailure` to get the item attributes if the `Update` 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 for the `UpdateItem` request.
*/
public var tableName: kotlin.String? = null
/**
* An expression that defines one or more attributes to be updated, the action to be performed on them, and new value(s) for them.
*/
public var updateExpression: kotlin.String? = null
@PublishedApi
internal constructor()
@PublishedApi
internal constructor(x: aws.sdk.kotlin.services.dynamodb.model.Update) : this() {
this.conditionExpression = x.conditionExpression
this.expressionAttributeNames = x.expressionAttributeNames
this.expressionAttributeValues = x.expressionAttributeValues
this.key = x.key
this.returnValuesOnConditionCheckFailure = x.returnValuesOnConditionCheckFailure
this.tableName = x.tableName
this.updateExpression = x.updateExpression
}
@PublishedApi
internal fun build(): aws.sdk.kotlin.services.dynamodb.model.Update = Update(this)
internal fun correctErrors(): Builder {
if (key == null) key = emptyMap()
if (tableName == null) tableName = ""
if (updateExpression == null) updateExpression = ""
return this
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy