commonMain.aws.sdk.kotlin.services.comprehend.model.PutResourcePolicyRequest.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of comprehend-jvm Show documentation
Show all versions of comprehend-jvm Show documentation
The AWS SDK for Kotlin client for Comprehend
// Code generated by smithy-kotlin-codegen. DO NOT EDIT!
package aws.sdk.kotlin.services.comprehend.model
import aws.smithy.kotlin.runtime.SdkDsl
public class PutResourcePolicyRequest private constructor(builder: Builder) {
/**
* The revision ID that Amazon Comprehend assigned to the policy that you are updating. If you are creating a new policy that has no prior version, don't use this parameter. Amazon Comprehend creates the revision ID for you.
*/
public val policyRevisionId: kotlin.String? = builder.policyRevisionId
/**
* The Amazon Resource Name (ARN) of the custom model to attach the policy to.
*/
public val resourceArn: kotlin.String? = builder.resourceArn
/**
* The JSON resource-based policy to attach to your custom model. Provide your JSON as a UTF-8 encoded string without line breaks. To provide valid JSON for your policy, enclose the attribute names and values in double quotes. If the JSON body is also enclosed in double quotes, then you must escape the double quotes that are inside the policy:
*
* `"{\"attribute\": \"value\", \"attribute\": [\"value\"]}"`
*
* To avoid escaping quotes, you can use single quotes to enclose the policy and double quotes to enclose the JSON names and values:
*
* `'{"attribute": "value", "attribute": ["value"]}'`
*/
public val resourcePolicy: kotlin.String? = builder.resourcePolicy
public companion object {
public operator fun invoke(block: Builder.() -> kotlin.Unit): aws.sdk.kotlin.services.comprehend.model.PutResourcePolicyRequest = Builder().apply(block).build()
}
override fun toString(): kotlin.String = buildString {
append("PutResourcePolicyRequest(")
append("policyRevisionId=$policyRevisionId,")
append("resourceArn=$resourceArn,")
append("resourcePolicy=$resourcePolicy")
append(")")
}
override fun hashCode(): kotlin.Int {
var result = policyRevisionId?.hashCode() ?: 0
result = 31 * result + (resourceArn?.hashCode() ?: 0)
result = 31 * result + (resourcePolicy?.hashCode() ?: 0)
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 PutResourcePolicyRequest
if (policyRevisionId != other.policyRevisionId) return false
if (resourceArn != other.resourceArn) return false
if (resourcePolicy != other.resourcePolicy) return false
return true
}
public inline fun copy(block: Builder.() -> kotlin.Unit = {}): aws.sdk.kotlin.services.comprehend.model.PutResourcePolicyRequest = Builder(this).apply(block).build()
@SdkDsl
public class Builder {
/**
* The revision ID that Amazon Comprehend assigned to the policy that you are updating. If you are creating a new policy that has no prior version, don't use this parameter. Amazon Comprehend creates the revision ID for you.
*/
public var policyRevisionId: kotlin.String? = null
/**
* The Amazon Resource Name (ARN) of the custom model to attach the policy to.
*/
public var resourceArn: kotlin.String? = null
/**
* The JSON resource-based policy to attach to your custom model. Provide your JSON as a UTF-8 encoded string without line breaks. To provide valid JSON for your policy, enclose the attribute names and values in double quotes. If the JSON body is also enclosed in double quotes, then you must escape the double quotes that are inside the policy:
*
* `"{\"attribute\": \"value\", \"attribute\": [\"value\"]}"`
*
* To avoid escaping quotes, you can use single quotes to enclose the policy and double quotes to enclose the JSON names and values:
*
* `'{"attribute": "value", "attribute": ["value"]}'`
*/
public var resourcePolicy: kotlin.String? = null
@PublishedApi
internal constructor()
@PublishedApi
internal constructor(x: aws.sdk.kotlin.services.comprehend.model.PutResourcePolicyRequest) : this() {
this.policyRevisionId = x.policyRevisionId
this.resourceArn = x.resourceArn
this.resourcePolicy = x.resourcePolicy
}
@PublishedApi
internal fun build(): aws.sdk.kotlin.services.comprehend.model.PutResourcePolicyRequest = PutResourcePolicyRequest(this)
internal fun correctErrors(): Builder {
return this
}
}
}