zio.aws.snowdevicemanagement.model.EbsInstanceBlockDevice.scala Maven / Gradle / Ivy
The newest version!
package zio.aws.snowdevicemanagement.model
import zio.aws.snowdevicemanagement.model.primitives.Timestamp
import java.time.Instant
import zio.prelude.data.Optional
import zio.aws.core.{AwsError, BuilderHelper}
import zio.ZIO
import scala.jdk.CollectionConverters._
final case class EbsInstanceBlockDevice(
attachTime: Optional[Timestamp] = Optional.Absent,
deleteOnTermination: Optional[Boolean] = Optional.Absent,
status: Optional[zio.aws.snowdevicemanagement.model.AttachmentStatus] =
Optional.Absent,
volumeId: Optional[String] = Optional.Absent
) {
def buildAwsValue()
: software.amazon.awssdk.services.snowdevicemanagement.model.EbsInstanceBlockDevice = {
import EbsInstanceBlockDevice.zioAwsBuilderHelper.BuilderOps
software.amazon.awssdk.services.snowdevicemanagement.model.EbsInstanceBlockDevice
.builder()
.optionallyWith(
attachTime.map(value => Timestamp.unwrap(value): Instant)
)(_.attachTime)
.optionallyWith(
deleteOnTermination.map(value => value: java.lang.Boolean)
)(_.deleteOnTermination)
.optionallyWith(status.map(value => value.unwrap))(_.status)
.optionallyWith(volumeId.map(value => value: java.lang.String))(
_.volumeId
)
.build()
}
def asReadOnly
: zio.aws.snowdevicemanagement.model.EbsInstanceBlockDevice.ReadOnly =
zio.aws.snowdevicemanagement.model.EbsInstanceBlockDevice
.wrap(buildAwsValue())
}
object EbsInstanceBlockDevice {
private lazy val zioAwsBuilderHelper: BuilderHelper[
software.amazon.awssdk.services.snowdevicemanagement.model.EbsInstanceBlockDevice
] = BuilderHelper.apply
trait ReadOnly {
def asEditable: zio.aws.snowdevicemanagement.model.EbsInstanceBlockDevice =
zio.aws.snowdevicemanagement.model.EbsInstanceBlockDevice(
attachTime.map(value => value),
deleteOnTermination.map(value => value),
status.map(value => value),
volumeId.map(value => value)
)
def attachTime: Optional[Timestamp]
def deleteOnTermination: Optional[Boolean]
def status: Optional[zio.aws.snowdevicemanagement.model.AttachmentStatus]
def volumeId: Optional[String]
def getAttachTime: ZIO[Any, AwsError, Timestamp] =
AwsError.unwrapOptionField("attachTime", attachTime)
def getDeleteOnTermination: ZIO[Any, AwsError, Boolean] =
AwsError.unwrapOptionField("deleteOnTermination", deleteOnTermination)
def getStatus: ZIO[
Any,
AwsError,
zio.aws.snowdevicemanagement.model.AttachmentStatus
] = AwsError.unwrapOptionField("status", status)
def getVolumeId: ZIO[Any, AwsError, String] =
AwsError.unwrapOptionField("volumeId", volumeId)
}
private final class Wrapper(
impl: software.amazon.awssdk.services.snowdevicemanagement.model.EbsInstanceBlockDevice
) extends zio.aws.snowdevicemanagement.model.EbsInstanceBlockDevice.ReadOnly {
override val attachTime: Optional[Timestamp] = zio.aws.core.internal
.optionalFromNullable(impl.attachTime())
.map(value =>
zio.aws.snowdevicemanagement.model.primitives.Timestamp(value)
)
override val deleteOnTermination: Optional[Boolean] = zio.aws.core.internal
.optionalFromNullable(impl.deleteOnTermination())
.map(value => value: Boolean)
override val status
: Optional[zio.aws.snowdevicemanagement.model.AttachmentStatus] =
zio.aws.core.internal
.optionalFromNullable(impl.status())
.map(value =>
zio.aws.snowdevicemanagement.model.AttachmentStatus.wrap(value)
)
override val volumeId: Optional[String] = zio.aws.core.internal
.optionalFromNullable(impl.volumeId())
.map(value => value: String)
}
def wrap(
impl: software.amazon.awssdk.services.snowdevicemanagement.model.EbsInstanceBlockDevice
): zio.aws.snowdevicemanagement.model.EbsInstanceBlockDevice.ReadOnly =
new Wrapper(impl)
}