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