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

zio.aws.verifiedpermissions.model.IsAuthorizedWithTokenRequest.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.{Token, PolicyStoreId}
import zio.ZIO
import zio.aws.core.{AwsError, BuilderHelper}
import zio.prelude.data.Optional
import scala.jdk.CollectionConverters._
final case class IsAuthorizedWithTokenRequest(
    policyStoreId: PolicyStoreId,
    identityToken: Optional[Token] = Optional.Absent,
    accessToken: Optional[Token] = Optional.Absent,
    action: Optional[zio.aws.verifiedpermissions.model.ActionIdentifier] =
      Optional.Absent,
    resource: Optional[zio.aws.verifiedpermissions.model.EntityIdentifier] =
      Optional.Absent,
    context: Optional[zio.aws.verifiedpermissions.model.ContextDefinition] =
      Optional.Absent,
    entities: Optional[zio.aws.verifiedpermissions.model.EntitiesDefinition] =
      Optional.Absent
) {
  def buildAwsValue()
      : software.amazon.awssdk.services.verifiedpermissions.model.IsAuthorizedWithTokenRequest = {
    import IsAuthorizedWithTokenRequest.zioAwsBuilderHelper.BuilderOps
    software.amazon.awssdk.services.verifiedpermissions.model.IsAuthorizedWithTokenRequest
      .builder()
      .policyStoreId(PolicyStoreId.unwrap(policyStoreId): java.lang.String)
      .optionallyWith(
        identityToken.map(value => Token.unwrap(value): java.lang.String)
      )(_.identityToken)
      .optionallyWith(
        accessToken.map(value => Token.unwrap(value): java.lang.String)
      )(_.accessToken)
      .optionallyWith(action.map(value => value.buildAwsValue()))(_.action)
      .optionallyWith(resource.map(value => value.buildAwsValue()))(_.resource)
      .optionallyWith(context.map(value => value.buildAwsValue()))(_.context)
      .optionallyWith(entities.map(value => value.buildAwsValue()))(_.entities)
      .build()
  }
  def asReadOnly
      : zio.aws.verifiedpermissions.model.IsAuthorizedWithTokenRequest.ReadOnly =
    zio.aws.verifiedpermissions.model.IsAuthorizedWithTokenRequest
      .wrap(buildAwsValue())
}
object IsAuthorizedWithTokenRequest {
  private lazy val zioAwsBuilderHelper: BuilderHelper[
    software.amazon.awssdk.services.verifiedpermissions.model.IsAuthorizedWithTokenRequest
  ] = BuilderHelper.apply
  trait ReadOnly {
    def asEditable
        : zio.aws.verifiedpermissions.model.IsAuthorizedWithTokenRequest =
      zio.aws.verifiedpermissions.model.IsAuthorizedWithTokenRequest(
        policyStoreId,
        identityToken.map(value => value),
        accessToken.map(value => value),
        action.map(value => value.asEditable),
        resource.map(value => value.asEditable),
        context.map(value => value.asEditable),
        entities.map(value => value.asEditable)
      )
    def policyStoreId: PolicyStoreId
    def identityToken: Optional[Token]
    def accessToken: Optional[Token]
    def action
        : Optional[zio.aws.verifiedpermissions.model.ActionIdentifier.ReadOnly]
    def resource
        : Optional[zio.aws.verifiedpermissions.model.EntityIdentifier.ReadOnly]
    def context
        : Optional[zio.aws.verifiedpermissions.model.ContextDefinition.ReadOnly]
    def entities: Optional[
      zio.aws.verifiedpermissions.model.EntitiesDefinition.ReadOnly
    ]
    def getPolicyStoreId: ZIO[Any, Nothing, PolicyStoreId] =
      ZIO.succeed(policyStoreId)
    def getIdentityToken: ZIO[Any, AwsError, Token] =
      AwsError.unwrapOptionField("identityToken", identityToken)
    def getAccessToken: ZIO[Any, AwsError, Token] =
      AwsError.unwrapOptionField("accessToken", accessToken)
    def getAction: ZIO[
      Any,
      AwsError,
      zio.aws.verifiedpermissions.model.ActionIdentifier.ReadOnly
    ] = AwsError.unwrapOptionField("action", action)
    def getResource: ZIO[
      Any,
      AwsError,
      zio.aws.verifiedpermissions.model.EntityIdentifier.ReadOnly
    ] = AwsError.unwrapOptionField("resource", resource)
    def getContext: ZIO[
      Any,
      AwsError,
      zio.aws.verifiedpermissions.model.ContextDefinition.ReadOnly
    ] = AwsError.unwrapOptionField("context", context)
    def getEntities: ZIO[
      Any,
      AwsError,
      zio.aws.verifiedpermissions.model.EntitiesDefinition.ReadOnly
    ] = AwsError.unwrapOptionField("entities", entities)
  }
  private final class Wrapper(
      impl: software.amazon.awssdk.services.verifiedpermissions.model.IsAuthorizedWithTokenRequest
  ) extends zio.aws.verifiedpermissions.model.IsAuthorizedWithTokenRequest.ReadOnly {
    override val policyStoreId: PolicyStoreId =
      zio.aws.verifiedpermissions.model.primitives
        .PolicyStoreId(impl.policyStoreId())
    override val identityToken: Optional[Token] = zio.aws.core.internal
      .optionalFromNullable(impl.identityToken())
      .map(value => zio.aws.verifiedpermissions.model.primitives.Token(value))
    override val accessToken: Optional[Token] = zio.aws.core.internal
      .optionalFromNullable(impl.accessToken())
      .map(value => zio.aws.verifiedpermissions.model.primitives.Token(value))
    override val action: Optional[
      zio.aws.verifiedpermissions.model.ActionIdentifier.ReadOnly
    ] = zio.aws.core.internal
      .optionalFromNullable(impl.action())
      .map(value =>
        zio.aws.verifiedpermissions.model.ActionIdentifier.wrap(value)
      )
    override val resource: Optional[
      zio.aws.verifiedpermissions.model.EntityIdentifier.ReadOnly
    ] = zio.aws.core.internal
      .optionalFromNullable(impl.resource())
      .map(value =>
        zio.aws.verifiedpermissions.model.EntityIdentifier.wrap(value)
      )
    override val context: Optional[
      zio.aws.verifiedpermissions.model.ContextDefinition.ReadOnly
    ] = zio.aws.core.internal
      .optionalFromNullable(impl.context())
      .map(value =>
        zio.aws.verifiedpermissions.model.ContextDefinition.wrap(value)
      )
    override val entities: Optional[
      zio.aws.verifiedpermissions.model.EntitiesDefinition.ReadOnly
    ] = zio.aws.core.internal
      .optionalFromNullable(impl.entities())
      .map(value =>
        zio.aws.verifiedpermissions.model.EntitiesDefinition.wrap(value)
      )
  }
  def wrap(
      impl: software.amazon.awssdk.services.verifiedpermissions.model.IsAuthorizedWithTokenRequest
  ): zio.aws.verifiedpermissions.model.IsAuthorizedWithTokenRequest.ReadOnly =
    new Wrapper(impl)
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy