zio.aws.workmail.model.UpdateImpersonationRoleRequest.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of zio-aws-workmail_2.12 Show documentation
Show all versions of zio-aws-workmail_2.12 Show documentation
Low-level AWS wrapper for ZIO
package zio.aws.workmail.model
import zio.aws.workmail.model.primitives.{
ImpersonationRoleDescription,
ImpersonationRoleName,
ImpersonationRoleId,
OrganizationId
}
import zio.ZIO
import zio.aws.core.{AwsError, BuilderHelper}
import zio.prelude.data.Optional
import scala.jdk.CollectionConverters._
final case class UpdateImpersonationRoleRequest(
organizationId: OrganizationId,
impersonationRoleId: ImpersonationRoleId,
name: ImpersonationRoleName,
`type`: zio.aws.workmail.model.ImpersonationRoleType,
description: Optional[ImpersonationRoleDescription] = Optional.Absent,
rules: Iterable[zio.aws.workmail.model.ImpersonationRule]
) {
def buildAwsValue()
: software.amazon.awssdk.services.workmail.model.UpdateImpersonationRoleRequest = {
import UpdateImpersonationRoleRequest.zioAwsBuilderHelper.BuilderOps
software.amazon.awssdk.services.workmail.model.UpdateImpersonationRoleRequest
.builder()
.organizationId(OrganizationId.unwrap(organizationId): java.lang.String)
.impersonationRoleId(
ImpersonationRoleId.unwrap(impersonationRoleId): java.lang.String
)
.name(ImpersonationRoleName.unwrap(name): java.lang.String)
.`type`(`type`.unwrap)
.optionallyWith(
description.map(value =>
ImpersonationRoleDescription.unwrap(value): java.lang.String
)
)(_.description)
.rules(rules.map { item =>
item.buildAwsValue()
}.asJavaCollection)
.build()
}
def asReadOnly
: zio.aws.workmail.model.UpdateImpersonationRoleRequest.ReadOnly =
zio.aws.workmail.model.UpdateImpersonationRoleRequest.wrap(buildAwsValue())
}
object UpdateImpersonationRoleRequest {
private lazy val zioAwsBuilderHelper: BuilderHelper[
software.amazon.awssdk.services.workmail.model.UpdateImpersonationRoleRequest
] = BuilderHelper.apply
trait ReadOnly {
def asEditable: zio.aws.workmail.model.UpdateImpersonationRoleRequest =
zio.aws.workmail.model.UpdateImpersonationRoleRequest(
organizationId,
impersonationRoleId,
name,
`type`,
description.map(value => value),
rules.map { item =>
item.asEditable
}
)
def organizationId: OrganizationId
def impersonationRoleId: ImpersonationRoleId
def name: ImpersonationRoleName
def `type`: zio.aws.workmail.model.ImpersonationRoleType
def description: Optional[ImpersonationRoleDescription]
def rules: List[zio.aws.workmail.model.ImpersonationRule.ReadOnly]
def getOrganizationId: ZIO[Any, Nothing, OrganizationId] =
ZIO.succeed(organizationId)
def getImpersonationRoleId: ZIO[Any, Nothing, ImpersonationRoleId] =
ZIO.succeed(impersonationRoleId)
def getName: ZIO[Any, Nothing, ImpersonationRoleName] = ZIO.succeed(name)
def getType
: ZIO[Any, Nothing, zio.aws.workmail.model.ImpersonationRoleType] =
ZIO.succeed(`type`)
def getDescription: ZIO[Any, AwsError, ImpersonationRoleDescription] =
AwsError.unwrapOptionField("description", description)
def getRules: ZIO[Any, Nothing, List[
zio.aws.workmail.model.ImpersonationRule.ReadOnly
]] = ZIO.succeed(rules)
}
private final class Wrapper(
impl: software.amazon.awssdk.services.workmail.model.UpdateImpersonationRoleRequest
) extends zio.aws.workmail.model.UpdateImpersonationRoleRequest.ReadOnly {
override val organizationId: OrganizationId =
zio.aws.workmail.model.primitives.OrganizationId(impl.organizationId())
override val impersonationRoleId: ImpersonationRoleId =
zio.aws.workmail.model.primitives
.ImpersonationRoleId(impl.impersonationRoleId())
override val name: ImpersonationRoleName =
zio.aws.workmail.model.primitives.ImpersonationRoleName(impl.name())
override val `type`: zio.aws.workmail.model.ImpersonationRoleType =
zio.aws.workmail.model.ImpersonationRoleType.wrap(impl.`type`())
override val description: Optional[ImpersonationRoleDescription] =
zio.aws.core.internal
.optionalFromNullable(impl.description())
.map(value =>
zio.aws.workmail.model.primitives.ImpersonationRoleDescription(value)
)
override val rules
: List[zio.aws.workmail.model.ImpersonationRule.ReadOnly] = impl
.rules()
.asScala
.map { item =>
zio.aws.workmail.model.ImpersonationRule.wrap(item)
}
.toList
}
def wrap(
impl: software.amazon.awssdk.services.workmail.model.UpdateImpersonationRoleRequest
): zio.aws.workmail.model.UpdateImpersonationRoleRequest.ReadOnly =
new Wrapper(impl)
}