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

zio.aws.workmail.model.CreateUserRequest.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.{
  Password,
  UserAttribute,
  UserName,
  OrganizationId
}
import zio.ZIO
import zio.aws.core.{AwsError, BuilderHelper}
import zio.prelude.data.Optional
import scala.jdk.CollectionConverters._
final case class CreateUserRequest(
    organizationId: OrganizationId,
    name: UserName,
    displayName: UserAttribute,
    password: Optional[Password] = Optional.Absent,
    role: Optional[zio.aws.workmail.model.UserRole] = Optional.Absent,
    firstName: Optional[UserAttribute] = Optional.Absent,
    lastName: Optional[UserAttribute] = Optional.Absent,
    hiddenFromGlobalAddressList: Optional[Boolean] = Optional.Absent
) {
  def buildAwsValue()
      : software.amazon.awssdk.services.workmail.model.CreateUserRequest = {
    import CreateUserRequest.zioAwsBuilderHelper.BuilderOps
    software.amazon.awssdk.services.workmail.model.CreateUserRequest
      .builder()
      .organizationId(OrganizationId.unwrap(organizationId): java.lang.String)
      .name(UserName.unwrap(name): java.lang.String)
      .displayName(UserAttribute.unwrap(displayName): java.lang.String)
      .optionallyWith(
        password.map(value => Password.unwrap(value): java.lang.String)
      )(_.password)
      .optionallyWith(role.map(value => value.unwrap))(_.role)
      .optionallyWith(
        firstName.map(value => UserAttribute.unwrap(value): java.lang.String)
      )(_.firstName)
      .optionallyWith(
        lastName.map(value => UserAttribute.unwrap(value): java.lang.String)
      )(_.lastName)
      .optionallyWith(
        hiddenFromGlobalAddressList.map(value => value: java.lang.Boolean)
      )(_.hiddenFromGlobalAddressList)
      .build()
  }
  def asReadOnly: zio.aws.workmail.model.CreateUserRequest.ReadOnly =
    zio.aws.workmail.model.CreateUserRequest.wrap(buildAwsValue())
}
object CreateUserRequest {
  private lazy val zioAwsBuilderHelper: BuilderHelper[
    software.amazon.awssdk.services.workmail.model.CreateUserRequest
  ] = BuilderHelper.apply
  trait ReadOnly {
    def asEditable: zio.aws.workmail.model.CreateUserRequest =
      zio.aws.workmail.model.CreateUserRequest(
        organizationId,
        name,
        displayName,
        password.map(value => value),
        role.map(value => value),
        firstName.map(value => value),
        lastName.map(value => value),
        hiddenFromGlobalAddressList.map(value => value)
      )
    def organizationId: OrganizationId
    def name: UserName
    def displayName: UserAttribute
    def password: Optional[Password]
    def role: Optional[zio.aws.workmail.model.UserRole]
    def firstName: Optional[UserAttribute]
    def lastName: Optional[UserAttribute]
    def hiddenFromGlobalAddressList: Optional[Boolean]
    def getOrganizationId: ZIO[Any, Nothing, OrganizationId] =
      ZIO.succeed(organizationId)
    def getName: ZIO[Any, Nothing, UserName] = ZIO.succeed(name)
    def getDisplayName: ZIO[Any, Nothing, UserAttribute] =
      ZIO.succeed(displayName)
    def getPassword: ZIO[Any, AwsError, Password] =
      AwsError.unwrapOptionField("password", password)
    def getRole: ZIO[Any, AwsError, zio.aws.workmail.model.UserRole] =
      AwsError.unwrapOptionField("role", role)
    def getFirstName: ZIO[Any, AwsError, UserAttribute] =
      AwsError.unwrapOptionField("firstName", firstName)
    def getLastName: ZIO[Any, AwsError, UserAttribute] =
      AwsError.unwrapOptionField("lastName", lastName)
    def getHiddenFromGlobalAddressList: ZIO[Any, AwsError, Boolean] =
      AwsError.unwrapOptionField(
        "hiddenFromGlobalAddressList",
        hiddenFromGlobalAddressList
      )
  }
  private final class Wrapper(
      impl: software.amazon.awssdk.services.workmail.model.CreateUserRequest
  ) extends zio.aws.workmail.model.CreateUserRequest.ReadOnly {
    override val organizationId: OrganizationId =
      zio.aws.workmail.model.primitives.OrganizationId(impl.organizationId())
    override val name: UserName =
      zio.aws.workmail.model.primitives.UserName(impl.name())
    override val displayName: UserAttribute =
      zio.aws.workmail.model.primitives.UserAttribute(impl.displayName())
    override val password: Optional[Password] = zio.aws.core.internal
      .optionalFromNullable(impl.password())
      .map(value => zio.aws.workmail.model.primitives.Password(value))
    override val role: Optional[zio.aws.workmail.model.UserRole] =
      zio.aws.core.internal
        .optionalFromNullable(impl.role())
        .map(value => zio.aws.workmail.model.UserRole.wrap(value))
    override val firstName: Optional[UserAttribute] = zio.aws.core.internal
      .optionalFromNullable(impl.firstName())
      .map(value => zio.aws.workmail.model.primitives.UserAttribute(value))
    override val lastName: Optional[UserAttribute] = zio.aws.core.internal
      .optionalFromNullable(impl.lastName())
      .map(value => zio.aws.workmail.model.primitives.UserAttribute(value))
    override val hiddenFromGlobalAddressList: Optional[Boolean] =
      zio.aws.core.internal
        .optionalFromNullable(impl.hiddenFromGlobalAddressList())
        .map(value => value: Boolean)
  }
  def wrap(
      impl: software.amazon.awssdk.services.workmail.model.CreateUserRequest
  ): zio.aws.workmail.model.CreateUserRequest.ReadOnly = new Wrapper(impl)
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy