zio.aws.verifiedpermissions.model.UpdatePolicyResponse.scala Maven / Gradle / Ivy
package zio.aws.verifiedpermissions.model
import java.time.Instant
import zio.prelude.data.Optional
import zio.aws.core.{AwsError, BuilderHelper}
import zio.ZIO
import zio.aws.verifiedpermissions.model.primitives.{
TimestampFormat,
PolicyId,
PolicyStoreId
}
import scala.jdk.CollectionConverters._
final case class UpdatePolicyResponse(
policyStoreId: PolicyStoreId,
policyId: PolicyId,
policyType: zio.aws.verifiedpermissions.model.PolicyType,
principal: Optional[zio.aws.verifiedpermissions.model.EntityIdentifier] =
Optional.Absent,
resource: Optional[zio.aws.verifiedpermissions.model.EntityIdentifier] =
Optional.Absent,
createdDate: TimestampFormat,
lastUpdatedDate: TimestampFormat
) {
def buildAwsValue()
: software.amazon.awssdk.services.verifiedpermissions.model.UpdatePolicyResponse = {
import UpdatePolicyResponse.zioAwsBuilderHelper.BuilderOps
software.amazon.awssdk.services.verifiedpermissions.model.UpdatePolicyResponse
.builder()
.policyStoreId(PolicyStoreId.unwrap(policyStoreId): java.lang.String)
.policyId(PolicyId.unwrap(policyId): java.lang.String)
.policyType(policyType.unwrap)
.optionallyWith(principal.map(value => value.buildAwsValue()))(
_.principal
)
.optionallyWith(resource.map(value => value.buildAwsValue()))(_.resource)
.createdDate(TimestampFormat.unwrap(createdDate): Instant)
.lastUpdatedDate(TimestampFormat.unwrap(lastUpdatedDate): Instant)
.build()
}
def asReadOnly
: zio.aws.verifiedpermissions.model.UpdatePolicyResponse.ReadOnly =
zio.aws.verifiedpermissions.model.UpdatePolicyResponse.wrap(buildAwsValue())
}
object UpdatePolicyResponse {
private lazy val zioAwsBuilderHelper: BuilderHelper[
software.amazon.awssdk.services.verifiedpermissions.model.UpdatePolicyResponse
] = BuilderHelper.apply
trait ReadOnly {
def asEditable: zio.aws.verifiedpermissions.model.UpdatePolicyResponse =
zio.aws.verifiedpermissions.model.UpdatePolicyResponse(
policyStoreId,
policyId,
policyType,
principal.map(value => value.asEditable),
resource.map(value => value.asEditable),
createdDate,
lastUpdatedDate
)
def policyStoreId: PolicyStoreId
def policyId: PolicyId
def policyType: zio.aws.verifiedpermissions.model.PolicyType
def principal
: Optional[zio.aws.verifiedpermissions.model.EntityIdentifier.ReadOnly]
def resource
: Optional[zio.aws.verifiedpermissions.model.EntityIdentifier.ReadOnly]
def createdDate: TimestampFormat
def lastUpdatedDate: TimestampFormat
def getPolicyStoreId: ZIO[Any, Nothing, PolicyStoreId] =
ZIO.succeed(policyStoreId)
def getPolicyId: ZIO[Any, Nothing, PolicyId] = ZIO.succeed(policyId)
def getPolicyType
: ZIO[Any, Nothing, zio.aws.verifiedpermissions.model.PolicyType] =
ZIO.succeed(policyType)
def getPrincipal: ZIO[
Any,
AwsError,
zio.aws.verifiedpermissions.model.EntityIdentifier.ReadOnly
] = AwsError.unwrapOptionField("principal", principal)
def getResource: ZIO[
Any,
AwsError,
zio.aws.verifiedpermissions.model.EntityIdentifier.ReadOnly
] = AwsError.unwrapOptionField("resource", resource)
def getCreatedDate: ZIO[Any, Nothing, TimestampFormat] =
ZIO.succeed(createdDate)
def getLastUpdatedDate: ZIO[Any, Nothing, TimestampFormat] =
ZIO.succeed(lastUpdatedDate)
}
private final class Wrapper(
impl: software.amazon.awssdk.services.verifiedpermissions.model.UpdatePolicyResponse
) extends zio.aws.verifiedpermissions.model.UpdatePolicyResponse.ReadOnly {
override val policyStoreId: PolicyStoreId =
zio.aws.verifiedpermissions.model.primitives
.PolicyStoreId(impl.policyStoreId())
override val policyId: PolicyId =
zio.aws.verifiedpermissions.model.primitives.PolicyId(impl.policyId())
override val policyType: zio.aws.verifiedpermissions.model.PolicyType =
zio.aws.verifiedpermissions.model.PolicyType.wrap(impl.policyType())
override val principal: Optional[
zio.aws.verifiedpermissions.model.EntityIdentifier.ReadOnly
] = zio.aws.core.internal
.optionalFromNullable(impl.principal())
.map(value =>
zio.aws.verifiedpermissions.model.EntityIdentifier.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 createdDate: TimestampFormat =
zio.aws.verifiedpermissions.model.primitives
.TimestampFormat(impl.createdDate())
override val lastUpdatedDate: TimestampFormat =
zio.aws.verifiedpermissions.model.primitives
.TimestampFormat(impl.lastUpdatedDate())
}
def wrap(
impl: software.amazon.awssdk.services.verifiedpermissions.model.UpdatePolicyResponse
): zio.aws.verifiedpermissions.model.UpdatePolicyResponse.ReadOnly =
new Wrapper(impl)
}