zio.aws.workmail.model.ImpersonationRole.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 java.time.Instant
import zio.prelude.data.Optional
import zio.aws.core.{AwsError, BuilderHelper}
import zio.ZIO
import zio.aws.workmail.model.primitives.{
Timestamp,
ImpersonationRoleName,
ImpersonationRoleId
}
import scala.jdk.CollectionConverters._
final case class ImpersonationRole(
impersonationRoleId: Optional[ImpersonationRoleId] = Optional.Absent,
name: Optional[ImpersonationRoleName] = Optional.Absent,
`type`: Optional[zio.aws.workmail.model.ImpersonationRoleType] =
Optional.Absent,
dateCreated: Optional[Timestamp] = Optional.Absent,
dateModified: Optional[Timestamp] = Optional.Absent
) {
def buildAwsValue()
: software.amazon.awssdk.services.workmail.model.ImpersonationRole = {
import ImpersonationRole.zioAwsBuilderHelper.BuilderOps
software.amazon.awssdk.services.workmail.model.ImpersonationRole
.builder()
.optionallyWith(
impersonationRoleId.map(value =>
ImpersonationRoleId.unwrap(value): java.lang.String
)
)(_.impersonationRoleId)
.optionallyWith(
name.map(value => ImpersonationRoleName.unwrap(value): java.lang.String)
)(_.name)
.optionallyWith(`type`.map(value => value.unwrap))(_.`type`)
.optionallyWith(
dateCreated.map(value => Timestamp.unwrap(value): Instant)
)(_.dateCreated)
.optionallyWith(
dateModified.map(value => Timestamp.unwrap(value): Instant)
)(_.dateModified)
.build()
}
def asReadOnly: zio.aws.workmail.model.ImpersonationRole.ReadOnly =
zio.aws.workmail.model.ImpersonationRole.wrap(buildAwsValue())
}
object ImpersonationRole {
private lazy val zioAwsBuilderHelper: BuilderHelper[
software.amazon.awssdk.services.workmail.model.ImpersonationRole
] = BuilderHelper.apply
trait ReadOnly {
def asEditable: zio.aws.workmail.model.ImpersonationRole =
zio.aws.workmail.model.ImpersonationRole(
impersonationRoleId.map(value => value),
name.map(value => value),
`type`.map(value => value),
dateCreated.map(value => value),
dateModified.map(value => value)
)
def impersonationRoleId: Optional[ImpersonationRoleId]
def name: Optional[ImpersonationRoleName]
def `type`: Optional[zio.aws.workmail.model.ImpersonationRoleType]
def dateCreated: Optional[Timestamp]
def dateModified: Optional[Timestamp]
def getImpersonationRoleId: ZIO[Any, AwsError, ImpersonationRoleId] =
AwsError.unwrapOptionField("impersonationRoleId", impersonationRoleId)
def getName: ZIO[Any, AwsError, ImpersonationRoleName] =
AwsError.unwrapOptionField("name", name)
def getType
: ZIO[Any, AwsError, zio.aws.workmail.model.ImpersonationRoleType] =
AwsError.unwrapOptionField("type", `type`)
def getDateCreated: ZIO[Any, AwsError, Timestamp] =
AwsError.unwrapOptionField("dateCreated", dateCreated)
def getDateModified: ZIO[Any, AwsError, Timestamp] =
AwsError.unwrapOptionField("dateModified", dateModified)
}
private final class Wrapper(
impl: software.amazon.awssdk.services.workmail.model.ImpersonationRole
) extends zio.aws.workmail.model.ImpersonationRole.ReadOnly {
override val impersonationRoleId: Optional[ImpersonationRoleId] =
zio.aws.core.internal
.optionalFromNullable(impl.impersonationRoleId())
.map(value =>
zio.aws.workmail.model.primitives.ImpersonationRoleId(value)
)
override val name: Optional[ImpersonationRoleName] = zio.aws.core.internal
.optionalFromNullable(impl.name())
.map(value =>
zio.aws.workmail.model.primitives.ImpersonationRoleName(value)
)
override val `type`
: Optional[zio.aws.workmail.model.ImpersonationRoleType] =
zio.aws.core.internal
.optionalFromNullable(impl.`type`())
.map(value => zio.aws.workmail.model.ImpersonationRoleType.wrap(value))
override val dateCreated: Optional[Timestamp] = zio.aws.core.internal
.optionalFromNullable(impl.dateCreated())
.map(value => zio.aws.workmail.model.primitives.Timestamp(value))
override val dateModified: Optional[Timestamp] = zio.aws.core.internal
.optionalFromNullable(impl.dateModified())
.map(value => zio.aws.workmail.model.primitives.Timestamp(value))
}
def wrap(
impl: software.amazon.awssdk.services.workmail.model.ImpersonationRole
): zio.aws.workmail.model.ImpersonationRole.ReadOnly = new Wrapper(impl)
}