All Downloads are FREE. Search and download functionalities are using the official Maven repository.

zio.aws.snowdevicemanagement.model.Instance.scala Maven / Gradle / Ivy

The newest version!
package zio.aws.snowdevicemanagement.model
import zio.aws.snowdevicemanagement.model.primitives.{Timestamp, Integer}
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 Instance(
    amiLaunchIndex: Optional[Integer] = Optional.Absent,
    blockDeviceMappings: Optional[
      Iterable[zio.aws.snowdevicemanagement.model.InstanceBlockDeviceMapping]
    ] = Optional.Absent,
    cpuOptions: Optional[zio.aws.snowdevicemanagement.model.CpuOptions] =
      Optional.Absent,
    createdAt: Optional[Timestamp] = Optional.Absent,
    imageId: Optional[String] = Optional.Absent,
    instanceId: Optional[String] = Optional.Absent,
    instanceType: Optional[String] = Optional.Absent,
    privateIpAddress: Optional[String] = Optional.Absent,
    publicIpAddress: Optional[String] = Optional.Absent,
    rootDeviceName: Optional[String] = Optional.Absent,
    securityGroups: Optional[
      Iterable[zio.aws.snowdevicemanagement.model.SecurityGroupIdentifier]
    ] = Optional.Absent,
    state: Optional[zio.aws.snowdevicemanagement.model.InstanceState] =
      Optional.Absent,
    updatedAt: Optional[Timestamp] = Optional.Absent
) {
  def buildAwsValue()
      : software.amazon.awssdk.services.snowdevicemanagement.model.Instance = {
    import Instance.zioAwsBuilderHelper.BuilderOps
    software.amazon.awssdk.services.snowdevicemanagement.model.Instance
      .builder()
      .optionallyWith(amiLaunchIndex.map(value => value: java.lang.Integer))(
        _.amiLaunchIndex
      )
      .optionallyWith(
        blockDeviceMappings.map(value =>
          value.map { item =>
            item.buildAwsValue()
          }.asJavaCollection
        )
      )(_.blockDeviceMappings)
      .optionallyWith(cpuOptions.map(value => value.buildAwsValue()))(
        _.cpuOptions
      )
      .optionallyWith(createdAt.map(value => Timestamp.unwrap(value): Instant))(
        _.createdAt
      )
      .optionallyWith(imageId.map(value => value: java.lang.String))(_.imageId)
      .optionallyWith(instanceId.map(value => value: java.lang.String))(
        _.instanceId
      )
      .optionallyWith(instanceType.map(value => value: java.lang.String))(
        _.instanceType
      )
      .optionallyWith(privateIpAddress.map(value => value: java.lang.String))(
        _.privateIpAddress
      )
      .optionallyWith(publicIpAddress.map(value => value: java.lang.String))(
        _.publicIpAddress
      )
      .optionallyWith(rootDeviceName.map(value => value: java.lang.String))(
        _.rootDeviceName
      )
      .optionallyWith(
        securityGroups.map(value =>
          value.map { item =>
            item.buildAwsValue()
          }.asJavaCollection
        )
      )(_.securityGroups)
      .optionallyWith(state.map(value => value.buildAwsValue()))(_.state)
      .optionallyWith(updatedAt.map(value => Timestamp.unwrap(value): Instant))(
        _.updatedAt
      )
      .build()
  }
  def asReadOnly: zio.aws.snowdevicemanagement.model.Instance.ReadOnly =
    zio.aws.snowdevicemanagement.model.Instance.wrap(buildAwsValue())
}
object Instance {
  private lazy val zioAwsBuilderHelper: BuilderHelper[
    software.amazon.awssdk.services.snowdevicemanagement.model.Instance
  ] = BuilderHelper.apply
  trait ReadOnly {
    def asEditable: zio.aws.snowdevicemanagement.model.Instance =
      zio.aws.snowdevicemanagement.model.Instance(
        amiLaunchIndex.map(value => value),
        blockDeviceMappings.map(value =>
          value.map { item =>
            item.asEditable
          }
        ),
        cpuOptions.map(value => value.asEditable),
        createdAt.map(value => value),
        imageId.map(value => value),
        instanceId.map(value => value),
        instanceType.map(value => value),
        privateIpAddress.map(value => value),
        publicIpAddress.map(value => value),
        rootDeviceName.map(value => value),
        securityGroups.map(value =>
          value.map { item =>
            item.asEditable
          }
        ),
        state.map(value => value.asEditable),
        updatedAt.map(value => value)
      )
    def amiLaunchIndex: Optional[Integer]
    def blockDeviceMappings: Optional[List[
      zio.aws.snowdevicemanagement.model.InstanceBlockDeviceMapping.ReadOnly
    ]]
    def cpuOptions
        : Optional[zio.aws.snowdevicemanagement.model.CpuOptions.ReadOnly]
    def createdAt: Optional[Timestamp]
    def imageId: Optional[String]
    def instanceId: Optional[String]
    def instanceType: Optional[String]
    def privateIpAddress: Optional[String]
    def publicIpAddress: Optional[String]
    def rootDeviceName: Optional[String]
    def securityGroups: Optional[
      List[zio.aws.snowdevicemanagement.model.SecurityGroupIdentifier.ReadOnly]
    ]
    def state
        : Optional[zio.aws.snowdevicemanagement.model.InstanceState.ReadOnly]
    def updatedAt: Optional[Timestamp]
    def getAmiLaunchIndex: ZIO[Any, AwsError, Integer] =
      AwsError.unwrapOptionField("amiLaunchIndex", amiLaunchIndex)
    def getBlockDeviceMappings: ZIO[Any, AwsError, List[
      zio.aws.snowdevicemanagement.model.InstanceBlockDeviceMapping.ReadOnly
    ]] = AwsError.unwrapOptionField("blockDeviceMappings", blockDeviceMappings)
    def getCpuOptions: ZIO[
      Any,
      AwsError,
      zio.aws.snowdevicemanagement.model.CpuOptions.ReadOnly
    ] = AwsError.unwrapOptionField("cpuOptions", cpuOptions)
    def getCreatedAt: ZIO[Any, AwsError, Timestamp] =
      AwsError.unwrapOptionField("createdAt", createdAt)
    def getImageId: ZIO[Any, AwsError, String] =
      AwsError.unwrapOptionField("imageId", imageId)
    def getInstanceId: ZIO[Any, AwsError, String] =
      AwsError.unwrapOptionField("instanceId", instanceId)
    def getInstanceType: ZIO[Any, AwsError, String] =
      AwsError.unwrapOptionField("instanceType", instanceType)
    def getPrivateIpAddress: ZIO[Any, AwsError, String] =
      AwsError.unwrapOptionField("privateIpAddress", privateIpAddress)
    def getPublicIpAddress: ZIO[Any, AwsError, String] =
      AwsError.unwrapOptionField("publicIpAddress", publicIpAddress)
    def getRootDeviceName: ZIO[Any, AwsError, String] =
      AwsError.unwrapOptionField("rootDeviceName", rootDeviceName)
    def getSecurityGroups: ZIO[Any, AwsError, List[
      zio.aws.snowdevicemanagement.model.SecurityGroupIdentifier.ReadOnly
    ]] = AwsError.unwrapOptionField("securityGroups", securityGroups)
    def getState: ZIO[
      Any,
      AwsError,
      zio.aws.snowdevicemanagement.model.InstanceState.ReadOnly
    ] = AwsError.unwrapOptionField("state", state)
    def getUpdatedAt: ZIO[Any, AwsError, Timestamp] =
      AwsError.unwrapOptionField("updatedAt", updatedAt)
  }
  private final class Wrapper(
      impl: software.amazon.awssdk.services.snowdevicemanagement.model.Instance
  ) extends zio.aws.snowdevicemanagement.model.Instance.ReadOnly {
    override val amiLaunchIndex: Optional[Integer] = zio.aws.core.internal
      .optionalFromNullable(impl.amiLaunchIndex())
      .map(value => value: Integer)
    override val blockDeviceMappings: Optional[List[
      zio.aws.snowdevicemanagement.model.InstanceBlockDeviceMapping.ReadOnly
    ]] = zio.aws.core.internal
      .optionalFromNullable(impl.blockDeviceMappings())
      .map(value =>
        value.asScala.map { item =>
          zio.aws.snowdevicemanagement.model.InstanceBlockDeviceMapping
            .wrap(item)
        }.toList
      )
    override val cpuOptions
        : Optional[zio.aws.snowdevicemanagement.model.CpuOptions.ReadOnly] =
      zio.aws.core.internal
        .optionalFromNullable(impl.cpuOptions())
        .map(value => zio.aws.snowdevicemanagement.model.CpuOptions.wrap(value))
    override val createdAt: Optional[Timestamp] = zio.aws.core.internal
      .optionalFromNullable(impl.createdAt())
      .map(value =>
        zio.aws.snowdevicemanagement.model.primitives.Timestamp(value)
      )
    override val imageId: Optional[String] = zio.aws.core.internal
      .optionalFromNullable(impl.imageId())
      .map(value => value: String)
    override val instanceId: Optional[String] = zio.aws.core.internal
      .optionalFromNullable(impl.instanceId())
      .map(value => value: String)
    override val instanceType: Optional[String] = zio.aws.core.internal
      .optionalFromNullable(impl.instanceType())
      .map(value => value: String)
    override val privateIpAddress: Optional[String] = zio.aws.core.internal
      .optionalFromNullable(impl.privateIpAddress())
      .map(value => value: String)
    override val publicIpAddress: Optional[String] = zio.aws.core.internal
      .optionalFromNullable(impl.publicIpAddress())
      .map(value => value: String)
    override val rootDeviceName: Optional[String] = zio.aws.core.internal
      .optionalFromNullable(impl.rootDeviceName())
      .map(value => value: String)
    override val securityGroups: Optional[
      List[zio.aws.snowdevicemanagement.model.SecurityGroupIdentifier.ReadOnly]
    ] = zio.aws.core.internal
      .optionalFromNullable(impl.securityGroups())
      .map(value =>
        value.asScala.map { item =>
          zio.aws.snowdevicemanagement.model.SecurityGroupIdentifier.wrap(item)
        }.toList
      )
    override val state
        : Optional[zio.aws.snowdevicemanagement.model.InstanceState.ReadOnly] =
      zio.aws.core.internal
        .optionalFromNullable(impl.state())
        .map(value =>
          zio.aws.snowdevicemanagement.model.InstanceState.wrap(value)
        )
    override val updatedAt: Optional[Timestamp] = zio.aws.core.internal
      .optionalFromNullable(impl.updatedAt())
      .map(value =>
        zio.aws.snowdevicemanagement.model.primitives.Timestamp(value)
      )
  }
  def wrap(
      impl: software.amazon.awssdk.services.snowdevicemanagement.model.Instance
  ): zio.aws.snowdevicemanagement.model.Instance.ReadOnly = new Wrapper(impl)
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy