zio.aws.workmail.model.ImpersonationRule.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.{
EntityIdentifier,
ImpersonationRuleDescription,
ImpersonationRuleName,
ImpersonationRuleId
}
import zio.ZIO
import zio.aws.core.{AwsError, BuilderHelper}
import zio.prelude.data.Optional
import scala.jdk.CollectionConverters._
final case class ImpersonationRule(
impersonationRuleId: ImpersonationRuleId,
name: Optional[ImpersonationRuleName] = Optional.Absent,
description: Optional[ImpersonationRuleDescription] = Optional.Absent,
effect: zio.aws.workmail.model.AccessEffect,
targetUsers: Optional[Iterable[EntityIdentifier]] = Optional.Absent,
notTargetUsers: Optional[Iterable[EntityIdentifier]] = Optional.Absent
) {
def buildAwsValue()
: software.amazon.awssdk.services.workmail.model.ImpersonationRule = {
import ImpersonationRule.zioAwsBuilderHelper.BuilderOps
software.amazon.awssdk.services.workmail.model.ImpersonationRule
.builder()
.impersonationRuleId(
ImpersonationRuleId.unwrap(impersonationRuleId): java.lang.String
)
.optionallyWith(
name.map(value => ImpersonationRuleName.unwrap(value): java.lang.String)
)(_.name)
.optionallyWith(
description.map(value =>
ImpersonationRuleDescription.unwrap(value): java.lang.String
)
)(_.description)
.effect(effect.unwrap)
.optionallyWith(
targetUsers.map(value =>
value.map { item =>
EntityIdentifier.unwrap(item): java.lang.String
}.asJavaCollection
)
)(_.targetUsers)
.optionallyWith(
notTargetUsers.map(value =>
value.map { item =>
EntityIdentifier.unwrap(item): java.lang.String
}.asJavaCollection
)
)(_.notTargetUsers)
.build()
}
def asReadOnly: zio.aws.workmail.model.ImpersonationRule.ReadOnly =
zio.aws.workmail.model.ImpersonationRule.wrap(buildAwsValue())
}
object ImpersonationRule {
private lazy val zioAwsBuilderHelper: BuilderHelper[
software.amazon.awssdk.services.workmail.model.ImpersonationRule
] = BuilderHelper.apply
trait ReadOnly {
def asEditable: zio.aws.workmail.model.ImpersonationRule =
zio.aws.workmail.model.ImpersonationRule(
impersonationRuleId,
name.map(value => value),
description.map(value => value),
effect,
targetUsers.map(value => value),
notTargetUsers.map(value => value)
)
def impersonationRuleId: ImpersonationRuleId
def name: Optional[ImpersonationRuleName]
def description: Optional[ImpersonationRuleDescription]
def effect: zio.aws.workmail.model.AccessEffect
def targetUsers: Optional[List[EntityIdentifier]]
def notTargetUsers: Optional[List[EntityIdentifier]]
def getImpersonationRuleId: ZIO[Any, Nothing, ImpersonationRuleId] =
ZIO.succeed(impersonationRuleId)
def getName: ZIO[Any, AwsError, ImpersonationRuleName] =
AwsError.unwrapOptionField("name", name)
def getDescription: ZIO[Any, AwsError, ImpersonationRuleDescription] =
AwsError.unwrapOptionField("description", description)
def getEffect: ZIO[Any, Nothing, zio.aws.workmail.model.AccessEffect] =
ZIO.succeed(effect)
def getTargetUsers: ZIO[Any, AwsError, List[EntityIdentifier]] =
AwsError.unwrapOptionField("targetUsers", targetUsers)
def getNotTargetUsers: ZIO[Any, AwsError, List[EntityIdentifier]] =
AwsError.unwrapOptionField("notTargetUsers", notTargetUsers)
}
private final class Wrapper(
impl: software.amazon.awssdk.services.workmail.model.ImpersonationRule
) extends zio.aws.workmail.model.ImpersonationRule.ReadOnly {
override val impersonationRuleId: ImpersonationRuleId =
zio.aws.workmail.model.primitives
.ImpersonationRuleId(impl.impersonationRuleId())
override val name: Optional[ImpersonationRuleName] = zio.aws.core.internal
.optionalFromNullable(impl.name())
.map(value =>
zio.aws.workmail.model.primitives.ImpersonationRuleName(value)
)
override val description: Optional[ImpersonationRuleDescription] =
zio.aws.core.internal
.optionalFromNullable(impl.description())
.map(value =>
zio.aws.workmail.model.primitives.ImpersonationRuleDescription(value)
)
override val effect: zio.aws.workmail.model.AccessEffect =
zio.aws.workmail.model.AccessEffect.wrap(impl.effect())
override val targetUsers: Optional[List[EntityIdentifier]] =
zio.aws.core.internal
.optionalFromNullable(impl.targetUsers())
.map(value =>
value.asScala.map { item =>
zio.aws.workmail.model.primitives.EntityIdentifier(item)
}.toList
)
override val notTargetUsers: Optional[List[EntityIdentifier]] =
zio.aws.core.internal
.optionalFromNullable(impl.notTargetUsers())
.map(value =>
value.asScala.map { item =>
zio.aws.workmail.model.primitives.EntityIdentifier(item)
}.toList
)
}
def wrap(
impl: software.amazon.awssdk.services.workmail.model.ImpersonationRule
): zio.aws.workmail.model.ImpersonationRule.ReadOnly = new Wrapper(impl)
}