zio.aws.verifiedpermissions.model.StaticPolicyDefinition.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 StaticPolicyDefinition(
description: Optional[StaticPolicyDescription] = Optional.Absent,
statement: PolicyStatement
) {
def buildAwsValue()
: software.amazon.awssdk.services.verifiedpermissions.model.StaticPolicyDefinition = {
import StaticPolicyDefinition.zioAwsBuilderHelper.BuilderOps
software.amazon.awssdk.services.verifiedpermissions.model.StaticPolicyDefinition
.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.StaticPolicyDefinition.ReadOnly =
zio.aws.verifiedpermissions.model.StaticPolicyDefinition
.wrap(buildAwsValue())
}
object StaticPolicyDefinition {
private lazy val zioAwsBuilderHelper: BuilderHelper[
software.amazon.awssdk.services.verifiedpermissions.model.StaticPolicyDefinition
] = BuilderHelper.apply
trait ReadOnly {
def asEditable: zio.aws.verifiedpermissions.model.StaticPolicyDefinition =
zio.aws.verifiedpermissions.model
.StaticPolicyDefinition(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.StaticPolicyDefinition
) extends zio.aws.verifiedpermissions.model.StaticPolicyDefinition.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.StaticPolicyDefinition
): zio.aws.verifiedpermissions.model.StaticPolicyDefinition.ReadOnly =
new Wrapper(impl)
}