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

zio.aws.ssm.model.SendCommandRequest.scala Maven / Gradle / Ivy

There is a newer version: 7.28.26.1
Show newest version
package zio.aws.ssm.model
import zio.prelude.data.Optional
import zio.aws.core.{AwsError, BuilderHelper}
import zio.ZIO
import java.lang.Integer
import zio.aws.ssm.model.primitives.{
  DocumentHash,
  Comment,
  ParameterName,
  ParameterValue,
  TimeoutSeconds,
  DocumentARN,
  InstanceId,
  S3Region,
  DocumentVersion,
  S3KeyPrefix,
  S3BucketName,
  ServiceRole,
  MaxConcurrency,
  MaxErrors
}
import scala.jdk.CollectionConverters.*
final case class SendCommandRequest(
    instanceIds: Optional[Iterable[InstanceId]] = Optional.Absent,
    targets: Optional[Iterable[zio.aws.ssm.model.Target]] = Optional.Absent,
    documentName: DocumentARN,
    documentVersion: Optional[DocumentVersion] = Optional.Absent,
    documentHash: Optional[DocumentHash] = Optional.Absent,
    documentHashType: Optional[zio.aws.ssm.model.DocumentHashType] =
      Optional.Absent,
    timeoutSeconds: Optional[TimeoutSeconds] = Optional.Absent,
    comment: Optional[Comment] = Optional.Absent,
    parameters: Optional[Map[ParameterName, Iterable[ParameterValue]]] =
      Optional.Absent,
    outputS3Region: Optional[S3Region] = Optional.Absent,
    outputS3BucketName: Optional[S3BucketName] = Optional.Absent,
    outputS3KeyPrefix: Optional[S3KeyPrefix] = Optional.Absent,
    maxConcurrency: Optional[MaxConcurrency] = Optional.Absent,
    maxErrors: Optional[MaxErrors] = Optional.Absent,
    serviceRoleArn: Optional[ServiceRole] = Optional.Absent,
    notificationConfig: Optional[zio.aws.ssm.model.NotificationConfig] =
      Optional.Absent,
    cloudWatchOutputConfig: Optional[zio.aws.ssm.model.CloudWatchOutputConfig] =
      Optional.Absent,
    alarmConfiguration: Optional[zio.aws.ssm.model.AlarmConfiguration] =
      Optional.Absent
) {
  def buildAwsValue()
      : software.amazon.awssdk.services.ssm.model.SendCommandRequest = {
    import SendCommandRequest.zioAwsBuilderHelper.BuilderOps
    software.amazon.awssdk.services.ssm.model.SendCommandRequest
      .builder()
      .optionallyWith(
        instanceIds.map(value =>
          value.map { item =>
            InstanceId.unwrap(item): java.lang.String
          }.asJavaCollection
        )
      )(_.instanceIds)
      .optionallyWith(
        targets.map(value =>
          value.map { item =>
            item.buildAwsValue()
          }.asJavaCollection
        )
      )(_.targets)
      .documentName(DocumentARN.unwrap(documentName): java.lang.String)
      .optionallyWith(
        documentVersion.map(value =>
          DocumentVersion.unwrap(value): java.lang.String
        )
      )(_.documentVersion)
      .optionallyWith(
        documentHash.map(value => DocumentHash.unwrap(value): java.lang.String)
      )(_.documentHash)
      .optionallyWith(documentHashType.map(value => value.unwrap))(
        _.documentHashType
      )
      .optionallyWith(
        timeoutSeconds.map(value => TimeoutSeconds.unwrap(value): Integer)
      )(_.timeoutSeconds)
      .optionallyWith(
        comment.map(value => Comment.unwrap(value): java.lang.String)
      )(_.comment)
      .optionallyWith(
        parameters.map(value =>
          value
            .map({ case (key, value) =>
              (ParameterName.unwrap(key): java.lang.String) -> value.map {
                item =>
                  ParameterValue.unwrap(item): java.lang.String
              }.asJavaCollection
            })
            .asJava
        )
      )(_.parameters)
      .optionallyWith(
        outputS3Region.map(value => S3Region.unwrap(value): java.lang.String)
      )(_.outputS3Region)
      .optionallyWith(
        outputS3BucketName.map(value =>
          S3BucketName.unwrap(value): java.lang.String
        )
      )(_.outputS3BucketName)
      .optionallyWith(
        outputS3KeyPrefix.map(value =>
          S3KeyPrefix.unwrap(value): java.lang.String
        )
      )(_.outputS3KeyPrefix)
      .optionallyWith(
        maxConcurrency.map(value =>
          MaxConcurrency.unwrap(value): java.lang.String
        )
      )(_.maxConcurrency)
      .optionallyWith(
        maxErrors.map(value => MaxErrors.unwrap(value): java.lang.String)
      )(_.maxErrors)
      .optionallyWith(
        serviceRoleArn.map(value => ServiceRole.unwrap(value): java.lang.String)
      )(_.serviceRoleArn)
      .optionallyWith(notificationConfig.map(value => value.buildAwsValue()))(
        _.notificationConfig
      )
      .optionallyWith(
        cloudWatchOutputConfig.map(value => value.buildAwsValue())
      )(_.cloudWatchOutputConfig)
      .optionallyWith(alarmConfiguration.map(value => value.buildAwsValue()))(
        _.alarmConfiguration
      )
      .build()
  }
  def asReadOnly: zio.aws.ssm.model.SendCommandRequest.ReadOnly =
    zio.aws.ssm.model.SendCommandRequest.wrap(buildAwsValue())
}
object SendCommandRequest {
  private lazy val zioAwsBuilderHelper: BuilderHelper[
    software.amazon.awssdk.services.ssm.model.SendCommandRequest
  ] = BuilderHelper.apply
  trait ReadOnly {
    def asEditable: zio.aws.ssm.model.SendCommandRequest =
      zio.aws.ssm.model.SendCommandRequest(
        instanceIds.map(value => value),
        targets.map(value =>
          value.map { item =>
            item.asEditable
          }
        ),
        documentName,
        documentVersion.map(value => value),
        documentHash.map(value => value),
        documentHashType.map(value => value),
        timeoutSeconds.map(value => value),
        comment.map(value => value),
        parameters.map(value => value),
        outputS3Region.map(value => value),
        outputS3BucketName.map(value => value),
        outputS3KeyPrefix.map(value => value),
        maxConcurrency.map(value => value),
        maxErrors.map(value => value),
        serviceRoleArn.map(value => value),
        notificationConfig.map(value => value.asEditable),
        cloudWatchOutputConfig.map(value => value.asEditable),
        alarmConfiguration.map(value => value.asEditable)
      )
    def instanceIds: Optional[List[InstanceId]]
    def targets: Optional[List[zio.aws.ssm.model.Target.ReadOnly]]
    def documentName: DocumentARN
    def documentVersion: Optional[DocumentVersion]
    def documentHash: Optional[DocumentHash]
    def documentHashType: Optional[zio.aws.ssm.model.DocumentHashType]
    def timeoutSeconds: Optional[TimeoutSeconds]
    def comment: Optional[Comment]
    def parameters: Optional[Map[ParameterName, List[ParameterValue]]]
    def outputS3Region: Optional[S3Region]
    def outputS3BucketName: Optional[S3BucketName]
    def outputS3KeyPrefix: Optional[S3KeyPrefix]
    def maxConcurrency: Optional[MaxConcurrency]
    def maxErrors: Optional[MaxErrors]
    def serviceRoleArn: Optional[ServiceRole]
    def notificationConfig
        : Optional[zio.aws.ssm.model.NotificationConfig.ReadOnly]
    def cloudWatchOutputConfig
        : Optional[zio.aws.ssm.model.CloudWatchOutputConfig.ReadOnly]
    def alarmConfiguration
        : Optional[zio.aws.ssm.model.AlarmConfiguration.ReadOnly]
    def getInstanceIds: ZIO[Any, AwsError, List[InstanceId]] =
      AwsError.unwrapOptionField("instanceIds", instanceIds)
    def getTargets
        : ZIO[Any, AwsError, List[zio.aws.ssm.model.Target.ReadOnly]] =
      AwsError.unwrapOptionField("targets", targets)
    def getDocumentName: ZIO[Any, Nothing, DocumentARN] =
      ZIO.succeed(documentName)
    def getDocumentVersion: ZIO[Any, AwsError, DocumentVersion] =
      AwsError.unwrapOptionField("documentVersion", documentVersion)
    def getDocumentHash: ZIO[Any, AwsError, DocumentHash] =
      AwsError.unwrapOptionField("documentHash", documentHash)
    def getDocumentHashType
        : ZIO[Any, AwsError, zio.aws.ssm.model.DocumentHashType] =
      AwsError.unwrapOptionField("documentHashType", documentHashType)
    def getTimeoutSeconds: ZIO[Any, AwsError, TimeoutSeconds] =
      AwsError.unwrapOptionField("timeoutSeconds", timeoutSeconds)
    def getComment: ZIO[Any, AwsError, Comment] =
      AwsError.unwrapOptionField("comment", comment)
    def getParameters
        : ZIO[Any, AwsError, Map[ParameterName, List[ParameterValue]]] =
      AwsError.unwrapOptionField("parameters", parameters)
    def getOutputS3Region: ZIO[Any, AwsError, S3Region] =
      AwsError.unwrapOptionField("outputS3Region", outputS3Region)
    def getOutputS3BucketName: ZIO[Any, AwsError, S3BucketName] =
      AwsError.unwrapOptionField("outputS3BucketName", outputS3BucketName)
    def getOutputS3KeyPrefix: ZIO[Any, AwsError, S3KeyPrefix] =
      AwsError.unwrapOptionField("outputS3KeyPrefix", outputS3KeyPrefix)
    def getMaxConcurrency: ZIO[Any, AwsError, MaxConcurrency] =
      AwsError.unwrapOptionField("maxConcurrency", maxConcurrency)
    def getMaxErrors: ZIO[Any, AwsError, MaxErrors] =
      AwsError.unwrapOptionField("maxErrors", maxErrors)
    def getServiceRoleArn: ZIO[Any, AwsError, ServiceRole] =
      AwsError.unwrapOptionField("serviceRoleArn", serviceRoleArn)
    def getNotificationConfig
        : ZIO[Any, AwsError, zio.aws.ssm.model.NotificationConfig.ReadOnly] =
      AwsError.unwrapOptionField("notificationConfig", notificationConfig)
    def getCloudWatchOutputConfig: ZIO[
      Any,
      AwsError,
      zio.aws.ssm.model.CloudWatchOutputConfig.ReadOnly
    ] = AwsError.unwrapOptionField(
      "cloudWatchOutputConfig",
      cloudWatchOutputConfig
    )
    def getAlarmConfiguration
        : ZIO[Any, AwsError, zio.aws.ssm.model.AlarmConfiguration.ReadOnly] =
      AwsError.unwrapOptionField("alarmConfiguration", alarmConfiguration)
  }
  private final class Wrapper(
      impl: software.amazon.awssdk.services.ssm.model.SendCommandRequest
  ) extends zio.aws.ssm.model.SendCommandRequest.ReadOnly {
    override val instanceIds: Optional[List[InstanceId]] = zio.aws.core.internal
      .optionalFromNullable(impl.instanceIds())
      .map(value =>
        value.asScala.map { item =>
          zio.aws.ssm.model.primitives.InstanceId(item)
        }.toList
      )
    override val targets: Optional[List[zio.aws.ssm.model.Target.ReadOnly]] =
      zio.aws.core.internal
        .optionalFromNullable(impl.targets())
        .map(value =>
          value.asScala.map { item =>
            zio.aws.ssm.model.Target.wrap(item)
          }.toList
        )
    override val documentName: DocumentARN =
      zio.aws.ssm.model.primitives.DocumentARN(impl.documentName())
    override val documentVersion: Optional[DocumentVersion] =
      zio.aws.core.internal
        .optionalFromNullable(impl.documentVersion())
        .map(value => zio.aws.ssm.model.primitives.DocumentVersion(value))
    override val documentHash: Optional[DocumentHash] = zio.aws.core.internal
      .optionalFromNullable(impl.documentHash())
      .map(value => zio.aws.ssm.model.primitives.DocumentHash(value))
    override val documentHashType
        : Optional[zio.aws.ssm.model.DocumentHashType] = zio.aws.core.internal
      .optionalFromNullable(impl.documentHashType())
      .map(value => zio.aws.ssm.model.DocumentHashType.wrap(value))
    override val timeoutSeconds: Optional[TimeoutSeconds] =
      zio.aws.core.internal
        .optionalFromNullable(impl.timeoutSeconds())
        .map(value => zio.aws.ssm.model.primitives.TimeoutSeconds(value))
    override val comment: Optional[Comment] = zio.aws.core.internal
      .optionalFromNullable(impl.comment())
      .map(value => zio.aws.ssm.model.primitives.Comment(value))
    override val parameters
        : Optional[Map[ParameterName, List[ParameterValue]]] =
      zio.aws.core.internal
        .optionalFromNullable(impl.parameters())
        .map(value =>
          value.asScala
            .map({ case (key, value) =>
              zio.aws.ssm.model.primitives
                .ParameterName(key) -> value.asScala.map { item =>
                zio.aws.ssm.model.primitives.ParameterValue(item)
              }.toList
            })
            .toMap
        )
    override val outputS3Region: Optional[S3Region] = zio.aws.core.internal
      .optionalFromNullable(impl.outputS3Region())
      .map(value => zio.aws.ssm.model.primitives.S3Region(value))
    override val outputS3BucketName: Optional[S3BucketName] =
      zio.aws.core.internal
        .optionalFromNullable(impl.outputS3BucketName())
        .map(value => zio.aws.ssm.model.primitives.S3BucketName(value))
    override val outputS3KeyPrefix: Optional[S3KeyPrefix] =
      zio.aws.core.internal
        .optionalFromNullable(impl.outputS3KeyPrefix())
        .map(value => zio.aws.ssm.model.primitives.S3KeyPrefix(value))
    override val maxConcurrency: Optional[MaxConcurrency] =
      zio.aws.core.internal
        .optionalFromNullable(impl.maxConcurrency())
        .map(value => zio.aws.ssm.model.primitives.MaxConcurrency(value))
    override val maxErrors: Optional[MaxErrors] = zio.aws.core.internal
      .optionalFromNullable(impl.maxErrors())
      .map(value => zio.aws.ssm.model.primitives.MaxErrors(value))
    override val serviceRoleArn: Optional[ServiceRole] = zio.aws.core.internal
      .optionalFromNullable(impl.serviceRoleArn())
      .map(value => zio.aws.ssm.model.primitives.ServiceRole(value))
    override val notificationConfig
        : Optional[zio.aws.ssm.model.NotificationConfig.ReadOnly] =
      zio.aws.core.internal
        .optionalFromNullable(impl.notificationConfig())
        .map(value => zio.aws.ssm.model.NotificationConfig.wrap(value))
    override val cloudWatchOutputConfig
        : Optional[zio.aws.ssm.model.CloudWatchOutputConfig.ReadOnly] =
      zio.aws.core.internal
        .optionalFromNullable(impl.cloudWatchOutputConfig())
        .map(value => zio.aws.ssm.model.CloudWatchOutputConfig.wrap(value))
    override val alarmConfiguration
        : Optional[zio.aws.ssm.model.AlarmConfiguration.ReadOnly] =
      zio.aws.core.internal
        .optionalFromNullable(impl.alarmConfiguration())
        .map(value => zio.aws.ssm.model.AlarmConfiguration.wrap(value))
  }
  def wrap(
      impl: software.amazon.awssdk.services.ssm.model.SendCommandRequest
  ): zio.aws.ssm.model.SendCommandRequest.ReadOnly = new Wrapper(impl)
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy