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

zio.aws.workmail.model.GetAccessControlEffectRequest.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.{
  AccessControlRuleAction,
  OrganizationId,
  WorkMailIdentifier,
  IpAddress,
  ImpersonationRoleId
}
import zio.ZIO
import zio.aws.core.{AwsError, BuilderHelper}
import zio.prelude.data.Optional
import scala.jdk.CollectionConverters._
final case class GetAccessControlEffectRequest(
    organizationId: OrganizationId,
    ipAddress: IpAddress,
    action: AccessControlRuleAction,
    userId: Optional[WorkMailIdentifier] = Optional.Absent,
    impersonationRoleId: Optional[ImpersonationRoleId] = Optional.Absent
) {
  def buildAwsValue()
      : software.amazon.awssdk.services.workmail.model.GetAccessControlEffectRequest = {
    import GetAccessControlEffectRequest.zioAwsBuilderHelper.BuilderOps
    software.amazon.awssdk.services.workmail.model.GetAccessControlEffectRequest
      .builder()
      .organizationId(OrganizationId.unwrap(organizationId): java.lang.String)
      .ipAddress(IpAddress.unwrap(ipAddress): java.lang.String)
      .action(AccessControlRuleAction.unwrap(action): java.lang.String)
      .optionallyWith(
        userId.map(value => WorkMailIdentifier.unwrap(value): java.lang.String)
      )(_.userId)
      .optionallyWith(
        impersonationRoleId.map(value =>
          ImpersonationRoleId.unwrap(value): java.lang.String
        )
      )(_.impersonationRoleId)
      .build()
  }
  def asReadOnly
      : zio.aws.workmail.model.GetAccessControlEffectRequest.ReadOnly =
    zio.aws.workmail.model.GetAccessControlEffectRequest.wrap(buildAwsValue())
}
object GetAccessControlEffectRequest {
  private lazy val zioAwsBuilderHelper: BuilderHelper[
    software.amazon.awssdk.services.workmail.model.GetAccessControlEffectRequest
  ] = BuilderHelper.apply
  trait ReadOnly {
    def asEditable: zio.aws.workmail.model.GetAccessControlEffectRequest =
      zio.aws.workmail.model.GetAccessControlEffectRequest(
        organizationId,
        ipAddress,
        action,
        userId.map(value => value),
        impersonationRoleId.map(value => value)
      )
    def organizationId: OrganizationId
    def ipAddress: IpAddress
    def action: AccessControlRuleAction
    def userId: Optional[WorkMailIdentifier]
    def impersonationRoleId: Optional[ImpersonationRoleId]
    def getOrganizationId: ZIO[Any, Nothing, OrganizationId] =
      ZIO.succeed(organizationId)
    def getIpAddress: ZIO[Any, Nothing, IpAddress] = ZIO.succeed(ipAddress)
    def getAction: ZIO[Any, Nothing, AccessControlRuleAction] =
      ZIO.succeed(action)
    def getUserId: ZIO[Any, AwsError, WorkMailIdentifier] =
      AwsError.unwrapOptionField("userId", userId)
    def getImpersonationRoleId: ZIO[Any, AwsError, ImpersonationRoleId] =
      AwsError.unwrapOptionField("impersonationRoleId", impersonationRoleId)
  }
  private final class Wrapper(
      impl: software.amazon.awssdk.services.workmail.model.GetAccessControlEffectRequest
  ) extends zio.aws.workmail.model.GetAccessControlEffectRequest.ReadOnly {
    override val organizationId: OrganizationId =
      zio.aws.workmail.model.primitives.OrganizationId(impl.organizationId())
    override val ipAddress: IpAddress =
      zio.aws.workmail.model.primitives.IpAddress(impl.ipAddress())
    override val action: AccessControlRuleAction =
      zio.aws.workmail.model.primitives.AccessControlRuleAction(impl.action())
    override val userId: Optional[WorkMailIdentifier] = zio.aws.core.internal
      .optionalFromNullable(impl.userId())
      .map(value => zio.aws.workmail.model.primitives.WorkMailIdentifier(value))
    override val impersonationRoleId: Optional[ImpersonationRoleId] =
      zio.aws.core.internal
        .optionalFromNullable(impl.impersonationRoleId())
        .map(value =>
          zio.aws.workmail.model.primitives.ImpersonationRoleId(value)
        )
  }
  def wrap(
      impl: software.amazon.awssdk.services.workmail.model.GetAccessControlEffectRequest
  ): zio.aws.workmail.model.GetAccessControlEffectRequest.ReadOnly =
    new Wrapper(impl)
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy