zio.aws.workmail.model.Domain.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.{HostedZoneId, DomainName}
import zio.ZIO
import zio.aws.core.{AwsError, BuilderHelper}
import zio.prelude.data.Optional
import scala.jdk.CollectionConverters._
final case class Domain(
domainName: DomainName,
hostedZoneId: Optional[HostedZoneId] = Optional.Absent
) {
def buildAwsValue(): software.amazon.awssdk.services.workmail.model.Domain = {
import Domain.zioAwsBuilderHelper.BuilderOps
software.amazon.awssdk.services.workmail.model.Domain
.builder()
.domainName(DomainName.unwrap(domainName): java.lang.String)
.optionallyWith(
hostedZoneId.map(value => HostedZoneId.unwrap(value): java.lang.String)
)(_.hostedZoneId)
.build()
}
def asReadOnly: zio.aws.workmail.model.Domain.ReadOnly =
zio.aws.workmail.model.Domain.wrap(buildAwsValue())
}
object Domain {
private lazy val zioAwsBuilderHelper
: BuilderHelper[software.amazon.awssdk.services.workmail.model.Domain] =
BuilderHelper.apply
trait ReadOnly {
def asEditable: zio.aws.workmail.model.Domain = zio.aws.workmail.model
.Domain(domainName, hostedZoneId.map(value => value))
def domainName: DomainName
def hostedZoneId: Optional[HostedZoneId]
def getDomainName: ZIO[Any, Nothing, DomainName] = ZIO.succeed(domainName)
def getHostedZoneId: ZIO[Any, AwsError, HostedZoneId] =
AwsError.unwrapOptionField("hostedZoneId", hostedZoneId)
}
private final class Wrapper(
impl: software.amazon.awssdk.services.workmail.model.Domain
) extends zio.aws.workmail.model.Domain.ReadOnly {
override val domainName: DomainName =
zio.aws.workmail.model.primitives.DomainName(impl.domainName())
override val hostedZoneId: Optional[HostedZoneId] = zio.aws.core.internal
.optionalFromNullable(impl.hostedZoneId())
.map(value => zio.aws.workmail.model.primitives.HostedZoneId(value))
}
def wrap(
impl: software.amazon.awssdk.services.workmail.model.Domain
): zio.aws.workmail.model.Domain.ReadOnly = new Wrapper(impl)
}