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

zio.aws.workmail.model.User.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.{
  Timestamp,
  UserName,
  EmailAddress,
  WorkMailIdentifier
}
import scala.jdk.CollectionConverters._
final case class User(
    id: Optional[WorkMailIdentifier] = Optional.Absent,
    email: Optional[EmailAddress] = Optional.Absent,
    name: Optional[UserName] = Optional.Absent,
    displayName: Optional[String] = Optional.Absent,
    state: Optional[zio.aws.workmail.model.EntityState] = Optional.Absent,
    userRole: Optional[zio.aws.workmail.model.UserRole] = Optional.Absent,
    enabledDate: Optional[Timestamp] = Optional.Absent,
    disabledDate: Optional[Timestamp] = Optional.Absent
) {
  def buildAwsValue(): software.amazon.awssdk.services.workmail.model.User = {
    import User.zioAwsBuilderHelper.BuilderOps
    software.amazon.awssdk.services.workmail.model.User
      .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 => UserName.unwrap(value): java.lang.String)
      )(_.name)
      .optionallyWith(displayName.map(value => value: java.lang.String))(
        _.displayName
      )
      .optionallyWith(state.map(value => value.unwrap))(_.state)
      .optionallyWith(userRole.map(value => value.unwrap))(_.userRole)
      .optionallyWith(
        enabledDate.map(value => Timestamp.unwrap(value): Instant)
      )(_.enabledDate)
      .optionallyWith(
        disabledDate.map(value => Timestamp.unwrap(value): Instant)
      )(_.disabledDate)
      .build()
  }
  def asReadOnly: zio.aws.workmail.model.User.ReadOnly =
    zio.aws.workmail.model.User.wrap(buildAwsValue())
}
object User {
  private lazy val zioAwsBuilderHelper
      : BuilderHelper[software.amazon.awssdk.services.workmail.model.User] =
    BuilderHelper.apply
  trait ReadOnly {
    def asEditable: zio.aws.workmail.model.User = zio.aws.workmail.model.User(
      id.map(value => value),
      email.map(value => value),
      name.map(value => value),
      displayName.map(value => value),
      state.map(value => value),
      userRole.map(value => value),
      enabledDate.map(value => value),
      disabledDate.map(value => value)
    )
    def id: Optional[WorkMailIdentifier]
    def email: Optional[EmailAddress]
    def name: Optional[UserName]
    def displayName: Optional[String]
    def state: Optional[zio.aws.workmail.model.EntityState]
    def userRole: Optional[zio.aws.workmail.model.UserRole]
    def enabledDate: Optional[Timestamp]
    def disabledDate: Optional[Timestamp]
    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, UserName] =
      AwsError.unwrapOptionField("name", name)
    def getDisplayName: ZIO[Any, AwsError, String] =
      AwsError.unwrapOptionField("displayName", displayName)
    def getState: ZIO[Any, AwsError, zio.aws.workmail.model.EntityState] =
      AwsError.unwrapOptionField("state", state)
    def getUserRole: ZIO[Any, AwsError, zio.aws.workmail.model.UserRole] =
      AwsError.unwrapOptionField("userRole", userRole)
    def getEnabledDate: ZIO[Any, AwsError, Timestamp] =
      AwsError.unwrapOptionField("enabledDate", enabledDate)
    def getDisabledDate: ZIO[Any, AwsError, Timestamp] =
      AwsError.unwrapOptionField("disabledDate", disabledDate)
  }
  private final class Wrapper(
      impl: software.amazon.awssdk.services.workmail.model.User
  ) extends zio.aws.workmail.model.User.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[UserName] = zio.aws.core.internal
      .optionalFromNullable(impl.name())
      .map(value => zio.aws.workmail.model.primitives.UserName(value))
    override val displayName: Optional[String] = zio.aws.core.internal
      .optionalFromNullable(impl.displayName())
      .map(value => value: String)
    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 userRole: Optional[zio.aws.workmail.model.UserRole] =
      zio.aws.core.internal
        .optionalFromNullable(impl.userRole())
        .map(value => zio.aws.workmail.model.UserRole.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))
  }
  def wrap(
      impl: software.amazon.awssdk.services.workmail.model.User
  ): zio.aws.workmail.model.User.ReadOnly = new Wrapper(impl)
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy