zio.aws.workmail.model.AccessControlRule.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.{
AccessControlRuleDescription,
IpRange,
AccessControlRuleName,
Timestamp,
AccessControlRuleAction,
WorkMailIdentifier,
ImpersonationRoleId
}
import scala.jdk.CollectionConverters._
final case class AccessControlRule(
name: Optional[AccessControlRuleName] = Optional.Absent,
effect: Optional[zio.aws.workmail.model.AccessControlRuleEffect] =
Optional.Absent,
description: Optional[AccessControlRuleDescription] = Optional.Absent,
ipRanges: Optional[Iterable[IpRange]] = Optional.Absent,
notIpRanges: Optional[Iterable[IpRange]] = Optional.Absent,
actions: Optional[Iterable[AccessControlRuleAction]] = Optional.Absent,
notActions: Optional[Iterable[AccessControlRuleAction]] = Optional.Absent,
userIds: Optional[Iterable[WorkMailIdentifier]] = Optional.Absent,
notUserIds: Optional[Iterable[WorkMailIdentifier]] = Optional.Absent,
dateCreated: Optional[Timestamp] = Optional.Absent,
dateModified: Optional[Timestamp] = Optional.Absent,
impersonationRoleIds: Optional[Iterable[ImpersonationRoleId]] =
Optional.Absent,
notImpersonationRoleIds: Optional[Iterable[ImpersonationRoleId]] =
Optional.Absent
) {
def buildAwsValue()
: software.amazon.awssdk.services.workmail.model.AccessControlRule = {
import AccessControlRule.zioAwsBuilderHelper.BuilderOps
software.amazon.awssdk.services.workmail.model.AccessControlRule
.builder()
.optionallyWith(
name.map(value => AccessControlRuleName.unwrap(value): java.lang.String)
)(_.name)
.optionallyWith(effect.map(value => value.unwrap))(_.effect)
.optionallyWith(
description.map(value =>
AccessControlRuleDescription.unwrap(value): java.lang.String
)
)(_.description)
.optionallyWith(
ipRanges.map(value =>
value.map { item =>
IpRange.unwrap(item): java.lang.String
}.asJavaCollection
)
)(_.ipRanges)
.optionallyWith(
notIpRanges.map(value =>
value.map { item =>
IpRange.unwrap(item): java.lang.String
}.asJavaCollection
)
)(_.notIpRanges)
.optionallyWith(
actions.map(value =>
value.map { item =>
AccessControlRuleAction.unwrap(item): java.lang.String
}.asJavaCollection
)
)(_.actions)
.optionallyWith(
notActions.map(value =>
value.map { item =>
AccessControlRuleAction.unwrap(item): java.lang.String
}.asJavaCollection
)
)(_.notActions)
.optionallyWith(
userIds.map(value =>
value.map { item =>
WorkMailIdentifier.unwrap(item): java.lang.String
}.asJavaCollection
)
)(_.userIds)
.optionallyWith(
notUserIds.map(value =>
value.map { item =>
WorkMailIdentifier.unwrap(item): java.lang.String
}.asJavaCollection
)
)(_.notUserIds)
.optionallyWith(
dateCreated.map(value => Timestamp.unwrap(value): Instant)
)(_.dateCreated)
.optionallyWith(
dateModified.map(value => Timestamp.unwrap(value): Instant)
)(_.dateModified)
.optionallyWith(
impersonationRoleIds.map(value =>
value.map { item =>
ImpersonationRoleId.unwrap(item): java.lang.String
}.asJavaCollection
)
)(_.impersonationRoleIds)
.optionallyWith(
notImpersonationRoleIds.map(value =>
value.map { item =>
ImpersonationRoleId.unwrap(item): java.lang.String
}.asJavaCollection
)
)(_.notImpersonationRoleIds)
.build()
}
def asReadOnly: zio.aws.workmail.model.AccessControlRule.ReadOnly =
zio.aws.workmail.model.AccessControlRule.wrap(buildAwsValue())
}
object AccessControlRule {
private lazy val zioAwsBuilderHelper: BuilderHelper[
software.amazon.awssdk.services.workmail.model.AccessControlRule
] = BuilderHelper.apply
trait ReadOnly {
def asEditable: zio.aws.workmail.model.AccessControlRule =
zio.aws.workmail.model.AccessControlRule(
name.map(value => value),
effect.map(value => value),
description.map(value => value),
ipRanges.map(value => value),
notIpRanges.map(value => value),
actions.map(value => value),
notActions.map(value => value),
userIds.map(value => value),
notUserIds.map(value => value),
dateCreated.map(value => value),
dateModified.map(value => value),
impersonationRoleIds.map(value => value),
notImpersonationRoleIds.map(value => value)
)
def name: Optional[AccessControlRuleName]
def effect: Optional[zio.aws.workmail.model.AccessControlRuleEffect]
def description: Optional[AccessControlRuleDescription]
def ipRanges: Optional[List[IpRange]]
def notIpRanges: Optional[List[IpRange]]
def actions: Optional[List[AccessControlRuleAction]]
def notActions: Optional[List[AccessControlRuleAction]]
def userIds: Optional[List[WorkMailIdentifier]]
def notUserIds: Optional[List[WorkMailIdentifier]]
def dateCreated: Optional[Timestamp]
def dateModified: Optional[Timestamp]
def impersonationRoleIds: Optional[List[ImpersonationRoleId]]
def notImpersonationRoleIds: Optional[List[ImpersonationRoleId]]
def getName: ZIO[Any, AwsError, AccessControlRuleName] =
AwsError.unwrapOptionField("name", name)
def getEffect
: ZIO[Any, AwsError, zio.aws.workmail.model.AccessControlRuleEffect] =
AwsError.unwrapOptionField("effect", effect)
def getDescription: ZIO[Any, AwsError, AccessControlRuleDescription] =
AwsError.unwrapOptionField("description", description)
def getIpRanges: ZIO[Any, AwsError, List[IpRange]] =
AwsError.unwrapOptionField("ipRanges", ipRanges)
def getNotIpRanges: ZIO[Any, AwsError, List[IpRange]] =
AwsError.unwrapOptionField("notIpRanges", notIpRanges)
def getActions: ZIO[Any, AwsError, List[AccessControlRuleAction]] =
AwsError.unwrapOptionField("actions", actions)
def getNotActions: ZIO[Any, AwsError, List[AccessControlRuleAction]] =
AwsError.unwrapOptionField("notActions", notActions)
def getUserIds: ZIO[Any, AwsError, List[WorkMailIdentifier]] =
AwsError.unwrapOptionField("userIds", userIds)
def getNotUserIds: ZIO[Any, AwsError, List[WorkMailIdentifier]] =
AwsError.unwrapOptionField("notUserIds", notUserIds)
def getDateCreated: ZIO[Any, AwsError, Timestamp] =
AwsError.unwrapOptionField("dateCreated", dateCreated)
def getDateModified: ZIO[Any, AwsError, Timestamp] =
AwsError.unwrapOptionField("dateModified", dateModified)
def getImpersonationRoleIds: ZIO[Any, AwsError, List[ImpersonationRoleId]] =
AwsError.unwrapOptionField("impersonationRoleIds", impersonationRoleIds)
def getNotImpersonationRoleIds
: ZIO[Any, AwsError, List[ImpersonationRoleId]] = AwsError
.unwrapOptionField("notImpersonationRoleIds", notImpersonationRoleIds)
}
private final class Wrapper(
impl: software.amazon.awssdk.services.workmail.model.AccessControlRule
) extends zio.aws.workmail.model.AccessControlRule.ReadOnly {
override val name: Optional[AccessControlRuleName] = zio.aws.core.internal
.optionalFromNullable(impl.name())
.map(value =>
zio.aws.workmail.model.primitives.AccessControlRuleName(value)
)
override val effect
: Optional[zio.aws.workmail.model.AccessControlRuleEffect] =
zio.aws.core.internal
.optionalFromNullable(impl.effect())
.map(value =>
zio.aws.workmail.model.AccessControlRuleEffect.wrap(value)
)
override val description: Optional[AccessControlRuleDescription] =
zio.aws.core.internal
.optionalFromNullable(impl.description())
.map(value =>
zio.aws.workmail.model.primitives.AccessControlRuleDescription(value)
)
override val ipRanges: Optional[List[IpRange]] = zio.aws.core.internal
.optionalFromNullable(impl.ipRanges())
.map(value =>
value.asScala.map { item =>
zio.aws.workmail.model.primitives.IpRange(item)
}.toList
)
override val notIpRanges: Optional[List[IpRange]] = zio.aws.core.internal
.optionalFromNullable(impl.notIpRanges())
.map(value =>
value.asScala.map { item =>
zio.aws.workmail.model.primitives.IpRange(item)
}.toList
)
override val actions: Optional[List[AccessControlRuleAction]] =
zio.aws.core.internal
.optionalFromNullable(impl.actions())
.map(value =>
value.asScala.map { item =>
zio.aws.workmail.model.primitives.AccessControlRuleAction(item)
}.toList
)
override val notActions: Optional[List[AccessControlRuleAction]] =
zio.aws.core.internal
.optionalFromNullable(impl.notActions())
.map(value =>
value.asScala.map { item =>
zio.aws.workmail.model.primitives.AccessControlRuleAction(item)
}.toList
)
override val userIds: Optional[List[WorkMailIdentifier]] =
zio.aws.core.internal
.optionalFromNullable(impl.userIds())
.map(value =>
value.asScala.map { item =>
zio.aws.workmail.model.primitives.WorkMailIdentifier(item)
}.toList
)
override val notUserIds: Optional[List[WorkMailIdentifier]] =
zio.aws.core.internal
.optionalFromNullable(impl.notUserIds())
.map(value =>
value.asScala.map { item =>
zio.aws.workmail.model.primitives.WorkMailIdentifier(item)
}.toList
)
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))
override val impersonationRoleIds: Optional[List[ImpersonationRoleId]] =
zio.aws.core.internal
.optionalFromNullable(impl.impersonationRoleIds())
.map(value =>
value.asScala.map { item =>
zio.aws.workmail.model.primitives.ImpersonationRoleId(item)
}.toList
)
override val notImpersonationRoleIds: Optional[List[ImpersonationRoleId]] =
zio.aws.core.internal
.optionalFromNullable(impl.notImpersonationRoleIds())
.map(value =>
value.asScala.map { item =>
zio.aws.workmail.model.primitives.ImpersonationRoleId(item)
}.toList
)
}
def wrap(
impl: software.amazon.awssdk.services.workmail.model.AccessControlRule
): zio.aws.workmail.model.AccessControlRule.ReadOnly = new Wrapper(impl)
}