
commonMain.aws.sdk.kotlin.services.iam.model.Role.kt Maven / Gradle / Ivy
// Code generated by smithy-kotlin-codegen. DO NOT EDIT!
package aws.sdk.kotlin.services.iam.model
import aws.smithy.kotlin.runtime.time.Instant
/**
* Contains information about an IAM role. This structure is returned as a response element in several API operations that interact with roles.
*/
public class Role private constructor(builder: Builder) {
/**
* The Amazon Resource Name (ARN) specifying the role. For more information about ARNs and how to use them in policies, see [IAM identifiers](https://docs.aws.amazon.com/IAM/latest/UserGuide/Using_Identifiers.html) in the *IAM User Guide* guide.
*/
public val arn: kotlin.String = requireNotNull(builder.arn) { "A non-null value must be provided for arn" }
/**
* The policy that grants an entity permission to assume the role.
*/
public val assumeRolePolicyDocument: kotlin.String? = builder.assumeRolePolicyDocument
/**
* The date and time, in [ISO 8601 date-time format](http://www.iso.org/iso/iso8601), when the role was created.
*/
public val createDate: aws.smithy.kotlin.runtime.time.Instant = requireNotNull(builder.createDate) { "A non-null value must be provided for createDate" }
/**
* A description of the role that you provide.
*/
public val description: kotlin.String? = builder.description
/**
* The maximum session duration (in seconds) for the specified role. Anyone who uses the CLI, or API to assume the role can specify the duration using the optional `DurationSeconds` API parameter or `duration-seconds` CLI parameter.
*/
public val maxSessionDuration: kotlin.Int? = builder.maxSessionDuration
/**
* The path to the role. For more information about paths, see [IAM identifiers](https://docs.aws.amazon.com/IAM/latest/UserGuide/Using_Identifiers.html) in the *IAM User Guide*.
*/
public val path: kotlin.String = requireNotNull(builder.path) { "A non-null value must be provided for path" }
/**
* The ARN of the policy used to set the permissions boundary for the role.
*
* For more information about permissions boundaries, see [Permissions boundaries for IAM identities ](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_boundaries.html) in the *IAM User Guide*.
*/
public val permissionsBoundary: aws.sdk.kotlin.services.iam.model.AttachedPermissionsBoundary? = builder.permissionsBoundary
/**
* The stable and unique string identifying the role. For more information about IDs, see [IAM identifiers](https://docs.aws.amazon.com/IAM/latest/UserGuide/Using_Identifiers.html) in the *IAM User Guide*.
*/
public val roleId: kotlin.String = requireNotNull(builder.roleId) { "A non-null value must be provided for roleId" }
/**
* Contains information about the last time that an IAM role was used. This includes the date and time and the Region in which the role was last used. Activity is only reported for the trailing 400 days. This period can be shorter if your Region began supporting these features within the last year. The role might have been used more than 400 days ago. For more information, see [Regions where data is tracked](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_access-advisor.html#access-advisor_tracking-period) in the *IAM user Guide*.
*/
public val roleLastUsed: aws.sdk.kotlin.services.iam.model.RoleLastUsed? = builder.roleLastUsed
/**
* The friendly name that identifies the role.
*/
public val roleName: kotlin.String = requireNotNull(builder.roleName) { "A non-null value must be provided for roleName" }
/**
* A list of tags that are attached to the role. For more information about tagging, see [Tagging IAM resources](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_tags.html) in the *IAM User Guide*.
*/
public val tags: List? = builder.tags
public companion object {
public operator fun invoke(block: Builder.() -> kotlin.Unit): aws.sdk.kotlin.services.iam.model.Role = Builder().apply(block).build()
}
override fun toString(): kotlin.String = buildString {
append("Role(")
append("arn=$arn,")
append("assumeRolePolicyDocument=$assumeRolePolicyDocument,")
append("createDate=$createDate,")
append("description=$description,")
append("maxSessionDuration=$maxSessionDuration,")
append("path=$path,")
append("permissionsBoundary=$permissionsBoundary,")
append("roleId=$roleId,")
append("roleLastUsed=$roleLastUsed,")
append("roleName=$roleName,")
append("tags=$tags")
append(")")
}
override fun hashCode(): kotlin.Int {
var result = arn.hashCode()
result = 31 * result + (assumeRolePolicyDocument?.hashCode() ?: 0)
result = 31 * result + (createDate.hashCode())
result = 31 * result + (description?.hashCode() ?: 0)
result = 31 * result + (maxSessionDuration ?: 0)
result = 31 * result + (path.hashCode())
result = 31 * result + (permissionsBoundary?.hashCode() ?: 0)
result = 31 * result + (roleId.hashCode())
result = 31 * result + (roleLastUsed?.hashCode() ?: 0)
result = 31 * result + (roleName.hashCode())
result = 31 * result + (tags?.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 Role
if (arn != other.arn) return false
if (assumeRolePolicyDocument != other.assumeRolePolicyDocument) return false
if (createDate != other.createDate) return false
if (description != other.description) return false
if (maxSessionDuration != other.maxSessionDuration) return false
if (path != other.path) return false
if (permissionsBoundary != other.permissionsBoundary) return false
if (roleId != other.roleId) return false
if (roleLastUsed != other.roleLastUsed) return false
if (roleName != other.roleName) return false
if (tags != other.tags) return false
return true
}
public inline fun copy(block: Builder.() -> kotlin.Unit = {}): aws.sdk.kotlin.services.iam.model.Role = Builder(this).apply(block).build()
public class Builder {
/**
* The Amazon Resource Name (ARN) specifying the role. For more information about ARNs and how to use them in policies, see [IAM identifiers](https://docs.aws.amazon.com/IAM/latest/UserGuide/Using_Identifiers.html) in the *IAM User Guide* guide.
*/
public var arn: kotlin.String? = null
/**
* The policy that grants an entity permission to assume the role.
*/
public var assumeRolePolicyDocument: kotlin.String? = null
/**
* The date and time, in [ISO 8601 date-time format](http://www.iso.org/iso/iso8601), when the role was created.
*/
public var createDate: aws.smithy.kotlin.runtime.time.Instant? = null
/**
* A description of the role that you provide.
*/
public var description: kotlin.String? = null
/**
* The maximum session duration (in seconds) for the specified role. Anyone who uses the CLI, or API to assume the role can specify the duration using the optional `DurationSeconds` API parameter or `duration-seconds` CLI parameter.
*/
public var maxSessionDuration: kotlin.Int? = null
/**
* The path to the role. For more information about paths, see [IAM identifiers](https://docs.aws.amazon.com/IAM/latest/UserGuide/Using_Identifiers.html) in the *IAM User Guide*.
*/
public var path: kotlin.String? = null
/**
* The ARN of the policy used to set the permissions boundary for the role.
*
* For more information about permissions boundaries, see [Permissions boundaries for IAM identities ](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_boundaries.html) in the *IAM User Guide*.
*/
public var permissionsBoundary: aws.sdk.kotlin.services.iam.model.AttachedPermissionsBoundary? = null
/**
* The stable and unique string identifying the role. For more information about IDs, see [IAM identifiers](https://docs.aws.amazon.com/IAM/latest/UserGuide/Using_Identifiers.html) in the *IAM User Guide*.
*/
public var roleId: kotlin.String? = null
/**
* Contains information about the last time that an IAM role was used. This includes the date and time and the Region in which the role was last used. Activity is only reported for the trailing 400 days. This period can be shorter if your Region began supporting these features within the last year. The role might have been used more than 400 days ago. For more information, see [Regions where data is tracked](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_access-advisor.html#access-advisor_tracking-period) in the *IAM user Guide*.
*/
public var roleLastUsed: aws.sdk.kotlin.services.iam.model.RoleLastUsed? = null
/**
* The friendly name that identifies the role.
*/
public var roleName: kotlin.String? = null
/**
* A list of tags that are attached to the role. For more information about tagging, see [Tagging IAM resources](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_tags.html) in the *IAM User Guide*.
*/
public var tags: List? = null
@PublishedApi
internal constructor()
@PublishedApi
internal constructor(x: aws.sdk.kotlin.services.iam.model.Role) : this() {
this.arn = x.arn
this.assumeRolePolicyDocument = x.assumeRolePolicyDocument
this.createDate = x.createDate
this.description = x.description
this.maxSessionDuration = x.maxSessionDuration
this.path = x.path
this.permissionsBoundary = x.permissionsBoundary
this.roleId = x.roleId
this.roleLastUsed = x.roleLastUsed
this.roleName = x.roleName
this.tags = x.tags
}
@PublishedApi
internal fun build(): aws.sdk.kotlin.services.iam.model.Role = Role(this)
/**
* construct an [aws.sdk.kotlin.services.iam.model.AttachedPermissionsBoundary] inside the given [block]
*/
public fun permissionsBoundary(block: aws.sdk.kotlin.services.iam.model.AttachedPermissionsBoundary.Builder.() -> kotlin.Unit) {
this.permissionsBoundary = aws.sdk.kotlin.services.iam.model.AttachedPermissionsBoundary.invoke(block)
}
/**
* construct an [aws.sdk.kotlin.services.iam.model.RoleLastUsed] inside the given [block]
*/
public fun roleLastUsed(block: aws.sdk.kotlin.services.iam.model.RoleLastUsed.Builder.() -> kotlin.Unit) {
this.roleLastUsed = aws.sdk.kotlin.services.iam.model.RoleLastUsed.invoke(block)
}
internal fun correctErrors(): Builder {
if (arn == null) arn = ""
if (createDate == null) createDate = Instant.fromEpochSeconds(0)
if (path == null) path = ""
if (roleId == null) roleId = ""
if (roleName == null) roleName = ""
return this
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy