All Downloads are FREE. Search and download functionalities are using the official Maven repository.

zio.aws.workmail.model.CreateOrganizationRequest.scala Maven / Gradle / Ivy

There is a newer version: 7.28.29.5
Show newest version
package zio.aws.workmail.model
import zio.aws.workmail.model.primitives.{
  KmsKeyArn,
  IdempotencyClientToken,
  OrganizationName,
  DirectoryId
}
import zio.ZIO
import zio.aws.core.{AwsError, BuilderHelper}
import zio.prelude.data.Optional
import scala.jdk.CollectionConverters._
final case class CreateOrganizationRequest(
    directoryId: Optional[DirectoryId] = Optional.Absent,
    alias: OrganizationName,
    clientToken: Optional[IdempotencyClientToken] = Optional.Absent,
    domains: Optional[Iterable[zio.aws.workmail.model.Domain]] =
      Optional.Absent,
    kmsKeyArn: Optional[KmsKeyArn] = Optional.Absent,
    enableInteroperability: Optional[Boolean] = Optional.Absent
) {
  def buildAwsValue()
      : software.amazon.awssdk.services.workmail.model.CreateOrganizationRequest = {
    import CreateOrganizationRequest.zioAwsBuilderHelper.BuilderOps
    software.amazon.awssdk.services.workmail.model.CreateOrganizationRequest
      .builder()
      .optionallyWith(
        directoryId.map(value => DirectoryId.unwrap(value): java.lang.String)
      )(_.directoryId)
      .alias(OrganizationName.unwrap(alias): java.lang.String)
      .optionallyWith(
        clientToken.map(value =>
          IdempotencyClientToken.unwrap(value): java.lang.String
        )
      )(_.clientToken)
      .optionallyWith(
        domains.map(value =>
          value.map { item =>
            item.buildAwsValue()
          }.asJavaCollection
        )
      )(_.domains)
      .optionallyWith(
        kmsKeyArn.map(value => KmsKeyArn.unwrap(value): java.lang.String)
      )(_.kmsKeyArn)
      .optionallyWith(
        enableInteroperability.map(value => value: java.lang.Boolean)
      )(_.enableInteroperability)
      .build()
  }
  def asReadOnly: zio.aws.workmail.model.CreateOrganizationRequest.ReadOnly =
    zio.aws.workmail.model.CreateOrganizationRequest.wrap(buildAwsValue())
}
object CreateOrganizationRequest {
  private lazy val zioAwsBuilderHelper: BuilderHelper[
    software.amazon.awssdk.services.workmail.model.CreateOrganizationRequest
  ] = BuilderHelper.apply
  trait ReadOnly {
    def asEditable: zio.aws.workmail.model.CreateOrganizationRequest =
      zio.aws.workmail.model.CreateOrganizationRequest(
        directoryId.map(value => value),
        alias,
        clientToken.map(value => value),
        domains.map(value =>
          value.map { item =>
            item.asEditable
          }
        ),
        kmsKeyArn.map(value => value),
        enableInteroperability.map(value => value)
      )
    def directoryId: Optional[DirectoryId]
    def alias: OrganizationName
    def clientToken: Optional[IdempotencyClientToken]
    def domains: Optional[List[zio.aws.workmail.model.Domain.ReadOnly]]
    def kmsKeyArn: Optional[KmsKeyArn]
    def enableInteroperability: Optional[Boolean]
    def getDirectoryId: ZIO[Any, AwsError, DirectoryId] =
      AwsError.unwrapOptionField("directoryId", directoryId)
    def getAlias: ZIO[Any, Nothing, OrganizationName] = ZIO.succeed(alias)
    def getClientToken: ZIO[Any, AwsError, IdempotencyClientToken] =
      AwsError.unwrapOptionField("clientToken", clientToken)
    def getDomains
        : ZIO[Any, AwsError, List[zio.aws.workmail.model.Domain.ReadOnly]] =
      AwsError.unwrapOptionField("domains", domains)
    def getKmsKeyArn: ZIO[Any, AwsError, KmsKeyArn] =
      AwsError.unwrapOptionField("kmsKeyArn", kmsKeyArn)
    def getEnableInteroperability: ZIO[Any, AwsError, Boolean] = AwsError
      .unwrapOptionField("enableInteroperability", enableInteroperability)
  }
  private final class Wrapper(
      impl: software.amazon.awssdk.services.workmail.model.CreateOrganizationRequest
  ) extends zio.aws.workmail.model.CreateOrganizationRequest.ReadOnly {
    override val directoryId: Optional[DirectoryId] = zio.aws.core.internal
      .optionalFromNullable(impl.directoryId())
      .map(value => zio.aws.workmail.model.primitives.DirectoryId(value))
    override val alias: OrganizationName =
      zio.aws.workmail.model.primitives.OrganizationName(impl.alias())
    override val clientToken: Optional[IdempotencyClientToken] =
      zio.aws.core.internal
        .optionalFromNullable(impl.clientToken())
        .map(value =>
          zio.aws.workmail.model.primitives.IdempotencyClientToken(value)
        )
    override val domains
        : Optional[List[zio.aws.workmail.model.Domain.ReadOnly]] =
      zio.aws.core.internal
        .optionalFromNullable(impl.domains())
        .map(value =>
          value.asScala.map { item =>
            zio.aws.workmail.model.Domain.wrap(item)
          }.toList
        )
    override val kmsKeyArn: Optional[KmsKeyArn] = zio.aws.core.internal
      .optionalFromNullable(impl.kmsKeyArn())
      .map(value => zio.aws.workmail.model.primitives.KmsKeyArn(value))
    override val enableInteroperability: Optional[Boolean] =
      zio.aws.core.internal
        .optionalFromNullable(impl.enableInteroperability())
        .map(value => value: Boolean)
  }
  def wrap(
      impl: software.amazon.awssdk.services.workmail.model.CreateOrganizationRequest
  ): zio.aws.workmail.model.CreateOrganizationRequest.ReadOnly = new Wrapper(
    impl
  )
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy