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

zio.aws.emrcontainers.model.JobTemplate.scala Maven / Gradle / Ivy

The newest version!
package zio.aws.emrcontainers.model
import zio.aws.emrcontainers.model.primitives.{
  JobTemplateArn,
  Date,
  ResourceIdString,
  StringEmpty256,
  String128,
  String2048,
  RequestIdentityUserArn,
  KmsKeyArn,
  ResourceNameString
}
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 JobTemplate(
    name: Optional[ResourceNameString] = Optional.Absent,
    id: Optional[ResourceIdString] = Optional.Absent,
    arn: Optional[JobTemplateArn] = Optional.Absent,
    createdAt: Optional[Date] = Optional.Absent,
    createdBy: Optional[RequestIdentityUserArn] = Optional.Absent,
    tags: Optional[Map[String128, StringEmpty256]] = Optional.Absent,
    jobTemplateData: zio.aws.emrcontainers.model.JobTemplateData,
    kmsKeyArn: Optional[KmsKeyArn] = Optional.Absent,
    decryptionError: Optional[String2048] = Optional.Absent
) {
  def buildAwsValue()
      : software.amazon.awssdk.services.emrcontainers.model.JobTemplate = {
    import JobTemplate.zioAwsBuilderHelper.BuilderOps
    software.amazon.awssdk.services.emrcontainers.model.JobTemplate
      .builder()
      .optionallyWith(
        name.map(value => ResourceNameString.unwrap(value): java.lang.String)
      )(_.name)
      .optionallyWith(
        id.map(value => ResourceIdString.unwrap(value): java.lang.String)
      )(_.id)
      .optionallyWith(
        arn.map(value => JobTemplateArn.unwrap(value): java.lang.String)
      )(_.arn)
      .optionallyWith(createdAt.map(value => Date.unwrap(value): Instant))(
        _.createdAt
      )
      .optionallyWith(
        createdBy.map(value =>
          RequestIdentityUserArn.unwrap(value): java.lang.String
        )
      )(_.createdBy)
      .optionallyWith(
        tags.map(value =>
          value
            .map({ case (key, value) =>
              (String128.unwrap(key): java.lang.String) -> (StringEmpty256
                .unwrap(value): java.lang.String)
            })
            .asJava
        )
      )(_.tags)
      .jobTemplateData(jobTemplateData.buildAwsValue())
      .optionallyWith(
        kmsKeyArn.map(value => KmsKeyArn.unwrap(value): java.lang.String)
      )(_.kmsKeyArn)
      .optionallyWith(
        decryptionError.map(value => String2048.unwrap(value): java.lang.String)
      )(_.decryptionError)
      .build()
  }
  def asReadOnly: zio.aws.emrcontainers.model.JobTemplate.ReadOnly =
    zio.aws.emrcontainers.model.JobTemplate.wrap(buildAwsValue())
}
object JobTemplate {
  private lazy val zioAwsBuilderHelper: BuilderHelper[
    software.amazon.awssdk.services.emrcontainers.model.JobTemplate
  ] = BuilderHelper.apply
  trait ReadOnly {
    def asEditable: zio.aws.emrcontainers.model.JobTemplate =
      zio.aws.emrcontainers.model.JobTemplate(
        name.map(value => value),
        id.map(value => value),
        arn.map(value => value),
        createdAt.map(value => value),
        createdBy.map(value => value),
        tags.map(value => value),
        jobTemplateData.asEditable,
        kmsKeyArn.map(value => value),
        decryptionError.map(value => value)
      )
    def name: Optional[ResourceNameString]
    def id: Optional[ResourceIdString]
    def arn: Optional[JobTemplateArn]
    def createdAt: Optional[Date]
    def createdBy: Optional[RequestIdentityUserArn]
    def tags: Optional[Map[String128, StringEmpty256]]
    def jobTemplateData: zio.aws.emrcontainers.model.JobTemplateData.ReadOnly
    def kmsKeyArn: Optional[KmsKeyArn]
    def decryptionError: Optional[String2048]
    def getName: ZIO[Any, AwsError, ResourceNameString] =
      AwsError.unwrapOptionField("name", name)
    def getId: ZIO[Any, AwsError, ResourceIdString] =
      AwsError.unwrapOptionField("id", id)
    def getArn: ZIO[Any, AwsError, JobTemplateArn] =
      AwsError.unwrapOptionField("arn", arn)
    def getCreatedAt: ZIO[Any, AwsError, Date] =
      AwsError.unwrapOptionField("createdAt", createdAt)
    def getCreatedBy: ZIO[Any, AwsError, RequestIdentityUserArn] =
      AwsError.unwrapOptionField("createdBy", createdBy)
    def getTags: ZIO[Any, AwsError, Map[String128, StringEmpty256]] =
      AwsError.unwrapOptionField("tags", tags)
    def getJobTemplateData: ZIO[
      Any,
      Nothing,
      zio.aws.emrcontainers.model.JobTemplateData.ReadOnly
    ] = ZIO.succeed(jobTemplateData)
    def getKmsKeyArn: ZIO[Any, AwsError, KmsKeyArn] =
      AwsError.unwrapOptionField("kmsKeyArn", kmsKeyArn)
    def getDecryptionError: ZIO[Any, AwsError, String2048] =
      AwsError.unwrapOptionField("decryptionError", decryptionError)
  }
  private final class Wrapper(
      impl: software.amazon.awssdk.services.emrcontainers.model.JobTemplate
  ) extends zio.aws.emrcontainers.model.JobTemplate.ReadOnly {
    override val name: Optional[ResourceNameString] = zio.aws.core.internal
      .optionalFromNullable(impl.name())
      .map(value =>
        zio.aws.emrcontainers.model.primitives.ResourceNameString(value)
      )
    override val id: Optional[ResourceIdString] = zio.aws.core.internal
      .optionalFromNullable(impl.id())
      .map(value =>
        zio.aws.emrcontainers.model.primitives.ResourceIdString(value)
      )
    override val arn: Optional[JobTemplateArn] = zio.aws.core.internal
      .optionalFromNullable(impl.arn())
      .map(value =>
        zio.aws.emrcontainers.model.primitives.JobTemplateArn(value)
      )
    override val createdAt: Optional[Date] = zio.aws.core.internal
      .optionalFromNullable(impl.createdAt())
      .map(value => zio.aws.emrcontainers.model.primitives.Date(value))
    override val createdBy: Optional[RequestIdentityUserArn] =
      zio.aws.core.internal
        .optionalFromNullable(impl.createdBy())
        .map(value =>
          zio.aws.emrcontainers.model.primitives.RequestIdentityUserArn(value)
        )
    override val tags: Optional[Map[String128, StringEmpty256]] =
      zio.aws.core.internal
        .optionalFromNullable(impl.tags())
        .map(value =>
          value.asScala
            .map({ case (key, value) =>
              zio.aws.emrcontainers.model.primitives.String128(
                key
              ) -> zio.aws.emrcontainers.model.primitives.StringEmpty256(value)
            })
            .toMap
        )
    override val jobTemplateData
        : zio.aws.emrcontainers.model.JobTemplateData.ReadOnly =
      zio.aws.emrcontainers.model.JobTemplateData.wrap(impl.jobTemplateData())
    override val kmsKeyArn: Optional[KmsKeyArn] = zio.aws.core.internal
      .optionalFromNullable(impl.kmsKeyArn())
      .map(value => zio.aws.emrcontainers.model.primitives.KmsKeyArn(value))
    override val decryptionError: Optional[String2048] = zio.aws.core.internal
      .optionalFromNullable(impl.decryptionError())
      .map(value => zio.aws.emrcontainers.model.primitives.String2048(value))
  }
  def wrap(
      impl: software.amazon.awssdk.services.emrcontainers.model.JobTemplate
  ): zio.aws.emrcontainers.model.JobTemplate.ReadOnly = new Wrapper(impl)
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy