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

zio.aws.verifiedpermissions.model.CreatePolicyRequest.scala Maven / Gradle / Ivy

There is a newer version: 7.28.29.5
Show newest version
package zio.aws.verifiedpermissions.model
import zio.aws.verifiedpermissions.model.primitives.{
  PolicyStoreId,
  IdempotencyToken
}
import zio.ZIO
import zio.aws.core.{AwsError, BuilderHelper}
import zio.prelude.data.Optional
import scala.jdk.CollectionConverters._
final case class CreatePolicyRequest(
    clientToken: Optional[IdempotencyToken] = Optional.Absent,
    policyStoreId: PolicyStoreId,
    definition: zio.aws.verifiedpermissions.model.PolicyDefinition
) {
  def buildAwsValue()
      : software.amazon.awssdk.services.verifiedpermissions.model.CreatePolicyRequest = {
    import CreatePolicyRequest.zioAwsBuilderHelper.BuilderOps
    software.amazon.awssdk.services.verifiedpermissions.model.CreatePolicyRequest
      .builder()
      .optionallyWith(
        clientToken.map(value =>
          IdempotencyToken.unwrap(value): java.lang.String
        )
      )(_.clientToken)
      .policyStoreId(PolicyStoreId.unwrap(policyStoreId): java.lang.String)
      .definition(definition.buildAwsValue())
      .build()
  }
  def asReadOnly
      : zio.aws.verifiedpermissions.model.CreatePolicyRequest.ReadOnly =
    zio.aws.verifiedpermissions.model.CreatePolicyRequest.wrap(buildAwsValue())
}
object CreatePolicyRequest {
  private lazy val zioAwsBuilderHelper: BuilderHelper[
    software.amazon.awssdk.services.verifiedpermissions.model.CreatePolicyRequest
  ] = BuilderHelper.apply
  trait ReadOnly {
    def asEditable: zio.aws.verifiedpermissions.model.CreatePolicyRequest =
      zio.aws.verifiedpermissions.model.CreatePolicyRequest(
        clientToken.map(value => value),
        policyStoreId,
        definition.asEditable
      )
    def clientToken: Optional[IdempotencyToken]
    def policyStoreId: PolicyStoreId
    def definition: zio.aws.verifiedpermissions.model.PolicyDefinition.ReadOnly
    def getClientToken: ZIO[Any, AwsError, IdempotencyToken] =
      AwsError.unwrapOptionField("clientToken", clientToken)
    def getPolicyStoreId: ZIO[Any, Nothing, PolicyStoreId] =
      ZIO.succeed(policyStoreId)
    def getDefinition: ZIO[
      Any,
      Nothing,
      zio.aws.verifiedpermissions.model.PolicyDefinition.ReadOnly
    ] = ZIO.succeed(definition)
  }
  private final class Wrapper(
      impl: software.amazon.awssdk.services.verifiedpermissions.model.CreatePolicyRequest
  ) extends zio.aws.verifiedpermissions.model.CreatePolicyRequest.ReadOnly {
    override val clientToken: Optional[IdempotencyToken] = zio.aws.core.internal
      .optionalFromNullable(impl.clientToken())
      .map(value =>
        zio.aws.verifiedpermissions.model.primitives.IdempotencyToken(value)
      )
    override val policyStoreId: PolicyStoreId =
      zio.aws.verifiedpermissions.model.primitives
        .PolicyStoreId(impl.policyStoreId())
    override val definition
        : zio.aws.verifiedpermissions.model.PolicyDefinition.ReadOnly =
      zio.aws.verifiedpermissions.model.PolicyDefinition.wrap(impl.definition())
  }
  def wrap(
      impl: software.amazon.awssdk.services.verifiedpermissions.model.CreatePolicyRequest
  ): zio.aws.verifiedpermissions.model.CreatePolicyRequest.ReadOnly =
    new Wrapper(impl)
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy