All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.aws.sdk.kotlin.services.iam.model.PolicyGrantingServiceAccess.kt Maven / Gradle / Ivy

// Code generated by smithy-kotlin-codegen. DO NOT EDIT!

package aws.sdk.kotlin.services.iam.model



/**
 * Contains details about the permissions policies that are attached to the specified identity (user, group, or role).
 *
 * This data type is an element of the ListPoliciesGrantingServiceAccessEntry object.
 */
public class PolicyGrantingServiceAccess private constructor(builder: Builder) {
    /**
     * The name of the entity (user or role) to which the inline policy is attached.
     *
     * This field is null for managed policies. For more information about these policy types, see [Managed policies and inline policies](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_managed-vs-inline.html) in the *IAM User Guide*.
     */
    public val entityName: kotlin.String? = builder.entityName
    /**
     * The type of entity (user or role) that used the policy to access the service to which the inline policy is attached.
     *
     * This field is null for managed policies. For more information about these policy types, see [Managed policies and inline policies](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_managed-vs-inline.html) in the *IAM User Guide*.
     */
    public val entityType: aws.sdk.kotlin.services.iam.model.PolicyOwnerEntityType? = builder.entityType
    /**
     * The Amazon Resource Name (ARN). ARNs are unique identifiers for Amazon Web Services resources.
     *
     * For more information about ARNs, go to [Amazon Resource Names (ARNs)](https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html) in the *Amazon Web Services General Reference*.
     */
    public val policyArn: kotlin.String? = builder.policyArn
    /**
     * The policy name.
     */
    public val policyName: kotlin.String = requireNotNull(builder.policyName) { "A non-null value must be provided for policyName" }
    /**
     * The policy type. For more information about these policy types, see [Managed policies and inline policies](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_managed-vs-inline.html) in the *IAM User Guide*.
     */
    public val policyType: aws.sdk.kotlin.services.iam.model.PolicyType = requireNotNull(builder.policyType) { "A non-null value must be provided for policyType" }

    public companion object {
        public operator fun invoke(block: Builder.() -> kotlin.Unit): aws.sdk.kotlin.services.iam.model.PolicyGrantingServiceAccess = Builder().apply(block).build()
    }

    override fun toString(): kotlin.String = buildString {
        append("PolicyGrantingServiceAccess(")
        append("entityName=$entityName,")
        append("entityType=$entityType,")
        append("policyArn=$policyArn,")
        append("policyName=$policyName,")
        append("policyType=$policyType")
        append(")")
    }

    override fun hashCode(): kotlin.Int {
        var result = entityName?.hashCode() ?: 0
        result = 31 * result + (entityType?.hashCode() ?: 0)
        result = 31 * result + (policyArn?.hashCode() ?: 0)
        result = 31 * result + (policyName.hashCode())
        result = 31 * result + (policyType.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 PolicyGrantingServiceAccess

        if (entityName != other.entityName) return false
        if (entityType != other.entityType) return false
        if (policyArn != other.policyArn) return false
        if (policyName != other.policyName) return false
        if (policyType != other.policyType) return false

        return true
    }

    public inline fun copy(block: Builder.() -> kotlin.Unit = {}): aws.sdk.kotlin.services.iam.model.PolicyGrantingServiceAccess = Builder(this).apply(block).build()

    public class Builder {
        /**
         * The name of the entity (user or role) to which the inline policy is attached.
         *
         * This field is null for managed policies. For more information about these policy types, see [Managed policies and inline policies](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_managed-vs-inline.html) in the *IAM User Guide*.
         */
        public var entityName: kotlin.String? = null
        /**
         * The type of entity (user or role) that used the policy to access the service to which the inline policy is attached.
         *
         * This field is null for managed policies. For more information about these policy types, see [Managed policies and inline policies](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_managed-vs-inline.html) in the *IAM User Guide*.
         */
        public var entityType: aws.sdk.kotlin.services.iam.model.PolicyOwnerEntityType? = null
        /**
         * The Amazon Resource Name (ARN). ARNs are unique identifiers for Amazon Web Services resources.
         *
         * For more information about ARNs, go to [Amazon Resource Names (ARNs)](https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html) in the *Amazon Web Services General Reference*.
         */
        public var policyArn: kotlin.String? = null
        /**
         * The policy name.
         */
        public var policyName: kotlin.String? = null
        /**
         * The policy type. For more information about these policy types, see [Managed policies and inline policies](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_managed-vs-inline.html) in the *IAM User Guide*.
         */
        public var policyType: aws.sdk.kotlin.services.iam.model.PolicyType? = null

        @PublishedApi
        internal constructor()
        @PublishedApi
        internal constructor(x: aws.sdk.kotlin.services.iam.model.PolicyGrantingServiceAccess) : this() {
            this.entityName = x.entityName
            this.entityType = x.entityType
            this.policyArn = x.policyArn
            this.policyName = x.policyName
            this.policyType = x.policyType
        }

        @PublishedApi
        internal fun build(): aws.sdk.kotlin.services.iam.model.PolicyGrantingServiceAccess = PolicyGrantingServiceAccess(this)

        internal fun correctErrors(): Builder {
            if (policyName == null) policyName = ""
            if (policyType == null) policyType = PolicyType.SdkUnknown("no value provided")
            return this
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy