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

zio.aws.snowdevicemanagement.SnowDeviceManagement.scala Maven / Gradle / Ivy

The newest version!
package zio.aws.snowdevicemanagement
import zio.aws.snowdevicemanagement.model.ListDevicesResponse.ReadOnly
import zio.aws.core.config.AwsConfig
import software.amazon.awssdk.services.snowdevicemanagement.{
  SnowDeviceManagementAsyncClientBuilder,
  SnowDeviceManagementAsyncClient
}
import zio.aws.snowdevicemanagement.model.{
  ListDeviceResourcesRequest,
  DescribeDeviceRequest,
  CreateTaskRequest,
  ListTagsForResourceRequest,
  DescribeTaskRequest,
  ListExecutionsRequest,
  ListTasksRequest,
  UntagResourceRequest,
  CancelTaskRequest,
  DescribeDeviceEc2InstancesRequest,
  ListDevicesRequest,
  DescribeExecutionRequest,
  TagResourceRequest
}
import software.amazon.awssdk.services.snowdevicemanagement.model.{
  ListTasksResponse,
  DescribeExecutionResponse,
  ListDevicesResponse,
  DescribeDeviceEc2InstancesResponse,
  TaskSummary,
  ListTagsForResourceResponse,
  DeviceSummary,
  UntagResourceResponse,
  ExecutionSummary,
  ResourceSummary,
  DescribeTaskResponse,
  ListDeviceResourcesResponse,
  DescribeDeviceResponse,
  CancelTaskResponse,
  ListExecutionsResponse,
  CreateTaskResponse,
  TagResourceResponse
}
import zio.aws.core.{AwsServiceBase, AwsError}
import software.amazon.awssdk.services.snowdevicemanagement.paginators.{
  ListDeviceResourcesPublisher,
  ListTasksPublisher,
  ListExecutionsPublisher,
  ListDevicesPublisher
}
import zio.aws.core.aspects.{AwsCallAspect, AspectSupport}
import zio.{ZEnvironment, IO, ZIO, ZLayer, Scope}
import zio.stream.ZStream
import scala.jdk.CollectionConverters._
trait SnowDeviceManagement extends AspectSupport[SnowDeviceManagement] {
  val api: SnowDeviceManagementAsyncClient
  def createTask(request: CreateTaskRequest): IO[
    AwsError,
    zio.aws.snowdevicemanagement.model.CreateTaskResponse.ReadOnly
  ]
  def describeDevice(request: DescribeDeviceRequest): IO[
    AwsError,
    zio.aws.snowdevicemanagement.model.DescribeDeviceResponse.ReadOnly
  ]
  def describeExecution(request: DescribeExecutionRequest): IO[
    AwsError,
    zio.aws.snowdevicemanagement.model.DescribeExecutionResponse.ReadOnly
  ]
  def listDevices(request: ListDevicesRequest): ZStream[
    Any,
    AwsError,
    zio.aws.snowdevicemanagement.model.DeviceSummary.ReadOnly
  ]
  def listDevicesPaginated(request: ListDevicesRequest): IO[AwsError, ReadOnly]
  def describeDeviceEc2Instances(
      request: DescribeDeviceEc2InstancesRequest
  ): IO[
    AwsError,
    zio.aws.snowdevicemanagement.model.DescribeDeviceEc2InstancesResponse.ReadOnly
  ]
  def untagResource(request: UntagResourceRequest): IO[AwsError, Unit]
  def listExecutions(request: ListExecutionsRequest): ZStream[
    Any,
    AwsError,
    zio.aws.snowdevicemanagement.model.ExecutionSummary.ReadOnly
  ]
  def listExecutionsPaginated(request: ListExecutionsRequest): IO[
    AwsError,
    zio.aws.snowdevicemanagement.model.ListExecutionsResponse.ReadOnly
  ]
  def listTagsForResource(request: ListTagsForResourceRequest): IO[
    AwsError,
    zio.aws.snowdevicemanagement.model.ListTagsForResourceResponse.ReadOnly
  ]
  def tagResource(request: TagResourceRequest): IO[AwsError, Unit]
  def cancelTask(request: CancelTaskRequest): IO[
    AwsError,
    zio.aws.snowdevicemanagement.model.CancelTaskResponse.ReadOnly
  ]
  def listTasks(request: ListTasksRequest): ZStream[
    Any,
    AwsError,
    zio.aws.snowdevicemanagement.model.TaskSummary.ReadOnly
  ]
  def listTasksPaginated(
      request: ListTasksRequest
  ): IO[AwsError, zio.aws.snowdevicemanagement.model.ListTasksResponse.ReadOnly]
  def listDeviceResources(request: ListDeviceResourcesRequest): ZStream[
    Any,
    AwsError,
    zio.aws.snowdevicemanagement.model.ResourceSummary.ReadOnly
  ]
  def listDeviceResourcesPaginated(request: ListDeviceResourcesRequest): IO[
    AwsError,
    zio.aws.snowdevicemanagement.model.ListDeviceResourcesResponse.ReadOnly
  ]
  def describeTask(request: DescribeTaskRequest): IO[
    AwsError,
    zio.aws.snowdevicemanagement.model.DescribeTaskResponse.ReadOnly
  ]
}
object SnowDeviceManagement {
  val live: ZLayer[AwsConfig, java.lang.Throwable, SnowDeviceManagement] =
    customized(identity)
  def customized(
      customization: SnowDeviceManagementAsyncClientBuilder => SnowDeviceManagementAsyncClientBuilder
  ): ZLayer[AwsConfig, java.lang.Throwable, SnowDeviceManagement] =
    ZLayer.scoped(scoped(customization))
  def scoped(
      customization: SnowDeviceManagementAsyncClientBuilder => SnowDeviceManagementAsyncClientBuilder
  ): ZIO[AwsConfig with Scope, java.lang.Throwable, SnowDeviceManagement] =
    for (
      awsConfig <- ZIO.service[AwsConfig]; executor <- ZIO.executor;
      builder = SnowDeviceManagementAsyncClient
        .builder()
        .asyncConfiguration(
          software.amazon.awssdk.core.client.config.ClientAsyncConfiguration
            .builder()
            .advancedOption(
              software.amazon.awssdk.core.client.config.SdkAdvancedAsyncClientOption.FUTURE_COMPLETION_EXECUTOR,
              executor.asJava
            )
            .build()
        );
      b0 <- awsConfig.configure[
        SnowDeviceManagementAsyncClient,
        SnowDeviceManagementAsyncClientBuilder
      ](builder);
      b1 <- awsConfig.configureHttpClient[
        SnowDeviceManagementAsyncClient,
        SnowDeviceManagementAsyncClientBuilder
      ](
        b0,
        zio.aws.core.httpclient.ServiceHttpCapabilities(supportsHttp2 = false)
      ); client <- ZIO.attempt(customization(b1).build())
    )
      yield new SnowDeviceManagementImpl(
        client,
        AwsCallAspect.identity,
        ZEnvironment.empty
      )
  private class SnowDeviceManagementImpl[R](
      override val api: SnowDeviceManagementAsyncClient,
      override val aspect: AwsCallAspect[R],
      r: ZEnvironment[R]
  ) extends SnowDeviceManagement
      with AwsServiceBase[R] {
    override val serviceName: String = "SnowDeviceManagement"
    override def withAspect[R1](
        newAspect: AwsCallAspect[R1],
        r: ZEnvironment[R1]
    ): SnowDeviceManagementImpl[R1] =
      new SnowDeviceManagementImpl(api, newAspect, r)
    def createTask(request: CreateTaskRequest): IO[
      AwsError,
      zio.aws.snowdevicemanagement.model.CreateTaskResponse.ReadOnly
    ] = asyncRequestResponse[
      software.amazon.awssdk.services.snowdevicemanagement.model.CreateTaskRequest,
      CreateTaskResponse
    ]("createTask", api.createTask)(request.buildAwsValue())
      .map(zio.aws.snowdevicemanagement.model.CreateTaskResponse.wrap)
      .provideEnvironment(r)
    def describeDevice(request: DescribeDeviceRequest): IO[
      AwsError,
      zio.aws.snowdevicemanagement.model.DescribeDeviceResponse.ReadOnly
    ] = asyncRequestResponse[
      software.amazon.awssdk.services.snowdevicemanagement.model.DescribeDeviceRequest,
      DescribeDeviceResponse
    ]("describeDevice", api.describeDevice)(request.buildAwsValue())
      .map(zio.aws.snowdevicemanagement.model.DescribeDeviceResponse.wrap)
      .provideEnvironment(r)
    def describeExecution(request: DescribeExecutionRequest): IO[
      AwsError,
      zio.aws.snowdevicemanagement.model.DescribeExecutionResponse.ReadOnly
    ] = asyncRequestResponse[
      software.amazon.awssdk.services.snowdevicemanagement.model.DescribeExecutionRequest,
      DescribeExecutionResponse
    ]("describeExecution", api.describeExecution)(request.buildAwsValue())
      .map(zio.aws.snowdevicemanagement.model.DescribeExecutionResponse.wrap)
      .provideEnvironment(r)
    def listDevices(request: ListDevicesRequest): ZStream[
      Any,
      AwsError,
      zio.aws.snowdevicemanagement.model.DeviceSummary.ReadOnly
    ] = asyncJavaPaginatedRequest[
      software.amazon.awssdk.services.snowdevicemanagement.model.ListDevicesRequest,
      DeviceSummary,
      ListDevicesPublisher
    ]("listDevices", api.listDevicesPaginator, _.devices())(
      request.buildAwsValue()
    ).map(item => zio.aws.snowdevicemanagement.model.DeviceSummary.wrap(item))
      .provideEnvironment(r)
    def listDevicesPaginated(
        request: ListDevicesRequest
    ): IO[AwsError, ReadOnly] = asyncRequestResponse[
      software.amazon.awssdk.services.snowdevicemanagement.model.ListDevicesRequest,
      ListDevicesResponse
    ]("listDevices", api.listDevices)(request.buildAwsValue())
      .map(zio.aws.snowdevicemanagement.model.ListDevicesResponse.wrap)
      .provideEnvironment(r)
    def describeDeviceEc2Instances(
        request: DescribeDeviceEc2InstancesRequest
    ): IO[
      AwsError,
      zio.aws.snowdevicemanagement.model.DescribeDeviceEc2InstancesResponse.ReadOnly
    ] = asyncRequestResponse[
      software.amazon.awssdk.services.snowdevicemanagement.model.DescribeDeviceEc2InstancesRequest,
      DescribeDeviceEc2InstancesResponse
    ]("describeDeviceEc2Instances", api.describeDeviceEc2Instances)(
      request.buildAwsValue()
    ).map(
      zio.aws.snowdevicemanagement.model.DescribeDeviceEc2InstancesResponse.wrap
    ).provideEnvironment(r)
    def untagResource(request: UntagResourceRequest): IO[AwsError, Unit] =
      asyncRequestResponse[
        software.amazon.awssdk.services.snowdevicemanagement.model.UntagResourceRequest,
        UntagResourceResponse
      ]("untagResource", api.untagResource)(request.buildAwsValue()).unit
        .provideEnvironment(r)
    def listExecutions(request: ListExecutionsRequest): ZStream[
      Any,
      AwsError,
      zio.aws.snowdevicemanagement.model.ExecutionSummary.ReadOnly
    ] = asyncJavaPaginatedRequest[
      software.amazon.awssdk.services.snowdevicemanagement.model.ListExecutionsRequest,
      ExecutionSummary,
      ListExecutionsPublisher
    ]("listExecutions", api.listExecutionsPaginator, _.executions())(
      request.buildAwsValue()
    ).map(item =>
      zio.aws.snowdevicemanagement.model.ExecutionSummary.wrap(item)
    ).provideEnvironment(r)
    def listExecutionsPaginated(request: ListExecutionsRequest): IO[
      AwsError,
      zio.aws.snowdevicemanagement.model.ListExecutionsResponse.ReadOnly
    ] = asyncRequestResponse[
      software.amazon.awssdk.services.snowdevicemanagement.model.ListExecutionsRequest,
      ListExecutionsResponse
    ]("listExecutions", api.listExecutions)(request.buildAwsValue())
      .map(zio.aws.snowdevicemanagement.model.ListExecutionsResponse.wrap)
      .provideEnvironment(r)
    def listTagsForResource(request: ListTagsForResourceRequest): IO[
      AwsError,
      zio.aws.snowdevicemanagement.model.ListTagsForResourceResponse.ReadOnly
    ] = asyncRequestResponse[
      software.amazon.awssdk.services.snowdevicemanagement.model.ListTagsForResourceRequest,
      ListTagsForResourceResponse
    ]("listTagsForResource", api.listTagsForResource)(request.buildAwsValue())
      .map(zio.aws.snowdevicemanagement.model.ListTagsForResourceResponse.wrap)
      .provideEnvironment(r)
    def tagResource(request: TagResourceRequest): IO[AwsError, Unit] =
      asyncRequestResponse[
        software.amazon.awssdk.services.snowdevicemanagement.model.TagResourceRequest,
        TagResourceResponse
      ]("tagResource", api.tagResource)(request.buildAwsValue()).unit
        .provideEnvironment(r)
    def cancelTask(request: CancelTaskRequest): IO[
      AwsError,
      zio.aws.snowdevicemanagement.model.CancelTaskResponse.ReadOnly
    ] = asyncRequestResponse[
      software.amazon.awssdk.services.snowdevicemanagement.model.CancelTaskRequest,
      CancelTaskResponse
    ]("cancelTask", api.cancelTask)(request.buildAwsValue())
      .map(zio.aws.snowdevicemanagement.model.CancelTaskResponse.wrap)
      .provideEnvironment(r)
    def listTasks(request: ListTasksRequest): ZStream[
      Any,
      AwsError,
      zio.aws.snowdevicemanagement.model.TaskSummary.ReadOnly
    ] = asyncJavaPaginatedRequest[
      software.amazon.awssdk.services.snowdevicemanagement.model.ListTasksRequest,
      TaskSummary,
      ListTasksPublisher
    ]("listTasks", api.listTasksPaginator, _.tasks())(request.buildAwsValue())
      .map(item => zio.aws.snowdevicemanagement.model.TaskSummary.wrap(item))
      .provideEnvironment(r)
    def listTasksPaginated(request: ListTasksRequest): IO[
      AwsError,
      zio.aws.snowdevicemanagement.model.ListTasksResponse.ReadOnly
    ] = asyncRequestResponse[
      software.amazon.awssdk.services.snowdevicemanagement.model.ListTasksRequest,
      ListTasksResponse
    ]("listTasks", api.listTasks)(request.buildAwsValue())
      .map(zio.aws.snowdevicemanagement.model.ListTasksResponse.wrap)
      .provideEnvironment(r)
    def listDeviceResources(request: ListDeviceResourcesRequest): ZStream[
      Any,
      AwsError,
      zio.aws.snowdevicemanagement.model.ResourceSummary.ReadOnly
    ] = asyncJavaPaginatedRequest[
      software.amazon.awssdk.services.snowdevicemanagement.model.ListDeviceResourcesRequest,
      ResourceSummary,
      ListDeviceResourcesPublisher
    ]("listDeviceResources", api.listDeviceResourcesPaginator, _.resources())(
      request.buildAwsValue()
    ).map(item => zio.aws.snowdevicemanagement.model.ResourceSummary.wrap(item))
      .provideEnvironment(r)
    def listDeviceResourcesPaginated(request: ListDeviceResourcesRequest): IO[
      AwsError,
      zio.aws.snowdevicemanagement.model.ListDeviceResourcesResponse.ReadOnly
    ] = asyncRequestResponse[
      software.amazon.awssdk.services.snowdevicemanagement.model.ListDeviceResourcesRequest,
      ListDeviceResourcesResponse
    ]("listDeviceResources", api.listDeviceResources)(request.buildAwsValue())
      .map(zio.aws.snowdevicemanagement.model.ListDeviceResourcesResponse.wrap)
      .provideEnvironment(r)
    def describeTask(request: DescribeTaskRequest): IO[
      AwsError,
      zio.aws.snowdevicemanagement.model.DescribeTaskResponse.ReadOnly
    ] = asyncRequestResponse[
      software.amazon.awssdk.services.snowdevicemanagement.model.DescribeTaskRequest,
      DescribeTaskResponse
    ]("describeTask", api.describeTask)(request.buildAwsValue())
      .map(zio.aws.snowdevicemanagement.model.DescribeTaskResponse.wrap)
      .provideEnvironment(r)
  }
  def createTask(request: CreateTaskRequest): ZIO[
    zio.aws.snowdevicemanagement.SnowDeviceManagement,
    AwsError,
    zio.aws.snowdevicemanagement.model.CreateTaskResponse.ReadOnly
  ] = ZIO.serviceWithZIO(_.createTask(request))
  def describeDevice(request: DescribeDeviceRequest): ZIO[
    zio.aws.snowdevicemanagement.SnowDeviceManagement,
    AwsError,
    zio.aws.snowdevicemanagement.model.DescribeDeviceResponse.ReadOnly
  ] = ZIO.serviceWithZIO(_.describeDevice(request))
  def describeExecution(request: DescribeExecutionRequest): ZIO[
    zio.aws.snowdevicemanagement.SnowDeviceManagement,
    AwsError,
    zio.aws.snowdevicemanagement.model.DescribeExecutionResponse.ReadOnly
  ] = ZIO.serviceWithZIO(_.describeExecution(request))
  def listDevices(request: ListDevicesRequest): ZStream[
    zio.aws.snowdevicemanagement.SnowDeviceManagement,
    AwsError,
    zio.aws.snowdevicemanagement.model.DeviceSummary.ReadOnly
  ] = ZStream.serviceWithStream(_.listDevices(request))
  def listDevicesPaginated(request: ListDevicesRequest): ZIO[
    zio.aws.snowdevicemanagement.SnowDeviceManagement,
    AwsError,
    ReadOnly
  ] = ZIO.serviceWithZIO(_.listDevicesPaginated(request))
  def describeDeviceEc2Instances(
      request: DescribeDeviceEc2InstancesRequest
  ): ZIO[
    zio.aws.snowdevicemanagement.SnowDeviceManagement,
    AwsError,
    zio.aws.snowdevicemanagement.model.DescribeDeviceEc2InstancesResponse.ReadOnly
  ] = ZIO.serviceWithZIO(_.describeDeviceEc2Instances(request))
  def untagResource(
      request: UntagResourceRequest
  ): ZIO[zio.aws.snowdevicemanagement.SnowDeviceManagement, AwsError, Unit] =
    ZIO.serviceWithZIO(_.untagResource(request))
  def listExecutions(request: ListExecutionsRequest): ZStream[
    zio.aws.snowdevicemanagement.SnowDeviceManagement,
    AwsError,
    zio.aws.snowdevicemanagement.model.ExecutionSummary.ReadOnly
  ] = ZStream.serviceWithStream(_.listExecutions(request))
  def listExecutionsPaginated(request: ListExecutionsRequest): ZIO[
    zio.aws.snowdevicemanagement.SnowDeviceManagement,
    AwsError,
    zio.aws.snowdevicemanagement.model.ListExecutionsResponse.ReadOnly
  ] = ZIO.serviceWithZIO(_.listExecutionsPaginated(request))
  def listTagsForResource(request: ListTagsForResourceRequest): ZIO[
    zio.aws.snowdevicemanagement.SnowDeviceManagement,
    AwsError,
    zio.aws.snowdevicemanagement.model.ListTagsForResourceResponse.ReadOnly
  ] = ZIO.serviceWithZIO(_.listTagsForResource(request))
  def tagResource(
      request: TagResourceRequest
  ): ZIO[zio.aws.snowdevicemanagement.SnowDeviceManagement, AwsError, Unit] =
    ZIO.serviceWithZIO(_.tagResource(request))
  def cancelTask(request: CancelTaskRequest): ZIO[
    zio.aws.snowdevicemanagement.SnowDeviceManagement,
    AwsError,
    zio.aws.snowdevicemanagement.model.CancelTaskResponse.ReadOnly
  ] = ZIO.serviceWithZIO(_.cancelTask(request))
  def listTasks(request: ListTasksRequest): ZStream[
    zio.aws.snowdevicemanagement.SnowDeviceManagement,
    AwsError,
    zio.aws.snowdevicemanagement.model.TaskSummary.ReadOnly
  ] = ZStream.serviceWithStream(_.listTasks(request))
  def listTasksPaginated(request: ListTasksRequest): ZIO[
    zio.aws.snowdevicemanagement.SnowDeviceManagement,
    AwsError,
    zio.aws.snowdevicemanagement.model.ListTasksResponse.ReadOnly
  ] = ZIO.serviceWithZIO(_.listTasksPaginated(request))
  def listDeviceResources(request: ListDeviceResourcesRequest): ZStream[
    zio.aws.snowdevicemanagement.SnowDeviceManagement,
    AwsError,
    zio.aws.snowdevicemanagement.model.ResourceSummary.ReadOnly
  ] = ZStream.serviceWithStream(_.listDeviceResources(request))
  def listDeviceResourcesPaginated(request: ListDeviceResourcesRequest): ZIO[
    zio.aws.snowdevicemanagement.SnowDeviceManagement,
    AwsError,
    zio.aws.snowdevicemanagement.model.ListDeviceResourcesResponse.ReadOnly
  ] = ZIO.serviceWithZIO(_.listDeviceResourcesPaginated(request))
  def describeTask(request: DescribeTaskRequest): ZIO[
    zio.aws.snowdevicemanagement.SnowDeviceManagement,
    AwsError,
    zio.aws.snowdevicemanagement.model.DescribeTaskResponse.ReadOnly
  ] = ZIO.serviceWithZIO(_.describeTask(request))
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy