zio.aws.verifiedpermissions.model.UpdateStaticPolicyDefinition.scala Maven / Gradle / Ivy
package zio.aws.verifiedpermissions.model
import zio.aws.verifiedpermissions.model.primitives.{
PolicyStatement,
StaticPolicyDescription
}
import zio.ZIO
import zio.aws.core.{AwsError, BuilderHelper}
import zio.prelude.data.Optional
import scala.jdk.CollectionConverters._
final case class UpdateStaticPolicyDefinition(
description: Optional[StaticPolicyDescription] = Optional.Absent,
statement: PolicyStatement
) {
def buildAwsValue()
: software.amazon.awssdk.services.verifiedpermissions.model.UpdateStaticPolicyDefinition = {
import UpdateStaticPolicyDefinition.zioAwsBuilderHelper.BuilderOps
software.amazon.awssdk.services.verifiedpermissions.model.UpdateStaticPolicyDefinition
.builder()
.optionallyWith(
description.map(value =>
StaticPolicyDescription.unwrap(value): java.lang.String
)
)(_.description)
.statement(PolicyStatement.unwrap(statement): java.lang.String)
.build()
}
def asReadOnly
: zio.aws.verifiedpermissions.model.UpdateStaticPolicyDefinition.ReadOnly =
zio.aws.verifiedpermissions.model.UpdateStaticPolicyDefinition
.wrap(buildAwsValue())
}
object UpdateStaticPolicyDefinition {
private lazy val zioAwsBuilderHelper: BuilderHelper[
software.amazon.awssdk.services.verifiedpermissions.model.UpdateStaticPolicyDefinition
] = BuilderHelper.apply
trait ReadOnly {
def asEditable
: zio.aws.verifiedpermissions.model.UpdateStaticPolicyDefinition =
zio.aws.verifiedpermissions.model.UpdateStaticPolicyDefinition(
description.map(value => value),
statement
)
def description: Optional[StaticPolicyDescription]
def statement: PolicyStatement
def getDescription: ZIO[Any, AwsError, StaticPolicyDescription] =
AwsError.unwrapOptionField("description", description)
def getStatement: ZIO[Any, Nothing, PolicyStatement] =
ZIO.succeed(statement)
}
private final class Wrapper(
impl: software.amazon.awssdk.services.verifiedpermissions.model.UpdateStaticPolicyDefinition
) extends zio.aws.verifiedpermissions.model.UpdateStaticPolicyDefinition.ReadOnly {
override val description: Optional[StaticPolicyDescription] =
zio.aws.core.internal
.optionalFromNullable(impl.description())
.map(value =>
zio.aws.verifiedpermissions.model.primitives
.StaticPolicyDescription(value)
)
override val statement: PolicyStatement =
zio.aws.verifiedpermissions.model.primitives
.PolicyStatement(impl.statement())
}
def wrap(
impl: software.amazon.awssdk.services.verifiedpermissions.model.UpdateStaticPolicyDefinition
): zio.aws.verifiedpermissions.model.UpdateStaticPolicyDefinition.ReadOnly =
new Wrapper(impl)
}