zio.aws.costoptimizationhub.CostOptimizationHub.scala Maven / Gradle / Ivy
The newest version!
package zio.aws.costoptimizationhub
import zio.aws.costoptimizationhub.model.UpdatePreferencesResponse.ReadOnly
import zio.aws.core.config.AwsConfig
import zio.aws.costoptimizationhub.model.{
UpdateEnrollmentStatusRequest,
GetPreferencesRequest,
ListRecommendationsRequest,
ListEnrollmentStatusesRequest,
GetRecommendationRequest,
UpdatePreferencesRequest,
ListRecommendationSummariesRequest
}
import software.amazon.awssdk.services.costoptimizationhub.paginators.{
ListRecommendationSummariesPublisher,
ListRecommendationsPublisher,
ListEnrollmentStatusesPublisher
}
import zio.aws.core.{AwsServiceBase, AwsError}
import software.amazon.awssdk.services.costoptimizationhub.model.{
UpdateEnrollmentStatusResponse,
ListEnrollmentStatusesResponse,
RecommendationSummary,
UpdatePreferencesResponse,
ListRecommendationSummariesResponse,
Recommendation,
GetRecommendationResponse,
AccountEnrollmentStatus,
GetPreferencesResponse,
ListRecommendationsResponse
}
import zio.aws.core.aspects.{AwsCallAspect, AspectSupport}
import zio.{ZEnvironment, IO, ZIO, ZLayer, Scope}
import zio.stream.ZStream
import software.amazon.awssdk.services.costoptimizationhub.{
CostOptimizationHubAsyncClientBuilder,
CostOptimizationHubAsyncClient
}
import scala.jdk.CollectionConverters.*
trait CostOptimizationHub extends AspectSupport[CostOptimizationHub] {
val api: CostOptimizationHubAsyncClient
def listEnrollmentStatuses(request: ListEnrollmentStatusesRequest): ZStream[
Any,
AwsError,
zio.aws.costoptimizationhub.model.AccountEnrollmentStatus.ReadOnly
]
def listEnrollmentStatusesPaginated(
request: ListEnrollmentStatusesRequest
): IO[
AwsError,
zio.aws.costoptimizationhub.model.ListEnrollmentStatusesResponse.ReadOnly
]
def updatePreferences(
request: UpdatePreferencesRequest
): IO[AwsError, ReadOnly]
def getPreferences(request: GetPreferencesRequest): IO[
AwsError,
zio.aws.costoptimizationhub.model.GetPreferencesResponse.ReadOnly
]
def listRecommendations(request: ListRecommendationsRequest): ZStream[
Any,
AwsError,
zio.aws.costoptimizationhub.model.Recommendation.ReadOnly
]
def listRecommendationsPaginated(request: ListRecommendationsRequest): IO[
AwsError,
zio.aws.costoptimizationhub.model.ListRecommendationsResponse.ReadOnly
]
def listRecommendationSummaries(
request: ListRecommendationSummariesRequest
): ZStream[
Any,
AwsError,
zio.aws.costoptimizationhub.model.RecommendationSummary.ReadOnly
]
def listRecommendationSummariesPaginated(
request: ListRecommendationSummariesRequest
): IO[
AwsError,
zio.aws.costoptimizationhub.model.ListRecommendationSummariesResponse.ReadOnly
]
def updateEnrollmentStatus(request: UpdateEnrollmentStatusRequest): IO[
AwsError,
zio.aws.costoptimizationhub.model.UpdateEnrollmentStatusResponse.ReadOnly
]
def getRecommendation(request: GetRecommendationRequest): IO[
AwsError,
zio.aws.costoptimizationhub.model.GetRecommendationResponse.ReadOnly
]
}
object CostOptimizationHub {
val live: ZLayer[AwsConfig, java.lang.Throwable, CostOptimizationHub] =
customized(identity)
def customized(
customization: CostOptimizationHubAsyncClientBuilder => CostOptimizationHubAsyncClientBuilder
): ZLayer[AwsConfig, java.lang.Throwable, CostOptimizationHub] =
ZLayer.scoped(scoped(customization))
def scoped(
customization: CostOptimizationHubAsyncClientBuilder => CostOptimizationHubAsyncClientBuilder
): ZIO[AwsConfig with Scope, java.lang.Throwable, CostOptimizationHub] = for (
awsConfig <- ZIO.service[AwsConfig]; executor <- ZIO.executor;
builder = CostOptimizationHubAsyncClient
.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[
CostOptimizationHubAsyncClient,
CostOptimizationHubAsyncClientBuilder
](builder);
b1 <- awsConfig.configureHttpClient[
CostOptimizationHubAsyncClient,
CostOptimizationHubAsyncClientBuilder
](
b0,
zio.aws.core.httpclient.ServiceHttpCapabilities(supportsHttp2 = false)
); client <- ZIO.attempt(customization(b1).build())
)
yield new CostOptimizationHubImpl(
client,
AwsCallAspect.identity,
ZEnvironment.empty
)
private class CostOptimizationHubImpl[R](
override val api: CostOptimizationHubAsyncClient,
override val aspect: AwsCallAspect[R],
r: ZEnvironment[R]
) extends CostOptimizationHub
with AwsServiceBase[R] {
override val serviceName: String = "CostOptimizationHub"
override def withAspect[R1](
newAspect: AwsCallAspect[R1],
r: ZEnvironment[R1]
): CostOptimizationHubImpl[R1] =
new CostOptimizationHubImpl(api, newAspect, r)
def listEnrollmentStatuses(request: ListEnrollmentStatusesRequest): ZStream[
Any,
AwsError,
zio.aws.costoptimizationhub.model.AccountEnrollmentStatus.ReadOnly
] = asyncJavaPaginatedRequest[
software.amazon.awssdk.services.costoptimizationhub.model.ListEnrollmentStatusesRequest,
AccountEnrollmentStatus,
ListEnrollmentStatusesPublisher
]("listEnrollmentStatuses", api.listEnrollmentStatusesPaginator, _.items())(
request.buildAwsValue()
).map(item =>
zio.aws.costoptimizationhub.model.AccountEnrollmentStatus.wrap(item)
).provideEnvironment(r)
def listEnrollmentStatusesPaginated(
request: ListEnrollmentStatusesRequest
): IO[
AwsError,
zio.aws.costoptimizationhub.model.ListEnrollmentStatusesResponse.ReadOnly
] = asyncRequestResponse[
software.amazon.awssdk.services.costoptimizationhub.model.ListEnrollmentStatusesRequest,
ListEnrollmentStatusesResponse
]("listEnrollmentStatuses", api.listEnrollmentStatuses)(
request.buildAwsValue()
).map(zio.aws.costoptimizationhub.model.ListEnrollmentStatusesResponse.wrap)
.provideEnvironment(r)
def updatePreferences(
request: UpdatePreferencesRequest
): IO[AwsError, ReadOnly] = asyncRequestResponse[
software.amazon.awssdk.services.costoptimizationhub.model.UpdatePreferencesRequest,
UpdatePreferencesResponse
]("updatePreferences", api.updatePreferences)(request.buildAwsValue())
.map(zio.aws.costoptimizationhub.model.UpdatePreferencesResponse.wrap)
.provideEnvironment(r)
def getPreferences(request: GetPreferencesRequest): IO[
AwsError,
zio.aws.costoptimizationhub.model.GetPreferencesResponse.ReadOnly
] = asyncRequestResponse[
software.amazon.awssdk.services.costoptimizationhub.model.GetPreferencesRequest,
GetPreferencesResponse
]("getPreferences", api.getPreferences)(request.buildAwsValue())
.map(zio.aws.costoptimizationhub.model.GetPreferencesResponse.wrap)
.provideEnvironment(r)
def listRecommendations(request: ListRecommendationsRequest): ZStream[
Any,
AwsError,
zio.aws.costoptimizationhub.model.Recommendation.ReadOnly
] = asyncJavaPaginatedRequest[
software.amazon.awssdk.services.costoptimizationhub.model.ListRecommendationsRequest,
Recommendation,
ListRecommendationsPublisher
]("listRecommendations", api.listRecommendationsPaginator, _.items())(
request.buildAwsValue()
).map(item => zio.aws.costoptimizationhub.model.Recommendation.wrap(item))
.provideEnvironment(r)
def listRecommendationsPaginated(request: ListRecommendationsRequest): IO[
AwsError,
zio.aws.costoptimizationhub.model.ListRecommendationsResponse.ReadOnly
] = asyncRequestResponse[
software.amazon.awssdk.services.costoptimizationhub.model.ListRecommendationsRequest,
ListRecommendationsResponse
]("listRecommendations", api.listRecommendations)(request.buildAwsValue())
.map(zio.aws.costoptimizationhub.model.ListRecommendationsResponse.wrap)
.provideEnvironment(r)
def listRecommendationSummaries(
request: ListRecommendationSummariesRequest
): ZStream[
Any,
AwsError,
zio.aws.costoptimizationhub.model.RecommendationSummary.ReadOnly
] = asyncJavaPaginatedRequest[
software.amazon.awssdk.services.costoptimizationhub.model.ListRecommendationSummariesRequest,
RecommendationSummary,
ListRecommendationSummariesPublisher
](
"listRecommendationSummaries",
api.listRecommendationSummariesPaginator,
_.items()
)(request.buildAwsValue())
.map(item =>
zio.aws.costoptimizationhub.model.RecommendationSummary.wrap(item)
)
.provideEnvironment(r)
def listRecommendationSummariesPaginated(
request: ListRecommendationSummariesRequest
): IO[
AwsError,
zio.aws.costoptimizationhub.model.ListRecommendationSummariesResponse.ReadOnly
] = asyncRequestResponse[
software.amazon.awssdk.services.costoptimizationhub.model.ListRecommendationSummariesRequest,
ListRecommendationSummariesResponse
]("listRecommendationSummaries", api.listRecommendationSummaries)(
request.buildAwsValue()
).map(
zio.aws.costoptimizationhub.model.ListRecommendationSummariesResponse.wrap
).provideEnvironment(r)
def updateEnrollmentStatus(request: UpdateEnrollmentStatusRequest): IO[
AwsError,
zio.aws.costoptimizationhub.model.UpdateEnrollmentStatusResponse.ReadOnly
] = asyncRequestResponse[
software.amazon.awssdk.services.costoptimizationhub.model.UpdateEnrollmentStatusRequest,
UpdateEnrollmentStatusResponse
]("updateEnrollmentStatus", api.updateEnrollmentStatus)(
request.buildAwsValue()
).map(zio.aws.costoptimizationhub.model.UpdateEnrollmentStatusResponse.wrap)
.provideEnvironment(r)
def getRecommendation(request: GetRecommendationRequest): IO[
AwsError,
zio.aws.costoptimizationhub.model.GetRecommendationResponse.ReadOnly
] = asyncRequestResponse[
software.amazon.awssdk.services.costoptimizationhub.model.GetRecommendationRequest,
GetRecommendationResponse
]("getRecommendation", api.getRecommendation)(request.buildAwsValue())
.map(zio.aws.costoptimizationhub.model.GetRecommendationResponse.wrap)
.provideEnvironment(r)
}
def listEnrollmentStatuses(request: ListEnrollmentStatusesRequest): ZStream[
zio.aws.costoptimizationhub.CostOptimizationHub,
AwsError,
zio.aws.costoptimizationhub.model.AccountEnrollmentStatus.ReadOnly
] = ZStream.serviceWithStream(_.listEnrollmentStatuses(request))
def listEnrollmentStatusesPaginated(
request: ListEnrollmentStatusesRequest
): ZIO[
zio.aws.costoptimizationhub.CostOptimizationHub,
AwsError,
zio.aws.costoptimizationhub.model.ListEnrollmentStatusesResponse.ReadOnly
] = ZIO.serviceWithZIO(_.listEnrollmentStatusesPaginated(request))
def updatePreferences(
request: UpdatePreferencesRequest
): ZIO[zio.aws.costoptimizationhub.CostOptimizationHub, AwsError, ReadOnly] =
ZIO.serviceWithZIO(_.updatePreferences(request))
def getPreferences(request: GetPreferencesRequest): ZIO[
zio.aws.costoptimizationhub.CostOptimizationHub,
AwsError,
zio.aws.costoptimizationhub.model.GetPreferencesResponse.ReadOnly
] = ZIO.serviceWithZIO(_.getPreferences(request))
def listRecommendations(request: ListRecommendationsRequest): ZStream[
zio.aws.costoptimizationhub.CostOptimizationHub,
AwsError,
zio.aws.costoptimizationhub.model.Recommendation.ReadOnly
] = ZStream.serviceWithStream(_.listRecommendations(request))
def listRecommendationsPaginated(request: ListRecommendationsRequest): ZIO[
zio.aws.costoptimizationhub.CostOptimizationHub,
AwsError,
zio.aws.costoptimizationhub.model.ListRecommendationsResponse.ReadOnly
] = ZIO.serviceWithZIO(_.listRecommendationsPaginated(request))
def listRecommendationSummaries(
request: ListRecommendationSummariesRequest
): ZStream[
zio.aws.costoptimizationhub.CostOptimizationHub,
AwsError,
zio.aws.costoptimizationhub.model.RecommendationSummary.ReadOnly
] = ZStream.serviceWithStream(_.listRecommendationSummaries(request))
def listRecommendationSummariesPaginated(
request: ListRecommendationSummariesRequest
): ZIO[
zio.aws.costoptimizationhub.CostOptimizationHub,
AwsError,
zio.aws.costoptimizationhub.model.ListRecommendationSummariesResponse.ReadOnly
] = ZIO.serviceWithZIO(_.listRecommendationSummariesPaginated(request))
def updateEnrollmentStatus(request: UpdateEnrollmentStatusRequest): ZIO[
zio.aws.costoptimizationhub.CostOptimizationHub,
AwsError,
zio.aws.costoptimizationhub.model.UpdateEnrollmentStatusResponse.ReadOnly
] = ZIO.serviceWithZIO(_.updateEnrollmentStatus(request))
def getRecommendation(request: GetRecommendationRequest): ZIO[
zio.aws.costoptimizationhub.CostOptimizationHub,
AwsError,
zio.aws.costoptimizationhub.model.GetRecommendationResponse.ReadOnly
] = ZIO.serviceWithZIO(_.getRecommendation(request))
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy