zio.aws.snowdevicemanagement.model.CreateTaskRequest.scala Maven / Gradle / Ivy
The newest version!
package zio.aws.snowdevicemanagement.model
import zio.ZIO
import zio.aws.core.{AwsError, BuilderHelper}
import zio.prelude.data.Optional
import zio.aws.snowdevicemanagement.model.primitives.{
TaskDescriptionString,
IdempotencyToken
}
import scala.jdk.CollectionConverters._
final case class CreateTaskRequest(
clientToken: Optional[IdempotencyToken] = Optional.Absent,
command: zio.aws.snowdevicemanagement.model.Command,
description: Optional[TaskDescriptionString] = Optional.Absent,
tags: Optional[Map[String, String]] = Optional.Absent,
targets: Iterable[String]
) {
def buildAwsValue()
: software.amazon.awssdk.services.snowdevicemanagement.model.CreateTaskRequest = {
import CreateTaskRequest.zioAwsBuilderHelper.BuilderOps
software.amazon.awssdk.services.snowdevicemanagement.model.CreateTaskRequest
.builder()
.optionallyWith(
clientToken.map(value =>
IdempotencyToken.unwrap(value): java.lang.String
)
)(_.clientToken)
.command(command.buildAwsValue())
.optionallyWith(
description.map(value =>
TaskDescriptionString.unwrap(value): java.lang.String
)
)(_.description)
.optionallyWith(
tags.map(value =>
value
.map({ case (key, value) =>
(key: java.lang.String) -> (value: java.lang.String)
})
.asJava
)
)(_.tags)
.targets(targets.map { item =>
item: java.lang.String
}.asJavaCollection)
.build()
}
def asReadOnly
: zio.aws.snowdevicemanagement.model.CreateTaskRequest.ReadOnly =
zio.aws.snowdevicemanagement.model.CreateTaskRequest.wrap(buildAwsValue())
}
object CreateTaskRequest {
private lazy val zioAwsBuilderHelper: BuilderHelper[
software.amazon.awssdk.services.snowdevicemanagement.model.CreateTaskRequest
] = BuilderHelper.apply
trait ReadOnly {
def asEditable: zio.aws.snowdevicemanagement.model.CreateTaskRequest =
zio.aws.snowdevicemanagement.model.CreateTaskRequest(
clientToken.map(value => value),
command.asEditable,
description.map(value => value),
tags.map(value => value),
targets
)
def clientToken: Optional[IdempotencyToken]
def command: zio.aws.snowdevicemanagement.model.Command.ReadOnly
def description: Optional[TaskDescriptionString]
def tags: Optional[Map[String, String]]
def targets: List[String]
def getClientToken: ZIO[Any, AwsError, IdempotencyToken] =
AwsError.unwrapOptionField("clientToken", clientToken)
def getCommand: ZIO[
Any,
Nothing,
zio.aws.snowdevicemanagement.model.Command.ReadOnly
] = ZIO.succeed(command)
def getDescription: ZIO[Any, AwsError, TaskDescriptionString] =
AwsError.unwrapOptionField("description", description)
def getTags: ZIO[Any, AwsError, Map[String, String]] =
AwsError.unwrapOptionField("tags", tags)
def getTargets: ZIO[Any, Nothing, List[String]] = ZIO.succeed(targets)
}
private final class Wrapper(
impl: software.amazon.awssdk.services.snowdevicemanagement.model.CreateTaskRequest
) extends zio.aws.snowdevicemanagement.model.CreateTaskRequest.ReadOnly {
override val clientToken: Optional[IdempotencyToken] = zio.aws.core.internal
.optionalFromNullable(impl.clientToken())
.map(value =>
zio.aws.snowdevicemanagement.model.primitives.IdempotencyToken(value)
)
override val command: zio.aws.snowdevicemanagement.model.Command.ReadOnly =
zio.aws.snowdevicemanagement.model.Command.wrap(impl.command())
override val description: Optional[TaskDescriptionString] =
zio.aws.core.internal
.optionalFromNullable(impl.description())
.map(value =>
zio.aws.snowdevicemanagement.model.primitives
.TaskDescriptionString(value)
)
override val tags: Optional[Map[String, String]] = zio.aws.core.internal
.optionalFromNullable(impl.tags())
.map(value =>
value.asScala
.map({ case (key, value) =>
(key: String) -> (value: String)
})
.toMap
)
override val targets: List[String] = impl
.targets()
.asScala
.map { item =>
item: String
}
.toList
}
def wrap(
impl: software.amazon.awssdk.services.snowdevicemanagement.model.CreateTaskRequest
): zio.aws.snowdevicemanagement.model.CreateTaskRequest.ReadOnly =
new Wrapper(impl)
}