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

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

The newest version!
package zio.aws.emrcontainers.model
import zio.ZIO
import zio.aws.core.{AwsError, BuilderHelper}
import zio.prelude.data.Optional
import zio.aws.emrcontainers.model.primitives.{
  StringEmpty256,
  String128,
  ClientToken,
  KmsKeyArn,
  ResourceNameString
}
import scala.jdk.CollectionConverters._
final case class CreateJobTemplateRequest(
    name: ResourceNameString,
    clientToken: ClientToken,
    jobTemplateData: zio.aws.emrcontainers.model.JobTemplateData,
    tags: Optional[Map[String128, StringEmpty256]] = Optional.Absent,
    kmsKeyArn: Optional[KmsKeyArn] = Optional.Absent
) {
  def buildAwsValue()
      : software.amazon.awssdk.services.emrcontainers.model.CreateJobTemplateRequest = {
    import CreateJobTemplateRequest.zioAwsBuilderHelper.BuilderOps
    software.amazon.awssdk.services.emrcontainers.model.CreateJobTemplateRequest
      .builder()
      .name(ResourceNameString.unwrap(name): java.lang.String)
      .clientToken(ClientToken.unwrap(clientToken): java.lang.String)
      .jobTemplateData(jobTemplateData.buildAwsValue())
      .optionallyWith(
        tags.map(value =>
          value
            .map({ case (key, value) =>
              (String128.unwrap(key): java.lang.String) -> (StringEmpty256
                .unwrap(value): java.lang.String)
            })
            .asJava
        )
      )(_.tags)
      .optionallyWith(
        kmsKeyArn.map(value => KmsKeyArn.unwrap(value): java.lang.String)
      )(_.kmsKeyArn)
      .build()
  }
  def asReadOnly
      : zio.aws.emrcontainers.model.CreateJobTemplateRequest.ReadOnly =
    zio.aws.emrcontainers.model.CreateJobTemplateRequest.wrap(buildAwsValue())
}
object CreateJobTemplateRequest {
  private lazy val zioAwsBuilderHelper: BuilderHelper[
    software.amazon.awssdk.services.emrcontainers.model.CreateJobTemplateRequest
  ] = BuilderHelper.apply
  trait ReadOnly {
    def asEditable: zio.aws.emrcontainers.model.CreateJobTemplateRequest =
      zio.aws.emrcontainers.model.CreateJobTemplateRequest(
        name,
        clientToken,
        jobTemplateData.asEditable,
        tags.map(value => value),
        kmsKeyArn.map(value => value)
      )
    def name: ResourceNameString
    def clientToken: ClientToken
    def jobTemplateData: zio.aws.emrcontainers.model.JobTemplateData.ReadOnly
    def tags: Optional[Map[String128, StringEmpty256]]
    def kmsKeyArn: Optional[KmsKeyArn]
    def getName: ZIO[Any, Nothing, ResourceNameString] = ZIO.succeed(name)
    def getClientToken: ZIO[Any, Nothing, ClientToken] =
      ZIO.succeed(clientToken)
    def getJobTemplateData: ZIO[
      Any,
      Nothing,
      zio.aws.emrcontainers.model.JobTemplateData.ReadOnly
    ] = ZIO.succeed(jobTemplateData)
    def getTags: ZIO[Any, AwsError, Map[String128, StringEmpty256]] =
      AwsError.unwrapOptionField("tags", tags)
    def getKmsKeyArn: ZIO[Any, AwsError, KmsKeyArn] =
      AwsError.unwrapOptionField("kmsKeyArn", kmsKeyArn)
  }
  private final class Wrapper(
      impl: software.amazon.awssdk.services.emrcontainers.model.CreateJobTemplateRequest
  ) extends zio.aws.emrcontainers.model.CreateJobTemplateRequest.ReadOnly {
    override val name: ResourceNameString =
      zio.aws.emrcontainers.model.primitives.ResourceNameString(impl.name())
    override val clientToken: ClientToken =
      zio.aws.emrcontainers.model.primitives.ClientToken(impl.clientToken())
    override val jobTemplateData
        : zio.aws.emrcontainers.model.JobTemplateData.ReadOnly =
      zio.aws.emrcontainers.model.JobTemplateData.wrap(impl.jobTemplateData())
    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 kmsKeyArn: Optional[KmsKeyArn] = zio.aws.core.internal
      .optionalFromNullable(impl.kmsKeyArn())
      .map(value => zio.aws.emrcontainers.model.primitives.KmsKeyArn(value))
  }
  def wrap(
      impl: software.amazon.awssdk.services.emrcontainers.model.CreateJobTemplateRequest
  ): zio.aws.emrcontainers.model.CreateJobTemplateRequest.ReadOnly =
    new Wrapper(impl)
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy