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

zio.aws.workmail.model.PutRetentionPolicyRequest.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.{
  PolicyDescription,
  ShortString,
  OrganizationId
}
import zio.ZIO
import zio.aws.core.{AwsError, BuilderHelper}
import zio.prelude.data.Optional
import scala.jdk.CollectionConverters._
final case class PutRetentionPolicyRequest(
    organizationId: OrganizationId,
    id: Optional[ShortString] = Optional.Absent,
    name: ShortString,
    description: Optional[PolicyDescription] = Optional.Absent,
    folderConfigurations: Iterable[zio.aws.workmail.model.FolderConfiguration]
) {
  def buildAwsValue()
      : software.amazon.awssdk.services.workmail.model.PutRetentionPolicyRequest = {
    import PutRetentionPolicyRequest.zioAwsBuilderHelper.BuilderOps
    software.amazon.awssdk.services.workmail.model.PutRetentionPolicyRequest
      .builder()
      .organizationId(OrganizationId.unwrap(organizationId): java.lang.String)
      .optionallyWith(
        id.map(value => ShortString.unwrap(value): java.lang.String)
      )(_.id)
      .name(ShortString.unwrap(name): java.lang.String)
      .optionallyWith(
        description.map(value =>
          PolicyDescription.unwrap(value): java.lang.String
        )
      )(_.description)
      .folderConfigurations(folderConfigurations.map { item =>
        item.buildAwsValue()
      }.asJavaCollection)
      .build()
  }
  def asReadOnly: zio.aws.workmail.model.PutRetentionPolicyRequest.ReadOnly =
    zio.aws.workmail.model.PutRetentionPolicyRequest.wrap(buildAwsValue())
}
object PutRetentionPolicyRequest {
  private lazy val zioAwsBuilderHelper: BuilderHelper[
    software.amazon.awssdk.services.workmail.model.PutRetentionPolicyRequest
  ] = BuilderHelper.apply
  trait ReadOnly {
    def asEditable: zio.aws.workmail.model.PutRetentionPolicyRequest =
      zio.aws.workmail.model.PutRetentionPolicyRequest(
        organizationId,
        id.map(value => value),
        name,
        description.map(value => value),
        folderConfigurations.map { item =>
          item.asEditable
        }
      )
    def organizationId: OrganizationId
    def id: Optional[ShortString]
    def name: ShortString
    def description: Optional[PolicyDescription]
    def folderConfigurations
        : List[zio.aws.workmail.model.FolderConfiguration.ReadOnly]
    def getOrganizationId: ZIO[Any, Nothing, OrganizationId] =
      ZIO.succeed(organizationId)
    def getId: ZIO[Any, AwsError, ShortString] =
      AwsError.unwrapOptionField("id", id)
    def getName: ZIO[Any, Nothing, ShortString] = ZIO.succeed(name)
    def getDescription: ZIO[Any, AwsError, PolicyDescription] =
      AwsError.unwrapOptionField("description", description)
    def getFolderConfigurations: ZIO[Any, Nothing, List[
      zio.aws.workmail.model.FolderConfiguration.ReadOnly
    ]] = ZIO.succeed(folderConfigurations)
  }
  private final class Wrapper(
      impl: software.amazon.awssdk.services.workmail.model.PutRetentionPolicyRequest
  ) extends zio.aws.workmail.model.PutRetentionPolicyRequest.ReadOnly {
    override val organizationId: OrganizationId =
      zio.aws.workmail.model.primitives.OrganizationId(impl.organizationId())
    override val id: Optional[ShortString] = zio.aws.core.internal
      .optionalFromNullable(impl.id())
      .map(value => zio.aws.workmail.model.primitives.ShortString(value))
    override val name: ShortString =
      zio.aws.workmail.model.primitives.ShortString(impl.name())
    override val description: Optional[PolicyDescription] =
      zio.aws.core.internal
        .optionalFromNullable(impl.description())
        .map(value =>
          zio.aws.workmail.model.primitives.PolicyDescription(value)
        )
    override val folderConfigurations
        : List[zio.aws.workmail.model.FolderConfiguration.ReadOnly] = impl
      .folderConfigurations()
      .asScala
      .map { item =>
        zio.aws.workmail.model.FolderConfiguration.wrap(item)
      }
      .toList
  }
  def wrap(
      impl: software.amazon.awssdk.services.workmail.model.PutRetentionPolicyRequest
  ): zio.aws.workmail.model.PutRetentionPolicyRequest.ReadOnly = new Wrapper(
    impl
  )
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy