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

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

There is a newer version: 7.28.29.5
Show newest version
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.{
  EmailAddress,
  ResourceDescription,
  Timestamp,
  WorkMailIdentifier,
  ResourceName
}
import scala.jdk.CollectionConverters._
final case class Resource(
    id: Optional[WorkMailIdentifier] = Optional.Absent,
    email: Optional[EmailAddress] = Optional.Absent,
    name: Optional[ResourceName] = Optional.Absent,
    `type`: Optional[zio.aws.workmail.model.ResourceType] = Optional.Absent,
    state: Optional[zio.aws.workmail.model.EntityState] = Optional.Absent,
    enabledDate: Optional[Timestamp] = Optional.Absent,
    disabledDate: Optional[Timestamp] = Optional.Absent,
    description: Optional[ResourceDescription] = Optional.Absent
) {
  def buildAwsValue()
      : software.amazon.awssdk.services.workmail.model.Resource = {
    import Resource.zioAwsBuilderHelper.BuilderOps
    software.amazon.awssdk.services.workmail.model.Resource
      .builder()
      .optionallyWith(
        id.map(value => WorkMailIdentifier.unwrap(value): java.lang.String)
      )(_.id)
      .optionallyWith(
        email.map(value => EmailAddress.unwrap(value): java.lang.String)
      )(_.email)
      .optionallyWith(
        name.map(value => ResourceName.unwrap(value): java.lang.String)
      )(_.name)
      .optionallyWith(`type`.map(value => value.unwrap))(_.`type`)
      .optionallyWith(state.map(value => value.unwrap))(_.state)
      .optionallyWith(
        enabledDate.map(value => Timestamp.unwrap(value): Instant)
      )(_.enabledDate)
      .optionallyWith(
        disabledDate.map(value => Timestamp.unwrap(value): Instant)
      )(_.disabledDate)
      .optionallyWith(
        description.map(value =>
          ResourceDescription.unwrap(value): java.lang.String
        )
      )(_.description)
      .build()
  }
  def asReadOnly: zio.aws.workmail.model.Resource.ReadOnly =
    zio.aws.workmail.model.Resource.wrap(buildAwsValue())
}
object Resource {
  private lazy val zioAwsBuilderHelper
      : BuilderHelper[software.amazon.awssdk.services.workmail.model.Resource] =
    BuilderHelper.apply
  trait ReadOnly {
    def asEditable: zio.aws.workmail.model.Resource =
      zio.aws.workmail.model.Resource(
        id.map(value => value),
        email.map(value => value),
        name.map(value => value),
        `type`.map(value => value),
        state.map(value => value),
        enabledDate.map(value => value),
        disabledDate.map(value => value),
        description.map(value => value)
      )
    def id: Optional[WorkMailIdentifier]
    def email: Optional[EmailAddress]
    def name: Optional[ResourceName]
    def `type`: Optional[zio.aws.workmail.model.ResourceType]
    def state: Optional[zio.aws.workmail.model.EntityState]
    def enabledDate: Optional[Timestamp]
    def disabledDate: Optional[Timestamp]
    def description: Optional[ResourceDescription]
    def getId: ZIO[Any, AwsError, WorkMailIdentifier] =
      AwsError.unwrapOptionField("id", id)
    def getEmail: ZIO[Any, AwsError, EmailAddress] =
      AwsError.unwrapOptionField("email", email)
    def getName: ZIO[Any, AwsError, ResourceName] =
      AwsError.unwrapOptionField("name", name)
    def getType: ZIO[Any, AwsError, zio.aws.workmail.model.ResourceType] =
      AwsError.unwrapOptionField("type", `type`)
    def getState: ZIO[Any, AwsError, zio.aws.workmail.model.EntityState] =
      AwsError.unwrapOptionField("state", state)
    def getEnabledDate: ZIO[Any, AwsError, Timestamp] =
      AwsError.unwrapOptionField("enabledDate", enabledDate)
    def getDisabledDate: ZIO[Any, AwsError, Timestamp] =
      AwsError.unwrapOptionField("disabledDate", disabledDate)
    def getDescription: ZIO[Any, AwsError, ResourceDescription] =
      AwsError.unwrapOptionField("description", description)
  }
  private final class Wrapper(
      impl: software.amazon.awssdk.services.workmail.model.Resource
  ) extends zio.aws.workmail.model.Resource.ReadOnly {
    override val id: Optional[WorkMailIdentifier] = zio.aws.core.internal
      .optionalFromNullable(impl.id())
      .map(value => zio.aws.workmail.model.primitives.WorkMailIdentifier(value))
    override val email: Optional[EmailAddress] = zio.aws.core.internal
      .optionalFromNullable(impl.email())
      .map(value => zio.aws.workmail.model.primitives.EmailAddress(value))
    override val name: Optional[ResourceName] = zio.aws.core.internal
      .optionalFromNullable(impl.name())
      .map(value => zio.aws.workmail.model.primitives.ResourceName(value))
    override val `type`: Optional[zio.aws.workmail.model.ResourceType] =
      zio.aws.core.internal
        .optionalFromNullable(impl.`type`())
        .map(value => zio.aws.workmail.model.ResourceType.wrap(value))
    override val state: Optional[zio.aws.workmail.model.EntityState] =
      zio.aws.core.internal
        .optionalFromNullable(impl.state())
        .map(value => zio.aws.workmail.model.EntityState.wrap(value))
    override val enabledDate: Optional[Timestamp] = zio.aws.core.internal
      .optionalFromNullable(impl.enabledDate())
      .map(value => zio.aws.workmail.model.primitives.Timestamp(value))
    override val disabledDate: Optional[Timestamp] = zio.aws.core.internal
      .optionalFromNullable(impl.disabledDate())
      .map(value => zio.aws.workmail.model.primitives.Timestamp(value))
    override val description: Optional[ResourceDescription] =
      zio.aws.core.internal
        .optionalFromNullable(impl.description())
        .map(value =>
          zio.aws.workmail.model.primitives.ResourceDescription(value)
        )
  }
  def wrap(
      impl: software.amazon.awssdk.services.workmail.model.Resource
  ): zio.aws.workmail.model.Resource.ReadOnly = new Wrapper(impl)
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy