From 4b16fbebce8131df7798ee92f43cf6b7df3e907c Mon Sep 17 00:00:00 2001 From: Victor Korzunin <5180700+floydspace@users.noreply.github.com> Date: Sun, 10 Nov 2024 03:16:08 +0100 Subject: [PATCH] feat: simplify layers (#80) * feat: prepare new layers * feat: simplify s3 service layers * feat: update codegen * chore: update codegen and generate all clients * fix: bug in iam service --- .changeset/polite-avocados-move.md | 35 + packages/client-account/README.md | 53 +- packages/client-account/src/AccountService.ts | 68 +- packages/client-account/test/Account.test.ts | 98 +- .../README.md | 48 +- .../src/ApiGatewayManagementApiService.ts | 76 +- .../test/ApiGatewayManagementApi.test.ts | 111 +- packages/client-bedrock/README.md | 53 +- packages/client-bedrock/src/BedrockService.ts | 68 +- packages/client-bedrock/test/Bedrock.test.ts | 98 +- packages/client-cloudsearch/README.md | 53 +- .../src/CloudSearchService.ts | 71 +- .../test/CloudSearch.test.ts | 102 +- packages/client-cloudtrail/README.md | 53 +- .../src/CloudTrailService.ts | 68 +- .../client-cloudtrail/test/CloudTrail.test.ts | 101 +- packages/client-cloudwatch-events/README.md | 53 +- .../src/CloudWatchEventsService.ts | 73 +- .../test/CloudWatchEvents.test.ts | 105 +- packages/client-cloudwatch-logs/README.md | 53 +- .../src/CloudWatchLogsService.ts | 73 +- .../test/CloudWatchLogs.test.ts | 104 +- packages/client-cloudwatch/README.md | 53 +- .../src/CloudWatchService.ts | 68 +- .../client-cloudwatch/test/CloudWatch.test.ts | 101 +- packages/client-codedeploy/README.md | 56 +- .../src/CodeDeployService.ts | 68 +- .../client-codedeploy/test/CodeDeploy.test.ts | 101 +- .../README.md | 53 +- .../src/CognitoIdentityProviderService.ts | 76 +- .../test/CognitoIdentityProvider.test.ts | 111 +- packages/client-dynamodb/README.md | 56 +- .../client-dynamodb/src/DynamoDBService.ts | 68 +- .../client-dynamodb/test/DynamoDB.test.ts | 98 +- packages/client-ec2/README.md | 59 +- .../client-ec2/src/EC2ClientInstanceConfig.ts | 5 +- packages/client-ec2/src/EC2Service.ts | 3234 +++++++++-------- packages/client-ec2/test/EC2.test.ts | 91 +- packages/client-elasticache/README.md | 57 +- .../src/ElastiCacheService.ts | 71 +- .../test/ElastiCache.test.ts | 102 +- packages/client-eventbridge/README.md | 57 +- .../src/EventBridgeService.ts | 71 +- .../test/EventBridge.test.ts | 102 +- packages/client-iam/README.md | 53 +- packages/client-iam/src/IAMService.ts | 70 +- packages/client-iam/test/IAM.test.ts | 95 +- packages/client-kinesis/README.md | 53 +- packages/client-kinesis/src/KinesisService.ts | 68 +- packages/client-kinesis/test/Kinesis.test.ts | 98 +- packages/client-kms/README.md | 53 +- packages/client-kms/src/KMSService.ts | 70 +- packages/client-kms/test/KMS.test.ts | 95 +- packages/client-lambda/README.md | 56 +- packages/client-lambda/src/LambdaService.ts | 68 +- packages/client-lambda/test/Lambda.test.ts | 95 +- packages/client-mq/README.md | 53 +- packages/client-mq/src/MqService.ts | 70 +- packages/client-mq/test/Mq.test.ts | 95 +- .../client-opensearch-serverless/README.md | 53 +- .../src/OpenSearchServerlessService.ts | 76 +- .../test/OpenSearchServerless.test.ts | 108 +- packages/client-opensearch/README.md | 53 +- .../src/OpenSearchService.ts | 68 +- .../client-opensearch/test/OpenSearch.test.ts | 101 +- packages/client-rds/README.md | 53 +- packages/client-rds/src/RDSService.ts | 70 +- packages/client-rds/test/RDS.test.ts | 168 +- packages/client-s3/README.md | 53 +- packages/client-s3/src/Errors.ts | 16 +- .../client-s3/src/S3ClientInstanceConfig.ts | 5 +- packages/client-s3/src/S3Service.ts | 138 +- packages/client-s3/test/S3.test.ts | 96 +- packages/client-scheduler/README.md | 53 +- .../client-scheduler/src/SchedulerService.ts | 68 +- .../client-scheduler/test/Scheduler.test.ts | 101 +- packages/client-secrets-manager/README.md | 57 +- .../src/SecretsManagerService.ts | 73 +- .../test/SecretsManager.test.ts | 104 +- packages/client-sfn/README.md | 53 +- packages/client-sfn/src/SFNService.ts | 70 +- packages/client-sfn/test/SFN.test.ts | 95 +- packages/client-sns/README.md | 53 +- packages/client-sns/src/SNSService.ts | 70 +- packages/client-sns/test/SNS.test.ts | 95 +- packages/client-sqs/README.md | 53 +- packages/client-sqs/src/SQSService.ts | 70 +- packages/client-sqs/test/SQS.test.ts | 95 +- packages/client-ssm/README.md | 53 +- packages/client-ssm/src/SSMService.ts | 70 +- packages/client-ssm/test/SSM.test.ts | 95 +- packages/client-sts/README.md | 53 +- packages/client-sts/src/STSService.ts | 70 +- packages/client-sts/test/STS.test.ts | 95 +- packages/client-textract/README.md | 53 +- .../client-textract/src/TextractService.ts | 68 +- .../client-textract/test/Textract.test.ts | 100 +- scripts/client-singularities.json | 124 + scripts/codegen-client.ts | 282 +- 99 files changed, 5777 insertions(+), 4921 deletions(-) create mode 100644 .changeset/polite-avocados-move.md create mode 100644 scripts/client-singularities.json diff --git a/.changeset/polite-avocados-move.md b/.changeset/polite-avocados-move.md new file mode 100644 index 0000000..5c703da --- /dev/null +++ b/.changeset/polite-avocados-move.md @@ -0,0 +1,35 @@ +--- +"@effect-aws/client-api-gateway-management-api": minor +"@effect-aws/client-cognito-identity-provider": minor +"@effect-aws/client-opensearch-serverless": minor +"@effect-aws/client-cloudwatch-events": minor +"@effect-aws/client-cloudwatch-logs": minor +"@effect-aws/client-secrets-manager": minor +"@effect-aws/client-cloudsearch": minor +"@effect-aws/client-elasticache": minor +"@effect-aws/client-eventbridge": minor +"@effect-aws/client-cloudtrail": minor +"@effect-aws/client-cloudwatch": minor +"@effect-aws/client-codedeploy": minor +"@effect-aws/client-opensearch": minor +"@effect-aws/client-scheduler": minor +"@effect-aws/client-dynamodb": minor +"@effect-aws/client-textract": minor +"@effect-aws/client-account": minor +"@effect-aws/client-bedrock": minor +"@effect-aws/client-kinesis": minor +"@effect-aws/client-lambda": minor +"@effect-aws/client-ec2": minor +"@effect-aws/client-iam": minor +"@effect-aws/client-kms": minor +"@effect-aws/client-rds": minor +"@effect-aws/client-sfn": minor +"@effect-aws/client-sns": minor +"@effect-aws/client-sqs": minor +"@effect-aws/client-ssm": minor +"@effect-aws/client-sts": minor +"@effect-aws/client-mq": minor +"@effect-aws/client-s3": minor +--- + +simplify layers configuration (closes #78) diff --git a/packages/client-account/README.md b/packages/client-account/README.md index 9716b0e..17510c3 100644 --- a/packages/client-account/README.md +++ b/packages/client-account/README.md @@ -14,13 +14,13 @@ npm install --save @effect-aws/client-account With default AccountClient instance: ```typescript -import { AccountService, DefaultAccountServiceLayer } from "@effect-aws/client-account"; +import { Account } from "@effect-aws/client-account"; -const program = AccountService.listRegions(args); +const program = Account.listRegions(args); const result = pipe( program, - Effect.provide(DefaultAccountServiceLayer), + Effect.provide(Account.defaultLayer), Effect.runPromise, ); ``` @@ -28,23 +28,15 @@ const result = pipe( With custom AccountClient instance: ```typescript -import { - AccountService, - BaseAccountServiceLayer, - AccountClientInstance, -} from "@effect-aws/client-account"; +import { Account } from "@effect-aws/client-account"; -const program = AccountService.listRegions(args); - -const AccountClientInstanceLayer = Layer.succeed( - AccountClientInstance, - new AccountClient({ region: "eu-central-1" }), -); +const program = Account.listRegions(args); const result = await pipe( program, - Effect.provide(BaseAccountServiceLayer), - Effect.provide(AccountClientInstanceLayer), + Effect.provide( + Account.baseLayer(() => new AccountClient({ region: "eu-central-1" })), + ), Effect.runPromise, ); ``` @@ -52,34 +44,15 @@ const result = await pipe( With custom AccountClient configuration: ```typescript -import { - AccountService, - BaseAccountServiceLayer, - DefaultAccountClientConfigLayer, - AccountClientInstance, - AccountClientInstanceConfig, -} from "@effect-aws/client-account"; - -const program = AccountService.listRegions(args); - -const AccountClientInstanceLayer = Layer.provide( - Layer.effect( - AccountClientInstance, - AccountClientInstanceConfig.pipe( - Effect.map( - (config) => new AccountClient({ ...config, region: "eu-central-1" }), - ), - ), - ), - DefaultAccountClientConfigLayer, -); +import { Account } from "@effect-aws/client-account"; + +const program = Account.listRegions(args); const result = await pipe( program, - Effect.provide(BaseAccountServiceLayer), - Effect.provide(AccountClientInstanceLayer), + Effect.provide(Account.layer({ region: "eu-central-1" })), Effect.runPromiseExit, ); ``` -or map over `DefaultAccountClientConfigLayer` layer context and update the configuration... +or use `Account.baseLayer((default) => new AccountClient({ ...default, region: "eu-central-1" }))` diff --git a/packages/client-account/src/AccountService.ts b/packages/client-account/src/AccountService.ts index 11537b1..e11fab7 100644 --- a/packages/client-account/src/AccountService.ts +++ b/packages/client-account/src/AccountService.ts @@ -3,6 +3,8 @@ */ import { AccountServiceException, + type AccountClient, + type AccountClientConfig, AcceptPrimaryEmailUpdateCommand, type AcceptPrimaryEmailUpdateCommandInput, type AcceptPrimaryEmailUpdateCommandOutput, @@ -45,7 +47,11 @@ import { AccountClientInstance, AccountClientInstanceLayer, } from "./AccountClientInstance"; -import { DefaultAccountClientConfigLayer } from "./AccountClientInstanceConfig"; +import { + DefaultAccountClientConfigLayer, + makeDefaultAccountClientInstanceConfig, + AccountClientInstanceConfig, +} from "./AccountClientInstanceConfig"; import { AllServiceErrors, AccessDeniedError, @@ -59,7 +65,7 @@ import { } from "./Errors"; /** - * @since 1.0.1 + * @since 1.0.0 */ export interface HttpHandlerOptions { /** @@ -278,14 +284,6 @@ interface AccountService$ { >; } -/** - * @since 1.0.0 - * @category models - */ -export class AccountService extends Effect.Tag( - "@effect-aws/client-account/AccountService", -)() {} - /** * @since 1.0.0 * @category constructors @@ -336,9 +334,53 @@ export const makeAccountService = Effect.gen(function* (_) { }, {}) as AccountService$; }); +/** + * @since 1.0.0 + * @category models + */ +export class AccountService extends Effect.Tag( + "@effect-aws/client-account/AccountService", +)() { + static readonly defaultLayer = Layer.effect(this, makeAccountService).pipe( + Layer.provide(AccountClientInstanceLayer), + Layer.provide(DefaultAccountClientConfigLayer), + ); + static readonly layer = (config: AccountClientConfig) => + Layer.effect(this, makeAccountService).pipe( + Layer.provide(AccountClientInstanceLayer), + Layer.provide( + Layer.effect( + AccountClientInstanceConfig, + makeDefaultAccountClientInstanceConfig.pipe( + Effect.map((defaultConfig) => ({ ...defaultConfig, ...config })), + ), + ), + ), + ); + static readonly baseLayer = ( + evaluate: (defaultConfig: AccountClientConfig) => AccountClient, + ) => + Layer.effect(this, makeAccountService).pipe( + Layer.provide( + Layer.effect( + AccountClientInstance, + Effect.map(makeDefaultAccountClientInstanceConfig, evaluate), + ), + ), + ); +} + +/** + * @since 1.0.0 + * @category models + * @alias AccountService + */ +export const Account = AccountService; + /** * @since 1.0.0 * @category layers + * @deprecated use Account.baseLayer instead */ export const BaseAccountServiceLayer = Layer.effect( AccountService, @@ -348,6 +390,7 @@ export const BaseAccountServiceLayer = Layer.effect( /** * @since 1.0.0 * @category layers + * @deprecated use Account.layer instead */ export const AccountServiceLayer = BaseAccountServiceLayer.pipe( Layer.provide(AccountClientInstanceLayer), @@ -356,7 +399,6 @@ export const AccountServiceLayer = BaseAccountServiceLayer.pipe( /** * @since 1.0.0 * @category layers + * @deprecated use Account.defaultLayer instead */ -export const DefaultAccountServiceLayer = AccountServiceLayer.pipe( - Layer.provide(DefaultAccountClientConfigLayer), -); +export const DefaultAccountServiceLayer = AccountService.defaultLayer; diff --git a/packages/client-account/test/Account.test.ts b/packages/client-account/test/Account.test.ts index 1ffb20a..e5405f9 100644 --- a/packages/client-account/test/Account.test.ts +++ b/packages/client-account/test/Account.test.ts @@ -4,39 +4,41 @@ import { AccountClient, AccountServiceException, } from "@aws-sdk/client-account"; +// @ts-ignore +import * as runtimeConfig from "@aws-sdk/client-account/dist-cjs/runtimeConfig"; import { mockClient } from "aws-sdk-client-mock"; import * as Effect from "effect/Effect"; import * as Exit from "effect/Exit"; import { pipe } from "effect/Function"; -import * as Layer from "effect/Layer"; -import { - BaseAccountServiceLayer, - DefaultAccountClientConfigLayer, - DefaultAccountServiceLayer, - AccountClientInstance, - AccountClientInstanceConfig, - AccountService, - AccountServiceLayer, - SdkError, -} from "../src"; +import { afterEach, describe, expect, it, vi } from "vitest"; +import { Account, SdkError } from "../src"; +const getRuntimeConfig = vi.spyOn(runtimeConfig, "getRuntimeConfig"); const clientMock = mockClient(AccountClient); describe("AccountClientImpl", () => { + afterEach(() => { + getRuntimeConfig.mockClear(); + }); + it("default", async () => { clientMock.reset().on(ListRegionsCommand).resolves({}); const args = {} as unknown as ListRegionsCommandInput; - const program = AccountService.listRegions(args); + const program = Account.listRegions(args); const result = await pipe( program, - Effect.provide(DefaultAccountServiceLayer), + Effect.provide(Account.defaultLayer), Effect.runPromiseExit, ); expect(result).toEqual(Exit.succeed({})); + expect(getRuntimeConfig).toHaveBeenCalledTimes(1); + expect(getRuntimeConfig).toHaveBeenCalledWith({ + logger: expect.any(Object), + }); expect(clientMock).toHaveReceivedCommandTimes(ListRegionsCommand, 1); expect(clientMock).toHaveReceivedCommandWith(ListRegionsCommand, args); }); @@ -46,25 +48,20 @@ describe("AccountClientImpl", () => { const args = {} as unknown as ListRegionsCommandInput; - const program = AccountService.listRegions(args); - - const AccountClientConfigLayer = Layer.succeed( - AccountClientInstanceConfig, - { - region: "eu-central-1", - }, - ); - const CustomAccountServiceLayer = AccountServiceLayer.pipe( - Layer.provide(AccountClientConfigLayer), - ); + const program = Account.listRegions(args); const result = await pipe( program, - Effect.provide(CustomAccountServiceLayer), + Effect.provide(Account.layer({ region: "eu-central-1" })), Effect.runPromiseExit, ); expect(result).toEqual(Exit.succeed({})); + expect(getRuntimeConfig).toHaveBeenCalledTimes(1); + expect(getRuntimeConfig).toHaveBeenCalledWith({ + region: "eu-central-1", + logger: expect.any(Object), + }); expect(clientMock).toHaveReceivedCommandTimes(ListRegionsCommand, 1); expect(clientMock).toHaveReceivedCommandWith(ListRegionsCommand, args); }); @@ -74,23 +71,21 @@ describe("AccountClientImpl", () => { const args = {} as unknown as ListRegionsCommandInput; - const program = AccountService.listRegions(args); - - const AccountClientInstanceLayer = Layer.succeed( - AccountClientInstance, - new AccountClient({ region: "eu-central-1" }), - ); - const CustomAccountServiceLayer = BaseAccountServiceLayer.pipe( - Layer.provide(AccountClientInstanceLayer), - ); + const program = Account.listRegions(args); const result = await pipe( program, - Effect.provide(CustomAccountServiceLayer), + Effect.provide( + Account.baseLayer(() => new AccountClient({ region: "eu-central-1" })), + ), Effect.runPromiseExit, ); expect(result).toEqual(Exit.succeed({})); + expect(getRuntimeConfig).toHaveBeenCalledTimes(1); + expect(getRuntimeConfig).toHaveBeenCalledWith({ + region: "eu-central-1", + }); expect(clientMock).toHaveReceivedCommandTimes(ListRegionsCommand, 1); expect(clientMock).toHaveReceivedCommandWith(ListRegionsCommand, args); }); @@ -100,27 +95,24 @@ describe("AccountClientImpl", () => { const args = {} as unknown as ListRegionsCommandInput; - const program = AccountService.listRegions(args); - - const AccountClientInstanceLayer = Layer.effect( - AccountClientInstance, - Effect.map( - AccountClientInstanceConfig, - (config) => new AccountClient({ ...config, region: "eu-central-1" }), - ), - ); - const CustomAccountServiceLayer = BaseAccountServiceLayer.pipe( - Layer.provide(AccountClientInstanceLayer), - Layer.provide(DefaultAccountClientConfigLayer), - ); + const program = Account.listRegions(args); const result = await pipe( program, - Effect.provide(CustomAccountServiceLayer), + Effect.provide( + Account.baseLayer( + (config) => new AccountClient({ ...config, region: "eu-central-1" }), + ), + ), Effect.runPromiseExit, ); expect(result).toEqual(Exit.succeed({})); + expect(getRuntimeConfig).toHaveBeenCalledTimes(1); + expect(getRuntimeConfig).toHaveBeenCalledWith({ + region: "eu-central-1", + logger: expect.any(Object), + }); expect(clientMock).toHaveReceivedCommandTimes(ListRegionsCommand, 1); expect(clientMock).toHaveReceivedCommandWith(ListRegionsCommand, args); }); @@ -130,11 +122,11 @@ describe("AccountClientImpl", () => { const args = {} as unknown as ListRegionsCommandInput; - const program = AccountService.listRegions(args); + const program = Account.listRegions(args); const result = await pipe( program, - Effect.provide(DefaultAccountServiceLayer), + Effect.provide(Account.defaultLayer), Effect.runPromiseExit, ); @@ -165,13 +157,13 @@ describe("AccountClientImpl", () => { const args = {} as unknown as ListRegionsCommandInput; - const program = AccountService.listRegions(args).pipe( + const program = Account.listRegions(args).pipe( Effect.catchTag("NotHandledException" as any, () => Effect.succeed(null)), ); const result = await pipe( program, - Effect.provide(DefaultAccountServiceLayer), + Effect.provide(Account.defaultLayer), Effect.runPromiseExit, ); diff --git a/packages/client-api-gateway-management-api/README.md b/packages/client-api-gateway-management-api/README.md index 1a4fe0d..b7551f8 100644 --- a/packages/client-api-gateway-management-api/README.md +++ b/packages/client-api-gateway-management-api/README.md @@ -14,16 +14,13 @@ npm install --save @effect-aws/client-api-gateway-management-api With default ApiGatewayManagementApiClient instance: ```typescript -import { - ApiGatewayManagementApiService, - DefaultApiGatewayManagementApiServiceLayer, -} from "@effect-aws/client-api-gateway-management-api"; +import { ApiGatewayManagementApi } from "@effect-aws/client-api-gateway-management-api"; -const program = ApiGatewayManagementApiService.postToConnection(args); +const program = ApiGatewayManagementApi.postToConnection(args); const result = pipe( program, - Effect.provide(DefaultApiGatewayManagementApiServiceLayer), + Effect.provide(ApiGatewayManagementApi.defaultLayer), Effect.runPromise, ); ``` @@ -31,23 +28,15 @@ const result = pipe( With custom ApiGatewayManagementApiClient instance: ```typescript -import { - ApiGatewayManagementApiService, - BaseApiGatewayManagementApiServiceLayer, - ApiGatewayManagementApiClientInstance, -} from "@effect-aws/client-api-gateway-management-api"; +import { ApiGatewayManagementApi } from "@effect-aws/client-api-gateway-management-api"; -const program = ApiGatewayManagementApiService.postToConnection(args); - -const ApiGatewayManagementApiClientInstanceLayer = Layer.succeed( - ApiGatewayManagementApiClientInstance, - new ApiGatewayManagementApiClient({ region: "eu-central-1" }), -); +const program = ApiGatewayManagementApi.postToConnection(args); const result = await pipe( program, - Effect.provide(BaseApiGatewayManagementApiServiceLayer), - Effect.provide(ApiGatewayManagementApiClientInstanceLayer), + Effect.provide( + ApiGatewayManagementApi.baseLayer(() => new ApiGatewayManagementApiClient({ region: "eu-central-1" })), + ), Effect.runPromise, ); ``` @@ -55,26 +44,15 @@ const result = await pipe( With custom ApiGatewayManagementApiClient configuration: ```typescript -import { - ApiGatewayManagementApiService, - ApiGatewayManagementApiServiceLayer, - ApiGatewayManagementApiClientInstanceConfig, -} from "@effect-aws/client-api-gateway-management-api"; - -const program = ApiGatewayManagementApiService.postToConnection(args); - -const CustomApiGatewayManagementApiServiceLayer = Layer.provide( - ApiGatewayManagementApiServiceLayer, - Layer.succeed(ApiGatewayManagementApiClientInstanceConfig, { - endpoint: `https://domain/path`, - }), -); +import { ApiGatewayManagementApi } from "@effect-aws/client-api-gateway-management-api"; + +const program = ApiGatewayManagementApi.postToConnection(args); const result = await pipe( program, - Effect.provide(CustomApiGatewayManagementApiServiceLayer), + Effect.provide(ApiGatewayManagementApi.layer({ region: "eu-central-1" })), Effect.runPromiseExit, ); ``` -or map over `DefaultApiGatewayManagementApiClientConfigLayer` layer context and update the configuration... +or use `ApiGatewayManagementApi.baseLayer((default) => new ApiGatewayManagementApiClient({ ...default, region: "eu-central-1" }))` diff --git a/packages/client-api-gateway-management-api/src/ApiGatewayManagementApiService.ts b/packages/client-api-gateway-management-api/src/ApiGatewayManagementApiService.ts index 5ae8f73..5a40a81 100644 --- a/packages/client-api-gateway-management-api/src/ApiGatewayManagementApiService.ts +++ b/packages/client-api-gateway-management-api/src/ApiGatewayManagementApiService.ts @@ -3,6 +3,8 @@ */ import { ApiGatewayManagementApiServiceException, + type ApiGatewayManagementApiClient, + type ApiGatewayManagementApiClientConfig, DeleteConnectionCommand, type DeleteConnectionCommandInput, type DeleteConnectionCommandOutput, @@ -18,7 +20,11 @@ import { ApiGatewayManagementApiClientInstance, ApiGatewayManagementApiClientInstanceLayer, } from "./ApiGatewayManagementApiClientInstance"; -import { DefaultApiGatewayManagementApiClientConfigLayer } from "./ApiGatewayManagementApiClientInstanceConfig"; +import { + DefaultApiGatewayManagementApiClientConfigLayer, + makeDefaultApiGatewayManagementApiClientInstanceConfig, + ApiGatewayManagementApiClientInstanceConfig, +} from "./ApiGatewayManagementApiClientInstanceConfig"; import { AllServiceErrors, ForbiddenError, @@ -30,7 +36,7 @@ import { } from "./Errors"; /** - * @since 1.4.1 + * @since 1.0.0 */ export interface HttpHandlerOptions { /** @@ -87,14 +93,6 @@ interface ApiGatewayManagementApiService$ { >; } -/** - * @since 1.0.0 - * @category models - */ -export class ApiGatewayManagementApiService extends Effect.Tag( - "@effect-aws/client-api-gateway-management-api/ApiGatewayManagementApiService", -)() {} - /** * @since 1.0.0 * @category constructors @@ -145,9 +143,61 @@ export const makeApiGatewayManagementApiService = Effect.gen(function* (_) { }, {}) as ApiGatewayManagementApiService$; }); +/** + * @since 1.0.0 + * @category models + */ +export class ApiGatewayManagementApiService extends Effect.Tag( + "@effect-aws/client-api-gateway-management-api/ApiGatewayManagementApiService", +)() { + static readonly defaultLayer = Layer.effect( + this, + makeApiGatewayManagementApiService, + ).pipe( + Layer.provide(ApiGatewayManagementApiClientInstanceLayer), + Layer.provide(DefaultApiGatewayManagementApiClientConfigLayer), + ); + static readonly layer = (config: ApiGatewayManagementApiClientConfig) => + Layer.effect(this, makeApiGatewayManagementApiService).pipe( + Layer.provide(ApiGatewayManagementApiClientInstanceLayer), + Layer.provide( + Layer.effect( + ApiGatewayManagementApiClientInstanceConfig, + makeDefaultApiGatewayManagementApiClientInstanceConfig.pipe( + Effect.map((defaultConfig) => ({ ...defaultConfig, ...config })), + ), + ), + ), + ); + static readonly baseLayer = ( + evaluate: ( + defaultConfig: ApiGatewayManagementApiClientConfig, + ) => ApiGatewayManagementApiClient, + ) => + Layer.effect(this, makeApiGatewayManagementApiService).pipe( + Layer.provide( + Layer.effect( + ApiGatewayManagementApiClientInstance, + Effect.map( + makeDefaultApiGatewayManagementApiClientInstanceConfig, + evaluate, + ), + ), + ), + ); +} + +/** + * @since 1.0.0 + * @category models + * @alias ApiGatewayManagementApiService + */ +export const ApiGatewayManagementApi = ApiGatewayManagementApiService; + /** * @since 1.0.0 * @category layers + * @deprecated use ApiGatewayManagementApi.baseLayer instead */ export const BaseApiGatewayManagementApiServiceLayer = Layer.effect( ApiGatewayManagementApiService, @@ -157,6 +207,7 @@ export const BaseApiGatewayManagementApiServiceLayer = Layer.effect( /** * @since 1.0.0 * @category layers + * @deprecated use ApiGatewayManagementApi.layer instead */ export const ApiGatewayManagementApiServiceLayer = BaseApiGatewayManagementApiServiceLayer.pipe( @@ -166,8 +217,7 @@ export const ApiGatewayManagementApiServiceLayer = /** * @since 1.0.0 * @category layers + * @deprecated use ApiGatewayManagementApi.defaultLayer instead */ export const DefaultApiGatewayManagementApiServiceLayer = - ApiGatewayManagementApiServiceLayer.pipe( - Layer.provide(DefaultApiGatewayManagementApiClientConfigLayer), - ); + ApiGatewayManagementApiService.defaultLayer; diff --git a/packages/client-api-gateway-management-api/test/ApiGatewayManagementApi.test.ts b/packages/client-api-gateway-management-api/test/ApiGatewayManagementApi.test.ts index 7db5691..a15a5fc 100644 --- a/packages/client-api-gateway-management-api/test/ApiGatewayManagementApi.test.ts +++ b/packages/client-api-gateway-management-api/test/ApiGatewayManagementApi.test.ts @@ -4,25 +4,23 @@ import { ApiGatewayManagementApiClient, ApiGatewayManagementApiServiceException, } from "@aws-sdk/client-apigatewaymanagementapi"; +// @ts-ignore +import * as runtimeConfig from "@aws-sdk/client-apigatewaymanagementapi/dist-cjs/runtimeConfig"; import { mockClient } from "aws-sdk-client-mock"; import * as Effect from "effect/Effect"; import * as Exit from "effect/Exit"; import { pipe } from "effect/Function"; -import * as Layer from "effect/Layer"; -import { - BaseApiGatewayManagementApiServiceLayer, - DefaultApiGatewayManagementApiClientConfigLayer, - DefaultApiGatewayManagementApiServiceLayer, - ApiGatewayManagementApiClientInstance, - ApiGatewayManagementApiClientInstanceConfig, - ApiGatewayManagementApiService, - ApiGatewayManagementApiServiceLayer, - SdkError, -} from "../src"; +import { afterEach, describe, expect, it, vi } from "vitest"; +import { ApiGatewayManagementApi, SdkError } from "../src"; +const getRuntimeConfig = vi.spyOn(runtimeConfig, "getRuntimeConfig"); const clientMock = mockClient(ApiGatewayManagementApiClient); describe("ApiGatewayManagementApiClientImpl", () => { + afterEach(() => { + getRuntimeConfig.mockClear(); + }); + it("default", async () => { clientMock.reset().on(PostToConnectionCommand).resolves({}); @@ -31,15 +29,19 @@ describe("ApiGatewayManagementApiClientImpl", () => { Data: "test", }; - const program = ApiGatewayManagementApiService.postToConnection(args); + const program = ApiGatewayManagementApi.postToConnection(args); const result = await pipe( program, - Effect.provide(DefaultApiGatewayManagementApiServiceLayer), + Effect.provide(ApiGatewayManagementApi.defaultLayer), Effect.runPromiseExit, ); expect(result).toEqual(Exit.succeed({})); + expect(getRuntimeConfig).toHaveBeenCalledTimes(1); + expect(getRuntimeConfig).toHaveBeenCalledWith({ + logger: expect.any(Object), + }); expect(clientMock).toHaveReceivedCommandTimes(PostToConnectionCommand, 1); expect(clientMock).toHaveReceivedCommandWith(PostToConnectionCommand, args); }); @@ -52,26 +54,20 @@ describe("ApiGatewayManagementApiClientImpl", () => { Data: "test", }; - const program = ApiGatewayManagementApiService.postToConnection(args); - - const ApiGatewayManagementApiClientConfigLayer = Layer.succeed( - ApiGatewayManagementApiClientInstanceConfig, - { - region: "eu-central-1", - }, - ); - const CustomApiGatewayManagementApiServiceLayer = - ApiGatewayManagementApiServiceLayer.pipe( - Layer.provide(ApiGatewayManagementApiClientConfigLayer), - ); + const program = ApiGatewayManagementApi.postToConnection(args); const result = await pipe( program, - Effect.provide(CustomApiGatewayManagementApiServiceLayer), + Effect.provide(ApiGatewayManagementApi.layer({ region: "eu-central-1" })), Effect.runPromiseExit, ); expect(result).toEqual(Exit.succeed({})); + expect(getRuntimeConfig).toHaveBeenCalledTimes(1); + expect(getRuntimeConfig).toHaveBeenCalledWith({ + region: "eu-central-1", + logger: expect.any(Object), + }); expect(clientMock).toHaveReceivedCommandTimes(PostToConnectionCommand, 1); expect(clientMock).toHaveReceivedCommandWith(PostToConnectionCommand, args); }); @@ -84,24 +80,23 @@ describe("ApiGatewayManagementApiClientImpl", () => { Data: "test", }; - const program = ApiGatewayManagementApiService.postToConnection(args); - - const ApiGatewayManagementApiClientInstanceLayer = Layer.succeed( - ApiGatewayManagementApiClientInstance, - new ApiGatewayManagementApiClient({ region: "eu-central-1" }), - ); - const CustomApiGatewayManagementApiServiceLayer = - BaseApiGatewayManagementApiServiceLayer.pipe( - Layer.provide(ApiGatewayManagementApiClientInstanceLayer), - ); + const program = ApiGatewayManagementApi.postToConnection(args); const result = await pipe( program, - Effect.provide(CustomApiGatewayManagementApiServiceLayer), + Effect.provide( + ApiGatewayManagementApi.baseLayer( + () => new ApiGatewayManagementApiClient({ region: "eu-central-1" }), + ), + ), Effect.runPromiseExit, ); expect(result).toEqual(Exit.succeed({})); + expect(getRuntimeConfig).toHaveBeenCalledTimes(1); + expect(getRuntimeConfig).toHaveBeenCalledWith({ + region: "eu-central-1", + }); expect(clientMock).toHaveReceivedCommandTimes(PostToConnectionCommand, 1); expect(clientMock).toHaveReceivedCommandWith(PostToConnectionCommand, args); }); @@ -114,32 +109,28 @@ describe("ApiGatewayManagementApiClientImpl", () => { Data: "test", }; - const program = ApiGatewayManagementApiService.postToConnection(args); - - const ApiGatewayManagementApiClientInstanceLayer = Layer.effect( - ApiGatewayManagementApiClientInstance, - Effect.map( - ApiGatewayManagementApiClientInstanceConfig, - (config) => - new ApiGatewayManagementApiClient({ - ...config, - region: "eu-central-1", - }), - ), - ); - const CustomApiGatewayManagementApiServiceLayer = - BaseApiGatewayManagementApiServiceLayer.pipe( - Layer.provide(ApiGatewayManagementApiClientInstanceLayer), - Layer.provide(DefaultApiGatewayManagementApiClientConfigLayer), - ); + const program = ApiGatewayManagementApi.postToConnection(args); const result = await pipe( program, - Effect.provide(CustomApiGatewayManagementApiServiceLayer), + Effect.provide( + ApiGatewayManagementApi.baseLayer( + (config) => + new ApiGatewayManagementApiClient({ + ...config, + region: "eu-central-1", + }), + ), + ), Effect.runPromiseExit, ); expect(result).toEqual(Exit.succeed({})); + expect(getRuntimeConfig).toHaveBeenCalledTimes(1); + expect(getRuntimeConfig).toHaveBeenCalledWith({ + region: "eu-central-1", + logger: expect.any(Object), + }); expect(clientMock).toHaveReceivedCommandTimes(PostToConnectionCommand, 1); expect(clientMock).toHaveReceivedCommandWith(PostToConnectionCommand, args); }); @@ -152,11 +143,11 @@ describe("ApiGatewayManagementApiClientImpl", () => { Data: "test", }; - const program = ApiGatewayManagementApiService.postToConnection(args); + const program = ApiGatewayManagementApi.postToConnection(args); const result = await pipe( program, - Effect.provide(DefaultApiGatewayManagementApiServiceLayer), + Effect.provide(ApiGatewayManagementApi.defaultLayer), Effect.runPromiseExit, ); @@ -190,13 +181,13 @@ describe("ApiGatewayManagementApiClientImpl", () => { Data: "test", }; - const program = ApiGatewayManagementApiService.postToConnection(args).pipe( + const program = ApiGatewayManagementApi.postToConnection(args).pipe( Effect.catchTag("NotHandledException" as any, () => Effect.succeed(null)), ); const result = await pipe( program, - Effect.provide(DefaultApiGatewayManagementApiServiceLayer), + Effect.provide(ApiGatewayManagementApi.defaultLayer), Effect.runPromiseExit, ); diff --git a/packages/client-bedrock/README.md b/packages/client-bedrock/README.md index b97ea0f..027aab0 100644 --- a/packages/client-bedrock/README.md +++ b/packages/client-bedrock/README.md @@ -14,13 +14,13 @@ npm install --save @effect-aws/client-bedrock With default BedrockClient instance: ```typescript -import { BedrockService, DefaultBedrockServiceLayer } from "@effect-aws/client-bedrock"; +import { Bedrock } from "@effect-aws/client-bedrock"; -const program = BedrockService.listCustomModels(args); +const program = Bedrock.listCustomModels(args); const result = pipe( program, - Effect.provide(DefaultBedrockServiceLayer), + Effect.provide(Bedrock.defaultLayer), Effect.runPromise, ); ``` @@ -28,23 +28,15 @@ const result = pipe( With custom BedrockClient instance: ```typescript -import { - BedrockService, - BaseBedrockServiceLayer, - BedrockClientInstance, -} from "@effect-aws/client-bedrock"; +import { Bedrock } from "@effect-aws/client-bedrock"; -const program = BedrockService.listCustomModels(args); - -const BedrockClientInstanceLayer = Layer.succeed( - BedrockClientInstance, - new BedrockClient({ region: "eu-central-1" }), -); +const program = Bedrock.listCustomModels(args); const result = await pipe( program, - Effect.provide(BaseBedrockServiceLayer), - Effect.provide(BedrockClientInstanceLayer), + Effect.provide( + Bedrock.baseLayer(() => new BedrockClient({ region: "eu-central-1" })), + ), Effect.runPromise, ); ``` @@ -52,34 +44,15 @@ const result = await pipe( With custom BedrockClient configuration: ```typescript -import { - BedrockService, - BaseBedrockServiceLayer, - DefaultBedrockClientConfigLayer, - BedrockClientInstance, - BedrockClientInstanceConfig, -} from "@effect-aws/client-bedrock"; - -const program = BedrockService.listCustomModels(args); - -const BedrockClientInstanceLayer = Layer.provide( - Layer.effect( - BedrockClientInstance, - BedrockClientInstanceConfig.pipe( - Effect.map( - (config) => new BedrockClient({ ...config, region: "eu-central-1" }), - ), - ), - ), - DefaultBedrockClientConfigLayer, -); +import { Bedrock } from "@effect-aws/client-bedrock"; + +const program = Bedrock.listCustomModels(args); const result = await pipe( program, - Effect.provide(BaseBedrockServiceLayer), - Effect.provide(BedrockClientInstanceLayer), + Effect.provide(Bedrock.layer({ region: "eu-central-1" })), Effect.runPromiseExit, ); ``` -or map over `DefaultBedrockClientConfigLayer` layer context and update the configuration... +or use `Bedrock.baseLayer((default) => new BedrockClient({ ...default, region: "eu-central-1" }))` diff --git a/packages/client-bedrock/src/BedrockService.ts b/packages/client-bedrock/src/BedrockService.ts index 6aaedab..86f66d0 100644 --- a/packages/client-bedrock/src/BedrockService.ts +++ b/packages/client-bedrock/src/BedrockService.ts @@ -3,6 +3,8 @@ */ import { BedrockServiceException, + type BedrockClient, + type BedrockClientConfig, BatchDeleteEvaluationJobCommand, type BatchDeleteEvaluationJobCommandInput, type BatchDeleteEvaluationJobCommandOutput, @@ -153,7 +155,11 @@ import { BedrockClientInstance, BedrockClientInstanceLayer, } from "./BedrockClientInstance"; -import { DefaultBedrockClientConfigLayer } from "./BedrockClientInstanceConfig"; +import { + DefaultBedrockClientConfigLayer, + makeDefaultBedrockClientInstanceConfig, + BedrockClientInstanceConfig, +} from "./BedrockClientInstanceConfig"; import { AllServiceErrors, AccessDeniedError, @@ -169,7 +175,7 @@ import { } from "./Errors"; /** - * @since 1.0.1 + * @since 1.0.0 */ export interface HttpHandlerOptions { /** @@ -1013,14 +1019,6 @@ interface BedrockService$ { >; } -/** - * @since 1.0.0 - * @category models - */ -export class BedrockService extends Effect.Tag( - "@effect-aws/client-bedrock/BedrockService", -)() {} - /** * @since 1.0.0 * @category constructors @@ -1071,9 +1069,53 @@ export const makeBedrockService = Effect.gen(function* (_) { }, {}) as BedrockService$; }); +/** + * @since 1.0.0 + * @category models + */ +export class BedrockService extends Effect.Tag( + "@effect-aws/client-bedrock/BedrockService", +)() { + static readonly defaultLayer = Layer.effect(this, makeBedrockService).pipe( + Layer.provide(BedrockClientInstanceLayer), + Layer.provide(DefaultBedrockClientConfigLayer), + ); + static readonly layer = (config: BedrockClientConfig) => + Layer.effect(this, makeBedrockService).pipe( + Layer.provide(BedrockClientInstanceLayer), + Layer.provide( + Layer.effect( + BedrockClientInstanceConfig, + makeDefaultBedrockClientInstanceConfig.pipe( + Effect.map((defaultConfig) => ({ ...defaultConfig, ...config })), + ), + ), + ), + ); + static readonly baseLayer = ( + evaluate: (defaultConfig: BedrockClientConfig) => BedrockClient, + ) => + Layer.effect(this, makeBedrockService).pipe( + Layer.provide( + Layer.effect( + BedrockClientInstance, + Effect.map(makeDefaultBedrockClientInstanceConfig, evaluate), + ), + ), + ); +} + +/** + * @since 1.0.0 + * @category models + * @alias BedrockService + */ +export const Bedrock = BedrockService; + /** * @since 1.0.0 * @category layers + * @deprecated use Bedrock.baseLayer instead */ export const BaseBedrockServiceLayer = Layer.effect( BedrockService, @@ -1083,6 +1125,7 @@ export const BaseBedrockServiceLayer = Layer.effect( /** * @since 1.0.0 * @category layers + * @deprecated use Bedrock.layer instead */ export const BedrockServiceLayer = BaseBedrockServiceLayer.pipe( Layer.provide(BedrockClientInstanceLayer), @@ -1091,7 +1134,6 @@ export const BedrockServiceLayer = BaseBedrockServiceLayer.pipe( /** * @since 1.0.0 * @category layers + * @deprecated use Bedrock.defaultLayer instead */ -export const DefaultBedrockServiceLayer = BedrockServiceLayer.pipe( - Layer.provide(DefaultBedrockClientConfigLayer), -); +export const DefaultBedrockServiceLayer = BedrockService.defaultLayer; diff --git a/packages/client-bedrock/test/Bedrock.test.ts b/packages/client-bedrock/test/Bedrock.test.ts index 0fb9b71..5a863af 100644 --- a/packages/client-bedrock/test/Bedrock.test.ts +++ b/packages/client-bedrock/test/Bedrock.test.ts @@ -4,39 +4,41 @@ import { BedrockClient, BedrockServiceException, } from "@aws-sdk/client-bedrock"; +// @ts-ignore +import * as runtimeConfig from "@aws-sdk/client-bedrock/dist-cjs/runtimeConfig"; import { mockClient } from "aws-sdk-client-mock"; import * as Effect from "effect/Effect"; import * as Exit from "effect/Exit"; import { pipe } from "effect/Function"; -import * as Layer from "effect/Layer"; -import { - BaseBedrockServiceLayer, - DefaultBedrockClientConfigLayer, - DefaultBedrockServiceLayer, - BedrockClientInstance, - BedrockClientInstanceConfig, - BedrockService, - BedrockServiceLayer, - SdkError, -} from "../src"; +import { afterEach, describe, expect, it, vi } from "vitest"; +import { Bedrock, SdkError } from "../src"; +const getRuntimeConfig = vi.spyOn(runtimeConfig, "getRuntimeConfig"); const clientMock = mockClient(BedrockClient); describe("BedrockClientImpl", () => { + afterEach(() => { + getRuntimeConfig.mockClear(); + }); + it("default", async () => { clientMock.reset().on(ListCustomModelsCommand).resolves({}); const args = {} as unknown as ListCustomModelsCommandInput; - const program = BedrockService.listCustomModels(args); + const program = Bedrock.listCustomModels(args); const result = await pipe( program, - Effect.provide(DefaultBedrockServiceLayer), + Effect.provide(Bedrock.defaultLayer), Effect.runPromiseExit, ); expect(result).toEqual(Exit.succeed({})); + expect(getRuntimeConfig).toHaveBeenCalledTimes(1); + expect(getRuntimeConfig).toHaveBeenCalledWith({ + logger: expect.any(Object), + }); expect(clientMock).toHaveReceivedCommandTimes(ListCustomModelsCommand, 1); expect(clientMock).toHaveReceivedCommandWith(ListCustomModelsCommand, args); }); @@ -46,25 +48,20 @@ describe("BedrockClientImpl", () => { const args = {} as unknown as ListCustomModelsCommandInput; - const program = BedrockService.listCustomModels(args); - - const BedrockClientConfigLayer = Layer.succeed( - BedrockClientInstanceConfig, - { - region: "eu-central-1", - }, - ); - const CustomBedrockServiceLayer = BedrockServiceLayer.pipe( - Layer.provide(BedrockClientConfigLayer), - ); + const program = Bedrock.listCustomModels(args); const result = await pipe( program, - Effect.provide(CustomBedrockServiceLayer), + Effect.provide(Bedrock.layer({ region: "eu-central-1" })), Effect.runPromiseExit, ); expect(result).toEqual(Exit.succeed({})); + expect(getRuntimeConfig).toHaveBeenCalledTimes(1); + expect(getRuntimeConfig).toHaveBeenCalledWith({ + region: "eu-central-1", + logger: expect.any(Object), + }); expect(clientMock).toHaveReceivedCommandTimes(ListCustomModelsCommand, 1); expect(clientMock).toHaveReceivedCommandWith(ListCustomModelsCommand, args); }); @@ -74,23 +71,21 @@ describe("BedrockClientImpl", () => { const args = {} as unknown as ListCustomModelsCommandInput; - const program = BedrockService.listCustomModels(args); - - const BedrockClientInstanceLayer = Layer.succeed( - BedrockClientInstance, - new BedrockClient({ region: "eu-central-1" }), - ); - const CustomBedrockServiceLayer = BaseBedrockServiceLayer.pipe( - Layer.provide(BedrockClientInstanceLayer), - ); + const program = Bedrock.listCustomModels(args); const result = await pipe( program, - Effect.provide(CustomBedrockServiceLayer), + Effect.provide( + Bedrock.baseLayer(() => new BedrockClient({ region: "eu-central-1" })), + ), Effect.runPromiseExit, ); expect(result).toEqual(Exit.succeed({})); + expect(getRuntimeConfig).toHaveBeenCalledTimes(1); + expect(getRuntimeConfig).toHaveBeenCalledWith({ + region: "eu-central-1", + }); expect(clientMock).toHaveReceivedCommandTimes(ListCustomModelsCommand, 1); expect(clientMock).toHaveReceivedCommandWith(ListCustomModelsCommand, args); }); @@ -100,27 +95,24 @@ describe("BedrockClientImpl", () => { const args = {} as unknown as ListCustomModelsCommandInput; - const program = BedrockService.listCustomModels(args); - - const BedrockClientInstanceLayer = Layer.effect( - BedrockClientInstance, - Effect.map( - BedrockClientInstanceConfig, - (config) => new BedrockClient({ ...config, region: "eu-central-1" }), - ), - ); - const CustomBedrockServiceLayer = BaseBedrockServiceLayer.pipe( - Layer.provide(BedrockClientInstanceLayer), - Layer.provide(DefaultBedrockClientConfigLayer), - ); + const program = Bedrock.listCustomModels(args); const result = await pipe( program, - Effect.provide(CustomBedrockServiceLayer), + Effect.provide( + Bedrock.baseLayer( + (config) => new BedrockClient({ ...config, region: "eu-central-1" }), + ), + ), Effect.runPromiseExit, ); expect(result).toEqual(Exit.succeed({})); + expect(getRuntimeConfig).toHaveBeenCalledTimes(1); + expect(getRuntimeConfig).toHaveBeenCalledWith({ + region: "eu-central-1", + logger: expect.any(Object), + }); expect(clientMock).toHaveReceivedCommandTimes(ListCustomModelsCommand, 1); expect(clientMock).toHaveReceivedCommandWith(ListCustomModelsCommand, args); }); @@ -130,11 +122,11 @@ describe("BedrockClientImpl", () => { const args = {} as unknown as ListCustomModelsCommandInput; - const program = BedrockService.listCustomModels(args); + const program = Bedrock.listCustomModels(args); const result = await pipe( program, - Effect.provide(DefaultBedrockServiceLayer), + Effect.provide(Bedrock.defaultLayer), Effect.runPromiseExit, ); @@ -165,13 +157,13 @@ describe("BedrockClientImpl", () => { const args = {} as unknown as ListCustomModelsCommandInput; - const program = BedrockService.listCustomModels(args).pipe( + const program = Bedrock.listCustomModels(args).pipe( Effect.catchTag("NotHandledException" as any, () => Effect.succeed(null)), ); const result = await pipe( program, - Effect.provide(DefaultBedrockServiceLayer), + Effect.provide(Bedrock.defaultLayer), Effect.runPromiseExit, ); diff --git a/packages/client-cloudsearch/README.md b/packages/client-cloudsearch/README.md index eda9a29..dc5bfbc 100644 --- a/packages/client-cloudsearch/README.md +++ b/packages/client-cloudsearch/README.md @@ -14,13 +14,13 @@ npm install --save @effect-aws/client-cloudsearch With default CloudSearchClient instance: ```typescript -import { CloudSearchService, DefaultCloudSearchServiceLayer } from "@effect-aws/client-cloudsearch"; +import { CloudSearch } from "@effect-aws/client-cloudsearch"; -const program = CloudSearchService.describeDomains(args); +const program = CloudSearch.describeDomains(args); const result = pipe( program, - Effect.provide(DefaultCloudSearchServiceLayer), + Effect.provide(CloudSearch.defaultLayer), Effect.runPromise, ); ``` @@ -28,23 +28,15 @@ const result = pipe( With custom CloudSearchClient instance: ```typescript -import { - CloudSearchService, - BaseCloudSearchServiceLayer, - CloudSearchClientInstance, -} from "@effect-aws/client-cloudsearch"; +import { CloudSearch } from "@effect-aws/client-cloudsearch"; -const program = CloudSearchService.describeDomains(args); - -const CloudSearchClientInstanceLayer = Layer.succeed( - CloudSearchClientInstance, - new CloudSearchClient({ region: "eu-central-1" }), -); +const program = CloudSearch.describeDomains(args); const result = await pipe( program, - Effect.provide(BaseCloudSearchServiceLayer), - Effect.provide(CloudSearchClientInstanceLayer), + Effect.provide( + CloudSearch.baseLayer(() => new CloudSearchClient({ region: "eu-central-1" })), + ), Effect.runPromise, ); ``` @@ -52,34 +44,15 @@ const result = await pipe( With custom CloudSearchClient configuration: ```typescript -import { - CloudSearchService, - BaseCloudSearchServiceLayer, - DefaultCloudSearchClientConfigLayer, - CloudSearchClientInstance, - CloudSearchClientInstanceConfig, -} from "@effect-aws/client-cloudsearch"; - -const program = CloudSearchService.describeDomains(args); - -const CloudSearchClientInstanceLayer = Layer.provide( - Layer.effect( - CloudSearchClientInstance, - CloudSearchClientInstanceConfig.pipe( - Effect.map( - (config) => new CloudSearchClient({ ...config, region: "eu-central-1" }), - ), - ), - ), - DefaultCloudSearchClientConfigLayer, -); +import { CloudSearch } from "@effect-aws/client-cloudsearch"; + +const program = CloudSearch.describeDomains(args); const result = await pipe( program, - Effect.provide(BaseCloudSearchServiceLayer), - Effect.provide(CloudSearchClientInstanceLayer), + Effect.provide(CloudSearch.layer({ region: "eu-central-1" })), Effect.runPromiseExit, ); ``` -or map over `DefaultCloudSearchClientConfigLayer` layer context and update the configuration... +or use `CloudSearch.baseLayer((default) => new CloudSearchClient({ ...default, region: "eu-central-1" }))` diff --git a/packages/client-cloudsearch/src/CloudSearchService.ts b/packages/client-cloudsearch/src/CloudSearchService.ts index 20a2612..a6bd1cf 100644 --- a/packages/client-cloudsearch/src/CloudSearchService.ts +++ b/packages/client-cloudsearch/src/CloudSearchService.ts @@ -3,6 +3,8 @@ */ import { CloudSearchServiceException, + type CloudSearchClient, + type CloudSearchClientConfig, BuildSuggestersCommand, type BuildSuggestersCommandInput, type BuildSuggestersCommandOutput, @@ -87,7 +89,11 @@ import { CloudSearchClientInstance, CloudSearchClientInstanceLayer, } from "./CloudSearchClientInstance"; -import { DefaultCloudSearchClientConfigLayer } from "./CloudSearchClientInstanceConfig"; +import { + DefaultCloudSearchClientConfigLayer, + makeDefaultCloudSearchClientInstanceConfig, + CloudSearchClientInstanceConfig, +} from "./CloudSearchClientInstanceConfig"; import { AllServiceErrors, BaseError, @@ -103,7 +109,7 @@ import { } from "./Errors"; /** - * @since 1.0.1 + * @since 1.0.0 */ export interface HttpHandlerOptions { /** @@ -523,14 +529,6 @@ interface CloudSearchService$ { >; } -/** - * @since 1.0.0 - * @category models - */ -export class CloudSearchService extends Effect.Tag( - "@effect-aws/client-cloudsearch/CloudSearchService", -)() {} - /** * @since 1.0.0 * @category constructors @@ -581,9 +579,56 @@ export const makeCloudSearchService = Effect.gen(function* (_) { }, {}) as CloudSearchService$; }); +/** + * @since 1.0.0 + * @category models + */ +export class CloudSearchService extends Effect.Tag( + "@effect-aws/client-cloudsearch/CloudSearchService", +)() { + static readonly defaultLayer = Layer.effect( + this, + makeCloudSearchService, + ).pipe( + Layer.provide(CloudSearchClientInstanceLayer), + Layer.provide(DefaultCloudSearchClientConfigLayer), + ); + static readonly layer = (config: CloudSearchClientConfig) => + Layer.effect(this, makeCloudSearchService).pipe( + Layer.provide(CloudSearchClientInstanceLayer), + Layer.provide( + Layer.effect( + CloudSearchClientInstanceConfig, + makeDefaultCloudSearchClientInstanceConfig.pipe( + Effect.map((defaultConfig) => ({ ...defaultConfig, ...config })), + ), + ), + ), + ); + static readonly baseLayer = ( + evaluate: (defaultConfig: CloudSearchClientConfig) => CloudSearchClient, + ) => + Layer.effect(this, makeCloudSearchService).pipe( + Layer.provide( + Layer.effect( + CloudSearchClientInstance, + Effect.map(makeDefaultCloudSearchClientInstanceConfig, evaluate), + ), + ), + ); +} + +/** + * @since 1.0.0 + * @category models + * @alias CloudSearchService + */ +export const CloudSearch = CloudSearchService; + /** * @since 1.0.0 * @category layers + * @deprecated use CloudSearch.baseLayer instead */ export const BaseCloudSearchServiceLayer = Layer.effect( CloudSearchService, @@ -593,6 +638,7 @@ export const BaseCloudSearchServiceLayer = Layer.effect( /** * @since 1.0.0 * @category layers + * @deprecated use CloudSearch.layer instead */ export const CloudSearchServiceLayer = BaseCloudSearchServiceLayer.pipe( Layer.provide(CloudSearchClientInstanceLayer), @@ -601,7 +647,6 @@ export const CloudSearchServiceLayer = BaseCloudSearchServiceLayer.pipe( /** * @since 1.0.0 * @category layers + * @deprecated use CloudSearch.defaultLayer instead */ -export const DefaultCloudSearchServiceLayer = CloudSearchServiceLayer.pipe( - Layer.provide(DefaultCloudSearchClientConfigLayer), -); +export const DefaultCloudSearchServiceLayer = CloudSearchService.defaultLayer; diff --git a/packages/client-cloudsearch/test/CloudSearch.test.ts b/packages/client-cloudsearch/test/CloudSearch.test.ts index 5a77865..c439cfd 100644 --- a/packages/client-cloudsearch/test/CloudSearch.test.ts +++ b/packages/client-cloudsearch/test/CloudSearch.test.ts @@ -4,39 +4,41 @@ import { CloudSearchClient, CloudSearchServiceException, } from "@aws-sdk/client-cloudsearch"; +// @ts-ignore +import * as runtimeConfig from "@aws-sdk/client-cloudsearch/dist-cjs/runtimeConfig"; import { mockClient } from "aws-sdk-client-mock"; import * as Effect from "effect/Effect"; import * as Exit from "effect/Exit"; import { pipe } from "effect/Function"; -import * as Layer from "effect/Layer"; -import { - BaseCloudSearchServiceLayer, - DefaultCloudSearchClientConfigLayer, - DefaultCloudSearchServiceLayer, - CloudSearchClientInstance, - CloudSearchClientInstanceConfig, - CloudSearchService, - CloudSearchServiceLayer, - SdkError, -} from "../src"; +import { afterEach, describe, expect, it, vi } from "vitest"; +import { CloudSearch, SdkError } from "../src"; +const getRuntimeConfig = vi.spyOn(runtimeConfig, "getRuntimeConfig"); const clientMock = mockClient(CloudSearchClient); describe("CloudSearchClientImpl", () => { + afterEach(() => { + getRuntimeConfig.mockClear(); + }); + it("default", async () => { clientMock.reset().on(DescribeDomainsCommand).resolves({}); const args = {} as unknown as DescribeDomainsCommandInput; - const program = CloudSearchService.describeDomains(args); + const program = CloudSearch.describeDomains(args); const result = await pipe( program, - Effect.provide(DefaultCloudSearchServiceLayer), + Effect.provide(CloudSearch.defaultLayer), Effect.runPromiseExit, ); expect(result).toEqual(Exit.succeed({})); + expect(getRuntimeConfig).toHaveBeenCalledTimes(1); + expect(getRuntimeConfig).toHaveBeenCalledWith({ + logger: expect.any(Object), + }); expect(clientMock).toHaveReceivedCommandTimes(DescribeDomainsCommand, 1); expect(clientMock).toHaveReceivedCommandWith(DescribeDomainsCommand, args); }); @@ -46,25 +48,20 @@ describe("CloudSearchClientImpl", () => { const args = {} as unknown as DescribeDomainsCommandInput; - const program = CloudSearchService.describeDomains(args); - - const CloudSearchClientConfigLayer = Layer.succeed( - CloudSearchClientInstanceConfig, - { - region: "eu-central-1", - }, - ); - const CustomCloudSearchServiceLayer = CloudSearchServiceLayer.pipe( - Layer.provide(CloudSearchClientConfigLayer), - ); + const program = CloudSearch.describeDomains(args); const result = await pipe( program, - Effect.provide(CustomCloudSearchServiceLayer), + Effect.provide(CloudSearch.layer({ region: "eu-central-1" })), Effect.runPromiseExit, ); expect(result).toEqual(Exit.succeed({})); + expect(getRuntimeConfig).toHaveBeenCalledTimes(1); + expect(getRuntimeConfig).toHaveBeenCalledWith({ + region: "eu-central-1", + logger: expect.any(Object), + }); expect(clientMock).toHaveReceivedCommandTimes(DescribeDomainsCommand, 1); expect(clientMock).toHaveReceivedCommandWith(DescribeDomainsCommand, args); }); @@ -74,23 +71,23 @@ describe("CloudSearchClientImpl", () => { const args = {} as unknown as DescribeDomainsCommandInput; - const program = CloudSearchService.describeDomains(args); - - const CloudSearchClientInstanceLayer = Layer.succeed( - CloudSearchClientInstance, - new CloudSearchClient({ region: "eu-central-1" }), - ); - const CustomCloudSearchServiceLayer = BaseCloudSearchServiceLayer.pipe( - Layer.provide(CloudSearchClientInstanceLayer), - ); + const program = CloudSearch.describeDomains(args); const result = await pipe( program, - Effect.provide(CustomCloudSearchServiceLayer), + Effect.provide( + CloudSearch.baseLayer( + () => new CloudSearchClient({ region: "eu-central-1" }), + ), + ), Effect.runPromiseExit, ); expect(result).toEqual(Exit.succeed({})); + expect(getRuntimeConfig).toHaveBeenCalledTimes(1); + expect(getRuntimeConfig).toHaveBeenCalledWith({ + region: "eu-central-1", + }); expect(clientMock).toHaveReceivedCommandTimes(DescribeDomainsCommand, 1); expect(clientMock).toHaveReceivedCommandWith(DescribeDomainsCommand, args); }); @@ -100,28 +97,25 @@ describe("CloudSearchClientImpl", () => { const args = {} as unknown as DescribeDomainsCommandInput; - const program = CloudSearchService.describeDomains(args); - - const CloudSearchClientInstanceLayer = Layer.effect( - CloudSearchClientInstance, - Effect.map( - CloudSearchClientInstanceConfig, - (config) => - new CloudSearchClient({ ...config, region: "eu-central-1" }), - ), - ); - const CustomCloudSearchServiceLayer = BaseCloudSearchServiceLayer.pipe( - Layer.provide(CloudSearchClientInstanceLayer), - Layer.provide(DefaultCloudSearchClientConfigLayer), - ); + const program = CloudSearch.describeDomains(args); const result = await pipe( program, - Effect.provide(CustomCloudSearchServiceLayer), + Effect.provide( + CloudSearch.baseLayer( + (config) => + new CloudSearchClient({ ...config, region: "eu-central-1" }), + ), + ), Effect.runPromiseExit, ); expect(result).toEqual(Exit.succeed({})); + expect(getRuntimeConfig).toHaveBeenCalledTimes(1); + expect(getRuntimeConfig).toHaveBeenCalledWith({ + region: "eu-central-1", + logger: expect.any(Object), + }); expect(clientMock).toHaveReceivedCommandTimes(DescribeDomainsCommand, 1); expect(clientMock).toHaveReceivedCommandWith(DescribeDomainsCommand, args); }); @@ -131,11 +125,11 @@ describe("CloudSearchClientImpl", () => { const args = {} as unknown as DescribeDomainsCommandInput; - const program = CloudSearchService.describeDomains(args); + const program = CloudSearch.describeDomains(args); const result = await pipe( program, - Effect.provide(DefaultCloudSearchServiceLayer), + Effect.provide(CloudSearch.defaultLayer), Effect.runPromiseExit, ); @@ -166,13 +160,13 @@ describe("CloudSearchClientImpl", () => { const args = {} as unknown as DescribeDomainsCommandInput; - const program = CloudSearchService.describeDomains(args).pipe( + const program = CloudSearch.describeDomains(args).pipe( Effect.catchTag("NotHandledException" as any, () => Effect.succeed(null)), ); const result = await pipe( program, - Effect.provide(DefaultCloudSearchServiceLayer), + Effect.provide(CloudSearch.defaultLayer), Effect.runPromiseExit, ); diff --git a/packages/client-cloudtrail/README.md b/packages/client-cloudtrail/README.md index efa694d..faf2563 100644 --- a/packages/client-cloudtrail/README.md +++ b/packages/client-cloudtrail/README.md @@ -14,13 +14,13 @@ npm install --save @effect-aws/client-cloudtrail With default CloudTrailClient instance: ```typescript -import { CloudTrailService, DefaultCloudTrailServiceLayer } from "@effect-aws/client-cloudtrail"; +import { CloudTrail } from "@effect-aws/client-cloudtrail"; -const program = CloudTrailService.listTrails(args); +const program = CloudTrail.listTrails(args); const result = pipe( program, - Effect.provide(DefaultCloudTrailServiceLayer), + Effect.provide(CloudTrail.defaultLayer), Effect.runPromise, ); ``` @@ -28,23 +28,15 @@ const result = pipe( With custom CloudTrailClient instance: ```typescript -import { - CloudTrailService, - BaseCloudTrailServiceLayer, - CloudTrailClientInstance, -} from "@effect-aws/client-cloudtrail"; +import { CloudTrail } from "@effect-aws/client-cloudtrail"; -const program = CloudTrailService.listTrails(args); - -const CloudTrailClientInstanceLayer = Layer.succeed( - CloudTrailClientInstance, - new CloudTrailClient({ region: "eu-central-1" }), -); +const program = CloudTrail.listTrails(args); const result = await pipe( program, - Effect.provide(BaseCloudTrailServiceLayer), - Effect.provide(CloudTrailClientInstanceLayer), + Effect.provide( + CloudTrail.baseLayer(() => new CloudTrailClient({ region: "eu-central-1" })), + ), Effect.runPromise, ); ``` @@ -52,34 +44,15 @@ const result = await pipe( With custom CloudTrailClient configuration: ```typescript -import { - CloudTrailService, - BaseCloudTrailServiceLayer, - DefaultCloudTrailClientConfigLayer, - CloudTrailClientInstance, - CloudTrailClientInstanceConfig, -} from "@effect-aws/client-cloudtrail"; - -const program = CloudTrailService.listTrails(args); - -const CloudTrailClientInstanceLayer = Layer.provide( - Layer.effect( - CloudTrailClientInstance, - CloudTrailClientInstanceConfig.pipe( - Effect.map( - (config) => new CloudTrailClient({ ...config, region: "eu-central-1" }), - ), - ), - ), - DefaultCloudTrailClientConfigLayer, -); +import { CloudTrail } from "@effect-aws/client-cloudtrail"; + +const program = CloudTrail.listTrails(args); const result = await pipe( program, - Effect.provide(BaseCloudTrailServiceLayer), - Effect.provide(CloudTrailClientInstanceLayer), + Effect.provide(CloudTrail.layer({ region: "eu-central-1" })), Effect.runPromiseExit, ); ``` -or map over `DefaultCloudTrailClientConfigLayer` layer context and update the configuration... +or use `CloudTrail.baseLayer((default) => new CloudTrailClient({ ...default, region: "eu-central-1" }))` diff --git a/packages/client-cloudtrail/src/CloudTrailService.ts b/packages/client-cloudtrail/src/CloudTrailService.ts index abe1ead..67c186a 100644 --- a/packages/client-cloudtrail/src/CloudTrailService.ts +++ b/packages/client-cloudtrail/src/CloudTrailService.ts @@ -3,6 +3,8 @@ */ import { CloudTrailServiceException, + type CloudTrailClient, + type CloudTrailClientConfig, AddTagsCommand, type AddTagsCommandInput, type AddTagsCommandOutput, @@ -156,7 +158,11 @@ import { CloudTrailClientInstance, CloudTrailClientInstanceLayer, } from "./CloudTrailClientInstance"; -import { DefaultCloudTrailClientConfigLayer } from "./CloudTrailClientInstanceConfig"; +import { + DefaultCloudTrailClientConfigLayer, + makeDefaultCloudTrailClientInstanceConfig, + CloudTrailClientInstanceConfig, +} from "./CloudTrailClientInstanceConfig"; import { AllServiceErrors, AccessDeniedError, @@ -247,7 +253,7 @@ import { } from "./Errors"; /** - * @since 1.0.1 + * @since 1.0.0 */ export interface HttpHandlerOptions { /** @@ -1349,14 +1355,6 @@ interface CloudTrailService$ { >; } -/** - * @since 1.0.0 - * @category models - */ -export class CloudTrailService extends Effect.Tag( - "@effect-aws/client-cloudtrail/CloudTrailService", -)() {} - /** * @since 1.0.0 * @category constructors @@ -1407,9 +1405,53 @@ export const makeCloudTrailService = Effect.gen(function* (_) { }, {}) as CloudTrailService$; }); +/** + * @since 1.0.0 + * @category models + */ +export class CloudTrailService extends Effect.Tag( + "@effect-aws/client-cloudtrail/CloudTrailService", +)() { + static readonly defaultLayer = Layer.effect(this, makeCloudTrailService).pipe( + Layer.provide(CloudTrailClientInstanceLayer), + Layer.provide(DefaultCloudTrailClientConfigLayer), + ); + static readonly layer = (config: CloudTrailClientConfig) => + Layer.effect(this, makeCloudTrailService).pipe( + Layer.provide(CloudTrailClientInstanceLayer), + Layer.provide( + Layer.effect( + CloudTrailClientInstanceConfig, + makeDefaultCloudTrailClientInstanceConfig.pipe( + Effect.map((defaultConfig) => ({ ...defaultConfig, ...config })), + ), + ), + ), + ); + static readonly baseLayer = ( + evaluate: (defaultConfig: CloudTrailClientConfig) => CloudTrailClient, + ) => + Layer.effect(this, makeCloudTrailService).pipe( + Layer.provide( + Layer.effect( + CloudTrailClientInstance, + Effect.map(makeDefaultCloudTrailClientInstanceConfig, evaluate), + ), + ), + ); +} + +/** + * @since 1.0.0 + * @category models + * @alias CloudTrailService + */ +export const CloudTrail = CloudTrailService; + /** * @since 1.0.0 * @category layers + * @deprecated use CloudTrail.baseLayer instead */ export const BaseCloudTrailServiceLayer = Layer.effect( CloudTrailService, @@ -1419,6 +1461,7 @@ export const BaseCloudTrailServiceLayer = Layer.effect( /** * @since 1.0.0 * @category layers + * @deprecated use CloudTrail.layer instead */ export const CloudTrailServiceLayer = BaseCloudTrailServiceLayer.pipe( Layer.provide(CloudTrailClientInstanceLayer), @@ -1427,7 +1470,6 @@ export const CloudTrailServiceLayer = BaseCloudTrailServiceLayer.pipe( /** * @since 1.0.0 * @category layers + * @deprecated use CloudTrail.defaultLayer instead */ -export const DefaultCloudTrailServiceLayer = CloudTrailServiceLayer.pipe( - Layer.provide(DefaultCloudTrailClientConfigLayer), -); +export const DefaultCloudTrailServiceLayer = CloudTrailService.defaultLayer; diff --git a/packages/client-cloudtrail/test/CloudTrail.test.ts b/packages/client-cloudtrail/test/CloudTrail.test.ts index 2068b4c..953691c 100644 --- a/packages/client-cloudtrail/test/CloudTrail.test.ts +++ b/packages/client-cloudtrail/test/CloudTrail.test.ts @@ -4,39 +4,41 @@ import { CloudTrailClient, CloudTrailServiceException, } from "@aws-sdk/client-cloudtrail"; +// @ts-ignore +import * as runtimeConfig from "@aws-sdk/client-cloudtrail/dist-cjs/runtimeConfig"; import { mockClient } from "aws-sdk-client-mock"; import * as Effect from "effect/Effect"; import * as Exit from "effect/Exit"; import { pipe } from "effect/Function"; -import * as Layer from "effect/Layer"; -import { - BaseCloudTrailServiceLayer, - DefaultCloudTrailClientConfigLayer, - DefaultCloudTrailServiceLayer, - CloudTrailClientInstance, - CloudTrailClientInstanceConfig, - CloudTrailService, - CloudTrailServiceLayer, - SdkError, -} from "../src"; +import { afterEach, describe, expect, it, vi } from "vitest"; +import { CloudTrail, SdkError } from "../src"; +const getRuntimeConfig = vi.spyOn(runtimeConfig, "getRuntimeConfig"); const clientMock = mockClient(CloudTrailClient); describe("CloudTrailClientImpl", () => { + afterEach(() => { + getRuntimeConfig.mockClear(); + }); + it("default", async () => { clientMock.reset().on(ListTrailsCommand).resolves({}); const args = {} as unknown as ListTrailsCommandInput; - const program = CloudTrailService.listTrails(args); + const program = CloudTrail.listTrails(args); const result = await pipe( program, - Effect.provide(DefaultCloudTrailServiceLayer), + Effect.provide(CloudTrail.defaultLayer), Effect.runPromiseExit, ); expect(result).toEqual(Exit.succeed({})); + expect(getRuntimeConfig).toHaveBeenCalledTimes(1); + expect(getRuntimeConfig).toHaveBeenCalledWith({ + logger: expect.any(Object), + }); expect(clientMock).toHaveReceivedCommandTimes(ListTrailsCommand, 1); expect(clientMock).toHaveReceivedCommandWith(ListTrailsCommand, args); }); @@ -46,25 +48,20 @@ describe("CloudTrailClientImpl", () => { const args = {} as unknown as ListTrailsCommandInput; - const program = CloudTrailService.listTrails(args); - - const CloudTrailClientConfigLayer = Layer.succeed( - CloudTrailClientInstanceConfig, - { - region: "eu-central-1", - }, - ); - const CustomCloudTrailServiceLayer = CloudTrailServiceLayer.pipe( - Layer.provide(CloudTrailClientConfigLayer), - ); + const program = CloudTrail.listTrails(args); const result = await pipe( program, - Effect.provide(CustomCloudTrailServiceLayer), + Effect.provide(CloudTrail.layer({ region: "eu-central-1" })), Effect.runPromiseExit, ); expect(result).toEqual(Exit.succeed({})); + expect(getRuntimeConfig).toHaveBeenCalledTimes(1); + expect(getRuntimeConfig).toHaveBeenCalledWith({ + region: "eu-central-1", + logger: expect.any(Object), + }); expect(clientMock).toHaveReceivedCommandTimes(ListTrailsCommand, 1); expect(clientMock).toHaveReceivedCommandWith(ListTrailsCommand, args); }); @@ -74,23 +71,23 @@ describe("CloudTrailClientImpl", () => { const args = {} as unknown as ListTrailsCommandInput; - const program = CloudTrailService.listTrails(args); - - const CloudTrailClientInstanceLayer = Layer.succeed( - CloudTrailClientInstance, - new CloudTrailClient({ region: "eu-central-1" }), - ); - const CustomCloudTrailServiceLayer = BaseCloudTrailServiceLayer.pipe( - Layer.provide(CloudTrailClientInstanceLayer), - ); + const program = CloudTrail.listTrails(args); const result = await pipe( program, - Effect.provide(CustomCloudTrailServiceLayer), + Effect.provide( + CloudTrail.baseLayer( + () => new CloudTrailClient({ region: "eu-central-1" }), + ), + ), Effect.runPromiseExit, ); expect(result).toEqual(Exit.succeed({})); + expect(getRuntimeConfig).toHaveBeenCalledTimes(1); + expect(getRuntimeConfig).toHaveBeenCalledWith({ + region: "eu-central-1", + }); expect(clientMock).toHaveReceivedCommandTimes(ListTrailsCommand, 1); expect(clientMock).toHaveReceivedCommandWith(ListTrailsCommand, args); }); @@ -100,27 +97,25 @@ describe("CloudTrailClientImpl", () => { const args = {} as unknown as ListTrailsCommandInput; - const program = CloudTrailService.listTrails(args); - - const CloudTrailClientInstanceLayer = Layer.effect( - CloudTrailClientInstance, - Effect.map( - CloudTrailClientInstanceConfig, - (config) => new CloudTrailClient({ ...config, region: "eu-central-1" }), - ), - ); - const CustomCloudTrailServiceLayer = BaseCloudTrailServiceLayer.pipe( - Layer.provide(CloudTrailClientInstanceLayer), - Layer.provide(DefaultCloudTrailClientConfigLayer), - ); + const program = CloudTrail.listTrails(args); const result = await pipe( program, - Effect.provide(CustomCloudTrailServiceLayer), + Effect.provide( + CloudTrail.baseLayer( + (config) => + new CloudTrailClient({ ...config, region: "eu-central-1" }), + ), + ), Effect.runPromiseExit, ); expect(result).toEqual(Exit.succeed({})); + expect(getRuntimeConfig).toHaveBeenCalledTimes(1); + expect(getRuntimeConfig).toHaveBeenCalledWith({ + region: "eu-central-1", + logger: expect.any(Object), + }); expect(clientMock).toHaveReceivedCommandTimes(ListTrailsCommand, 1); expect(clientMock).toHaveReceivedCommandWith(ListTrailsCommand, args); }); @@ -130,11 +125,11 @@ describe("CloudTrailClientImpl", () => { const args = {} as unknown as ListTrailsCommandInput; - const program = CloudTrailService.listTrails(args); + const program = CloudTrail.listTrails(args); const result = await pipe( program, - Effect.provide(DefaultCloudTrailServiceLayer), + Effect.provide(CloudTrail.defaultLayer), Effect.runPromiseExit, ); @@ -165,13 +160,13 @@ describe("CloudTrailClientImpl", () => { const args = {} as unknown as ListTrailsCommandInput; - const program = CloudTrailService.listTrails(args).pipe( + const program = CloudTrail.listTrails(args).pipe( Effect.catchTag("NotHandledException" as any, () => Effect.succeed(null)), ); const result = await pipe( program, - Effect.provide(DefaultCloudTrailServiceLayer), + Effect.provide(CloudTrail.defaultLayer), Effect.runPromiseExit, ); diff --git a/packages/client-cloudwatch-events/README.md b/packages/client-cloudwatch-events/README.md index 73cc9f5..c41255c 100644 --- a/packages/client-cloudwatch-events/README.md +++ b/packages/client-cloudwatch-events/README.md @@ -14,13 +14,13 @@ npm install --save @effect-aws/client-cloudwatch-events With default CloudWatchEventsClient instance: ```typescript -import { CloudWatchEventsService, DefaultCloudWatchEventsServiceLayer } from "@effect-aws/client-cloudwatch-events"; +import { CloudWatchEvents } from "@effect-aws/client-cloudwatch-events"; -const program = CloudWatchEventsService.listRules(args); +const program = CloudWatchEvents.listRules(args); const result = pipe( program, - Effect.provide(DefaultCloudWatchEventsServiceLayer), + Effect.provide(CloudWatchEvents.defaultLayer), Effect.runPromise, ); ``` @@ -28,23 +28,15 @@ const result = pipe( With custom CloudWatchEventsClient instance: ```typescript -import { - CloudWatchEventsService, - BaseCloudWatchEventsServiceLayer, - CloudWatchEventsClientInstance, -} from "@effect-aws/client-cloudwatch-events"; +import { CloudWatchEvents } from "@effect-aws/client-cloudwatch-events"; -const program = CloudWatchEventsService.listRules(args); - -const CloudWatchEventsClientInstanceLayer = Layer.succeed( - CloudWatchEventsClientInstance, - new CloudWatchEventsClient({ region: "eu-central-1" }), -); +const program = CloudWatchEvents.listRules(args); const result = await pipe( program, - Effect.provide(BaseCloudWatchEventsServiceLayer), - Effect.provide(CloudWatchEventsClientInstanceLayer), + Effect.provide( + CloudWatchEvents.baseLayer(() => new CloudWatchEventsClient({ region: "eu-central-1" })), + ), Effect.runPromise, ); ``` @@ -52,34 +44,15 @@ const result = await pipe( With custom CloudWatchEventsClient configuration: ```typescript -import { - CloudWatchEventsService, - BaseCloudWatchEventsServiceLayer, - DefaultCloudWatchEventsClientConfigLayer, - CloudWatchEventsClientInstance, - CloudWatchEventsClientInstanceConfig, -} from "@effect-aws/client-cloudwatch-events"; - -const program = CloudWatchEventsService.listRules(args); - -const CloudWatchEventsClientInstanceLayer = Layer.provide( - Layer.effect( - CloudWatchEventsClientInstance, - CloudWatchEventsClientInstanceConfig.pipe( - Effect.map( - (config) => new CloudWatchEventsClient({ ...config, region: "eu-central-1" }), - ), - ), - ), - DefaultCloudWatchEventsClientConfigLayer, -); +import { CloudWatchEvents } from "@effect-aws/client-cloudwatch-events"; + +const program = CloudWatchEvents.listRules(args); const result = await pipe( program, - Effect.provide(BaseCloudWatchEventsServiceLayer), - Effect.provide(CloudWatchEventsClientInstanceLayer), + Effect.provide(CloudWatchEvents.layer({ region: "eu-central-1" })), Effect.runPromiseExit, ); ``` -or map over `DefaultCloudWatchEventsClientConfigLayer` layer context and update the configuration... +or use `CloudWatchEvents.baseLayer((default) => new CloudWatchEventsClient({ ...default, region: "eu-central-1" }))` diff --git a/packages/client-cloudwatch-events/src/CloudWatchEventsService.ts b/packages/client-cloudwatch-events/src/CloudWatchEventsService.ts index 509ce2b..6318de8 100644 --- a/packages/client-cloudwatch-events/src/CloudWatchEventsService.ts +++ b/packages/client-cloudwatch-events/src/CloudWatchEventsService.ts @@ -3,6 +3,8 @@ */ import { CloudWatchEventsServiceException, + type CloudWatchEventsClient, + type CloudWatchEventsClientConfig, ActivateEventSourceCommand, type ActivateEventSourceCommandInput, type ActivateEventSourceCommandOutput, @@ -162,7 +164,11 @@ import { CloudWatchEventsClientInstance, CloudWatchEventsClientInstanceLayer, } from "./CloudWatchEventsClientInstance"; -import { DefaultCloudWatchEventsClientConfigLayer } from "./CloudWatchEventsClientInstanceConfig"; +import { + DefaultCloudWatchEventsClientConfigLayer, + makeDefaultCloudWatchEventsClientInstanceConfig, + CloudWatchEventsClientInstanceConfig, +} from "./CloudWatchEventsClientInstanceConfig"; import { AllServiceErrors, ConcurrentModificationError, @@ -181,7 +187,7 @@ import { } from "./Errors"; /** - * @since 1.0.1 + * @since 1.0.0 */ export interface HttpHandlerOptions { /** @@ -911,14 +917,6 @@ interface CloudWatchEventsService$ { >; } -/** - * @since 1.0.0 - * @category models - */ -export class CloudWatchEventsService extends Effect.Tag( - "@effect-aws/client-cloudwatch-events/CloudWatchEventsService", -)() {} - /** * @since 1.0.0 * @category constructors @@ -969,9 +967,58 @@ export const makeCloudWatchEventsService = Effect.gen(function* (_) { }, {}) as CloudWatchEventsService$; }); +/** + * @since 1.0.0 + * @category models + */ +export class CloudWatchEventsService extends Effect.Tag( + "@effect-aws/client-cloudwatch-events/CloudWatchEventsService", +)() { + static readonly defaultLayer = Layer.effect( + this, + makeCloudWatchEventsService, + ).pipe( + Layer.provide(CloudWatchEventsClientInstanceLayer), + Layer.provide(DefaultCloudWatchEventsClientConfigLayer), + ); + static readonly layer = (config: CloudWatchEventsClientConfig) => + Layer.effect(this, makeCloudWatchEventsService).pipe( + Layer.provide(CloudWatchEventsClientInstanceLayer), + Layer.provide( + Layer.effect( + CloudWatchEventsClientInstanceConfig, + makeDefaultCloudWatchEventsClientInstanceConfig.pipe( + Effect.map((defaultConfig) => ({ ...defaultConfig, ...config })), + ), + ), + ), + ); + static readonly baseLayer = ( + evaluate: ( + defaultConfig: CloudWatchEventsClientConfig, + ) => CloudWatchEventsClient, + ) => + Layer.effect(this, makeCloudWatchEventsService).pipe( + Layer.provide( + Layer.effect( + CloudWatchEventsClientInstance, + Effect.map(makeDefaultCloudWatchEventsClientInstanceConfig, evaluate), + ), + ), + ); +} + +/** + * @since 1.0.0 + * @category models + * @alias CloudWatchEventsService + */ +export const CloudWatchEvents = CloudWatchEventsService; + /** * @since 1.0.0 * @category layers + * @deprecated use CloudWatchEvents.baseLayer instead */ export const BaseCloudWatchEventsServiceLayer = Layer.effect( CloudWatchEventsService, @@ -981,6 +1028,7 @@ export const BaseCloudWatchEventsServiceLayer = Layer.effect( /** * @since 1.0.0 * @category layers + * @deprecated use CloudWatchEvents.layer instead */ export const CloudWatchEventsServiceLayer = BaseCloudWatchEventsServiceLayer.pipe( @@ -990,8 +1038,7 @@ export const CloudWatchEventsServiceLayer = /** * @since 1.0.0 * @category layers + * @deprecated use CloudWatchEvents.defaultLayer instead */ export const DefaultCloudWatchEventsServiceLayer = - CloudWatchEventsServiceLayer.pipe( - Layer.provide(DefaultCloudWatchEventsClientConfigLayer), - ); + CloudWatchEventsService.defaultLayer; diff --git a/packages/client-cloudwatch-events/test/CloudWatchEvents.test.ts b/packages/client-cloudwatch-events/test/CloudWatchEvents.test.ts index 8d5c33c..4c2e522 100644 --- a/packages/client-cloudwatch-events/test/CloudWatchEvents.test.ts +++ b/packages/client-cloudwatch-events/test/CloudWatchEvents.test.ts @@ -4,39 +4,41 @@ import { CloudWatchEventsClient, CloudWatchEventsServiceException, } from "@aws-sdk/client-cloudwatch-events"; +// @ts-ignore +import * as runtimeConfig from "@aws-sdk/client-cloudwatch-events/dist-cjs/runtimeConfig"; import { mockClient } from "aws-sdk-client-mock"; import * as Effect from "effect/Effect"; import * as Exit from "effect/Exit"; import { pipe } from "effect/Function"; -import * as Layer from "effect/Layer"; -import { - BaseCloudWatchEventsServiceLayer, - DefaultCloudWatchEventsClientConfigLayer, - DefaultCloudWatchEventsServiceLayer, - CloudWatchEventsClientInstance, - CloudWatchEventsClientInstanceConfig, - CloudWatchEventsService, - CloudWatchEventsServiceLayer, - SdkError, -} from "../src"; +import { afterEach, describe, expect, it, vi } from "vitest"; +import { CloudWatchEvents, SdkError } from "../src"; +const getRuntimeConfig = vi.spyOn(runtimeConfig, "getRuntimeConfig"); const clientMock = mockClient(CloudWatchEventsClient); describe("CloudWatchEventsClientImpl", () => { + afterEach(() => { + getRuntimeConfig.mockClear(); + }); + it("default", async () => { clientMock.reset().on(ListRulesCommand).resolves({}); const args = {} as unknown as ListRulesCommandInput; - const program = CloudWatchEventsService.listRules(args); + const program = CloudWatchEvents.listRules(args); const result = await pipe( program, - Effect.provide(DefaultCloudWatchEventsServiceLayer), + Effect.provide(CloudWatchEvents.defaultLayer), Effect.runPromiseExit, ); expect(result).toEqual(Exit.succeed({})); + expect(getRuntimeConfig).toHaveBeenCalledTimes(1); + expect(getRuntimeConfig).toHaveBeenCalledWith({ + logger: expect.any(Object), + }); expect(clientMock).toHaveReceivedCommandTimes(ListRulesCommand, 1); expect(clientMock).toHaveReceivedCommandWith(ListRulesCommand, args); }); @@ -46,26 +48,20 @@ describe("CloudWatchEventsClientImpl", () => { const args = {} as unknown as ListRulesCommandInput; - const program = CloudWatchEventsService.listRules(args); - - const CloudWatchEventsClientConfigLayer = Layer.succeed( - CloudWatchEventsClientInstanceConfig, - { - region: "eu-central-1", - }, - ); - const CustomCloudWatchEventsServiceLayer = - CloudWatchEventsServiceLayer.pipe( - Layer.provide(CloudWatchEventsClientConfigLayer), - ); + const program = CloudWatchEvents.listRules(args); const result = await pipe( program, - Effect.provide(CustomCloudWatchEventsServiceLayer), + Effect.provide(CloudWatchEvents.layer({ region: "eu-central-1" })), Effect.runPromiseExit, ); expect(result).toEqual(Exit.succeed({})); + expect(getRuntimeConfig).toHaveBeenCalledTimes(1); + expect(getRuntimeConfig).toHaveBeenCalledWith({ + region: "eu-central-1", + logger: expect.any(Object), + }); expect(clientMock).toHaveReceivedCommandTimes(ListRulesCommand, 1); expect(clientMock).toHaveReceivedCommandWith(ListRulesCommand, args); }); @@ -75,24 +71,23 @@ describe("CloudWatchEventsClientImpl", () => { const args = {} as unknown as ListRulesCommandInput; - const program = CloudWatchEventsService.listRules(args); - - const CloudWatchEventsClientInstanceLayer = Layer.succeed( - CloudWatchEventsClientInstance, - new CloudWatchEventsClient({ region: "eu-central-1" }), - ); - const CustomCloudWatchEventsServiceLayer = - BaseCloudWatchEventsServiceLayer.pipe( - Layer.provide(CloudWatchEventsClientInstanceLayer), - ); + const program = CloudWatchEvents.listRules(args); const result = await pipe( program, - Effect.provide(CustomCloudWatchEventsServiceLayer), + Effect.provide( + CloudWatchEvents.baseLayer( + () => new CloudWatchEventsClient({ region: "eu-central-1" }), + ), + ), Effect.runPromiseExit, ); expect(result).toEqual(Exit.succeed({})); + expect(getRuntimeConfig).toHaveBeenCalledTimes(1); + expect(getRuntimeConfig).toHaveBeenCalledWith({ + region: "eu-central-1", + }); expect(clientMock).toHaveReceivedCommandTimes(ListRulesCommand, 1); expect(clientMock).toHaveReceivedCommandWith(ListRulesCommand, args); }); @@ -102,29 +97,25 @@ describe("CloudWatchEventsClientImpl", () => { const args = {} as unknown as ListRulesCommandInput; - const program = CloudWatchEventsService.listRules(args); - - const CloudWatchEventsClientInstanceLayer = Layer.effect( - CloudWatchEventsClientInstance, - Effect.map( - CloudWatchEventsClientInstanceConfig, - (config) => - new CloudWatchEventsClient({ ...config, region: "eu-central-1" }), - ), - ); - const CustomCloudWatchEventsServiceLayer = - BaseCloudWatchEventsServiceLayer.pipe( - Layer.provide(CloudWatchEventsClientInstanceLayer), - Layer.provide(DefaultCloudWatchEventsClientConfigLayer), - ); + const program = CloudWatchEvents.listRules(args); const result = await pipe( program, - Effect.provide(CustomCloudWatchEventsServiceLayer), + Effect.provide( + CloudWatchEvents.baseLayer( + (config) => + new CloudWatchEventsClient({ ...config, region: "eu-central-1" }), + ), + ), Effect.runPromiseExit, ); expect(result).toEqual(Exit.succeed({})); + expect(getRuntimeConfig).toHaveBeenCalledTimes(1); + expect(getRuntimeConfig).toHaveBeenCalledWith({ + region: "eu-central-1", + logger: expect.any(Object), + }); expect(clientMock).toHaveReceivedCommandTimes(ListRulesCommand, 1); expect(clientMock).toHaveReceivedCommandWith(ListRulesCommand, args); }); @@ -134,11 +125,11 @@ describe("CloudWatchEventsClientImpl", () => { const args = {} as unknown as ListRulesCommandInput; - const program = CloudWatchEventsService.listRules(args); + const program = CloudWatchEvents.listRules(args); const result = await pipe( program, - Effect.provide(DefaultCloudWatchEventsServiceLayer), + Effect.provide(CloudWatchEvents.defaultLayer), Effect.runPromiseExit, ); @@ -169,13 +160,13 @@ describe("CloudWatchEventsClientImpl", () => { const args = {} as unknown as ListRulesCommandInput; - const program = CloudWatchEventsService.listRules(args).pipe( + const program = CloudWatchEvents.listRules(args).pipe( Effect.catchTag("NotHandledException" as any, () => Effect.succeed(null)), ); const result = await pipe( program, - Effect.provide(DefaultCloudWatchEventsServiceLayer), + Effect.provide(CloudWatchEvents.defaultLayer), Effect.runPromiseExit, ); diff --git a/packages/client-cloudwatch-logs/README.md b/packages/client-cloudwatch-logs/README.md index b315628..b247488 100644 --- a/packages/client-cloudwatch-logs/README.md +++ b/packages/client-cloudwatch-logs/README.md @@ -14,13 +14,13 @@ npm install --save @effect-aws/client-cloudwatch-logs With default CloudWatchLogsClient instance: ```typescript -import { CloudWatchLogsService, DefaultCloudWatchLogsServiceLayer } from "@effect-aws/client-cloudwatch-logs"; +import { CloudWatchLogs } from "@effect-aws/client-cloudwatch-logs"; -const program = CloudWatchLogsService.describeLogGroups(args); +const program = CloudWatchLogs.describeLogGroups(args); const result = pipe( program, - Effect.provide(DefaultCloudWatchLogsServiceLayer), + Effect.provide(CloudWatchLogs.defaultLayer), Effect.runPromise, ); ``` @@ -28,23 +28,15 @@ const result = pipe( With custom CloudWatchLogsClient instance: ```typescript -import { - CloudWatchLogsService, - BaseCloudWatchLogsServiceLayer, - CloudWatchLogsClientInstance, -} from "@effect-aws/client-cloudwatch-logs"; +import { CloudWatchLogs } from "@effect-aws/client-cloudwatch-logs"; -const program = CloudWatchLogsService.describeLogGroups(args); - -const CloudWatchLogsClientInstanceLayer = Layer.succeed( - CloudWatchLogsClientInstance, - new CloudWatchLogsClient({ region: "eu-central-1" }), -); +const program = CloudWatchLogs.describeLogGroups(args); const result = await pipe( program, - Effect.provide(BaseCloudWatchLogsServiceLayer), - Effect.provide(CloudWatchLogsClientInstanceLayer), + Effect.provide( + CloudWatchLogs.baseLayer(() => new CloudWatchLogsClient({ region: "eu-central-1" })), + ), Effect.runPromise, ); ``` @@ -52,34 +44,15 @@ const result = await pipe( With custom CloudWatchLogsClient configuration: ```typescript -import { - CloudWatchLogsService, - BaseCloudWatchLogsServiceLayer, - DefaultCloudWatchLogsClientConfigLayer, - CloudWatchLogsClientInstance, - CloudWatchLogsClientInstanceConfig, -} from "@effect-aws/client-cloudwatch-logs"; - -const program = CloudWatchLogsService.describeLogGroups(args); - -const CloudWatchLogsClientInstanceLayer = Layer.provide( - Layer.effect( - CloudWatchLogsClientInstance, - CloudWatchLogsClientInstanceConfig.pipe( - Effect.map( - (config) => new CloudWatchLogsClient({ ...config, region: "eu-central-1" }), - ), - ), - ), - DefaultCloudWatchLogsClientConfigLayer, -); +import { CloudWatchLogs } from "@effect-aws/client-cloudwatch-logs"; + +const program = CloudWatchLogs.describeLogGroups(args); const result = await pipe( program, - Effect.provide(BaseCloudWatchLogsServiceLayer), - Effect.provide(CloudWatchLogsClientInstanceLayer), + Effect.provide(CloudWatchLogs.layer({ region: "eu-central-1" })), Effect.runPromiseExit, ); ``` -or map over `DefaultCloudWatchLogsClientConfigLayer` layer context and update the configuration... +or use `CloudWatchLogs.baseLayer((default) => new CloudWatchLogsClient({ ...default, region: "eu-central-1" }))` diff --git a/packages/client-cloudwatch-logs/src/CloudWatchLogsService.ts b/packages/client-cloudwatch-logs/src/CloudWatchLogsService.ts index 77bda73..40ba5ba 100644 --- a/packages/client-cloudwatch-logs/src/CloudWatchLogsService.ts +++ b/packages/client-cloudwatch-logs/src/CloudWatchLogsService.ts @@ -3,6 +3,8 @@ */ import { CloudWatchLogsServiceException, + type CloudWatchLogsClient, + type CloudWatchLogsClientConfig, AssociateKmsKeyCommand, type AssociateKmsKeyCommandInput, type AssociateKmsKeyCommandOutput, @@ -237,7 +239,11 @@ import { CloudWatchLogsClientInstance, CloudWatchLogsClientInstanceLayer, } from "./CloudWatchLogsClientInstance"; -import { DefaultCloudWatchLogsClientConfigLayer } from "./CloudWatchLogsClientInstanceConfig"; +import { + DefaultCloudWatchLogsClientConfigLayer, + makeDefaultCloudWatchLogsClientInstanceConfig, + CloudWatchLogsClientInstanceConfig, +} from "./CloudWatchLogsClientInstanceConfig"; import { AllServiceErrors, AccessDeniedError, @@ -262,7 +268,7 @@ import { } from "./Errors"; /** - * @since 1.0.1 + * @since 1.0.0 */ export interface HttpHandlerOptions { /** @@ -1469,14 +1475,6 @@ interface CloudWatchLogsService$ { >; } -/** - * @since 1.0.0 - * @category models - */ -export class CloudWatchLogsService extends Effect.Tag( - "@effect-aws/client-cloudwatch-logs/CloudWatchLogsService", -)() {} - /** * @since 1.0.0 * @category constructors @@ -1527,9 +1525,58 @@ export const makeCloudWatchLogsService = Effect.gen(function* (_) { }, {}) as CloudWatchLogsService$; }); +/** + * @since 1.0.0 + * @category models + */ +export class CloudWatchLogsService extends Effect.Tag( + "@effect-aws/client-cloudwatch-logs/CloudWatchLogsService", +)() { + static readonly defaultLayer = Layer.effect( + this, + makeCloudWatchLogsService, + ).pipe( + Layer.provide(CloudWatchLogsClientInstanceLayer), + Layer.provide(DefaultCloudWatchLogsClientConfigLayer), + ); + static readonly layer = (config: CloudWatchLogsClientConfig) => + Layer.effect(this, makeCloudWatchLogsService).pipe( + Layer.provide(CloudWatchLogsClientInstanceLayer), + Layer.provide( + Layer.effect( + CloudWatchLogsClientInstanceConfig, + makeDefaultCloudWatchLogsClientInstanceConfig.pipe( + Effect.map((defaultConfig) => ({ ...defaultConfig, ...config })), + ), + ), + ), + ); + static readonly baseLayer = ( + evaluate: ( + defaultConfig: CloudWatchLogsClientConfig, + ) => CloudWatchLogsClient, + ) => + Layer.effect(this, makeCloudWatchLogsService).pipe( + Layer.provide( + Layer.effect( + CloudWatchLogsClientInstance, + Effect.map(makeDefaultCloudWatchLogsClientInstanceConfig, evaluate), + ), + ), + ); +} + +/** + * @since 1.0.0 + * @category models + * @alias CloudWatchLogsService + */ +export const CloudWatchLogs = CloudWatchLogsService; + /** * @since 1.0.0 * @category layers + * @deprecated use CloudWatchLogs.baseLayer instead */ export const BaseCloudWatchLogsServiceLayer = Layer.effect( CloudWatchLogsService, @@ -1539,6 +1586,7 @@ export const BaseCloudWatchLogsServiceLayer = Layer.effect( /** * @since 1.0.0 * @category layers + * @deprecated use CloudWatchLogs.layer instead */ export const CloudWatchLogsServiceLayer = BaseCloudWatchLogsServiceLayer.pipe( Layer.provide(CloudWatchLogsClientInstanceLayer), @@ -1547,8 +1595,7 @@ export const CloudWatchLogsServiceLayer = BaseCloudWatchLogsServiceLayer.pipe( /** * @since 1.0.0 * @category layers + * @deprecated use CloudWatchLogs.defaultLayer instead */ export const DefaultCloudWatchLogsServiceLayer = - CloudWatchLogsServiceLayer.pipe( - Layer.provide(DefaultCloudWatchLogsClientConfigLayer), - ); + CloudWatchLogsService.defaultLayer; diff --git a/packages/client-cloudwatch-logs/test/CloudWatchLogs.test.ts b/packages/client-cloudwatch-logs/test/CloudWatchLogs.test.ts index 75fa7db..8ef8ccc 100644 --- a/packages/client-cloudwatch-logs/test/CloudWatchLogs.test.ts +++ b/packages/client-cloudwatch-logs/test/CloudWatchLogs.test.ts @@ -4,39 +4,41 @@ import { CloudWatchLogsClient, CloudWatchLogsServiceException, } from "@aws-sdk/client-cloudwatch-logs"; +// @ts-ignore +import * as runtimeConfig from "@aws-sdk/client-cloudwatch-logs/dist-cjs/runtimeConfig"; import { mockClient } from "aws-sdk-client-mock"; import * as Effect from "effect/Effect"; import * as Exit from "effect/Exit"; import { pipe } from "effect/Function"; -import * as Layer from "effect/Layer"; -import { - BaseCloudWatchLogsServiceLayer, - DefaultCloudWatchLogsClientConfigLayer, - DefaultCloudWatchLogsServiceLayer, - CloudWatchLogsClientInstance, - CloudWatchLogsClientInstanceConfig, - CloudWatchLogsService, - CloudWatchLogsServiceLayer, - SdkError, -} from "../src"; +import { afterEach, describe, expect, it, vi } from "vitest"; +import { CloudWatchLogs, SdkError } from "../src"; +const getRuntimeConfig = vi.spyOn(runtimeConfig, "getRuntimeConfig"); const clientMock = mockClient(CloudWatchLogsClient); describe("CloudWatchLogsClientImpl", () => { + afterEach(() => { + getRuntimeConfig.mockClear(); + }); + it("default", async () => { clientMock.reset().on(DescribeLogGroupsCommand).resolves({}); const args = {} as unknown as DescribeLogGroupsCommandInput; - const program = CloudWatchLogsService.describeLogGroups(args); + const program = CloudWatchLogs.describeLogGroups(args); const result = await pipe( program, - Effect.provide(DefaultCloudWatchLogsServiceLayer), + Effect.provide(CloudWatchLogs.defaultLayer), Effect.runPromiseExit, ); expect(result).toEqual(Exit.succeed({})); + expect(getRuntimeConfig).toHaveBeenCalledTimes(1); + expect(getRuntimeConfig).toHaveBeenCalledWith({ + logger: expect.any(Object), + }); expect(clientMock).toHaveReceivedCommandTimes(DescribeLogGroupsCommand, 1); expect(clientMock).toHaveReceivedCommandWith( DescribeLogGroupsCommand, @@ -49,25 +51,20 @@ describe("CloudWatchLogsClientImpl", () => { const args = {} as unknown as DescribeLogGroupsCommandInput; - const program = CloudWatchLogsService.describeLogGroups(args); - - const CloudWatchLogsClientConfigLayer = Layer.succeed( - CloudWatchLogsClientInstanceConfig, - { - region: "eu-central-1", - }, - ); - const CustomCloudWatchLogsServiceLayer = CloudWatchLogsServiceLayer.pipe( - Layer.provide(CloudWatchLogsClientConfigLayer), - ); + const program = CloudWatchLogs.describeLogGroups(args); const result = await pipe( program, - Effect.provide(CustomCloudWatchLogsServiceLayer), + Effect.provide(CloudWatchLogs.layer({ region: "eu-central-1" })), Effect.runPromiseExit, ); expect(result).toEqual(Exit.succeed({})); + expect(getRuntimeConfig).toHaveBeenCalledTimes(1); + expect(getRuntimeConfig).toHaveBeenCalledWith({ + region: "eu-central-1", + logger: expect.any(Object), + }); expect(clientMock).toHaveReceivedCommandTimes(DescribeLogGroupsCommand, 1); expect(clientMock).toHaveReceivedCommandWith( DescribeLogGroupsCommand, @@ -80,24 +77,23 @@ describe("CloudWatchLogsClientImpl", () => { const args = {} as unknown as DescribeLogGroupsCommandInput; - const program = CloudWatchLogsService.describeLogGroups(args); - - const CloudWatchLogsClientInstanceLayer = Layer.succeed( - CloudWatchLogsClientInstance, - new CloudWatchLogsClient({ region: "eu-central-1" }), - ); - const CustomCloudWatchLogsServiceLayer = - BaseCloudWatchLogsServiceLayer.pipe( - Layer.provide(CloudWatchLogsClientInstanceLayer), - ); + const program = CloudWatchLogs.describeLogGroups(args); const result = await pipe( program, - Effect.provide(CustomCloudWatchLogsServiceLayer), + Effect.provide( + CloudWatchLogs.baseLayer( + () => new CloudWatchLogsClient({ region: "eu-central-1" }), + ), + ), Effect.runPromiseExit, ); expect(result).toEqual(Exit.succeed({})); + expect(getRuntimeConfig).toHaveBeenCalledTimes(1); + expect(getRuntimeConfig).toHaveBeenCalledWith({ + region: "eu-central-1", + }); expect(clientMock).toHaveReceivedCommandTimes(DescribeLogGroupsCommand, 1); expect(clientMock).toHaveReceivedCommandWith( DescribeLogGroupsCommand, @@ -110,29 +106,25 @@ describe("CloudWatchLogsClientImpl", () => { const args = {} as unknown as DescribeLogGroupsCommandInput; - const program = CloudWatchLogsService.describeLogGroups(args); - - const CloudWatchLogsClientInstanceLayer = Layer.effect( - CloudWatchLogsClientInstance, - Effect.map( - CloudWatchLogsClientInstanceConfig, - (config) => - new CloudWatchLogsClient({ ...config, region: "eu-central-1" }), - ), - ); - const CustomCloudWatchLogsServiceLayer = - BaseCloudWatchLogsServiceLayer.pipe( - Layer.provide(CloudWatchLogsClientInstanceLayer), - Layer.provide(DefaultCloudWatchLogsClientConfigLayer), - ); + const program = CloudWatchLogs.describeLogGroups(args); const result = await pipe( program, - Effect.provide(CustomCloudWatchLogsServiceLayer), + Effect.provide( + CloudWatchLogs.baseLayer( + (config) => + new CloudWatchLogsClient({ ...config, region: "eu-central-1" }), + ), + ), Effect.runPromiseExit, ); expect(result).toEqual(Exit.succeed({})); + expect(getRuntimeConfig).toHaveBeenCalledTimes(1); + expect(getRuntimeConfig).toHaveBeenCalledWith({ + region: "eu-central-1", + logger: expect.any(Object), + }); expect(clientMock).toHaveReceivedCommandTimes(DescribeLogGroupsCommand, 1); expect(clientMock).toHaveReceivedCommandWith( DescribeLogGroupsCommand, @@ -145,11 +137,11 @@ describe("CloudWatchLogsClientImpl", () => { const args = {} as unknown as DescribeLogGroupsCommandInput; - const program = CloudWatchLogsService.describeLogGroups(args); + const program = CloudWatchLogs.describeLogGroups(args); const result = await pipe( program, - Effect.provide(DefaultCloudWatchLogsServiceLayer), + Effect.provide(CloudWatchLogs.defaultLayer), Effect.runPromiseExit, ); @@ -183,13 +175,13 @@ describe("CloudWatchLogsClientImpl", () => { const args = {} as unknown as DescribeLogGroupsCommandInput; - const program = CloudWatchLogsService.describeLogGroups(args).pipe( + const program = CloudWatchLogs.describeLogGroups(args).pipe( Effect.catchTag("NotHandledException" as any, () => Effect.succeed(null)), ); const result = await pipe( program, - Effect.provide(DefaultCloudWatchLogsServiceLayer), + Effect.provide(CloudWatchLogs.defaultLayer), Effect.runPromiseExit, ); diff --git a/packages/client-cloudwatch/README.md b/packages/client-cloudwatch/README.md index fb254f0..1e17542 100644 --- a/packages/client-cloudwatch/README.md +++ b/packages/client-cloudwatch/README.md @@ -14,13 +14,13 @@ npm install --save @effect-aws/client-cloudwatch With default CloudWatchClient instance: ```typescript -import { CloudWatchService, DefaultCloudWatchServiceLayer } from "@effect-aws/client-cloudwatch"; +import { CloudWatch } from "@effect-aws/client-cloudwatch"; -const program = CloudWatchService.describeAlarms(args); +const program = CloudWatch.describeAlarms(args); const result = pipe( program, - Effect.provide(DefaultCloudWatchServiceLayer), + Effect.provide(CloudWatch.defaultLayer), Effect.runPromise, ); ``` @@ -28,23 +28,15 @@ const result = pipe( With custom CloudWatchClient instance: ```typescript -import { - CloudWatchService, - BaseCloudWatchServiceLayer, - CloudWatchClientInstance, -} from "@effect-aws/client-cloudwatch"; +import { CloudWatch } from "@effect-aws/client-cloudwatch"; -const program = CloudWatchService.describeAlarms(args); - -const CloudWatchClientInstanceLayer = Layer.succeed( - CloudWatchClientInstance, - new CloudWatchClient({ region: "eu-central-1" }), -); +const program = CloudWatch.describeAlarms(args); const result = await pipe( program, - Effect.provide(BaseCloudWatchServiceLayer), - Effect.provide(CloudWatchClientInstanceLayer), + Effect.provide( + CloudWatch.baseLayer(() => new CloudWatchClient({ region: "eu-central-1" })), + ), Effect.runPromise, ); ``` @@ -52,34 +44,15 @@ const result = await pipe( With custom CloudWatchClient configuration: ```typescript -import { - CloudWatchService, - BaseCloudWatchServiceLayer, - DefaultCloudWatchClientConfigLayer, - CloudWatchClientInstance, - CloudWatchClientInstanceConfig, -} from "@effect-aws/client-cloudwatch"; - -const program = CloudWatchService.describeAlarms(args); - -const CloudWatchClientInstanceLayer = Layer.provide( - Layer.effect( - CloudWatchClientInstance, - CloudWatchClientInstanceConfig.pipe( - Effect.map( - (config) => new CloudWatchClient({ ...config, region: "eu-central-1" }), - ), - ), - ), - DefaultCloudWatchClientConfigLayer, -); +import { CloudWatch } from "@effect-aws/client-cloudwatch"; + +const program = CloudWatch.describeAlarms(args); const result = await pipe( program, - Effect.provide(BaseCloudWatchServiceLayer), - Effect.provide(CloudWatchClientInstanceLayer), + Effect.provide(CloudWatch.layer({ region: "eu-central-1" })), Effect.runPromiseExit, ); ``` -or map over `DefaultCloudWatchClientConfigLayer` layer context and update the configuration... +or use `CloudWatch.baseLayer((default) => new CloudWatchClient({ ...default, region: "eu-central-1" }))` diff --git a/packages/client-cloudwatch/src/CloudWatchService.ts b/packages/client-cloudwatch/src/CloudWatchService.ts index 08c4141..f064246 100644 --- a/packages/client-cloudwatch/src/CloudWatchService.ts +++ b/packages/client-cloudwatch/src/CloudWatchService.ts @@ -2,6 +2,8 @@ * @since 1.0.0 */ import { + type CloudWatchClient, + type CloudWatchClientConfig, CloudWatchServiceException, DeleteAlarmsCommand, type DeleteAlarmsCommandInput, @@ -123,7 +125,11 @@ import { CloudWatchClientInstance, CloudWatchClientInstanceLayer, } from "./CloudWatchClientInstance"; -import { DefaultCloudWatchClientConfigLayer } from "./CloudWatchClientInstanceConfig"; +import { + CloudWatchClientInstanceConfig, + DefaultCloudWatchClientConfigLayer, + makeDefaultCloudWatchClientInstanceConfig, +} from "./CloudWatchClientInstanceConfig"; import { AllServiceErrors, ConcurrentModificationError, @@ -144,7 +150,7 @@ import { } from "./Errors"; /** - * @since 1.0.1 + * @since 1.0.0 */ export interface HttpHandlerOptions { /** @@ -676,14 +682,6 @@ interface CloudWatchService$ { >; } -/** - * @since 1.0.0 - * @category models - */ -export class CloudWatchService extends Effect.Tag( - "@effect-aws/client-cloudwatch/CloudWatchService", -)() {} - /** * @since 1.0.0 * @category constructors @@ -734,9 +732,53 @@ export const makeCloudWatchService = Effect.gen(function* (_) { }, {}) as CloudWatchService$; }); +/** + * @since 1.0.0 + * @category models + */ +export class CloudWatchService extends Effect.Tag( + "@effect-aws/client-cloudwatch/CloudWatchService", +)() { + static readonly defaultLayer = Layer.effect(this, makeCloudWatchService).pipe( + Layer.provide(CloudWatchClientInstanceLayer), + Layer.provide(DefaultCloudWatchClientConfigLayer), + ); + static readonly layer = (config: CloudWatchClientConfig) => + Layer.effect(this, makeCloudWatchService).pipe( + Layer.provide(CloudWatchClientInstanceLayer), + Layer.provide( + Layer.effect( + CloudWatchClientInstanceConfig, + makeDefaultCloudWatchClientInstanceConfig.pipe( + Effect.map((defaultConfig) => ({ ...defaultConfig, ...config })), + ), + ), + ), + ); + static readonly baseLayer = ( + evaluate: (defaultConfig: CloudWatchClientConfig) => CloudWatchClient, + ) => + Layer.effect(this, makeCloudWatchService).pipe( + Layer.provide( + Layer.effect( + CloudWatchClientInstance, + Effect.map(makeDefaultCloudWatchClientInstanceConfig, evaluate), + ), + ), + ); +} + +/** + * @since 1.0.0 + * @category models + * @alias CloudWatchService + */ +export const CloudWatch = CloudWatchService; + /** * @since 1.0.0 * @category layers + * @deprecated use CloudWatch.baseLayer instead */ export const BaseCloudWatchServiceLayer = Layer.effect( CloudWatchService, @@ -746,6 +788,7 @@ export const BaseCloudWatchServiceLayer = Layer.effect( /** * @since 1.0.0 * @category layers + * @deprecated use CloudWatch.layer instead */ export const CloudWatchServiceLayer = BaseCloudWatchServiceLayer.pipe( Layer.provide(CloudWatchClientInstanceLayer), @@ -754,7 +797,6 @@ export const CloudWatchServiceLayer = BaseCloudWatchServiceLayer.pipe( /** * @since 1.0.0 * @category layers + * @deprecated use CloudWatch.defaultLayer instead */ -export const DefaultCloudWatchServiceLayer = CloudWatchServiceLayer.pipe( - Layer.provide(DefaultCloudWatchClientConfigLayer), -); +export const DefaultCloudWatchServiceLayer = CloudWatchService.defaultLayer; diff --git a/packages/client-cloudwatch/test/CloudWatch.test.ts b/packages/client-cloudwatch/test/CloudWatch.test.ts index ada3bf6..4cb15f3 100644 --- a/packages/client-cloudwatch/test/CloudWatch.test.ts +++ b/packages/client-cloudwatch/test/CloudWatch.test.ts @@ -4,39 +4,41 @@ import { CloudWatchClient, CloudWatchServiceException, } from "@aws-sdk/client-cloudwatch"; +// @ts-ignore +import * as runtimeConfig from "@aws-sdk/client-cloudwatch/dist-cjs/runtimeConfig"; import { mockClient } from "aws-sdk-client-mock"; import * as Effect from "effect/Effect"; import * as Exit from "effect/Exit"; import { pipe } from "effect/Function"; -import * as Layer from "effect/Layer"; -import { - BaseCloudWatchServiceLayer, - DefaultCloudWatchClientConfigLayer, - DefaultCloudWatchServiceLayer, - CloudWatchClientInstance, - CloudWatchClientInstanceConfig, - CloudWatchService, - CloudWatchServiceLayer, - SdkError, -} from "../src"; +import { afterEach, describe, expect, it, vi } from "vitest"; +import { CloudWatch, SdkError } from "../src"; +const getRuntimeConfig = vi.spyOn(runtimeConfig, "getRuntimeConfig"); const clientMock = mockClient(CloudWatchClient); describe("CloudWatchClientImpl", () => { + afterEach(() => { + getRuntimeConfig.mockClear(); + }); + it("default", async () => { clientMock.reset().on(DescribeAlarmsCommand).resolves({}); const args = {} as unknown as DescribeAlarmsCommandInput; - const program = CloudWatchService.describeAlarms(args); + const program = CloudWatch.describeAlarms(args); const result = await pipe( program, - Effect.provide(DefaultCloudWatchServiceLayer), + Effect.provide(CloudWatch.defaultLayer), Effect.runPromiseExit, ); expect(result).toEqual(Exit.succeed({})); + expect(getRuntimeConfig).toHaveBeenCalledTimes(1); + expect(getRuntimeConfig).toHaveBeenCalledWith({ + logger: expect.any(Object), + }); expect(clientMock).toHaveReceivedCommandTimes(DescribeAlarmsCommand, 1); expect(clientMock).toHaveReceivedCommandWith(DescribeAlarmsCommand, args); }); @@ -46,25 +48,20 @@ describe("CloudWatchClientImpl", () => { const args = {} as unknown as DescribeAlarmsCommandInput; - const program = CloudWatchService.describeAlarms(args); - - const CloudWatchClientConfigLayer = Layer.succeed( - CloudWatchClientInstanceConfig, - { - region: "eu-central-1", - }, - ); - const CustomCloudWatchServiceLayer = CloudWatchServiceLayer.pipe( - Layer.provide(CloudWatchClientConfigLayer), - ); + const program = CloudWatch.describeAlarms(args); const result = await pipe( program, - Effect.provide(CustomCloudWatchServiceLayer), + Effect.provide(CloudWatch.layer({ region: "eu-central-1" })), Effect.runPromiseExit, ); expect(result).toEqual(Exit.succeed({})); + expect(getRuntimeConfig).toHaveBeenCalledTimes(1); + expect(getRuntimeConfig).toHaveBeenCalledWith({ + region: "eu-central-1", + logger: expect.any(Object), + }); expect(clientMock).toHaveReceivedCommandTimes(DescribeAlarmsCommand, 1); expect(clientMock).toHaveReceivedCommandWith(DescribeAlarmsCommand, args); }); @@ -74,23 +71,23 @@ describe("CloudWatchClientImpl", () => { const args = {} as unknown as DescribeAlarmsCommandInput; - const program = CloudWatchService.describeAlarms(args); - - const CloudWatchClientInstanceLayer = Layer.succeed( - CloudWatchClientInstance, - new CloudWatchClient({ region: "eu-central-1" }), - ); - const CustomCloudWatchServiceLayer = BaseCloudWatchServiceLayer.pipe( - Layer.provide(CloudWatchClientInstanceLayer), - ); + const program = CloudWatch.describeAlarms(args); const result = await pipe( program, - Effect.provide(CustomCloudWatchServiceLayer), + Effect.provide( + CloudWatch.baseLayer( + () => new CloudWatchClient({ region: "eu-central-1" }), + ), + ), Effect.runPromiseExit, ); expect(result).toEqual(Exit.succeed({})); + expect(getRuntimeConfig).toHaveBeenCalledTimes(1); + expect(getRuntimeConfig).toHaveBeenCalledWith({ + region: "eu-central-1", + }); expect(clientMock).toHaveReceivedCommandTimes(DescribeAlarmsCommand, 1); expect(clientMock).toHaveReceivedCommandWith(DescribeAlarmsCommand, args); }); @@ -100,27 +97,25 @@ describe("CloudWatchClientImpl", () => { const args = {} as unknown as DescribeAlarmsCommandInput; - const program = CloudWatchService.describeAlarms(args); - - const CloudWatchClientInstanceLayer = Layer.effect( - CloudWatchClientInstance, - Effect.map( - CloudWatchClientInstanceConfig, - (config) => new CloudWatchClient({ ...config, region: "eu-central-1" }), - ), - ); - const CustomCloudWatchServiceLayer = BaseCloudWatchServiceLayer.pipe( - Layer.provide(CloudWatchClientInstanceLayer), - Layer.provide(DefaultCloudWatchClientConfigLayer), - ); + const program = CloudWatch.describeAlarms(args); const result = await pipe( program, - Effect.provide(CustomCloudWatchServiceLayer), + Effect.provide( + CloudWatch.baseLayer( + (config) => + new CloudWatchClient({ ...config, region: "eu-central-1" }), + ), + ), Effect.runPromiseExit, ); expect(result).toEqual(Exit.succeed({})); + expect(getRuntimeConfig).toHaveBeenCalledTimes(1); + expect(getRuntimeConfig).toHaveBeenCalledWith({ + region: "eu-central-1", + logger: expect.any(Object), + }); expect(clientMock).toHaveReceivedCommandTimes(DescribeAlarmsCommand, 1); expect(clientMock).toHaveReceivedCommandWith(DescribeAlarmsCommand, args); }); @@ -130,11 +125,11 @@ describe("CloudWatchClientImpl", () => { const args = {} as unknown as DescribeAlarmsCommandInput; - const program = CloudWatchService.describeAlarms(args); + const program = CloudWatch.describeAlarms(args); const result = await pipe( program, - Effect.provide(DefaultCloudWatchServiceLayer), + Effect.provide(CloudWatch.defaultLayer), Effect.runPromiseExit, ); @@ -165,13 +160,13 @@ describe("CloudWatchClientImpl", () => { const args = {} as unknown as DescribeAlarmsCommandInput; - const program = CloudWatchService.describeAlarms(args).pipe( + const program = CloudWatch.describeAlarms(args).pipe( Effect.catchTag("NotHandledException" as any, () => Effect.succeed(null)), ); const result = await pipe( program, - Effect.provide(DefaultCloudWatchServiceLayer), + Effect.provide(CloudWatch.defaultLayer), Effect.runPromiseExit, ); diff --git a/packages/client-codedeploy/README.md b/packages/client-codedeploy/README.md index a3169fd..28c36ab 100644 --- a/packages/client-codedeploy/README.md +++ b/packages/client-codedeploy/README.md @@ -14,16 +14,13 @@ npm install --save @effect-aws/client-codedeploy With default CodeDeployClient instance: ```typescript -import { - CodeDeployService, - DefaultCodeDeployServiceLayer, -} from "@effect-aws/client-codedeploy"; +import { CodeDeploy } from "@effect-aws/client-codedeploy"; -const program = CodeDeployService.listApplications(args); +const program = CodeDeploy.listApplications(args); const result = pipe( program, - Effect.provide(DefaultCodeDeployServiceLayer), + Effect.provide(CodeDeploy.defaultLayer), Effect.runPromise, ); ``` @@ -31,23 +28,15 @@ const result = pipe( With custom CodeDeployClient instance: ```typescript -import { - CodeDeployService, - BaseCodeDeployServiceLayer, - CodeDeployClientInstance, -} from "@effect-aws/client-codedeploy"; +import { CodeDeploy } from "@effect-aws/client-codedeploy"; -const program = CodeDeployService.listApplications(args); - -const CodeDeployClientInstanceLayer = Layer.succeed( - CodeDeployClientInstance, - new CodeDeployClient({ region: "eu-central-1" }), -); +const program = CodeDeploy.listApplications(args); const result = await pipe( program, - Effect.provide(BaseCodeDeployServiceLayer), - Effect.provide(CodeDeployClientInstanceLayer), + Effect.provide( + CodeDeploy.baseLayer(() => new CodeDeployClient({ region: "eu-central-1" })), + ), Effect.runPromise, ); ``` @@ -55,34 +44,15 @@ const result = await pipe( With custom CodeDeployClient configuration: ```typescript -import { - CodeDeployService, - BaseCodeDeployServiceLayer, - DefaultCodeDeployClientConfigLayer, - CodeDeployClientInstance, - CodeDeployClientInstanceConfig, -} from "@effect-aws/client-codedeploy"; - -const program = CodeDeployService.listApplications(args); - -const CodeDeployClientInstanceLayer = Layer.provide( - Layer.effect( - CodeDeployClientInstance, - CodeDeployClientInstanceConfig.pipe( - Effect.map( - (config) => new CodeDeployClient({ ...config, region: "eu-central-1" }), - ), - ), - ), - DefaultCodeDeployClientConfigLayer, -); +import { CodeDeploy } from "@effect-aws/client-codedeploy"; + +const program = CodeDeploy.listApplications(args); const result = await pipe( program, - Effect.provide(BaseCodeDeployServiceLayer), - Effect.provide(CodeDeployClientInstanceLayer), + Effect.provide(CodeDeploy.layer({ region: "eu-central-1" })), Effect.runPromiseExit, ); ``` -or map over `DefaultCodeDeployClientConfigLayer` layer context and update the configuration... +or use `CodeDeploy.baseLayer((default) => new CodeDeployClient({ ...default, region: "eu-central-1" }))` diff --git a/packages/client-codedeploy/src/CodeDeployService.ts b/packages/client-codedeploy/src/CodeDeployService.ts index 2313234..4bacd1a 100644 --- a/packages/client-codedeploy/src/CodeDeployService.ts +++ b/packages/client-codedeploy/src/CodeDeployService.ts @@ -3,6 +3,8 @@ */ import { CodeDeployServiceException, + type CodeDeployClient, + type CodeDeployClientConfig, AddTagsToOnPremisesInstancesCommand, type AddTagsToOnPremisesInstancesCommandInput, type AddTagsToOnPremisesInstancesCommandOutput, @@ -150,7 +152,11 @@ import { CodeDeployClientInstance, CodeDeployClientInstanceLayer, } from "./CodeDeployClientInstance"; -import { DefaultCodeDeployClientConfigLayer } from "./CodeDeployClientInstanceConfig"; +import { + DefaultCodeDeployClientConfigLayer, + makeDefaultCodeDeployClientInstanceConfig, + CodeDeployClientInstanceConfig, +} from "./CodeDeployClientInstanceConfig"; import { AllServiceErrors, AlarmsLimitExceededError, @@ -268,7 +274,7 @@ import { } from "./Errors"; /** - * @since 1.2.1 + * @since 1.0.0 */ export interface HttpHandlerOptions { /** @@ -1174,14 +1180,6 @@ interface CodeDeployService$ { >; } -/** - * @since 1.0.0 - * @category models - */ -export class CodeDeployService extends Effect.Tag( - "@effect-aws/client-codedeploy/CodeDeployService", -)() {} - /** * @since 1.0.0 * @category constructors @@ -1232,9 +1230,53 @@ export const makeCodeDeployService = Effect.gen(function* (_) { }, {}) as CodeDeployService$; }); +/** + * @since 1.0.0 + * @category models + */ +export class CodeDeployService extends Effect.Tag( + "@effect-aws/client-codedeploy/CodeDeployService", +)() { + static readonly defaultLayer = Layer.effect(this, makeCodeDeployService).pipe( + Layer.provide(CodeDeployClientInstanceLayer), + Layer.provide(DefaultCodeDeployClientConfigLayer), + ); + static readonly layer = (config: CodeDeployClientConfig) => + Layer.effect(this, makeCodeDeployService).pipe( + Layer.provide(CodeDeployClientInstanceLayer), + Layer.provide( + Layer.effect( + CodeDeployClientInstanceConfig, + makeDefaultCodeDeployClientInstanceConfig.pipe( + Effect.map((defaultConfig) => ({ ...defaultConfig, ...config })), + ), + ), + ), + ); + static readonly baseLayer = ( + evaluate: (defaultConfig: CodeDeployClientConfig) => CodeDeployClient, + ) => + Layer.effect(this, makeCodeDeployService).pipe( + Layer.provide( + Layer.effect( + CodeDeployClientInstance, + Effect.map(makeDefaultCodeDeployClientInstanceConfig, evaluate), + ), + ), + ); +} + +/** + * @since 1.0.0 + * @category models + * @alias CodeDeployService + */ +export const CodeDeploy = CodeDeployService; + /** * @since 1.0.0 * @category layers + * @deprecated use CodeDeploy.baseLayer instead */ export const BaseCodeDeployServiceLayer = Layer.effect( CodeDeployService, @@ -1244,6 +1286,7 @@ export const BaseCodeDeployServiceLayer = Layer.effect( /** * @since 1.0.0 * @category layers + * @deprecated use CodeDeploy.layer instead */ export const CodeDeployServiceLayer = BaseCodeDeployServiceLayer.pipe( Layer.provide(CodeDeployClientInstanceLayer), @@ -1252,7 +1295,6 @@ export const CodeDeployServiceLayer = BaseCodeDeployServiceLayer.pipe( /** * @since 1.0.0 * @category layers + * @deprecated use CodeDeploy.defaultLayer instead */ -export const DefaultCodeDeployServiceLayer = CodeDeployServiceLayer.pipe( - Layer.provide(DefaultCodeDeployClientConfigLayer), -); +export const DefaultCodeDeployServiceLayer = CodeDeployService.defaultLayer; diff --git a/packages/client-codedeploy/test/CodeDeploy.test.ts b/packages/client-codedeploy/test/CodeDeploy.test.ts index aba4f89..6c342a1 100644 --- a/packages/client-codedeploy/test/CodeDeploy.test.ts +++ b/packages/client-codedeploy/test/CodeDeploy.test.ts @@ -4,39 +4,41 @@ import { CodeDeployClient, CodeDeployServiceException, } from "@aws-sdk/client-codedeploy"; +// @ts-ignore +import * as runtimeConfig from "@aws-sdk/client-codedeploy/dist-cjs/runtimeConfig"; import { mockClient } from "aws-sdk-client-mock"; import * as Effect from "effect/Effect"; import * as Exit from "effect/Exit"; import { pipe } from "effect/Function"; -import * as Layer from "effect/Layer"; -import { - BaseCodeDeployServiceLayer, - DefaultCodeDeployClientConfigLayer, - DefaultCodeDeployServiceLayer, - CodeDeployClientInstance, - CodeDeployClientInstanceConfig, - CodeDeployService, - CodeDeployServiceLayer, - SdkError, -} from "../src"; +import { afterEach, describe, expect, it, vi } from "vitest"; +import { CodeDeploy, SdkError } from "../src"; +const getRuntimeConfig = vi.spyOn(runtimeConfig, "getRuntimeConfig"); const clientMock = mockClient(CodeDeployClient); describe("CodeDeployClientImpl", () => { + afterEach(() => { + getRuntimeConfig.mockClear(); + }); + it("default", async () => { clientMock.reset().on(ListApplicationsCommand).resolves({}); const args = {} as unknown as ListApplicationsCommandInput; - const program = CodeDeployService.listApplications(args); + const program = CodeDeploy.listApplications(args); const result = await pipe( program, - Effect.provide(DefaultCodeDeployServiceLayer), + Effect.provide(CodeDeploy.defaultLayer), Effect.runPromiseExit, ); expect(result).toEqual(Exit.succeed({})); + expect(getRuntimeConfig).toHaveBeenCalledTimes(1); + expect(getRuntimeConfig).toHaveBeenCalledWith({ + logger: expect.any(Object), + }); expect(clientMock).toHaveReceivedCommandTimes(ListApplicationsCommand, 1); expect(clientMock).toHaveReceivedCommandWith(ListApplicationsCommand, args); }); @@ -46,25 +48,20 @@ describe("CodeDeployClientImpl", () => { const args = {} as unknown as ListApplicationsCommandInput; - const program = CodeDeployService.listApplications(args); - - const CodeDeployClientConfigLayer = Layer.succeed( - CodeDeployClientInstanceConfig, - { - region: "eu-central-1", - }, - ); - const CustomCodeDeployServiceLayer = CodeDeployServiceLayer.pipe( - Layer.provide(CodeDeployClientConfigLayer), - ); + const program = CodeDeploy.listApplications(args); const result = await pipe( program, - Effect.provide(CustomCodeDeployServiceLayer), + Effect.provide(CodeDeploy.layer({ region: "eu-central-1" })), Effect.runPromiseExit, ); expect(result).toEqual(Exit.succeed({})); + expect(getRuntimeConfig).toHaveBeenCalledTimes(1); + expect(getRuntimeConfig).toHaveBeenCalledWith({ + region: "eu-central-1", + logger: expect.any(Object), + }); expect(clientMock).toHaveReceivedCommandTimes(ListApplicationsCommand, 1); expect(clientMock).toHaveReceivedCommandWith(ListApplicationsCommand, args); }); @@ -74,23 +71,23 @@ describe("CodeDeployClientImpl", () => { const args = {} as unknown as ListApplicationsCommandInput; - const program = CodeDeployService.listApplications(args); - - const CodeDeployClientInstanceLayer = Layer.succeed( - CodeDeployClientInstance, - new CodeDeployClient({ region: "eu-central-1" }), - ); - const CustomCodeDeployServiceLayer = BaseCodeDeployServiceLayer.pipe( - Layer.provide(CodeDeployClientInstanceLayer), - ); + const program = CodeDeploy.listApplications(args); const result = await pipe( program, - Effect.provide(CustomCodeDeployServiceLayer), + Effect.provide( + CodeDeploy.baseLayer( + () => new CodeDeployClient({ region: "eu-central-1" }), + ), + ), Effect.runPromiseExit, ); expect(result).toEqual(Exit.succeed({})); + expect(getRuntimeConfig).toHaveBeenCalledTimes(1); + expect(getRuntimeConfig).toHaveBeenCalledWith({ + region: "eu-central-1", + }); expect(clientMock).toHaveReceivedCommandTimes(ListApplicationsCommand, 1); expect(clientMock).toHaveReceivedCommandWith(ListApplicationsCommand, args); }); @@ -100,27 +97,25 @@ describe("CodeDeployClientImpl", () => { const args = {} as unknown as ListApplicationsCommandInput; - const program = CodeDeployService.listApplications(args); - - const CodeDeployClientInstanceLayer = Layer.effect( - CodeDeployClientInstance, - Effect.map( - CodeDeployClientInstanceConfig, - (config) => new CodeDeployClient({ ...config, region: "eu-central-1" }), - ), - ); - const CustomCodeDeployServiceLayer = BaseCodeDeployServiceLayer.pipe( - Layer.provide(CodeDeployClientInstanceLayer), - Layer.provide(DefaultCodeDeployClientConfigLayer), - ); + const program = CodeDeploy.listApplications(args); const result = await pipe( program, - Effect.provide(CustomCodeDeployServiceLayer), + Effect.provide( + CodeDeploy.baseLayer( + (config) => + new CodeDeployClient({ ...config, region: "eu-central-1" }), + ), + ), Effect.runPromiseExit, ); expect(result).toEqual(Exit.succeed({})); + expect(getRuntimeConfig).toHaveBeenCalledTimes(1); + expect(getRuntimeConfig).toHaveBeenCalledWith({ + region: "eu-central-1", + logger: expect.any(Object), + }); expect(clientMock).toHaveReceivedCommandTimes(ListApplicationsCommand, 1); expect(clientMock).toHaveReceivedCommandWith(ListApplicationsCommand, args); }); @@ -130,11 +125,11 @@ describe("CodeDeployClientImpl", () => { const args = {} as unknown as ListApplicationsCommandInput; - const program = CodeDeployService.listApplications(args); + const program = CodeDeploy.listApplications(args); const result = await pipe( program, - Effect.provide(DefaultCodeDeployServiceLayer), + Effect.provide(CodeDeploy.defaultLayer), Effect.runPromiseExit, ); @@ -165,13 +160,13 @@ describe("CodeDeployClientImpl", () => { const args = {} as unknown as ListApplicationsCommandInput; - const program = CodeDeployService.listApplications(args).pipe( + const program = CodeDeploy.listApplications(args).pipe( Effect.catchTag("NotHandledException" as any, () => Effect.succeed(null)), ); const result = await pipe( program, - Effect.provide(DefaultCodeDeployServiceLayer), + Effect.provide(CodeDeploy.defaultLayer), Effect.runPromiseExit, ); diff --git a/packages/client-cognito-identity-provider/README.md b/packages/client-cognito-identity-provider/README.md index 9fc0491..ea7e363 100644 --- a/packages/client-cognito-identity-provider/README.md +++ b/packages/client-cognito-identity-provider/README.md @@ -14,13 +14,13 @@ npm install --save @effect-aws/client-cognito-identity-provider With default CognitoIdentityProviderClient instance: ```typescript -import { CognitoIdentityProviderService, DefaultCognitoIdentityProviderServiceLayer } from "@effect-aws/client-cognito-identity-provider"; +import { CognitoIdentityProvider } from "@effect-aws/client-cognito-identity-provider"; -const program = CognitoIdentityProviderService.listUserPools(args); +const program = CognitoIdentityProvider.listUserPools(args); const result = pipe( program, - Effect.provide(DefaultCognitoIdentityProviderServiceLayer), + Effect.provide(CognitoIdentityProvider.defaultLayer), Effect.runPromise, ); ``` @@ -28,23 +28,15 @@ const result = pipe( With custom CognitoIdentityProviderClient instance: ```typescript -import { - CognitoIdentityProviderService, - BaseCognitoIdentityProviderServiceLayer, - CognitoIdentityProviderClientInstance, -} from "@effect-aws/client-cognito-identity-provider"; +import { CognitoIdentityProvider } from "@effect-aws/client-cognito-identity-provider"; -const program = CognitoIdentityProviderService.listUserPools(args); - -const CognitoIdentityProviderClientInstanceLayer = Layer.succeed( - CognitoIdentityProviderClientInstance, - new CognitoIdentityProviderClient({ region: "eu-central-1" }), -); +const program = CognitoIdentityProvider.listUserPools(args); const result = await pipe( program, - Effect.provide(BaseCognitoIdentityProviderServiceLayer), - Effect.provide(CognitoIdentityProviderClientInstanceLayer), + Effect.provide( + CognitoIdentityProvider.baseLayer(() => new CognitoIdentityProviderClient({ region: "eu-central-1" })), + ), Effect.runPromise, ); ``` @@ -52,34 +44,15 @@ const result = await pipe( With custom CognitoIdentityProviderClient configuration: ```typescript -import { - CognitoIdentityProviderService, - BaseCognitoIdentityProviderServiceLayer, - DefaultCognitoIdentityProviderClientConfigLayer, - CognitoIdentityProviderClientInstance, - CognitoIdentityProviderClientInstanceConfig, -} from "@effect-aws/client-cognito-identity-provider"; - -const program = CognitoIdentityProviderService.listUserPools(args); - -const CognitoIdentityProviderClientInstanceLayer = Layer.provide( - Layer.effect( - CognitoIdentityProviderClientInstance, - CognitoIdentityProviderClientInstanceConfig.pipe( - Effect.map( - (config) => new CognitoIdentityProviderClient({ ...config, region: "eu-central-1" }), - ), - ), - ), - DefaultCognitoIdentityProviderClientConfigLayer, -); +import { CognitoIdentityProvider } from "@effect-aws/client-cognito-identity-provider"; + +const program = CognitoIdentityProvider.listUserPools(args); const result = await pipe( program, - Effect.provide(BaseCognitoIdentityProviderServiceLayer), - Effect.provide(CognitoIdentityProviderClientInstanceLayer), + Effect.provide(CognitoIdentityProvider.layer({ region: "eu-central-1" })), Effect.runPromiseExit, ); ``` -or map over `DefaultCognitoIdentityProviderClientConfigLayer` layer context and update the configuration... +or use `CognitoIdentityProvider.baseLayer((default) => new CognitoIdentityProviderClient({ ...default, region: "eu-central-1" }))` diff --git a/packages/client-cognito-identity-provider/src/CognitoIdentityProviderService.ts b/packages/client-cognito-identity-provider/src/CognitoIdentityProviderService.ts index aad1feb..b1bbac6 100644 --- a/packages/client-cognito-identity-provider/src/CognitoIdentityProviderService.ts +++ b/packages/client-cognito-identity-provider/src/CognitoIdentityProviderService.ts @@ -3,6 +3,8 @@ */ import { CognitoIdentityProviderServiceException, + type CognitoIdentityProviderClient, + type CognitoIdentityProviderClientConfig, AddCustomAttributesCommand, type AddCustomAttributesCommandInput, type AddCustomAttributesCommandOutput, @@ -318,7 +320,11 @@ import { CognitoIdentityProviderClientInstance, CognitoIdentityProviderClientInstanceLayer, } from "./CognitoIdentityProviderClientInstance"; -import { DefaultCognitoIdentityProviderClientConfigLayer } from "./CognitoIdentityProviderClientInstanceConfig"; +import { + DefaultCognitoIdentityProviderClientConfigLayer, + makeDefaultCognitoIdentityProviderClientInstanceConfig, + CognitoIdentityProviderClientInstanceConfig, +} from "./CognitoIdentityProviderClientInstanceConfig"; import { AllServiceErrors, AliasExistsError, @@ -368,7 +374,7 @@ import { } from "./Errors"; /** - * @since 1.0.1 + * @since 1.0.0 */ export interface HttpHandlerOptions { /** @@ -2444,14 +2450,6 @@ interface CognitoIdentityProviderService$ { >; } -/** - * @since 1.0.0 - * @category models - */ -export class CognitoIdentityProviderService extends Effect.Tag( - "@effect-aws/client-cognito-identity-provider/CognitoIdentityProviderService", -)() {} - /** * @since 1.0.0 * @category constructors @@ -2502,9 +2500,61 @@ export const makeCognitoIdentityProviderService = Effect.gen(function* (_) { }, {}) as CognitoIdentityProviderService$; }); +/** + * @since 1.0.0 + * @category models + */ +export class CognitoIdentityProviderService extends Effect.Tag( + "@effect-aws/client-cognito-identity-provider/CognitoIdentityProviderService", +)() { + static readonly defaultLayer = Layer.effect( + this, + makeCognitoIdentityProviderService, + ).pipe( + Layer.provide(CognitoIdentityProviderClientInstanceLayer), + Layer.provide(DefaultCognitoIdentityProviderClientConfigLayer), + ); + static readonly layer = (config: CognitoIdentityProviderClientConfig) => + Layer.effect(this, makeCognitoIdentityProviderService).pipe( + Layer.provide(CognitoIdentityProviderClientInstanceLayer), + Layer.provide( + Layer.effect( + CognitoIdentityProviderClientInstanceConfig, + makeDefaultCognitoIdentityProviderClientInstanceConfig.pipe( + Effect.map((defaultConfig) => ({ ...defaultConfig, ...config })), + ), + ), + ), + ); + static readonly baseLayer = ( + evaluate: ( + defaultConfig: CognitoIdentityProviderClientConfig, + ) => CognitoIdentityProviderClient, + ) => + Layer.effect(this, makeCognitoIdentityProviderService).pipe( + Layer.provide( + Layer.effect( + CognitoIdentityProviderClientInstance, + Effect.map( + makeDefaultCognitoIdentityProviderClientInstanceConfig, + evaluate, + ), + ), + ), + ); +} + +/** + * @since 1.0.0 + * @category models + * @alias CognitoIdentityProviderService + */ +export const CognitoIdentityProvider = CognitoIdentityProviderService; + /** * @since 1.0.0 * @category layers + * @deprecated use CognitoIdentityProvider.baseLayer instead */ export const BaseCognitoIdentityProviderServiceLayer = Layer.effect( CognitoIdentityProviderService, @@ -2514,6 +2564,7 @@ export const BaseCognitoIdentityProviderServiceLayer = Layer.effect( /** * @since 1.0.0 * @category layers + * @deprecated use CognitoIdentityProvider.layer instead */ export const CognitoIdentityProviderServiceLayer = BaseCognitoIdentityProviderServiceLayer.pipe( @@ -2523,8 +2574,7 @@ export const CognitoIdentityProviderServiceLayer = /** * @since 1.0.0 * @category layers + * @deprecated use CognitoIdentityProvider.defaultLayer instead */ export const DefaultCognitoIdentityProviderServiceLayer = - CognitoIdentityProviderServiceLayer.pipe( - Layer.provide(DefaultCognitoIdentityProviderClientConfigLayer), - ); + CognitoIdentityProviderService.defaultLayer; diff --git a/packages/client-cognito-identity-provider/test/CognitoIdentityProvider.test.ts b/packages/client-cognito-identity-provider/test/CognitoIdentityProvider.test.ts index 41293cb..c17d463 100644 --- a/packages/client-cognito-identity-provider/test/CognitoIdentityProvider.test.ts +++ b/packages/client-cognito-identity-provider/test/CognitoIdentityProvider.test.ts @@ -4,39 +4,41 @@ import { CognitoIdentityProviderClient, CognitoIdentityProviderServiceException, } from "@aws-sdk/client-cognito-identity-provider"; +// @ts-ignore +import * as runtimeConfig from "@aws-sdk/client-cognito-identity-provider/dist-cjs/runtimeConfig"; import { mockClient } from "aws-sdk-client-mock"; import * as Effect from "effect/Effect"; import * as Exit from "effect/Exit"; import { pipe } from "effect/Function"; -import * as Layer from "effect/Layer"; -import { - BaseCognitoIdentityProviderServiceLayer, - DefaultCognitoIdentityProviderClientConfigLayer, - DefaultCognitoIdentityProviderServiceLayer, - CognitoIdentityProviderClientInstance, - CognitoIdentityProviderClientInstanceConfig, - CognitoIdentityProviderService, - CognitoIdentityProviderServiceLayer, - SdkError, -} from "../src"; +import { afterEach, describe, expect, it, vi } from "vitest"; +import { CognitoIdentityProvider, SdkError } from "../src"; +const getRuntimeConfig = vi.spyOn(runtimeConfig, "getRuntimeConfig"); const clientMock = mockClient(CognitoIdentityProviderClient); describe("CognitoIdentityProviderClientImpl", () => { + afterEach(() => { + getRuntimeConfig.mockClear(); + }); + it("default", async () => { clientMock.reset().on(ListUserPoolsCommand).resolves({}); const args = {} as unknown as ListUserPoolsCommandInput; - const program = CognitoIdentityProviderService.listUserPools(args); + const program = CognitoIdentityProvider.listUserPools(args); const result = await pipe( program, - Effect.provide(DefaultCognitoIdentityProviderServiceLayer), + Effect.provide(CognitoIdentityProvider.defaultLayer), Effect.runPromiseExit, ); expect(result).toEqual(Exit.succeed({})); + expect(getRuntimeConfig).toHaveBeenCalledTimes(1); + expect(getRuntimeConfig).toHaveBeenCalledWith({ + logger: expect.any(Object), + }); expect(clientMock).toHaveReceivedCommandTimes(ListUserPoolsCommand, 1); expect(clientMock).toHaveReceivedCommandWith(ListUserPoolsCommand, args); }); @@ -46,26 +48,20 @@ describe("CognitoIdentityProviderClientImpl", () => { const args = {} as unknown as ListUserPoolsCommandInput; - const program = CognitoIdentityProviderService.listUserPools(args); - - const CognitoIdentityProviderClientConfigLayer = Layer.succeed( - CognitoIdentityProviderClientInstanceConfig, - { - region: "eu-central-1", - }, - ); - const CustomCognitoIdentityProviderServiceLayer = - CognitoIdentityProviderServiceLayer.pipe( - Layer.provide(CognitoIdentityProviderClientConfigLayer), - ); + const program = CognitoIdentityProvider.listUserPools(args); const result = await pipe( program, - Effect.provide(CustomCognitoIdentityProviderServiceLayer), + Effect.provide(CognitoIdentityProvider.layer({ region: "eu-central-1" })), Effect.runPromiseExit, ); expect(result).toEqual(Exit.succeed({})); + expect(getRuntimeConfig).toHaveBeenCalledTimes(1); + expect(getRuntimeConfig).toHaveBeenCalledWith({ + region: "eu-central-1", + logger: expect.any(Object), + }); expect(clientMock).toHaveReceivedCommandTimes(ListUserPoolsCommand, 1); expect(clientMock).toHaveReceivedCommandWith(ListUserPoolsCommand, args); }); @@ -75,24 +71,23 @@ describe("CognitoIdentityProviderClientImpl", () => { const args = {} as unknown as ListUserPoolsCommandInput; - const program = CognitoIdentityProviderService.listUserPools(args); - - const CognitoIdentityProviderClientInstanceLayer = Layer.succeed( - CognitoIdentityProviderClientInstance, - new CognitoIdentityProviderClient({ region: "eu-central-1" }), - ); - const CustomCognitoIdentityProviderServiceLayer = - BaseCognitoIdentityProviderServiceLayer.pipe( - Layer.provide(CognitoIdentityProviderClientInstanceLayer), - ); + const program = CognitoIdentityProvider.listUserPools(args); const result = await pipe( program, - Effect.provide(CustomCognitoIdentityProviderServiceLayer), + Effect.provide( + CognitoIdentityProvider.baseLayer( + () => new CognitoIdentityProviderClient({ region: "eu-central-1" }), + ), + ), Effect.runPromiseExit, ); expect(result).toEqual(Exit.succeed({})); + expect(getRuntimeConfig).toHaveBeenCalledTimes(1); + expect(getRuntimeConfig).toHaveBeenCalledWith({ + region: "eu-central-1", + }); expect(clientMock).toHaveReceivedCommandTimes(ListUserPoolsCommand, 1); expect(clientMock).toHaveReceivedCommandWith(ListUserPoolsCommand, args); }); @@ -102,32 +97,28 @@ describe("CognitoIdentityProviderClientImpl", () => { const args = {} as unknown as ListUserPoolsCommandInput; - const program = CognitoIdentityProviderService.listUserPools(args); - - const CognitoIdentityProviderClientInstanceLayer = Layer.effect( - CognitoIdentityProviderClientInstance, - Effect.map( - CognitoIdentityProviderClientInstanceConfig, - (config) => - new CognitoIdentityProviderClient({ - ...config, - region: "eu-central-1", - }), - ), - ); - const CustomCognitoIdentityProviderServiceLayer = - BaseCognitoIdentityProviderServiceLayer.pipe( - Layer.provide(CognitoIdentityProviderClientInstanceLayer), - Layer.provide(DefaultCognitoIdentityProviderClientConfigLayer), - ); + const program = CognitoIdentityProvider.listUserPools(args); const result = await pipe( program, - Effect.provide(CustomCognitoIdentityProviderServiceLayer), + Effect.provide( + CognitoIdentityProvider.baseLayer( + (config) => + new CognitoIdentityProviderClient({ + ...config, + region: "eu-central-1", + }), + ), + ), Effect.runPromiseExit, ); expect(result).toEqual(Exit.succeed({})); + expect(getRuntimeConfig).toHaveBeenCalledTimes(1); + expect(getRuntimeConfig).toHaveBeenCalledWith({ + region: "eu-central-1", + logger: expect.any(Object), + }); expect(clientMock).toHaveReceivedCommandTimes(ListUserPoolsCommand, 1); expect(clientMock).toHaveReceivedCommandWith(ListUserPoolsCommand, args); }); @@ -137,11 +128,11 @@ describe("CognitoIdentityProviderClientImpl", () => { const args = {} as unknown as ListUserPoolsCommandInput; - const program = CognitoIdentityProviderService.listUserPools(args); + const program = CognitoIdentityProvider.listUserPools(args); const result = await pipe( program, - Effect.provide(DefaultCognitoIdentityProviderServiceLayer), + Effect.provide(CognitoIdentityProvider.defaultLayer), Effect.runPromiseExit, ); @@ -172,13 +163,13 @@ describe("CognitoIdentityProviderClientImpl", () => { const args = {} as unknown as ListUserPoolsCommandInput; - const program = CognitoIdentityProviderService.listUserPools(args).pipe( + const program = CognitoIdentityProvider.listUserPools(args).pipe( Effect.catchTag("NotHandledException" as any, () => Effect.succeed(null)), ); const result = await pipe( program, - Effect.provide(DefaultCognitoIdentityProviderServiceLayer), + Effect.provide(CognitoIdentityProvider.defaultLayer), Effect.runPromiseExit, ); diff --git a/packages/client-dynamodb/README.md b/packages/client-dynamodb/README.md index 572b510..6627dca 100644 --- a/packages/client-dynamodb/README.md +++ b/packages/client-dynamodb/README.md @@ -14,16 +14,13 @@ npm install --save @effect-aws/client-dynamodb With default DynamoDBClient instance: ```typescript -import { - DynamoDBService, - DefaultDynamoDBServiceLayer, -} from "@effect-aws/client-dynamodb"; +import { DynamoDB } from "@effect-aws/client-dynamodb"; -const program = DynamoDBService.putItem(args); +const program = DynamoDB.putItem(args); const result = pipe( program, - Effect.provide(DefaultDynamoDBServiceLayer), + Effect.provide(DynamoDB.defaultLayer), Effect.runPromise, ); ``` @@ -31,23 +28,15 @@ const result = pipe( With custom DynamoDBClient instance: ```typescript -import { - DynamoDBService, - BaseDynamoDBServiceLayer, - DynamoDBClientInstance, -} from "@effect-aws/client-dynamodb"; +import { DynamoDB } from "@effect-aws/client-dynamodb"; -const program = DynamoDBService.putItem(args); - -const DynamoDBClientInstanceLayer = Layer.succeed( - DynamoDBClientInstance, - new DynamoDBClient({ region: "eu-central-1" }), -); +const program = DynamoDB.putItem(args); const result = await pipe( program, - Effect.provide(BaseDynamoDBServiceLayer), - Effect.provide(DynamoDBClientInstanceLayer), + Effect.provide( + DynamoDB.baseLayer(() => new DynamoDBClient({ region: "eu-central-1" })), + ), Effect.runPromise, ); ``` @@ -55,34 +44,15 @@ const result = await pipe( With custom DynamoDBClient configuration: ```typescript -import { - DynamoDBService, - BaseDynamoDBServiceLayer, - DefaultDynamoDBClientConfigLayer, - DynamoDBClientInstance, - DynamoDBClientInstanceConfig, -} from "@effect-aws/client-dynamodb"; - -const program = DynamoDBService.putItem(args); - -const DynamoDBClientInstanceLayer = Layer.provide( - Layer.effect( - DynamoDBClientInstance, - DynamoDBClientInstanceConfig.pipe( - Effect.map( - (config) => new DynamoDBClient({ ...config, region: "eu-central-1" }), - ), - ), - ), - DefaultDynamoDBClientConfigLayer, -); +import { DynamoDB } from "@effect-aws/client-dynamodb"; + +const program = DynamoDB.putItem(args); const result = await pipe( program, - Effect.provide(BaseDynamoDBServiceLayer), - Effect.provide(DynamoDBClientInstanceLayer), + Effect.provide(DynamoDB.layer({ region: "eu-central-1" })), Effect.runPromiseExit, ); ``` -or map over `DefaultDynamoDBClientConfigLayer` layer context and update the configuration... +or use `DynamoDB.baseLayer((default) => new DynamoDBClient({ ...default, region: "eu-central-1" }))` diff --git a/packages/client-dynamodb/src/DynamoDBService.ts b/packages/client-dynamodb/src/DynamoDBService.ts index 15c03f7..7d8e4b0 100644 --- a/packages/client-dynamodb/src/DynamoDBService.ts +++ b/packages/client-dynamodb/src/DynamoDBService.ts @@ -3,6 +3,8 @@ */ import { DynamoDBServiceException, + type DynamoDBClient, + type DynamoDBClientConfig, BatchExecuteStatementCommand, type BatchExecuteStatementCommandInput, type BatchExecuteStatementCommandOutput, @@ -180,7 +182,11 @@ import { DynamoDBClientInstance, DynamoDBClientInstanceLayer, } from "./DynamoDBClientInstance"; -import { DefaultDynamoDBClientConfigLayer } from "./DynamoDBClientInstanceConfig"; +import { + DefaultDynamoDBClientConfigLayer, + makeDefaultDynamoDBClientInstanceConfig, + DynamoDBClientInstanceConfig, +} from "./DynamoDBClientInstanceConfig"; import { AllServiceErrors, BackupInUseError, @@ -221,7 +227,7 @@ import { } from "./Errors"; /** - * @since 1.4.1 + * @since 1.0.0 */ export interface HttpHandlerOptions { /** @@ -1129,14 +1135,6 @@ interface DynamoDBService$ { >; } -/** - * @since 1.0.0 - * @category models - */ -export class DynamoDBService extends Effect.Tag( - "@effect-aws/client-dynamodb/DynamoDBService", -)() {} - /** * @since 1.0.0 * @category constructors @@ -1187,9 +1185,53 @@ export const makeDynamoDBService = Effect.gen(function* (_) { }, {}) as DynamoDBService$; }); +/** + * @since 1.0.0 + * @category models + */ +export class DynamoDBService extends Effect.Tag( + "@effect-aws/client-dynamodb/DynamoDBService", +)() { + static readonly defaultLayer = Layer.effect(this, makeDynamoDBService).pipe( + Layer.provide(DynamoDBClientInstanceLayer), + Layer.provide(DefaultDynamoDBClientConfigLayer), + ); + static readonly layer = (config: DynamoDBClientConfig) => + Layer.effect(this, makeDynamoDBService).pipe( + Layer.provide(DynamoDBClientInstanceLayer), + Layer.provide( + Layer.effect( + DynamoDBClientInstanceConfig, + makeDefaultDynamoDBClientInstanceConfig.pipe( + Effect.map((defaultConfig) => ({ ...defaultConfig, ...config })), + ), + ), + ), + ); + static readonly baseLayer = ( + evaluate: (defaultConfig: DynamoDBClientConfig) => DynamoDBClient, + ) => + Layer.effect(this, makeDynamoDBService).pipe( + Layer.provide( + Layer.effect( + DynamoDBClientInstance, + Effect.map(makeDefaultDynamoDBClientInstanceConfig, evaluate), + ), + ), + ); +} + +/** + * @since 1.0.0 + * @category models + * @alias DynamoDBService + */ +export const DynamoDB = DynamoDBService; + /** * @since 1.0.0 * @category layers + * @deprecated use DynamoDB.baseLayer instead */ export const BaseDynamoDBServiceLayer = Layer.effect( DynamoDBService, @@ -1199,6 +1241,7 @@ export const BaseDynamoDBServiceLayer = Layer.effect( /** * @since 1.0.0 * @category layers + * @deprecated use DynamoDB.layer instead */ export const DynamoDBServiceLayer = BaseDynamoDBServiceLayer.pipe( Layer.provide(DynamoDBClientInstanceLayer), @@ -1207,7 +1250,6 @@ export const DynamoDBServiceLayer = BaseDynamoDBServiceLayer.pipe( /** * @since 1.0.0 * @category layers + * @deprecated use DynamoDB.defaultLayer instead */ -export const DefaultDynamoDBServiceLayer = DynamoDBServiceLayer.pipe( - Layer.provide(DefaultDynamoDBClientConfigLayer), -); +export const DefaultDynamoDBServiceLayer = DynamoDBService.defaultLayer; diff --git a/packages/client-dynamodb/test/DynamoDB.test.ts b/packages/client-dynamodb/test/DynamoDB.test.ts index 9e37040..a96599d 100644 --- a/packages/client-dynamodb/test/DynamoDB.test.ts +++ b/packages/client-dynamodb/test/DynamoDB.test.ts @@ -4,25 +4,23 @@ import { DynamoDBClient, DynamoDBServiceException, } from "@aws-sdk/client-dynamodb"; +// @ts-ignore +import * as runtimeConfig from "@aws-sdk/client-dynamodb/dist-cjs/runtimeConfig"; import { mockClient } from "aws-sdk-client-mock"; import * as Effect from "effect/Effect"; import * as Exit from "effect/Exit"; import { pipe } from "effect/Function"; -import * as Layer from "effect/Layer"; -import { - BaseDynamoDBServiceLayer, - DefaultDynamoDBClientConfigLayer, - DefaultDynamoDBServiceLayer, - DynamoDBClientInstance, - DynamoDBClientInstanceConfig, - DynamoDBService, - DynamoDBServiceLayer, - SdkError, -} from "../src"; +import { afterEach, describe, expect, it, vi } from "vitest"; +import { DynamoDB, SdkError } from "../src"; +const getRuntimeConfig = vi.spyOn(runtimeConfig, "getRuntimeConfig"); const clientMock = mockClient(DynamoDBClient); describe("DynamoDBClientImpl", () => { + afterEach(() => { + getRuntimeConfig.mockClear(); + }); + it("default", async () => { clientMock.reset().on(PutItemCommand).resolves({}); @@ -31,15 +29,19 @@ describe("DynamoDBClientImpl", () => { Item: { testAttr: { S: "test" } }, }; - const program = DynamoDBService.putItem(args); + const program = DynamoDB.putItem(args); const result = await pipe( program, - Effect.provide(DefaultDynamoDBServiceLayer), + Effect.provide(DynamoDB.defaultLayer), Effect.runPromiseExit, ); expect(result).toEqual(Exit.succeed({})); + expect(getRuntimeConfig).toHaveBeenCalledTimes(1); + expect(getRuntimeConfig).toHaveBeenCalledWith({ + logger: expect.any(Object), + }); expect(clientMock).toHaveReceivedCommandTimes(PutItemCommand, 1); expect(clientMock).toHaveReceivedCommandWith(PutItemCommand, args); }); @@ -52,23 +54,20 @@ describe("DynamoDBClientImpl", () => { Item: { testAttr: { S: "test" } }, }; - const program = DynamoDBService.putItem(args); - - const DynamoDBClientConfigLayer = Layer.succeed( - DynamoDBClientInstanceConfig, - { region: "eu-central-1" }, - ); - const CustomDynamoDBServiceLayer = DynamoDBServiceLayer.pipe( - Layer.provide(DynamoDBClientConfigLayer), - ); + const program = DynamoDB.putItem(args); const result = await pipe( program, - Effect.provide(CustomDynamoDBServiceLayer), + Effect.provide(DynamoDB.layer({ region: "eu-central-1" })), Effect.runPromiseExit, ); expect(result).toEqual(Exit.succeed({})); + expect(getRuntimeConfig).toHaveBeenCalledTimes(1); + expect(getRuntimeConfig).toHaveBeenCalledWith({ + region: "eu-central-1", + logger: expect.any(Object), + }); expect(clientMock).toHaveReceivedCommandTimes(PutItemCommand, 1); expect(clientMock).toHaveReceivedCommandWith(PutItemCommand, args); }); @@ -81,23 +80,23 @@ describe("DynamoDBClientImpl", () => { Item: { testAttr: { S: "test" } }, }; - const program = DynamoDBService.putItem(args); - - const DynamoDBClientInstanceLayer = Layer.succeed( - DynamoDBClientInstance, - new DynamoDBClient({ region: "eu-central-1" }), - ); - const CustomDynamoDBServiceLayer = BaseDynamoDBServiceLayer.pipe( - Layer.provide(DynamoDBClientInstanceLayer), - ); + const program = DynamoDB.putItem(args); const result = await pipe( program, - Effect.provide(CustomDynamoDBServiceLayer), + Effect.provide( + DynamoDB.baseLayer( + () => new DynamoDBClient({ region: "eu-central-1" }), + ), + ), Effect.runPromiseExit, ); expect(result).toEqual(Exit.succeed({})); + expect(getRuntimeConfig).toHaveBeenCalledTimes(1); + expect(getRuntimeConfig).toHaveBeenCalledWith({ + region: "eu-central-1", + }); expect(clientMock).toHaveReceivedCommandTimes(PutItemCommand, 1); expect(clientMock).toHaveReceivedCommandWith(PutItemCommand, args); }); @@ -110,27 +109,24 @@ describe("DynamoDBClientImpl", () => { Item: { testAttr: { S: "test" } }, }; - const program = DynamoDBService.putItem(args); - - const DynamoDBClientInstanceLayer = Layer.effect( - DynamoDBClientInstance, - Effect.map( - DynamoDBClientInstanceConfig, - (config) => new DynamoDBClient({ ...config, region: "eu-central-1" }), - ), - ); - const CustomDynamoDBServiceLayer = BaseDynamoDBServiceLayer.pipe( - Layer.provide(DynamoDBClientInstanceLayer), - Layer.provide(DefaultDynamoDBClientConfigLayer), - ); + const program = DynamoDB.putItem(args); const result = await pipe( program, - Effect.provide(CustomDynamoDBServiceLayer), + Effect.provide( + DynamoDB.baseLayer( + (config) => new DynamoDBClient({ ...config, region: "eu-central-1" }), + ), + ), Effect.runPromiseExit, ); expect(result).toEqual(Exit.succeed({})); + expect(getRuntimeConfig).toHaveBeenCalledTimes(1); + expect(getRuntimeConfig).toHaveBeenCalledWith({ + region: "eu-central-1", + logger: expect.any(Object), + }); expect(clientMock).toHaveReceivedCommandTimes(PutItemCommand, 1); expect(clientMock).toHaveReceivedCommandWith(PutItemCommand, args); }); @@ -143,11 +139,11 @@ describe("DynamoDBClientImpl", () => { Item: { testAttr: { S: "test" } }, }; - const program = DynamoDBService.putItem(args, { requestTimeout: 1000 }); + const program = DynamoDB.putItem(args); const result = await pipe( program, - Effect.provide(DefaultDynamoDBServiceLayer), + Effect.provide(DynamoDB.defaultLayer), Effect.runPromiseExit, ); @@ -181,13 +177,13 @@ describe("DynamoDBClientImpl", () => { Item: { testAttr: { S: "test" } }, }; - const program = DynamoDBService.putItem(args).pipe( + const program = DynamoDB.putItem(args).pipe( Effect.catchTag("NotHandledException" as any, () => Effect.succeed(null)), ); const result = await pipe( program, - Effect.provide(DefaultDynamoDBServiceLayer), + Effect.provide(DynamoDB.defaultLayer), Effect.runPromiseExit, ); diff --git a/packages/client-ec2/README.md b/packages/client-ec2/README.md index b3fa7dd..1ce01b7 100644 --- a/packages/client-ec2/README.md +++ b/packages/client-ec2/README.md @@ -1 +1,58 @@ -# replace this \ No newline at end of file +# @effect-aws/client-ec2 + +[![npm version](https://img.shields.io/npm/v/%40effect-aws%2Fclient-ec2?color=brightgreen&label=npm%20package)](https://www.npmjs.com/package/@effect-aws/client-ec2) +[![npm downloads](https://img.shields.io/npm/dm/%40effect-aws%2Fclient-ec2)](https://www.npmjs.com/package/@effect-aws/client-ec2) + +## Installation + +```bash +npm install --save @effect-aws/client-ec2 +``` + +## Usage + +With default EC2Client instance: + +```typescript +import { EC2 } from "@effect-aws/client-ec2"; + +const program = EC2.acceptAddressTransfer(args); + +const result = pipe( + program, + Effect.provide(EC2.defaultLayer), + Effect.runPromise, +); +``` + +With custom EC2Client instance: + +```typescript +import { EC2 } from "@effect-aws/client-ec2"; + +const program = EC2.acceptAddressTransfer(args); + +const result = await pipe( + program, + Effect.provide( + EC2.baseLayer(() => new EC2Client({ region: "eu-central-1" })), + ), + Effect.runPromise, +); +``` + +With custom EC2Client configuration: + +```typescript +import { EC2 } from "@effect-aws/client-ec2"; + +const program = EC2.acceptAddressTransfer(args); + +const result = await pipe( + program, + Effect.provide(EC2.layer({ region: "eu-central-1" })), + Effect.runPromiseExit, +); +``` + +or use `EC2.baseLayer((default) => new EC2Client({ ...default, region: "eu-central-1" }))` diff --git a/packages/client-ec2/src/EC2ClientInstanceConfig.ts b/packages/client-ec2/src/EC2ClientInstanceConfig.ts index 67de4f4..d3d79fa 100644 --- a/packages/client-ec2/src/EC2ClientInstanceConfig.ts +++ b/packages/client-ec2/src/EC2ClientInstanceConfig.ts @@ -2,10 +2,7 @@ * @since 1.0.0 */ import type { EC2ClientConfig } from "@aws-sdk/client-ec2"; -import * as Context from "effect/Context"; -import * as Effect from "effect/Effect"; -import * as Layer from "effect/Layer"; -import * as Runtime from "effect/Runtime"; +import { Context, Effect, Layer, Runtime } from "effect"; /** * @since 1.0.0 diff --git a/packages/client-ec2/src/EC2Service.ts b/packages/client-ec2/src/EC2Service.ts index 4183c31..2887f00 100644 --- a/packages/client-ec2/src/EC2Service.ts +++ b/packages/client-ec2/src/EC2Service.ts @@ -2,10 +2,12 @@ * @since 1.0.0 */ import { - EC2ServiceException, AcceptAddressTransferCommand, type AcceptAddressTransferCommandInput, type AcceptAddressTransferCommandOutput, + AcceptCapacityReservationBillingOwnershipCommand, + type AcceptCapacityReservationBillingOwnershipCommandInput, + type AcceptCapacityReservationBillingOwnershipCommandOutput, AcceptReservedInstancesExchangeQuoteCommand, type AcceptReservedInstancesExchangeQuoteCommandInput, type AcceptReservedInstancesExchangeQuoteCommandOutput, @@ -51,6 +53,9 @@ import { AssociateAddressCommand, type AssociateAddressCommandInput, type AssociateAddressCommandOutput, + AssociateCapacityReservationBillingOwnerCommand, + type AssociateCapacityReservationBillingOwnerCommandInput, + type AssociateCapacityReservationBillingOwnerCommandOutput, AssociateClientVpnTargetNetworkCommand, type AssociateClientVpnTargetNetworkCommandInput, type AssociateClientVpnTargetNetworkCommandOutput, @@ -78,6 +83,9 @@ import { AssociateRouteTableCommand, type AssociateRouteTableCommandInput, type AssociateRouteTableCommandOutput, + AssociateSecurityGroupVpcCommand, + type AssociateSecurityGroupVpcCommandInput, + type AssociateSecurityGroupVpcCommandOutput, AssociateSubnetCidrBlockCommand, type AssociateSubnetCidrBlockCommandInput, type AssociateSubnetCidrBlockCommandOutput, @@ -168,6 +176,9 @@ import { CopySnapshotCommand, type CopySnapshotCommandInput, type CopySnapshotCommandOutput, + CreateCapacityReservationBySplittingCommand, + type CreateCapacityReservationBySplittingCommandInput, + type CreateCapacityReservationBySplittingCommandOutput, CreateCapacityReservationCommand, type CreateCapacityReservationCommandInput, type CreateCapacityReservationCommandOutput, @@ -231,6 +242,9 @@ import { CreateIpamCommand, type CreateIpamCommandInput, type CreateIpamCommandOutput, + CreateIpamExternalResourceVerificationTokenCommand, + type CreateIpamExternalResourceVerificationTokenCommandInput, + type CreateIpamExternalResourceVerificationTokenCommandOutput, CreateIpamPoolCommand, type CreateIpamPoolCommandInput, type CreateIpamPoolCommandOutput, @@ -321,12 +335,12 @@ import { CreateStoreImageTaskCommand, type CreateStoreImageTaskCommandInput, type CreateStoreImageTaskCommandOutput, - CreateSubnetCommand, - type CreateSubnetCommandInput, - type CreateSubnetCommandOutput, CreateSubnetCidrReservationCommand, type CreateSubnetCidrReservationCommandInput, type CreateSubnetCidrReservationCommandOutput, + CreateSubnetCommand, + type CreateSubnetCommandInput, + type CreateSubnetCommandOutput, CreateTagsCommand, type CreateTagsCommandInput, type CreateTagsCommandOutput, @@ -366,12 +380,12 @@ import { CreateTransitGatewayRouteCommand, type CreateTransitGatewayRouteCommandInput, type CreateTransitGatewayRouteCommandOutput, - CreateTransitGatewayRouteTableCommand, - type CreateTransitGatewayRouteTableCommandInput, - type CreateTransitGatewayRouteTableCommandOutput, CreateTransitGatewayRouteTableAnnouncementCommand, type CreateTransitGatewayRouteTableAnnouncementCommandInput, type CreateTransitGatewayRouteTableAnnouncementCommandOutput, + CreateTransitGatewayRouteTableCommand, + type CreateTransitGatewayRouteTableCommandInput, + type CreateTransitGatewayRouteTableCommandOutput, CreateTransitGatewayVpcAttachmentCommand, type CreateTransitGatewayVpcAttachmentCommandInput, type CreateTransitGatewayVpcAttachmentCommandOutput, @@ -459,6 +473,9 @@ import { DeleteIpamCommand, type DeleteIpamCommandInput, type DeleteIpamCommandOutput, + DeleteIpamExternalResourceVerificationTokenCommand, + type DeleteIpamExternalResourceVerificationTokenCommandInput, + type DeleteIpamExternalResourceVerificationTokenCommandOutput, DeleteIpamPoolCommand, type DeleteIpamPoolCommandInput, type DeleteIpamPoolCommandOutput, @@ -501,12 +518,12 @@ import { DeleteNetworkAclEntryCommand, type DeleteNetworkAclEntryCommandInput, type DeleteNetworkAclEntryCommandOutput, - DeleteNetworkInsightsAccessScopeCommand, - type DeleteNetworkInsightsAccessScopeCommandInput, - type DeleteNetworkInsightsAccessScopeCommandOutput, DeleteNetworkInsightsAccessScopeAnalysisCommand, type DeleteNetworkInsightsAccessScopeAnalysisCommandInput, type DeleteNetworkInsightsAccessScopeAnalysisCommandOutput, + DeleteNetworkInsightsAccessScopeCommand, + type DeleteNetworkInsightsAccessScopeCommandInput, + type DeleteNetworkInsightsAccessScopeCommandOutput, DeleteNetworkInsightsAnalysisCommand, type DeleteNetworkInsightsAnalysisCommandInput, type DeleteNetworkInsightsAnalysisCommandOutput, @@ -543,12 +560,12 @@ import { DeleteSpotDatafeedSubscriptionCommand, type DeleteSpotDatafeedSubscriptionCommandInput, type DeleteSpotDatafeedSubscriptionCommandOutput, - DeleteSubnetCommand, - type DeleteSubnetCommandInput, - type DeleteSubnetCommandOutput, DeleteSubnetCidrReservationCommand, type DeleteSubnetCidrReservationCommandInput, type DeleteSubnetCidrReservationCommandOutput, + DeleteSubnetCommand, + type DeleteSubnetCommandInput, + type DeleteSubnetCommandOutput, DeleteTagsCommand, type DeleteTagsCommandInput, type DeleteTagsCommandOutput, @@ -588,12 +605,12 @@ import { DeleteTransitGatewayRouteCommand, type DeleteTransitGatewayRouteCommandInput, type DeleteTransitGatewayRouteCommandOutput, - DeleteTransitGatewayRouteTableCommand, - type DeleteTransitGatewayRouteTableCommandInput, - type DeleteTransitGatewayRouteTableCommandOutput, DeleteTransitGatewayRouteTableAnnouncementCommand, type DeleteTransitGatewayRouteTableAnnouncementCommandInput, type DeleteTransitGatewayRouteTableAnnouncementCommandOutput, + DeleteTransitGatewayRouteTableCommand, + type DeleteTransitGatewayRouteTableCommandInput, + type DeleteTransitGatewayRouteTableCommandOutput, DeleteTransitGatewayVpcAttachmentCommand, type DeleteTransitGatewayVpcAttachmentCommandInput, type DeleteTransitGatewayVpcAttachmentCommandOutput, @@ -618,12 +635,12 @@ import { DeleteVpcEndpointConnectionNotificationsCommand, type DeleteVpcEndpointConnectionNotificationsCommandInput, type DeleteVpcEndpointConnectionNotificationsCommandOutput, - DeleteVpcEndpointsCommand, - type DeleteVpcEndpointsCommandInput, - type DeleteVpcEndpointsCommandOutput, DeleteVpcEndpointServiceConfigurationsCommand, type DeleteVpcEndpointServiceConfigurationsCommandInput, type DeleteVpcEndpointServiceConfigurationsCommandOutput, + DeleteVpcEndpointsCommand, + type DeleteVpcEndpointsCommandInput, + type DeleteVpcEndpointsCommandOutput, DeleteVpcPeeringConnectionCommand, type DeleteVpcPeeringConnectionCommandInput, type DeleteVpcPeeringConnectionCommandOutput, @@ -663,15 +680,15 @@ import { DescribeAccountAttributesCommand, type DescribeAccountAttributesCommandInput, type DescribeAccountAttributesCommandOutput, - DescribeAddressesCommand, - type DescribeAddressesCommandInput, - type DescribeAddressesCommandOutput, - DescribeAddressesAttributeCommand, - type DescribeAddressesAttributeCommandInput, - type DescribeAddressesAttributeCommandOutput, DescribeAddressTransfersCommand, type DescribeAddressTransfersCommandInput, type DescribeAddressTransfersCommandOutput, + DescribeAddressesAttributeCommand, + type DescribeAddressesAttributeCommandInput, + type DescribeAddressesAttributeCommandOutput, + DescribeAddressesCommand, + type DescribeAddressesCommandInput, + type DescribeAddressesCommandOutput, DescribeAggregateIdFormatCommand, type DescribeAggregateIdFormatCommandInput, type DescribeAggregateIdFormatCommandOutput, @@ -690,6 +707,9 @@ import { DescribeCapacityBlockOfferingsCommand, type DescribeCapacityBlockOfferingsCommandInput, type DescribeCapacityBlockOfferingsCommandOutput, + DescribeCapacityReservationBillingRequestsCommand, + type DescribeCapacityReservationBillingRequestsCommandInput, + type DescribeCapacityReservationBillingRequestsCommandOutput, DescribeCapacityReservationFleetsCommand, type DescribeCapacityReservationFleetsCommandInput, type DescribeCapacityReservationFleetsCommandOutput, @@ -777,12 +797,12 @@ import { DescribeIamInstanceProfileAssociationsCommand, type DescribeIamInstanceProfileAssociationsCommandInput, type DescribeIamInstanceProfileAssociationsCommandOutput, - DescribeIdentityIdFormatCommand, - type DescribeIdentityIdFormatCommandInput, - type DescribeIdentityIdFormatCommandOutput, DescribeIdFormatCommand, type DescribeIdFormatCommandInput, type DescribeIdFormatCommandOutput, + DescribeIdentityIdFormatCommand, + type DescribeIdentityIdFormatCommandInput, + type DescribeIdentityIdFormatCommandOutput, DescribeImageAttributeCommand, type DescribeImageAttributeCommandInput, type DescribeImageAttributeCommandOutput, @@ -810,9 +830,9 @@ import { DescribeInstanceEventWindowsCommand, type DescribeInstanceEventWindowsCommandInput, type DescribeInstanceEventWindowsCommandOutput, - DescribeInstancesCommand, - type DescribeInstancesCommandInput, - type DescribeInstancesCommandOutput, + DescribeInstanceImageMetadataCommand, + type DescribeInstanceImageMetadataCommandInput, + type DescribeInstanceImageMetadataCommandOutput, DescribeInstanceStatusCommand, type DescribeInstanceStatusCommandInput, type DescribeInstanceStatusCommandOutput, @@ -825,12 +845,18 @@ import { DescribeInstanceTypesCommand, type DescribeInstanceTypesCommandInput, type DescribeInstanceTypesCommandOutput, + DescribeInstancesCommand, + type DescribeInstancesCommandInput, + type DescribeInstancesCommandOutput, DescribeInternetGatewaysCommand, type DescribeInternetGatewaysCommandInput, type DescribeInternetGatewaysCommandOutput, DescribeIpamByoasnCommand, type DescribeIpamByoasnCommandInput, type DescribeIpamByoasnCommandOutput, + DescribeIpamExternalResourceVerificationTokensCommand, + type DescribeIpamExternalResourceVerificationTokensCommandInput, + type DescribeIpamExternalResourceVerificationTokensCommandOutput, DescribeIpamPoolsCommand, type DescribeIpamPoolsCommandInput, type DescribeIpamPoolsCommandOutput, @@ -840,45 +866,48 @@ import { DescribeIpamResourceDiscoveryAssociationsCommand, type DescribeIpamResourceDiscoveryAssociationsCommandInput, type DescribeIpamResourceDiscoveryAssociationsCommandOutput, - DescribeIpamsCommand, - type DescribeIpamsCommandInput, - type DescribeIpamsCommandOutput, DescribeIpamScopesCommand, type DescribeIpamScopesCommandInput, type DescribeIpamScopesCommandOutput, + DescribeIpamsCommand, + type DescribeIpamsCommandInput, + type DescribeIpamsCommandOutput, DescribeIpv6PoolsCommand, type DescribeIpv6PoolsCommandInput, type DescribeIpv6PoolsCommandOutput, DescribeKeyPairsCommand, type DescribeKeyPairsCommandInput, type DescribeKeyPairsCommandOutput, - DescribeLaunchTemplatesCommand, - type DescribeLaunchTemplatesCommandInput, - type DescribeLaunchTemplatesCommandOutput, DescribeLaunchTemplateVersionsCommand, type DescribeLaunchTemplateVersionsCommandInput, type DescribeLaunchTemplateVersionsCommandOutput, - DescribeLocalGatewayRouteTablesCommand, - type DescribeLocalGatewayRouteTablesCommandInput, - type DescribeLocalGatewayRouteTablesCommandOutput, + DescribeLaunchTemplatesCommand, + type DescribeLaunchTemplatesCommandInput, + type DescribeLaunchTemplatesCommandOutput, DescribeLocalGatewayRouteTableVirtualInterfaceGroupAssociationsCommand, type DescribeLocalGatewayRouteTableVirtualInterfaceGroupAssociationsCommandInput, type DescribeLocalGatewayRouteTableVirtualInterfaceGroupAssociationsCommandOutput, DescribeLocalGatewayRouteTableVpcAssociationsCommand, type DescribeLocalGatewayRouteTableVpcAssociationsCommandInput, type DescribeLocalGatewayRouteTableVpcAssociationsCommandOutput, - DescribeLocalGatewaysCommand, - type DescribeLocalGatewaysCommandInput, - type DescribeLocalGatewaysCommandOutput, + DescribeLocalGatewayRouteTablesCommand, + type DescribeLocalGatewayRouteTablesCommandInput, + type DescribeLocalGatewayRouteTablesCommandOutput, DescribeLocalGatewayVirtualInterfaceGroupsCommand, type DescribeLocalGatewayVirtualInterfaceGroupsCommandInput, type DescribeLocalGatewayVirtualInterfaceGroupsCommandOutput, DescribeLocalGatewayVirtualInterfacesCommand, type DescribeLocalGatewayVirtualInterfacesCommandInput, type DescribeLocalGatewayVirtualInterfacesCommandOutput, + DescribeLocalGatewaysCommand, + type DescribeLocalGatewaysCommandInput, + type DescribeLocalGatewaysCommandOutput, DescribeLockedSnapshotsCommand, type DescribeLockedSnapshotsCommandInput, type DescribeLockedSnapshotsCommandOutput, + DescribeMacHostsCommand, + type DescribeMacHostsCommandInput, + type DescribeMacHostsCommandOutput, DescribeManagedPrefixListsCommand, type DescribeManagedPrefixListsCommandInput, type DescribeManagedPrefixListsCommandOutput, @@ -957,18 +986,21 @@ import { DescribeSecurityGroupRulesCommand, type DescribeSecurityGroupRulesCommandInput, type DescribeSecurityGroupRulesCommandOutput, + DescribeSecurityGroupVpcAssociationsCommand, + type DescribeSecurityGroupVpcAssociationsCommandInput, + type DescribeSecurityGroupVpcAssociationsCommandOutput, DescribeSecurityGroupsCommand, type DescribeSecurityGroupsCommandInput, type DescribeSecurityGroupsCommandOutput, DescribeSnapshotAttributeCommand, type DescribeSnapshotAttributeCommandInput, type DescribeSnapshotAttributeCommandOutput, - DescribeSnapshotsCommand, - type DescribeSnapshotsCommandInput, - type DescribeSnapshotsCommandOutput, DescribeSnapshotTierStatusCommand, type DescribeSnapshotTierStatusCommandInput, type DescribeSnapshotTierStatusCommandOutput, + DescribeSnapshotsCommand, + type DescribeSnapshotsCommandInput, + type DescribeSnapshotsCommandOutput, DescribeSpotDatafeedSubscriptionCommand, type DescribeSpotDatafeedSubscriptionCommandInput, type DescribeSpotDatafeedSubscriptionCommandOutput, @@ -999,6 +1031,9 @@ import { DescribeTagsCommand, type DescribeTagsCommandInput, type DescribeTagsCommandOutput, + DescribeTrafficMirrorFilterRulesCommand, + type DescribeTrafficMirrorFilterRulesCommandInput, + type DescribeTrafficMirrorFilterRulesCommandOutput, DescribeTrafficMirrorFiltersCommand, type DescribeTrafficMirrorFiltersCommandInput, type DescribeTrafficMirrorFiltersCommandOutput, @@ -1032,12 +1067,12 @@ import { DescribeTransitGatewayRouteTablesCommand, type DescribeTransitGatewayRouteTablesCommandInput, type DescribeTransitGatewayRouteTablesCommandOutput, - DescribeTransitGatewaysCommand, - type DescribeTransitGatewaysCommandInput, - type DescribeTransitGatewaysCommandOutput, DescribeTransitGatewayVpcAttachmentsCommand, type DescribeTransitGatewayVpcAttachmentsCommandInput, type DescribeTransitGatewayVpcAttachmentsCommandOutput, + DescribeTransitGatewaysCommand, + type DescribeTransitGatewaysCommandInput, + type DescribeTransitGatewaysCommandOutput, DescribeTrunkInterfaceAssociationsCommand, type DescribeTrunkInterfaceAssociationsCommandInput, type DescribeTrunkInterfaceAssociationsCommandOutput, @@ -1059,15 +1094,15 @@ import { DescribeVolumeAttributeCommand, type DescribeVolumeAttributeCommandInput, type DescribeVolumeAttributeCommandOutput, + DescribeVolumeStatusCommand, + type DescribeVolumeStatusCommandInput, + type DescribeVolumeStatusCommandOutput, DescribeVolumesCommand, type DescribeVolumesCommandInput, type DescribeVolumesCommandOutput, DescribeVolumesModificationsCommand, type DescribeVolumesModificationsCommandInput, type DescribeVolumesModificationsCommandOutput, - DescribeVolumeStatusCommand, - type DescribeVolumeStatusCommandInput, - type DescribeVolumeStatusCommandOutput, DescribeVpcAttributeCommand, type DescribeVpcAttributeCommandInput, type DescribeVpcAttributeCommandOutput, @@ -1083,9 +1118,6 @@ import { DescribeVpcEndpointConnectionsCommand, type DescribeVpcEndpointConnectionsCommandInput, type DescribeVpcEndpointConnectionsCommandOutput, - DescribeVpcEndpointsCommand, - type DescribeVpcEndpointsCommandInput, - type DescribeVpcEndpointsCommandOutput, DescribeVpcEndpointServiceConfigurationsCommand, type DescribeVpcEndpointServiceConfigurationsCommandInput, type DescribeVpcEndpointServiceConfigurationsCommandOutput, @@ -1095,6 +1127,9 @@ import { DescribeVpcEndpointServicesCommand, type DescribeVpcEndpointServicesCommandInput, type DescribeVpcEndpointServicesCommandOutput, + DescribeVpcEndpointsCommand, + type DescribeVpcEndpointsCommandInput, + type DescribeVpcEndpointsCommandOutput, DescribeVpcPeeringConnectionsCommand, type DescribeVpcPeeringConnectionsCommandInput, type DescribeVpcPeeringConnectionsCommandOutput, @@ -1140,15 +1175,18 @@ import { DisableFastSnapshotRestoresCommand, type DisableFastSnapshotRestoresCommandInput, type DisableFastSnapshotRestoresCommandOutput, - DisableImageCommand, - type DisableImageCommandInput, - type DisableImageCommandOutput, DisableImageBlockPublicAccessCommand, type DisableImageBlockPublicAccessCommandInput, type DisableImageBlockPublicAccessCommandOutput, + DisableImageCommand, + type DisableImageCommandInput, + type DisableImageCommandOutput, DisableImageDeprecationCommand, type DisableImageDeprecationCommandInput, type DisableImageDeprecationCommandOutput, + DisableImageDeregistrationProtectionCommand, + type DisableImageDeregistrationProtectionCommandInput, + type DisableImageDeregistrationProtectionCommandOutput, DisableIpamOrganizationAdminAccountCommand, type DisableIpamOrganizationAdminAccountCommandInput, type DisableIpamOrganizationAdminAccountCommandOutput, @@ -1173,6 +1211,9 @@ import { DisassociateAddressCommand, type DisassociateAddressCommandInput, type DisassociateAddressCommandOutput, + DisassociateCapacityReservationBillingOwnerCommand, + type DisassociateCapacityReservationBillingOwnerCommandInput, + type DisassociateCapacityReservationBillingOwnerCommandOutput, DisassociateClientVpnTargetNetworkCommand, type DisassociateClientVpnTargetNetworkCommandInput, type DisassociateClientVpnTargetNetworkCommandOutput, @@ -1197,6 +1238,9 @@ import { DisassociateRouteTableCommand, type DisassociateRouteTableCommandInput, type DisassociateRouteTableCommandOutput, + DisassociateSecurityGroupVpcCommand, + type DisassociateSecurityGroupVpcCommandInput, + type DisassociateSecurityGroupVpcCommandOutput, DisassociateSubnetCidrBlockCommand, type DisassociateSubnetCidrBlockCommandInput, type DisassociateSubnetCidrBlockCommandOutput, @@ -1215,6 +1259,9 @@ import { DisassociateVpcCidrBlockCommand, type DisassociateVpcCidrBlockCommandInput, type DisassociateVpcCidrBlockCommandOutput, + type EC2Client, + type EC2ClientConfig, + EC2ServiceException, EnableAddressTransferCommand, type EnableAddressTransferCommandInput, type EnableAddressTransferCommandOutput, @@ -1230,15 +1277,18 @@ import { EnableFastSnapshotRestoresCommand, type EnableFastSnapshotRestoresCommandInput, type EnableFastSnapshotRestoresCommandOutput, - EnableImageCommand, - type EnableImageCommandInput, - type EnableImageCommandOutput, EnableImageBlockPublicAccessCommand, type EnableImageBlockPublicAccessCommandInput, type EnableImageBlockPublicAccessCommandOutput, + EnableImageCommand, + type EnableImageCommandInput, + type EnableImageCommandOutput, EnableImageDeprecationCommand, type EnableImageDeprecationCommandInput, type EnableImageDeprecationCommandOutput, + EnableImageDeregistrationProtectionCommand, + type EnableImageDeregistrationProtectionCommandInput, + type EnableImageDeregistrationProtectionCommandOutput, EnableIpamOrganizationAdminAccountCommand, type EnableIpamOrganizationAdminAccountCommandInput, type EnableIpamOrganizationAdminAccountCommandOutput, @@ -1320,6 +1370,12 @@ import { GetImageBlockPublicAccessStateCommand, type GetImageBlockPublicAccessStateCommandInput, type GetImageBlockPublicAccessStateCommandOutput, + GetInstanceMetadataDefaultsCommand, + type GetInstanceMetadataDefaultsCommandInput, + type GetInstanceMetadataDefaultsCommandOutput, + GetInstanceTpmEkPubCommand, + type GetInstanceTpmEkPubCommandInput, + type GetInstanceTpmEkPubCommandOutput, GetInstanceTypesFromInstanceRequirementsCommand, type GetInstanceTypesFromInstanceRequirementsCommandInput, type GetInstanceTypesFromInstanceRequirementsCommandOutput, @@ -1476,12 +1532,12 @@ import { ModifyHostsCommand, type ModifyHostsCommandInput, type ModifyHostsCommandOutput, - ModifyIdentityIdFormatCommand, - type ModifyIdentityIdFormatCommandInput, - type ModifyIdentityIdFormatCommandOutput, ModifyIdFormatCommand, type ModifyIdFormatCommandInput, type ModifyIdFormatCommandOutput, + ModifyIdentityIdFormatCommand, + type ModifyIdentityIdFormatCommandInput, + type ModifyIdentityIdFormatCommandOutput, ModifyImageAttributeCommand, type ModifyImageAttributeCommandInput, type ModifyImageAttributeCommandOutput, @@ -1491,6 +1547,9 @@ import { ModifyInstanceCapacityReservationAttributesCommand, type ModifyInstanceCapacityReservationAttributesCommandInput, type ModifyInstanceCapacityReservationAttributesCommandOutput, + ModifyInstanceCpuOptionsCommand, + type ModifyInstanceCpuOptionsCommandInput, + type ModifyInstanceCpuOptionsCommandOutput, ModifyInstanceCreditSpecificationCommand, type ModifyInstanceCreditSpecificationCommandInput, type ModifyInstanceCreditSpecificationCommandOutput, @@ -1503,6 +1562,9 @@ import { ModifyInstanceMaintenanceOptionsCommand, type ModifyInstanceMaintenanceOptionsCommandInput, type ModifyInstanceMaintenanceOptionsCommandOutput, + ModifyInstanceMetadataDefaultsCommand, + type ModifyInstanceMetadataDefaultsCommandInput, + type ModifyInstanceMetadataDefaultsCommandOutput, ModifyInstanceMetadataOptionsCommand, type ModifyInstanceMetadataOptionsCommandInput, type ModifyInstanceMetadataOptionsCommandOutput, @@ -1596,12 +1658,12 @@ import { ModifyVerifiedAccessTrustProviderCommand, type ModifyVerifiedAccessTrustProviderCommandInput, type ModifyVerifiedAccessTrustProviderCommandOutput, - ModifyVolumeCommand, - type ModifyVolumeCommandInput, - type ModifyVolumeCommandOutput, ModifyVolumeAttributeCommand, type ModifyVolumeAttributeCommandInput, type ModifyVolumeAttributeCommandOutput, + ModifyVolumeCommand, + type ModifyVolumeCommandInput, + type ModifyVolumeCommandOutput, ModifyVpcAttributeCommand, type ModifyVpcAttributeCommandInput, type ModifyVpcAttributeCommandOutput, @@ -1647,6 +1709,9 @@ import { MoveByoipCidrToIpamCommand, type MoveByoipCidrToIpamCommandInput, type MoveByoipCidrToIpamCommandOutput, + MoveCapacityReservationInstancesCommand, + type MoveCapacityReservationInstancesCommandInput, + type MoveCapacityReservationInstancesCommandOutput, ProvisionByoipCidrCommand, type ProvisionByoipCidrCommandInput, type ProvisionByoipCidrCommandOutput, @@ -1686,6 +1751,9 @@ import { RegisterTransitGatewayMulticastGroupSourcesCommand, type RegisterTransitGatewayMulticastGroupSourcesCommandInput, type RegisterTransitGatewayMulticastGroupSourcesCommandOutput, + RejectCapacityReservationBillingOwnershipCommand, + type RejectCapacityReservationBillingOwnershipCommandInput, + type RejectCapacityReservationBillingOwnershipCommandOutput, RejectTransitGatewayMulticastDomainAssociationsCommand, type RejectTransitGatewayMulticastDomainAssociationsCommandInput, type RejectTransitGatewayMulticastDomainAssociationsCommandOutput, @@ -1849,13 +1917,17 @@ import { type WithdrawByoipCidrCommandInput, type WithdrawByoipCidrCommandOutput, } from "@aws-sdk/client-ec2"; -import { Effect, Layer, Record, Data } from "effect"; +import { Data, Effect, Layer, Record } from "effect"; import { EC2ClientInstance, EC2ClientInstanceLayer } from "./EC2ClientInstance"; -import { DefaultEC2ClientConfigLayer } from "./EC2ClientInstanceConfig"; +import { + DefaultEC2ClientConfigLayer, + EC2ClientInstanceConfig, + makeDefaultEC2ClientInstanceConfig, +} from "./EC2ClientInstanceConfig"; import { EC2ServiceError, SdkError, TaggedException } from "./Errors"; /** - * @since 1.2.1 + * @since 1.0.0 */ export interface HttpHandlerOptions { /** @@ -1867,6 +1939,7 @@ export interface HttpHandlerOptions { const commands = { AcceptAddressTransferCommand, + AcceptCapacityReservationBillingOwnershipCommand, AcceptReservedInstancesExchangeQuoteCommand, AcceptTransitGatewayMulticastDomainAssociationsCommand, AcceptTransitGatewayPeeringAttachmentCommand, @@ -1882,6 +1955,7 @@ const commands = { AssignPrivateIpAddressesCommand, AssignPrivateNatGatewayAddressCommand, AssociateAddressCommand, + AssociateCapacityReservationBillingOwnerCommand, AssociateClientVpnTargetNetworkCommand, AssociateDhcpOptionsCommand, AssociateEnclaveCertificateIamRoleCommand, @@ -1891,6 +1965,7 @@ const commands = { AssociateIpamResourceDiscoveryCommand, AssociateNatGatewayAddressCommand, AssociateRouteTableCommand, + AssociateSecurityGroupVpcCommand, AssociateSubnetCidrBlockCommand, AssociateTransitGatewayMulticastDomainCommand, AssociateTransitGatewayPolicyTableCommand, @@ -1922,6 +1997,7 @@ const commands = { CopyImageCommand, CopySnapshotCommand, CreateCapacityReservationCommand, + CreateCapacityReservationBySplittingCommand, CreateCapacityReservationFleetCommand, CreateCarrierGatewayCommand, CreateClientVpnEndpointCommand, @@ -1942,6 +2018,7 @@ const commands = { CreateInstanceExportTaskCommand, CreateInternetGatewayCommand, CreateIpamCommand, + CreateIpamExternalResourceVerificationTokenCommand, CreateIpamPoolCommand, CreateIpamResourceDiscoveryCommand, CreateIpamScopeCommand, @@ -2018,6 +2095,7 @@ const commands = { DeleteInstanceEventWindowCommand, DeleteInternetGatewayCommand, DeleteIpamCommand, + DeleteIpamExternalResourceVerificationTokenCommand, DeleteIpamPoolCommand, DeleteIpamResourceDiscoveryCommand, DeleteIpamScopeCommand, @@ -2071,8 +2149,8 @@ const commands = { DeleteVolumeCommand, DeleteVpcCommand, DeleteVpcEndpointConnectionNotificationsCommand, - DeleteVpcEndpointsCommand, DeleteVpcEndpointServiceConfigurationsCommand, + DeleteVpcEndpointsCommand, DeleteVpcPeeringConnectionCommand, DeleteVpnConnectionCommand, DeleteVpnConnectionRouteCommand, @@ -2086,15 +2164,16 @@ const commands = { DeregisterTransitGatewayMulticastGroupMembersCommand, DeregisterTransitGatewayMulticastGroupSourcesCommand, DescribeAccountAttributesCommand, + DescribeAddressTransfersCommand, DescribeAddressesCommand, DescribeAddressesAttributeCommand, - DescribeAddressTransfersCommand, DescribeAggregateIdFormatCommand, DescribeAvailabilityZonesCommand, DescribeAwsNetworkPerformanceMetricSubscriptionsCommand, DescribeBundleTasksCommand, DescribeByoipCidrsCommand, DescribeCapacityBlockOfferingsCommand, + DescribeCapacityReservationBillingRequestsCommand, DescribeCapacityReservationFleetsCommand, DescribeCapacityReservationsCommand, DescribeCarrierGatewaysCommand, @@ -2124,8 +2203,8 @@ const commands = { DescribeHostReservationsCommand, DescribeHostsCommand, DescribeIamInstanceProfileAssociationsCommand, - DescribeIdentityIdFormatCommand, DescribeIdFormatCommand, + DescribeIdentityIdFormatCommand, DescribeImageAttributeCommand, DescribeImagesCommand, DescribeImportImageTasksCommand, @@ -2135,29 +2214,32 @@ const commands = { DescribeInstanceCreditSpecificationsCommand, DescribeInstanceEventNotificationAttributesCommand, DescribeInstanceEventWindowsCommand, - DescribeInstancesCommand, + DescribeInstanceImageMetadataCommand, DescribeInstanceStatusCommand, DescribeInstanceTopologyCommand, DescribeInstanceTypeOfferingsCommand, DescribeInstanceTypesCommand, + DescribeInstancesCommand, DescribeInternetGatewaysCommand, DescribeIpamByoasnCommand, + DescribeIpamExternalResourceVerificationTokensCommand, DescribeIpamPoolsCommand, DescribeIpamResourceDiscoveriesCommand, DescribeIpamResourceDiscoveryAssociationsCommand, - DescribeIpamsCommand, DescribeIpamScopesCommand, + DescribeIpamsCommand, DescribeIpv6PoolsCommand, DescribeKeyPairsCommand, - DescribeLaunchTemplatesCommand, DescribeLaunchTemplateVersionsCommand, - DescribeLocalGatewayRouteTablesCommand, + DescribeLaunchTemplatesCommand, DescribeLocalGatewayRouteTableVirtualInterfaceGroupAssociationsCommand, DescribeLocalGatewayRouteTableVpcAssociationsCommand, - DescribeLocalGatewaysCommand, + DescribeLocalGatewayRouteTablesCommand, DescribeLocalGatewayVirtualInterfaceGroupsCommand, DescribeLocalGatewayVirtualInterfacesCommand, + DescribeLocalGatewaysCommand, DescribeLockedSnapshotsCommand, + DescribeMacHostsCommand, DescribeManagedPrefixListsCommand, DescribeMovingAddressesCommand, DescribeNatGatewaysCommand, @@ -2184,10 +2266,11 @@ const commands = { DescribeScheduledInstancesCommand, DescribeSecurityGroupReferencesCommand, DescribeSecurityGroupRulesCommand, + DescribeSecurityGroupVpcAssociationsCommand, DescribeSecurityGroupsCommand, DescribeSnapshotAttributeCommand, - DescribeSnapshotsCommand, DescribeSnapshotTierStatusCommand, + DescribeSnapshotsCommand, DescribeSpotDatafeedSubscriptionCommand, DescribeSpotFleetInstancesCommand, DescribeSpotFleetRequestHistoryCommand, @@ -2198,6 +2281,7 @@ const commands = { DescribeStoreImageTasksCommand, DescribeSubnetsCommand, DescribeTagsCommand, + DescribeTrafficMirrorFilterRulesCommand, DescribeTrafficMirrorFiltersCommand, DescribeTrafficMirrorSessionsCommand, DescribeTrafficMirrorTargetsCommand, @@ -2209,8 +2293,8 @@ const commands = { DescribeTransitGatewayPolicyTablesCommand, DescribeTransitGatewayRouteTableAnnouncementsCommand, DescribeTransitGatewayRouteTablesCommand, - DescribeTransitGatewaysCommand, DescribeTransitGatewayVpcAttachmentsCommand, + DescribeTransitGatewaysCommand, DescribeTrunkInterfaceAssociationsCommand, DescribeVerifiedAccessEndpointsCommand, DescribeVerifiedAccessGroupsCommand, @@ -2218,18 +2302,18 @@ const commands = { DescribeVerifiedAccessInstancesCommand, DescribeVerifiedAccessTrustProvidersCommand, DescribeVolumeAttributeCommand, + DescribeVolumeStatusCommand, DescribeVolumesCommand, DescribeVolumesModificationsCommand, - DescribeVolumeStatusCommand, DescribeVpcAttributeCommand, DescribeVpcClassicLinkCommand, DescribeVpcClassicLinkDnsSupportCommand, DescribeVpcEndpointConnectionNotificationsCommand, DescribeVpcEndpointConnectionsCommand, - DescribeVpcEndpointsCommand, DescribeVpcEndpointServiceConfigurationsCommand, DescribeVpcEndpointServicePermissionsCommand, DescribeVpcEndpointServicesCommand, + DescribeVpcEndpointsCommand, DescribeVpcPeeringConnectionsCommand, DescribeVpcsCommand, DescribeVpnConnectionsCommand, @@ -2248,6 +2332,7 @@ const commands = { DisableImageCommand, DisableImageBlockPublicAccessCommand, DisableImageDeprecationCommand, + DisableImageDeregistrationProtectionCommand, DisableIpamOrganizationAdminAccountCommand, DisableSerialConsoleAccessCommand, DisableSnapshotBlockPublicAccessCommand, @@ -2256,6 +2341,7 @@ const commands = { DisableVpcClassicLinkCommand, DisableVpcClassicLinkDnsSupportCommand, DisassociateAddressCommand, + DisassociateCapacityReservationBillingOwnerCommand, DisassociateClientVpnTargetNetworkCommand, DisassociateEnclaveCertificateIamRoleCommand, DisassociateIamInstanceProfileCommand, @@ -2264,6 +2350,7 @@ const commands = { DisassociateIpamResourceDiscoveryCommand, DisassociateNatGatewayAddressCommand, DisassociateRouteTableCommand, + DisassociateSecurityGroupVpcCommand, DisassociateSubnetCidrBlockCommand, DisassociateTransitGatewayMulticastDomainCommand, DisassociateTransitGatewayPolicyTableCommand, @@ -2278,6 +2365,7 @@ const commands = { EnableImageCommand, EnableImageBlockPublicAccessCommand, EnableImageDeprecationCommand, + EnableImageDeregistrationProtectionCommand, EnableIpamOrganizationAdminAccountCommand, EnableReachabilityAnalyzerOrganizationSharingCommand, EnableSerialConsoleAccessCommand, @@ -2305,6 +2393,8 @@ const commands = { GetGroupsForCapacityReservationCommand, GetHostReservationPurchasePreviewCommand, GetImageBlockPublicAccessStateCommand, + GetInstanceMetadataDefaultsCommand, + GetInstanceTpmEkPubCommand, GetInstanceTypesFromInstanceRequirementsCommand, GetInstanceUefiDataCommand, GetIpamAddressHistoryCommand, @@ -2357,15 +2447,17 @@ const commands = { ModifyFleetCommand, ModifyFpgaImageAttributeCommand, ModifyHostsCommand, - ModifyIdentityIdFormatCommand, ModifyIdFormatCommand, + ModifyIdentityIdFormatCommand, ModifyImageAttributeCommand, ModifyInstanceAttributeCommand, ModifyInstanceCapacityReservationAttributesCommand, + ModifyInstanceCpuOptionsCommand, ModifyInstanceCreditSpecificationCommand, ModifyInstanceEventStartTimeCommand, ModifyInstanceEventWindowCommand, ModifyInstanceMaintenanceOptionsCommand, + ModifyInstanceMetadataDefaultsCommand, ModifyInstanceMetadataOptionsCommand, ModifyInstancePlacementCommand, ModifyIpamCommand, @@ -2414,6 +2506,7 @@ const commands = { MonitorInstancesCommand, MoveAddressToVpcCommand, MoveByoipCidrToIpamCommand, + MoveCapacityReservationInstancesCommand, ProvisionByoipCidrCommand, ProvisionIpamByoasnCommand, ProvisionIpamPoolCidrCommand, @@ -2427,6 +2520,7 @@ const commands = { RegisterInstanceEventNotificationAttributesCommand, RegisterTransitGatewayMulticastGroupMembersCommand, RegisterTransitGatewayMulticastGroupSourcesCommand, + RejectCapacityReservationBillingOwnershipCommand, RejectTransitGatewayMulticastDomainAssociationsCommand, RejectTransitGatewayPeeringAttachmentCommand, RejectTransitGatewayVpcAttachmentCommand, @@ -2483,31 +2577,38 @@ const commands = { WithdrawByoipCidrCommand, }; -/** - * @since 1.0.0 - * @category models - */ interface EC2Service$ { readonly _: unique symbol; /** * @see {@link AcceptAddressTransferCommand} */ - readonly acceptAddressTransfer: ( + acceptAddressTransfer( args: AcceptAddressTransferCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< AcceptAddressTransferCommandOutput, SdkError | EC2ServiceError >; + /** + * @see {@link AcceptCapacityReservationBillingOwnershipCommand} + */ + acceptCapacityReservationBillingOwnership( + args: AcceptCapacityReservationBillingOwnershipCommandInput, + options?: HttpHandlerOptions, + ): Effect.Effect< + AcceptCapacityReservationBillingOwnershipCommandOutput, + SdkError | EC2ServiceError + >; + /** * @see {@link AcceptReservedInstancesExchangeQuoteCommand} */ - readonly acceptReservedInstancesExchangeQuote: ( + acceptReservedInstancesExchangeQuote( args: AcceptReservedInstancesExchangeQuoteCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< AcceptReservedInstancesExchangeQuoteCommandOutput, SdkError | EC2ServiceError >; @@ -2515,10 +2616,10 @@ interface EC2Service$ { /** * @see {@link AcceptTransitGatewayMulticastDomainAssociationsCommand} */ - readonly acceptTransitGatewayMulticastDomainAssociations: ( + acceptTransitGatewayMulticastDomainAssociations( args: AcceptTransitGatewayMulticastDomainAssociationsCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< AcceptTransitGatewayMulticastDomainAssociationsCommandOutput, SdkError | EC2ServiceError >; @@ -2526,10 +2627,10 @@ interface EC2Service$ { /** * @see {@link AcceptTransitGatewayPeeringAttachmentCommand} */ - readonly acceptTransitGatewayPeeringAttachment: ( + acceptTransitGatewayPeeringAttachment( args: AcceptTransitGatewayPeeringAttachmentCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< AcceptTransitGatewayPeeringAttachmentCommandOutput, SdkError | EC2ServiceError >; @@ -2537,10 +2638,10 @@ interface EC2Service$ { /** * @see {@link AcceptTransitGatewayVpcAttachmentCommand} */ - readonly acceptTransitGatewayVpcAttachment: ( + acceptTransitGatewayVpcAttachment( args: AcceptTransitGatewayVpcAttachmentCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< AcceptTransitGatewayVpcAttachmentCommandOutput, SdkError | EC2ServiceError >; @@ -2548,10 +2649,10 @@ interface EC2Service$ { /** * @see {@link AcceptVpcEndpointConnectionsCommand} */ - readonly acceptVpcEndpointConnections: ( + acceptVpcEndpointConnections( args: AcceptVpcEndpointConnectionsCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< AcceptVpcEndpointConnectionsCommandOutput, SdkError | EC2ServiceError >; @@ -2559,10 +2660,10 @@ interface EC2Service$ { /** * @see {@link AcceptVpcPeeringConnectionCommand} */ - readonly acceptVpcPeeringConnection: ( + acceptVpcPeeringConnection( args: AcceptVpcPeeringConnectionCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< AcceptVpcPeeringConnectionCommandOutput, SdkError | EC2ServiceError >; @@ -2570,37 +2671,34 @@ interface EC2Service$ { /** * @see {@link AdvertiseByoipCidrCommand} */ - readonly advertiseByoipCidr: ( + advertiseByoipCidr( args: AdvertiseByoipCidrCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< - AdvertiseByoipCidrCommandOutput, - SdkError | EC2ServiceError - >; + ): Effect.Effect; /** * @see {@link AllocateAddressCommand} */ - readonly allocateAddress: ( + allocateAddress( args: AllocateAddressCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect; + ): Effect.Effect; /** * @see {@link AllocateHostsCommand} */ - readonly allocateHosts: ( + allocateHosts( args: AllocateHostsCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect; + ): Effect.Effect; /** * @see {@link AllocateIpamPoolCidrCommand} */ - readonly allocateIpamPoolCidr: ( + allocateIpamPoolCidr( args: AllocateIpamPoolCidrCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< AllocateIpamPoolCidrCommandOutput, SdkError | EC2ServiceError >; @@ -2608,10 +2706,10 @@ interface EC2Service$ { /** * @see {@link ApplySecurityGroupsToClientVpnTargetNetworkCommand} */ - readonly applySecurityGroupsToClientVpnTargetNetwork: ( + applySecurityGroupsToClientVpnTargetNetwork( args: ApplySecurityGroupsToClientVpnTargetNetworkCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< ApplySecurityGroupsToClientVpnTargetNetworkCommandOutput, SdkError | EC2ServiceError >; @@ -2619,10 +2717,10 @@ interface EC2Service$ { /** * @see {@link AssignIpv6AddressesCommand} */ - readonly assignIpv6Addresses: ( + assignIpv6Addresses( args: AssignIpv6AddressesCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< AssignIpv6AddressesCommandOutput, SdkError | EC2ServiceError >; @@ -2630,10 +2728,10 @@ interface EC2Service$ { /** * @see {@link AssignPrivateIpAddressesCommand} */ - readonly assignPrivateIpAddresses: ( + assignPrivateIpAddresses( args: AssignPrivateIpAddressesCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< AssignPrivateIpAddressesCommandOutput, SdkError | EC2ServiceError >; @@ -2641,10 +2739,10 @@ interface EC2Service$ { /** * @see {@link AssignPrivateNatGatewayAddressCommand} */ - readonly assignPrivateNatGatewayAddress: ( + assignPrivateNatGatewayAddress( args: AssignPrivateNatGatewayAddressCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< AssignPrivateNatGatewayAddressCommandOutput, SdkError | EC2ServiceError >; @@ -2652,18 +2750,29 @@ interface EC2Service$ { /** * @see {@link AssociateAddressCommand} */ - readonly associateAddress: ( + associateAddress( args: AssociateAddressCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect; + ): Effect.Effect; + + /** + * @see {@link AssociateCapacityReservationBillingOwnerCommand} + */ + associateCapacityReservationBillingOwner( + args: AssociateCapacityReservationBillingOwnerCommandInput, + options?: HttpHandlerOptions, + ): Effect.Effect< + AssociateCapacityReservationBillingOwnerCommandOutput, + SdkError | EC2ServiceError + >; /** * @see {@link AssociateClientVpnTargetNetworkCommand} */ - readonly associateClientVpnTargetNetwork: ( + associateClientVpnTargetNetwork( args: AssociateClientVpnTargetNetworkCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< AssociateClientVpnTargetNetworkCommandOutput, SdkError | EC2ServiceError >; @@ -2671,10 +2780,10 @@ interface EC2Service$ { /** * @see {@link AssociateDhcpOptionsCommand} */ - readonly associateDhcpOptions: ( + associateDhcpOptions( args: AssociateDhcpOptionsCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< AssociateDhcpOptionsCommandOutput, SdkError | EC2ServiceError >; @@ -2682,10 +2791,10 @@ interface EC2Service$ { /** * @see {@link AssociateEnclaveCertificateIamRoleCommand} */ - readonly associateEnclaveCertificateIamRole: ( + associateEnclaveCertificateIamRole( args: AssociateEnclaveCertificateIamRoleCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< AssociateEnclaveCertificateIamRoleCommandOutput, SdkError | EC2ServiceError >; @@ -2693,10 +2802,10 @@ interface EC2Service$ { /** * @see {@link AssociateIamInstanceProfileCommand} */ - readonly associateIamInstanceProfile: ( + associateIamInstanceProfile( args: AssociateIamInstanceProfileCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< AssociateIamInstanceProfileCommandOutput, SdkError | EC2ServiceError >; @@ -2704,10 +2813,10 @@ interface EC2Service$ { /** * @see {@link AssociateInstanceEventWindowCommand} */ - readonly associateInstanceEventWindow: ( + associateInstanceEventWindow( args: AssociateInstanceEventWindowCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< AssociateInstanceEventWindowCommandOutput, SdkError | EC2ServiceError >; @@ -2715,10 +2824,10 @@ interface EC2Service$ { /** * @see {@link AssociateIpamByoasnCommand} */ - readonly associateIpamByoasn: ( + associateIpamByoasn( args: AssociateIpamByoasnCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< AssociateIpamByoasnCommandOutput, SdkError | EC2ServiceError >; @@ -2726,10 +2835,10 @@ interface EC2Service$ { /** * @see {@link AssociateIpamResourceDiscoveryCommand} */ - readonly associateIpamResourceDiscovery: ( + associateIpamResourceDiscovery( args: AssociateIpamResourceDiscoveryCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< AssociateIpamResourceDiscoveryCommandOutput, SdkError | EC2ServiceError >; @@ -2737,10 +2846,10 @@ interface EC2Service$ { /** * @see {@link AssociateNatGatewayAddressCommand} */ - readonly associateNatGatewayAddress: ( + associateNatGatewayAddress( args: AssociateNatGatewayAddressCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< AssociateNatGatewayAddressCommandOutput, SdkError | EC2ServiceError >; @@ -2748,21 +2857,32 @@ interface EC2Service$ { /** * @see {@link AssociateRouteTableCommand} */ - readonly associateRouteTable: ( + associateRouteTable( args: AssociateRouteTableCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< AssociateRouteTableCommandOutput, SdkError | EC2ServiceError >; + /** + * @see {@link AssociateSecurityGroupVpcCommand} + */ + associateSecurityGroupVpc( + args: AssociateSecurityGroupVpcCommandInput, + options?: HttpHandlerOptions, + ): Effect.Effect< + AssociateSecurityGroupVpcCommandOutput, + SdkError | EC2ServiceError + >; + /** * @see {@link AssociateSubnetCidrBlockCommand} */ - readonly associateSubnetCidrBlock: ( + associateSubnetCidrBlock( args: AssociateSubnetCidrBlockCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< AssociateSubnetCidrBlockCommandOutput, SdkError | EC2ServiceError >; @@ -2770,10 +2890,10 @@ interface EC2Service$ { /** * @see {@link AssociateTransitGatewayMulticastDomainCommand} */ - readonly associateTransitGatewayMulticastDomain: ( + associateTransitGatewayMulticastDomain( args: AssociateTransitGatewayMulticastDomainCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< AssociateTransitGatewayMulticastDomainCommandOutput, SdkError | EC2ServiceError >; @@ -2781,10 +2901,10 @@ interface EC2Service$ { /** * @see {@link AssociateTransitGatewayPolicyTableCommand} */ - readonly associateTransitGatewayPolicyTable: ( + associateTransitGatewayPolicyTable( args: AssociateTransitGatewayPolicyTableCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< AssociateTransitGatewayPolicyTableCommandOutput, SdkError | EC2ServiceError >; @@ -2792,10 +2912,10 @@ interface EC2Service$ { /** * @see {@link AssociateTransitGatewayRouteTableCommand} */ - readonly associateTransitGatewayRouteTable: ( + associateTransitGatewayRouteTable( args: AssociateTransitGatewayRouteTableCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< AssociateTransitGatewayRouteTableCommandOutput, SdkError | EC2ServiceError >; @@ -2803,10 +2923,10 @@ interface EC2Service$ { /** * @see {@link AssociateTrunkInterfaceCommand} */ - readonly associateTrunkInterface: ( + associateTrunkInterface( args: AssociateTrunkInterfaceCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< AssociateTrunkInterfaceCommandOutput, SdkError | EC2ServiceError >; @@ -2814,10 +2934,10 @@ interface EC2Service$ { /** * @see {@link AssociateVpcCidrBlockCommand} */ - readonly associateVpcCidrBlock: ( + associateVpcCidrBlock( args: AssociateVpcCidrBlockCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< AssociateVpcCidrBlockCommandOutput, SdkError | EC2ServiceError >; @@ -2825,10 +2945,10 @@ interface EC2Service$ { /** * @see {@link AttachClassicLinkVpcCommand} */ - readonly attachClassicLinkVpc: ( + attachClassicLinkVpc( args: AttachClassicLinkVpcCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< AttachClassicLinkVpcCommandOutput, SdkError | EC2ServiceError >; @@ -2836,10 +2956,10 @@ interface EC2Service$ { /** * @see {@link AttachInternetGatewayCommand} */ - readonly attachInternetGateway: ( + attachInternetGateway( args: AttachInternetGatewayCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< AttachInternetGatewayCommandOutput, SdkError | EC2ServiceError >; @@ -2847,10 +2967,10 @@ interface EC2Service$ { /** * @see {@link AttachNetworkInterfaceCommand} */ - readonly attachNetworkInterface: ( + attachNetworkInterface( args: AttachNetworkInterfaceCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< AttachNetworkInterfaceCommandOutput, SdkError | EC2ServiceError >; @@ -2858,10 +2978,10 @@ interface EC2Service$ { /** * @see {@link AttachVerifiedAccessTrustProviderCommand} */ - readonly attachVerifiedAccessTrustProvider: ( + attachVerifiedAccessTrustProvider( args: AttachVerifiedAccessTrustProviderCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< AttachVerifiedAccessTrustProviderCommandOutput, SdkError | EC2ServiceError >; @@ -2869,26 +2989,26 @@ interface EC2Service$ { /** * @see {@link AttachVolumeCommand} */ - readonly attachVolume: ( + attachVolume( args: AttachVolumeCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect; + ): Effect.Effect; /** * @see {@link AttachVpnGatewayCommand} */ - readonly attachVpnGateway: ( + attachVpnGateway( args: AttachVpnGatewayCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect; + ): Effect.Effect; /** * @see {@link AuthorizeClientVpnIngressCommand} */ - readonly authorizeClientVpnIngress: ( + authorizeClientVpnIngress( args: AuthorizeClientVpnIngressCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< AuthorizeClientVpnIngressCommandOutput, SdkError | EC2ServiceError >; @@ -2896,10 +3016,10 @@ interface EC2Service$ { /** * @see {@link AuthorizeSecurityGroupEgressCommand} */ - readonly authorizeSecurityGroupEgress: ( + authorizeSecurityGroupEgress( args: AuthorizeSecurityGroupEgressCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< AuthorizeSecurityGroupEgressCommandOutput, SdkError | EC2ServiceError >; @@ -2907,10 +3027,10 @@ interface EC2Service$ { /** * @see {@link AuthorizeSecurityGroupIngressCommand} */ - readonly authorizeSecurityGroupIngress: ( + authorizeSecurityGroupIngress( args: AuthorizeSecurityGroupIngressCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< AuthorizeSecurityGroupIngressCommandOutput, SdkError | EC2ServiceError >; @@ -2918,26 +3038,26 @@ interface EC2Service$ { /** * @see {@link BundleInstanceCommand} */ - readonly bundleInstance: ( + bundleInstance( args: BundleInstanceCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect; + ): Effect.Effect; /** * @see {@link CancelBundleTaskCommand} */ - readonly cancelBundleTask: ( + cancelBundleTask( args: CancelBundleTaskCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect; + ): Effect.Effect; /** * @see {@link CancelCapacityReservationCommand} */ - readonly cancelCapacityReservation: ( + cancelCapacityReservation( args: CancelCapacityReservationCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< CancelCapacityReservationCommandOutput, SdkError | EC2ServiceError >; @@ -2945,10 +3065,10 @@ interface EC2Service$ { /** * @see {@link CancelCapacityReservationFleetsCommand} */ - readonly cancelCapacityReservationFleets: ( + cancelCapacityReservationFleets( args: CancelCapacityReservationFleetsCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< CancelCapacityReservationFleetsCommandOutput, SdkError | EC2ServiceError >; @@ -2956,10 +3076,10 @@ interface EC2Service$ { /** * @see {@link CancelConversionTaskCommand} */ - readonly cancelConversionTask: ( + cancelConversionTask( args: CancelConversionTaskCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< CancelConversionTaskCommandOutput, SdkError | EC2ServiceError >; @@ -2967,18 +3087,18 @@ interface EC2Service$ { /** * @see {@link CancelExportTaskCommand} */ - readonly cancelExportTask: ( + cancelExportTask( args: CancelExportTaskCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect; + ): Effect.Effect; /** * @see {@link CancelImageLaunchPermissionCommand} */ - readonly cancelImageLaunchPermission: ( + cancelImageLaunchPermission( args: CancelImageLaunchPermissionCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< CancelImageLaunchPermissionCommandOutput, SdkError | EC2ServiceError >; @@ -2986,18 +3106,18 @@ interface EC2Service$ { /** * @see {@link CancelImportTaskCommand} */ - readonly cancelImportTask: ( + cancelImportTask( args: CancelImportTaskCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect; + ): Effect.Effect; /** * @see {@link CancelReservedInstancesListingCommand} */ - readonly cancelReservedInstancesListing: ( + cancelReservedInstancesListing( args: CancelReservedInstancesListingCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< CancelReservedInstancesListingCommandOutput, SdkError | EC2ServiceError >; @@ -3005,10 +3125,10 @@ interface EC2Service$ { /** * @see {@link CancelSpotFleetRequestsCommand} */ - readonly cancelSpotFleetRequests: ( + cancelSpotFleetRequests( args: CancelSpotFleetRequestsCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< CancelSpotFleetRequestsCommandOutput, SdkError | EC2ServiceError >; @@ -3016,10 +3136,10 @@ interface EC2Service$ { /** * @see {@link CancelSpotInstanceRequestsCommand} */ - readonly cancelSpotInstanceRequests: ( + cancelSpotInstanceRequests( args: CancelSpotInstanceRequestsCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< CancelSpotInstanceRequestsCommandOutput, SdkError | EC2ServiceError >; @@ -3027,10 +3147,10 @@ interface EC2Service$ { /** * @see {@link ConfirmProductInstanceCommand} */ - readonly confirmProductInstance: ( + confirmProductInstance( args: ConfirmProductInstanceCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< ConfirmProductInstanceCommandOutput, SdkError | EC2ServiceError >; @@ -3038,45 +3158,56 @@ interface EC2Service$ { /** * @see {@link CopyFpgaImageCommand} */ - readonly copyFpgaImage: ( + copyFpgaImage( args: CopyFpgaImageCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect; + ): Effect.Effect; /** * @see {@link CopyImageCommand} */ - readonly copyImage: ( + copyImage( args: CopyImageCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect; + ): Effect.Effect; /** * @see {@link CopySnapshotCommand} */ - readonly copySnapshot: ( + copySnapshot( args: CopySnapshotCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect; + ): Effect.Effect; /** * @see {@link CreateCapacityReservationCommand} */ - readonly createCapacityReservation: ( + createCapacityReservation( args: CreateCapacityReservationCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< CreateCapacityReservationCommandOutput, SdkError | EC2ServiceError >; + /** + * @see {@link CreateCapacityReservationBySplittingCommand} + */ + createCapacityReservationBySplitting( + args: CreateCapacityReservationBySplittingCommandInput, + options?: HttpHandlerOptions, + ): Effect.Effect< + CreateCapacityReservationBySplittingCommandOutput, + SdkError | EC2ServiceError + >; + /** * @see {@link CreateCapacityReservationFleetCommand} */ - readonly createCapacityReservationFleet: ( + createCapacityReservationFleet( args: CreateCapacityReservationFleetCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< CreateCapacityReservationFleetCommandOutput, SdkError | EC2ServiceError >; @@ -3084,10 +3215,10 @@ interface EC2Service$ { /** * @see {@link CreateCarrierGatewayCommand} */ - readonly createCarrierGateway: ( + createCarrierGateway( args: CreateCarrierGatewayCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< CreateCarrierGatewayCommandOutput, SdkError | EC2ServiceError >; @@ -3095,10 +3226,10 @@ interface EC2Service$ { /** * @see {@link CreateClientVpnEndpointCommand} */ - readonly createClientVpnEndpoint: ( + createClientVpnEndpoint( args: CreateClientVpnEndpointCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< CreateClientVpnEndpointCommandOutput, SdkError | EC2ServiceError >; @@ -3106,10 +3237,10 @@ interface EC2Service$ { /** * @see {@link CreateClientVpnRouteCommand} */ - readonly createClientVpnRoute: ( + createClientVpnRoute( args: CreateClientVpnRouteCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< CreateClientVpnRouteCommandOutput, SdkError | EC2ServiceError >; @@ -3117,26 +3248,26 @@ interface EC2Service$ { /** * @see {@link CreateCoipCidrCommand} */ - readonly createCoipCidr: ( + createCoipCidr( args: CreateCoipCidrCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect; + ): Effect.Effect; /** * @see {@link CreateCoipPoolCommand} */ - readonly createCoipPool: ( + createCoipPool( args: CreateCoipPoolCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect; + ): Effect.Effect; /** * @see {@link CreateCustomerGatewayCommand} */ - readonly createCustomerGateway: ( + createCustomerGateway( args: CreateCustomerGatewayCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< CreateCustomerGatewayCommandOutput, SdkError | EC2ServiceError >; @@ -3144,10 +3275,10 @@ interface EC2Service$ { /** * @see {@link CreateDefaultSubnetCommand} */ - readonly createDefaultSubnet: ( + createDefaultSubnet( args: CreateDefaultSubnetCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< CreateDefaultSubnetCommandOutput, SdkError | EC2ServiceError >; @@ -3155,29 +3286,26 @@ interface EC2Service$ { /** * @see {@link CreateDefaultVpcCommand} */ - readonly createDefaultVpc: ( + createDefaultVpc( args: CreateDefaultVpcCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect; + ): Effect.Effect; /** * @see {@link CreateDhcpOptionsCommand} */ - readonly createDhcpOptions: ( + createDhcpOptions( args: CreateDhcpOptionsCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< - CreateDhcpOptionsCommandOutput, - SdkError | EC2ServiceError - >; + ): Effect.Effect; /** * @see {@link CreateEgressOnlyInternetGatewayCommand} */ - readonly createEgressOnlyInternetGateway: ( + createEgressOnlyInternetGateway( args: CreateEgressOnlyInternetGatewayCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< CreateEgressOnlyInternetGatewayCommandOutput, SdkError | EC2ServiceError >; @@ -3185,42 +3313,42 @@ interface EC2Service$ { /** * @see {@link CreateFleetCommand} */ - readonly createFleet: ( + createFleet( args: CreateFleetCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect; + ): Effect.Effect; /** * @see {@link CreateFlowLogsCommand} */ - readonly createFlowLogs: ( + createFlowLogs( args: CreateFlowLogsCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect; + ): Effect.Effect; /** * @see {@link CreateFpgaImageCommand} */ - readonly createFpgaImage: ( + createFpgaImage( args: CreateFpgaImageCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect; + ): Effect.Effect; /** * @see {@link CreateImageCommand} */ - readonly createImage: ( + createImage( args: CreateImageCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect; + ): Effect.Effect; /** * @see {@link CreateInstanceConnectEndpointCommand} */ - readonly createInstanceConnectEndpoint: ( + createInstanceConnectEndpoint( args: CreateInstanceConnectEndpointCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< CreateInstanceConnectEndpointCommandOutput, SdkError | EC2ServiceError >; @@ -3228,10 +3356,10 @@ interface EC2Service$ { /** * @see {@link CreateInstanceEventWindowCommand} */ - readonly createInstanceEventWindow: ( + createInstanceEventWindow( args: CreateInstanceEventWindowCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< CreateInstanceEventWindowCommandOutput, SdkError | EC2ServiceError >; @@ -3239,10 +3367,10 @@ interface EC2Service$ { /** * @see {@link CreateInstanceExportTaskCommand} */ - readonly createInstanceExportTask: ( + createInstanceExportTask( args: CreateInstanceExportTaskCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< CreateInstanceExportTaskCommandOutput, SdkError | EC2ServiceError >; @@ -3250,10 +3378,10 @@ interface EC2Service$ { /** * @see {@link CreateInternetGatewayCommand} */ - readonly createInternetGateway: ( + createInternetGateway( args: CreateInternetGatewayCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< CreateInternetGatewayCommandOutput, SdkError | EC2ServiceError >; @@ -3261,26 +3389,37 @@ interface EC2Service$ { /** * @see {@link CreateIpamCommand} */ - readonly createIpam: ( + createIpam( args: CreateIpamCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect; + ): Effect.Effect; + + /** + * @see {@link CreateIpamExternalResourceVerificationTokenCommand} + */ + createIpamExternalResourceVerificationToken( + args: CreateIpamExternalResourceVerificationTokenCommandInput, + options?: HttpHandlerOptions, + ): Effect.Effect< + CreateIpamExternalResourceVerificationTokenCommandOutput, + SdkError | EC2ServiceError + >; /** * @see {@link CreateIpamPoolCommand} */ - readonly createIpamPool: ( + createIpamPool( args: CreateIpamPoolCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect; + ): Effect.Effect; /** * @see {@link CreateIpamResourceDiscoveryCommand} */ - readonly createIpamResourceDiscovery: ( + createIpamResourceDiscovery( args: CreateIpamResourceDiscoveryCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< CreateIpamResourceDiscoveryCommandOutput, SdkError | EC2ServiceError >; @@ -3288,26 +3427,26 @@ interface EC2Service$ { /** * @see {@link CreateIpamScopeCommand} */ - readonly createIpamScope: ( + createIpamScope( args: CreateIpamScopeCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect; + ): Effect.Effect; /** * @see {@link CreateKeyPairCommand} */ - readonly createKeyPair: ( + createKeyPair( args: CreateKeyPairCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect; + ): Effect.Effect; /** * @see {@link CreateLaunchTemplateCommand} */ - readonly createLaunchTemplate: ( + createLaunchTemplate( args: CreateLaunchTemplateCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< CreateLaunchTemplateCommandOutput, SdkError | EC2ServiceError >; @@ -3315,10 +3454,10 @@ interface EC2Service$ { /** * @see {@link CreateLaunchTemplateVersionCommand} */ - readonly createLaunchTemplateVersion: ( + createLaunchTemplateVersion( args: CreateLaunchTemplateVersionCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< CreateLaunchTemplateVersionCommandOutput, SdkError | EC2ServiceError >; @@ -3326,10 +3465,10 @@ interface EC2Service$ { /** * @see {@link CreateLocalGatewayRouteCommand} */ - readonly createLocalGatewayRoute: ( + createLocalGatewayRoute( args: CreateLocalGatewayRouteCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< CreateLocalGatewayRouteCommandOutput, SdkError | EC2ServiceError >; @@ -3337,10 +3476,10 @@ interface EC2Service$ { /** * @see {@link CreateLocalGatewayRouteTableCommand} */ - readonly createLocalGatewayRouteTable: ( + createLocalGatewayRouteTable( args: CreateLocalGatewayRouteTableCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< CreateLocalGatewayRouteTableCommandOutput, SdkError | EC2ServiceError >; @@ -3348,10 +3487,10 @@ interface EC2Service$ { /** * @see {@link CreateLocalGatewayRouteTableVirtualInterfaceGroupAssociationCommand} */ - readonly createLocalGatewayRouteTableVirtualInterfaceGroupAssociation: ( + createLocalGatewayRouteTableVirtualInterfaceGroupAssociation( args: CreateLocalGatewayRouteTableVirtualInterfaceGroupAssociationCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< CreateLocalGatewayRouteTableVirtualInterfaceGroupAssociationCommandOutput, SdkError | EC2ServiceError >; @@ -3359,10 +3498,10 @@ interface EC2Service$ { /** * @see {@link CreateLocalGatewayRouteTableVpcAssociationCommand} */ - readonly createLocalGatewayRouteTableVpcAssociation: ( + createLocalGatewayRouteTableVpcAssociation( args: CreateLocalGatewayRouteTableVpcAssociationCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< CreateLocalGatewayRouteTableVpcAssociationCommandOutput, SdkError | EC2ServiceError >; @@ -3370,10 +3509,10 @@ interface EC2Service$ { /** * @see {@link CreateManagedPrefixListCommand} */ - readonly createManagedPrefixList: ( + createManagedPrefixList( args: CreateManagedPrefixListCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< CreateManagedPrefixListCommandOutput, SdkError | EC2ServiceError >; @@ -3381,26 +3520,26 @@ interface EC2Service$ { /** * @see {@link CreateNatGatewayCommand} */ - readonly createNatGateway: ( + createNatGateway( args: CreateNatGatewayCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect; + ): Effect.Effect; /** * @see {@link CreateNetworkAclCommand} */ - readonly createNetworkAcl: ( + createNetworkAcl( args: CreateNetworkAclCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect; + ): Effect.Effect; /** * @see {@link CreateNetworkAclEntryCommand} */ - readonly createNetworkAclEntry: ( + createNetworkAclEntry( args: CreateNetworkAclEntryCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< CreateNetworkAclEntryCommandOutput, SdkError | EC2ServiceError >; @@ -3408,10 +3547,10 @@ interface EC2Service$ { /** * @see {@link CreateNetworkInsightsAccessScopeCommand} */ - readonly createNetworkInsightsAccessScope: ( + createNetworkInsightsAccessScope( args: CreateNetworkInsightsAccessScopeCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< CreateNetworkInsightsAccessScopeCommandOutput, SdkError | EC2ServiceError >; @@ -3419,10 +3558,10 @@ interface EC2Service$ { /** * @see {@link CreateNetworkInsightsPathCommand} */ - readonly createNetworkInsightsPath: ( + createNetworkInsightsPath( args: CreateNetworkInsightsPathCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< CreateNetworkInsightsPathCommandOutput, SdkError | EC2ServiceError >; @@ -3430,10 +3569,10 @@ interface EC2Service$ { /** * @see {@link CreateNetworkInterfaceCommand} */ - readonly createNetworkInterface: ( + createNetworkInterface( args: CreateNetworkInterfaceCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< CreateNetworkInterfaceCommandOutput, SdkError | EC2ServiceError >; @@ -3441,10 +3580,10 @@ interface EC2Service$ { /** * @see {@link CreateNetworkInterfacePermissionCommand} */ - readonly createNetworkInterfacePermission: ( + createNetworkInterfacePermission( args: CreateNetworkInterfacePermissionCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< CreateNetworkInterfacePermissionCommandOutput, SdkError | EC2ServiceError >; @@ -3452,10 +3591,10 @@ interface EC2Service$ { /** * @see {@link CreatePlacementGroupCommand} */ - readonly createPlacementGroup: ( + createPlacementGroup( args: CreatePlacementGroupCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< CreatePlacementGroupCommandOutput, SdkError | EC2ServiceError >; @@ -3463,10 +3602,10 @@ interface EC2Service$ { /** * @see {@link CreatePublicIpv4PoolCommand} */ - readonly createPublicIpv4Pool: ( + createPublicIpv4Pool( args: CreatePublicIpv4PoolCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< CreatePublicIpv4PoolCommandOutput, SdkError | EC2ServiceError >; @@ -3474,10 +3613,10 @@ interface EC2Service$ { /** * @see {@link CreateReplaceRootVolumeTaskCommand} */ - readonly createReplaceRootVolumeTask: ( + createReplaceRootVolumeTask( args: CreateReplaceRootVolumeTaskCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< CreateReplaceRootVolumeTaskCommandOutput, SdkError | EC2ServiceError >; @@ -3485,10 +3624,10 @@ interface EC2Service$ { /** * @see {@link CreateReservedInstancesListingCommand} */ - readonly createReservedInstancesListing: ( + createReservedInstancesListing( args: CreateReservedInstancesListingCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< CreateReservedInstancesListingCommandOutput, SdkError | EC2ServiceError >; @@ -3496,10 +3635,10 @@ interface EC2Service$ { /** * @see {@link CreateRestoreImageTaskCommand} */ - readonly createRestoreImageTask: ( + createRestoreImageTask( args: CreateRestoreImageTaskCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< CreateRestoreImageTaskCommandOutput, SdkError | EC2ServiceError >; @@ -3507,26 +3646,26 @@ interface EC2Service$ { /** * @see {@link CreateRouteCommand} */ - readonly createRoute: ( + createRoute( args: CreateRouteCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect; + ): Effect.Effect; /** * @see {@link CreateRouteTableCommand} */ - readonly createRouteTable: ( + createRouteTable( args: CreateRouteTableCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect; + ): Effect.Effect; /** * @see {@link CreateSecurityGroupCommand} */ - readonly createSecurityGroup: ( + createSecurityGroup( args: CreateSecurityGroupCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< CreateSecurityGroupCommandOutput, SdkError | EC2ServiceError >; @@ -3534,26 +3673,26 @@ interface EC2Service$ { /** * @see {@link CreateSnapshotCommand} */ - readonly createSnapshot: ( + createSnapshot( args: CreateSnapshotCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect; + ): Effect.Effect; /** * @see {@link CreateSnapshotsCommand} */ - readonly createSnapshots: ( + createSnapshots( args: CreateSnapshotsCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect; + ): Effect.Effect; /** * @see {@link CreateSpotDatafeedSubscriptionCommand} */ - readonly createSpotDatafeedSubscription: ( + createSpotDatafeedSubscription( args: CreateSpotDatafeedSubscriptionCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< CreateSpotDatafeedSubscriptionCommandOutput, SdkError | EC2ServiceError >; @@ -3561,10 +3700,10 @@ interface EC2Service$ { /** * @see {@link CreateStoreImageTaskCommand} */ - readonly createStoreImageTask: ( + createStoreImageTask( args: CreateStoreImageTaskCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< CreateStoreImageTaskCommandOutput, SdkError | EC2ServiceError >; @@ -3572,18 +3711,18 @@ interface EC2Service$ { /** * @see {@link CreateSubnetCommand} */ - readonly createSubnet: ( + createSubnet( args: CreateSubnetCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect; + ): Effect.Effect; /** * @see {@link CreateSubnetCidrReservationCommand} */ - readonly createSubnetCidrReservation: ( + createSubnetCidrReservation( args: CreateSubnetCidrReservationCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< CreateSubnetCidrReservationCommandOutput, SdkError | EC2ServiceError >; @@ -3591,18 +3730,18 @@ interface EC2Service$ { /** * @see {@link CreateTagsCommand} */ - readonly createTags: ( + createTags( args: CreateTagsCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect; + ): Effect.Effect; /** * @see {@link CreateTrafficMirrorFilterCommand} */ - readonly createTrafficMirrorFilter: ( + createTrafficMirrorFilter( args: CreateTrafficMirrorFilterCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< CreateTrafficMirrorFilterCommandOutput, SdkError | EC2ServiceError >; @@ -3610,10 +3749,10 @@ interface EC2Service$ { /** * @see {@link CreateTrafficMirrorFilterRuleCommand} */ - readonly createTrafficMirrorFilterRule: ( + createTrafficMirrorFilterRule( args: CreateTrafficMirrorFilterRuleCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< CreateTrafficMirrorFilterRuleCommandOutput, SdkError | EC2ServiceError >; @@ -3621,10 +3760,10 @@ interface EC2Service$ { /** * @see {@link CreateTrafficMirrorSessionCommand} */ - readonly createTrafficMirrorSession: ( + createTrafficMirrorSession( args: CreateTrafficMirrorSessionCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< CreateTrafficMirrorSessionCommandOutput, SdkError | EC2ServiceError >; @@ -3632,10 +3771,10 @@ interface EC2Service$ { /** * @see {@link CreateTrafficMirrorTargetCommand} */ - readonly createTrafficMirrorTarget: ( + createTrafficMirrorTarget( args: CreateTrafficMirrorTargetCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< CreateTrafficMirrorTargetCommandOutput, SdkError | EC2ServiceError >; @@ -3643,10 +3782,10 @@ interface EC2Service$ { /** * @see {@link CreateTransitGatewayCommand} */ - readonly createTransitGateway: ( + createTransitGateway( args: CreateTransitGatewayCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< CreateTransitGatewayCommandOutput, SdkError | EC2ServiceError >; @@ -3654,10 +3793,10 @@ interface EC2Service$ { /** * @see {@link CreateTransitGatewayConnectCommand} */ - readonly createTransitGatewayConnect: ( + createTransitGatewayConnect( args: CreateTransitGatewayConnectCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< CreateTransitGatewayConnectCommandOutput, SdkError | EC2ServiceError >; @@ -3665,10 +3804,10 @@ interface EC2Service$ { /** * @see {@link CreateTransitGatewayConnectPeerCommand} */ - readonly createTransitGatewayConnectPeer: ( + createTransitGatewayConnectPeer( args: CreateTransitGatewayConnectPeerCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< CreateTransitGatewayConnectPeerCommandOutput, SdkError | EC2ServiceError >; @@ -3676,10 +3815,10 @@ interface EC2Service$ { /** * @see {@link CreateTransitGatewayMulticastDomainCommand} */ - readonly createTransitGatewayMulticastDomain: ( + createTransitGatewayMulticastDomain( args: CreateTransitGatewayMulticastDomainCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< CreateTransitGatewayMulticastDomainCommandOutput, SdkError | EC2ServiceError >; @@ -3687,10 +3826,10 @@ interface EC2Service$ { /** * @see {@link CreateTransitGatewayPeeringAttachmentCommand} */ - readonly createTransitGatewayPeeringAttachment: ( + createTransitGatewayPeeringAttachment( args: CreateTransitGatewayPeeringAttachmentCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< CreateTransitGatewayPeeringAttachmentCommandOutput, SdkError | EC2ServiceError >; @@ -3698,10 +3837,10 @@ interface EC2Service$ { /** * @see {@link CreateTransitGatewayPolicyTableCommand} */ - readonly createTransitGatewayPolicyTable: ( + createTransitGatewayPolicyTable( args: CreateTransitGatewayPolicyTableCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< CreateTransitGatewayPolicyTableCommandOutput, SdkError | EC2ServiceError >; @@ -3709,10 +3848,10 @@ interface EC2Service$ { /** * @see {@link CreateTransitGatewayPrefixListReferenceCommand} */ - readonly createTransitGatewayPrefixListReference: ( + createTransitGatewayPrefixListReference( args: CreateTransitGatewayPrefixListReferenceCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< CreateTransitGatewayPrefixListReferenceCommandOutput, SdkError | EC2ServiceError >; @@ -3720,10 +3859,10 @@ interface EC2Service$ { /** * @see {@link CreateTransitGatewayRouteCommand} */ - readonly createTransitGatewayRoute: ( + createTransitGatewayRoute( args: CreateTransitGatewayRouteCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< CreateTransitGatewayRouteCommandOutput, SdkError | EC2ServiceError >; @@ -3731,10 +3870,10 @@ interface EC2Service$ { /** * @see {@link CreateTransitGatewayRouteTableCommand} */ - readonly createTransitGatewayRouteTable: ( + createTransitGatewayRouteTable( args: CreateTransitGatewayRouteTableCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< CreateTransitGatewayRouteTableCommandOutput, SdkError | EC2ServiceError >; @@ -3742,10 +3881,10 @@ interface EC2Service$ { /** * @see {@link CreateTransitGatewayRouteTableAnnouncementCommand} */ - readonly createTransitGatewayRouteTableAnnouncement: ( + createTransitGatewayRouteTableAnnouncement( args: CreateTransitGatewayRouteTableAnnouncementCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< CreateTransitGatewayRouteTableAnnouncementCommandOutput, SdkError | EC2ServiceError >; @@ -3753,10 +3892,10 @@ interface EC2Service$ { /** * @see {@link CreateTransitGatewayVpcAttachmentCommand} */ - readonly createTransitGatewayVpcAttachment: ( + createTransitGatewayVpcAttachment( args: CreateTransitGatewayVpcAttachmentCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< CreateTransitGatewayVpcAttachmentCommandOutput, SdkError | EC2ServiceError >; @@ -3764,10 +3903,10 @@ interface EC2Service$ { /** * @see {@link CreateVerifiedAccessEndpointCommand} */ - readonly createVerifiedAccessEndpoint: ( + createVerifiedAccessEndpoint( args: CreateVerifiedAccessEndpointCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< CreateVerifiedAccessEndpointCommandOutput, SdkError | EC2ServiceError >; @@ -3775,10 +3914,10 @@ interface EC2Service$ { /** * @see {@link CreateVerifiedAccessGroupCommand} */ - readonly createVerifiedAccessGroup: ( + createVerifiedAccessGroup( args: CreateVerifiedAccessGroupCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< CreateVerifiedAccessGroupCommandOutput, SdkError | EC2ServiceError >; @@ -3786,10 +3925,10 @@ interface EC2Service$ { /** * @see {@link CreateVerifiedAccessInstanceCommand} */ - readonly createVerifiedAccessInstance: ( + createVerifiedAccessInstance( args: CreateVerifiedAccessInstanceCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< CreateVerifiedAccessInstanceCommandOutput, SdkError | EC2ServiceError >; @@ -3797,10 +3936,10 @@ interface EC2Service$ { /** * @see {@link CreateVerifiedAccessTrustProviderCommand} */ - readonly createVerifiedAccessTrustProvider: ( + createVerifiedAccessTrustProvider( args: CreateVerifiedAccessTrustProviderCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< CreateVerifiedAccessTrustProviderCommandOutput, SdkError | EC2ServiceError >; @@ -3808,37 +3947,34 @@ interface EC2Service$ { /** * @see {@link CreateVolumeCommand} */ - readonly createVolume: ( + createVolume( args: CreateVolumeCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect; + ): Effect.Effect; /** * @see {@link CreateVpcCommand} */ - readonly createVpc: ( + createVpc( args: CreateVpcCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect; + ): Effect.Effect; /** * @see {@link CreateVpcEndpointCommand} */ - readonly createVpcEndpoint: ( + createVpcEndpoint( args: CreateVpcEndpointCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< - CreateVpcEndpointCommandOutput, - SdkError | EC2ServiceError - >; + ): Effect.Effect; /** * @see {@link CreateVpcEndpointConnectionNotificationCommand} */ - readonly createVpcEndpointConnectionNotification: ( + createVpcEndpointConnectionNotification( args: CreateVpcEndpointConnectionNotificationCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< CreateVpcEndpointConnectionNotificationCommandOutput, SdkError | EC2ServiceError >; @@ -3846,10 +3982,10 @@ interface EC2Service$ { /** * @see {@link CreateVpcEndpointServiceConfigurationCommand} */ - readonly createVpcEndpointServiceConfiguration: ( + createVpcEndpointServiceConfiguration( args: CreateVpcEndpointServiceConfigurationCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< CreateVpcEndpointServiceConfigurationCommandOutput, SdkError | EC2ServiceError >; @@ -3857,10 +3993,10 @@ interface EC2Service$ { /** * @see {@link CreateVpcPeeringConnectionCommand} */ - readonly createVpcPeeringConnection: ( + createVpcPeeringConnection( args: CreateVpcPeeringConnectionCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< CreateVpcPeeringConnectionCommandOutput, SdkError | EC2ServiceError >; @@ -3868,10 +4004,10 @@ interface EC2Service$ { /** * @see {@link CreateVpnConnectionCommand} */ - readonly createVpnConnection: ( + createVpnConnection( args: CreateVpnConnectionCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< CreateVpnConnectionCommandOutput, SdkError | EC2ServiceError >; @@ -3879,10 +4015,10 @@ interface EC2Service$ { /** * @see {@link CreateVpnConnectionRouteCommand} */ - readonly createVpnConnectionRoute: ( + createVpnConnectionRoute( args: CreateVpnConnectionRouteCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< CreateVpnConnectionRouteCommandOutput, SdkError | EC2ServiceError >; @@ -3890,18 +4026,18 @@ interface EC2Service$ { /** * @see {@link CreateVpnGatewayCommand} */ - readonly createVpnGateway: ( + createVpnGateway( args: CreateVpnGatewayCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect; + ): Effect.Effect; /** * @see {@link DeleteCarrierGatewayCommand} */ - readonly deleteCarrierGateway: ( + deleteCarrierGateway( args: DeleteCarrierGatewayCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DeleteCarrierGatewayCommandOutput, SdkError | EC2ServiceError >; @@ -3909,10 +4045,10 @@ interface EC2Service$ { /** * @see {@link DeleteClientVpnEndpointCommand} */ - readonly deleteClientVpnEndpoint: ( + deleteClientVpnEndpoint( args: DeleteClientVpnEndpointCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DeleteClientVpnEndpointCommandOutput, SdkError | EC2ServiceError >; @@ -3920,10 +4056,10 @@ interface EC2Service$ { /** * @see {@link DeleteClientVpnRouteCommand} */ - readonly deleteClientVpnRoute: ( + deleteClientVpnRoute( args: DeleteClientVpnRouteCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DeleteClientVpnRouteCommandOutput, SdkError | EC2ServiceError >; @@ -3931,26 +4067,26 @@ interface EC2Service$ { /** * @see {@link DeleteCoipCidrCommand} */ - readonly deleteCoipCidr: ( + deleteCoipCidr( args: DeleteCoipCidrCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect; + ): Effect.Effect; /** * @see {@link DeleteCoipPoolCommand} */ - readonly deleteCoipPool: ( + deleteCoipPool( args: DeleteCoipPoolCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect; + ): Effect.Effect; /** * @see {@link DeleteCustomerGatewayCommand} */ - readonly deleteCustomerGateway: ( + deleteCustomerGateway( args: DeleteCustomerGatewayCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DeleteCustomerGatewayCommandOutput, SdkError | EC2ServiceError >; @@ -3958,21 +4094,18 @@ interface EC2Service$ { /** * @see {@link DeleteDhcpOptionsCommand} */ - readonly deleteDhcpOptions: ( + deleteDhcpOptions( args: DeleteDhcpOptionsCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< - DeleteDhcpOptionsCommandOutput, - SdkError | EC2ServiceError - >; + ): Effect.Effect; /** * @see {@link DeleteEgressOnlyInternetGatewayCommand} */ - readonly deleteEgressOnlyInternetGateway: ( + deleteEgressOnlyInternetGateway( args: DeleteEgressOnlyInternetGatewayCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DeleteEgressOnlyInternetGatewayCommandOutput, SdkError | EC2ServiceError >; @@ -3980,34 +4113,34 @@ interface EC2Service$ { /** * @see {@link DeleteFleetsCommand} */ - readonly deleteFleets: ( + deleteFleets( args: DeleteFleetsCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect; + ): Effect.Effect; /** * @see {@link DeleteFlowLogsCommand} */ - readonly deleteFlowLogs: ( + deleteFlowLogs( args: DeleteFlowLogsCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect; + ): Effect.Effect; /** * @see {@link DeleteFpgaImageCommand} */ - readonly deleteFpgaImage: ( + deleteFpgaImage( args: DeleteFpgaImageCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect; + ): Effect.Effect; /** * @see {@link DeleteInstanceConnectEndpointCommand} */ - readonly deleteInstanceConnectEndpoint: ( + deleteInstanceConnectEndpoint( args: DeleteInstanceConnectEndpointCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DeleteInstanceConnectEndpointCommandOutput, SdkError | EC2ServiceError >; @@ -4015,10 +4148,10 @@ interface EC2Service$ { /** * @see {@link DeleteInstanceEventWindowCommand} */ - readonly deleteInstanceEventWindow: ( + deleteInstanceEventWindow( args: DeleteInstanceEventWindowCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DeleteInstanceEventWindowCommandOutput, SdkError | EC2ServiceError >; @@ -4026,10 +4159,10 @@ interface EC2Service$ { /** * @see {@link DeleteInternetGatewayCommand} */ - readonly deleteInternetGateway: ( + deleteInternetGateway( args: DeleteInternetGatewayCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DeleteInternetGatewayCommandOutput, SdkError | EC2ServiceError >; @@ -4037,26 +4170,37 @@ interface EC2Service$ { /** * @see {@link DeleteIpamCommand} */ - readonly deleteIpam: ( + deleteIpam( args: DeleteIpamCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect; + ): Effect.Effect; + + /** + * @see {@link DeleteIpamExternalResourceVerificationTokenCommand} + */ + deleteIpamExternalResourceVerificationToken( + args: DeleteIpamExternalResourceVerificationTokenCommandInput, + options?: HttpHandlerOptions, + ): Effect.Effect< + DeleteIpamExternalResourceVerificationTokenCommandOutput, + SdkError | EC2ServiceError + >; /** * @see {@link DeleteIpamPoolCommand} */ - readonly deleteIpamPool: ( + deleteIpamPool( args: DeleteIpamPoolCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect; + ): Effect.Effect; /** * @see {@link DeleteIpamResourceDiscoveryCommand} */ - readonly deleteIpamResourceDiscovery: ( + deleteIpamResourceDiscovery( args: DeleteIpamResourceDiscoveryCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DeleteIpamResourceDiscoveryCommandOutput, SdkError | EC2ServiceError >; @@ -4064,26 +4208,26 @@ interface EC2Service$ { /** * @see {@link DeleteIpamScopeCommand} */ - readonly deleteIpamScope: ( + deleteIpamScope( args: DeleteIpamScopeCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect; + ): Effect.Effect; /** * @see {@link DeleteKeyPairCommand} */ - readonly deleteKeyPair: ( + deleteKeyPair( args: DeleteKeyPairCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect; + ): Effect.Effect; /** * @see {@link DeleteLaunchTemplateCommand} */ - readonly deleteLaunchTemplate: ( + deleteLaunchTemplate( args: DeleteLaunchTemplateCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DeleteLaunchTemplateCommandOutput, SdkError | EC2ServiceError >; @@ -4091,10 +4235,10 @@ interface EC2Service$ { /** * @see {@link DeleteLaunchTemplateVersionsCommand} */ - readonly deleteLaunchTemplateVersions: ( + deleteLaunchTemplateVersions( args: DeleteLaunchTemplateVersionsCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DeleteLaunchTemplateVersionsCommandOutput, SdkError | EC2ServiceError >; @@ -4102,10 +4246,10 @@ interface EC2Service$ { /** * @see {@link DeleteLocalGatewayRouteCommand} */ - readonly deleteLocalGatewayRoute: ( + deleteLocalGatewayRoute( args: DeleteLocalGatewayRouteCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DeleteLocalGatewayRouteCommandOutput, SdkError | EC2ServiceError >; @@ -4113,10 +4257,10 @@ interface EC2Service$ { /** * @see {@link DeleteLocalGatewayRouteTableCommand} */ - readonly deleteLocalGatewayRouteTable: ( + deleteLocalGatewayRouteTable( args: DeleteLocalGatewayRouteTableCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DeleteLocalGatewayRouteTableCommandOutput, SdkError | EC2ServiceError >; @@ -4124,10 +4268,10 @@ interface EC2Service$ { /** * @see {@link DeleteLocalGatewayRouteTableVirtualInterfaceGroupAssociationCommand} */ - readonly deleteLocalGatewayRouteTableVirtualInterfaceGroupAssociation: ( + deleteLocalGatewayRouteTableVirtualInterfaceGroupAssociation( args: DeleteLocalGatewayRouteTableVirtualInterfaceGroupAssociationCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DeleteLocalGatewayRouteTableVirtualInterfaceGroupAssociationCommandOutput, SdkError | EC2ServiceError >; @@ -4135,10 +4279,10 @@ interface EC2Service$ { /** * @see {@link DeleteLocalGatewayRouteTableVpcAssociationCommand} */ - readonly deleteLocalGatewayRouteTableVpcAssociation: ( + deleteLocalGatewayRouteTableVpcAssociation( args: DeleteLocalGatewayRouteTableVpcAssociationCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DeleteLocalGatewayRouteTableVpcAssociationCommandOutput, SdkError | EC2ServiceError >; @@ -4146,10 +4290,10 @@ interface EC2Service$ { /** * @see {@link DeleteManagedPrefixListCommand} */ - readonly deleteManagedPrefixList: ( + deleteManagedPrefixList( args: DeleteManagedPrefixListCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DeleteManagedPrefixListCommandOutput, SdkError | EC2ServiceError >; @@ -4157,26 +4301,26 @@ interface EC2Service$ { /** * @see {@link DeleteNatGatewayCommand} */ - readonly deleteNatGateway: ( + deleteNatGateway( args: DeleteNatGatewayCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect; + ): Effect.Effect; /** * @see {@link DeleteNetworkAclCommand} */ - readonly deleteNetworkAcl: ( + deleteNetworkAcl( args: DeleteNetworkAclCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect; + ): Effect.Effect; /** * @see {@link DeleteNetworkAclEntryCommand} */ - readonly deleteNetworkAclEntry: ( + deleteNetworkAclEntry( args: DeleteNetworkAclEntryCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DeleteNetworkAclEntryCommandOutput, SdkError | EC2ServiceError >; @@ -4184,10 +4328,10 @@ interface EC2Service$ { /** * @see {@link DeleteNetworkInsightsAccessScopeCommand} */ - readonly deleteNetworkInsightsAccessScope: ( + deleteNetworkInsightsAccessScope( args: DeleteNetworkInsightsAccessScopeCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DeleteNetworkInsightsAccessScopeCommandOutput, SdkError | EC2ServiceError >; @@ -4195,10 +4339,10 @@ interface EC2Service$ { /** * @see {@link DeleteNetworkInsightsAccessScopeAnalysisCommand} */ - readonly deleteNetworkInsightsAccessScopeAnalysis: ( + deleteNetworkInsightsAccessScopeAnalysis( args: DeleteNetworkInsightsAccessScopeAnalysisCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DeleteNetworkInsightsAccessScopeAnalysisCommandOutput, SdkError | EC2ServiceError >; @@ -4206,10 +4350,10 @@ interface EC2Service$ { /** * @see {@link DeleteNetworkInsightsAnalysisCommand} */ - readonly deleteNetworkInsightsAnalysis: ( + deleteNetworkInsightsAnalysis( args: DeleteNetworkInsightsAnalysisCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DeleteNetworkInsightsAnalysisCommandOutput, SdkError | EC2ServiceError >; @@ -4217,10 +4361,10 @@ interface EC2Service$ { /** * @see {@link DeleteNetworkInsightsPathCommand} */ - readonly deleteNetworkInsightsPath: ( + deleteNetworkInsightsPath( args: DeleteNetworkInsightsPathCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DeleteNetworkInsightsPathCommandOutput, SdkError | EC2ServiceError >; @@ -4228,10 +4372,10 @@ interface EC2Service$ { /** * @see {@link DeleteNetworkInterfaceCommand} */ - readonly deleteNetworkInterface: ( + deleteNetworkInterface( args: DeleteNetworkInterfaceCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DeleteNetworkInterfaceCommandOutput, SdkError | EC2ServiceError >; @@ -4239,10 +4383,10 @@ interface EC2Service$ { /** * @see {@link DeleteNetworkInterfacePermissionCommand} */ - readonly deleteNetworkInterfacePermission: ( + deleteNetworkInterfacePermission( args: DeleteNetworkInterfacePermissionCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DeleteNetworkInterfacePermissionCommandOutput, SdkError | EC2ServiceError >; @@ -4250,10 +4394,10 @@ interface EC2Service$ { /** * @see {@link DeletePlacementGroupCommand} */ - readonly deletePlacementGroup: ( + deletePlacementGroup( args: DeletePlacementGroupCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DeletePlacementGroupCommandOutput, SdkError | EC2ServiceError >; @@ -4261,10 +4405,10 @@ interface EC2Service$ { /** * @see {@link DeletePublicIpv4PoolCommand} */ - readonly deletePublicIpv4Pool: ( + deletePublicIpv4Pool( args: DeletePublicIpv4PoolCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DeletePublicIpv4PoolCommandOutput, SdkError | EC2ServiceError >; @@ -4272,10 +4416,10 @@ interface EC2Service$ { /** * @see {@link DeleteQueuedReservedInstancesCommand} */ - readonly deleteQueuedReservedInstances: ( + deleteQueuedReservedInstances( args: DeleteQueuedReservedInstancesCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DeleteQueuedReservedInstancesCommandOutput, SdkError | EC2ServiceError >; @@ -4283,26 +4427,26 @@ interface EC2Service$ { /** * @see {@link DeleteRouteCommand} */ - readonly deleteRoute: ( + deleteRoute( args: DeleteRouteCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect; + ): Effect.Effect; /** * @see {@link DeleteRouteTableCommand} */ - readonly deleteRouteTable: ( + deleteRouteTable( args: DeleteRouteTableCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect; + ): Effect.Effect; /** * @see {@link DeleteSecurityGroupCommand} */ - readonly deleteSecurityGroup: ( + deleteSecurityGroup( args: DeleteSecurityGroupCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DeleteSecurityGroupCommandOutput, SdkError | EC2ServiceError >; @@ -4310,18 +4454,18 @@ interface EC2Service$ { /** * @see {@link DeleteSnapshotCommand} */ - readonly deleteSnapshot: ( + deleteSnapshot( args: DeleteSnapshotCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect; + ): Effect.Effect; /** * @see {@link DeleteSpotDatafeedSubscriptionCommand} */ - readonly deleteSpotDatafeedSubscription: ( + deleteSpotDatafeedSubscription( args: DeleteSpotDatafeedSubscriptionCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DeleteSpotDatafeedSubscriptionCommandOutput, SdkError | EC2ServiceError >; @@ -4329,18 +4473,18 @@ interface EC2Service$ { /** * @see {@link DeleteSubnetCommand} */ - readonly deleteSubnet: ( + deleteSubnet( args: DeleteSubnetCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect; + ): Effect.Effect; /** * @see {@link DeleteSubnetCidrReservationCommand} */ - readonly deleteSubnetCidrReservation: ( + deleteSubnetCidrReservation( args: DeleteSubnetCidrReservationCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DeleteSubnetCidrReservationCommandOutput, SdkError | EC2ServiceError >; @@ -4348,18 +4492,18 @@ interface EC2Service$ { /** * @see {@link DeleteTagsCommand} */ - readonly deleteTags: ( + deleteTags( args: DeleteTagsCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect; + ): Effect.Effect; /** * @see {@link DeleteTrafficMirrorFilterCommand} */ - readonly deleteTrafficMirrorFilter: ( + deleteTrafficMirrorFilter( args: DeleteTrafficMirrorFilterCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DeleteTrafficMirrorFilterCommandOutput, SdkError | EC2ServiceError >; @@ -4367,10 +4511,10 @@ interface EC2Service$ { /** * @see {@link DeleteTrafficMirrorFilterRuleCommand} */ - readonly deleteTrafficMirrorFilterRule: ( + deleteTrafficMirrorFilterRule( args: DeleteTrafficMirrorFilterRuleCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DeleteTrafficMirrorFilterRuleCommandOutput, SdkError | EC2ServiceError >; @@ -4378,10 +4522,10 @@ interface EC2Service$ { /** * @see {@link DeleteTrafficMirrorSessionCommand} */ - readonly deleteTrafficMirrorSession: ( + deleteTrafficMirrorSession( args: DeleteTrafficMirrorSessionCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DeleteTrafficMirrorSessionCommandOutput, SdkError | EC2ServiceError >; @@ -4389,10 +4533,10 @@ interface EC2Service$ { /** * @see {@link DeleteTrafficMirrorTargetCommand} */ - readonly deleteTrafficMirrorTarget: ( + deleteTrafficMirrorTarget( args: DeleteTrafficMirrorTargetCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DeleteTrafficMirrorTargetCommandOutput, SdkError | EC2ServiceError >; @@ -4400,10 +4544,10 @@ interface EC2Service$ { /** * @see {@link DeleteTransitGatewayCommand} */ - readonly deleteTransitGateway: ( + deleteTransitGateway( args: DeleteTransitGatewayCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DeleteTransitGatewayCommandOutput, SdkError | EC2ServiceError >; @@ -4411,10 +4555,10 @@ interface EC2Service$ { /** * @see {@link DeleteTransitGatewayConnectCommand} */ - readonly deleteTransitGatewayConnect: ( + deleteTransitGatewayConnect( args: DeleteTransitGatewayConnectCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DeleteTransitGatewayConnectCommandOutput, SdkError | EC2ServiceError >; @@ -4422,10 +4566,10 @@ interface EC2Service$ { /** * @see {@link DeleteTransitGatewayConnectPeerCommand} */ - readonly deleteTransitGatewayConnectPeer: ( + deleteTransitGatewayConnectPeer( args: DeleteTransitGatewayConnectPeerCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DeleteTransitGatewayConnectPeerCommandOutput, SdkError | EC2ServiceError >; @@ -4433,10 +4577,10 @@ interface EC2Service$ { /** * @see {@link DeleteTransitGatewayMulticastDomainCommand} */ - readonly deleteTransitGatewayMulticastDomain: ( + deleteTransitGatewayMulticastDomain( args: DeleteTransitGatewayMulticastDomainCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DeleteTransitGatewayMulticastDomainCommandOutput, SdkError | EC2ServiceError >; @@ -4444,10 +4588,10 @@ interface EC2Service$ { /** * @see {@link DeleteTransitGatewayPeeringAttachmentCommand} */ - readonly deleteTransitGatewayPeeringAttachment: ( + deleteTransitGatewayPeeringAttachment( args: DeleteTransitGatewayPeeringAttachmentCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DeleteTransitGatewayPeeringAttachmentCommandOutput, SdkError | EC2ServiceError >; @@ -4455,10 +4599,10 @@ interface EC2Service$ { /** * @see {@link DeleteTransitGatewayPolicyTableCommand} */ - readonly deleteTransitGatewayPolicyTable: ( + deleteTransitGatewayPolicyTable( args: DeleteTransitGatewayPolicyTableCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DeleteTransitGatewayPolicyTableCommandOutput, SdkError | EC2ServiceError >; @@ -4466,10 +4610,10 @@ interface EC2Service$ { /** * @see {@link DeleteTransitGatewayPrefixListReferenceCommand} */ - readonly deleteTransitGatewayPrefixListReference: ( + deleteTransitGatewayPrefixListReference( args: DeleteTransitGatewayPrefixListReferenceCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DeleteTransitGatewayPrefixListReferenceCommandOutput, SdkError | EC2ServiceError >; @@ -4477,10 +4621,10 @@ interface EC2Service$ { /** * @see {@link DeleteTransitGatewayRouteCommand} */ - readonly deleteTransitGatewayRoute: ( + deleteTransitGatewayRoute( args: DeleteTransitGatewayRouteCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DeleteTransitGatewayRouteCommandOutput, SdkError | EC2ServiceError >; @@ -4488,10 +4632,10 @@ interface EC2Service$ { /** * @see {@link DeleteTransitGatewayRouteTableCommand} */ - readonly deleteTransitGatewayRouteTable: ( + deleteTransitGatewayRouteTable( args: DeleteTransitGatewayRouteTableCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DeleteTransitGatewayRouteTableCommandOutput, SdkError | EC2ServiceError >; @@ -4499,10 +4643,10 @@ interface EC2Service$ { /** * @see {@link DeleteTransitGatewayRouteTableAnnouncementCommand} */ - readonly deleteTransitGatewayRouteTableAnnouncement: ( + deleteTransitGatewayRouteTableAnnouncement( args: DeleteTransitGatewayRouteTableAnnouncementCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DeleteTransitGatewayRouteTableAnnouncementCommandOutput, SdkError | EC2ServiceError >; @@ -4510,10 +4654,10 @@ interface EC2Service$ { /** * @see {@link DeleteTransitGatewayVpcAttachmentCommand} */ - readonly deleteTransitGatewayVpcAttachment: ( + deleteTransitGatewayVpcAttachment( args: DeleteTransitGatewayVpcAttachmentCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DeleteTransitGatewayVpcAttachmentCommandOutput, SdkError | EC2ServiceError >; @@ -4521,10 +4665,10 @@ interface EC2Service$ { /** * @see {@link DeleteVerifiedAccessEndpointCommand} */ - readonly deleteVerifiedAccessEndpoint: ( + deleteVerifiedAccessEndpoint( args: DeleteVerifiedAccessEndpointCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DeleteVerifiedAccessEndpointCommandOutput, SdkError | EC2ServiceError >; @@ -4532,10 +4676,10 @@ interface EC2Service$ { /** * @see {@link DeleteVerifiedAccessGroupCommand} */ - readonly deleteVerifiedAccessGroup: ( + deleteVerifiedAccessGroup( args: DeleteVerifiedAccessGroupCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DeleteVerifiedAccessGroupCommandOutput, SdkError | EC2ServiceError >; @@ -4543,10 +4687,10 @@ interface EC2Service$ { /** * @see {@link DeleteVerifiedAccessInstanceCommand} */ - readonly deleteVerifiedAccessInstance: ( + deleteVerifiedAccessInstance( args: DeleteVerifiedAccessInstanceCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DeleteVerifiedAccessInstanceCommandOutput, SdkError | EC2ServiceError >; @@ -4554,10 +4698,10 @@ interface EC2Service$ { /** * @see {@link DeleteVerifiedAccessTrustProviderCommand} */ - readonly deleteVerifiedAccessTrustProvider: ( + deleteVerifiedAccessTrustProvider( args: DeleteVerifiedAccessTrustProviderCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DeleteVerifiedAccessTrustProviderCommandOutput, SdkError | EC2ServiceError >; @@ -4565,59 +4709,56 @@ interface EC2Service$ { /** * @see {@link DeleteVolumeCommand} */ - readonly deleteVolume: ( + deleteVolume( args: DeleteVolumeCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect; + ): Effect.Effect; /** * @see {@link DeleteVpcCommand} */ - readonly deleteVpc: ( + deleteVpc( args: DeleteVpcCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect; + ): Effect.Effect; /** * @see {@link DeleteVpcEndpointConnectionNotificationsCommand} */ - readonly deleteVpcEndpointConnectionNotifications: ( + deleteVpcEndpointConnectionNotifications( args: DeleteVpcEndpointConnectionNotificationsCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DeleteVpcEndpointConnectionNotificationsCommandOutput, SdkError | EC2ServiceError >; /** - * @see {@link DeleteVpcEndpointsCommand} + * @see {@link DeleteVpcEndpointServiceConfigurationsCommand} */ - readonly deleteVpcEndpoints: ( - args: DeleteVpcEndpointsCommandInput, + deleteVpcEndpointServiceConfigurations( + args: DeleteVpcEndpointServiceConfigurationsCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< - DeleteVpcEndpointsCommandOutput, + ): Effect.Effect< + DeleteVpcEndpointServiceConfigurationsCommandOutput, SdkError | EC2ServiceError >; /** - * @see {@link DeleteVpcEndpointServiceConfigurationsCommand} + * @see {@link DeleteVpcEndpointsCommand} */ - readonly deleteVpcEndpointServiceConfigurations: ( - args: DeleteVpcEndpointServiceConfigurationsCommandInput, + deleteVpcEndpoints( + args: DeleteVpcEndpointsCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< - DeleteVpcEndpointServiceConfigurationsCommandOutput, - SdkError | EC2ServiceError - >; + ): Effect.Effect; /** * @see {@link DeleteVpcPeeringConnectionCommand} */ - readonly deleteVpcPeeringConnection: ( + deleteVpcPeeringConnection( args: DeleteVpcPeeringConnectionCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DeleteVpcPeeringConnectionCommandOutput, SdkError | EC2ServiceError >; @@ -4625,10 +4766,10 @@ interface EC2Service$ { /** * @see {@link DeleteVpnConnectionCommand} */ - readonly deleteVpnConnection: ( + deleteVpnConnection( args: DeleteVpnConnectionCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DeleteVpnConnectionCommandOutput, SdkError | EC2ServiceError >; @@ -4636,10 +4777,10 @@ interface EC2Service$ { /** * @see {@link DeleteVpnConnectionRouteCommand} */ - readonly deleteVpnConnectionRoute: ( + deleteVpnConnectionRoute( args: DeleteVpnConnectionRouteCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DeleteVpnConnectionRouteCommandOutput, SdkError | EC2ServiceError >; @@ -4647,18 +4788,18 @@ interface EC2Service$ { /** * @see {@link DeleteVpnGatewayCommand} */ - readonly deleteVpnGateway: ( + deleteVpnGateway( args: DeleteVpnGatewayCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect; + ): Effect.Effect; /** * @see {@link DeprovisionByoipCidrCommand} */ - readonly deprovisionByoipCidr: ( + deprovisionByoipCidr( args: DeprovisionByoipCidrCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DeprovisionByoipCidrCommandOutput, SdkError | EC2ServiceError >; @@ -4666,10 +4807,10 @@ interface EC2Service$ { /** * @see {@link DeprovisionIpamByoasnCommand} */ - readonly deprovisionIpamByoasn: ( + deprovisionIpamByoasn( args: DeprovisionIpamByoasnCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DeprovisionIpamByoasnCommandOutput, SdkError | EC2ServiceError >; @@ -4677,10 +4818,10 @@ interface EC2Service$ { /** * @see {@link DeprovisionIpamPoolCidrCommand} */ - readonly deprovisionIpamPoolCidr: ( + deprovisionIpamPoolCidr( args: DeprovisionIpamPoolCidrCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DeprovisionIpamPoolCidrCommandOutput, SdkError | EC2ServiceError >; @@ -4688,10 +4829,10 @@ interface EC2Service$ { /** * @see {@link DeprovisionPublicIpv4PoolCidrCommand} */ - readonly deprovisionPublicIpv4PoolCidr: ( + deprovisionPublicIpv4PoolCidr( args: DeprovisionPublicIpv4PoolCidrCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DeprovisionPublicIpv4PoolCidrCommandOutput, SdkError | EC2ServiceError >; @@ -4699,18 +4840,18 @@ interface EC2Service$ { /** * @see {@link DeregisterImageCommand} */ - readonly deregisterImage: ( + deregisterImage( args: DeregisterImageCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect; + ): Effect.Effect; /** * @see {@link DeregisterInstanceEventNotificationAttributesCommand} */ - readonly deregisterInstanceEventNotificationAttributes: ( + deregisterInstanceEventNotificationAttributes( args: DeregisterInstanceEventNotificationAttributesCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DeregisterInstanceEventNotificationAttributesCommandOutput, SdkError | EC2ServiceError >; @@ -4718,10 +4859,10 @@ interface EC2Service$ { /** * @see {@link DeregisterTransitGatewayMulticastGroupMembersCommand} */ - readonly deregisterTransitGatewayMulticastGroupMembers: ( + deregisterTransitGatewayMulticastGroupMembers( args: DeregisterTransitGatewayMulticastGroupMembersCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DeregisterTransitGatewayMulticastGroupMembersCommandOutput, SdkError | EC2ServiceError >; @@ -4729,10 +4870,10 @@ interface EC2Service$ { /** * @see {@link DeregisterTransitGatewayMulticastGroupSourcesCommand} */ - readonly deregisterTransitGatewayMulticastGroupSources: ( + deregisterTransitGatewayMulticastGroupSources( args: DeregisterTransitGatewayMulticastGroupSourcesCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DeregisterTransitGatewayMulticastGroupSourcesCommandOutput, SdkError | EC2ServiceError >; @@ -4740,54 +4881,51 @@ interface EC2Service$ { /** * @see {@link DescribeAccountAttributesCommand} */ - readonly describeAccountAttributes: ( + describeAccountAttributes( args: DescribeAccountAttributesCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DescribeAccountAttributesCommandOutput, SdkError | EC2ServiceError >; /** - * @see {@link DescribeAddressesCommand} + * @see {@link DescribeAddressTransfersCommand} */ - readonly describeAddresses: ( - args: DescribeAddressesCommandInput, + describeAddressTransfers( + args: DescribeAddressTransfersCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< - DescribeAddressesCommandOutput, + ): Effect.Effect< + DescribeAddressTransfersCommandOutput, SdkError | EC2ServiceError >; /** - * @see {@link DescribeAddressesAttributeCommand} + * @see {@link DescribeAddressesCommand} */ - readonly describeAddressesAttribute: ( - args: DescribeAddressesAttributeCommandInput, + describeAddresses( + args: DescribeAddressesCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< - DescribeAddressesAttributeCommandOutput, - SdkError | EC2ServiceError - >; + ): Effect.Effect; /** - * @see {@link DescribeAddressTransfersCommand} + * @see {@link DescribeAddressesAttributeCommand} */ - readonly describeAddressTransfers: ( - args: DescribeAddressTransfersCommandInput, + describeAddressesAttribute( + args: DescribeAddressesAttributeCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< - DescribeAddressTransfersCommandOutput, + ): Effect.Effect< + DescribeAddressesAttributeCommandOutput, SdkError | EC2ServiceError >; /** * @see {@link DescribeAggregateIdFormatCommand} */ - readonly describeAggregateIdFormat: ( + describeAggregateIdFormat( args: DescribeAggregateIdFormatCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DescribeAggregateIdFormatCommandOutput, SdkError | EC2ServiceError >; @@ -4795,10 +4933,10 @@ interface EC2Service$ { /** * @see {@link DescribeAvailabilityZonesCommand} */ - readonly describeAvailabilityZones: ( + describeAvailabilityZones( args: DescribeAvailabilityZonesCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DescribeAvailabilityZonesCommandOutput, SdkError | EC2ServiceError >; @@ -4806,10 +4944,10 @@ interface EC2Service$ { /** * @see {@link DescribeAwsNetworkPerformanceMetricSubscriptionsCommand} */ - readonly describeAwsNetworkPerformanceMetricSubscriptions: ( + describeAwsNetworkPerformanceMetricSubscriptions( args: DescribeAwsNetworkPerformanceMetricSubscriptionsCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DescribeAwsNetworkPerformanceMetricSubscriptionsCommandOutput, SdkError | EC2ServiceError >; @@ -4817,10 +4955,10 @@ interface EC2Service$ { /** * @see {@link DescribeBundleTasksCommand} */ - readonly describeBundleTasks: ( + describeBundleTasks( args: DescribeBundleTasksCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DescribeBundleTasksCommandOutput, SdkError | EC2ServiceError >; @@ -4828,32 +4966,40 @@ interface EC2Service$ { /** * @see {@link DescribeByoipCidrsCommand} */ - readonly describeByoipCidrs: ( + describeByoipCidrs( args: DescribeByoipCidrsCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< - DescribeByoipCidrsCommandOutput, - SdkError | EC2ServiceError - >; + ): Effect.Effect; /** * @see {@link DescribeCapacityBlockOfferingsCommand} */ - readonly describeCapacityBlockOfferings: ( + describeCapacityBlockOfferings( args: DescribeCapacityBlockOfferingsCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DescribeCapacityBlockOfferingsCommandOutput, SdkError | EC2ServiceError >; + /** + * @see {@link DescribeCapacityReservationBillingRequestsCommand} + */ + describeCapacityReservationBillingRequests( + args: DescribeCapacityReservationBillingRequestsCommandInput, + options?: HttpHandlerOptions, + ): Effect.Effect< + DescribeCapacityReservationBillingRequestsCommandOutput, + SdkError | EC2ServiceError + >; + /** * @see {@link DescribeCapacityReservationFleetsCommand} */ - readonly describeCapacityReservationFleets: ( + describeCapacityReservationFleets( args: DescribeCapacityReservationFleetsCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DescribeCapacityReservationFleetsCommandOutput, SdkError | EC2ServiceError >; @@ -4861,10 +5007,10 @@ interface EC2Service$ { /** * @see {@link DescribeCapacityReservationsCommand} */ - readonly describeCapacityReservations: ( + describeCapacityReservations( args: DescribeCapacityReservationsCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DescribeCapacityReservationsCommandOutput, SdkError | EC2ServiceError >; @@ -4872,10 +5018,10 @@ interface EC2Service$ { /** * @see {@link DescribeCarrierGatewaysCommand} */ - readonly describeCarrierGateways: ( + describeCarrierGateways( args: DescribeCarrierGatewaysCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DescribeCarrierGatewaysCommandOutput, SdkError | EC2ServiceError >; @@ -4883,10 +5029,10 @@ interface EC2Service$ { /** * @see {@link DescribeClassicLinkInstancesCommand} */ - readonly describeClassicLinkInstances: ( + describeClassicLinkInstances( args: DescribeClassicLinkInstancesCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DescribeClassicLinkInstancesCommandOutput, SdkError | EC2ServiceError >; @@ -4894,10 +5040,10 @@ interface EC2Service$ { /** * @see {@link DescribeClientVpnAuthorizationRulesCommand} */ - readonly describeClientVpnAuthorizationRules: ( + describeClientVpnAuthorizationRules( args: DescribeClientVpnAuthorizationRulesCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DescribeClientVpnAuthorizationRulesCommandOutput, SdkError | EC2ServiceError >; @@ -4905,10 +5051,10 @@ interface EC2Service$ { /** * @see {@link DescribeClientVpnConnectionsCommand} */ - readonly describeClientVpnConnections: ( + describeClientVpnConnections( args: DescribeClientVpnConnectionsCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DescribeClientVpnConnectionsCommandOutput, SdkError | EC2ServiceError >; @@ -4916,10 +5062,10 @@ interface EC2Service$ { /** * @see {@link DescribeClientVpnEndpointsCommand} */ - readonly describeClientVpnEndpoints: ( + describeClientVpnEndpoints( args: DescribeClientVpnEndpointsCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DescribeClientVpnEndpointsCommandOutput, SdkError | EC2ServiceError >; @@ -4927,10 +5073,10 @@ interface EC2Service$ { /** * @see {@link DescribeClientVpnRoutesCommand} */ - readonly describeClientVpnRoutes: ( + describeClientVpnRoutes( args: DescribeClientVpnRoutesCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DescribeClientVpnRoutesCommandOutput, SdkError | EC2ServiceError >; @@ -4938,10 +5084,10 @@ interface EC2Service$ { /** * @see {@link DescribeClientVpnTargetNetworksCommand} */ - readonly describeClientVpnTargetNetworks: ( + describeClientVpnTargetNetworks( args: DescribeClientVpnTargetNetworksCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DescribeClientVpnTargetNetworksCommandOutput, SdkError | EC2ServiceError >; @@ -4949,21 +5095,18 @@ interface EC2Service$ { /** * @see {@link DescribeCoipPoolsCommand} */ - readonly describeCoipPools: ( + describeCoipPools( args: DescribeCoipPoolsCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< - DescribeCoipPoolsCommandOutput, - SdkError | EC2ServiceError - >; + ): Effect.Effect; /** * @see {@link DescribeConversionTasksCommand} */ - readonly describeConversionTasks: ( + describeConversionTasks( args: DescribeConversionTasksCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DescribeConversionTasksCommandOutput, SdkError | EC2ServiceError >; @@ -4971,10 +5114,10 @@ interface EC2Service$ { /** * @see {@link DescribeCustomerGatewaysCommand} */ - readonly describeCustomerGateways: ( + describeCustomerGateways( args: DescribeCustomerGatewaysCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DescribeCustomerGatewaysCommandOutput, SdkError | EC2ServiceError >; @@ -4982,10 +5125,10 @@ interface EC2Service$ { /** * @see {@link DescribeDhcpOptionsCommand} */ - readonly describeDhcpOptions: ( + describeDhcpOptions( args: DescribeDhcpOptionsCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DescribeDhcpOptionsCommandOutput, SdkError | EC2ServiceError >; @@ -4993,10 +5136,10 @@ interface EC2Service$ { /** * @see {@link DescribeEgressOnlyInternetGatewaysCommand} */ - readonly describeEgressOnlyInternetGateways: ( + describeEgressOnlyInternetGateways( args: DescribeEgressOnlyInternetGatewaysCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DescribeEgressOnlyInternetGatewaysCommandOutput, SdkError | EC2ServiceError >; @@ -5004,10 +5147,10 @@ interface EC2Service$ { /** * @see {@link DescribeElasticGpusCommand} */ - readonly describeElasticGpus: ( + describeElasticGpus( args: DescribeElasticGpusCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DescribeElasticGpusCommandOutput, SdkError | EC2ServiceError >; @@ -5015,10 +5158,10 @@ interface EC2Service$ { /** * @see {@link DescribeExportImageTasksCommand} */ - readonly describeExportImageTasks: ( + describeExportImageTasks( args: DescribeExportImageTasksCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DescribeExportImageTasksCommandOutput, SdkError | EC2ServiceError >; @@ -5026,10 +5169,10 @@ interface EC2Service$ { /** * @see {@link DescribeExportTasksCommand} */ - readonly describeExportTasks: ( + describeExportTasks( args: DescribeExportTasksCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DescribeExportTasksCommandOutput, SdkError | EC2ServiceError >; @@ -5037,10 +5180,10 @@ interface EC2Service$ { /** * @see {@link DescribeFastLaunchImagesCommand} */ - readonly describeFastLaunchImages: ( + describeFastLaunchImages( args: DescribeFastLaunchImagesCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DescribeFastLaunchImagesCommandOutput, SdkError | EC2ServiceError >; @@ -5048,10 +5191,10 @@ interface EC2Service$ { /** * @see {@link DescribeFastSnapshotRestoresCommand} */ - readonly describeFastSnapshotRestores: ( + describeFastSnapshotRestores( args: DescribeFastSnapshotRestoresCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DescribeFastSnapshotRestoresCommandOutput, SdkError | EC2ServiceError >; @@ -5059,10 +5202,10 @@ interface EC2Service$ { /** * @see {@link DescribeFleetHistoryCommand} */ - readonly describeFleetHistory: ( + describeFleetHistory( args: DescribeFleetHistoryCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DescribeFleetHistoryCommandOutput, SdkError | EC2ServiceError >; @@ -5070,10 +5213,10 @@ interface EC2Service$ { /** * @see {@link DescribeFleetInstancesCommand} */ - readonly describeFleetInstances: ( + describeFleetInstances( args: DescribeFleetInstancesCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DescribeFleetInstancesCommandOutput, SdkError | EC2ServiceError >; @@ -5081,26 +5224,26 @@ interface EC2Service$ { /** * @see {@link DescribeFleetsCommand} */ - readonly describeFleets: ( + describeFleets( args: DescribeFleetsCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect; + ): Effect.Effect; /** * @see {@link DescribeFlowLogsCommand} */ - readonly describeFlowLogs: ( + describeFlowLogs( args: DescribeFlowLogsCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect; + ): Effect.Effect; /** * @see {@link DescribeFpgaImageAttributeCommand} */ - readonly describeFpgaImageAttribute: ( + describeFpgaImageAttribute( args: DescribeFpgaImageAttributeCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DescribeFpgaImageAttributeCommandOutput, SdkError | EC2ServiceError >; @@ -5108,21 +5251,18 @@ interface EC2Service$ { /** * @see {@link DescribeFpgaImagesCommand} */ - readonly describeFpgaImages: ( + describeFpgaImages( args: DescribeFpgaImagesCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< - DescribeFpgaImagesCommandOutput, - SdkError | EC2ServiceError - >; + ): Effect.Effect; /** * @see {@link DescribeHostReservationOfferingsCommand} */ - readonly describeHostReservationOfferings: ( + describeHostReservationOfferings( args: DescribeHostReservationOfferingsCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DescribeHostReservationOfferingsCommandOutput, SdkError | EC2ServiceError >; @@ -5130,10 +5270,10 @@ interface EC2Service$ { /** * @see {@link DescribeHostReservationsCommand} */ - readonly describeHostReservations: ( + describeHostReservations( args: DescribeHostReservationsCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DescribeHostReservationsCommandOutput, SdkError | EC2ServiceError >; @@ -5141,48 +5281,48 @@ interface EC2Service$ { /** * @see {@link DescribeHostsCommand} */ - readonly describeHosts: ( + describeHosts( args: DescribeHostsCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect; + ): Effect.Effect; /** * @see {@link DescribeIamInstanceProfileAssociationsCommand} */ - readonly describeIamInstanceProfileAssociations: ( + describeIamInstanceProfileAssociations( args: DescribeIamInstanceProfileAssociationsCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DescribeIamInstanceProfileAssociationsCommandOutput, SdkError | EC2ServiceError >; + /** + * @see {@link DescribeIdFormatCommand} + */ + describeIdFormat( + args: DescribeIdFormatCommandInput, + options?: HttpHandlerOptions, + ): Effect.Effect; + /** * @see {@link DescribeIdentityIdFormatCommand} */ - readonly describeIdentityIdFormat: ( + describeIdentityIdFormat( args: DescribeIdentityIdFormatCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DescribeIdentityIdFormatCommandOutput, SdkError | EC2ServiceError >; - /** - * @see {@link DescribeIdFormatCommand} - */ - readonly describeIdFormat: ( - args: DescribeIdFormatCommandInput, - options?: HttpHandlerOptions, - ) => Effect.Effect; - /** * @see {@link DescribeImageAttributeCommand} */ - readonly describeImageAttribute: ( + describeImageAttribute( args: DescribeImageAttributeCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DescribeImageAttributeCommandOutput, SdkError | EC2ServiceError >; @@ -5190,18 +5330,18 @@ interface EC2Service$ { /** * @see {@link DescribeImagesCommand} */ - readonly describeImages: ( + describeImages( args: DescribeImagesCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect; + ): Effect.Effect; /** * @see {@link DescribeImportImageTasksCommand} */ - readonly describeImportImageTasks: ( + describeImportImageTasks( args: DescribeImportImageTasksCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DescribeImportImageTasksCommandOutput, SdkError | EC2ServiceError >; @@ -5209,10 +5349,10 @@ interface EC2Service$ { /** * @see {@link DescribeImportSnapshotTasksCommand} */ - readonly describeImportSnapshotTasks: ( + describeImportSnapshotTasks( args: DescribeImportSnapshotTasksCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DescribeImportSnapshotTasksCommandOutput, SdkError | EC2ServiceError >; @@ -5220,10 +5360,10 @@ interface EC2Service$ { /** * @see {@link DescribeInstanceAttributeCommand} */ - readonly describeInstanceAttribute: ( + describeInstanceAttribute( args: DescribeInstanceAttributeCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DescribeInstanceAttributeCommandOutput, SdkError | EC2ServiceError >; @@ -5231,10 +5371,10 @@ interface EC2Service$ { /** * @see {@link DescribeInstanceConnectEndpointsCommand} */ - readonly describeInstanceConnectEndpoints: ( + describeInstanceConnectEndpoints( args: DescribeInstanceConnectEndpointsCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DescribeInstanceConnectEndpointsCommandOutput, SdkError | EC2ServiceError >; @@ -5242,10 +5382,10 @@ interface EC2Service$ { /** * @see {@link DescribeInstanceCreditSpecificationsCommand} */ - readonly describeInstanceCreditSpecifications: ( + describeInstanceCreditSpecifications( args: DescribeInstanceCreditSpecificationsCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DescribeInstanceCreditSpecificationsCommandOutput, SdkError | EC2ServiceError >; @@ -5253,10 +5393,10 @@ interface EC2Service$ { /** * @see {@link DescribeInstanceEventNotificationAttributesCommand} */ - readonly describeInstanceEventNotificationAttributes: ( + describeInstanceEventNotificationAttributes( args: DescribeInstanceEventNotificationAttributesCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DescribeInstanceEventNotificationAttributesCommandOutput, SdkError | EC2ServiceError >; @@ -5264,32 +5404,32 @@ interface EC2Service$ { /** * @see {@link DescribeInstanceEventWindowsCommand} */ - readonly describeInstanceEventWindows: ( + describeInstanceEventWindows( args: DescribeInstanceEventWindowsCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DescribeInstanceEventWindowsCommandOutput, SdkError | EC2ServiceError >; /** - * @see {@link DescribeInstancesCommand} + * @see {@link DescribeInstanceImageMetadataCommand} */ - readonly describeInstances: ( - args: DescribeInstancesCommandInput, + describeInstanceImageMetadata( + args: DescribeInstanceImageMetadataCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< - DescribeInstancesCommandOutput, + ): Effect.Effect< + DescribeInstanceImageMetadataCommandOutput, SdkError | EC2ServiceError >; /** * @see {@link DescribeInstanceStatusCommand} */ - readonly describeInstanceStatus: ( + describeInstanceStatus( args: DescribeInstanceStatusCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DescribeInstanceStatusCommandOutput, SdkError | EC2ServiceError >; @@ -5297,10 +5437,10 @@ interface EC2Service$ { /** * @see {@link DescribeInstanceTopologyCommand} */ - readonly describeInstanceTopology: ( + describeInstanceTopology( args: DescribeInstanceTopologyCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DescribeInstanceTopologyCommandOutput, SdkError | EC2ServiceError >; @@ -5308,10 +5448,10 @@ interface EC2Service$ { /** * @see {@link DescribeInstanceTypeOfferingsCommand} */ - readonly describeInstanceTypeOfferings: ( + describeInstanceTypeOfferings( args: DescribeInstanceTypeOfferingsCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DescribeInstanceTypeOfferingsCommandOutput, SdkError | EC2ServiceError >; @@ -5319,21 +5459,29 @@ interface EC2Service$ { /** * @see {@link DescribeInstanceTypesCommand} */ - readonly describeInstanceTypes: ( + describeInstanceTypes( args: DescribeInstanceTypesCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DescribeInstanceTypesCommandOutput, SdkError | EC2ServiceError >; + /** + * @see {@link DescribeInstancesCommand} + */ + describeInstances( + args: DescribeInstancesCommandInput, + options?: HttpHandlerOptions, + ): Effect.Effect; + /** * @see {@link DescribeInternetGatewaysCommand} */ - readonly describeInternetGateways: ( + describeInternetGateways( args: DescribeInternetGatewaysCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DescribeInternetGatewaysCommandOutput, SdkError | EC2ServiceError >; @@ -5341,32 +5489,37 @@ interface EC2Service$ { /** * @see {@link DescribeIpamByoasnCommand} */ - readonly describeIpamByoasn: ( + describeIpamByoasn( args: DescribeIpamByoasnCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< - DescribeIpamByoasnCommandOutput, + ): Effect.Effect; + + /** + * @see {@link DescribeIpamExternalResourceVerificationTokensCommand} + */ + describeIpamExternalResourceVerificationTokens( + args: DescribeIpamExternalResourceVerificationTokensCommandInput, + options?: HttpHandlerOptions, + ): Effect.Effect< + DescribeIpamExternalResourceVerificationTokensCommandOutput, SdkError | EC2ServiceError >; /** * @see {@link DescribeIpamPoolsCommand} */ - readonly describeIpamPools: ( + describeIpamPools( args: DescribeIpamPoolsCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< - DescribeIpamPoolsCommandOutput, - SdkError | EC2ServiceError - >; + ): Effect.Effect; /** * @see {@link DescribeIpamResourceDiscoveriesCommand} */ - readonly describeIpamResourceDiscoveries: ( + describeIpamResourceDiscoveries( args: DescribeIpamResourceDiscoveriesCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DescribeIpamResourceDiscoveriesCommandOutput, SdkError | EC2ServiceError >; @@ -5374,92 +5527,75 @@ interface EC2Service$ { /** * @see {@link DescribeIpamResourceDiscoveryAssociationsCommand} */ - readonly describeIpamResourceDiscoveryAssociations: ( + describeIpamResourceDiscoveryAssociations( args: DescribeIpamResourceDiscoveryAssociationsCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DescribeIpamResourceDiscoveryAssociationsCommandOutput, SdkError | EC2ServiceError >; /** - * @see {@link DescribeIpamsCommand} + * @see {@link DescribeIpamScopesCommand} */ - readonly describeIpams: ( - args: DescribeIpamsCommandInput, + describeIpamScopes( + args: DescribeIpamScopesCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect; + ): Effect.Effect; /** - * @see {@link DescribeIpamScopesCommand} + * @see {@link DescribeIpamsCommand} */ - readonly describeIpamScopes: ( - args: DescribeIpamScopesCommandInput, + describeIpams( + args: DescribeIpamsCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< - DescribeIpamScopesCommandOutput, - SdkError | EC2ServiceError - >; + ): Effect.Effect; /** * @see {@link DescribeIpv6PoolsCommand} */ - readonly describeIpv6Pools: ( + describeIpv6Pools( args: DescribeIpv6PoolsCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< - DescribeIpv6PoolsCommandOutput, - SdkError | EC2ServiceError - >; + ): Effect.Effect; /** * @see {@link DescribeKeyPairsCommand} */ - readonly describeKeyPairs: ( + describeKeyPairs( args: DescribeKeyPairsCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect; - - /** - * @see {@link DescribeLaunchTemplatesCommand} - */ - readonly describeLaunchTemplates: ( - args: DescribeLaunchTemplatesCommandInput, - options?: HttpHandlerOptions, - ) => Effect.Effect< - DescribeLaunchTemplatesCommandOutput, - SdkError | EC2ServiceError - >; + ): Effect.Effect; /** * @see {@link DescribeLaunchTemplateVersionsCommand} */ - readonly describeLaunchTemplateVersions: ( + describeLaunchTemplateVersions( args: DescribeLaunchTemplateVersionsCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DescribeLaunchTemplateVersionsCommandOutput, SdkError | EC2ServiceError >; /** - * @see {@link DescribeLocalGatewayRouteTablesCommand} + * @see {@link DescribeLaunchTemplatesCommand} */ - readonly describeLocalGatewayRouteTables: ( - args: DescribeLocalGatewayRouteTablesCommandInput, + describeLaunchTemplates( + args: DescribeLaunchTemplatesCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< - DescribeLocalGatewayRouteTablesCommandOutput, + ): Effect.Effect< + DescribeLaunchTemplatesCommandOutput, SdkError | EC2ServiceError >; /** * @see {@link DescribeLocalGatewayRouteTableVirtualInterfaceGroupAssociationsCommand} */ - readonly describeLocalGatewayRouteTableVirtualInterfaceGroupAssociations: ( + describeLocalGatewayRouteTableVirtualInterfaceGroupAssociations( args: DescribeLocalGatewayRouteTableVirtualInterfaceGroupAssociationsCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DescribeLocalGatewayRouteTableVirtualInterfaceGroupAssociationsCommandOutput, SdkError | EC2ServiceError >; @@ -5467,32 +5603,32 @@ interface EC2Service$ { /** * @see {@link DescribeLocalGatewayRouteTableVpcAssociationsCommand} */ - readonly describeLocalGatewayRouteTableVpcAssociations: ( + describeLocalGatewayRouteTableVpcAssociations( args: DescribeLocalGatewayRouteTableVpcAssociationsCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DescribeLocalGatewayRouteTableVpcAssociationsCommandOutput, SdkError | EC2ServiceError >; /** - * @see {@link DescribeLocalGatewaysCommand} + * @see {@link DescribeLocalGatewayRouteTablesCommand} */ - readonly describeLocalGateways: ( - args: DescribeLocalGatewaysCommandInput, + describeLocalGatewayRouteTables( + args: DescribeLocalGatewayRouteTablesCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< - DescribeLocalGatewaysCommandOutput, + ): Effect.Effect< + DescribeLocalGatewayRouteTablesCommandOutput, SdkError | EC2ServiceError >; /** * @see {@link DescribeLocalGatewayVirtualInterfaceGroupsCommand} */ - readonly describeLocalGatewayVirtualInterfaceGroups: ( + describeLocalGatewayVirtualInterfaceGroups( args: DescribeLocalGatewayVirtualInterfaceGroupsCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DescribeLocalGatewayVirtualInterfaceGroupsCommandOutput, SdkError | EC2ServiceError >; @@ -5500,32 +5636,51 @@ interface EC2Service$ { /** * @see {@link DescribeLocalGatewayVirtualInterfacesCommand} */ - readonly describeLocalGatewayVirtualInterfaces: ( + describeLocalGatewayVirtualInterfaces( args: DescribeLocalGatewayVirtualInterfacesCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DescribeLocalGatewayVirtualInterfacesCommandOutput, SdkError | EC2ServiceError >; + /** + * @see {@link DescribeLocalGatewaysCommand} + */ + describeLocalGateways( + args: DescribeLocalGatewaysCommandInput, + options?: HttpHandlerOptions, + ): Effect.Effect< + DescribeLocalGatewaysCommandOutput, + SdkError | EC2ServiceError + >; + /** * @see {@link DescribeLockedSnapshotsCommand} */ - readonly describeLockedSnapshots: ( + describeLockedSnapshots( args: DescribeLockedSnapshotsCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DescribeLockedSnapshotsCommandOutput, SdkError | EC2ServiceError >; + /** + * @see {@link DescribeMacHostsCommand} + */ + describeMacHosts( + args: DescribeMacHostsCommandInput, + options?: HttpHandlerOptions, + ): Effect.Effect; + /** * @see {@link DescribeManagedPrefixListsCommand} */ - readonly describeManagedPrefixLists: ( + describeManagedPrefixLists( args: DescribeManagedPrefixListsCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DescribeManagedPrefixListsCommandOutput, SdkError | EC2ServiceError >; @@ -5533,10 +5688,10 @@ interface EC2Service$ { /** * @see {@link DescribeMovingAddressesCommand} */ - readonly describeMovingAddresses: ( + describeMovingAddresses( args: DescribeMovingAddressesCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DescribeMovingAddressesCommandOutput, SdkError | EC2ServiceError >; @@ -5544,10 +5699,10 @@ interface EC2Service$ { /** * @see {@link DescribeNatGatewaysCommand} */ - readonly describeNatGateways: ( + describeNatGateways( args: DescribeNatGatewaysCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DescribeNatGatewaysCommandOutput, SdkError | EC2ServiceError >; @@ -5555,10 +5710,10 @@ interface EC2Service$ { /** * @see {@link DescribeNetworkAclsCommand} */ - readonly describeNetworkAcls: ( + describeNetworkAcls( args: DescribeNetworkAclsCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DescribeNetworkAclsCommandOutput, SdkError | EC2ServiceError >; @@ -5566,10 +5721,10 @@ interface EC2Service$ { /** * @see {@link DescribeNetworkInsightsAccessScopeAnalysesCommand} */ - readonly describeNetworkInsightsAccessScopeAnalyses: ( + describeNetworkInsightsAccessScopeAnalyses( args: DescribeNetworkInsightsAccessScopeAnalysesCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DescribeNetworkInsightsAccessScopeAnalysesCommandOutput, SdkError | EC2ServiceError >; @@ -5577,10 +5732,10 @@ interface EC2Service$ { /** * @see {@link DescribeNetworkInsightsAccessScopesCommand} */ - readonly describeNetworkInsightsAccessScopes: ( + describeNetworkInsightsAccessScopes( args: DescribeNetworkInsightsAccessScopesCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DescribeNetworkInsightsAccessScopesCommandOutput, SdkError | EC2ServiceError >; @@ -5588,10 +5743,10 @@ interface EC2Service$ { /** * @see {@link DescribeNetworkInsightsAnalysesCommand} */ - readonly describeNetworkInsightsAnalyses: ( + describeNetworkInsightsAnalyses( args: DescribeNetworkInsightsAnalysesCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DescribeNetworkInsightsAnalysesCommandOutput, SdkError | EC2ServiceError >; @@ -5599,10 +5754,10 @@ interface EC2Service$ { /** * @see {@link DescribeNetworkInsightsPathsCommand} */ - readonly describeNetworkInsightsPaths: ( + describeNetworkInsightsPaths( args: DescribeNetworkInsightsPathsCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DescribeNetworkInsightsPathsCommandOutput, SdkError | EC2ServiceError >; @@ -5610,10 +5765,10 @@ interface EC2Service$ { /** * @see {@link DescribeNetworkInterfaceAttributeCommand} */ - readonly describeNetworkInterfaceAttribute: ( + describeNetworkInterfaceAttribute( args: DescribeNetworkInterfaceAttributeCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DescribeNetworkInterfaceAttributeCommandOutput, SdkError | EC2ServiceError >; @@ -5621,10 +5776,10 @@ interface EC2Service$ { /** * @see {@link DescribeNetworkInterfacePermissionsCommand} */ - readonly describeNetworkInterfacePermissions: ( + describeNetworkInterfacePermissions( args: DescribeNetworkInterfacePermissionsCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DescribeNetworkInterfacePermissionsCommandOutput, SdkError | EC2ServiceError >; @@ -5632,10 +5787,10 @@ interface EC2Service$ { /** * @see {@link DescribeNetworkInterfacesCommand} */ - readonly describeNetworkInterfaces: ( + describeNetworkInterfaces( args: DescribeNetworkInterfacesCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DescribeNetworkInterfacesCommandOutput, SdkError | EC2ServiceError >; @@ -5643,10 +5798,10 @@ interface EC2Service$ { /** * @see {@link DescribePlacementGroupsCommand} */ - readonly describePlacementGroups: ( + describePlacementGroups( args: DescribePlacementGroupsCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DescribePlacementGroupsCommandOutput, SdkError | EC2ServiceError >; @@ -5654,10 +5809,10 @@ interface EC2Service$ { /** * @see {@link DescribePrefixListsCommand} */ - readonly describePrefixLists: ( + describePrefixLists( args: DescribePrefixListsCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DescribePrefixListsCommandOutput, SdkError | EC2ServiceError >; @@ -5665,10 +5820,10 @@ interface EC2Service$ { /** * @see {@link DescribePrincipalIdFormatCommand} */ - readonly describePrincipalIdFormat: ( + describePrincipalIdFormat( args: DescribePrincipalIdFormatCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DescribePrincipalIdFormatCommandOutput, SdkError | EC2ServiceError >; @@ -5676,10 +5831,10 @@ interface EC2Service$ { /** * @see {@link DescribePublicIpv4PoolsCommand} */ - readonly describePublicIpv4Pools: ( + describePublicIpv4Pools( args: DescribePublicIpv4PoolsCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DescribePublicIpv4PoolsCommandOutput, SdkError | EC2ServiceError >; @@ -5687,18 +5842,18 @@ interface EC2Service$ { /** * @see {@link DescribeRegionsCommand} */ - readonly describeRegions: ( + describeRegions( args: DescribeRegionsCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect; + ): Effect.Effect; /** * @see {@link DescribeReplaceRootVolumeTasksCommand} */ - readonly describeReplaceRootVolumeTasks: ( + describeReplaceRootVolumeTasks( args: DescribeReplaceRootVolumeTasksCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DescribeReplaceRootVolumeTasksCommandOutput, SdkError | EC2ServiceError >; @@ -5706,10 +5861,10 @@ interface EC2Service$ { /** * @see {@link DescribeReservedInstancesCommand} */ - readonly describeReservedInstances: ( + describeReservedInstances( args: DescribeReservedInstancesCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DescribeReservedInstancesCommandOutput, SdkError | EC2ServiceError >; @@ -5717,10 +5872,10 @@ interface EC2Service$ { /** * @see {@link DescribeReservedInstancesListingsCommand} */ - readonly describeReservedInstancesListings: ( + describeReservedInstancesListings( args: DescribeReservedInstancesListingsCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DescribeReservedInstancesListingsCommandOutput, SdkError | EC2ServiceError >; @@ -5728,10 +5883,10 @@ interface EC2Service$ { /** * @see {@link DescribeReservedInstancesModificationsCommand} */ - readonly describeReservedInstancesModifications: ( + describeReservedInstancesModifications( args: DescribeReservedInstancesModificationsCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DescribeReservedInstancesModificationsCommandOutput, SdkError | EC2ServiceError >; @@ -5739,10 +5894,10 @@ interface EC2Service$ { /** * @see {@link DescribeReservedInstancesOfferingsCommand} */ - readonly describeReservedInstancesOfferings: ( + describeReservedInstancesOfferings( args: DescribeReservedInstancesOfferingsCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DescribeReservedInstancesOfferingsCommandOutput, SdkError | EC2ServiceError >; @@ -5750,10 +5905,10 @@ interface EC2Service$ { /** * @see {@link DescribeRouteTablesCommand} */ - readonly describeRouteTables: ( + describeRouteTables( args: DescribeRouteTablesCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DescribeRouteTablesCommandOutput, SdkError | EC2ServiceError >; @@ -5761,10 +5916,10 @@ interface EC2Service$ { /** * @see {@link DescribeScheduledInstanceAvailabilityCommand} */ - readonly describeScheduledInstanceAvailability: ( + describeScheduledInstanceAvailability( args: DescribeScheduledInstanceAvailabilityCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DescribeScheduledInstanceAvailabilityCommandOutput, SdkError | EC2ServiceError >; @@ -5772,10 +5927,10 @@ interface EC2Service$ { /** * @see {@link DescribeScheduledInstancesCommand} */ - readonly describeScheduledInstances: ( + describeScheduledInstances( args: DescribeScheduledInstancesCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DescribeScheduledInstancesCommandOutput, SdkError | EC2ServiceError >; @@ -5783,10 +5938,10 @@ interface EC2Service$ { /** * @see {@link DescribeSecurityGroupReferencesCommand} */ - readonly describeSecurityGroupReferences: ( + describeSecurityGroupReferences( args: DescribeSecurityGroupReferencesCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DescribeSecurityGroupReferencesCommandOutput, SdkError | EC2ServiceError >; @@ -5794,21 +5949,32 @@ interface EC2Service$ { /** * @see {@link DescribeSecurityGroupRulesCommand} */ - readonly describeSecurityGroupRules: ( + describeSecurityGroupRules( args: DescribeSecurityGroupRulesCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DescribeSecurityGroupRulesCommandOutput, SdkError | EC2ServiceError >; + /** + * @see {@link DescribeSecurityGroupVpcAssociationsCommand} + */ + describeSecurityGroupVpcAssociations( + args: DescribeSecurityGroupVpcAssociationsCommandInput, + options?: HttpHandlerOptions, + ): Effect.Effect< + DescribeSecurityGroupVpcAssociationsCommandOutput, + SdkError | EC2ServiceError + >; + /** * @see {@link DescribeSecurityGroupsCommand} */ - readonly describeSecurityGroups: ( + describeSecurityGroups( args: DescribeSecurityGroupsCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DescribeSecurityGroupsCommandOutput, SdkError | EC2ServiceError >; @@ -5816,43 +5982,40 @@ interface EC2Service$ { /** * @see {@link DescribeSnapshotAttributeCommand} */ - readonly describeSnapshotAttribute: ( + describeSnapshotAttribute( args: DescribeSnapshotAttributeCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DescribeSnapshotAttributeCommandOutput, SdkError | EC2ServiceError >; /** - * @see {@link DescribeSnapshotsCommand} + * @see {@link DescribeSnapshotTierStatusCommand} */ - readonly describeSnapshots: ( - args: DescribeSnapshotsCommandInput, + describeSnapshotTierStatus( + args: DescribeSnapshotTierStatusCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< - DescribeSnapshotsCommandOutput, + ): Effect.Effect< + DescribeSnapshotTierStatusCommandOutput, SdkError | EC2ServiceError >; /** - * @see {@link DescribeSnapshotTierStatusCommand} + * @see {@link DescribeSnapshotsCommand} */ - readonly describeSnapshotTierStatus: ( - args: DescribeSnapshotTierStatusCommandInput, + describeSnapshots( + args: DescribeSnapshotsCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< - DescribeSnapshotTierStatusCommandOutput, - SdkError | EC2ServiceError - >; + ): Effect.Effect; /** * @see {@link DescribeSpotDatafeedSubscriptionCommand} */ - readonly describeSpotDatafeedSubscription: ( + describeSpotDatafeedSubscription( args: DescribeSpotDatafeedSubscriptionCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DescribeSpotDatafeedSubscriptionCommandOutput, SdkError | EC2ServiceError >; @@ -5860,10 +6023,10 @@ interface EC2Service$ { /** * @see {@link DescribeSpotFleetInstancesCommand} */ - readonly describeSpotFleetInstances: ( + describeSpotFleetInstances( args: DescribeSpotFleetInstancesCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DescribeSpotFleetInstancesCommandOutput, SdkError | EC2ServiceError >; @@ -5871,10 +6034,10 @@ interface EC2Service$ { /** * @see {@link DescribeSpotFleetRequestHistoryCommand} */ - readonly describeSpotFleetRequestHistory: ( + describeSpotFleetRequestHistory( args: DescribeSpotFleetRequestHistoryCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DescribeSpotFleetRequestHistoryCommandOutput, SdkError | EC2ServiceError >; @@ -5882,10 +6045,10 @@ interface EC2Service$ { /** * @see {@link DescribeSpotFleetRequestsCommand} */ - readonly describeSpotFleetRequests: ( + describeSpotFleetRequests( args: DescribeSpotFleetRequestsCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DescribeSpotFleetRequestsCommandOutput, SdkError | EC2ServiceError >; @@ -5893,10 +6056,10 @@ interface EC2Service$ { /** * @see {@link DescribeSpotInstanceRequestsCommand} */ - readonly describeSpotInstanceRequests: ( + describeSpotInstanceRequests( args: DescribeSpotInstanceRequestsCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DescribeSpotInstanceRequestsCommandOutput, SdkError | EC2ServiceError >; @@ -5904,10 +6067,10 @@ interface EC2Service$ { /** * @see {@link DescribeSpotPriceHistoryCommand} */ - readonly describeSpotPriceHistory: ( + describeSpotPriceHistory( args: DescribeSpotPriceHistoryCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DescribeSpotPriceHistoryCommandOutput, SdkError | EC2ServiceError >; @@ -5915,10 +6078,10 @@ interface EC2Service$ { /** * @see {@link DescribeStaleSecurityGroupsCommand} */ - readonly describeStaleSecurityGroups: ( + describeStaleSecurityGroups( args: DescribeStaleSecurityGroupsCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DescribeStaleSecurityGroupsCommandOutput, SdkError | EC2ServiceError >; @@ -5926,10 +6089,10 @@ interface EC2Service$ { /** * @see {@link DescribeStoreImageTasksCommand} */ - readonly describeStoreImageTasks: ( + describeStoreImageTasks( args: DescribeStoreImageTasksCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DescribeStoreImageTasksCommandOutput, SdkError | EC2ServiceError >; @@ -5937,26 +6100,37 @@ interface EC2Service$ { /** * @see {@link DescribeSubnetsCommand} */ - readonly describeSubnets: ( + describeSubnets( args: DescribeSubnetsCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect; + ): Effect.Effect; /** * @see {@link DescribeTagsCommand} */ - readonly describeTags: ( + describeTags( args: DescribeTagsCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect; + ): Effect.Effect; + + /** + * @see {@link DescribeTrafficMirrorFilterRulesCommand} + */ + describeTrafficMirrorFilterRules( + args: DescribeTrafficMirrorFilterRulesCommandInput, + options?: HttpHandlerOptions, + ): Effect.Effect< + DescribeTrafficMirrorFilterRulesCommandOutput, + SdkError | EC2ServiceError + >; /** * @see {@link DescribeTrafficMirrorFiltersCommand} */ - readonly describeTrafficMirrorFilters: ( + describeTrafficMirrorFilters( args: DescribeTrafficMirrorFiltersCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DescribeTrafficMirrorFiltersCommandOutput, SdkError | EC2ServiceError >; @@ -5964,10 +6138,10 @@ interface EC2Service$ { /** * @see {@link DescribeTrafficMirrorSessionsCommand} */ - readonly describeTrafficMirrorSessions: ( + describeTrafficMirrorSessions( args: DescribeTrafficMirrorSessionsCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DescribeTrafficMirrorSessionsCommandOutput, SdkError | EC2ServiceError >; @@ -5975,10 +6149,10 @@ interface EC2Service$ { /** * @see {@link DescribeTrafficMirrorTargetsCommand} */ - readonly describeTrafficMirrorTargets: ( + describeTrafficMirrorTargets( args: DescribeTrafficMirrorTargetsCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DescribeTrafficMirrorTargetsCommandOutput, SdkError | EC2ServiceError >; @@ -5986,10 +6160,10 @@ interface EC2Service$ { /** * @see {@link DescribeTransitGatewayAttachmentsCommand} */ - readonly describeTransitGatewayAttachments: ( + describeTransitGatewayAttachments( args: DescribeTransitGatewayAttachmentsCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DescribeTransitGatewayAttachmentsCommandOutput, SdkError | EC2ServiceError >; @@ -5997,10 +6171,10 @@ interface EC2Service$ { /** * @see {@link DescribeTransitGatewayConnectPeersCommand} */ - readonly describeTransitGatewayConnectPeers: ( + describeTransitGatewayConnectPeers( args: DescribeTransitGatewayConnectPeersCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DescribeTransitGatewayConnectPeersCommandOutput, SdkError | EC2ServiceError >; @@ -6008,10 +6182,10 @@ interface EC2Service$ { /** * @see {@link DescribeTransitGatewayConnectsCommand} */ - readonly describeTransitGatewayConnects: ( + describeTransitGatewayConnects( args: DescribeTransitGatewayConnectsCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DescribeTransitGatewayConnectsCommandOutput, SdkError | EC2ServiceError >; @@ -6019,10 +6193,10 @@ interface EC2Service$ { /** * @see {@link DescribeTransitGatewayMulticastDomainsCommand} */ - readonly describeTransitGatewayMulticastDomains: ( + describeTransitGatewayMulticastDomains( args: DescribeTransitGatewayMulticastDomainsCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DescribeTransitGatewayMulticastDomainsCommandOutput, SdkError | EC2ServiceError >; @@ -6030,10 +6204,10 @@ interface EC2Service$ { /** * @see {@link DescribeTransitGatewayPeeringAttachmentsCommand} */ - readonly describeTransitGatewayPeeringAttachments: ( + describeTransitGatewayPeeringAttachments( args: DescribeTransitGatewayPeeringAttachmentsCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DescribeTransitGatewayPeeringAttachmentsCommandOutput, SdkError | EC2ServiceError >; @@ -6041,10 +6215,10 @@ interface EC2Service$ { /** * @see {@link DescribeTransitGatewayPolicyTablesCommand} */ - readonly describeTransitGatewayPolicyTables: ( + describeTransitGatewayPolicyTables( args: DescribeTransitGatewayPolicyTablesCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DescribeTransitGatewayPolicyTablesCommandOutput, SdkError | EC2ServiceError >; @@ -6052,10 +6226,10 @@ interface EC2Service$ { /** * @see {@link DescribeTransitGatewayRouteTableAnnouncementsCommand} */ - readonly describeTransitGatewayRouteTableAnnouncements: ( + describeTransitGatewayRouteTableAnnouncements( args: DescribeTransitGatewayRouteTableAnnouncementsCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DescribeTransitGatewayRouteTableAnnouncementsCommandOutput, SdkError | EC2ServiceError >; @@ -6063,43 +6237,43 @@ interface EC2Service$ { /** * @see {@link DescribeTransitGatewayRouteTablesCommand} */ - readonly describeTransitGatewayRouteTables: ( + describeTransitGatewayRouteTables( args: DescribeTransitGatewayRouteTablesCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DescribeTransitGatewayRouteTablesCommandOutput, SdkError | EC2ServiceError >; /** - * @see {@link DescribeTransitGatewaysCommand} + * @see {@link DescribeTransitGatewayVpcAttachmentsCommand} */ - readonly describeTransitGateways: ( - args: DescribeTransitGatewaysCommandInput, + describeTransitGatewayVpcAttachments( + args: DescribeTransitGatewayVpcAttachmentsCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< - DescribeTransitGatewaysCommandOutput, + ): Effect.Effect< + DescribeTransitGatewayVpcAttachmentsCommandOutput, SdkError | EC2ServiceError >; /** - * @see {@link DescribeTransitGatewayVpcAttachmentsCommand} + * @see {@link DescribeTransitGatewaysCommand} */ - readonly describeTransitGatewayVpcAttachments: ( - args: DescribeTransitGatewayVpcAttachmentsCommandInput, + describeTransitGateways( + args: DescribeTransitGatewaysCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< - DescribeTransitGatewayVpcAttachmentsCommandOutput, + ): Effect.Effect< + DescribeTransitGatewaysCommandOutput, SdkError | EC2ServiceError >; /** * @see {@link DescribeTrunkInterfaceAssociationsCommand} */ - readonly describeTrunkInterfaceAssociations: ( + describeTrunkInterfaceAssociations( args: DescribeTrunkInterfaceAssociationsCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DescribeTrunkInterfaceAssociationsCommandOutput, SdkError | EC2ServiceError >; @@ -6107,10 +6281,10 @@ interface EC2Service$ { /** * @see {@link DescribeVerifiedAccessEndpointsCommand} */ - readonly describeVerifiedAccessEndpoints: ( + describeVerifiedAccessEndpoints( args: DescribeVerifiedAccessEndpointsCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DescribeVerifiedAccessEndpointsCommandOutput, SdkError | EC2ServiceError >; @@ -6118,10 +6292,10 @@ interface EC2Service$ { /** * @see {@link DescribeVerifiedAccessGroupsCommand} */ - readonly describeVerifiedAccessGroups: ( + describeVerifiedAccessGroups( args: DescribeVerifiedAccessGroupsCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DescribeVerifiedAccessGroupsCommandOutput, SdkError | EC2ServiceError >; @@ -6129,10 +6303,10 @@ interface EC2Service$ { /** * @see {@link DescribeVerifiedAccessInstanceLoggingConfigurationsCommand} */ - readonly describeVerifiedAccessInstanceLoggingConfigurations: ( + describeVerifiedAccessInstanceLoggingConfigurations( args: DescribeVerifiedAccessInstanceLoggingConfigurationsCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DescribeVerifiedAccessInstanceLoggingConfigurationsCommandOutput, SdkError | EC2ServiceError >; @@ -6140,10 +6314,10 @@ interface EC2Service$ { /** * @see {@link DescribeVerifiedAccessInstancesCommand} */ - readonly describeVerifiedAccessInstances: ( + describeVerifiedAccessInstances( args: DescribeVerifiedAccessInstancesCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DescribeVerifiedAccessInstancesCommandOutput, SdkError | EC2ServiceError >; @@ -6151,10 +6325,10 @@ interface EC2Service$ { /** * @see {@link DescribeVerifiedAccessTrustProvidersCommand} */ - readonly describeVerifiedAccessTrustProviders: ( + describeVerifiedAccessTrustProviders( args: DescribeVerifiedAccessTrustProvidersCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DescribeVerifiedAccessTrustProvidersCommandOutput, SdkError | EC2ServiceError >; @@ -6162,51 +6336,51 @@ interface EC2Service$ { /** * @see {@link DescribeVolumeAttributeCommand} */ - readonly describeVolumeAttribute: ( + describeVolumeAttribute( args: DescribeVolumeAttributeCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DescribeVolumeAttributeCommandOutput, SdkError | EC2ServiceError >; + /** + * @see {@link DescribeVolumeStatusCommand} + */ + describeVolumeStatus( + args: DescribeVolumeStatusCommandInput, + options?: HttpHandlerOptions, + ): Effect.Effect< + DescribeVolumeStatusCommandOutput, + SdkError | EC2ServiceError + >; + /** * @see {@link DescribeVolumesCommand} */ - readonly describeVolumes: ( + describeVolumes( args: DescribeVolumesCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect; + ): Effect.Effect; /** * @see {@link DescribeVolumesModificationsCommand} */ - readonly describeVolumesModifications: ( + describeVolumesModifications( args: DescribeVolumesModificationsCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DescribeVolumesModificationsCommandOutput, SdkError | EC2ServiceError >; - /** - * @see {@link DescribeVolumeStatusCommand} - */ - readonly describeVolumeStatus: ( - args: DescribeVolumeStatusCommandInput, - options?: HttpHandlerOptions, - ) => Effect.Effect< - DescribeVolumeStatusCommandOutput, - SdkError | EC2ServiceError - >; - /** * @see {@link DescribeVpcAttributeCommand} */ - readonly describeVpcAttribute: ( + describeVpcAttribute( args: DescribeVpcAttributeCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DescribeVpcAttributeCommandOutput, SdkError | EC2ServiceError >; @@ -6214,10 +6388,10 @@ interface EC2Service$ { /** * @see {@link DescribeVpcClassicLinkCommand} */ - readonly describeVpcClassicLink: ( + describeVpcClassicLink( args: DescribeVpcClassicLinkCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DescribeVpcClassicLinkCommandOutput, SdkError | EC2ServiceError >; @@ -6225,10 +6399,10 @@ interface EC2Service$ { /** * @see {@link DescribeVpcClassicLinkDnsSupportCommand} */ - readonly describeVpcClassicLinkDnsSupport: ( + describeVpcClassicLinkDnsSupport( args: DescribeVpcClassicLinkDnsSupportCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DescribeVpcClassicLinkDnsSupportCommandOutput, SdkError | EC2ServiceError >; @@ -6236,10 +6410,10 @@ interface EC2Service$ { /** * @see {@link DescribeVpcEndpointConnectionNotificationsCommand} */ - readonly describeVpcEndpointConnectionNotifications: ( + describeVpcEndpointConnectionNotifications( args: DescribeVpcEndpointConnectionNotificationsCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DescribeVpcEndpointConnectionNotificationsCommandOutput, SdkError | EC2ServiceError >; @@ -6247,32 +6421,21 @@ interface EC2Service$ { /** * @see {@link DescribeVpcEndpointConnectionsCommand} */ - readonly describeVpcEndpointConnections: ( + describeVpcEndpointConnections( args: DescribeVpcEndpointConnectionsCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DescribeVpcEndpointConnectionsCommandOutput, SdkError | EC2ServiceError >; - /** - * @see {@link DescribeVpcEndpointsCommand} - */ - readonly describeVpcEndpoints: ( - args: DescribeVpcEndpointsCommandInput, - options?: HttpHandlerOptions, - ) => Effect.Effect< - DescribeVpcEndpointsCommandOutput, - SdkError | EC2ServiceError - >; - /** * @see {@link DescribeVpcEndpointServiceConfigurationsCommand} */ - readonly describeVpcEndpointServiceConfigurations: ( + describeVpcEndpointServiceConfigurations( args: DescribeVpcEndpointServiceConfigurationsCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DescribeVpcEndpointServiceConfigurationsCommandOutput, SdkError | EC2ServiceError >; @@ -6280,10 +6443,10 @@ interface EC2Service$ { /** * @see {@link DescribeVpcEndpointServicePermissionsCommand} */ - readonly describeVpcEndpointServicePermissions: ( + describeVpcEndpointServicePermissions( args: DescribeVpcEndpointServicePermissionsCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DescribeVpcEndpointServicePermissionsCommandOutput, SdkError | EC2ServiceError >; @@ -6291,21 +6454,32 @@ interface EC2Service$ { /** * @see {@link DescribeVpcEndpointServicesCommand} */ - readonly describeVpcEndpointServices: ( + describeVpcEndpointServices( args: DescribeVpcEndpointServicesCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DescribeVpcEndpointServicesCommandOutput, SdkError | EC2ServiceError >; + /** + * @see {@link DescribeVpcEndpointsCommand} + */ + describeVpcEndpoints( + args: DescribeVpcEndpointsCommandInput, + options?: HttpHandlerOptions, + ): Effect.Effect< + DescribeVpcEndpointsCommandOutput, + SdkError | EC2ServiceError + >; + /** * @see {@link DescribeVpcPeeringConnectionsCommand} */ - readonly describeVpcPeeringConnections: ( + describeVpcPeeringConnections( args: DescribeVpcPeeringConnectionsCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DescribeVpcPeeringConnectionsCommandOutput, SdkError | EC2ServiceError >; @@ -6313,18 +6487,18 @@ interface EC2Service$ { /** * @see {@link DescribeVpcsCommand} */ - readonly describeVpcs: ( + describeVpcs( args: DescribeVpcsCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect; + ): Effect.Effect; /** * @see {@link DescribeVpnConnectionsCommand} */ - readonly describeVpnConnections: ( + describeVpnConnections( args: DescribeVpnConnectionsCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DescribeVpnConnectionsCommandOutput, SdkError | EC2ServiceError >; @@ -6332,10 +6506,10 @@ interface EC2Service$ { /** * @see {@link DescribeVpnGatewaysCommand} */ - readonly describeVpnGateways: ( + describeVpnGateways( args: DescribeVpnGatewaysCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DescribeVpnGatewaysCommandOutput, SdkError | EC2ServiceError >; @@ -6343,10 +6517,10 @@ interface EC2Service$ { /** * @see {@link DetachClassicLinkVpcCommand} */ - readonly detachClassicLinkVpc: ( + detachClassicLinkVpc( args: DetachClassicLinkVpcCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DetachClassicLinkVpcCommandOutput, SdkError | EC2ServiceError >; @@ -6354,10 +6528,10 @@ interface EC2Service$ { /** * @see {@link DetachInternetGatewayCommand} */ - readonly detachInternetGateway: ( + detachInternetGateway( args: DetachInternetGatewayCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DetachInternetGatewayCommandOutput, SdkError | EC2ServiceError >; @@ -6365,10 +6539,10 @@ interface EC2Service$ { /** * @see {@link DetachNetworkInterfaceCommand} */ - readonly detachNetworkInterface: ( + detachNetworkInterface( args: DetachNetworkInterfaceCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DetachNetworkInterfaceCommandOutput, SdkError | EC2ServiceError >; @@ -6376,10 +6550,10 @@ interface EC2Service$ { /** * @see {@link DetachVerifiedAccessTrustProviderCommand} */ - readonly detachVerifiedAccessTrustProvider: ( + detachVerifiedAccessTrustProvider( args: DetachVerifiedAccessTrustProviderCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DetachVerifiedAccessTrustProviderCommandOutput, SdkError | EC2ServiceError >; @@ -6387,26 +6561,26 @@ interface EC2Service$ { /** * @see {@link DetachVolumeCommand} */ - readonly detachVolume: ( + detachVolume( args: DetachVolumeCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect; + ): Effect.Effect; /** * @see {@link DetachVpnGatewayCommand} */ - readonly detachVpnGateway: ( + detachVpnGateway( args: DetachVpnGatewayCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect; + ): Effect.Effect; /** * @see {@link DisableAddressTransferCommand} */ - readonly disableAddressTransfer: ( + disableAddressTransfer( args: DisableAddressTransferCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DisableAddressTransferCommandOutput, SdkError | EC2ServiceError >; @@ -6414,10 +6588,10 @@ interface EC2Service$ { /** * @see {@link DisableAwsNetworkPerformanceMetricSubscriptionCommand} */ - readonly disableAwsNetworkPerformanceMetricSubscription: ( + disableAwsNetworkPerformanceMetricSubscription( args: DisableAwsNetworkPerformanceMetricSubscriptionCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DisableAwsNetworkPerformanceMetricSubscriptionCommandOutput, SdkError | EC2ServiceError >; @@ -6425,10 +6599,10 @@ interface EC2Service$ { /** * @see {@link DisableEbsEncryptionByDefaultCommand} */ - readonly disableEbsEncryptionByDefault: ( + disableEbsEncryptionByDefault( args: DisableEbsEncryptionByDefaultCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DisableEbsEncryptionByDefaultCommandOutput, SdkError | EC2ServiceError >; @@ -6436,21 +6610,18 @@ interface EC2Service$ { /** * @see {@link DisableFastLaunchCommand} */ - readonly disableFastLaunch: ( + disableFastLaunch( args: DisableFastLaunchCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< - DisableFastLaunchCommandOutput, - SdkError | EC2ServiceError - >; + ): Effect.Effect; /** * @see {@link DisableFastSnapshotRestoresCommand} */ - readonly disableFastSnapshotRestores: ( + disableFastSnapshotRestores( args: DisableFastSnapshotRestoresCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DisableFastSnapshotRestoresCommandOutput, SdkError | EC2ServiceError >; @@ -6458,18 +6629,18 @@ interface EC2Service$ { /** * @see {@link DisableImageCommand} */ - readonly disableImage: ( + disableImage( args: DisableImageCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect; + ): Effect.Effect; /** * @see {@link DisableImageBlockPublicAccessCommand} */ - readonly disableImageBlockPublicAccess: ( + disableImageBlockPublicAccess( args: DisableImageBlockPublicAccessCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DisableImageBlockPublicAccessCommandOutput, SdkError | EC2ServiceError >; @@ -6477,21 +6648,32 @@ interface EC2Service$ { /** * @see {@link DisableImageDeprecationCommand} */ - readonly disableImageDeprecation: ( + disableImageDeprecation( args: DisableImageDeprecationCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DisableImageDeprecationCommandOutput, SdkError | EC2ServiceError >; + /** + * @see {@link DisableImageDeregistrationProtectionCommand} + */ + disableImageDeregistrationProtection( + args: DisableImageDeregistrationProtectionCommandInput, + options?: HttpHandlerOptions, + ): Effect.Effect< + DisableImageDeregistrationProtectionCommandOutput, + SdkError | EC2ServiceError + >; + /** * @see {@link DisableIpamOrganizationAdminAccountCommand} */ - readonly disableIpamOrganizationAdminAccount: ( + disableIpamOrganizationAdminAccount( args: DisableIpamOrganizationAdminAccountCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DisableIpamOrganizationAdminAccountCommandOutput, SdkError | EC2ServiceError >; @@ -6499,10 +6681,10 @@ interface EC2Service$ { /** * @see {@link DisableSerialConsoleAccessCommand} */ - readonly disableSerialConsoleAccess: ( + disableSerialConsoleAccess( args: DisableSerialConsoleAccessCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DisableSerialConsoleAccessCommandOutput, SdkError | EC2ServiceError >; @@ -6510,10 +6692,10 @@ interface EC2Service$ { /** * @see {@link DisableSnapshotBlockPublicAccessCommand} */ - readonly disableSnapshotBlockPublicAccess: ( + disableSnapshotBlockPublicAccess( args: DisableSnapshotBlockPublicAccessCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DisableSnapshotBlockPublicAccessCommandOutput, SdkError | EC2ServiceError >; @@ -6521,10 +6703,10 @@ interface EC2Service$ { /** * @see {@link DisableTransitGatewayRouteTablePropagationCommand} */ - readonly disableTransitGatewayRouteTablePropagation: ( + disableTransitGatewayRouteTablePropagation( args: DisableTransitGatewayRouteTablePropagationCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DisableTransitGatewayRouteTablePropagationCommandOutput, SdkError | EC2ServiceError >; @@ -6532,10 +6714,10 @@ interface EC2Service$ { /** * @see {@link DisableVgwRoutePropagationCommand} */ - readonly disableVgwRoutePropagation: ( + disableVgwRoutePropagation( args: DisableVgwRoutePropagationCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DisableVgwRoutePropagationCommandOutput, SdkError | EC2ServiceError >; @@ -6543,10 +6725,10 @@ interface EC2Service$ { /** * @see {@link DisableVpcClassicLinkCommand} */ - readonly disableVpcClassicLink: ( + disableVpcClassicLink( args: DisableVpcClassicLinkCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DisableVpcClassicLinkCommandOutput, SdkError | EC2ServiceError >; @@ -6554,10 +6736,10 @@ interface EC2Service$ { /** * @see {@link DisableVpcClassicLinkDnsSupportCommand} */ - readonly disableVpcClassicLinkDnsSupport: ( + disableVpcClassicLinkDnsSupport( args: DisableVpcClassicLinkDnsSupportCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DisableVpcClassicLinkDnsSupportCommandOutput, SdkError | EC2ServiceError >; @@ -6565,21 +6747,32 @@ interface EC2Service$ { /** * @see {@link DisassociateAddressCommand} */ - readonly disassociateAddress: ( + disassociateAddress( args: DisassociateAddressCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DisassociateAddressCommandOutput, SdkError | EC2ServiceError >; + /** + * @see {@link DisassociateCapacityReservationBillingOwnerCommand} + */ + disassociateCapacityReservationBillingOwner( + args: DisassociateCapacityReservationBillingOwnerCommandInput, + options?: HttpHandlerOptions, + ): Effect.Effect< + DisassociateCapacityReservationBillingOwnerCommandOutput, + SdkError | EC2ServiceError + >; + /** * @see {@link DisassociateClientVpnTargetNetworkCommand} */ - readonly disassociateClientVpnTargetNetwork: ( + disassociateClientVpnTargetNetwork( args: DisassociateClientVpnTargetNetworkCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DisassociateClientVpnTargetNetworkCommandOutput, SdkError | EC2ServiceError >; @@ -6587,10 +6780,10 @@ interface EC2Service$ { /** * @see {@link DisassociateEnclaveCertificateIamRoleCommand} */ - readonly disassociateEnclaveCertificateIamRole: ( + disassociateEnclaveCertificateIamRole( args: DisassociateEnclaveCertificateIamRoleCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DisassociateEnclaveCertificateIamRoleCommandOutput, SdkError | EC2ServiceError >; @@ -6598,10 +6791,10 @@ interface EC2Service$ { /** * @see {@link DisassociateIamInstanceProfileCommand} */ - readonly disassociateIamInstanceProfile: ( + disassociateIamInstanceProfile( args: DisassociateIamInstanceProfileCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DisassociateIamInstanceProfileCommandOutput, SdkError | EC2ServiceError >; @@ -6609,10 +6802,10 @@ interface EC2Service$ { /** * @see {@link DisassociateInstanceEventWindowCommand} */ - readonly disassociateInstanceEventWindow: ( + disassociateInstanceEventWindow( args: DisassociateInstanceEventWindowCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DisassociateInstanceEventWindowCommandOutput, SdkError | EC2ServiceError >; @@ -6620,10 +6813,10 @@ interface EC2Service$ { /** * @see {@link DisassociateIpamByoasnCommand} */ - readonly disassociateIpamByoasn: ( + disassociateIpamByoasn( args: DisassociateIpamByoasnCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DisassociateIpamByoasnCommandOutput, SdkError | EC2ServiceError >; @@ -6631,10 +6824,10 @@ interface EC2Service$ { /** * @see {@link DisassociateIpamResourceDiscoveryCommand} */ - readonly disassociateIpamResourceDiscovery: ( + disassociateIpamResourceDiscovery( args: DisassociateIpamResourceDiscoveryCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DisassociateIpamResourceDiscoveryCommandOutput, SdkError | EC2ServiceError >; @@ -6642,10 +6835,10 @@ interface EC2Service$ { /** * @see {@link DisassociateNatGatewayAddressCommand} */ - readonly disassociateNatGatewayAddress: ( + disassociateNatGatewayAddress( args: DisassociateNatGatewayAddressCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DisassociateNatGatewayAddressCommandOutput, SdkError | EC2ServiceError >; @@ -6653,21 +6846,32 @@ interface EC2Service$ { /** * @see {@link DisassociateRouteTableCommand} */ - readonly disassociateRouteTable: ( + disassociateRouteTable( args: DisassociateRouteTableCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DisassociateRouteTableCommandOutput, SdkError | EC2ServiceError >; + /** + * @see {@link DisassociateSecurityGroupVpcCommand} + */ + disassociateSecurityGroupVpc( + args: DisassociateSecurityGroupVpcCommandInput, + options?: HttpHandlerOptions, + ): Effect.Effect< + DisassociateSecurityGroupVpcCommandOutput, + SdkError | EC2ServiceError + >; + /** * @see {@link DisassociateSubnetCidrBlockCommand} */ - readonly disassociateSubnetCidrBlock: ( + disassociateSubnetCidrBlock( args: DisassociateSubnetCidrBlockCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DisassociateSubnetCidrBlockCommandOutput, SdkError | EC2ServiceError >; @@ -6675,10 +6879,10 @@ interface EC2Service$ { /** * @see {@link DisassociateTransitGatewayMulticastDomainCommand} */ - readonly disassociateTransitGatewayMulticastDomain: ( + disassociateTransitGatewayMulticastDomain( args: DisassociateTransitGatewayMulticastDomainCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DisassociateTransitGatewayMulticastDomainCommandOutput, SdkError | EC2ServiceError >; @@ -6686,10 +6890,10 @@ interface EC2Service$ { /** * @see {@link DisassociateTransitGatewayPolicyTableCommand} */ - readonly disassociateTransitGatewayPolicyTable: ( + disassociateTransitGatewayPolicyTable( args: DisassociateTransitGatewayPolicyTableCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DisassociateTransitGatewayPolicyTableCommandOutput, SdkError | EC2ServiceError >; @@ -6697,10 +6901,10 @@ interface EC2Service$ { /** * @see {@link DisassociateTransitGatewayRouteTableCommand} */ - readonly disassociateTransitGatewayRouteTable: ( + disassociateTransitGatewayRouteTable( args: DisassociateTransitGatewayRouteTableCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DisassociateTransitGatewayRouteTableCommandOutput, SdkError | EC2ServiceError >; @@ -6708,10 +6912,10 @@ interface EC2Service$ { /** * @see {@link DisassociateTrunkInterfaceCommand} */ - readonly disassociateTrunkInterface: ( + disassociateTrunkInterface( args: DisassociateTrunkInterfaceCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DisassociateTrunkInterfaceCommandOutput, SdkError | EC2ServiceError >; @@ -6719,10 +6923,10 @@ interface EC2Service$ { /** * @see {@link DisassociateVpcCidrBlockCommand} */ - readonly disassociateVpcCidrBlock: ( + disassociateVpcCidrBlock( args: DisassociateVpcCidrBlockCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< DisassociateVpcCidrBlockCommandOutput, SdkError | EC2ServiceError >; @@ -6730,10 +6934,10 @@ interface EC2Service$ { /** * @see {@link EnableAddressTransferCommand} */ - readonly enableAddressTransfer: ( + enableAddressTransfer( args: EnableAddressTransferCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< EnableAddressTransferCommandOutput, SdkError | EC2ServiceError >; @@ -6741,10 +6945,10 @@ interface EC2Service$ { /** * @see {@link EnableAwsNetworkPerformanceMetricSubscriptionCommand} */ - readonly enableAwsNetworkPerformanceMetricSubscription: ( + enableAwsNetworkPerformanceMetricSubscription( args: EnableAwsNetworkPerformanceMetricSubscriptionCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< EnableAwsNetworkPerformanceMetricSubscriptionCommandOutput, SdkError | EC2ServiceError >; @@ -6752,10 +6956,10 @@ interface EC2Service$ { /** * @see {@link EnableEbsEncryptionByDefaultCommand} */ - readonly enableEbsEncryptionByDefault: ( + enableEbsEncryptionByDefault( args: EnableEbsEncryptionByDefaultCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< EnableEbsEncryptionByDefaultCommandOutput, SdkError | EC2ServiceError >; @@ -6763,18 +6967,18 @@ interface EC2Service$ { /** * @see {@link EnableFastLaunchCommand} */ - readonly enableFastLaunch: ( + enableFastLaunch( args: EnableFastLaunchCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect; + ): Effect.Effect; /** * @see {@link EnableFastSnapshotRestoresCommand} */ - readonly enableFastSnapshotRestores: ( + enableFastSnapshotRestores( args: EnableFastSnapshotRestoresCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< EnableFastSnapshotRestoresCommandOutput, SdkError | EC2ServiceError >; @@ -6782,18 +6986,18 @@ interface EC2Service$ { /** * @see {@link EnableImageCommand} */ - readonly enableImage: ( + enableImage( args: EnableImageCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect; + ): Effect.Effect; /** * @see {@link EnableImageBlockPublicAccessCommand} */ - readonly enableImageBlockPublicAccess: ( + enableImageBlockPublicAccess( args: EnableImageBlockPublicAccessCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< EnableImageBlockPublicAccessCommandOutput, SdkError | EC2ServiceError >; @@ -6801,21 +7005,32 @@ interface EC2Service$ { /** * @see {@link EnableImageDeprecationCommand} */ - readonly enableImageDeprecation: ( + enableImageDeprecation( args: EnableImageDeprecationCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< EnableImageDeprecationCommandOutput, SdkError | EC2ServiceError >; + /** + * @see {@link EnableImageDeregistrationProtectionCommand} + */ + enableImageDeregistrationProtection( + args: EnableImageDeregistrationProtectionCommandInput, + options?: HttpHandlerOptions, + ): Effect.Effect< + EnableImageDeregistrationProtectionCommandOutput, + SdkError | EC2ServiceError + >; + /** * @see {@link EnableIpamOrganizationAdminAccountCommand} */ - readonly enableIpamOrganizationAdminAccount: ( + enableIpamOrganizationAdminAccount( args: EnableIpamOrganizationAdminAccountCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< EnableIpamOrganizationAdminAccountCommandOutput, SdkError | EC2ServiceError >; @@ -6823,10 +7038,10 @@ interface EC2Service$ { /** * @see {@link EnableReachabilityAnalyzerOrganizationSharingCommand} */ - readonly enableReachabilityAnalyzerOrganizationSharing: ( + enableReachabilityAnalyzerOrganizationSharing( args: EnableReachabilityAnalyzerOrganizationSharingCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< EnableReachabilityAnalyzerOrganizationSharingCommandOutput, SdkError | EC2ServiceError >; @@ -6834,10 +7049,10 @@ interface EC2Service$ { /** * @see {@link EnableSerialConsoleAccessCommand} */ - readonly enableSerialConsoleAccess: ( + enableSerialConsoleAccess( args: EnableSerialConsoleAccessCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< EnableSerialConsoleAccessCommandOutput, SdkError | EC2ServiceError >; @@ -6845,10 +7060,10 @@ interface EC2Service$ { /** * @see {@link EnableSnapshotBlockPublicAccessCommand} */ - readonly enableSnapshotBlockPublicAccess: ( + enableSnapshotBlockPublicAccess( args: EnableSnapshotBlockPublicAccessCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< EnableSnapshotBlockPublicAccessCommandOutput, SdkError | EC2ServiceError >; @@ -6856,10 +7071,10 @@ interface EC2Service$ { /** * @see {@link EnableTransitGatewayRouteTablePropagationCommand} */ - readonly enableTransitGatewayRouteTablePropagation: ( + enableTransitGatewayRouteTablePropagation( args: EnableTransitGatewayRouteTablePropagationCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< EnableTransitGatewayRouteTablePropagationCommandOutput, SdkError | EC2ServiceError >; @@ -6867,10 +7082,10 @@ interface EC2Service$ { /** * @see {@link EnableVgwRoutePropagationCommand} */ - readonly enableVgwRoutePropagation: ( + enableVgwRoutePropagation( args: EnableVgwRoutePropagationCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< EnableVgwRoutePropagationCommandOutput, SdkError | EC2ServiceError >; @@ -6878,18 +7093,18 @@ interface EC2Service$ { /** * @see {@link EnableVolumeIOCommand} */ - readonly enableVolumeIO: ( + enableVolumeIO( args: EnableVolumeIOCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect; + ): Effect.Effect; /** * @see {@link EnableVpcClassicLinkCommand} */ - readonly enableVpcClassicLink: ( + enableVpcClassicLink( args: EnableVpcClassicLinkCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< EnableVpcClassicLinkCommandOutput, SdkError | EC2ServiceError >; @@ -6897,10 +7112,10 @@ interface EC2Service$ { /** * @see {@link EnableVpcClassicLinkDnsSupportCommand} */ - readonly enableVpcClassicLinkDnsSupport: ( + enableVpcClassicLinkDnsSupport( args: EnableVpcClassicLinkDnsSupportCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< EnableVpcClassicLinkDnsSupportCommandOutput, SdkError | EC2ServiceError >; @@ -6908,10 +7123,10 @@ interface EC2Service$ { /** * @see {@link ExportClientVpnClientCertificateRevocationListCommand} */ - readonly exportClientVpnClientCertificateRevocationList: ( + exportClientVpnClientCertificateRevocationList( args: ExportClientVpnClientCertificateRevocationListCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< ExportClientVpnClientCertificateRevocationListCommandOutput, SdkError | EC2ServiceError >; @@ -6919,10 +7134,10 @@ interface EC2Service$ { /** * @see {@link ExportClientVpnClientConfigurationCommand} */ - readonly exportClientVpnClientConfiguration: ( + exportClientVpnClientConfiguration( args: ExportClientVpnClientConfigurationCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< ExportClientVpnClientConfigurationCommandOutput, SdkError | EC2ServiceError >; @@ -6930,18 +7145,18 @@ interface EC2Service$ { /** * @see {@link ExportImageCommand} */ - readonly exportImage: ( + exportImage( args: ExportImageCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect; + ): Effect.Effect; /** * @see {@link ExportTransitGatewayRoutesCommand} */ - readonly exportTransitGatewayRoutes: ( + exportTransitGatewayRoutes( args: ExportTransitGatewayRoutesCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< ExportTransitGatewayRoutesCommandOutput, SdkError | EC2ServiceError >; @@ -6949,10 +7164,10 @@ interface EC2Service$ { /** * @see {@link GetAssociatedEnclaveCertificateIamRolesCommand} */ - readonly getAssociatedEnclaveCertificateIamRoles: ( + getAssociatedEnclaveCertificateIamRoles( args: GetAssociatedEnclaveCertificateIamRolesCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< GetAssociatedEnclaveCertificateIamRolesCommandOutput, SdkError | EC2ServiceError >; @@ -6960,10 +7175,10 @@ interface EC2Service$ { /** * @see {@link GetAssociatedIpv6PoolCidrsCommand} */ - readonly getAssociatedIpv6PoolCidrs: ( + getAssociatedIpv6PoolCidrs( args: GetAssociatedIpv6PoolCidrsCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< GetAssociatedIpv6PoolCidrsCommandOutput, SdkError | EC2ServiceError >; @@ -6971,10 +7186,10 @@ interface EC2Service$ { /** * @see {@link GetAwsNetworkPerformanceDataCommand} */ - readonly getAwsNetworkPerformanceData: ( + getAwsNetworkPerformanceData( args: GetAwsNetworkPerformanceDataCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< GetAwsNetworkPerformanceDataCommandOutput, SdkError | EC2ServiceError >; @@ -6982,10 +7197,10 @@ interface EC2Service$ { /** * @see {@link GetCapacityReservationUsageCommand} */ - readonly getCapacityReservationUsage: ( + getCapacityReservationUsage( args: GetCapacityReservationUsageCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< GetCapacityReservationUsageCommandOutput, SdkError | EC2ServiceError >; @@ -6993,26 +7208,26 @@ interface EC2Service$ { /** * @see {@link GetCoipPoolUsageCommand} */ - readonly getCoipPoolUsage: ( + getCoipPoolUsage( args: GetCoipPoolUsageCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect; + ): Effect.Effect; /** * @see {@link GetConsoleOutputCommand} */ - readonly getConsoleOutput: ( + getConsoleOutput( args: GetConsoleOutputCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect; + ): Effect.Effect; /** * @see {@link GetConsoleScreenshotCommand} */ - readonly getConsoleScreenshot: ( + getConsoleScreenshot( args: GetConsoleScreenshotCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< GetConsoleScreenshotCommandOutput, SdkError | EC2ServiceError >; @@ -7020,10 +7235,10 @@ interface EC2Service$ { /** * @see {@link GetDefaultCreditSpecificationCommand} */ - readonly getDefaultCreditSpecification: ( + getDefaultCreditSpecification( args: GetDefaultCreditSpecificationCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< GetDefaultCreditSpecificationCommandOutput, SdkError | EC2ServiceError >; @@ -7031,10 +7246,10 @@ interface EC2Service$ { /** * @see {@link GetEbsDefaultKmsKeyIdCommand} */ - readonly getEbsDefaultKmsKeyId: ( + getEbsDefaultKmsKeyId( args: GetEbsDefaultKmsKeyIdCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< GetEbsDefaultKmsKeyIdCommandOutput, SdkError | EC2ServiceError >; @@ -7042,10 +7257,10 @@ interface EC2Service$ { /** * @see {@link GetEbsEncryptionByDefaultCommand} */ - readonly getEbsEncryptionByDefault: ( + getEbsEncryptionByDefault( args: GetEbsEncryptionByDefaultCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< GetEbsEncryptionByDefaultCommandOutput, SdkError | EC2ServiceError >; @@ -7053,10 +7268,10 @@ interface EC2Service$ { /** * @see {@link GetFlowLogsIntegrationTemplateCommand} */ - readonly getFlowLogsIntegrationTemplate: ( + getFlowLogsIntegrationTemplate( args: GetFlowLogsIntegrationTemplateCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< GetFlowLogsIntegrationTemplateCommandOutput, SdkError | EC2ServiceError >; @@ -7064,10 +7279,10 @@ interface EC2Service$ { /** * @see {@link GetGroupsForCapacityReservationCommand} */ - readonly getGroupsForCapacityReservation: ( + getGroupsForCapacityReservation( args: GetGroupsForCapacityReservationCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< GetGroupsForCapacityReservationCommandOutput, SdkError | EC2ServiceError >; @@ -7075,10 +7290,10 @@ interface EC2Service$ { /** * @see {@link GetHostReservationPurchasePreviewCommand} */ - readonly getHostReservationPurchasePreview: ( + getHostReservationPurchasePreview( args: GetHostReservationPurchasePreviewCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< GetHostReservationPurchasePreviewCommandOutput, SdkError | EC2ServiceError >; @@ -7086,21 +7301,43 @@ interface EC2Service$ { /** * @see {@link GetImageBlockPublicAccessStateCommand} */ - readonly getImageBlockPublicAccessState: ( + getImageBlockPublicAccessState( args: GetImageBlockPublicAccessStateCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< GetImageBlockPublicAccessStateCommandOutput, SdkError | EC2ServiceError >; + /** + * @see {@link GetInstanceMetadataDefaultsCommand} + */ + getInstanceMetadataDefaults( + args: GetInstanceMetadataDefaultsCommandInput, + options?: HttpHandlerOptions, + ): Effect.Effect< + GetInstanceMetadataDefaultsCommandOutput, + SdkError | EC2ServiceError + >; + + /** + * @see {@link GetInstanceTpmEkPubCommand} + */ + getInstanceTpmEkPub( + args: GetInstanceTpmEkPubCommandInput, + options?: HttpHandlerOptions, + ): Effect.Effect< + GetInstanceTpmEkPubCommandOutput, + SdkError | EC2ServiceError + >; + /** * @see {@link GetInstanceTypesFromInstanceRequirementsCommand} */ - readonly getInstanceTypesFromInstanceRequirements: ( + getInstanceTypesFromInstanceRequirements( args: GetInstanceTypesFromInstanceRequirementsCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< GetInstanceTypesFromInstanceRequirementsCommandOutput, SdkError | EC2ServiceError >; @@ -7108,10 +7345,10 @@ interface EC2Service$ { /** * @see {@link GetInstanceUefiDataCommand} */ - readonly getInstanceUefiData: ( + getInstanceUefiData( args: GetInstanceUefiDataCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< GetInstanceUefiDataCommandOutput, SdkError | EC2ServiceError >; @@ -7119,10 +7356,10 @@ interface EC2Service$ { /** * @see {@link GetIpamAddressHistoryCommand} */ - readonly getIpamAddressHistory: ( + getIpamAddressHistory( args: GetIpamAddressHistoryCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< GetIpamAddressHistoryCommandOutput, SdkError | EC2ServiceError >; @@ -7130,10 +7367,10 @@ interface EC2Service$ { /** * @see {@link GetIpamDiscoveredAccountsCommand} */ - readonly getIpamDiscoveredAccounts: ( + getIpamDiscoveredAccounts( args: GetIpamDiscoveredAccountsCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< GetIpamDiscoveredAccountsCommandOutput, SdkError | EC2ServiceError >; @@ -7141,10 +7378,10 @@ interface EC2Service$ { /** * @see {@link GetIpamDiscoveredPublicAddressesCommand} */ - readonly getIpamDiscoveredPublicAddresses: ( + getIpamDiscoveredPublicAddresses( args: GetIpamDiscoveredPublicAddressesCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< GetIpamDiscoveredPublicAddressesCommandOutput, SdkError | EC2ServiceError >; @@ -7152,10 +7389,10 @@ interface EC2Service$ { /** * @see {@link GetIpamDiscoveredResourceCidrsCommand} */ - readonly getIpamDiscoveredResourceCidrs: ( + getIpamDiscoveredResourceCidrs( args: GetIpamDiscoveredResourceCidrsCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< GetIpamDiscoveredResourceCidrsCommandOutput, SdkError | EC2ServiceError >; @@ -7163,10 +7400,10 @@ interface EC2Service$ { /** * @see {@link GetIpamPoolAllocationsCommand} */ - readonly getIpamPoolAllocations: ( + getIpamPoolAllocations( args: GetIpamPoolAllocationsCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< GetIpamPoolAllocationsCommandOutput, SdkError | EC2ServiceError >; @@ -7174,18 +7411,18 @@ interface EC2Service$ { /** * @see {@link GetIpamPoolCidrsCommand} */ - readonly getIpamPoolCidrs: ( + getIpamPoolCidrs( args: GetIpamPoolCidrsCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect; + ): Effect.Effect; /** * @see {@link GetIpamResourceCidrsCommand} */ - readonly getIpamResourceCidrs: ( + getIpamResourceCidrs( args: GetIpamResourceCidrsCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< GetIpamResourceCidrsCommandOutput, SdkError | EC2ServiceError >; @@ -7193,10 +7430,10 @@ interface EC2Service$ { /** * @see {@link GetLaunchTemplateDataCommand} */ - readonly getLaunchTemplateData: ( + getLaunchTemplateData( args: GetLaunchTemplateDataCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< GetLaunchTemplateDataCommandOutput, SdkError | EC2ServiceError >; @@ -7204,10 +7441,10 @@ interface EC2Service$ { /** * @see {@link GetManagedPrefixListAssociationsCommand} */ - readonly getManagedPrefixListAssociations: ( + getManagedPrefixListAssociations( args: GetManagedPrefixListAssociationsCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< GetManagedPrefixListAssociationsCommandOutput, SdkError | EC2ServiceError >; @@ -7215,10 +7452,10 @@ interface EC2Service$ { /** * @see {@link GetManagedPrefixListEntriesCommand} */ - readonly getManagedPrefixListEntries: ( + getManagedPrefixListEntries( args: GetManagedPrefixListEntriesCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< GetManagedPrefixListEntriesCommandOutput, SdkError | EC2ServiceError >; @@ -7226,10 +7463,10 @@ interface EC2Service$ { /** * @see {@link GetNetworkInsightsAccessScopeAnalysisFindingsCommand} */ - readonly getNetworkInsightsAccessScopeAnalysisFindings: ( + getNetworkInsightsAccessScopeAnalysisFindings( args: GetNetworkInsightsAccessScopeAnalysisFindingsCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< GetNetworkInsightsAccessScopeAnalysisFindingsCommandOutput, SdkError | EC2ServiceError >; @@ -7237,10 +7474,10 @@ interface EC2Service$ { /** * @see {@link GetNetworkInsightsAccessScopeContentCommand} */ - readonly getNetworkInsightsAccessScopeContent: ( + getNetworkInsightsAccessScopeContent( args: GetNetworkInsightsAccessScopeContentCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< GetNetworkInsightsAccessScopeContentCommandOutput, SdkError | EC2ServiceError >; @@ -7248,18 +7485,18 @@ interface EC2Service$ { /** * @see {@link GetPasswordDataCommand} */ - readonly getPasswordData: ( + getPasswordData( args: GetPasswordDataCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect; + ): Effect.Effect; /** * @see {@link GetReservedInstancesExchangeQuoteCommand} */ - readonly getReservedInstancesExchangeQuote: ( + getReservedInstancesExchangeQuote( args: GetReservedInstancesExchangeQuoteCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< GetReservedInstancesExchangeQuoteCommandOutput, SdkError | EC2ServiceError >; @@ -7267,10 +7504,10 @@ interface EC2Service$ { /** * @see {@link GetSecurityGroupsForVpcCommand} */ - readonly getSecurityGroupsForVpc: ( + getSecurityGroupsForVpc( args: GetSecurityGroupsForVpcCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< GetSecurityGroupsForVpcCommandOutput, SdkError | EC2ServiceError >; @@ -7278,10 +7515,10 @@ interface EC2Service$ { /** * @see {@link GetSerialConsoleAccessStatusCommand} */ - readonly getSerialConsoleAccessStatus: ( + getSerialConsoleAccessStatus( args: GetSerialConsoleAccessStatusCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< GetSerialConsoleAccessStatusCommandOutput, SdkError | EC2ServiceError >; @@ -7289,10 +7526,10 @@ interface EC2Service$ { /** * @see {@link GetSnapshotBlockPublicAccessStateCommand} */ - readonly getSnapshotBlockPublicAccessState: ( + getSnapshotBlockPublicAccessState( args: GetSnapshotBlockPublicAccessStateCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< GetSnapshotBlockPublicAccessStateCommandOutput, SdkError | EC2ServiceError >; @@ -7300,10 +7537,10 @@ interface EC2Service$ { /** * @see {@link GetSpotPlacementScoresCommand} */ - readonly getSpotPlacementScores: ( + getSpotPlacementScores( args: GetSpotPlacementScoresCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< GetSpotPlacementScoresCommandOutput, SdkError | EC2ServiceError >; @@ -7311,10 +7548,10 @@ interface EC2Service$ { /** * @see {@link GetSubnetCidrReservationsCommand} */ - readonly getSubnetCidrReservations: ( + getSubnetCidrReservations( args: GetSubnetCidrReservationsCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< GetSubnetCidrReservationsCommandOutput, SdkError | EC2ServiceError >; @@ -7322,10 +7559,10 @@ interface EC2Service$ { /** * @see {@link GetTransitGatewayAttachmentPropagationsCommand} */ - readonly getTransitGatewayAttachmentPropagations: ( + getTransitGatewayAttachmentPropagations( args: GetTransitGatewayAttachmentPropagationsCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< GetTransitGatewayAttachmentPropagationsCommandOutput, SdkError | EC2ServiceError >; @@ -7333,10 +7570,10 @@ interface EC2Service$ { /** * @see {@link GetTransitGatewayMulticastDomainAssociationsCommand} */ - readonly getTransitGatewayMulticastDomainAssociations: ( + getTransitGatewayMulticastDomainAssociations( args: GetTransitGatewayMulticastDomainAssociationsCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< GetTransitGatewayMulticastDomainAssociationsCommandOutput, SdkError | EC2ServiceError >; @@ -7344,10 +7581,10 @@ interface EC2Service$ { /** * @see {@link GetTransitGatewayPolicyTableAssociationsCommand} */ - readonly getTransitGatewayPolicyTableAssociations: ( + getTransitGatewayPolicyTableAssociations( args: GetTransitGatewayPolicyTableAssociationsCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< GetTransitGatewayPolicyTableAssociationsCommandOutput, SdkError | EC2ServiceError >; @@ -7355,10 +7592,10 @@ interface EC2Service$ { /** * @see {@link GetTransitGatewayPolicyTableEntriesCommand} */ - readonly getTransitGatewayPolicyTableEntries: ( + getTransitGatewayPolicyTableEntries( args: GetTransitGatewayPolicyTableEntriesCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< GetTransitGatewayPolicyTableEntriesCommandOutput, SdkError | EC2ServiceError >; @@ -7366,10 +7603,10 @@ interface EC2Service$ { /** * @see {@link GetTransitGatewayPrefixListReferencesCommand} */ - readonly getTransitGatewayPrefixListReferences: ( + getTransitGatewayPrefixListReferences( args: GetTransitGatewayPrefixListReferencesCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< GetTransitGatewayPrefixListReferencesCommandOutput, SdkError | EC2ServiceError >; @@ -7377,10 +7614,10 @@ interface EC2Service$ { /** * @see {@link GetTransitGatewayRouteTableAssociationsCommand} */ - readonly getTransitGatewayRouteTableAssociations: ( + getTransitGatewayRouteTableAssociations( args: GetTransitGatewayRouteTableAssociationsCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< GetTransitGatewayRouteTableAssociationsCommandOutput, SdkError | EC2ServiceError >; @@ -7388,10 +7625,10 @@ interface EC2Service$ { /** * @see {@link GetTransitGatewayRouteTablePropagationsCommand} */ - readonly getTransitGatewayRouteTablePropagations: ( + getTransitGatewayRouteTablePropagations( args: GetTransitGatewayRouteTablePropagationsCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< GetTransitGatewayRouteTablePropagationsCommandOutput, SdkError | EC2ServiceError >; @@ -7399,10 +7636,10 @@ interface EC2Service$ { /** * @see {@link GetVerifiedAccessEndpointPolicyCommand} */ - readonly getVerifiedAccessEndpointPolicy: ( + getVerifiedAccessEndpointPolicy( args: GetVerifiedAccessEndpointPolicyCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< GetVerifiedAccessEndpointPolicyCommandOutput, SdkError | EC2ServiceError >; @@ -7410,10 +7647,10 @@ interface EC2Service$ { /** * @see {@link GetVerifiedAccessGroupPolicyCommand} */ - readonly getVerifiedAccessGroupPolicy: ( + getVerifiedAccessGroupPolicy( args: GetVerifiedAccessGroupPolicyCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< GetVerifiedAccessGroupPolicyCommandOutput, SdkError | EC2ServiceError >; @@ -7421,10 +7658,10 @@ interface EC2Service$ { /** * @see {@link GetVpnConnectionDeviceSampleConfigurationCommand} */ - readonly getVpnConnectionDeviceSampleConfiguration: ( + getVpnConnectionDeviceSampleConfiguration( args: GetVpnConnectionDeviceSampleConfigurationCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< GetVpnConnectionDeviceSampleConfigurationCommandOutput, SdkError | EC2ServiceError >; @@ -7432,10 +7669,10 @@ interface EC2Service$ { /** * @see {@link GetVpnConnectionDeviceTypesCommand} */ - readonly getVpnConnectionDeviceTypes: ( + getVpnConnectionDeviceTypes( args: GetVpnConnectionDeviceTypesCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< GetVpnConnectionDeviceTypesCommandOutput, SdkError | EC2ServiceError >; @@ -7443,10 +7680,10 @@ interface EC2Service$ { /** * @see {@link GetVpnTunnelReplacementStatusCommand} */ - readonly getVpnTunnelReplacementStatus: ( + getVpnTunnelReplacementStatus( args: GetVpnTunnelReplacementStatusCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< GetVpnTunnelReplacementStatusCommandOutput, SdkError | EC2ServiceError >; @@ -7454,10 +7691,10 @@ interface EC2Service$ { /** * @see {@link ImportClientVpnClientCertificateRevocationListCommand} */ - readonly importClientVpnClientCertificateRevocationList: ( + importClientVpnClientCertificateRevocationList( args: ImportClientVpnClientCertificateRevocationListCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< ImportClientVpnClientCertificateRevocationListCommandOutput, SdkError | EC2ServiceError >; @@ -7465,50 +7702,50 @@ interface EC2Service$ { /** * @see {@link ImportImageCommand} */ - readonly importImage: ( + importImage( args: ImportImageCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect; + ): Effect.Effect; /** * @see {@link ImportInstanceCommand} */ - readonly importInstance: ( + importInstance( args: ImportInstanceCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect; + ): Effect.Effect; /** * @see {@link ImportKeyPairCommand} */ - readonly importKeyPair: ( + importKeyPair( args: ImportKeyPairCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect; + ): Effect.Effect; /** * @see {@link ImportSnapshotCommand} */ - readonly importSnapshot: ( + importSnapshot( args: ImportSnapshotCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect; + ): Effect.Effect; /** * @see {@link ImportVolumeCommand} */ - readonly importVolume: ( + importVolume( args: ImportVolumeCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect; + ): Effect.Effect; /** * @see {@link ListImagesInRecycleBinCommand} */ - readonly listImagesInRecycleBin: ( + listImagesInRecycleBin( args: ListImagesInRecycleBinCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< ListImagesInRecycleBinCommandOutput, SdkError | EC2ServiceError >; @@ -7516,10 +7753,10 @@ interface EC2Service$ { /** * @see {@link ListSnapshotsInRecycleBinCommand} */ - readonly listSnapshotsInRecycleBin: ( + listSnapshotsInRecycleBin( args: ListSnapshotsInRecycleBinCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< ListSnapshotsInRecycleBinCommandOutput, SdkError | EC2ServiceError >; @@ -7527,18 +7764,18 @@ interface EC2Service$ { /** * @see {@link LockSnapshotCommand} */ - readonly lockSnapshot: ( + lockSnapshot( args: LockSnapshotCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect; + ): Effect.Effect; /** * @see {@link ModifyAddressAttributeCommand} */ - readonly modifyAddressAttribute: ( + modifyAddressAttribute( args: ModifyAddressAttributeCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< ModifyAddressAttributeCommandOutput, SdkError | EC2ServiceError >; @@ -7546,10 +7783,10 @@ interface EC2Service$ { /** * @see {@link ModifyAvailabilityZoneGroupCommand} */ - readonly modifyAvailabilityZoneGroup: ( + modifyAvailabilityZoneGroup( args: ModifyAvailabilityZoneGroupCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< ModifyAvailabilityZoneGroupCommandOutput, SdkError | EC2ServiceError >; @@ -7557,10 +7794,10 @@ interface EC2Service$ { /** * @see {@link ModifyCapacityReservationCommand} */ - readonly modifyCapacityReservation: ( + modifyCapacityReservation( args: ModifyCapacityReservationCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< ModifyCapacityReservationCommandOutput, SdkError | EC2ServiceError >; @@ -7568,10 +7805,10 @@ interface EC2Service$ { /** * @see {@link ModifyCapacityReservationFleetCommand} */ - readonly modifyCapacityReservationFleet: ( + modifyCapacityReservationFleet( args: ModifyCapacityReservationFleetCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< ModifyCapacityReservationFleetCommandOutput, SdkError | EC2ServiceError >; @@ -7579,10 +7816,10 @@ interface EC2Service$ { /** * @see {@link ModifyClientVpnEndpointCommand} */ - readonly modifyClientVpnEndpoint: ( + modifyClientVpnEndpoint( args: ModifyClientVpnEndpointCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< ModifyClientVpnEndpointCommandOutput, SdkError | EC2ServiceError >; @@ -7590,10 +7827,10 @@ interface EC2Service$ { /** * @see {@link ModifyDefaultCreditSpecificationCommand} */ - readonly modifyDefaultCreditSpecification: ( + modifyDefaultCreditSpecification( args: ModifyDefaultCreditSpecificationCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< ModifyDefaultCreditSpecificationCommandOutput, SdkError | EC2ServiceError >; @@ -7601,10 +7838,10 @@ interface EC2Service$ { /** * @see {@link ModifyEbsDefaultKmsKeyIdCommand} */ - readonly modifyEbsDefaultKmsKeyId: ( + modifyEbsDefaultKmsKeyId( args: ModifyEbsDefaultKmsKeyIdCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< ModifyEbsDefaultKmsKeyIdCommandOutput, SdkError | EC2ServiceError >; @@ -7612,18 +7849,18 @@ interface EC2Service$ { /** * @see {@link ModifyFleetCommand} */ - readonly modifyFleet: ( + modifyFleet( args: ModifyFleetCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect; + ): Effect.Effect; /** * @see {@link ModifyFpgaImageAttributeCommand} */ - readonly modifyFpgaImageAttribute: ( + modifyFpgaImageAttribute( args: ModifyFpgaImageAttributeCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< ModifyFpgaImageAttributeCommandOutput, SdkError | EC2ServiceError >; @@ -7631,37 +7868,37 @@ interface EC2Service$ { /** * @see {@link ModifyHostsCommand} */ - readonly modifyHosts: ( + modifyHosts( args: ModifyHostsCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect; + ): Effect.Effect; + + /** + * @see {@link ModifyIdFormatCommand} + */ + modifyIdFormat( + args: ModifyIdFormatCommandInput, + options?: HttpHandlerOptions, + ): Effect.Effect; /** * @see {@link ModifyIdentityIdFormatCommand} */ - readonly modifyIdentityIdFormat: ( + modifyIdentityIdFormat( args: ModifyIdentityIdFormatCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< ModifyIdentityIdFormatCommandOutput, SdkError | EC2ServiceError >; - /** - * @see {@link ModifyIdFormatCommand} - */ - readonly modifyIdFormat: ( - args: ModifyIdFormatCommandInput, - options?: HttpHandlerOptions, - ) => Effect.Effect; - /** * @see {@link ModifyImageAttributeCommand} */ - readonly modifyImageAttribute: ( + modifyImageAttribute( args: ModifyImageAttributeCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< ModifyImageAttributeCommandOutput, SdkError | EC2ServiceError >; @@ -7669,10 +7906,10 @@ interface EC2Service$ { /** * @see {@link ModifyInstanceAttributeCommand} */ - readonly modifyInstanceAttribute: ( + modifyInstanceAttribute( args: ModifyInstanceAttributeCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< ModifyInstanceAttributeCommandOutput, SdkError | EC2ServiceError >; @@ -7680,21 +7917,32 @@ interface EC2Service$ { /** * @see {@link ModifyInstanceCapacityReservationAttributesCommand} */ - readonly modifyInstanceCapacityReservationAttributes: ( + modifyInstanceCapacityReservationAttributes( args: ModifyInstanceCapacityReservationAttributesCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< ModifyInstanceCapacityReservationAttributesCommandOutput, SdkError | EC2ServiceError >; + /** + * @see {@link ModifyInstanceCpuOptionsCommand} + */ + modifyInstanceCpuOptions( + args: ModifyInstanceCpuOptionsCommandInput, + options?: HttpHandlerOptions, + ): Effect.Effect< + ModifyInstanceCpuOptionsCommandOutput, + SdkError | EC2ServiceError + >; + /** * @see {@link ModifyInstanceCreditSpecificationCommand} */ - readonly modifyInstanceCreditSpecification: ( + modifyInstanceCreditSpecification( args: ModifyInstanceCreditSpecificationCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< ModifyInstanceCreditSpecificationCommandOutput, SdkError | EC2ServiceError >; @@ -7702,10 +7950,10 @@ interface EC2Service$ { /** * @see {@link ModifyInstanceEventStartTimeCommand} */ - readonly modifyInstanceEventStartTime: ( + modifyInstanceEventStartTime( args: ModifyInstanceEventStartTimeCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< ModifyInstanceEventStartTimeCommandOutput, SdkError | EC2ServiceError >; @@ -7713,10 +7961,10 @@ interface EC2Service$ { /** * @see {@link ModifyInstanceEventWindowCommand} */ - readonly modifyInstanceEventWindow: ( + modifyInstanceEventWindow( args: ModifyInstanceEventWindowCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< ModifyInstanceEventWindowCommandOutput, SdkError | EC2ServiceError >; @@ -7724,21 +7972,32 @@ interface EC2Service$ { /** * @see {@link ModifyInstanceMaintenanceOptionsCommand} */ - readonly modifyInstanceMaintenanceOptions: ( + modifyInstanceMaintenanceOptions( args: ModifyInstanceMaintenanceOptionsCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< ModifyInstanceMaintenanceOptionsCommandOutput, SdkError | EC2ServiceError >; + /** + * @see {@link ModifyInstanceMetadataDefaultsCommand} + */ + modifyInstanceMetadataDefaults( + args: ModifyInstanceMetadataDefaultsCommandInput, + options?: HttpHandlerOptions, + ): Effect.Effect< + ModifyInstanceMetadataDefaultsCommandOutput, + SdkError | EC2ServiceError + >; + /** * @see {@link ModifyInstanceMetadataOptionsCommand} */ - readonly modifyInstanceMetadataOptions: ( + modifyInstanceMetadataOptions( args: ModifyInstanceMetadataOptionsCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< ModifyInstanceMetadataOptionsCommandOutput, SdkError | EC2ServiceError >; @@ -7746,10 +8005,10 @@ interface EC2Service$ { /** * @see {@link ModifyInstancePlacementCommand} */ - readonly modifyInstancePlacement: ( + modifyInstancePlacement( args: ModifyInstancePlacementCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< ModifyInstancePlacementCommandOutput, SdkError | EC2ServiceError >; @@ -7757,26 +8016,26 @@ interface EC2Service$ { /** * @see {@link ModifyIpamCommand} */ - readonly modifyIpam: ( + modifyIpam( args: ModifyIpamCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect; + ): Effect.Effect; /** * @see {@link ModifyIpamPoolCommand} */ - readonly modifyIpamPool: ( + modifyIpamPool( args: ModifyIpamPoolCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect; + ): Effect.Effect; /** * @see {@link ModifyIpamResourceCidrCommand} */ - readonly modifyIpamResourceCidr: ( + modifyIpamResourceCidr( args: ModifyIpamResourceCidrCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< ModifyIpamResourceCidrCommandOutput, SdkError | EC2ServiceError >; @@ -7784,10 +8043,10 @@ interface EC2Service$ { /** * @see {@link ModifyIpamResourceDiscoveryCommand} */ - readonly modifyIpamResourceDiscovery: ( + modifyIpamResourceDiscovery( args: ModifyIpamResourceDiscoveryCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< ModifyIpamResourceDiscoveryCommandOutput, SdkError | EC2ServiceError >; @@ -7795,18 +8054,18 @@ interface EC2Service$ { /** * @see {@link ModifyIpamScopeCommand} */ - readonly modifyIpamScope: ( + modifyIpamScope( args: ModifyIpamScopeCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect; + ): Effect.Effect; /** * @see {@link ModifyLaunchTemplateCommand} */ - readonly modifyLaunchTemplate: ( + modifyLaunchTemplate( args: ModifyLaunchTemplateCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< ModifyLaunchTemplateCommandOutput, SdkError | EC2ServiceError >; @@ -7814,10 +8073,10 @@ interface EC2Service$ { /** * @see {@link ModifyLocalGatewayRouteCommand} */ - readonly modifyLocalGatewayRoute: ( + modifyLocalGatewayRoute( args: ModifyLocalGatewayRouteCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< ModifyLocalGatewayRouteCommandOutput, SdkError | EC2ServiceError >; @@ -7825,10 +8084,10 @@ interface EC2Service$ { /** * @see {@link ModifyManagedPrefixListCommand} */ - readonly modifyManagedPrefixList: ( + modifyManagedPrefixList( args: ModifyManagedPrefixListCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< ModifyManagedPrefixListCommandOutput, SdkError | EC2ServiceError >; @@ -7836,10 +8095,10 @@ interface EC2Service$ { /** * @see {@link ModifyNetworkInterfaceAttributeCommand} */ - readonly modifyNetworkInterfaceAttribute: ( + modifyNetworkInterfaceAttribute( args: ModifyNetworkInterfaceAttributeCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< ModifyNetworkInterfaceAttributeCommandOutput, SdkError | EC2ServiceError >; @@ -7847,10 +8106,10 @@ interface EC2Service$ { /** * @see {@link ModifyPrivateDnsNameOptionsCommand} */ - readonly modifyPrivateDnsNameOptions: ( + modifyPrivateDnsNameOptions( args: ModifyPrivateDnsNameOptionsCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< ModifyPrivateDnsNameOptionsCommandOutput, SdkError | EC2ServiceError >; @@ -7858,10 +8117,10 @@ interface EC2Service$ { /** * @see {@link ModifyReservedInstancesCommand} */ - readonly modifyReservedInstances: ( + modifyReservedInstances( args: ModifyReservedInstancesCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< ModifyReservedInstancesCommandOutput, SdkError | EC2ServiceError >; @@ -7869,10 +8128,10 @@ interface EC2Service$ { /** * @see {@link ModifySecurityGroupRulesCommand} */ - readonly modifySecurityGroupRules: ( + modifySecurityGroupRules( args: ModifySecurityGroupRulesCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< ModifySecurityGroupRulesCommandOutput, SdkError | EC2ServiceError >; @@ -7880,10 +8139,10 @@ interface EC2Service$ { /** * @see {@link ModifySnapshotAttributeCommand} */ - readonly modifySnapshotAttribute: ( + modifySnapshotAttribute( args: ModifySnapshotAttributeCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< ModifySnapshotAttributeCommandOutput, SdkError | EC2ServiceError >; @@ -7891,21 +8150,18 @@ interface EC2Service$ { /** * @see {@link ModifySnapshotTierCommand} */ - readonly modifySnapshotTier: ( + modifySnapshotTier( args: ModifySnapshotTierCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< - ModifySnapshotTierCommandOutput, - SdkError | EC2ServiceError - >; + ): Effect.Effect; /** * @see {@link ModifySpotFleetRequestCommand} */ - readonly modifySpotFleetRequest: ( + modifySpotFleetRequest( args: ModifySpotFleetRequestCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< ModifySpotFleetRequestCommandOutput, SdkError | EC2ServiceError >; @@ -7913,10 +8169,10 @@ interface EC2Service$ { /** * @see {@link ModifySubnetAttributeCommand} */ - readonly modifySubnetAttribute: ( + modifySubnetAttribute( args: ModifySubnetAttributeCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< ModifySubnetAttributeCommandOutput, SdkError | EC2ServiceError >; @@ -7924,10 +8180,10 @@ interface EC2Service$ { /** * @see {@link ModifyTrafficMirrorFilterNetworkServicesCommand} */ - readonly modifyTrafficMirrorFilterNetworkServices: ( + modifyTrafficMirrorFilterNetworkServices( args: ModifyTrafficMirrorFilterNetworkServicesCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< ModifyTrafficMirrorFilterNetworkServicesCommandOutput, SdkError | EC2ServiceError >; @@ -7935,10 +8191,10 @@ interface EC2Service$ { /** * @see {@link ModifyTrafficMirrorFilterRuleCommand} */ - readonly modifyTrafficMirrorFilterRule: ( + modifyTrafficMirrorFilterRule( args: ModifyTrafficMirrorFilterRuleCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< ModifyTrafficMirrorFilterRuleCommandOutput, SdkError | EC2ServiceError >; @@ -7946,10 +8202,10 @@ interface EC2Service$ { /** * @see {@link ModifyTrafficMirrorSessionCommand} */ - readonly modifyTrafficMirrorSession: ( + modifyTrafficMirrorSession( args: ModifyTrafficMirrorSessionCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< ModifyTrafficMirrorSessionCommandOutput, SdkError | EC2ServiceError >; @@ -7957,10 +8213,10 @@ interface EC2Service$ { /** * @see {@link ModifyTransitGatewayCommand} */ - readonly modifyTransitGateway: ( + modifyTransitGateway( args: ModifyTransitGatewayCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< ModifyTransitGatewayCommandOutput, SdkError | EC2ServiceError >; @@ -7968,10 +8224,10 @@ interface EC2Service$ { /** * @see {@link ModifyTransitGatewayPrefixListReferenceCommand} */ - readonly modifyTransitGatewayPrefixListReference: ( + modifyTransitGatewayPrefixListReference( args: ModifyTransitGatewayPrefixListReferenceCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< ModifyTransitGatewayPrefixListReferenceCommandOutput, SdkError | EC2ServiceError >; @@ -7979,10 +8235,10 @@ interface EC2Service$ { /** * @see {@link ModifyTransitGatewayVpcAttachmentCommand} */ - readonly modifyTransitGatewayVpcAttachment: ( + modifyTransitGatewayVpcAttachment( args: ModifyTransitGatewayVpcAttachmentCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< ModifyTransitGatewayVpcAttachmentCommandOutput, SdkError | EC2ServiceError >; @@ -7990,10 +8246,10 @@ interface EC2Service$ { /** * @see {@link ModifyVerifiedAccessEndpointCommand} */ - readonly modifyVerifiedAccessEndpoint: ( + modifyVerifiedAccessEndpoint( args: ModifyVerifiedAccessEndpointCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< ModifyVerifiedAccessEndpointCommandOutput, SdkError | EC2ServiceError >; @@ -8001,10 +8257,10 @@ interface EC2Service$ { /** * @see {@link ModifyVerifiedAccessEndpointPolicyCommand} */ - readonly modifyVerifiedAccessEndpointPolicy: ( + modifyVerifiedAccessEndpointPolicy( args: ModifyVerifiedAccessEndpointPolicyCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< ModifyVerifiedAccessEndpointPolicyCommandOutput, SdkError | EC2ServiceError >; @@ -8012,10 +8268,10 @@ interface EC2Service$ { /** * @see {@link ModifyVerifiedAccessGroupCommand} */ - readonly modifyVerifiedAccessGroup: ( + modifyVerifiedAccessGroup( args: ModifyVerifiedAccessGroupCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< ModifyVerifiedAccessGroupCommandOutput, SdkError | EC2ServiceError >; @@ -8023,10 +8279,10 @@ interface EC2Service$ { /** * @see {@link ModifyVerifiedAccessGroupPolicyCommand} */ - readonly modifyVerifiedAccessGroupPolicy: ( + modifyVerifiedAccessGroupPolicy( args: ModifyVerifiedAccessGroupPolicyCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< ModifyVerifiedAccessGroupPolicyCommandOutput, SdkError | EC2ServiceError >; @@ -8034,10 +8290,10 @@ interface EC2Service$ { /** * @see {@link ModifyVerifiedAccessInstanceCommand} */ - readonly modifyVerifiedAccessInstance: ( + modifyVerifiedAccessInstance( args: ModifyVerifiedAccessInstanceCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< ModifyVerifiedAccessInstanceCommandOutput, SdkError | EC2ServiceError >; @@ -8045,10 +8301,10 @@ interface EC2Service$ { /** * @see {@link ModifyVerifiedAccessInstanceLoggingConfigurationCommand} */ - readonly modifyVerifiedAccessInstanceLoggingConfiguration: ( + modifyVerifiedAccessInstanceLoggingConfiguration( args: ModifyVerifiedAccessInstanceLoggingConfigurationCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< ModifyVerifiedAccessInstanceLoggingConfigurationCommandOutput, SdkError | EC2ServiceError >; @@ -8056,10 +8312,10 @@ interface EC2Service$ { /** * @see {@link ModifyVerifiedAccessTrustProviderCommand} */ - readonly modifyVerifiedAccessTrustProvider: ( + modifyVerifiedAccessTrustProvider( args: ModifyVerifiedAccessTrustProviderCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< ModifyVerifiedAccessTrustProviderCommandOutput, SdkError | EC2ServiceError >; @@ -8067,18 +8323,18 @@ interface EC2Service$ { /** * @see {@link ModifyVolumeCommand} */ - readonly modifyVolume: ( + modifyVolume( args: ModifyVolumeCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect; + ): Effect.Effect; /** * @see {@link ModifyVolumeAttributeCommand} */ - readonly modifyVolumeAttribute: ( + modifyVolumeAttribute( args: ModifyVolumeAttributeCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< ModifyVolumeAttributeCommandOutput, SdkError | EC2ServiceError >; @@ -8086,32 +8342,26 @@ interface EC2Service$ { /** * @see {@link ModifyVpcAttributeCommand} */ - readonly modifyVpcAttribute: ( + modifyVpcAttribute( args: ModifyVpcAttributeCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< - ModifyVpcAttributeCommandOutput, - SdkError | EC2ServiceError - >; + ): Effect.Effect; /** * @see {@link ModifyVpcEndpointCommand} */ - readonly modifyVpcEndpoint: ( + modifyVpcEndpoint( args: ModifyVpcEndpointCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< - ModifyVpcEndpointCommandOutput, - SdkError | EC2ServiceError - >; + ): Effect.Effect; /** * @see {@link ModifyVpcEndpointConnectionNotificationCommand} */ - readonly modifyVpcEndpointConnectionNotification: ( + modifyVpcEndpointConnectionNotification( args: ModifyVpcEndpointConnectionNotificationCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< ModifyVpcEndpointConnectionNotificationCommandOutput, SdkError | EC2ServiceError >; @@ -8119,10 +8369,10 @@ interface EC2Service$ { /** * @see {@link ModifyVpcEndpointServiceConfigurationCommand} */ - readonly modifyVpcEndpointServiceConfiguration: ( + modifyVpcEndpointServiceConfiguration( args: ModifyVpcEndpointServiceConfigurationCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< ModifyVpcEndpointServiceConfigurationCommandOutput, SdkError | EC2ServiceError >; @@ -8130,10 +8380,10 @@ interface EC2Service$ { /** * @see {@link ModifyVpcEndpointServicePayerResponsibilityCommand} */ - readonly modifyVpcEndpointServicePayerResponsibility: ( + modifyVpcEndpointServicePayerResponsibility( args: ModifyVpcEndpointServicePayerResponsibilityCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< ModifyVpcEndpointServicePayerResponsibilityCommandOutput, SdkError | EC2ServiceError >; @@ -8141,10 +8391,10 @@ interface EC2Service$ { /** * @see {@link ModifyVpcEndpointServicePermissionsCommand} */ - readonly modifyVpcEndpointServicePermissions: ( + modifyVpcEndpointServicePermissions( args: ModifyVpcEndpointServicePermissionsCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< ModifyVpcEndpointServicePermissionsCommandOutput, SdkError | EC2ServiceError >; @@ -8152,10 +8402,10 @@ interface EC2Service$ { /** * @see {@link ModifyVpcPeeringConnectionOptionsCommand} */ - readonly modifyVpcPeeringConnectionOptions: ( + modifyVpcPeeringConnectionOptions( args: ModifyVpcPeeringConnectionOptionsCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< ModifyVpcPeeringConnectionOptionsCommandOutput, SdkError | EC2ServiceError >; @@ -8163,18 +8413,18 @@ interface EC2Service$ { /** * @see {@link ModifyVpcTenancyCommand} */ - readonly modifyVpcTenancy: ( + modifyVpcTenancy( args: ModifyVpcTenancyCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect; + ): Effect.Effect; /** * @see {@link ModifyVpnConnectionCommand} */ - readonly modifyVpnConnection: ( + modifyVpnConnection( args: ModifyVpnConnectionCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< ModifyVpnConnectionCommandOutput, SdkError | EC2ServiceError >; @@ -8182,10 +8432,10 @@ interface EC2Service$ { /** * @see {@link ModifyVpnConnectionOptionsCommand} */ - readonly modifyVpnConnectionOptions: ( + modifyVpnConnectionOptions( args: ModifyVpnConnectionOptionsCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< ModifyVpnConnectionOptionsCommandOutput, SdkError | EC2ServiceError >; @@ -8193,10 +8443,10 @@ interface EC2Service$ { /** * @see {@link ModifyVpnTunnelCertificateCommand} */ - readonly modifyVpnTunnelCertificate: ( + modifyVpnTunnelCertificate( args: ModifyVpnTunnelCertificateCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< ModifyVpnTunnelCertificateCommandOutput, SdkError | EC2ServiceError >; @@ -8204,10 +8454,10 @@ interface EC2Service$ { /** * @see {@link ModifyVpnTunnelOptionsCommand} */ - readonly modifyVpnTunnelOptions: ( + modifyVpnTunnelOptions( args: ModifyVpnTunnelOptionsCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< ModifyVpnTunnelOptionsCommandOutput, SdkError | EC2ServiceError >; @@ -8215,48 +8465,56 @@ interface EC2Service$ { /** * @see {@link MonitorInstancesCommand} */ - readonly monitorInstances: ( + monitorInstances( args: MonitorInstancesCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect; + ): Effect.Effect; /** * @see {@link MoveAddressToVpcCommand} */ - readonly moveAddressToVpc: ( + moveAddressToVpc( args: MoveAddressToVpcCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect; + ): Effect.Effect; /** * @see {@link MoveByoipCidrToIpamCommand} */ - readonly moveByoipCidrToIpam: ( + moveByoipCidrToIpam( args: MoveByoipCidrToIpamCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< MoveByoipCidrToIpamCommandOutput, SdkError | EC2ServiceError >; /** - * @see {@link ProvisionByoipCidrCommand} + * @see {@link MoveCapacityReservationInstancesCommand} */ - readonly provisionByoipCidr: ( - args: ProvisionByoipCidrCommandInput, + moveCapacityReservationInstances( + args: MoveCapacityReservationInstancesCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< - ProvisionByoipCidrCommandOutput, + ): Effect.Effect< + MoveCapacityReservationInstancesCommandOutput, SdkError | EC2ServiceError >; + /** + * @see {@link ProvisionByoipCidrCommand} + */ + provisionByoipCidr( + args: ProvisionByoipCidrCommandInput, + options?: HttpHandlerOptions, + ): Effect.Effect; + /** * @see {@link ProvisionIpamByoasnCommand} */ - readonly provisionIpamByoasn: ( + provisionIpamByoasn( args: ProvisionIpamByoasnCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< ProvisionIpamByoasnCommandOutput, SdkError | EC2ServiceError >; @@ -8264,10 +8522,10 @@ interface EC2Service$ { /** * @see {@link ProvisionIpamPoolCidrCommand} */ - readonly provisionIpamPoolCidr: ( + provisionIpamPoolCidr( args: ProvisionIpamPoolCidrCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< ProvisionIpamPoolCidrCommandOutput, SdkError | EC2ServiceError >; @@ -8275,10 +8533,10 @@ interface EC2Service$ { /** * @see {@link ProvisionPublicIpv4PoolCidrCommand} */ - readonly provisionPublicIpv4PoolCidr: ( + provisionPublicIpv4PoolCidr( args: ProvisionPublicIpv4PoolCidrCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< ProvisionPublicIpv4PoolCidrCommandOutput, SdkError | EC2ServiceError >; @@ -8286,10 +8544,10 @@ interface EC2Service$ { /** * @see {@link PurchaseCapacityBlockCommand} */ - readonly purchaseCapacityBlock: ( + purchaseCapacityBlock( args: PurchaseCapacityBlockCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< PurchaseCapacityBlockCommandOutput, SdkError | EC2ServiceError >; @@ -8297,10 +8555,10 @@ interface EC2Service$ { /** * @see {@link PurchaseHostReservationCommand} */ - readonly purchaseHostReservation: ( + purchaseHostReservation( args: PurchaseHostReservationCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< PurchaseHostReservationCommandOutput, SdkError | EC2ServiceError >; @@ -8308,10 +8566,10 @@ interface EC2Service$ { /** * @see {@link PurchaseReservedInstancesOfferingCommand} */ - readonly purchaseReservedInstancesOffering: ( + purchaseReservedInstancesOffering( args: PurchaseReservedInstancesOfferingCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< PurchaseReservedInstancesOfferingCommandOutput, SdkError | EC2ServiceError >; @@ -8319,10 +8577,10 @@ interface EC2Service$ { /** * @see {@link PurchaseScheduledInstancesCommand} */ - readonly purchaseScheduledInstances: ( + purchaseScheduledInstances( args: PurchaseScheduledInstancesCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< PurchaseScheduledInstancesCommandOutput, SdkError | EC2ServiceError >; @@ -8330,26 +8588,26 @@ interface EC2Service$ { /** * @see {@link RebootInstancesCommand} */ - readonly rebootInstances: ( + rebootInstances( args: RebootInstancesCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect; + ): Effect.Effect; /** * @see {@link RegisterImageCommand} */ - readonly registerImage: ( + registerImage( args: RegisterImageCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect; + ): Effect.Effect; /** * @see {@link RegisterInstanceEventNotificationAttributesCommand} */ - readonly registerInstanceEventNotificationAttributes: ( + registerInstanceEventNotificationAttributes( args: RegisterInstanceEventNotificationAttributesCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< RegisterInstanceEventNotificationAttributesCommandOutput, SdkError | EC2ServiceError >; @@ -8357,10 +8615,10 @@ interface EC2Service$ { /** * @see {@link RegisterTransitGatewayMulticastGroupMembersCommand} */ - readonly registerTransitGatewayMulticastGroupMembers: ( + registerTransitGatewayMulticastGroupMembers( args: RegisterTransitGatewayMulticastGroupMembersCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< RegisterTransitGatewayMulticastGroupMembersCommandOutput, SdkError | EC2ServiceError >; @@ -8368,21 +8626,32 @@ interface EC2Service$ { /** * @see {@link RegisterTransitGatewayMulticastGroupSourcesCommand} */ - readonly registerTransitGatewayMulticastGroupSources: ( + registerTransitGatewayMulticastGroupSources( args: RegisterTransitGatewayMulticastGroupSourcesCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< RegisterTransitGatewayMulticastGroupSourcesCommandOutput, SdkError | EC2ServiceError >; + /** + * @see {@link RejectCapacityReservationBillingOwnershipCommand} + */ + rejectCapacityReservationBillingOwnership( + args: RejectCapacityReservationBillingOwnershipCommandInput, + options?: HttpHandlerOptions, + ): Effect.Effect< + RejectCapacityReservationBillingOwnershipCommandOutput, + SdkError | EC2ServiceError + >; + /** * @see {@link RejectTransitGatewayMulticastDomainAssociationsCommand} */ - readonly rejectTransitGatewayMulticastDomainAssociations: ( + rejectTransitGatewayMulticastDomainAssociations( args: RejectTransitGatewayMulticastDomainAssociationsCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< RejectTransitGatewayMulticastDomainAssociationsCommandOutput, SdkError | EC2ServiceError >; @@ -8390,10 +8659,10 @@ interface EC2Service$ { /** * @see {@link RejectTransitGatewayPeeringAttachmentCommand} */ - readonly rejectTransitGatewayPeeringAttachment: ( + rejectTransitGatewayPeeringAttachment( args: RejectTransitGatewayPeeringAttachmentCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< RejectTransitGatewayPeeringAttachmentCommandOutput, SdkError | EC2ServiceError >; @@ -8401,10 +8670,10 @@ interface EC2Service$ { /** * @see {@link RejectTransitGatewayVpcAttachmentCommand} */ - readonly rejectTransitGatewayVpcAttachment: ( + rejectTransitGatewayVpcAttachment( args: RejectTransitGatewayVpcAttachmentCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< RejectTransitGatewayVpcAttachmentCommandOutput, SdkError | EC2ServiceError >; @@ -8412,10 +8681,10 @@ interface EC2Service$ { /** * @see {@link RejectVpcEndpointConnectionsCommand} */ - readonly rejectVpcEndpointConnections: ( + rejectVpcEndpointConnections( args: RejectVpcEndpointConnectionsCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< RejectVpcEndpointConnectionsCommandOutput, SdkError | EC2ServiceError >; @@ -8423,10 +8692,10 @@ interface EC2Service$ { /** * @see {@link RejectVpcPeeringConnectionCommand} */ - readonly rejectVpcPeeringConnection: ( + rejectVpcPeeringConnection( args: RejectVpcPeeringConnectionCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< RejectVpcPeeringConnectionCommandOutput, SdkError | EC2ServiceError >; @@ -8434,26 +8703,26 @@ interface EC2Service$ { /** * @see {@link ReleaseAddressCommand} */ - readonly releaseAddress: ( + releaseAddress( args: ReleaseAddressCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect; + ): Effect.Effect; /** * @see {@link ReleaseHostsCommand} */ - readonly releaseHosts: ( + releaseHosts( args: ReleaseHostsCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect; + ): Effect.Effect; /** * @see {@link ReleaseIpamPoolAllocationCommand} */ - readonly releaseIpamPoolAllocation: ( + releaseIpamPoolAllocation( args: ReleaseIpamPoolAllocationCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< ReleaseIpamPoolAllocationCommandOutput, SdkError | EC2ServiceError >; @@ -8461,10 +8730,10 @@ interface EC2Service$ { /** * @see {@link ReplaceIamInstanceProfileAssociationCommand} */ - readonly replaceIamInstanceProfileAssociation: ( + replaceIamInstanceProfileAssociation( args: ReplaceIamInstanceProfileAssociationCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< ReplaceIamInstanceProfileAssociationCommandOutput, SdkError | EC2ServiceError >; @@ -8472,10 +8741,10 @@ interface EC2Service$ { /** * @see {@link ReplaceNetworkAclAssociationCommand} */ - readonly replaceNetworkAclAssociation: ( + replaceNetworkAclAssociation( args: ReplaceNetworkAclAssociationCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< ReplaceNetworkAclAssociationCommandOutput, SdkError | EC2ServiceError >; @@ -8483,10 +8752,10 @@ interface EC2Service$ { /** * @see {@link ReplaceNetworkAclEntryCommand} */ - readonly replaceNetworkAclEntry: ( + replaceNetworkAclEntry( args: ReplaceNetworkAclEntryCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< ReplaceNetworkAclEntryCommandOutput, SdkError | EC2ServiceError >; @@ -8494,18 +8763,18 @@ interface EC2Service$ { /** * @see {@link ReplaceRouteCommand} */ - readonly replaceRoute: ( + replaceRoute( args: ReplaceRouteCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect; + ): Effect.Effect; /** * @see {@link ReplaceRouteTableAssociationCommand} */ - readonly replaceRouteTableAssociation: ( + replaceRouteTableAssociation( args: ReplaceRouteTableAssociationCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< ReplaceRouteTableAssociationCommandOutput, SdkError | EC2ServiceError >; @@ -8513,10 +8782,10 @@ interface EC2Service$ { /** * @see {@link ReplaceTransitGatewayRouteCommand} */ - readonly replaceTransitGatewayRoute: ( + replaceTransitGatewayRoute( args: ReplaceTransitGatewayRouteCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< ReplaceTransitGatewayRouteCommandOutput, SdkError | EC2ServiceError >; @@ -8524,18 +8793,18 @@ interface EC2Service$ { /** * @see {@link ReplaceVpnTunnelCommand} */ - readonly replaceVpnTunnel: ( + replaceVpnTunnel( args: ReplaceVpnTunnelCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect; + ): Effect.Effect; /** * @see {@link ReportInstanceStatusCommand} */ - readonly reportInstanceStatus: ( + reportInstanceStatus( args: ReportInstanceStatusCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< ReportInstanceStatusCommandOutput, SdkError | EC2ServiceError >; @@ -8543,18 +8812,18 @@ interface EC2Service$ { /** * @see {@link RequestSpotFleetCommand} */ - readonly requestSpotFleet: ( + requestSpotFleet( args: RequestSpotFleetCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect; + ): Effect.Effect; /** * @see {@link RequestSpotInstancesCommand} */ - readonly requestSpotInstances: ( + requestSpotInstances( args: RequestSpotInstancesCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< RequestSpotInstancesCommandOutput, SdkError | EC2ServiceError >; @@ -8562,10 +8831,10 @@ interface EC2Service$ { /** * @see {@link ResetAddressAttributeCommand} */ - readonly resetAddressAttribute: ( + resetAddressAttribute( args: ResetAddressAttributeCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< ResetAddressAttributeCommandOutput, SdkError | EC2ServiceError >; @@ -8573,10 +8842,10 @@ interface EC2Service$ { /** * @see {@link ResetEbsDefaultKmsKeyIdCommand} */ - readonly resetEbsDefaultKmsKeyId: ( + resetEbsDefaultKmsKeyId( args: ResetEbsDefaultKmsKeyIdCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< ResetEbsDefaultKmsKeyIdCommandOutput, SdkError | EC2ServiceError >; @@ -8584,10 +8853,10 @@ interface EC2Service$ { /** * @see {@link ResetFpgaImageAttributeCommand} */ - readonly resetFpgaImageAttribute: ( + resetFpgaImageAttribute( args: ResetFpgaImageAttributeCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< ResetFpgaImageAttributeCommandOutput, SdkError | EC2ServiceError >; @@ -8595,10 +8864,10 @@ interface EC2Service$ { /** * @see {@link ResetImageAttributeCommand} */ - readonly resetImageAttribute: ( + resetImageAttribute( args: ResetImageAttributeCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< ResetImageAttributeCommandOutput, SdkError | EC2ServiceError >; @@ -8606,10 +8875,10 @@ interface EC2Service$ { /** * @see {@link ResetInstanceAttributeCommand} */ - readonly resetInstanceAttribute: ( + resetInstanceAttribute( args: ResetInstanceAttributeCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< ResetInstanceAttributeCommandOutput, SdkError | EC2ServiceError >; @@ -8617,10 +8886,10 @@ interface EC2Service$ { /** * @see {@link ResetNetworkInterfaceAttributeCommand} */ - readonly resetNetworkInterfaceAttribute: ( + resetNetworkInterfaceAttribute( args: ResetNetworkInterfaceAttributeCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< ResetNetworkInterfaceAttributeCommandOutput, SdkError | EC2ServiceError >; @@ -8628,10 +8897,10 @@ interface EC2Service$ { /** * @see {@link ResetSnapshotAttributeCommand} */ - readonly resetSnapshotAttribute: ( + resetSnapshotAttribute( args: ResetSnapshotAttributeCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< ResetSnapshotAttributeCommandOutput, SdkError | EC2ServiceError >; @@ -8639,10 +8908,10 @@ interface EC2Service$ { /** * @see {@link RestoreAddressToClassicCommand} */ - readonly restoreAddressToClassic: ( + restoreAddressToClassic( args: RestoreAddressToClassicCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< RestoreAddressToClassicCommandOutput, SdkError | EC2ServiceError >; @@ -8650,10 +8919,10 @@ interface EC2Service$ { /** * @see {@link RestoreImageFromRecycleBinCommand} */ - readonly restoreImageFromRecycleBin: ( + restoreImageFromRecycleBin( args: RestoreImageFromRecycleBinCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< RestoreImageFromRecycleBinCommandOutput, SdkError | EC2ServiceError >; @@ -8661,10 +8930,10 @@ interface EC2Service$ { /** * @see {@link RestoreManagedPrefixListVersionCommand} */ - readonly restoreManagedPrefixListVersion: ( + restoreManagedPrefixListVersion( args: RestoreManagedPrefixListVersionCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< RestoreManagedPrefixListVersionCommandOutput, SdkError | EC2ServiceError >; @@ -8672,10 +8941,10 @@ interface EC2Service$ { /** * @see {@link RestoreSnapshotFromRecycleBinCommand} */ - readonly restoreSnapshotFromRecycleBin: ( + restoreSnapshotFromRecycleBin( args: RestoreSnapshotFromRecycleBinCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< RestoreSnapshotFromRecycleBinCommandOutput, SdkError | EC2ServiceError >; @@ -8683,10 +8952,10 @@ interface EC2Service$ { /** * @see {@link RestoreSnapshotTierCommand} */ - readonly restoreSnapshotTier: ( + restoreSnapshotTier( args: RestoreSnapshotTierCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< RestoreSnapshotTierCommandOutput, SdkError | EC2ServiceError >; @@ -8694,10 +8963,10 @@ interface EC2Service$ { /** * @see {@link RevokeClientVpnIngressCommand} */ - readonly revokeClientVpnIngress: ( + revokeClientVpnIngress( args: RevokeClientVpnIngressCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< RevokeClientVpnIngressCommandOutput, SdkError | EC2ServiceError >; @@ -8705,10 +8974,10 @@ interface EC2Service$ { /** * @see {@link RevokeSecurityGroupEgressCommand} */ - readonly revokeSecurityGroupEgress: ( + revokeSecurityGroupEgress( args: RevokeSecurityGroupEgressCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< RevokeSecurityGroupEgressCommandOutput, SdkError | EC2ServiceError >; @@ -8716,10 +8985,10 @@ interface EC2Service$ { /** * @see {@link RevokeSecurityGroupIngressCommand} */ - readonly revokeSecurityGroupIngress: ( + revokeSecurityGroupIngress( args: RevokeSecurityGroupIngressCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< RevokeSecurityGroupIngressCommandOutput, SdkError | EC2ServiceError >; @@ -8727,18 +8996,18 @@ interface EC2Service$ { /** * @see {@link RunInstancesCommand} */ - readonly runInstances: ( + runInstances( args: RunInstancesCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect; + ): Effect.Effect; /** * @see {@link RunScheduledInstancesCommand} */ - readonly runScheduledInstances: ( + runScheduledInstances( args: RunScheduledInstancesCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< RunScheduledInstancesCommandOutput, SdkError | EC2ServiceError >; @@ -8746,10 +9015,10 @@ interface EC2Service$ { /** * @see {@link SearchLocalGatewayRoutesCommand} */ - readonly searchLocalGatewayRoutes: ( + searchLocalGatewayRoutes( args: SearchLocalGatewayRoutesCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< SearchLocalGatewayRoutesCommandOutput, SdkError | EC2ServiceError >; @@ -8757,10 +9026,10 @@ interface EC2Service$ { /** * @see {@link SearchTransitGatewayMulticastGroupsCommand} */ - readonly searchTransitGatewayMulticastGroups: ( + searchTransitGatewayMulticastGroups( args: SearchTransitGatewayMulticastGroupsCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< SearchTransitGatewayMulticastGroupsCommandOutput, SdkError | EC2ServiceError >; @@ -8768,10 +9037,10 @@ interface EC2Service$ { /** * @see {@link SearchTransitGatewayRoutesCommand} */ - readonly searchTransitGatewayRoutes: ( + searchTransitGatewayRoutes( args: SearchTransitGatewayRoutesCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< SearchTransitGatewayRoutesCommandOutput, SdkError | EC2ServiceError >; @@ -8779,10 +9048,10 @@ interface EC2Service$ { /** * @see {@link SendDiagnosticInterruptCommand} */ - readonly sendDiagnosticInterrupt: ( + sendDiagnosticInterrupt( args: SendDiagnosticInterruptCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< SendDiagnosticInterruptCommandOutput, SdkError | EC2ServiceError >; @@ -8790,18 +9059,18 @@ interface EC2Service$ { /** * @see {@link StartInstancesCommand} */ - readonly startInstances: ( + startInstances( args: StartInstancesCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect; + ): Effect.Effect; /** * @see {@link StartNetworkInsightsAccessScopeAnalysisCommand} */ - readonly startNetworkInsightsAccessScopeAnalysis: ( + startNetworkInsightsAccessScopeAnalysis( args: StartNetworkInsightsAccessScopeAnalysisCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< StartNetworkInsightsAccessScopeAnalysisCommandOutput, SdkError | EC2ServiceError >; @@ -8809,10 +9078,10 @@ interface EC2Service$ { /** * @see {@link StartNetworkInsightsAnalysisCommand} */ - readonly startNetworkInsightsAnalysis: ( + startNetworkInsightsAnalysis( args: StartNetworkInsightsAnalysisCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< StartNetworkInsightsAnalysisCommandOutput, SdkError | EC2ServiceError >; @@ -8820,10 +9089,10 @@ interface EC2Service$ { /** * @see {@link StartVpcEndpointServicePrivateDnsVerificationCommand} */ - readonly startVpcEndpointServicePrivateDnsVerification: ( + startVpcEndpointServicePrivateDnsVerification( args: StartVpcEndpointServicePrivateDnsVerificationCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< StartVpcEndpointServicePrivateDnsVerificationCommandOutput, SdkError | EC2ServiceError >; @@ -8831,18 +9100,18 @@ interface EC2Service$ { /** * @see {@link StopInstancesCommand} */ - readonly stopInstances: ( + stopInstances( args: StopInstancesCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect; + ): Effect.Effect; /** * @see {@link TerminateClientVpnConnectionsCommand} */ - readonly terminateClientVpnConnections: ( + terminateClientVpnConnections( args: TerminateClientVpnConnectionsCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< TerminateClientVpnConnectionsCommandOutput, SdkError | EC2ServiceError >; @@ -8850,21 +9119,18 @@ interface EC2Service$ { /** * @see {@link TerminateInstancesCommand} */ - readonly terminateInstances: ( + terminateInstances( args: TerminateInstancesCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< - TerminateInstancesCommandOutput, - SdkError | EC2ServiceError - >; + ): Effect.Effect; /** * @see {@link UnassignIpv6AddressesCommand} */ - readonly unassignIpv6Addresses: ( + unassignIpv6Addresses( args: UnassignIpv6AddressesCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< UnassignIpv6AddressesCommandOutput, SdkError | EC2ServiceError >; @@ -8872,10 +9138,10 @@ interface EC2Service$ { /** * @see {@link UnassignPrivateIpAddressesCommand} */ - readonly unassignPrivateIpAddresses: ( + unassignPrivateIpAddresses( args: UnassignPrivateIpAddressesCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< UnassignPrivateIpAddressesCommandOutput, SdkError | EC2ServiceError >; @@ -8883,10 +9149,10 @@ interface EC2Service$ { /** * @see {@link UnassignPrivateNatGatewayAddressCommand} */ - readonly unassignPrivateNatGatewayAddress: ( + unassignPrivateNatGatewayAddress( args: UnassignPrivateNatGatewayAddressCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< UnassignPrivateNatGatewayAddressCommandOutput, SdkError | EC2ServiceError >; @@ -8894,29 +9160,26 @@ interface EC2Service$ { /** * @see {@link UnlockSnapshotCommand} */ - readonly unlockSnapshot: ( + unlockSnapshot( args: UnlockSnapshotCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect; + ): Effect.Effect; /** * @see {@link UnmonitorInstancesCommand} */ - readonly unmonitorInstances: ( + unmonitorInstances( args: UnmonitorInstancesCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< - UnmonitorInstancesCommandOutput, - SdkError | EC2ServiceError - >; + ): Effect.Effect; /** * @see {@link UpdateSecurityGroupRuleDescriptionsEgressCommand} */ - readonly updateSecurityGroupRuleDescriptionsEgress: ( + updateSecurityGroupRuleDescriptionsEgress( args: UpdateSecurityGroupRuleDescriptionsEgressCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< UpdateSecurityGroupRuleDescriptionsEgressCommandOutput, SdkError | EC2ServiceError >; @@ -8924,10 +9187,10 @@ interface EC2Service$ { /** * @see {@link UpdateSecurityGroupRuleDescriptionsIngressCommand} */ - readonly updateSecurityGroupRuleDescriptionsIngress: ( + updateSecurityGroupRuleDescriptionsIngress( args: UpdateSecurityGroupRuleDescriptionsIngressCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< + ): Effect.Effect< UpdateSecurityGroupRuleDescriptionsIngressCommandOutput, SdkError | EC2ServiceError >; @@ -8935,24 +9198,12 @@ interface EC2Service$ { /** * @see {@link WithdrawByoipCidrCommand} */ - readonly withdrawByoipCidr: ( + withdrawByoipCidr( args: WithdrawByoipCidrCommandInput, options?: HttpHandlerOptions, - ) => Effect.Effect< - WithdrawByoipCidrCommandOutput, - SdkError | EC2ServiceError - >; + ): Effect.Effect; } -/** - * @since 1.0.0 - * @category models - */ -export class EC2Service extends Effect.Tag("@effect-aws/client-ec2/EC2Service")< - EC2Service, - EC2Service$ ->() {} - /** * @since 1.0.0 * @category constructors @@ -9000,15 +9251,61 @@ export const makeEC2Service = Effect.gen(function* (_) { }, {}) as EC2Service$; }); +/** + * @since 1.0.0 + * @category models + */ +export class EC2Service extends Effect.Tag("@effect-aws/client-ec2/EC2Service")< + EC2Service, + EC2Service$ +>() { + static readonly defaultLayer = Layer.effect(this, makeEC2Service).pipe( + Layer.provide(EC2ClientInstanceLayer), + Layer.provide(DefaultEC2ClientConfigLayer), + ); + static readonly layer = (config: EC2ClientConfig) => + Layer.effect(this, makeEC2Service).pipe( + Layer.provide(EC2ClientInstanceLayer), + Layer.provide( + Layer.effect( + EC2ClientInstanceConfig, + makeDefaultEC2ClientInstanceConfig.pipe( + Effect.map((defaultConfig) => ({ ...defaultConfig, ...config })), + ), + ), + ), + ); + static readonly baseLayer = ( + evaluate: (defaultConfig: EC2ClientConfig) => EC2Client, + ) => + Layer.effect(this, makeEC2Service).pipe( + Layer.provide( + Layer.effect( + EC2ClientInstance, + Effect.map(makeDefaultEC2ClientInstanceConfig, evaluate), + ), + ), + ); +} + +/** + * @since 1.0.0 + * @category models + * @alias EC2Service + */ +export const EC2 = EC2Service; + /** * @since 1.0.0 * @category layers + * @deprecated use EC2.baseLayer instead */ export const BaseEC2ServiceLayer = Layer.effect(EC2Service, makeEC2Service); /** * @since 1.0.0 * @category layers + * @deprecated use EC2.layer instead */ export const EC2ServiceLayer = BaseEC2ServiceLayer.pipe( Layer.provide(EC2ClientInstanceLayer), @@ -9017,7 +9314,6 @@ export const EC2ServiceLayer = BaseEC2ServiceLayer.pipe( /** * @since 1.0.0 * @category layers + * @deprecated use EC2.defaultLayer instead */ -export const DefaultEC2ServiceLayer = EC2ServiceLayer.pipe( - Layer.provide(DefaultEC2ClientConfigLayer), -); +export const DefaultEC2ServiceLayer = EC2Service.defaultLayer; diff --git a/packages/client-ec2/test/EC2.test.ts b/packages/client-ec2/test/EC2.test.ts index c6ebde4..22a05ec 100644 --- a/packages/client-ec2/test/EC2.test.ts +++ b/packages/client-ec2/test/EC2.test.ts @@ -3,39 +3,41 @@ import { AcceptAddressTransferCommand, EC2Client, } from "@aws-sdk/client-ec2"; +// @ts-ignore +import * as runtimeConfig from "@aws-sdk/client-ec2/dist-cjs/runtimeConfig"; import { mockClient } from "aws-sdk-client-mock"; import * as Effect from "effect/Effect"; import * as Exit from "effect/Exit"; import { pipe } from "effect/Function"; -import * as Layer from "effect/Layer"; -import { - BaseEC2ServiceLayer, - DefaultEC2ClientConfigLayer, - DefaultEC2ServiceLayer, - EC2ClientInstance, - EC2ClientInstanceConfig, - EC2Service, - EC2ServiceLayer, - SdkError, -} from "../src"; +import { afterEach, describe, expect, it, vi } from "vitest"; +import { EC2, SdkError } from "../src"; +const getRuntimeConfig = vi.spyOn(runtimeConfig, "getRuntimeConfig"); const clientMock = mockClient(EC2Client); describe("EC2ClientImpl", () => { + afterEach(() => { + getRuntimeConfig.mockClear(); + }); + it("default", async () => { clientMock.reset().on(AcceptAddressTransferCommand).resolves({}); const args = {} as unknown as AcceptAddressTransferCommandInput; - const program = EC2Service.acceptAddressTransfer(args); + const program = EC2.acceptAddressTransfer(args); const result = await pipe( program, - Effect.provide(DefaultEC2ServiceLayer), + Effect.provide(EC2.defaultLayer), Effect.runPromiseExit, ); expect(result).toEqual(Exit.succeed({})); + expect(getRuntimeConfig).toHaveBeenCalledTimes(1); + expect(getRuntimeConfig).toHaveBeenCalledWith({ + logger: expect.any(Object), + }); expect(clientMock).toHaveReceivedCommandTimes( AcceptAddressTransferCommand, 1, @@ -51,22 +53,20 @@ describe("EC2ClientImpl", () => { const args = {} as unknown as AcceptAddressTransferCommandInput; - const program = EC2Service.acceptAddressTransfer(args); - - const EC2ClientConfigLayer = Layer.succeed(EC2ClientInstanceConfig, { - region: "eu-central-1", - }); - const CustomEC2ServiceLayer = EC2ServiceLayer.pipe( - Layer.provide(EC2ClientConfigLayer), - ); + const program = EC2.acceptAddressTransfer(args); const result = await pipe( program, - Effect.provide(CustomEC2ServiceLayer), + Effect.provide(EC2.layer({ region: "eu-central-1" })), Effect.runPromiseExit, ); expect(result).toEqual(Exit.succeed({})); + expect(getRuntimeConfig).toHaveBeenCalledTimes(1); + expect(getRuntimeConfig).toHaveBeenCalledWith({ + region: "eu-central-1", + logger: expect.any(Object), + }); expect(clientMock).toHaveReceivedCommandTimes( AcceptAddressTransferCommand, 1, @@ -82,23 +82,21 @@ describe("EC2ClientImpl", () => { const args = {} as unknown as AcceptAddressTransferCommandInput; - const program = EC2Service.acceptAddressTransfer(args); - - const EC2ClientInstanceLayer = Layer.succeed( - EC2ClientInstance, - new EC2Client({ region: "eu-central-1" }), - ); - const CustomEC2ServiceLayer = BaseEC2ServiceLayer.pipe( - Layer.provide(EC2ClientInstanceLayer), - ); + const program = EC2.acceptAddressTransfer(args); const result = await pipe( program, - Effect.provide(CustomEC2ServiceLayer), + Effect.provide( + EC2.baseLayer(() => new EC2Client({ region: "eu-central-1" })), + ), Effect.runPromiseExit, ); expect(result).toEqual(Exit.succeed({})); + expect(getRuntimeConfig).toHaveBeenCalledTimes(1); + expect(getRuntimeConfig).toHaveBeenCalledWith({ + region: "eu-central-1", + }); expect(clientMock).toHaveReceivedCommandTimes( AcceptAddressTransferCommand, 1, @@ -114,27 +112,24 @@ describe("EC2ClientImpl", () => { const args = {} as unknown as AcceptAddressTransferCommandInput; - const program = EC2Service.acceptAddressTransfer(args); - - const EC2ClientInstanceLayer = Layer.effect( - EC2ClientInstance, - Effect.map( - EC2ClientInstanceConfig, - (config) => new EC2Client({ ...config, region: "eu-central-1" }), - ), - ); - const CustomEC2ServiceLayer = BaseEC2ServiceLayer.pipe( - Layer.provide(EC2ClientInstanceLayer), - Layer.provide(DefaultEC2ClientConfigLayer), - ); + const program = EC2.acceptAddressTransfer(args); const result = await pipe( program, - Effect.provide(CustomEC2ServiceLayer), + Effect.provide( + EC2.baseLayer( + (config) => new EC2Client({ ...config, region: "eu-central-1" }), + ), + ), Effect.runPromiseExit, ); expect(result).toEqual(Exit.succeed({})); + expect(getRuntimeConfig).toHaveBeenCalledTimes(1); + expect(getRuntimeConfig).toHaveBeenCalledWith({ + region: "eu-central-1", + logger: expect.any(Object), + }); expect(clientMock).toHaveReceivedCommandTimes( AcceptAddressTransferCommand, 1, @@ -153,11 +148,11 @@ describe("EC2ClientImpl", () => { const args = {} as unknown as AcceptAddressTransferCommandInput; - const program = EC2Service.acceptAddressTransfer(args); + const program = EC2.acceptAddressTransfer(args); const result = await pipe( program, - Effect.provide(DefaultEC2ServiceLayer), + Effect.provide(EC2.defaultLayer), Effect.runPromiseExit, ); diff --git a/packages/client-elasticache/README.md b/packages/client-elasticache/README.md index 127641f..166e64d 100644 --- a/packages/client-elasticache/README.md +++ b/packages/client-elasticache/README.md @@ -14,16 +14,13 @@ npm install --save @effect-aws/client-elasticache With default ElastiCacheClient instance: ```typescript -import { - ElastiCacheService, - DefaultElastiCacheServiceLayer, -} from "@effect-aws/client-elasticache"; +import { ElastiCache } from "@effect-aws/client-elasticache"; -const program = ElastiCacheService.listTagsForResource(args); +const program = ElastiCache.listTagsForResource(args); const result = pipe( program, - Effect.provide(DefaultElastiCacheServiceLayer), + Effect.provide(ElastiCache.defaultLayer), Effect.runPromise, ); ``` @@ -31,23 +28,15 @@ const result = pipe( With custom ElastiCacheClient instance: ```typescript -import { - ElastiCacheService, - BaseElastiCacheServiceLayer, - ElastiCacheClientInstance, -} from "@effect-aws/client-elasticache"; +import { ElastiCache } from "@effect-aws/client-elasticache"; -const program = ElastiCacheService.listTagsForResource(args); - -const ElastiCacheClientInstanceLayer = Layer.succeed( - ElastiCacheClientInstance, - new ElastiCacheClient({ region: "eu-central-1" }), -); +const program = ElastiCache.listTagsForResource(args); const result = await pipe( program, - Effect.provide(BaseElastiCacheServiceLayer), - Effect.provide(ElastiCacheClientInstanceLayer), + Effect.provide( + ElastiCache.baseLayer(() => new ElastiCacheClient({ region: "eu-central-1" })), + ), Effect.runPromise, ); ``` @@ -55,35 +44,15 @@ const result = await pipe( With custom ElastiCacheClient configuration: ```typescript -import { - ElastiCacheService, - BaseElastiCacheServiceLayer, - DefaultElastiCacheClientConfigLayer, - ElastiCacheClientInstance, - ElastiCacheClientInstanceConfig, -} from "@effect-aws/client-elasticache"; - -const program = ElastiCacheService.listTagsForResource(args); - -const ElastiCacheClientInstanceLayer = Layer.provide( - Layer.effect( - ElastiCacheClientInstance, - ElastiCacheClientInstanceConfig.pipe( - Effect.map( - (config) => - new ElastiCacheClient({ ...config, region: "eu-central-1" }), - ), - ), - ), - DefaultElastiCacheClientConfigLayer, -); +import { ElastiCache } from "@effect-aws/client-elasticache"; + +const program = ElastiCache.listTagsForResource(args); const result = await pipe( program, - Effect.provide(BaseElastiCacheServiceLayer), - Effect.provide(ElastiCacheClientInstanceLayer), + Effect.provide(ElastiCache.layer({ region: "eu-central-1" })), Effect.runPromiseExit, ); ``` -or map over `DefaultElastiCacheClientConfigLayer` layer context and update the configuration... +or use `ElastiCache.baseLayer((default) => new ElastiCacheClient({ ...default, region: "eu-central-1" }))` diff --git a/packages/client-elasticache/src/ElastiCacheService.ts b/packages/client-elasticache/src/ElastiCacheService.ts index cbca97e..e98ecf2 100644 --- a/packages/client-elasticache/src/ElastiCacheService.ts +++ b/packages/client-elasticache/src/ElastiCacheService.ts @@ -3,6 +3,8 @@ */ import { ElastiCacheServiceException, + type ElastiCacheClient, + type ElastiCacheClientConfig, AddTagsToResourceCommand, type AddTagsToResourceCommandInput, type AddTagsToResourceCommandOutput, @@ -234,7 +236,11 @@ import { ElastiCacheClientInstance, ElastiCacheClientInstanceLayer, } from "./ElastiCacheClientInstance"; -import { DefaultElastiCacheClientConfigLayer } from "./ElastiCacheClientInstanceConfig"; +import { + DefaultElastiCacheClientConfigLayer, + makeDefaultElastiCacheClientInstanceConfig, + ElastiCacheClientInstanceConfig, +} from "./ElastiCacheClientInstanceConfig"; import { AllServiceErrors, APICallRateForCustomerExceededFaultError, @@ -318,7 +324,7 @@ import { } from "./Errors"; /** - * @since 1.3.1 + * @since 1.0.0 */ export interface HttpHandlerOptions { /** @@ -1650,14 +1656,6 @@ interface ElastiCacheService$ { >; } -/** - * @since 1.0.0 - * @category models - */ -export class ElastiCacheService extends Effect.Tag( - "@effect-aws/client-elasticache/ElastiCacheService", -)() {} - /** * @since 1.0.0 * @category constructors @@ -1708,9 +1706,56 @@ export const makeElastiCacheService = Effect.gen(function* (_) { }, {}) as ElastiCacheService$; }); +/** + * @since 1.0.0 + * @category models + */ +export class ElastiCacheService extends Effect.Tag( + "@effect-aws/client-elasticache/ElastiCacheService", +)() { + static readonly defaultLayer = Layer.effect( + this, + makeElastiCacheService, + ).pipe( + Layer.provide(ElastiCacheClientInstanceLayer), + Layer.provide(DefaultElastiCacheClientConfigLayer), + ); + static readonly layer = (config: ElastiCacheClientConfig) => + Layer.effect(this, makeElastiCacheService).pipe( + Layer.provide(ElastiCacheClientInstanceLayer), + Layer.provide( + Layer.effect( + ElastiCacheClientInstanceConfig, + makeDefaultElastiCacheClientInstanceConfig.pipe( + Effect.map((defaultConfig) => ({ ...defaultConfig, ...config })), + ), + ), + ), + ); + static readonly baseLayer = ( + evaluate: (defaultConfig: ElastiCacheClientConfig) => ElastiCacheClient, + ) => + Layer.effect(this, makeElastiCacheService).pipe( + Layer.provide( + Layer.effect( + ElastiCacheClientInstance, + Effect.map(makeDefaultElastiCacheClientInstanceConfig, evaluate), + ), + ), + ); +} + +/** + * @since 1.0.0 + * @category models + * @alias ElastiCacheService + */ +export const ElastiCache = ElastiCacheService; + /** * @since 1.0.0 * @category layers + * @deprecated use ElastiCache.baseLayer instead */ export const BaseElastiCacheServiceLayer = Layer.effect( ElastiCacheService, @@ -1720,6 +1765,7 @@ export const BaseElastiCacheServiceLayer = Layer.effect( /** * @since 1.0.0 * @category layers + * @deprecated use ElastiCache.layer instead */ export const ElastiCacheServiceLayer = BaseElastiCacheServiceLayer.pipe( Layer.provide(ElastiCacheClientInstanceLayer), @@ -1728,7 +1774,6 @@ export const ElastiCacheServiceLayer = BaseElastiCacheServiceLayer.pipe( /** * @since 1.0.0 * @category layers + * @deprecated use ElastiCache.defaultLayer instead */ -export const DefaultElastiCacheServiceLayer = ElastiCacheServiceLayer.pipe( - Layer.provide(DefaultElastiCacheClientConfigLayer), -); +export const DefaultElastiCacheServiceLayer = ElastiCacheService.defaultLayer; diff --git a/packages/client-elasticache/test/ElastiCache.test.ts b/packages/client-elasticache/test/ElastiCache.test.ts index f9f1057..0f3be54 100644 --- a/packages/client-elasticache/test/ElastiCache.test.ts +++ b/packages/client-elasticache/test/ElastiCache.test.ts @@ -4,39 +4,41 @@ import { ElastiCacheClient, ElastiCacheServiceException, } from "@aws-sdk/client-elasticache"; +// @ts-ignore +import * as runtimeConfig from "@aws-sdk/client-elasticache/dist-cjs/runtimeConfig"; import { mockClient } from "aws-sdk-client-mock"; import * as Effect from "effect/Effect"; import * as Exit from "effect/Exit"; import { pipe } from "effect/Function"; -import * as Layer from "effect/Layer"; -import { - BaseElastiCacheServiceLayer, - DefaultElastiCacheClientConfigLayer, - DefaultElastiCacheServiceLayer, - ElastiCacheClientInstance, - ElastiCacheClientInstanceConfig, - ElastiCacheService, - ElastiCacheServiceLayer, - SdkError, -} from "../src"; +import { afterEach, describe, expect, it, vi } from "vitest"; +import { ElastiCache, SdkError } from "../src"; +const getRuntimeConfig = vi.spyOn(runtimeConfig, "getRuntimeConfig"); const clientMock = mockClient(ElastiCacheClient); describe("ElastiCacheClientImpl", () => { + afterEach(() => { + getRuntimeConfig.mockClear(); + }); + it("default", async () => { clientMock.reset().on(ListTagsForResourceCommand).resolves({}); const args: ListTagsForResourceCommandInput = { ResourceName: "test" }; - const program = ElastiCacheService.listTagsForResource(args); + const program = ElastiCache.listTagsForResource(args); const result = await pipe( program, - Effect.provide(DefaultElastiCacheServiceLayer), + Effect.provide(ElastiCache.defaultLayer), Effect.runPromiseExit, ); expect(result).toEqual(Exit.succeed({})); + expect(getRuntimeConfig).toHaveBeenCalledTimes(1); + expect(getRuntimeConfig).toHaveBeenCalledWith({ + logger: expect.any(Object), + }); expect(clientMock).toHaveReceivedCommandTimes( ListTagsForResourceCommand, 1, @@ -52,25 +54,20 @@ describe("ElastiCacheClientImpl", () => { const args: ListTagsForResourceCommandInput = { ResourceName: "test" }; - const program = ElastiCacheService.listTagsForResource(args); - - const ElastiCacheClientConfigLayer = Layer.succeed( - ElastiCacheClientInstanceConfig, - { - region: "eu-central-1", - }, - ); - const CustomElastiCacheServiceLayer = ElastiCacheServiceLayer.pipe( - Layer.provide(ElastiCacheClientConfigLayer), - ); + const program = ElastiCache.listTagsForResource(args); const result = await pipe( program, - Effect.provide(CustomElastiCacheServiceLayer), + Effect.provide(ElastiCache.layer({ region: "eu-central-1" })), Effect.runPromiseExit, ); expect(result).toEqual(Exit.succeed({})); + expect(getRuntimeConfig).toHaveBeenCalledTimes(1); + expect(getRuntimeConfig).toHaveBeenCalledWith({ + region: "eu-central-1", + logger: expect.any(Object), + }); expect(clientMock).toHaveReceivedCommandTimes( ListTagsForResourceCommand, 1, @@ -86,23 +83,23 @@ describe("ElastiCacheClientImpl", () => { const args: ListTagsForResourceCommandInput = { ResourceName: "test" }; - const program = ElastiCacheService.listTagsForResource(args); - - const ElastiCacheClientInstanceLayer = Layer.succeed( - ElastiCacheClientInstance, - new ElastiCacheClient({ region: "eu-central-1" }), - ); - const CustomElastiCacheServiceLayer = BaseElastiCacheServiceLayer.pipe( - Layer.provide(ElastiCacheClientInstanceLayer), - ); + const program = ElastiCache.listTagsForResource(args); const result = await pipe( program, - Effect.provide(CustomElastiCacheServiceLayer), + Effect.provide( + ElastiCache.baseLayer( + () => new ElastiCacheClient({ region: "eu-central-1" }), + ), + ), Effect.runPromiseExit, ); expect(result).toEqual(Exit.succeed({})); + expect(getRuntimeConfig).toHaveBeenCalledTimes(1); + expect(getRuntimeConfig).toHaveBeenCalledWith({ + region: "eu-central-1", + }); expect(clientMock).toHaveReceivedCommandTimes( ListTagsForResourceCommand, 1, @@ -118,28 +115,25 @@ describe("ElastiCacheClientImpl", () => { const args: ListTagsForResourceCommandInput = { ResourceName: "test" }; - const program = ElastiCacheService.listTagsForResource(args); - - const ElastiCacheClientInstanceLayer = Layer.effect( - ElastiCacheClientInstance, - Effect.map( - ElastiCacheClientInstanceConfig, - (config) => - new ElastiCacheClient({ ...config, region: "eu-central-1" }), - ), - ); - const CustomElastiCacheServiceLayer = BaseElastiCacheServiceLayer.pipe( - Layer.provide(ElastiCacheClientInstanceLayer), - Layer.provide(DefaultElastiCacheClientConfigLayer), - ); + const program = ElastiCache.listTagsForResource(args); const result = await pipe( program, - Effect.provide(CustomElastiCacheServiceLayer), + Effect.provide( + ElastiCache.baseLayer( + (config) => + new ElastiCacheClient({ ...config, region: "eu-central-1" }), + ), + ), Effect.runPromiseExit, ); expect(result).toEqual(Exit.succeed({})); + expect(getRuntimeConfig).toHaveBeenCalledTimes(1); + expect(getRuntimeConfig).toHaveBeenCalledWith({ + region: "eu-central-1", + logger: expect.any(Object), + }); expect(clientMock).toHaveReceivedCommandTimes( ListTagsForResourceCommand, 1, @@ -158,11 +152,11 @@ describe("ElastiCacheClientImpl", () => { const args: ListTagsForResourceCommandInput = { ResourceName: "test" }; - const program = ElastiCacheService.listTagsForResource(args); + const program = ElastiCache.listTagsForResource(args); const result = await pipe( program, - Effect.provide(DefaultElastiCacheServiceLayer), + Effect.provide(ElastiCache.defaultLayer), Effect.runPromiseExit, ); @@ -199,13 +193,13 @@ describe("ElastiCacheClientImpl", () => { const args: ListTagsForResourceCommandInput = { ResourceName: "test" }; - const program = ElastiCacheService.listTagsForResource(args).pipe( + const program = ElastiCache.listTagsForResource(args).pipe( Effect.catchTag("NotHandledException" as any, () => Effect.succeed(null)), ); const result = await pipe( program, - Effect.provide(DefaultElastiCacheServiceLayer), + Effect.provide(ElastiCache.defaultLayer), Effect.runPromiseExit, ); diff --git a/packages/client-eventbridge/README.md b/packages/client-eventbridge/README.md index 04abf76..4b18e35 100644 --- a/packages/client-eventbridge/README.md +++ b/packages/client-eventbridge/README.md @@ -14,16 +14,13 @@ npm install --save @effect-aws/client-eventbridge With default EventBridgeClient instance: ```typescript -import { - EventBridgeService, - DefaultEventBridgeServiceLayer, -} from "@effect-aws/client-eventbridge"; +import { EventBridge } from "@effect-aws/client-eventbridge"; -const program = EventBridgeService.putEvents(args); +const program = EventBridge.putEvents(args); const result = pipe( program, - Effect.provide(DefaultEventBridgeServiceLayer), + Effect.provide(EventBridge.defaultLayer), Effect.runPromise, ); ``` @@ -31,23 +28,15 @@ const result = pipe( With custom EventBridgeClient instance: ```typescript -import { - EventBridgeService, - BaseEventBridgeServiceLayer, - EventBridgeClientInstance, -} from "@effect-aws/client-eventbridge"; +import { EventBridge } from "@effect-aws/client-eventbridge"; -const program = EventBridgeService.putEvents(args); - -const EventBridgeClientInstanceLayer = Layer.succeed( - EventBridgeClientInstance, - new EventBridgeClient({ region: "eu-central-1" }), -); +const program = EventBridge.putEvents(args); const result = await pipe( program, - Effect.provide(BaseEventBridgeServiceLayer), - Effect.provide(EventBridgeClientInstanceLayer), + Effect.provide( + EventBridge.baseLayer(() => new EventBridgeClient({ region: "eu-central-1" })), + ), Effect.runPromise, ); ``` @@ -55,35 +44,15 @@ const result = await pipe( With custom EventBridgeClient configuration: ```typescript -import { - EventBridgeService, - BaseEventBridgeServiceLayer, - DefaultEventBridgeClientConfigLayer, - EventBridgeClientInstance, - EventBridgeClientInstanceConfig, -} from "@effect-aws/client-eventbridge"; - -const program = EventBridgeService.putEvents(args); - -const EventBridgeClientInstanceLayer = Layer.provide( - Layer.effect( - EventBridgeClientInstance, - EventBridgeClientInstanceConfig.pipe( - Effect.map( - (config) => - new EventBridgeClient({ ...config, region: "eu-central-1" }), - ), - ), - ), - DefaultEventBridgeClientConfigLayer, -); +import { EventBridge } from "@effect-aws/client-eventbridge"; + +const program = EventBridge.putEvents(args); const result = await pipe( program, - Effect.provide(BaseEventBridgeServiceLayer), - Effect.provide(EventBridgeClientInstanceLayer), + Effect.provide(EventBridge.layer({ region: "eu-central-1" })), Effect.runPromiseExit, ); ``` -or map over `DefaultEventBridgeClientConfigLayer` layer context and update the configuration... +or use `EventBridge.baseLayer((default) => new EventBridgeClient({ ...default, region: "eu-central-1" }))` diff --git a/packages/client-eventbridge/src/EventBridgeService.ts b/packages/client-eventbridge/src/EventBridgeService.ts index 90a4db3..ed630d4 100644 --- a/packages/client-eventbridge/src/EventBridgeService.ts +++ b/packages/client-eventbridge/src/EventBridgeService.ts @@ -3,6 +3,8 @@ */ import { EventBridgeServiceException, + type EventBridgeClient, + type EventBridgeClientConfig, ActivateEventSourceCommand, type ActivateEventSourceCommandInput, type ActivateEventSourceCommandOutput, @@ -196,10 +198,14 @@ import { EventBridgeClientInstance, EventBridgeClientInstanceLayer, } from "./EventBridgeClientInstance"; -import { DefaultEventBridgeClientConfigLayer } from "./EventBridgeClientInstanceConfig"; +import { + DefaultEventBridgeClientConfigLayer, + makeDefaultEventBridgeClientInstanceConfig, + EventBridgeClientInstanceConfig, +} from "./EventBridgeClientInstanceConfig"; /** - * @since 1.5.1 + * @since 1.0.0 */ export interface HttpHandlerOptions { /** @@ -1008,14 +1014,6 @@ interface EventBridgeService$ { >; } -/** - * @since 1.0.0 - * @category models - */ -export class EventBridgeService extends Effect.Tag( - "@effect-aws/client-eventbridge/EventBridgeService", -)() {} - /** * @since 1.0.0 * @category constructors @@ -1066,9 +1064,56 @@ export const makeEventBridgeService = Effect.gen(function* (_) { }, {}) as EventBridgeService$; }); +/** + * @since 1.0.0 + * @category models + */ +export class EventBridgeService extends Effect.Tag( + "@effect-aws/client-eventbridge/EventBridgeService", +)() { + static readonly defaultLayer = Layer.effect( + this, + makeEventBridgeService, + ).pipe( + Layer.provide(EventBridgeClientInstanceLayer), + Layer.provide(DefaultEventBridgeClientConfigLayer), + ); + static readonly layer = (config: EventBridgeClientConfig) => + Layer.effect(this, makeEventBridgeService).pipe( + Layer.provide(EventBridgeClientInstanceLayer), + Layer.provide( + Layer.effect( + EventBridgeClientInstanceConfig, + makeDefaultEventBridgeClientInstanceConfig.pipe( + Effect.map((defaultConfig) => ({ ...defaultConfig, ...config })), + ), + ), + ), + ); + static readonly baseLayer = ( + evaluate: (defaultConfig: EventBridgeClientConfig) => EventBridgeClient, + ) => + Layer.effect(this, makeEventBridgeService).pipe( + Layer.provide( + Layer.effect( + EventBridgeClientInstance, + Effect.map(makeDefaultEventBridgeClientInstanceConfig, evaluate), + ), + ), + ); +} + +/** + * @since 1.0.0 + * @category models + * @alias EventBridgeService + */ +export const EventBridge = EventBridgeService; + /** * @since 1.0.0 * @category layers + * @deprecated use EventBridge.baseLayer instead */ export const BaseEventBridgeServiceLayer = Layer.effect( EventBridgeService, @@ -1078,6 +1123,7 @@ export const BaseEventBridgeServiceLayer = Layer.effect( /** * @since 1.0.0 * @category layers + * @deprecated use EventBridge.layer instead */ export const EventBridgeServiceLayer = BaseEventBridgeServiceLayer.pipe( Layer.provide(EventBridgeClientInstanceLayer), @@ -1086,7 +1132,6 @@ export const EventBridgeServiceLayer = BaseEventBridgeServiceLayer.pipe( /** * @since 1.0.0 * @category layers + * @deprecated use EventBridge.defaultLayer instead */ -export const DefaultEventBridgeServiceLayer = EventBridgeServiceLayer.pipe( - Layer.provide(DefaultEventBridgeClientConfigLayer), -); +export const DefaultEventBridgeServiceLayer = EventBridgeService.defaultLayer; diff --git a/packages/client-eventbridge/test/EventBridge.test.ts b/packages/client-eventbridge/test/EventBridge.test.ts index eee793a..8260e17 100644 --- a/packages/client-eventbridge/test/EventBridge.test.ts +++ b/packages/client-eventbridge/test/EventBridge.test.ts @@ -4,39 +4,41 @@ import { EventBridgeClient, EventBridgeServiceException, } from "@aws-sdk/client-eventbridge"; +// @ts-ignore +import * as runtimeConfig from "@aws-sdk/client-eventbridge/dist-cjs/runtimeConfig"; import { mockClient } from "aws-sdk-client-mock"; import * as Effect from "effect/Effect"; import * as Exit from "effect/Exit"; import { pipe } from "effect/Function"; -import * as Layer from "effect/Layer"; -import { - BaseEventBridgeServiceLayer, - DefaultEventBridgeClientConfigLayer, - DefaultEventBridgeServiceLayer, - EventBridgeClientInstance, - EventBridgeClientInstanceConfig, - EventBridgeService, - EventBridgeServiceLayer, - SdkError, -} from "../src"; +import { afterEach, describe, expect, it, vi } from "vitest"; +import { EventBridge, SdkError } from "../src"; +const getRuntimeConfig = vi.spyOn(runtimeConfig, "getRuntimeConfig"); const clientMock = mockClient(EventBridgeClient); describe("EventBridgeClientImpl", () => { + afterEach(() => { + getRuntimeConfig.mockClear(); + }); + it("default", async () => { clientMock.reset().on(PutEventsCommand).resolves({}); const args: PutEventsCommandInput = { Entries: [{ Detail: "test" }] }; - const program = EventBridgeService.putEvents(args); + const program = EventBridge.putEvents(args); const result = await pipe( program, - Effect.provide(DefaultEventBridgeServiceLayer), + Effect.provide(EventBridge.defaultLayer), Effect.runPromiseExit, ); expect(result).toEqual(Exit.succeed({})); + expect(getRuntimeConfig).toHaveBeenCalledTimes(1); + expect(getRuntimeConfig).toHaveBeenCalledWith({ + logger: expect.any(Object), + }); expect(clientMock).toHaveReceivedCommandTimes(PutEventsCommand, 1); expect(clientMock).toHaveReceivedCommandWith(PutEventsCommand, args); }); @@ -46,25 +48,20 @@ describe("EventBridgeClientImpl", () => { const args: PutEventsCommandInput = { Entries: [{ Detail: "test" }] }; - const program = EventBridgeService.putEvents(args); - - const EventBridgeClientConfigLayer = Layer.succeed( - EventBridgeClientInstanceConfig, - { - region: "eu-central-1", - }, - ); - const CustomEventBridgeServiceLayer = EventBridgeServiceLayer.pipe( - Layer.provide(EventBridgeClientConfigLayer), - ); + const program = EventBridge.putEvents(args); const result = await pipe( program, - Effect.provide(CustomEventBridgeServiceLayer), + Effect.provide(EventBridge.layer({ region: "eu-central-1" })), Effect.runPromiseExit, ); expect(result).toEqual(Exit.succeed({})); + expect(getRuntimeConfig).toHaveBeenCalledTimes(1); + expect(getRuntimeConfig).toHaveBeenCalledWith({ + region: "eu-central-1", + logger: expect.any(Object), + }); expect(clientMock).toHaveReceivedCommandTimes(PutEventsCommand, 1); expect(clientMock).toHaveReceivedCommandWith(PutEventsCommand, args); }); @@ -74,23 +71,23 @@ describe("EventBridgeClientImpl", () => { const args: PutEventsCommandInput = { Entries: [{ Detail: "test" }] }; - const program = EventBridgeService.putEvents(args); - - const EventBridgeClientInstanceLayer = Layer.succeed( - EventBridgeClientInstance, - new EventBridgeClient({ region: "eu-central-1" }), - ); - const CustomEventBridgeServiceLayer = BaseEventBridgeServiceLayer.pipe( - Layer.provide(EventBridgeClientInstanceLayer), - ); + const program = EventBridge.putEvents(args); const result = await pipe( program, - Effect.provide(CustomEventBridgeServiceLayer), + Effect.provide( + EventBridge.baseLayer( + () => new EventBridgeClient({ region: "eu-central-1" }), + ), + ), Effect.runPromiseExit, ); expect(result).toEqual(Exit.succeed({})); + expect(getRuntimeConfig).toHaveBeenCalledTimes(1); + expect(getRuntimeConfig).toHaveBeenCalledWith({ + region: "eu-central-1", + }); expect(clientMock).toHaveReceivedCommandTimes(PutEventsCommand, 1); expect(clientMock).toHaveReceivedCommandWith(PutEventsCommand, args); }); @@ -100,28 +97,25 @@ describe("EventBridgeClientImpl", () => { const args: PutEventsCommandInput = { Entries: [{ Detail: "test" }] }; - const program = EventBridgeService.putEvents(args); - - const EventBridgeClientInstanceLayer = Layer.effect( - EventBridgeClientInstance, - Effect.map( - EventBridgeClientInstanceConfig, - (config) => - new EventBridgeClient({ ...config, region: "eu-central-1" }), - ), - ); - const CustomEventBridgeServiceLayer = BaseEventBridgeServiceLayer.pipe( - Layer.provide(EventBridgeClientInstanceLayer), - Layer.provide(DefaultEventBridgeClientConfigLayer), - ); + const program = EventBridge.putEvents(args); const result = await pipe( program, - Effect.provide(CustomEventBridgeServiceLayer), + Effect.provide( + EventBridge.baseLayer( + (config) => + new EventBridgeClient({ ...config, region: "eu-central-1" }), + ), + ), Effect.runPromiseExit, ); expect(result).toEqual(Exit.succeed({})); + expect(getRuntimeConfig).toHaveBeenCalledTimes(1); + expect(getRuntimeConfig).toHaveBeenCalledWith({ + region: "eu-central-1", + logger: expect.any(Object), + }); expect(clientMock).toHaveReceivedCommandTimes(PutEventsCommand, 1); expect(clientMock).toHaveReceivedCommandWith(PutEventsCommand, args); }); @@ -131,11 +125,11 @@ describe("EventBridgeClientImpl", () => { const args: PutEventsCommandInput = { Entries: [{ Detail: "test" }] }; - const program = EventBridgeService.putEvents(args); + const program = EventBridge.putEvents(args); const result = await pipe( program, - Effect.provide(DefaultEventBridgeServiceLayer), + Effect.provide(EventBridge.defaultLayer), Effect.runPromiseExit, ); @@ -166,13 +160,13 @@ describe("EventBridgeClientImpl", () => { const args: PutEventsCommandInput = { Entries: [{ Detail: "test" }] }; - const program = EventBridgeService.putEvents(args).pipe( + const program = EventBridge.putEvents(args).pipe( Effect.catchTag("NotHandledException" as any, () => Effect.succeed(null)), ); const result = await pipe( program, - Effect.provide(DefaultEventBridgeServiceLayer), + Effect.provide(EventBridge.defaultLayer), Effect.runPromiseExit, ); diff --git a/packages/client-iam/README.md b/packages/client-iam/README.md index ed2ccb8..0db9b05 100644 --- a/packages/client-iam/README.md +++ b/packages/client-iam/README.md @@ -14,13 +14,13 @@ npm install --save @effect-aws/client-iam With default IAMClient instance: ```typescript -import { IAMService, DefaultIAMServiceLayer } from "@effect-aws/client-iam"; +import { IAM } from "@effect-aws/client-iam"; -const program = IAMService.createRole(args); +const program = IAM.createRole(args); const result = pipe( program, - Effect.provide(DefaultIAMServiceLayer), + Effect.provide(IAM.defaultLayer), Effect.runPromise, ); ``` @@ -28,23 +28,15 @@ const result = pipe( With custom IAMClient instance: ```typescript -import { - IAMService, - BaseIAMServiceLayer, - IAMClientInstance, -} from "@effect-aws/client-iam"; +import { IAM } from "@effect-aws/client-iam"; -const program = IAMService.createRole(args); - -const IAMClientInstanceLayer = Layer.succeed( - IAMClientInstance, - new IAMClient({ region: "eu-central-1" }), -); +const program = IAM.createRole(args); const result = await pipe( program, - Effect.provide(BaseIAMServiceLayer), - Effect.provide(IAMClientInstanceLayer), + Effect.provide( + IAM.baseLayer(() => new IAMClient({ region: "eu-central-1" })), + ), Effect.runPromise, ); ``` @@ -52,34 +44,15 @@ const result = await pipe( With custom IAMClient configuration: ```typescript -import { - IAMService, - BaseIAMServiceLayer, - DefaultIAMClientConfigLayer, - IAMClientInstance, - IAMClientInstanceConfig, -} from "@effect-aws/client-iam"; - -const program = IAMService.createRole(args); - -const IAMClientInstanceLayer = Layer.provide( - Layer.effect( - IAMClientInstance, - IAMClientInstanceConfig.pipe( - Effect.map( - (config) => new IAMClient({ ...config, region: "eu-central-1" }), - ), - ), - ), - DefaultIAMClientConfigLayer, -); +import { IAM } from "@effect-aws/client-iam"; + +const program = IAM.createRole(args); const result = await pipe( program, - Effect.provide(BaseIAMServiceLayer), - Effect.provide(IAMClientInstanceLayer), + Effect.provide(IAM.layer({ region: "eu-central-1" })), Effect.runPromiseExit, ); ``` -or map over `DefaultIAMClientConfigLayer` layer context and update the configuration... +or use `IAM.baseLayer((default) => new IAMClient({ ...default, region: "eu-central-1" }))` diff --git a/packages/client-iam/src/IAMService.ts b/packages/client-iam/src/IAMService.ts index 8a56c51..7c29dc9 100644 --- a/packages/client-iam/src/IAMService.ts +++ b/packages/client-iam/src/IAMService.ts @@ -3,6 +3,8 @@ */ import { IAMServiceException, + type IAMClient, + type IAMClientConfig, AddClientIDToOpenIDConnectProviderCommand, type AddClientIDToOpenIDConnectProviderCommandInput, type AddClientIDToOpenIDConnectProviderCommandOutput, @@ -516,10 +518,14 @@ import { TaggedException, } from "./Errors"; import { IAMClientInstance, IAMClientInstanceLayer } from "./IAMClientInstance"; -import { DefaultIAMClientConfigLayer } from "./IAMClientInstanceConfig"; +import { + DefaultIAMClientConfigLayer, + makeDefaultIAMClientInstanceConfig, + IAMClientInstanceConfig, +} from "./IAMClientInstanceConfig"; /** - * @since 1.4.1 + * @since 1.0.0 */ export interface HttpHandlerOptions { /** @@ -2762,15 +2768,6 @@ interface IAMService$ { >; } -/** - * @since 1.0.0 - * @category models - */ -export class IAMService extends Effect.Tag("@effect-aws/client-iam/IAMService")< - IAMService, - IAMService$ ->() {} - /** * @since 1.0.0 * @category constructors @@ -2821,15 +2818,61 @@ export const makeIAMService = Effect.gen(function* (_) { }, {}) as IAMService$; }); +/** + * @since 1.0.0 + * @category models + */ +export class IAMService extends Effect.Tag("@effect-aws/client-iam/IAMService")< + IAMService, + IAMService$ +>() { + static readonly defaultLayer = Layer.effect(this, makeIAMService).pipe( + Layer.provide(IAMClientInstanceLayer), + Layer.provide(DefaultIAMClientConfigLayer), + ); + static readonly layer = (config: IAMClientConfig) => + Layer.effect(this, makeIAMService).pipe( + Layer.provide(IAMClientInstanceLayer), + Layer.provide( + Layer.effect( + IAMClientInstanceConfig, + makeDefaultIAMClientInstanceConfig.pipe( + Effect.map((defaultConfig) => ({ ...defaultConfig, ...config })), + ), + ), + ), + ); + static readonly baseLayer = ( + evaluate: (defaultConfig: IAMClientConfig) => IAMClient, + ) => + Layer.effect(this, makeIAMService).pipe( + Layer.provide( + Layer.effect( + IAMClientInstance, + Effect.map(makeDefaultIAMClientInstanceConfig, evaluate), + ), + ), + ); +} + +/** + * @since 1.0.0 + * @category models + * @alias IAMService + */ +export const IAM = IAMService; + /** * @since 1.0.0 * @category layers + * @deprecated use IAM.baseLayer instead */ export const BaseIAMServiceLayer = Layer.effect(IAMService, makeIAMService); /** * @since 1.0.0 * @category layers + * @deprecated use IAM.layer instead */ export const IAMServiceLayer = BaseIAMServiceLayer.pipe( Layer.provide(IAMClientInstanceLayer), @@ -2838,7 +2881,6 @@ export const IAMServiceLayer = BaseIAMServiceLayer.pipe( /** * @since 1.0.0 * @category layers + * @deprecated use IAM.defaultLayer instead */ -export const DefaultIAMServiceLayer = IAMServiceLayer.pipe( - Layer.provide(DefaultIAMClientConfigLayer), -); +export const DefaultIAMServiceLayer = IAMService.defaultLayer; diff --git a/packages/client-iam/test/IAM.test.ts b/packages/client-iam/test/IAM.test.ts index 394ff56..7bb3c94 100644 --- a/packages/client-iam/test/IAM.test.ts +++ b/packages/client-iam/test/IAM.test.ts @@ -4,39 +4,41 @@ import { IAMClient, IAMServiceException, } from "@aws-sdk/client-iam"; +// @ts-ignore +import * as runtimeConfig from "@aws-sdk/client-iam/dist-cjs/runtimeConfig"; import { mockClient } from "aws-sdk-client-mock"; import * as Effect from "effect/Effect"; import * as Exit from "effect/Exit"; import { pipe } from "effect/Function"; -import * as Layer from "effect/Layer"; -import { - BaseIAMServiceLayer, - DefaultIAMClientConfigLayer, - DefaultIAMServiceLayer, - IAMClientInstance, - IAMClientInstanceConfig, - IAMService, - IAMServiceLayer, - SdkError, -} from "../src"; +import { afterEach, describe, expect, it, vi } from "vitest"; +import { IAM, SdkError } from "../src"; +const getRuntimeConfig = vi.spyOn(runtimeConfig, "getRuntimeConfig"); const clientMock = mockClient(IAMClient); describe("IAMClientImpl", () => { + afterEach(() => { + getRuntimeConfig.mockClear(); + }); + it("default", async () => { clientMock.reset().on(CreateRoleCommand).resolves({}); const args = {} as unknown as CreateRoleCommandInput; - const program = IAMService.createRole(args); + const program = IAM.createRole(args); const result = await pipe( program, - Effect.provide(DefaultIAMServiceLayer), + Effect.provide(IAM.defaultLayer), Effect.runPromiseExit, ); expect(result).toEqual(Exit.succeed({})); + expect(getRuntimeConfig).toHaveBeenCalledTimes(1); + expect(getRuntimeConfig).toHaveBeenCalledWith({ + logger: expect.any(Object), + }); expect(clientMock).toHaveReceivedCommandTimes(CreateRoleCommand, 1); expect(clientMock).toHaveReceivedCommandWith(CreateRoleCommand, args); }); @@ -46,22 +48,20 @@ describe("IAMClientImpl", () => { const args = {} as unknown as CreateRoleCommandInput; - const program = IAMService.createRole(args); - - const IAMClientConfigLayer = Layer.succeed(IAMClientInstanceConfig, { - region: "eu-central-1", - }); - const CustomIAMServiceLayer = IAMServiceLayer.pipe( - Layer.provide(IAMClientConfigLayer), - ); + const program = IAM.createRole(args); const result = await pipe( program, - Effect.provide(CustomIAMServiceLayer), + Effect.provide(IAM.layer({ region: "eu-central-1" })), Effect.runPromiseExit, ); expect(result).toEqual(Exit.succeed({})); + expect(getRuntimeConfig).toHaveBeenCalledTimes(1); + expect(getRuntimeConfig).toHaveBeenCalledWith({ + region: "eu-central-1", + logger: expect.any(Object), + }); expect(clientMock).toHaveReceivedCommandTimes(CreateRoleCommand, 1); expect(clientMock).toHaveReceivedCommandWith(CreateRoleCommand, args); }); @@ -71,23 +71,21 @@ describe("IAMClientImpl", () => { const args = {} as unknown as CreateRoleCommandInput; - const program = IAMService.createRole(args); - - const IAMClientInstanceLayer = Layer.succeed( - IAMClientInstance, - new IAMClient({ region: "eu-central-1" }), - ); - const CustomIAMServiceLayer = BaseIAMServiceLayer.pipe( - Layer.provide(IAMClientInstanceLayer), - ); + const program = IAM.createRole(args); const result = await pipe( program, - Effect.provide(CustomIAMServiceLayer), + Effect.provide( + IAM.baseLayer(() => new IAMClient({ region: "eu-central-1" })), + ), Effect.runPromiseExit, ); expect(result).toEqual(Exit.succeed({})); + expect(getRuntimeConfig).toHaveBeenCalledTimes(1); + expect(getRuntimeConfig).toHaveBeenCalledWith({ + region: "eu-central-1", + }); expect(clientMock).toHaveReceivedCommandTimes(CreateRoleCommand, 1); expect(clientMock).toHaveReceivedCommandWith(CreateRoleCommand, args); }); @@ -97,27 +95,24 @@ describe("IAMClientImpl", () => { const args = {} as unknown as CreateRoleCommandInput; - const program = IAMService.createRole(args); - - const IAMClientInstanceLayer = Layer.effect( - IAMClientInstance, - Effect.map( - IAMClientInstanceConfig, - (config) => new IAMClient({ ...config, region: "eu-central-1" }), - ), - ); - const CustomIAMServiceLayer = BaseIAMServiceLayer.pipe( - Layer.provide(IAMClientInstanceLayer), - Layer.provide(DefaultIAMClientConfigLayer), - ); + const program = IAM.createRole(args); const result = await pipe( program, - Effect.provide(CustomIAMServiceLayer), + Effect.provide( + IAM.baseLayer( + (config) => new IAMClient({ ...config, region: "eu-central-1" }), + ), + ), Effect.runPromiseExit, ); expect(result).toEqual(Exit.succeed({})); + expect(getRuntimeConfig).toHaveBeenCalledTimes(1); + expect(getRuntimeConfig).toHaveBeenCalledWith({ + region: "eu-central-1", + logger: expect.any(Object), + }); expect(clientMock).toHaveReceivedCommandTimes(CreateRoleCommand, 1); expect(clientMock).toHaveReceivedCommandWith(CreateRoleCommand, args); }); @@ -127,11 +122,11 @@ describe("IAMClientImpl", () => { const args = {} as unknown as CreateRoleCommandInput; - const program = IAMService.createRole(args); + const program = IAM.createRole(args); const result = await pipe( program, - Effect.provide(DefaultIAMServiceLayer), + Effect.provide(IAM.defaultLayer), Effect.runPromiseExit, ); @@ -162,13 +157,13 @@ describe("IAMClientImpl", () => { const args = {} as unknown as CreateRoleCommandInput; - const program = IAMService.createRole(args).pipe( + const program = IAM.createRole(args).pipe( Effect.catchTag("NotHandledException" as any, () => Effect.succeed(null)), ); const result = await pipe( program, - Effect.provide(DefaultIAMServiceLayer), + Effect.provide(IAM.defaultLayer), Effect.runPromiseExit, ); diff --git a/packages/client-kinesis/README.md b/packages/client-kinesis/README.md index 532aed0..6a575c7 100644 --- a/packages/client-kinesis/README.md +++ b/packages/client-kinesis/README.md @@ -14,13 +14,13 @@ npm install --save @effect-aws/client-kinesis With default KinesisClient instance: ```typescript -import { KinesisService, DefaultKinesisServiceLayer } from "@effect-aws/client-kinesis"; +import { Kinesis } from "@effect-aws/client-kinesis"; -const program = KinesisService.putRecord(args); +const program = Kinesis.putRecord(args); const result = pipe( program, - Effect.provide(DefaultKinesisServiceLayer), + Effect.provide(Kinesis.defaultLayer), Effect.runPromise, ); ``` @@ -28,23 +28,15 @@ const result = pipe( With custom KinesisClient instance: ```typescript -import { - KinesisService, - BaseKinesisServiceLayer, - KinesisClientInstance, -} from "@effect-aws/client-kinesis"; +import { Kinesis } from "@effect-aws/client-kinesis"; -const program = KinesisService.putRecord(args); - -const KinesisClientInstanceLayer = Layer.succeed( - KinesisClientInstance, - new KinesisClient({ region: "eu-central-1" }), -); +const program = Kinesis.putRecord(args); const result = await pipe( program, - Effect.provide(BaseKinesisServiceLayer), - Effect.provide(KinesisClientInstanceLayer), + Effect.provide( + Kinesis.baseLayer(() => new KinesisClient({ region: "eu-central-1" })), + ), Effect.runPromise, ); ``` @@ -52,34 +44,15 @@ const result = await pipe( With custom KinesisClient configuration: ```typescript -import { - KinesisService, - BaseKinesisServiceLayer, - DefaultKinesisClientConfigLayer, - KinesisClientInstance, - KinesisClientInstanceConfig, -} from "@effect-aws/client-kinesis"; - -const program = KinesisService.putRecord(args); - -const KinesisClientInstanceLayer = Layer.provide( - Layer.effect( - KinesisClientInstance, - KinesisClientInstanceConfig.pipe( - Effect.map( - (config) => new KinesisClient({ ...config, region: "eu-central-1" }), - ), - ), - ), - DefaultKinesisClientConfigLayer, -); +import { Kinesis } from "@effect-aws/client-kinesis"; + +const program = Kinesis.putRecord(args); const result = await pipe( program, - Effect.provide(BaseKinesisServiceLayer), - Effect.provide(KinesisClientInstanceLayer), + Effect.provide(Kinesis.layer({ region: "eu-central-1" })), Effect.runPromiseExit, ); ``` -or map over `DefaultKinesisClientConfigLayer` layer context and update the configuration... +or use `Kinesis.baseLayer((default) => new KinesisClient({ ...default, region: "eu-central-1" }))` diff --git a/packages/client-kinesis/src/KinesisService.ts b/packages/client-kinesis/src/KinesisService.ts index 2b6be1b..debbf14 100644 --- a/packages/client-kinesis/src/KinesisService.ts +++ b/packages/client-kinesis/src/KinesisService.ts @@ -3,6 +3,8 @@ */ import { KinesisServiceException, + type KinesisClient, + type KinesisClientConfig, AddTagsToStreamCommand, type AddTagsToStreamCommandInput, type AddTagsToStreamCommandOutput, @@ -125,10 +127,14 @@ import { KinesisClientInstance, KinesisClientInstanceLayer, } from "./KinesisClientInstance"; -import { DefaultKinesisClientConfigLayer } from "./KinesisClientInstanceConfig"; +import { + DefaultKinesisClientConfigLayer, + makeDefaultKinesisClientInstanceConfig, + KinesisClientInstanceConfig, +} from "./KinesisClientInstanceConfig"; /** - * @since 1.0.1 + * @since 1.0.0 */ export interface HttpHandlerOptions { /** @@ -681,14 +687,6 @@ interface KinesisService$ { >; } -/** - * @since 1.0.0 - * @category models - */ -export class KinesisService extends Effect.Tag( - "@effect-aws/client-kinesis/KinesisService", -)() {} - /** * @since 1.0.0 * @category constructors @@ -739,9 +737,53 @@ export const makeKinesisService = Effect.gen(function* (_) { }, {}) as KinesisService$; }); +/** + * @since 1.0.0 + * @category models + */ +export class KinesisService extends Effect.Tag( + "@effect-aws/client-kinesis/KinesisService", +)() { + static readonly defaultLayer = Layer.effect(this, makeKinesisService).pipe( + Layer.provide(KinesisClientInstanceLayer), + Layer.provide(DefaultKinesisClientConfigLayer), + ); + static readonly layer = (config: KinesisClientConfig) => + Layer.effect(this, makeKinesisService).pipe( + Layer.provide(KinesisClientInstanceLayer), + Layer.provide( + Layer.effect( + KinesisClientInstanceConfig, + makeDefaultKinesisClientInstanceConfig.pipe( + Effect.map((defaultConfig) => ({ ...defaultConfig, ...config })), + ), + ), + ), + ); + static readonly baseLayer = ( + evaluate: (defaultConfig: KinesisClientConfig) => KinesisClient, + ) => + Layer.effect(this, makeKinesisService).pipe( + Layer.provide( + Layer.effect( + KinesisClientInstance, + Effect.map(makeDefaultKinesisClientInstanceConfig, evaluate), + ), + ), + ); +} + +/** + * @since 1.0.0 + * @category models + * @alias KinesisService + */ +export const Kinesis = KinesisService; + /** * @since 1.0.0 * @category layers + * @deprecated use Kinesis.baseLayer instead */ export const BaseKinesisServiceLayer = Layer.effect( KinesisService, @@ -751,6 +793,7 @@ export const BaseKinesisServiceLayer = Layer.effect( /** * @since 1.0.0 * @category layers + * @deprecated use Kinesis.layer instead */ export const KinesisServiceLayer = BaseKinesisServiceLayer.pipe( Layer.provide(KinesisClientInstanceLayer), @@ -759,7 +802,6 @@ export const KinesisServiceLayer = BaseKinesisServiceLayer.pipe( /** * @since 1.0.0 * @category layers + * @deprecated use Kinesis.defaultLayer instead */ -export const DefaultKinesisServiceLayer = KinesisServiceLayer.pipe( - Layer.provide(DefaultKinesisClientConfigLayer), -); +export const DefaultKinesisServiceLayer = KinesisService.defaultLayer; diff --git a/packages/client-kinesis/test/Kinesis.test.ts b/packages/client-kinesis/test/Kinesis.test.ts index 48a7f39..4c007f1 100644 --- a/packages/client-kinesis/test/Kinesis.test.ts +++ b/packages/client-kinesis/test/Kinesis.test.ts @@ -4,39 +4,41 @@ import { KinesisClient, KinesisServiceException, } from "@aws-sdk/client-kinesis"; +// @ts-ignore +import * as runtimeConfig from "@aws-sdk/client-kinesis/dist-cjs/runtimeConfig"; import { mockClient } from "aws-sdk-client-mock"; import * as Effect from "effect/Effect"; import * as Exit from "effect/Exit"; import { pipe } from "effect/Function"; -import * as Layer from "effect/Layer"; -import { - BaseKinesisServiceLayer, - DefaultKinesisClientConfigLayer, - DefaultKinesisServiceLayer, - KinesisClientInstance, - KinesisClientInstanceConfig, - KinesisService, - KinesisServiceLayer, - SdkError, -} from "../src"; +import { afterEach, describe, expect, it, vi } from "vitest"; +import { Kinesis, SdkError } from "../src"; +const getRuntimeConfig = vi.spyOn(runtimeConfig, "getRuntimeConfig"); const clientMock = mockClient(KinesisClient); describe("KinesisClientImpl", () => { + afterEach(() => { + getRuntimeConfig.mockClear(); + }); + it("default", async () => { clientMock.reset().on(PutRecordCommand).resolves({}); const args = {} as unknown as PutRecordCommandInput; - const program = KinesisService.putRecord(args); + const program = Kinesis.putRecord(args); const result = await pipe( program, - Effect.provide(DefaultKinesisServiceLayer), + Effect.provide(Kinesis.defaultLayer), Effect.runPromiseExit, ); expect(result).toEqual(Exit.succeed({})); + expect(getRuntimeConfig).toHaveBeenCalledTimes(1); + expect(getRuntimeConfig).toHaveBeenCalledWith({ + logger: expect.any(Object), + }); expect(clientMock).toHaveReceivedCommandTimes(PutRecordCommand, 1); expect(clientMock).toHaveReceivedCommandWith(PutRecordCommand, args); }); @@ -46,25 +48,20 @@ describe("KinesisClientImpl", () => { const args = {} as unknown as PutRecordCommandInput; - const program = KinesisService.putRecord(args); - - const KinesisClientConfigLayer = Layer.succeed( - KinesisClientInstanceConfig, - { - region: "eu-central-1", - }, - ); - const CustomKinesisServiceLayer = KinesisServiceLayer.pipe( - Layer.provide(KinesisClientConfigLayer), - ); + const program = Kinesis.putRecord(args); const result = await pipe( program, - Effect.provide(CustomKinesisServiceLayer), + Effect.provide(Kinesis.layer({ region: "eu-central-1" })), Effect.runPromiseExit, ); expect(result).toEqual(Exit.succeed({})); + expect(getRuntimeConfig).toHaveBeenCalledTimes(1); + expect(getRuntimeConfig).toHaveBeenCalledWith({ + region: "eu-central-1", + logger: expect.any(Object), + }); expect(clientMock).toHaveReceivedCommandTimes(PutRecordCommand, 1); expect(clientMock).toHaveReceivedCommandWith(PutRecordCommand, args); }); @@ -74,23 +71,21 @@ describe("KinesisClientImpl", () => { const args = {} as unknown as PutRecordCommandInput; - const program = KinesisService.putRecord(args); - - const KinesisClientInstanceLayer = Layer.succeed( - KinesisClientInstance, - new KinesisClient({ region: "eu-central-1" }), - ); - const CustomKinesisServiceLayer = BaseKinesisServiceLayer.pipe( - Layer.provide(KinesisClientInstanceLayer), - ); + const program = Kinesis.putRecord(args); const result = await pipe( program, - Effect.provide(CustomKinesisServiceLayer), + Effect.provide( + Kinesis.baseLayer(() => new KinesisClient({ region: "eu-central-1" })), + ), Effect.runPromiseExit, ); expect(result).toEqual(Exit.succeed({})); + expect(getRuntimeConfig).toHaveBeenCalledTimes(1); + expect(getRuntimeConfig).toHaveBeenCalledWith({ + region: "eu-central-1", + }); expect(clientMock).toHaveReceivedCommandTimes(PutRecordCommand, 1); expect(clientMock).toHaveReceivedCommandWith(PutRecordCommand, args); }); @@ -100,27 +95,24 @@ describe("KinesisClientImpl", () => { const args = {} as unknown as PutRecordCommandInput; - const program = KinesisService.putRecord(args); - - const KinesisClientInstanceLayer = Layer.effect( - KinesisClientInstance, - Effect.map( - KinesisClientInstanceConfig, - (config) => new KinesisClient({ ...config, region: "eu-central-1" }), - ), - ); - const CustomKinesisServiceLayer = BaseKinesisServiceLayer.pipe( - Layer.provide(KinesisClientInstanceLayer), - Layer.provide(DefaultKinesisClientConfigLayer), - ); + const program = Kinesis.putRecord(args); const result = await pipe( program, - Effect.provide(CustomKinesisServiceLayer), + Effect.provide( + Kinesis.baseLayer( + (config) => new KinesisClient({ ...config, region: "eu-central-1" }), + ), + ), Effect.runPromiseExit, ); expect(result).toEqual(Exit.succeed({})); + expect(getRuntimeConfig).toHaveBeenCalledTimes(1); + expect(getRuntimeConfig).toHaveBeenCalledWith({ + region: "eu-central-1", + logger: expect.any(Object), + }); expect(clientMock).toHaveReceivedCommandTimes(PutRecordCommand, 1); expect(clientMock).toHaveReceivedCommandWith(PutRecordCommand, args); }); @@ -130,11 +122,11 @@ describe("KinesisClientImpl", () => { const args = {} as unknown as PutRecordCommandInput; - const program = KinesisService.putRecord(args); + const program = Kinesis.putRecord(args); const result = await pipe( program, - Effect.provide(DefaultKinesisServiceLayer), + Effect.provide(Kinesis.defaultLayer), Effect.runPromiseExit, ); @@ -165,13 +157,13 @@ describe("KinesisClientImpl", () => { const args = {} as unknown as PutRecordCommandInput; - const program = KinesisService.putRecord(args).pipe( + const program = Kinesis.putRecord(args).pipe( Effect.catchTag("NotHandledException" as any, () => Effect.succeed(null)), ); const result = await pipe( program, - Effect.provide(DefaultKinesisServiceLayer), + Effect.provide(Kinesis.defaultLayer), Effect.runPromiseExit, ); diff --git a/packages/client-kms/README.md b/packages/client-kms/README.md index 2b20ce4..af3d469 100644 --- a/packages/client-kms/README.md +++ b/packages/client-kms/README.md @@ -14,13 +14,13 @@ npm install --save @effect-aws/client-kms With default KMSClient instance: ```typescript -import { KMSService, DefaultKMSServiceLayer } from "@effect-aws/client-kms"; +import { KMS } from "@effect-aws/client-kms"; -const program = KMSService.listKeys(args); +const program = KMS.listKeys(args); const result = pipe( program, - Effect.provide(DefaultKMSServiceLayer), + Effect.provide(KMS.defaultLayer), Effect.runPromise, ); ``` @@ -28,23 +28,15 @@ const result = pipe( With custom KMSClient instance: ```typescript -import { - KMSService, - BaseKMSServiceLayer, - KMSClientInstance, -} from "@effect-aws/client-kms"; +import { KMS } from "@effect-aws/client-kms"; -const program = KMSService.listKeys(args); - -const KMSClientInstanceLayer = Layer.succeed( - KMSClientInstance, - new KMSClient({ region: "eu-central-1" }), -); +const program = KMS.listKeys(args); const result = await pipe( program, - Effect.provide(BaseKMSServiceLayer), - Effect.provide(KMSClientInstanceLayer), + Effect.provide( + KMS.baseLayer(() => new KMSClient({ region: "eu-central-1" })), + ), Effect.runPromise, ); ``` @@ -52,34 +44,15 @@ const result = await pipe( With custom KMSClient configuration: ```typescript -import { - KMSService, - BaseKMSServiceLayer, - DefaultKMSClientConfigLayer, - KMSClientInstance, - KMSClientInstanceConfig, -} from "@effect-aws/client-kms"; - -const program = KMSService.listKeys(args); - -const KMSClientInstanceLayer = Layer.provide( - Layer.effect( - KMSClientInstance, - KMSClientInstanceConfig.pipe( - Effect.map( - (config) => new KMSClient({ ...config, region: "eu-central-1" }), - ), - ), - ), - DefaultKMSClientConfigLayer, -); +import { KMS } from "@effect-aws/client-kms"; + +const program = KMS.listKeys(args); const result = await pipe( program, - Effect.provide(BaseKMSServiceLayer), - Effect.provide(KMSClientInstanceLayer), + Effect.provide(KMS.layer({ region: "eu-central-1" })), Effect.runPromiseExit, ); ``` -or map over `DefaultKMSClientConfigLayer` layer context and update the configuration... +or use `KMS.baseLayer((default) => new KMSClient({ ...default, region: "eu-central-1" }))` diff --git a/packages/client-kms/src/KMSService.ts b/packages/client-kms/src/KMSService.ts index 05a1398..ffa62db 100644 --- a/packages/client-kms/src/KMSService.ts +++ b/packages/client-kms/src/KMSService.ts @@ -3,6 +3,8 @@ */ import { KMSServiceException, + type KMSClient, + type KMSClientConfig, CancelKeyDeletionCommand, type CancelKeyDeletionCommandInput, type CancelKeyDeletionCommandOutput, @@ -218,10 +220,14 @@ import { TaggedException, } from "./Errors"; import { KMSClientInstance, KMSClientInstanceLayer } from "./KMSClientInstance"; -import { DefaultKMSClientConfigLayer } from "./KMSClientInstanceConfig"; +import { + DefaultKMSClientConfigLayer, + makeDefaultKMSClientInstanceConfig, + KMSClientInstanceConfig, +} from "./KMSClientInstanceConfig"; /** - * @since 1.0.1 + * @since 1.0.0 */ export interface HttpHandlerOptions { /** @@ -1258,15 +1264,6 @@ interface KMSService$ { >; } -/** - * @since 1.0.0 - * @category models - */ -export class KMSService extends Effect.Tag("@effect-aws/client-kms/KMSService")< - KMSService, - KMSService$ ->() {} - /** * @since 1.0.0 * @category constructors @@ -1317,15 +1314,61 @@ export const makeKMSService = Effect.gen(function* (_) { }, {}) as KMSService$; }); +/** + * @since 1.0.0 + * @category models + */ +export class KMSService extends Effect.Tag("@effect-aws/client-kms/KMSService")< + KMSService, + KMSService$ +>() { + static readonly defaultLayer = Layer.effect(this, makeKMSService).pipe( + Layer.provide(KMSClientInstanceLayer), + Layer.provide(DefaultKMSClientConfigLayer), + ); + static readonly layer = (config: KMSClientConfig) => + Layer.effect(this, makeKMSService).pipe( + Layer.provide(KMSClientInstanceLayer), + Layer.provide( + Layer.effect( + KMSClientInstanceConfig, + makeDefaultKMSClientInstanceConfig.pipe( + Effect.map((defaultConfig) => ({ ...defaultConfig, ...config })), + ), + ), + ), + ); + static readonly baseLayer = ( + evaluate: (defaultConfig: KMSClientConfig) => KMSClient, + ) => + Layer.effect(this, makeKMSService).pipe( + Layer.provide( + Layer.effect( + KMSClientInstance, + Effect.map(makeDefaultKMSClientInstanceConfig, evaluate), + ), + ), + ); +} + +/** + * @since 1.0.0 + * @category models + * @alias KMSService + */ +export const KMS = KMSService; + /** * @since 1.0.0 * @category layers + * @deprecated use KMS.baseLayer instead */ export const BaseKMSServiceLayer = Layer.effect(KMSService, makeKMSService); /** * @since 1.0.0 * @category layers + * @deprecated use KMS.layer instead */ export const KMSServiceLayer = BaseKMSServiceLayer.pipe( Layer.provide(KMSClientInstanceLayer), @@ -1334,7 +1377,6 @@ export const KMSServiceLayer = BaseKMSServiceLayer.pipe( /** * @since 1.0.0 * @category layers + * @deprecated use KMS.defaultLayer instead */ -export const DefaultKMSServiceLayer = KMSServiceLayer.pipe( - Layer.provide(DefaultKMSClientConfigLayer), -); +export const DefaultKMSServiceLayer = KMSService.defaultLayer; diff --git a/packages/client-kms/test/KMS.test.ts b/packages/client-kms/test/KMS.test.ts index e75e786..13f1177 100644 --- a/packages/client-kms/test/KMS.test.ts +++ b/packages/client-kms/test/KMS.test.ts @@ -4,39 +4,41 @@ import { KMSClient, KMSServiceException, } from "@aws-sdk/client-kms"; +// @ts-ignore +import * as runtimeConfig from "@aws-sdk/client-kms/dist-cjs/runtimeConfig"; import { mockClient } from "aws-sdk-client-mock"; import * as Effect from "effect/Effect"; import * as Exit from "effect/Exit"; import { pipe } from "effect/Function"; -import * as Layer from "effect/Layer"; -import { - BaseKMSServiceLayer, - DefaultKMSClientConfigLayer, - DefaultKMSServiceLayer, - KMSClientInstance, - KMSClientInstanceConfig, - KMSService, - KMSServiceLayer, - SdkError, -} from "../src"; +import { afterEach, describe, expect, it, vi } from "vitest"; +import { KMS, SdkError } from "../src"; +const getRuntimeConfig = vi.spyOn(runtimeConfig, "getRuntimeConfig"); const clientMock = mockClient(KMSClient); describe("KMSClientImpl", () => { + afterEach(() => { + getRuntimeConfig.mockClear(); + }); + it("default", async () => { clientMock.reset().on(ListKeysCommand).resolves({}); const args = {} as unknown as ListKeysCommandInput; - const program = KMSService.listKeys(args); + const program = KMS.listKeys(args); const result = await pipe( program, - Effect.provide(DefaultKMSServiceLayer), + Effect.provide(KMS.defaultLayer), Effect.runPromiseExit, ); expect(result).toEqual(Exit.succeed({})); + expect(getRuntimeConfig).toHaveBeenCalledTimes(1); + expect(getRuntimeConfig).toHaveBeenCalledWith({ + logger: expect.any(Object), + }); expect(clientMock).toHaveReceivedCommandTimes(ListKeysCommand, 1); expect(clientMock).toHaveReceivedCommandWith(ListKeysCommand, args); }); @@ -46,22 +48,20 @@ describe("KMSClientImpl", () => { const args = {} as unknown as ListKeysCommandInput; - const program = KMSService.listKeys(args); - - const KMSClientConfigLayer = Layer.succeed(KMSClientInstanceConfig, { - region: "eu-central-1", - }); - const CustomKMSServiceLayer = KMSServiceLayer.pipe( - Layer.provide(KMSClientConfigLayer), - ); + const program = KMS.listKeys(args); const result = await pipe( program, - Effect.provide(CustomKMSServiceLayer), + Effect.provide(KMS.layer({ region: "eu-central-1" })), Effect.runPromiseExit, ); expect(result).toEqual(Exit.succeed({})); + expect(getRuntimeConfig).toHaveBeenCalledTimes(1); + expect(getRuntimeConfig).toHaveBeenCalledWith({ + region: "eu-central-1", + logger: expect.any(Object), + }); expect(clientMock).toHaveReceivedCommandTimes(ListKeysCommand, 1); expect(clientMock).toHaveReceivedCommandWith(ListKeysCommand, args); }); @@ -71,23 +71,21 @@ describe("KMSClientImpl", () => { const args = {} as unknown as ListKeysCommandInput; - const program = KMSService.listKeys(args); - - const KMSClientInstanceLayer = Layer.succeed( - KMSClientInstance, - new KMSClient({ region: "eu-central-1" }), - ); - const CustomKMSServiceLayer = BaseKMSServiceLayer.pipe( - Layer.provide(KMSClientInstanceLayer), - ); + const program = KMS.listKeys(args); const result = await pipe( program, - Effect.provide(CustomKMSServiceLayer), + Effect.provide( + KMS.baseLayer(() => new KMSClient({ region: "eu-central-1" })), + ), Effect.runPromiseExit, ); expect(result).toEqual(Exit.succeed({})); + expect(getRuntimeConfig).toHaveBeenCalledTimes(1); + expect(getRuntimeConfig).toHaveBeenCalledWith({ + region: "eu-central-1", + }); expect(clientMock).toHaveReceivedCommandTimes(ListKeysCommand, 1); expect(clientMock).toHaveReceivedCommandWith(ListKeysCommand, args); }); @@ -97,27 +95,24 @@ describe("KMSClientImpl", () => { const args = {} as unknown as ListKeysCommandInput; - const program = KMSService.listKeys(args); - - const KMSClientInstanceLayer = Layer.effect( - KMSClientInstance, - Effect.map( - KMSClientInstanceConfig, - (config) => new KMSClient({ ...config, region: "eu-central-1" }), - ), - ); - const CustomKMSServiceLayer = BaseKMSServiceLayer.pipe( - Layer.provide(KMSClientInstanceLayer), - Layer.provide(DefaultKMSClientConfigLayer), - ); + const program = KMS.listKeys(args); const result = await pipe( program, - Effect.provide(CustomKMSServiceLayer), + Effect.provide( + KMS.baseLayer( + (config) => new KMSClient({ ...config, region: "eu-central-1" }), + ), + ), Effect.runPromiseExit, ); expect(result).toEqual(Exit.succeed({})); + expect(getRuntimeConfig).toHaveBeenCalledTimes(1); + expect(getRuntimeConfig).toHaveBeenCalledWith({ + region: "eu-central-1", + logger: expect.any(Object), + }); expect(clientMock).toHaveReceivedCommandTimes(ListKeysCommand, 1); expect(clientMock).toHaveReceivedCommandWith(ListKeysCommand, args); }); @@ -127,11 +122,11 @@ describe("KMSClientImpl", () => { const args = {} as unknown as ListKeysCommandInput; - const program = KMSService.listKeys(args); + const program = KMS.listKeys(args); const result = await pipe( program, - Effect.provide(DefaultKMSServiceLayer), + Effect.provide(KMS.defaultLayer), Effect.runPromiseExit, ); @@ -162,13 +157,13 @@ describe("KMSClientImpl", () => { const args = {} as unknown as ListKeysCommandInput; - const program = KMSService.listKeys(args).pipe( + const program = KMS.listKeys(args).pipe( Effect.catchTag("NotHandledException" as any, () => Effect.succeed(null)), ); const result = await pipe( program, - Effect.provide(DefaultKMSServiceLayer), + Effect.provide(KMS.defaultLayer), Effect.runPromiseExit, ); diff --git a/packages/client-lambda/README.md b/packages/client-lambda/README.md index ef9dbbb..af35f9d 100644 --- a/packages/client-lambda/README.md +++ b/packages/client-lambda/README.md @@ -14,16 +14,13 @@ npm install --save @effect-aws/client-lambda With default LambdaClient instance: ```typescript -import { - LambdaService, - DefaultLambdaServiceLayer, -} from "@effect-aws/client-lambda"; +import { Lambda } from "@effect-aws/client-lambda"; -const program = LambdaService.invoke(args); +const program = Lambda.invoke(args); const result = pipe( program, - Effect.provide(DefaultLambdaServiceLayer), + Effect.provide(Lambda.defaultLayer), Effect.runPromise, ); ``` @@ -31,23 +28,15 @@ const result = pipe( With custom LambdaClient instance: ```typescript -import { - LambdaService, - BaseLambdaServiceLayer, - LambdaClientInstance, -} from "@effect-aws/client-lambda"; +import { Lambda } from "@effect-aws/client-lambda"; -const program = LambdaService.invoke(args); - -const LambdaClientInstanceLayer = Layer.succeed( - LambdaClientInstance, - new LambdaClient({ region: "eu-central-1" }), -); +const program = Lambda.invoke(args); const result = await pipe( program, - Effect.provide(BaseLambdaServiceLayer), - Effect.provide(LambdaClientInstanceLayer), + Effect.provide( + Lambda.baseLayer(() => new LambdaClient({ region: "eu-central-1" })), + ), Effect.runPromise, ); ``` @@ -55,34 +44,15 @@ const result = await pipe( With custom LambdaClient configuration: ```typescript -import { - LambdaService, - BaseLambdaServiceLayer, - DefaultLambdaClientConfigLayer, - LambdaClientInstance, - LambdaClientInstanceConfig, -} from "@effect-aws/client-lambda"; - -const program = LambdaService.invoke(args); - -const LambdaClientInstanceLayer = Layer.provide( - Layer.effect( - LambdaClientInstance, - LambdaClientInstanceConfig.pipe( - Effect.map( - (config) => new LambdaClient({ ...config, region: "eu-central-1" }), - ), - ), - ), - DefaultLambdaClientConfigLayer, -); +import { Lambda } from "@effect-aws/client-lambda"; + +const program = Lambda.invoke(args); const result = await pipe( program, - Effect.provide(BaseLambdaServiceLayer), - Effect.provide(LambdaClientInstanceLayer), + Effect.provide(Lambda.layer({ region: "eu-central-1" })), Effect.runPromiseExit, ); ``` -or map over `DefaultLambdaClientConfigLayer` layer context and update the configuration... +or use `Lambda.baseLayer((default) => new LambdaClient({ ...default, region: "eu-central-1" }))` diff --git a/packages/client-lambda/src/LambdaService.ts b/packages/client-lambda/src/LambdaService.ts index 646a420..0cf34cd 100644 --- a/packages/client-lambda/src/LambdaService.ts +++ b/packages/client-lambda/src/LambdaService.ts @@ -3,6 +3,8 @@ */ import { LambdaServiceException, + type LambdaClient, + type LambdaClientConfig, AddLayerVersionPermissionCommand, type AddLayerVersionPermissionCommandInput, type AddLayerVersionPermissionCommandOutput, @@ -256,10 +258,14 @@ import { LambdaClientInstance, LambdaClientInstanceLayer, } from "./LambdaClientInstance"; -import { DefaultLambdaClientConfigLayer } from "./LambdaClientInstanceConfig"; +import { + DefaultLambdaClientConfigLayer, + makeDefaultLambdaClientInstanceConfig, + LambdaClientInstanceConfig, +} from "./LambdaClientInstanceConfig"; /** - * @since 1.5.1 + * @since 1.0.0 */ export interface HttpHandlerOptions { /** @@ -1436,14 +1442,6 @@ interface LambdaService$ { >; } -/** - * @since 1.0.0 - * @category models - */ -export class LambdaService extends Effect.Tag( - "@effect-aws/client-lambda/LambdaService", -)() {} - /** * @since 1.0.0 * @category constructors @@ -1494,9 +1492,53 @@ export const makeLambdaService = Effect.gen(function* (_) { }, {}) as LambdaService$; }); +/** + * @since 1.0.0 + * @category models + */ +export class LambdaService extends Effect.Tag( + "@effect-aws/client-lambda/LambdaService", +)() { + static readonly defaultLayer = Layer.effect(this, makeLambdaService).pipe( + Layer.provide(LambdaClientInstanceLayer), + Layer.provide(DefaultLambdaClientConfigLayer), + ); + static readonly layer = (config: LambdaClientConfig) => + Layer.effect(this, makeLambdaService).pipe( + Layer.provide(LambdaClientInstanceLayer), + Layer.provide( + Layer.effect( + LambdaClientInstanceConfig, + makeDefaultLambdaClientInstanceConfig.pipe( + Effect.map((defaultConfig) => ({ ...defaultConfig, ...config })), + ), + ), + ), + ); + static readonly baseLayer = ( + evaluate: (defaultConfig: LambdaClientConfig) => LambdaClient, + ) => + Layer.effect(this, makeLambdaService).pipe( + Layer.provide( + Layer.effect( + LambdaClientInstance, + Effect.map(makeDefaultLambdaClientInstanceConfig, evaluate), + ), + ), + ); +} + +/** + * @since 1.0.0 + * @category models + * @alias LambdaService + */ +export const Lambda = LambdaService; + /** * @since 1.0.0 * @category layers + * @deprecated use Lambda.baseLayer instead */ export const BaseLambdaServiceLayer = Layer.effect( LambdaService, @@ -1506,6 +1548,7 @@ export const BaseLambdaServiceLayer = Layer.effect( /** * @since 1.0.0 * @category layers + * @deprecated use Lambda.layer instead */ export const LambdaServiceLayer = BaseLambdaServiceLayer.pipe( Layer.provide(LambdaClientInstanceLayer), @@ -1514,7 +1557,6 @@ export const LambdaServiceLayer = BaseLambdaServiceLayer.pipe( /** * @since 1.0.0 * @category layers + * @deprecated use Lambda.defaultLayer instead */ -export const DefaultLambdaServiceLayer = LambdaServiceLayer.pipe( - Layer.provide(DefaultLambdaClientConfigLayer), -); +export const DefaultLambdaServiceLayer = LambdaService.defaultLayer; diff --git a/packages/client-lambda/test/Lambda.test.ts b/packages/client-lambda/test/Lambda.test.ts index 613178d..5ec0348 100644 --- a/packages/client-lambda/test/Lambda.test.ts +++ b/packages/client-lambda/test/Lambda.test.ts @@ -4,39 +4,41 @@ import { LambdaClient, LambdaServiceException, } from "@aws-sdk/client-lambda"; +// @ts-ignore +import * as runtimeConfig from "@aws-sdk/client-lambda/dist-cjs/runtimeConfig"; import { mockClient } from "aws-sdk-client-mock"; import * as Effect from "effect/Effect"; import * as Exit from "effect/Exit"; import { pipe } from "effect/Function"; -import * as Layer from "effect/Layer"; -import { - BaseLambdaServiceLayer, - DefaultLambdaClientConfigLayer, - DefaultLambdaServiceLayer, - LambdaClientInstance, - LambdaClientInstanceConfig, - LambdaService, - LambdaServiceLayer, - SdkError, -} from "../src"; +import { afterEach, describe, expect, it, vi } from "vitest"; +import { Lambda, SdkError } from "../src"; +const getRuntimeConfig = vi.spyOn(runtimeConfig, "getRuntimeConfig"); const clientMock = mockClient(LambdaClient); describe("LambdaClientImpl", () => { + afterEach(() => { + getRuntimeConfig.mockClear(); + }); + it("default", async () => { clientMock.reset().on(InvokeCommand).resolves({}); const args: InvokeCommandInput = { FunctionName: "test", Payload: "test" }; - const program = LambdaService.invoke(args); + const program = Lambda.invoke(args); const result = await pipe( program, - Effect.provide(DefaultLambdaServiceLayer), + Effect.provide(Lambda.defaultLayer), Effect.runPromiseExit, ); expect(result).toEqual(Exit.succeed({})); + expect(getRuntimeConfig).toHaveBeenCalledTimes(1); + expect(getRuntimeConfig).toHaveBeenCalledWith({ + logger: expect.any(Object), + }); expect(clientMock).toHaveReceivedCommandTimes(InvokeCommand, 1); expect(clientMock).toHaveReceivedCommandWith(InvokeCommand, args); }); @@ -46,22 +48,20 @@ describe("LambdaClientImpl", () => { const args: InvokeCommandInput = { FunctionName: "test", Payload: "test" }; - const program = LambdaService.invoke(args); - - const LambdaClientConfigLayer = Layer.succeed(LambdaClientInstanceConfig, { - region: "eu-central-1", - }); - const CustomLambdaServiceLayer = LambdaServiceLayer.pipe( - Layer.provide(LambdaClientConfigLayer), - ); + const program = Lambda.invoke(args); const result = await pipe( program, - Effect.provide(CustomLambdaServiceLayer), + Effect.provide(Lambda.layer({ region: "eu-central-1" })), Effect.runPromiseExit, ); expect(result).toEqual(Exit.succeed({})); + expect(getRuntimeConfig).toHaveBeenCalledTimes(1); + expect(getRuntimeConfig).toHaveBeenCalledWith({ + region: "eu-central-1", + logger: expect.any(Object), + }); expect(clientMock).toHaveReceivedCommandTimes(InvokeCommand, 1); expect(clientMock).toHaveReceivedCommandWith(InvokeCommand, args); }); @@ -71,23 +71,21 @@ describe("LambdaClientImpl", () => { const args: InvokeCommandInput = { FunctionName: "test", Payload: "test" }; - const program = LambdaService.invoke(args); - - const LambdaClientInstanceLayer = Layer.succeed( - LambdaClientInstance, - new LambdaClient({ region: "eu-central-1" }), - ); - const CustomLambdaServiceLayer = BaseLambdaServiceLayer.pipe( - Layer.provide(LambdaClientInstanceLayer), - ); + const program = Lambda.invoke(args); const result = await pipe( program, - Effect.provide(CustomLambdaServiceLayer), + Effect.provide( + Lambda.baseLayer(() => new LambdaClient({ region: "eu-central-1" })), + ), Effect.runPromiseExit, ); expect(result).toEqual(Exit.succeed({})); + expect(getRuntimeConfig).toHaveBeenCalledTimes(1); + expect(getRuntimeConfig).toHaveBeenCalledWith({ + region: "eu-central-1", + }); expect(clientMock).toHaveReceivedCommandTimes(InvokeCommand, 1); expect(clientMock).toHaveReceivedCommandWith(InvokeCommand, args); }); @@ -97,27 +95,24 @@ describe("LambdaClientImpl", () => { const args: InvokeCommandInput = { FunctionName: "test", Payload: "test" }; - const program = LambdaService.invoke(args); - - const LambdaClientInstanceLayer = Layer.effect( - LambdaClientInstance, - Effect.map( - LambdaClientInstanceConfig, - (config) => new LambdaClient({ ...config, region: "eu-central-1" }), - ), - ); - const CustomLambdaServiceLayer = BaseLambdaServiceLayer.pipe( - Layer.provide(LambdaClientInstanceLayer), - Layer.provide(DefaultLambdaClientConfigLayer), - ); + const program = Lambda.invoke(args); const result = await pipe( program, - Effect.provide(CustomLambdaServiceLayer), + Effect.provide( + Lambda.baseLayer( + (config) => new LambdaClient({ ...config, region: "eu-central-1" }), + ), + ), Effect.runPromiseExit, ); expect(result).toEqual(Exit.succeed({})); + expect(getRuntimeConfig).toHaveBeenCalledTimes(1); + expect(getRuntimeConfig).toHaveBeenCalledWith({ + region: "eu-central-1", + logger: expect.any(Object), + }); expect(clientMock).toHaveReceivedCommandTimes(InvokeCommand, 1); expect(clientMock).toHaveReceivedCommandWith(InvokeCommand, args); }); @@ -127,11 +122,11 @@ describe("LambdaClientImpl", () => { const args: InvokeCommandInput = { FunctionName: "test", Payload: "test" }; - const program = LambdaService.invoke(args); + const program = Lambda.invoke(args); const result = await pipe( program, - Effect.provide(DefaultLambdaServiceLayer), + Effect.provide(Lambda.defaultLayer), Effect.runPromiseExit, ); @@ -162,13 +157,13 @@ describe("LambdaClientImpl", () => { const args: InvokeCommandInput = { FunctionName: "test", Payload: "test" }; - const program = LambdaService.invoke(args).pipe( + const program = Lambda.invoke(args).pipe( Effect.catchTag("NotHandledException" as any, () => Effect.succeed(null)), ); const result = await pipe( program, - Effect.provide(DefaultLambdaServiceLayer), + Effect.provide(Lambda.defaultLayer), Effect.runPromiseExit, ); diff --git a/packages/client-mq/README.md b/packages/client-mq/README.md index 88e418d..69666dd 100644 --- a/packages/client-mq/README.md +++ b/packages/client-mq/README.md @@ -14,13 +14,13 @@ npm install --save @effect-aws/client-mq With default MqClient instance: ```typescript -import { MqService, DefaultMqServiceLayer } from "@effect-aws/client-mq"; +import { Mq } from "@effect-aws/client-mq"; -const program = MqService.listBrokers(args); +const program = Mq.listBrokers(args); const result = pipe( program, - Effect.provide(DefaultMqServiceLayer), + Effect.provide(Mq.defaultLayer), Effect.runPromise, ); ``` @@ -28,23 +28,15 @@ const result = pipe( With custom MqClient instance: ```typescript -import { - MqService, - BaseMqServiceLayer, - MqClientInstance, -} from "@effect-aws/client-mq"; +import { Mq } from "@effect-aws/client-mq"; -const program = MqService.listBrokers(args); - -const MqClientInstanceLayer = Layer.succeed( - MqClientInstance, - new MqClient({ region: "eu-central-1" }), -); +const program = Mq.listBrokers(args); const result = await pipe( program, - Effect.provide(BaseMqServiceLayer), - Effect.provide(MqClientInstanceLayer), + Effect.provide( + Mq.baseLayer(() => new MqClient({ region: "eu-central-1" })), + ), Effect.runPromise, ); ``` @@ -52,34 +44,15 @@ const result = await pipe( With custom MqClient configuration: ```typescript -import { - MqService, - BaseMqServiceLayer, - DefaultMqClientConfigLayer, - MqClientInstance, - MqClientInstanceConfig, -} from "@effect-aws/client-mq"; - -const program = MqService.listBrokers(args); - -const MqClientInstanceLayer = Layer.provide( - Layer.effect( - MqClientInstance, - MqClientInstanceConfig.pipe( - Effect.map( - (config) => new MqClient({ ...config, region: "eu-central-1" }), - ), - ), - ), - DefaultMqClientConfigLayer, -); +import { Mq } from "@effect-aws/client-mq"; + +const program = Mq.listBrokers(args); const result = await pipe( program, - Effect.provide(BaseMqServiceLayer), - Effect.provide(MqClientInstanceLayer), + Effect.provide(Mq.layer({ region: "eu-central-1" })), Effect.runPromiseExit, ); ``` -or map over `DefaultMqClientConfigLayer` layer context and update the configuration... +or use `Mq.baseLayer((default) => new MqClient({ ...default, region: "eu-central-1" }))` diff --git a/packages/client-mq/src/MqService.ts b/packages/client-mq/src/MqService.ts index 08399c1..20a75bf 100644 --- a/packages/client-mq/src/MqService.ts +++ b/packages/client-mq/src/MqService.ts @@ -3,6 +3,8 @@ */ import { MqServiceException, + type MqClient, + type MqClientConfig, CreateBrokerCommand, type CreateBrokerCommandInput, type CreateBrokerCommandOutput, @@ -86,10 +88,14 @@ import { TaggedException, } from "./Errors"; import { MqClientInstance, MqClientInstanceLayer } from "./MqClientInstance"; -import { DefaultMqClientConfigLayer } from "./MqClientInstanceConfig"; +import { + DefaultMqClientConfigLayer, + makeDefaultMqClientInstanceConfig, + MqClientInstanceConfig, +} from "./MqClientInstanceConfig"; /** - * @since 1.0.1 + * @since 1.0.0 */ export interface HttpHandlerOptions { /** @@ -463,15 +469,6 @@ interface MqService$ { >; } -/** - * @since 1.0.0 - * @category models - */ -export class MqService extends Effect.Tag("@effect-aws/client-mq/MqService")< - MqService, - MqService$ ->() {} - /** * @since 1.0.0 * @category constructors @@ -522,15 +519,61 @@ export const makeMqService = Effect.gen(function* (_) { }, {}) as MqService$; }); +/** + * @since 1.0.0 + * @category models + */ +export class MqService extends Effect.Tag("@effect-aws/client-mq/MqService")< + MqService, + MqService$ +>() { + static readonly defaultLayer = Layer.effect(this, makeMqService).pipe( + Layer.provide(MqClientInstanceLayer), + Layer.provide(DefaultMqClientConfigLayer), + ); + static readonly layer = (config: MqClientConfig) => + Layer.effect(this, makeMqService).pipe( + Layer.provide(MqClientInstanceLayer), + Layer.provide( + Layer.effect( + MqClientInstanceConfig, + makeDefaultMqClientInstanceConfig.pipe( + Effect.map((defaultConfig) => ({ ...defaultConfig, ...config })), + ), + ), + ), + ); + static readonly baseLayer = ( + evaluate: (defaultConfig: MqClientConfig) => MqClient, + ) => + Layer.effect(this, makeMqService).pipe( + Layer.provide( + Layer.effect( + MqClientInstance, + Effect.map(makeDefaultMqClientInstanceConfig, evaluate), + ), + ), + ); +} + +/** + * @since 1.0.0 + * @category models + * @alias MqService + */ +export const Mq = MqService; + /** * @since 1.0.0 * @category layers + * @deprecated use Mq.baseLayer instead */ export const BaseMqServiceLayer = Layer.effect(MqService, makeMqService); /** * @since 1.0.0 * @category layers + * @deprecated use Mq.layer instead */ export const MqServiceLayer = BaseMqServiceLayer.pipe( Layer.provide(MqClientInstanceLayer), @@ -539,7 +582,6 @@ export const MqServiceLayer = BaseMqServiceLayer.pipe( /** * @since 1.0.0 * @category layers + * @deprecated use Mq.defaultLayer instead */ -export const DefaultMqServiceLayer = MqServiceLayer.pipe( - Layer.provide(DefaultMqClientConfigLayer), -); +export const DefaultMqServiceLayer = MqService.defaultLayer; diff --git a/packages/client-mq/test/Mq.test.ts b/packages/client-mq/test/Mq.test.ts index b9610a2..c6453c7 100644 --- a/packages/client-mq/test/Mq.test.ts +++ b/packages/client-mq/test/Mq.test.ts @@ -4,39 +4,41 @@ import { MqClient, MqServiceException, } from "@aws-sdk/client-mq"; +// @ts-ignore +import * as runtimeConfig from "@aws-sdk/client-mq/dist-cjs/runtimeConfig"; import { mockClient } from "aws-sdk-client-mock"; import * as Effect from "effect/Effect"; import * as Exit from "effect/Exit"; import { pipe } from "effect/Function"; -import * as Layer from "effect/Layer"; -import { - BaseMqServiceLayer, - DefaultMqClientConfigLayer, - DefaultMqServiceLayer, - MqClientInstance, - MqClientInstanceConfig, - MqService, - MqServiceLayer, - SdkError, -} from "../src"; +import { afterEach, describe, expect, it, vi } from "vitest"; +import { Mq, SdkError } from "../src"; +const getRuntimeConfig = vi.spyOn(runtimeConfig, "getRuntimeConfig"); const clientMock = mockClient(MqClient); describe("MqClientImpl", () => { + afterEach(() => { + getRuntimeConfig.mockClear(); + }); + it("default", async () => { clientMock.reset().on(ListBrokersCommand).resolves({}); const args = {} as unknown as ListBrokersCommandInput; - const program = MqService.listBrokers(args); + const program = Mq.listBrokers(args); const result = await pipe( program, - Effect.provide(DefaultMqServiceLayer), + Effect.provide(Mq.defaultLayer), Effect.runPromiseExit, ); expect(result).toEqual(Exit.succeed({})); + expect(getRuntimeConfig).toHaveBeenCalledTimes(1); + expect(getRuntimeConfig).toHaveBeenCalledWith({ + logger: expect.any(Object), + }); expect(clientMock).toHaveReceivedCommandTimes(ListBrokersCommand, 1); expect(clientMock).toHaveReceivedCommandWith(ListBrokersCommand, args); }); @@ -46,22 +48,20 @@ describe("MqClientImpl", () => { const args = {} as unknown as ListBrokersCommandInput; - const program = MqService.listBrokers(args); - - const MqClientConfigLayer = Layer.succeed(MqClientInstanceConfig, { - region: "eu-central-1", - }); - const CustomMqServiceLayer = MqServiceLayer.pipe( - Layer.provide(MqClientConfigLayer), - ); + const program = Mq.listBrokers(args); const result = await pipe( program, - Effect.provide(CustomMqServiceLayer), + Effect.provide(Mq.layer({ region: "eu-central-1" })), Effect.runPromiseExit, ); expect(result).toEqual(Exit.succeed({})); + expect(getRuntimeConfig).toHaveBeenCalledTimes(1); + expect(getRuntimeConfig).toHaveBeenCalledWith({ + region: "eu-central-1", + logger: expect.any(Object), + }); expect(clientMock).toHaveReceivedCommandTimes(ListBrokersCommand, 1); expect(clientMock).toHaveReceivedCommandWith(ListBrokersCommand, args); }); @@ -71,23 +71,21 @@ describe("MqClientImpl", () => { const args = {} as unknown as ListBrokersCommandInput; - const program = MqService.listBrokers(args); - - const MqClientInstanceLayer = Layer.succeed( - MqClientInstance, - new MqClient({ region: "eu-central-1" }), - ); - const CustomMqServiceLayer = BaseMqServiceLayer.pipe( - Layer.provide(MqClientInstanceLayer), - ); + const program = Mq.listBrokers(args); const result = await pipe( program, - Effect.provide(CustomMqServiceLayer), + Effect.provide( + Mq.baseLayer(() => new MqClient({ region: "eu-central-1" })), + ), Effect.runPromiseExit, ); expect(result).toEqual(Exit.succeed({})); + expect(getRuntimeConfig).toHaveBeenCalledTimes(1); + expect(getRuntimeConfig).toHaveBeenCalledWith({ + region: "eu-central-1", + }); expect(clientMock).toHaveReceivedCommandTimes(ListBrokersCommand, 1); expect(clientMock).toHaveReceivedCommandWith(ListBrokersCommand, args); }); @@ -97,27 +95,24 @@ describe("MqClientImpl", () => { const args = {} as unknown as ListBrokersCommandInput; - const program = MqService.listBrokers(args); - - const MqClientInstanceLayer = Layer.effect( - MqClientInstance, - Effect.map( - MqClientInstanceConfig, - (config) => new MqClient({ ...config, region: "eu-central-1" }), - ), - ); - const CustomMqServiceLayer = BaseMqServiceLayer.pipe( - Layer.provide(MqClientInstanceLayer), - Layer.provide(DefaultMqClientConfigLayer), - ); + const program = Mq.listBrokers(args); const result = await pipe( program, - Effect.provide(CustomMqServiceLayer), + Effect.provide( + Mq.baseLayer( + (config) => new MqClient({ ...config, region: "eu-central-1" }), + ), + ), Effect.runPromiseExit, ); expect(result).toEqual(Exit.succeed({})); + expect(getRuntimeConfig).toHaveBeenCalledTimes(1); + expect(getRuntimeConfig).toHaveBeenCalledWith({ + region: "eu-central-1", + logger: expect.any(Object), + }); expect(clientMock).toHaveReceivedCommandTimes(ListBrokersCommand, 1); expect(clientMock).toHaveReceivedCommandWith(ListBrokersCommand, args); }); @@ -127,11 +122,11 @@ describe("MqClientImpl", () => { const args = {} as unknown as ListBrokersCommandInput; - const program = MqService.listBrokers(args); + const program = Mq.listBrokers(args); const result = await pipe( program, - Effect.provide(DefaultMqServiceLayer), + Effect.provide(Mq.defaultLayer), Effect.runPromiseExit, ); @@ -162,13 +157,13 @@ describe("MqClientImpl", () => { const args = {} as unknown as ListBrokersCommandInput; - const program = MqService.listBrokers(args).pipe( + const program = Mq.listBrokers(args).pipe( Effect.catchTag("NotHandledException" as any, () => Effect.succeed(null)), ); const result = await pipe( program, - Effect.provide(DefaultMqServiceLayer), + Effect.provide(Mq.defaultLayer), Effect.runPromiseExit, ); diff --git a/packages/client-opensearch-serverless/README.md b/packages/client-opensearch-serverless/README.md index 691131f..7727ef1 100644 --- a/packages/client-opensearch-serverless/README.md +++ b/packages/client-opensearch-serverless/README.md @@ -14,13 +14,13 @@ npm install --save @effect-aws/client-opensearch-serverless With default OpenSearchServerlessClient instance: ```typescript -import { OpenSearchServerlessService, DefaultOpenSearchServerlessServiceLayer } from "@effect-aws/client-opensearch-serverless"; +import { OpenSearchServerless } from "@effect-aws/client-opensearch-serverless"; -const program = OpenSearchServerlessService.listCollections(args); +const program = OpenSearchServerless.listCollections(args); const result = pipe( program, - Effect.provide(DefaultOpenSearchServerlessServiceLayer), + Effect.provide(OpenSearchServerless.defaultLayer), Effect.runPromise, ); ``` @@ -28,23 +28,15 @@ const result = pipe( With custom OpenSearchServerlessClient instance: ```typescript -import { - OpenSearchServerlessService, - BaseOpenSearchServerlessServiceLayer, - OpenSearchServerlessClientInstance, -} from "@effect-aws/client-opensearch-serverless"; +import { OpenSearchServerless } from "@effect-aws/client-opensearch-serverless"; -const program = OpenSearchServerlessService.listCollections(args); - -const OpenSearchServerlessClientInstanceLayer = Layer.succeed( - OpenSearchServerlessClientInstance, - new OpenSearchServerlessClient({ region: "eu-central-1" }), -); +const program = OpenSearchServerless.listCollections(args); const result = await pipe( program, - Effect.provide(BaseOpenSearchServerlessServiceLayer), - Effect.provide(OpenSearchServerlessClientInstanceLayer), + Effect.provide( + OpenSearchServerless.baseLayer(() => new OpenSearchServerlessClient({ region: "eu-central-1" })), + ), Effect.runPromise, ); ``` @@ -52,34 +44,15 @@ const result = await pipe( With custom OpenSearchServerlessClient configuration: ```typescript -import { - OpenSearchServerlessService, - BaseOpenSearchServerlessServiceLayer, - DefaultOpenSearchServerlessClientConfigLayer, - OpenSearchServerlessClientInstance, - OpenSearchServerlessClientInstanceConfig, -} from "@effect-aws/client-opensearch-serverless"; - -const program = OpenSearchServerlessService.listCollections(args); - -const OpenSearchServerlessClientInstanceLayer = Layer.provide( - Layer.effect( - OpenSearchServerlessClientInstance, - OpenSearchServerlessClientInstanceConfig.pipe( - Effect.map( - (config) => new OpenSearchServerlessClient({ ...config, region: "eu-central-1" }), - ), - ), - ), - DefaultOpenSearchServerlessClientConfigLayer, -); +import { OpenSearchServerless } from "@effect-aws/client-opensearch-serverless"; + +const program = OpenSearchServerless.listCollections(args); const result = await pipe( program, - Effect.provide(BaseOpenSearchServerlessServiceLayer), - Effect.provide(OpenSearchServerlessClientInstanceLayer), + Effect.provide(OpenSearchServerless.layer({ region: "eu-central-1" })), Effect.runPromiseExit, ); ``` -or map over `DefaultOpenSearchServerlessClientConfigLayer` layer context and update the configuration... +or use `OpenSearchServerless.baseLayer((default) => new OpenSearchServerlessClient({ ...default, region: "eu-central-1" }))` diff --git a/packages/client-opensearch-serverless/src/OpenSearchServerlessService.ts b/packages/client-opensearch-serverless/src/OpenSearchServerlessService.ts index fe94c80..9879267 100644 --- a/packages/client-opensearch-serverless/src/OpenSearchServerlessService.ts +++ b/packages/client-opensearch-serverless/src/OpenSearchServerlessService.ts @@ -3,6 +3,8 @@ */ import { OpenSearchServerlessServiceException, + type OpenSearchServerlessClient, + type OpenSearchServerlessClientConfig, BatchGetCollectionCommand, type BatchGetCollectionCommandInput, type BatchGetCollectionCommandOutput, @@ -131,10 +133,14 @@ import { OpenSearchServerlessClientInstance, OpenSearchServerlessClientInstanceLayer, } from "./OpenSearchServerlessClientInstance"; -import { DefaultOpenSearchServerlessClientConfigLayer } from "./OpenSearchServerlessClientInstanceConfig"; +import { + DefaultOpenSearchServerlessClientConfigLayer, + makeDefaultOpenSearchServerlessClientInstanceConfig, + OpenSearchServerlessClientInstanceConfig, +} from "./OpenSearchServerlessClientInstanceConfig"; /** - * @since 1.0.1 + * @since 1.0.0 */ export interface HttpHandlerOptions { /** @@ -671,14 +677,6 @@ interface OpenSearchServerlessService$ { >; } -/** - * @since 1.0.0 - * @category models - */ -export class OpenSearchServerlessService extends Effect.Tag( - "@effect-aws/client-opensearch-serverless/OpenSearchServerlessService", -)() {} - /** * @since 1.0.0 * @category constructors @@ -729,9 +727,61 @@ export const makeOpenSearchServerlessService = Effect.gen(function* (_) { }, {}) as OpenSearchServerlessService$; }); +/** + * @since 1.0.0 + * @category models + */ +export class OpenSearchServerlessService extends Effect.Tag( + "@effect-aws/client-opensearch-serverless/OpenSearchServerlessService", +)() { + static readonly defaultLayer = Layer.effect( + this, + makeOpenSearchServerlessService, + ).pipe( + Layer.provide(OpenSearchServerlessClientInstanceLayer), + Layer.provide(DefaultOpenSearchServerlessClientConfigLayer), + ); + static readonly layer = (config: OpenSearchServerlessClientConfig) => + Layer.effect(this, makeOpenSearchServerlessService).pipe( + Layer.provide(OpenSearchServerlessClientInstanceLayer), + Layer.provide( + Layer.effect( + OpenSearchServerlessClientInstanceConfig, + makeDefaultOpenSearchServerlessClientInstanceConfig.pipe( + Effect.map((defaultConfig) => ({ ...defaultConfig, ...config })), + ), + ), + ), + ); + static readonly baseLayer = ( + evaluate: ( + defaultConfig: OpenSearchServerlessClientConfig, + ) => OpenSearchServerlessClient, + ) => + Layer.effect(this, makeOpenSearchServerlessService).pipe( + Layer.provide( + Layer.effect( + OpenSearchServerlessClientInstance, + Effect.map( + makeDefaultOpenSearchServerlessClientInstanceConfig, + evaluate, + ), + ), + ), + ); +} + +/** + * @since 1.0.0 + * @category models + * @alias OpenSearchServerlessService + */ +export const OpenSearchServerless = OpenSearchServerlessService; + /** * @since 1.0.0 * @category layers + * @deprecated use OpenSearchServerless.baseLayer instead */ export const BaseOpenSearchServerlessServiceLayer = Layer.effect( OpenSearchServerlessService, @@ -741,6 +791,7 @@ export const BaseOpenSearchServerlessServiceLayer = Layer.effect( /** * @since 1.0.0 * @category layers + * @deprecated use OpenSearchServerless.layer instead */ export const OpenSearchServerlessServiceLayer = BaseOpenSearchServerlessServiceLayer.pipe( @@ -750,8 +801,7 @@ export const OpenSearchServerlessServiceLayer = /** * @since 1.0.0 * @category layers + * @deprecated use OpenSearchServerless.defaultLayer instead */ export const DefaultOpenSearchServerlessServiceLayer = - OpenSearchServerlessServiceLayer.pipe( - Layer.provide(DefaultOpenSearchServerlessClientConfigLayer), - ); + OpenSearchServerlessService.defaultLayer; diff --git a/packages/client-opensearch-serverless/test/OpenSearchServerless.test.ts b/packages/client-opensearch-serverless/test/OpenSearchServerless.test.ts index ab59206..b39f33d 100644 --- a/packages/client-opensearch-serverless/test/OpenSearchServerless.test.ts +++ b/packages/client-opensearch-serverless/test/OpenSearchServerless.test.ts @@ -4,39 +4,41 @@ import { OpenSearchServerlessClient, OpenSearchServerlessServiceException, } from "@aws-sdk/client-opensearchserverless"; +// @ts-ignore +import * as runtimeConfig from "@aws-sdk/client-opensearchserverless/dist-cjs/runtimeConfig"; import { mockClient } from "aws-sdk-client-mock"; import * as Effect from "effect/Effect"; import * as Exit from "effect/Exit"; import { pipe } from "effect/Function"; -import * as Layer from "effect/Layer"; -import { - BaseOpenSearchServerlessServiceLayer, - DefaultOpenSearchServerlessClientConfigLayer, - DefaultOpenSearchServerlessServiceLayer, - OpenSearchServerlessClientInstance, - OpenSearchServerlessClientInstanceConfig, - OpenSearchServerlessService, - OpenSearchServerlessServiceLayer, - SdkError, -} from "../src"; +import { afterEach, describe, expect, it, vi } from "vitest"; +import { OpenSearchServerless, SdkError } from "../src"; +const getRuntimeConfig = vi.spyOn(runtimeConfig, "getRuntimeConfig"); const clientMock = mockClient(OpenSearchServerlessClient); describe("OpenSearchServerlessClientImpl", () => { + afterEach(() => { + getRuntimeConfig.mockClear(); + }); + it("default", async () => { clientMock.reset().on(ListCollectionsCommand).resolves({}); const args = {} as unknown as ListCollectionsCommandInput; - const program = OpenSearchServerlessService.listCollections(args); + const program = OpenSearchServerless.listCollections(args); const result = await pipe( program, - Effect.provide(DefaultOpenSearchServerlessServiceLayer), + Effect.provide(OpenSearchServerless.defaultLayer), Effect.runPromiseExit, ); expect(result).toEqual(Exit.succeed({})); + expect(getRuntimeConfig).toHaveBeenCalledTimes(1); + expect(getRuntimeConfig).toHaveBeenCalledWith({ + logger: expect.any(Object), + }); expect(clientMock).toHaveReceivedCommandTimes(ListCollectionsCommand, 1); expect(clientMock).toHaveReceivedCommandWith(ListCollectionsCommand, args); }); @@ -46,26 +48,20 @@ describe("OpenSearchServerlessClientImpl", () => { const args = {} as unknown as ListCollectionsCommandInput; - const program = OpenSearchServerlessService.listCollections(args); - - const OpenSearchServerlessClientConfigLayer = Layer.succeed( - OpenSearchServerlessClientInstanceConfig, - { - region: "eu-central-1", - }, - ); - const CustomOpenSearchServerlessServiceLayer = - OpenSearchServerlessServiceLayer.pipe( - Layer.provide(OpenSearchServerlessClientConfigLayer), - ); + const program = OpenSearchServerless.listCollections(args); const result = await pipe( program, - Effect.provide(CustomOpenSearchServerlessServiceLayer), + Effect.provide(OpenSearchServerless.layer({ region: "eu-central-1" })), Effect.runPromiseExit, ); expect(result).toEqual(Exit.succeed({})); + expect(getRuntimeConfig).toHaveBeenCalledTimes(1); + expect(getRuntimeConfig).toHaveBeenCalledWith({ + region: "eu-central-1", + logger: expect.any(Object), + }); expect(clientMock).toHaveReceivedCommandTimes(ListCollectionsCommand, 1); expect(clientMock).toHaveReceivedCommandWith(ListCollectionsCommand, args); }); @@ -75,24 +71,23 @@ describe("OpenSearchServerlessClientImpl", () => { const args = {} as unknown as ListCollectionsCommandInput; - const program = OpenSearchServerlessService.listCollections(args); - - const OpenSearchServerlessClientInstanceLayer = Layer.succeed( - OpenSearchServerlessClientInstance, - new OpenSearchServerlessClient({ region: "eu-central-1" }), - ); - const CustomOpenSearchServerlessServiceLayer = - BaseOpenSearchServerlessServiceLayer.pipe( - Layer.provide(OpenSearchServerlessClientInstanceLayer), - ); + const program = OpenSearchServerless.listCollections(args); const result = await pipe( program, - Effect.provide(CustomOpenSearchServerlessServiceLayer), + Effect.provide( + OpenSearchServerless.baseLayer( + () => new OpenSearchServerlessClient({ region: "eu-central-1" }), + ), + ), Effect.runPromiseExit, ); expect(result).toEqual(Exit.succeed({})); + expect(getRuntimeConfig).toHaveBeenCalledTimes(1); + expect(getRuntimeConfig).toHaveBeenCalledWith({ + region: "eu-central-1", + }); expect(clientMock).toHaveReceivedCommandTimes(ListCollectionsCommand, 1); expect(clientMock).toHaveReceivedCommandWith(ListCollectionsCommand, args); }); @@ -102,29 +97,28 @@ describe("OpenSearchServerlessClientImpl", () => { const args = {} as unknown as ListCollectionsCommandInput; - const program = OpenSearchServerlessService.listCollections(args); - - const OpenSearchServerlessClientInstanceLayer = Layer.effect( - OpenSearchServerlessClientInstance, - Effect.map( - OpenSearchServerlessClientInstanceConfig, - (config) => - new OpenSearchServerlessClient({ ...config, region: "eu-central-1" }), - ), - ); - const CustomOpenSearchServerlessServiceLayer = - BaseOpenSearchServerlessServiceLayer.pipe( - Layer.provide(OpenSearchServerlessClientInstanceLayer), - Layer.provide(DefaultOpenSearchServerlessClientConfigLayer), - ); + const program = OpenSearchServerless.listCollections(args); const result = await pipe( program, - Effect.provide(CustomOpenSearchServerlessServiceLayer), + Effect.provide( + OpenSearchServerless.baseLayer( + (config) => + new OpenSearchServerlessClient({ + ...config, + region: "eu-central-1", + }), + ), + ), Effect.runPromiseExit, ); expect(result).toEqual(Exit.succeed({})); + expect(getRuntimeConfig).toHaveBeenCalledTimes(1); + expect(getRuntimeConfig).toHaveBeenCalledWith({ + region: "eu-central-1", + logger: expect.any(Object), + }); expect(clientMock).toHaveReceivedCommandTimes(ListCollectionsCommand, 1); expect(clientMock).toHaveReceivedCommandWith(ListCollectionsCommand, args); }); @@ -134,11 +128,11 @@ describe("OpenSearchServerlessClientImpl", () => { const args = {} as unknown as ListCollectionsCommandInput; - const program = OpenSearchServerlessService.listCollections(args); + const program = OpenSearchServerless.listCollections(args); const result = await pipe( program, - Effect.provide(DefaultOpenSearchServerlessServiceLayer), + Effect.provide(OpenSearchServerless.defaultLayer), Effect.runPromiseExit, ); @@ -169,13 +163,13 @@ describe("OpenSearchServerlessClientImpl", () => { const args = {} as unknown as ListCollectionsCommandInput; - const program = OpenSearchServerlessService.listCollections(args).pipe( + const program = OpenSearchServerless.listCollections(args).pipe( Effect.catchTag("NotHandledException" as any, () => Effect.succeed(null)), ); const result = await pipe( program, - Effect.provide(DefaultOpenSearchServerlessServiceLayer), + Effect.provide(OpenSearchServerless.defaultLayer), Effect.runPromiseExit, ); diff --git a/packages/client-opensearch/README.md b/packages/client-opensearch/README.md index 4880344..6849f4c 100644 --- a/packages/client-opensearch/README.md +++ b/packages/client-opensearch/README.md @@ -14,13 +14,13 @@ npm install --save @effect-aws/client-opensearch With default OpenSearchClient instance: ```typescript -import { OpenSearchService, DefaultOpenSearchServiceLayer } from "@effect-aws/client-opensearch"; +import { OpenSearch } from "@effect-aws/client-opensearch"; -const program = OpenSearchService.describeDomains(args); +const program = OpenSearch.describeDomains(args); const result = pipe( program, - Effect.provide(DefaultOpenSearchServiceLayer), + Effect.provide(OpenSearch.defaultLayer), Effect.runPromise, ); ``` @@ -28,23 +28,15 @@ const result = pipe( With custom OpenSearchClient instance: ```typescript -import { - OpenSearchService, - BaseOpenSearchServiceLayer, - OpenSearchClientInstance, -} from "@effect-aws/client-opensearch"; +import { OpenSearch } from "@effect-aws/client-opensearch"; -const program = OpenSearchService.describeDomains(args); - -const OpenSearchClientInstanceLayer = Layer.succeed( - OpenSearchClientInstance, - new OpenSearchClient({ region: "eu-central-1" }), -); +const program = OpenSearch.describeDomains(args); const result = await pipe( program, - Effect.provide(BaseOpenSearchServiceLayer), - Effect.provide(OpenSearchClientInstanceLayer), + Effect.provide( + OpenSearch.baseLayer(() => new OpenSearchClient({ region: "eu-central-1" })), + ), Effect.runPromise, ); ``` @@ -52,34 +44,15 @@ const result = await pipe( With custom OpenSearchClient configuration: ```typescript -import { - OpenSearchService, - BaseOpenSearchServiceLayer, - DefaultOpenSearchClientConfigLayer, - OpenSearchClientInstance, - OpenSearchClientInstanceConfig, -} from "@effect-aws/client-opensearch"; - -const program = OpenSearchService.describeDomains(args); - -const OpenSearchClientInstanceLayer = Layer.provide( - Layer.effect( - OpenSearchClientInstance, - OpenSearchClientInstanceConfig.pipe( - Effect.map( - (config) => new OpenSearchClient({ ...config, region: "eu-central-1" }), - ), - ), - ), - DefaultOpenSearchClientConfigLayer, -); +import { OpenSearch } from "@effect-aws/client-opensearch"; + +const program = OpenSearch.describeDomains(args); const result = await pipe( program, - Effect.provide(BaseOpenSearchServiceLayer), - Effect.provide(OpenSearchClientInstanceLayer), + Effect.provide(OpenSearch.layer({ region: "eu-central-1" })), Effect.runPromiseExit, ); ``` -or map over `DefaultOpenSearchClientConfigLayer` layer context and update the configuration... +or use `OpenSearch.baseLayer((default) => new OpenSearchClient({ ...default, region: "eu-central-1" }))` diff --git a/packages/client-opensearch/src/OpenSearchService.ts b/packages/client-opensearch/src/OpenSearchService.ts index 8c3118c..54749fb 100644 --- a/packages/client-opensearch/src/OpenSearchService.ts +++ b/packages/client-opensearch/src/OpenSearchService.ts @@ -3,6 +3,8 @@ */ import { OpenSearchServiceException, + type OpenSearchClient, + type OpenSearchClientConfig, AcceptInboundConnectionCommand, type AcceptInboundConnectionCommandInput, type AcceptInboundConnectionCommandOutput, @@ -231,10 +233,14 @@ import { OpenSearchClientInstance, OpenSearchClientInstanceLayer, } from "./OpenSearchClientInstance"; -import { DefaultOpenSearchClientConfigLayer } from "./OpenSearchClientInstanceConfig"; +import { + DefaultOpenSearchClientConfigLayer, + makeDefaultOpenSearchClientInstanceConfig, + OpenSearchClientInstanceConfig, +} from "./OpenSearchClientInstanceConfig"; /** - * @since 1.0.1 + * @since 1.0.0 */ export interface HttpHandlerOptions { /** @@ -1369,14 +1375,6 @@ interface OpenSearchService$ { >; } -/** - * @since 1.0.0 - * @category models - */ -export class OpenSearchService extends Effect.Tag( - "@effect-aws/client-opensearch/OpenSearchService", -)() {} - /** * @since 1.0.0 * @category constructors @@ -1427,9 +1425,53 @@ export const makeOpenSearchService = Effect.gen(function* (_) { }, {}) as OpenSearchService$; }); +/** + * @since 1.0.0 + * @category models + */ +export class OpenSearchService extends Effect.Tag( + "@effect-aws/client-opensearch/OpenSearchService", +)() { + static readonly defaultLayer = Layer.effect(this, makeOpenSearchService).pipe( + Layer.provide(OpenSearchClientInstanceLayer), + Layer.provide(DefaultOpenSearchClientConfigLayer), + ); + static readonly layer = (config: OpenSearchClientConfig) => + Layer.effect(this, makeOpenSearchService).pipe( + Layer.provide(OpenSearchClientInstanceLayer), + Layer.provide( + Layer.effect( + OpenSearchClientInstanceConfig, + makeDefaultOpenSearchClientInstanceConfig.pipe( + Effect.map((defaultConfig) => ({ ...defaultConfig, ...config })), + ), + ), + ), + ); + static readonly baseLayer = ( + evaluate: (defaultConfig: OpenSearchClientConfig) => OpenSearchClient, + ) => + Layer.effect(this, makeOpenSearchService).pipe( + Layer.provide( + Layer.effect( + OpenSearchClientInstance, + Effect.map(makeDefaultOpenSearchClientInstanceConfig, evaluate), + ), + ), + ); +} + +/** + * @since 1.0.0 + * @category models + * @alias OpenSearchService + */ +export const OpenSearch = OpenSearchService; + /** * @since 1.0.0 * @category layers + * @deprecated use OpenSearch.baseLayer instead */ export const BaseOpenSearchServiceLayer = Layer.effect( OpenSearchService, @@ -1439,6 +1481,7 @@ export const BaseOpenSearchServiceLayer = Layer.effect( /** * @since 1.0.0 * @category layers + * @deprecated use OpenSearch.layer instead */ export const OpenSearchServiceLayer = BaseOpenSearchServiceLayer.pipe( Layer.provide(OpenSearchClientInstanceLayer), @@ -1447,7 +1490,6 @@ export const OpenSearchServiceLayer = BaseOpenSearchServiceLayer.pipe( /** * @since 1.0.0 * @category layers + * @deprecated use OpenSearch.defaultLayer instead */ -export const DefaultOpenSearchServiceLayer = OpenSearchServiceLayer.pipe( - Layer.provide(DefaultOpenSearchClientConfigLayer), -); +export const DefaultOpenSearchServiceLayer = OpenSearchService.defaultLayer; diff --git a/packages/client-opensearch/test/OpenSearch.test.ts b/packages/client-opensearch/test/OpenSearch.test.ts index f9e2719..3571c55 100644 --- a/packages/client-opensearch/test/OpenSearch.test.ts +++ b/packages/client-opensearch/test/OpenSearch.test.ts @@ -4,39 +4,41 @@ import { OpenSearchClient, OpenSearchServiceException, } from "@aws-sdk/client-opensearch"; +// @ts-ignore +import * as runtimeConfig from "@aws-sdk/client-opensearch/dist-cjs/runtimeConfig"; import { mockClient } from "aws-sdk-client-mock"; import * as Effect from "effect/Effect"; import * as Exit from "effect/Exit"; import { pipe } from "effect/Function"; -import * as Layer from "effect/Layer"; -import { - BaseOpenSearchServiceLayer, - DefaultOpenSearchClientConfigLayer, - DefaultOpenSearchServiceLayer, - OpenSearchClientInstance, - OpenSearchClientInstanceConfig, - OpenSearchService, - OpenSearchServiceLayer, - SdkError, -} from "../src"; +import { afterEach, describe, expect, it, vi } from "vitest"; +import { OpenSearch, SdkError } from "../src"; +const getRuntimeConfig = vi.spyOn(runtimeConfig, "getRuntimeConfig"); const clientMock = mockClient(OpenSearchClient); describe("OpenSearchClientImpl", () => { + afterEach(() => { + getRuntimeConfig.mockClear(); + }); + it("default", async () => { clientMock.reset().on(DescribeDomainsCommand).resolves({}); const args = {} as unknown as DescribeDomainsCommandInput; - const program = OpenSearchService.describeDomains(args); + const program = OpenSearch.describeDomains(args); const result = await pipe( program, - Effect.provide(DefaultOpenSearchServiceLayer), + Effect.provide(OpenSearch.defaultLayer), Effect.runPromiseExit, ); expect(result).toEqual(Exit.succeed({})); + expect(getRuntimeConfig).toHaveBeenCalledTimes(1); + expect(getRuntimeConfig).toHaveBeenCalledWith({ + logger: expect.any(Object), + }); expect(clientMock).toHaveReceivedCommandTimes(DescribeDomainsCommand, 1); expect(clientMock).toHaveReceivedCommandWith(DescribeDomainsCommand, args); }); @@ -46,25 +48,20 @@ describe("OpenSearchClientImpl", () => { const args = {} as unknown as DescribeDomainsCommandInput; - const program = OpenSearchService.describeDomains(args); - - const OpenSearchClientConfigLayer = Layer.succeed( - OpenSearchClientInstanceConfig, - { - region: "eu-central-1", - }, - ); - const CustomOpenSearchServiceLayer = OpenSearchServiceLayer.pipe( - Layer.provide(OpenSearchClientConfigLayer), - ); + const program = OpenSearch.describeDomains(args); const result = await pipe( program, - Effect.provide(CustomOpenSearchServiceLayer), + Effect.provide(OpenSearch.layer({ region: "eu-central-1" })), Effect.runPromiseExit, ); expect(result).toEqual(Exit.succeed({})); + expect(getRuntimeConfig).toHaveBeenCalledTimes(1); + expect(getRuntimeConfig).toHaveBeenCalledWith({ + region: "eu-central-1", + logger: expect.any(Object), + }); expect(clientMock).toHaveReceivedCommandTimes(DescribeDomainsCommand, 1); expect(clientMock).toHaveReceivedCommandWith(DescribeDomainsCommand, args); }); @@ -74,23 +71,23 @@ describe("OpenSearchClientImpl", () => { const args = {} as unknown as DescribeDomainsCommandInput; - const program = OpenSearchService.describeDomains(args); - - const OpenSearchClientInstanceLayer = Layer.succeed( - OpenSearchClientInstance, - new OpenSearchClient({ region: "eu-central-1" }), - ); - const CustomOpenSearchServiceLayer = BaseOpenSearchServiceLayer.pipe( - Layer.provide(OpenSearchClientInstanceLayer), - ); + const program = OpenSearch.describeDomains(args); const result = await pipe( program, - Effect.provide(CustomOpenSearchServiceLayer), + Effect.provide( + OpenSearch.baseLayer( + () => new OpenSearchClient({ region: "eu-central-1" }), + ), + ), Effect.runPromiseExit, ); expect(result).toEqual(Exit.succeed({})); + expect(getRuntimeConfig).toHaveBeenCalledTimes(1); + expect(getRuntimeConfig).toHaveBeenCalledWith({ + region: "eu-central-1", + }); expect(clientMock).toHaveReceivedCommandTimes(DescribeDomainsCommand, 1); expect(clientMock).toHaveReceivedCommandWith(DescribeDomainsCommand, args); }); @@ -100,27 +97,25 @@ describe("OpenSearchClientImpl", () => { const args = {} as unknown as DescribeDomainsCommandInput; - const program = OpenSearchService.describeDomains(args); - - const OpenSearchClientInstanceLayer = Layer.effect( - OpenSearchClientInstance, - Effect.map( - OpenSearchClientInstanceConfig, - (config) => new OpenSearchClient({ ...config, region: "eu-central-1" }), - ), - ); - const CustomOpenSearchServiceLayer = BaseOpenSearchServiceLayer.pipe( - Layer.provide(OpenSearchClientInstanceLayer), - Layer.provide(DefaultOpenSearchClientConfigLayer), - ); + const program = OpenSearch.describeDomains(args); const result = await pipe( program, - Effect.provide(CustomOpenSearchServiceLayer), + Effect.provide( + OpenSearch.baseLayer( + (config) => + new OpenSearchClient({ ...config, region: "eu-central-1" }), + ), + ), Effect.runPromiseExit, ); expect(result).toEqual(Exit.succeed({})); + expect(getRuntimeConfig).toHaveBeenCalledTimes(1); + expect(getRuntimeConfig).toHaveBeenCalledWith({ + region: "eu-central-1", + logger: expect.any(Object), + }); expect(clientMock).toHaveReceivedCommandTimes(DescribeDomainsCommand, 1); expect(clientMock).toHaveReceivedCommandWith(DescribeDomainsCommand, args); }); @@ -130,11 +125,11 @@ describe("OpenSearchClientImpl", () => { const args = {} as unknown as DescribeDomainsCommandInput; - const program = OpenSearchService.describeDomains(args); + const program = OpenSearch.describeDomains(args); const result = await pipe( program, - Effect.provide(DefaultOpenSearchServiceLayer), + Effect.provide(OpenSearch.defaultLayer), Effect.runPromiseExit, ); @@ -165,13 +160,13 @@ describe("OpenSearchClientImpl", () => { const args = {} as unknown as DescribeDomainsCommandInput; - const program = OpenSearchService.describeDomains(args).pipe( + const program = OpenSearch.describeDomains(args).pipe( Effect.catchTag("NotHandledException" as any, () => Effect.succeed(null)), ); const result = await pipe( program, - Effect.provide(DefaultOpenSearchServiceLayer), + Effect.provide(OpenSearch.defaultLayer), Effect.runPromiseExit, ); diff --git a/packages/client-rds/README.md b/packages/client-rds/README.md index 04c05ce..3769ee5 100644 --- a/packages/client-rds/README.md +++ b/packages/client-rds/README.md @@ -14,13 +14,13 @@ npm install --save @effect-aws/client-rds With default RDSClient instance: ```typescript -import { RDSService, DefaultRDSServiceLayer } from "@effect-aws/client-rds"; +import { RDS } from "@effect-aws/client-rds"; -const program = RDSService.describeDBClusters(args); +const program = RDS.describeDBInstances(args); const result = pipe( program, - Effect.provide(DefaultRDSServiceLayer), + Effect.provide(RDS.defaultLayer), Effect.runPromise, ); ``` @@ -28,23 +28,15 @@ const result = pipe( With custom RDSClient instance: ```typescript -import { - RDSService, - BaseRDSServiceLayer, - RDSClientInstance, -} from "@effect-aws/client-rds"; +import { RDS } from "@effect-aws/client-rds"; -const program = RDSService.describeDBClusters(args); - -const RDSClientInstanceLayer = Layer.succeed( - RDSClientInstance, - new RDSClient({ region: "eu-central-1" }), -); +const program = RDS.describeDBInstances(args); const result = await pipe( program, - Effect.provide(BaseRDSServiceLayer), - Effect.provide(RDSClientInstanceLayer), + Effect.provide( + RDS.baseLayer(() => new RDSClient({ region: "eu-central-1" })), + ), Effect.runPromise, ); ``` @@ -52,34 +44,15 @@ const result = await pipe( With custom RDSClient configuration: ```typescript -import { - RDSService, - BaseRDSServiceLayer, - DefaultRDSClientConfigLayer, - RDSClientInstance, - RDSClientInstanceConfig, -} from "@effect-aws/client-rds"; - -const program = RDSService.describeDBClusters(args); - -const RDSClientInstanceLayer = Layer.provide( - Layer.effect( - RDSClientInstance, - RDSClientInstanceConfig.pipe( - Effect.map( - (config) => new RDSClient({ ...config, region: "eu-central-1" }), - ), - ), - ), - DefaultRDSClientConfigLayer, -); +import { RDS } from "@effect-aws/client-rds"; + +const program = RDS.describeDBInstances(args); const result = await pipe( program, - Effect.provide(BaseRDSServiceLayer), - Effect.provide(RDSClientInstanceLayer), + Effect.provide(RDS.layer({ region: "eu-central-1" })), Effect.runPromiseExit, ); ``` -or map over `DefaultRDSClientConfigLayer` layer context and update the configuration... +or use `RDS.baseLayer((default) => new RDSClient({ ...default, region: "eu-central-1" }))` diff --git a/packages/client-rds/src/RDSService.ts b/packages/client-rds/src/RDSService.ts index 5635df6..76cc90f 100644 --- a/packages/client-rds/src/RDSService.ts +++ b/packages/client-rds/src/RDSService.ts @@ -3,6 +3,8 @@ */ import { RDSServiceException, + type RDSClient, + type RDSClientConfig, AddRoleToDBClusterCommand, type AddRoleToDBClusterCommandInput, type AddRoleToDBClusterCommandOutput, @@ -641,10 +643,14 @@ import { TaggedException, } from "./Errors"; import { RDSClientInstance, RDSClientInstanceLayer } from "./RDSClientInstance"; -import { DefaultRDSClientConfigLayer } from "./RDSClientInstanceConfig"; +import { + DefaultRDSClientConfigLayer, + makeDefaultRDSClientInstanceConfig, + RDSClientInstanceConfig, +} from "./RDSClientInstanceConfig"; /** - * @since 1.0.1 + * @since 1.0.0 */ export interface HttpHandlerOptions { /** @@ -3160,15 +3166,6 @@ interface RDSService$ { >; } -/** - * @since 1.0.0 - * @category models - */ -export class RDSService extends Effect.Tag("@effect-aws/client-rds/RDSService")< - RDSService, - RDSService$ ->() {} - /** * @since 1.0.0 * @category constructors @@ -3219,15 +3216,61 @@ export const makeRDSService = Effect.gen(function* (_) { }, {}) as RDSService$; }); +/** + * @since 1.0.0 + * @category models + */ +export class RDSService extends Effect.Tag("@effect-aws/client-rds/RDSService")< + RDSService, + RDSService$ +>() { + static readonly defaultLayer = Layer.effect(this, makeRDSService).pipe( + Layer.provide(RDSClientInstanceLayer), + Layer.provide(DefaultRDSClientConfigLayer), + ); + static readonly layer = (config: RDSClientConfig) => + Layer.effect(this, makeRDSService).pipe( + Layer.provide(RDSClientInstanceLayer), + Layer.provide( + Layer.effect( + RDSClientInstanceConfig, + makeDefaultRDSClientInstanceConfig.pipe( + Effect.map((defaultConfig) => ({ ...defaultConfig, ...config })), + ), + ), + ), + ); + static readonly baseLayer = ( + evaluate: (defaultConfig: RDSClientConfig) => RDSClient, + ) => + Layer.effect(this, makeRDSService).pipe( + Layer.provide( + Layer.effect( + RDSClientInstance, + Effect.map(makeDefaultRDSClientInstanceConfig, evaluate), + ), + ), + ); +} + +/** + * @since 1.0.0 + * @category models + * @alias RDSService + */ +export const RDS = RDSService; + /** * @since 1.0.0 * @category layers + * @deprecated use RDS.baseLayer instead */ export const BaseRDSServiceLayer = Layer.effect(RDSService, makeRDSService); /** * @since 1.0.0 * @category layers + * @deprecated use RDS.layer instead */ export const RDSServiceLayer = BaseRDSServiceLayer.pipe( Layer.provide(RDSClientInstanceLayer), @@ -3236,7 +3279,6 @@ export const RDSServiceLayer = BaseRDSServiceLayer.pipe( /** * @since 1.0.0 * @category layers + * @deprecated use RDS.defaultLayer instead */ -export const DefaultRDSServiceLayer = RDSServiceLayer.pipe( - Layer.provide(DefaultRDSClientConfigLayer), -); +export const DefaultRDSServiceLayer = RDSService.defaultLayer; diff --git a/packages/client-rds/test/RDS.test.ts b/packages/client-rds/test/RDS.test.ts index 8c0b12e..0d0e9c8 100644 --- a/packages/client-rds/test/RDS.test.ts +++ b/packages/client-rds/test/RDS.test.ts @@ -1,149 +1,159 @@ import { - type DescribeDBClustersCommandInput, - DescribeDBClustersCommand, + type DescribeDBInstancesCommandInput, + DescribeDBInstancesCommand, RDSClient, RDSServiceException, } from "@aws-sdk/client-rds"; +// @ts-ignore +import * as runtimeConfig from "@aws-sdk/client-rds/dist-cjs/runtimeConfig"; import { mockClient } from "aws-sdk-client-mock"; import * as Effect from "effect/Effect"; import * as Exit from "effect/Exit"; import { pipe } from "effect/Function"; -import * as Layer from "effect/Layer"; -import { - BaseRDSServiceLayer, - DefaultRDSClientConfigLayer, - DefaultRDSServiceLayer, - RDSClientInstance, - RDSClientInstanceConfig, - RDSService, - RDSServiceLayer, - SdkError, -} from "../src"; +import { afterEach, describe, expect, it, vi } from "vitest"; +import { RDS, SdkError } from "../src"; +const getRuntimeConfig = vi.spyOn(runtimeConfig, "getRuntimeConfig"); const clientMock = mockClient(RDSClient); describe("RDSClientImpl", () => { + afterEach(() => { + getRuntimeConfig.mockClear(); + }); + it("default", async () => { - clientMock.reset().on(DescribeDBClustersCommand).resolves({}); + clientMock.reset().on(DescribeDBInstancesCommand).resolves({}); - const args = {} as unknown as DescribeDBClustersCommandInput; + const args = {} as unknown as DescribeDBInstancesCommandInput; - const program = RDSService.describeDBClusters(args); + const program = RDS.describeDBInstances(args); const result = await pipe( program, - Effect.provide(DefaultRDSServiceLayer), + Effect.provide(RDS.defaultLayer), Effect.runPromiseExit, ); expect(result).toEqual(Exit.succeed({})); - expect(clientMock).toHaveReceivedCommandTimes(DescribeDBClustersCommand, 1); + expect(getRuntimeConfig).toHaveBeenCalledTimes(1); + expect(getRuntimeConfig).toHaveBeenCalledWith({ + logger: expect.any(Object), + }); + expect(clientMock).toHaveReceivedCommandTimes( + DescribeDBInstancesCommand, + 1, + ); expect(clientMock).toHaveReceivedCommandWith( - DescribeDBClustersCommand, + DescribeDBInstancesCommand, args, ); }); it("configurable", async () => { - clientMock.reset().on(DescribeDBClustersCommand).resolves({}); - - const args = {} as unknown as DescribeDBClustersCommandInput; + clientMock.reset().on(DescribeDBInstancesCommand).resolves({}); - const program = RDSService.describeDBClusters(args); + const args = {} as unknown as DescribeDBInstancesCommandInput; - const RDSClientConfigLayer = Layer.succeed(RDSClientInstanceConfig, { - region: "eu-central-1", - }); - const CustomRDSServiceLayer = RDSServiceLayer.pipe( - Layer.provide(RDSClientConfigLayer), - ); + const program = RDS.describeDBInstances(args); const result = await pipe( program, - Effect.provide(CustomRDSServiceLayer), + Effect.provide(RDS.layer({ region: "eu-central-1" })), Effect.runPromiseExit, ); expect(result).toEqual(Exit.succeed({})); - expect(clientMock).toHaveReceivedCommandTimes(DescribeDBClustersCommand, 1); + expect(getRuntimeConfig).toHaveBeenCalledTimes(1); + expect(getRuntimeConfig).toHaveBeenCalledWith({ + region: "eu-central-1", + logger: expect.any(Object), + }); + expect(clientMock).toHaveReceivedCommandTimes( + DescribeDBInstancesCommand, + 1, + ); expect(clientMock).toHaveReceivedCommandWith( - DescribeDBClustersCommand, + DescribeDBInstancesCommand, args, ); }); it("base", async () => { - clientMock.reset().on(DescribeDBClustersCommand).resolves({}); + clientMock.reset().on(DescribeDBInstancesCommand).resolves({}); - const args = {} as unknown as DescribeDBClustersCommandInput; + const args = {} as unknown as DescribeDBInstancesCommandInput; - const program = RDSService.describeDBClusters(args); - - const RDSClientInstanceLayer = Layer.succeed( - RDSClientInstance, - new RDSClient({ region: "eu-central-1" }), - ); - const CustomRDSServiceLayer = BaseRDSServiceLayer.pipe( - Layer.provide(RDSClientInstanceLayer), - ); + const program = RDS.describeDBInstances(args); const result = await pipe( program, - Effect.provide(CustomRDSServiceLayer), + Effect.provide( + RDS.baseLayer(() => new RDSClient({ region: "eu-central-1" })), + ), Effect.runPromiseExit, ); expect(result).toEqual(Exit.succeed({})); - expect(clientMock).toHaveReceivedCommandTimes(DescribeDBClustersCommand, 1); + expect(getRuntimeConfig).toHaveBeenCalledTimes(1); + expect(getRuntimeConfig).toHaveBeenCalledWith({ + region: "eu-central-1", + }); + expect(clientMock).toHaveReceivedCommandTimes( + DescribeDBInstancesCommand, + 1, + ); expect(clientMock).toHaveReceivedCommandWith( - DescribeDBClustersCommand, + DescribeDBInstancesCommand, args, ); }); it("extended", async () => { - clientMock.reset().on(DescribeDBClustersCommand).resolves({}); - - const args = {} as unknown as DescribeDBClustersCommandInput; + clientMock.reset().on(DescribeDBInstancesCommand).resolves({}); - const program = RDSService.describeDBClusters(args); + const args = {} as unknown as DescribeDBInstancesCommandInput; - const RDSClientInstanceLayer = Layer.effect( - RDSClientInstance, - Effect.map( - RDSClientInstanceConfig, - (config) => new RDSClient({ ...config, region: "eu-central-1" }), - ), - ); - const CustomRDSServiceLayer = BaseRDSServiceLayer.pipe( - Layer.provide(RDSClientInstanceLayer), - Layer.provide(DefaultRDSClientConfigLayer), - ); + const program = RDS.describeDBInstances(args); const result = await pipe( program, - Effect.provide(CustomRDSServiceLayer), + Effect.provide( + RDS.baseLayer( + (config) => new RDSClient({ ...config, region: "eu-central-1" }), + ), + ), Effect.runPromiseExit, ); expect(result).toEqual(Exit.succeed({})); - expect(clientMock).toHaveReceivedCommandTimes(DescribeDBClustersCommand, 1); + expect(getRuntimeConfig).toHaveBeenCalledTimes(1); + expect(getRuntimeConfig).toHaveBeenCalledWith({ + region: "eu-central-1", + logger: expect.any(Object), + }); + expect(clientMock).toHaveReceivedCommandTimes( + DescribeDBInstancesCommand, + 1, + ); expect(clientMock).toHaveReceivedCommandWith( - DescribeDBClustersCommand, + DescribeDBInstancesCommand, args, ); }); it("fail", async () => { - clientMock.reset().on(DescribeDBClustersCommand).rejects(new Error("test")); + clientMock + .reset() + .on(DescribeDBInstancesCommand) + .rejects(new Error("test")); - const args = {} as unknown as DescribeDBClustersCommandInput; + const args = {} as unknown as DescribeDBInstancesCommandInput; - const program = RDSService.describeDBClusters(args); + const program = RDS.describeDBInstances(args); const result = await pipe( program, - Effect.provide(DefaultRDSServiceLayer), + Effect.provide(RDS.defaultLayer), Effect.runPromiseExit, ); @@ -157,9 +167,12 @@ describe("RDSClientImpl", () => { }), ), ); - expect(clientMock).toHaveReceivedCommandTimes(DescribeDBClustersCommand, 1); + expect(clientMock).toHaveReceivedCommandTimes( + DescribeDBInstancesCommand, + 1, + ); expect(clientMock).toHaveReceivedCommandWith( - DescribeDBClustersCommand, + DescribeDBInstancesCommand, args, ); }); @@ -167,7 +180,7 @@ describe("RDSClientImpl", () => { it("should not catch unexpected error as expected", async () => { clientMock .reset() - .on(DescribeDBClustersCommand) + .on(DescribeDBInstancesCommand) .rejects( new RDSServiceException({ name: "NotHandledException", @@ -175,15 +188,15 @@ describe("RDSClientImpl", () => { } as any), ); - const args = {} as unknown as DescribeDBClustersCommandInput; + const args = {} as unknown as DescribeDBInstancesCommandInput; - const program = RDSService.describeDBClusters(args).pipe( + const program = RDS.describeDBInstances(args).pipe( Effect.catchTag("NotHandledException" as any, () => Effect.succeed(null)), ); const result = await pipe( program, - Effect.provide(DefaultRDSServiceLayer), + Effect.provide(RDS.defaultLayer), Effect.runPromiseExit, ); @@ -197,9 +210,12 @@ describe("RDSClientImpl", () => { }), ), ); - expect(clientMock).toHaveReceivedCommandTimes(DescribeDBClustersCommand, 1); + expect(clientMock).toHaveReceivedCommandTimes( + DescribeDBInstancesCommand, + 1, + ); expect(clientMock).toHaveReceivedCommandWith( - DescribeDBClustersCommand, + DescribeDBInstancesCommand, args, ); }); diff --git a/packages/client-s3/README.md b/packages/client-s3/README.md index 53a4d6a..e20f255 100644 --- a/packages/client-s3/README.md +++ b/packages/client-s3/README.md @@ -14,13 +14,13 @@ npm install --save @effect-aws/client-s3 With default S3Client instance: ```typescript -import { S3Service, DefaultS3ServiceLayer } from "@effect-aws/client-s3"; +import { S3 } from "@effect-aws/client-s3"; -const program = Effect.flatMap(S3Service, (s3) => s3.headObject(args)); +const program = S3.headObject(args); const result = pipe( program, - Effect.provide(DefaultS3ServiceLayer), + Effect.provide(S3.defaultLayer), Effect.runPromise, ); ``` @@ -28,23 +28,15 @@ const result = pipe( With custom S3Client instance: ```typescript -import { - S3Service, - BaseS3ServiceLayer, - S3ClientInstance, -} from "@effect-aws/client-s3"; +import { S3 } from "@effect-aws/client-s3"; -const program = Effect.flatMap(S3Service, (s3) => s3.headObject(args)); - -const S3ClientInstanceLayer = Layer.succeed( - S3ClientInstance, - new S3Client({ region: "eu-central-1" }), -); +const program = S3.headObject(args); const result = await pipe( program, - Effect.provide(BaseS3ServiceLayer), - Effect.provide(S3ClientInstanceLayer), + Effect.provide( + S3.baseLayer(() => new S3Client({ region: "eu-central-1" })), + ), Effect.runPromise, ); ``` @@ -52,34 +44,15 @@ const result = await pipe( With custom S3Client configuration: ```typescript -import { - S3Service, - BaseS3ServiceLayer, - DefaultS3ClientConfigLayer, - S3ClientInstance, - S3ClientInstanceConfig, -} from "@effect-aws/client-s3"; - -const program = Effect.flatMap(S3Service, (s3) => s3.headObject(args)); - -const S3ClientInstanceLayer = Layer.provide( - Layer.effect( - S3ClientInstance, - S3ClientInstanceConfig.pipe( - Effect.map( - (config) => new S3Client({ ...config, region: "eu-central-1" }), - ), - ), - ), - DefaultS3ClientConfigLayer, -); +import { S3 } from "@effect-aws/client-s3"; + +const program = S3.headObject(args); const result = await pipe( program, - Effect.provide(BaseS3ServiceLayer), - Effect.provide(S3ClientInstanceLayer), + Effect.provide(S3.layer({ region: "eu-central-1" })), Effect.runPromiseExit, ); ``` -or map over `DefaultS3ClientConfigLayer` layer context and update the configuration... +or use `S3.baseLayer((default) => new S3Client({ ...default, region: "eu-central-1" }))` diff --git a/packages/client-s3/src/Errors.ts b/packages/client-s3/src/Errors.ts index 2558a19..a0fd4d6 100644 --- a/packages/client-s3/src/Errors.ts +++ b/packages/client-s3/src/Errors.ts @@ -1,5 +1,4 @@ import type { - S3ServiceException, BucketAlreadyExists, BucketAlreadyOwnedByYou, InvalidObjectState, @@ -9,8 +8,21 @@ import type { NotFound, ObjectAlreadyInActiveTierError as ObjectAlreadyInActiveTierException, ObjectNotInActiveTierError as ObjectNotInActiveTierException, + S3ServiceException, } from "@aws-sdk/client-s3"; -import * as Data from "effect/Data"; +import { Data } from "effect"; + +export const AllServiceErrors = [ + "BucketAlreadyExists", + "BucketAlreadyOwnedByYou", + "InvalidObjectState", + "NoSuchBucket", + "NoSuchKey", + "NoSuchUpload", + "NotFound", + "ObjectAlreadyInActiveTierError", + "ObjectNotInActiveTierError", +]; export type TaggedException = T & { readonly _tag: T["name"]; diff --git a/packages/client-s3/src/S3ClientInstanceConfig.ts b/packages/client-s3/src/S3ClientInstanceConfig.ts index 02a4eec..a4e2663 100644 --- a/packages/client-s3/src/S3ClientInstanceConfig.ts +++ b/packages/client-s3/src/S3ClientInstanceConfig.ts @@ -2,10 +2,7 @@ * @since 1.0.0 */ import type { S3ClientConfig } from "@aws-sdk/client-s3"; -import * as Context from "effect/Context"; -import * as Effect from "effect/Effect"; -import * as Layer from "effect/Layer"; -import * as Runtime from "effect/Runtime"; +import { Context, Effect, Layer, Runtime } from "effect"; /** * @since 1.0.0 diff --git a/packages/client-s3/src/S3Service.ts b/packages/client-s3/src/S3Service.ts index 9c979eb..ccd0326 100644 --- a/packages/client-s3/src/S3Service.ts +++ b/packages/client-s3/src/S3Service.ts @@ -2,7 +2,6 @@ * @since 1.0.0 */ import { - S3ServiceException, AbortMultipartUploadCommand, type AbortMultipartUploadCommandInput, type AbortMultipartUploadCommandOutput, @@ -21,12 +20,12 @@ import { CreateSessionCommand, type CreateSessionCommandInput, type CreateSessionCommandOutput, - DeleteBucketCommand, - type DeleteBucketCommandInput, - type DeleteBucketCommandOutput, DeleteBucketAnalyticsConfigurationCommand, type DeleteBucketAnalyticsConfigurationCommandInput, type DeleteBucketAnalyticsConfigurationCommandOutput, + DeleteBucketCommand, + type DeleteBucketCommandInput, + type DeleteBucketCommandOutput, DeleteBucketCorsCommand, type DeleteBucketCorsCommandInput, type DeleteBucketCorsCommandOutput, @@ -63,12 +62,12 @@ import { DeleteObjectCommand, type DeleteObjectCommandInput, type DeleteObjectCommandOutput, - DeleteObjectsCommand, - type DeleteObjectsCommandInput, - type DeleteObjectsCommandOutput, DeleteObjectTaggingCommand, type DeleteObjectTaggingCommandInput, type DeleteObjectTaggingCommandOutput, + DeleteObjectsCommand, + type DeleteObjectsCommandInput, + type DeleteObjectsCommandOutput, DeletePublicAccessBlockCommand, type DeletePublicAccessBlockCommandInput, type DeletePublicAccessBlockCommandOutput, @@ -132,15 +131,15 @@ import { GetBucketWebsiteCommand, type GetBucketWebsiteCommandInput, type GetBucketWebsiteCommandOutput, - GetObjectCommand, - type GetObjectCommandInput, - type GetObjectCommandOutput, GetObjectAclCommand, type GetObjectAclCommandInput, type GetObjectAclCommandOutput, GetObjectAttributesCommand, type GetObjectAttributesCommandInput, type GetObjectAttributesCommandOutput, + GetObjectCommand, + type GetObjectCommandInput, + type GetObjectCommandOutput, GetObjectLegalHoldCommand, type GetObjectLegalHoldCommandInput, type GetObjectLegalHoldCommandOutput, @@ -186,15 +185,15 @@ import { ListMultipartUploadsCommand, type ListMultipartUploadsCommandInput, type ListMultipartUploadsCommandOutput, + ListObjectVersionsCommand, + type ListObjectVersionsCommandInput, + type ListObjectVersionsCommandOutput, ListObjectsCommand, type ListObjectsCommandInput, type ListObjectsCommandOutput, ListObjectsV2Command, type ListObjectsV2CommandInput, type ListObjectsV2CommandOutput, - ListObjectVersionsCommand, - type ListObjectVersionsCommandInput, - type ListObjectVersionsCommandOutput, ListPartsCommand, type ListPartsCommandInput, type ListPartsCommandOutput, @@ -252,12 +251,12 @@ import { PutBucketWebsiteCommand, type PutBucketWebsiteCommandInput, type PutBucketWebsiteCommandOutput, - PutObjectCommand, - type PutObjectCommandInput, - type PutObjectCommandOutput, PutObjectAclCommand, type PutObjectAclCommandInput, type PutObjectAclCommandOutput, + PutObjectCommand, + type PutObjectCommandInput, + type PutObjectCommandOutput, PutObjectLegalHoldCommand, type PutObjectLegalHoldCommandInput, type PutObjectLegalHoldCommandOutput, @@ -276,6 +275,9 @@ import { RestoreObjectCommand, type RestoreObjectCommandInput, type RestoreObjectCommandOutput, + type S3Client, + type S3ClientConfig, + S3ServiceException, SelectObjectContentCommand, type SelectObjectContentCommandInput, type SelectObjectContentCommandOutput, @@ -307,10 +309,14 @@ import { TaggedException, } from "./Errors"; import { S3ClientInstance, S3ClientInstanceLayer } from "./S3ClientInstance"; -import { DefaultS3ClientConfigLayer } from "./S3ClientInstanceConfig"; +import { + DefaultS3ClientConfigLayer, + S3ClientInstanceConfig, + makeDefaultS3ClientInstanceConfig, +} from "./S3ClientInstanceConfig"; /** - * @since 1.4.1 + * @since 1.0.1 */ export interface HttpHandlerOptions { /** @@ -341,8 +347,8 @@ const commands = { DeleteBucketTaggingCommand, DeleteBucketWebsiteCommand, DeleteObjectCommand, - DeleteObjectsCommand, DeleteObjectTaggingCommand, + DeleteObjectsCommand, DeletePublicAccessBlockCommand, GetBucketAccelerateConfigurationCommand, GetBucketAclCommand, @@ -382,9 +388,9 @@ const commands = { ListBucketsCommand, ListDirectoryBucketsCommand, ListMultipartUploadsCommand, + ListObjectVersionsCommand, ListObjectsCommand, ListObjectsV2Command, - ListObjectVersionsCommand, ListPartsCommand, PutBucketAccelerateConfigurationCommand, PutBucketAclCommand, @@ -620,14 +626,6 @@ interface S3Service$ { options?: HttpHandlerOptions, ): Effect.Effect; - /** - * @see {@link DeleteObjectsCommand} - */ - deleteObjects( - args: DeleteObjectsCommandInput, - options?: HttpHandlerOptions, - ): Effect.Effect; - /** * @see {@link DeleteObjectTaggingCommand} */ @@ -636,6 +634,14 @@ interface S3Service$ { options?: HttpHandlerOptions, ): Effect.Effect; + /** + * @see {@link DeleteObjectsCommand} + */ + deleteObjects( + args: DeleteObjectsCommandInput, + options?: HttpHandlerOptions, + ): Effect.Effect; + /** * @see {@link DeletePublicAccessBlockCommand} */ @@ -1015,6 +1021,14 @@ interface S3Service$ { SdkError | S3ServiceError >; + /** + * @see {@link ListObjectVersionsCommand} + */ + listObjectVersions( + args: ListObjectVersionsCommandInput, + options?: HttpHandlerOptions, + ): Effect.Effect; + /** * @see {@link ListObjectsCommand} */ @@ -1031,14 +1045,6 @@ interface S3Service$ { options?: HttpHandlerOptions, ): Effect.Effect; - /** - * @see {@link ListObjectVersionsCommand} - */ - listObjectVersions( - args: ListObjectVersionsCommandInput, - options?: HttpHandlerOptions, - ): Effect.Effect; - /** * @see {@link ListPartsCommand} */ @@ -1334,15 +1340,6 @@ interface S3Service$ { >; } -/** - * @since 1.0.0 - * @category models - */ -export class S3Service extends Effect.Tag("@effect-aws/client-s3/S3Service")< - S3Service, - S3Service$ ->() {} - /** * @since 1.0.0 * @category constructors @@ -1403,15 +1400,61 @@ export const makeS3Service = Effect.gen(function* (_) { }, {}) as S3Service$; }); +/** + * @since 1.0.0 + * @category models + */ +export class S3Service extends Effect.Tag("@effect-aws/client-s3/S3Service")< + S3Service, + S3Service$ +>() { + static readonly defaultLayer = Layer.effect(this, makeS3Service).pipe( + Layer.provide(S3ClientInstanceLayer), + Layer.provide(DefaultS3ClientConfigLayer), + ); + static readonly layer = (config: S3ClientConfig) => + Layer.effect(this, makeS3Service).pipe( + Layer.provide(S3ClientInstanceLayer), + Layer.provide( + Layer.effect( + S3ClientInstanceConfig, + makeDefaultS3ClientInstanceConfig.pipe( + Effect.map((defaultConfig) => ({ ...defaultConfig, ...config })), + ), + ), + ), + ); + static readonly baseLayer = ( + evaluate: (defaultConfig: S3ClientConfig) => S3Client, + ) => + Layer.effect(this, makeS3Service).pipe( + Layer.provide( + Layer.effect( + S3ClientInstance, + Effect.map(makeDefaultS3ClientInstanceConfig, evaluate), + ), + ), + ); +} + +/** + * @since 1.0.0 + * @category models + * @alias S3Service + */ +export const S3 = S3Service; + /** * @since 1.0.0 * @category layers + * @deprecated use S3.baseLayer instead */ export const BaseS3ServiceLayer = Layer.effect(S3Service, makeS3Service); /** * @since 1.0.0 * @category layers + * @deprecated use S3.layer instead */ export const S3ServiceLayer = BaseS3ServiceLayer.pipe( Layer.provide(S3ClientInstanceLayer), @@ -1420,7 +1463,6 @@ export const S3ServiceLayer = BaseS3ServiceLayer.pipe( /** * @since 1.0.0 * @category layers + * @deprecated use S3.defaultLayer instead */ -export const DefaultS3ServiceLayer = S3ServiceLayer.pipe( - Layer.provide(DefaultS3ClientConfigLayer), -); +export const DefaultS3ServiceLayer = S3Service.defaultLayer; diff --git a/packages/client-s3/test/S3.test.ts b/packages/client-s3/test/S3.test.ts index 39c9f97..778327a 100644 --- a/packages/client-s3/test/S3.test.ts +++ b/packages/client-s3/test/S3.test.ts @@ -5,11 +5,14 @@ import { type HeadObjectCommandInput, S3Client, } from "@aws-sdk/client-s3"; +// @ts-ignore +import * as runtimeConfig from "@aws-sdk/client-s3/dist-cjs/runtimeConfig"; import { mockClient } from "aws-sdk-client-mock"; import * as Effect from "effect/Effect"; import * as Exit from "effect/Exit"; import { pipe } from "effect/Function"; -import * as Layer from "effect/Layer"; +import { afterEach, describe, expect, it, vi } from "vitest"; +import { S3, SdkError } from "../src"; const getSignedUrl = vi.hoisted(() => vi @@ -20,34 +23,32 @@ const getSignedUrl = vi.hoisted(() => ); vi.mock("@aws-sdk/s3-request-presigner", () => ({ getSignedUrl })); -import { - BaseS3ServiceLayer, - DefaultS3ClientConfigLayer, - DefaultS3ServiceLayer, - S3ClientInstance, - S3ClientInstanceConfig, - S3Service, - S3ServiceLayer, - SdkError, -} from "../src"; - +const getRuntimeConfig = vi.spyOn(runtimeConfig, "getRuntimeConfig"); const clientMock = mockClient(S3Client); describe("S3ClientImpl", () => { + afterEach(() => { + getRuntimeConfig.mockClear(); + }); + it("default", async () => { clientMock.reset().on(HeadObjectCommand).resolves({}); const args: HeadObjectCommandInput = { Key: "test", Bucket: "test" }; - const program = S3Service.headObject(args); + const program = S3.headObject(args); const result = await pipe( program, - Effect.provide(DefaultS3ServiceLayer), + Effect.provide(S3.defaultLayer), Effect.runPromiseExit, ); expect(result).toEqual(Exit.succeed({})); + expect(getRuntimeConfig).toHaveBeenCalledTimes(1); + expect(getRuntimeConfig).toHaveBeenCalledWith({ + logger: expect.any(Object), + }); expect(clientMock).toHaveReceivedCommandTimes(HeadObjectCommand, 1); expect(clientMock).toHaveReceivedCommandWith(HeadObjectCommand, args); }); @@ -57,22 +58,20 @@ describe("S3ClientImpl", () => { const args: HeadObjectCommandInput = { Key: "test", Bucket: "test" }; - const program = S3Service.headObject(args); - - const S3ClientConfigLayer = Layer.succeed(S3ClientInstanceConfig, { - region: "eu-central-1", - }); - const CustomS3ServiceLayer = S3ServiceLayer.pipe( - Layer.provide(S3ClientConfigLayer), - ); + const program = S3.headObject(args); const result = await pipe( program, - Effect.provide(CustomS3ServiceLayer), + Effect.provide(S3.layer({ region: "eu-central-1" })), Effect.runPromiseExit, ); expect(result).toEqual(Exit.succeed({})); + expect(getRuntimeConfig).toHaveBeenCalledTimes(1); + expect(getRuntimeConfig).toHaveBeenCalledWith({ + region: "eu-central-1", + logger: expect.any(Object), + }); expect(clientMock).toHaveReceivedCommandTimes(HeadObjectCommand, 1); expect(clientMock).toHaveReceivedCommandWith(HeadObjectCommand, args); }); @@ -82,23 +81,21 @@ describe("S3ClientImpl", () => { const args: HeadObjectCommandInput = { Key: "test", Bucket: "test" }; - const program = S3Service.headObject(args); - - const S3ClientInstanceLayer = Layer.succeed( - S3ClientInstance, - new S3Client({ region: "eu-central-1" }), - ); - const CustomS3ServiceLayer = BaseS3ServiceLayer.pipe( - Layer.provide(S3ClientInstanceLayer), - ); + const program = S3.headObject(args); const result = await pipe( program, - Effect.provide(CustomS3ServiceLayer), + Effect.provide( + S3.baseLayer(() => new S3Client({ region: "eu-central-1" })), + ), Effect.runPromiseExit, ); expect(result).toEqual(Exit.succeed({})); + expect(getRuntimeConfig).toHaveBeenCalledTimes(1); + expect(getRuntimeConfig).toHaveBeenCalledWith({ + region: "eu-central-1", + }); expect(clientMock).toHaveReceivedCommandTimes(HeadObjectCommand, 1); expect(clientMock).toHaveReceivedCommandWith(HeadObjectCommand, args); }); @@ -108,27 +105,24 @@ describe("S3ClientImpl", () => { const args: HeadObjectCommandInput = { Key: "test", Bucket: "test" }; - const program = S3Service.headObject(args); - - const S3ClientInstanceLayer = Layer.effect( - S3ClientInstance, - Effect.map( - S3ClientInstanceConfig, - (config) => new S3Client({ ...config, region: "eu-central-1" }), - ), - ); - const CustomS3ServiceLayer = BaseS3ServiceLayer.pipe( - Layer.provide(S3ClientInstanceLayer), - Layer.provide(DefaultS3ClientConfigLayer), - ); + const program = S3.headObject(args); const result = await pipe( program, - Effect.provide(CustomS3ServiceLayer), + Effect.provide( + S3.baseLayer( + (config) => new S3Client({ ...config, region: "eu-central-1" }), + ), + ), Effect.runPromiseExit, ); expect(result).toEqual(Exit.succeed({})); + expect(getRuntimeConfig).toHaveBeenCalledTimes(1); + expect(getRuntimeConfig).toHaveBeenCalledWith({ + region: "eu-central-1", + logger: expect.any(Object), + }); expect(clientMock).toHaveReceivedCommandTimes(HeadObjectCommand, 1); expect(clientMock).toHaveReceivedCommandWith(HeadObjectCommand, args); }); @@ -138,11 +132,11 @@ describe("S3ClientImpl", () => { const args: HeadObjectCommandInput = { Key: "test", Bucket: "test" }; - const program = S3Service.headObject(args, { requestTimeout: 1000 }); + const program = S3.headObject(args, { requestTimeout: 1000 }); const result = await pipe( program, - Effect.provide(DefaultS3ServiceLayer), + Effect.provide(S3.defaultLayer), Effect.runPromiseExit, ); @@ -163,13 +157,13 @@ describe("S3ClientImpl", () => { it("presigned url", async () => { const args: GetObjectCommandInput = { Key: "test", Bucket: "test" }; - const program = Effect.flatMap(S3Service, (service) => + const program = Effect.flatMap(S3, (service) => service.getObject(args, { presigned: true, expiresIn: 100 }), ); const result = await pipe( program, - Effect.provide(DefaultS3ServiceLayer), + Effect.provide(S3.defaultLayer), Effect.runPromise, ); diff --git a/packages/client-scheduler/README.md b/packages/client-scheduler/README.md index 57bacaa..3d86def 100644 --- a/packages/client-scheduler/README.md +++ b/packages/client-scheduler/README.md @@ -14,13 +14,13 @@ npm install --save @effect-aws/client-scheduler With default SchedulerClient instance: ```typescript -import { SchedulerService, DefaultSchedulerServiceLayer } from "@effect-aws/client-scheduler"; +import { Scheduler } from "@effect-aws/client-scheduler"; -const program = SchedulerService.tagResource(args); +const program = Scheduler.tagResource(args); const result = pipe( program, - Effect.provide(DefaultSchedulerServiceLayer), + Effect.provide(Scheduler.defaultLayer), Effect.runPromise, ); ``` @@ -28,23 +28,15 @@ const result = pipe( With custom SchedulerClient instance: ```typescript -import { - SchedulerService, - BaseSchedulerServiceLayer, - SchedulerClientInstance, -} from "@effect-aws/client-scheduler"; +import { Scheduler } from "@effect-aws/client-scheduler"; -const program = SchedulerService.tagResource(args); - -const SchedulerClientInstanceLayer = Layer.succeed( - SchedulerClientInstance, - new SchedulerClient({ region: "eu-central-1" }), -); +const program = Scheduler.tagResource(args); const result = await pipe( program, - Effect.provide(BaseSchedulerServiceLayer), - Effect.provide(SchedulerClientInstanceLayer), + Effect.provide( + Scheduler.baseLayer(() => new SchedulerClient({ region: "eu-central-1" })), + ), Effect.runPromise, ); ``` @@ -52,34 +44,15 @@ const result = await pipe( With custom SchedulerClient configuration: ```typescript -import { - SchedulerService, - BaseSchedulerServiceLayer, - DefaultSchedulerClientConfigLayer, - SchedulerClientInstance, - SchedulerClientInstanceConfig, -} from "@effect-aws/client-scheduler"; - -const program = SchedulerService.tagResource(args); - -const SchedulerClientInstanceLayer = Layer.provide( - Layer.effect( - SchedulerClientInstance, - SchedulerClientInstanceConfig.pipe( - Effect.map( - (config) => new SchedulerClient({ ...config, region: "eu-central-1" }), - ), - ), - ), - DefaultSchedulerClientConfigLayer, -); +import { Scheduler } from "@effect-aws/client-scheduler"; + +const program = Scheduler.tagResource(args); const result = await pipe( program, - Effect.provide(BaseSchedulerServiceLayer), - Effect.provide(SchedulerClientInstanceLayer), + Effect.provide(Scheduler.layer({ region: "eu-central-1" })), Effect.runPromiseExit, ); ``` -or map over `DefaultSchedulerClientConfigLayer` layer context and update the configuration... +or use `Scheduler.baseLayer((default) => new SchedulerClient({ ...default, region: "eu-central-1" }))` diff --git a/packages/client-scheduler/src/SchedulerService.ts b/packages/client-scheduler/src/SchedulerService.ts index 7e253ce..47cfe15 100644 --- a/packages/client-scheduler/src/SchedulerService.ts +++ b/packages/client-scheduler/src/SchedulerService.ts @@ -3,6 +3,8 @@ */ import { SchedulerServiceException, + type SchedulerClient, + type SchedulerClientConfig, CreateScheduleCommand, type CreateScheduleCommandInput, type CreateScheduleCommandOutput, @@ -56,10 +58,14 @@ import { SchedulerClientInstance, SchedulerClientInstanceLayer, } from "./SchedulerClientInstance"; -import { DefaultSchedulerClientConfigLayer } from "./SchedulerClientInstanceConfig"; +import { + DefaultSchedulerClientConfigLayer, + makeDefaultSchedulerClientInstanceConfig, + SchedulerClientInstanceConfig, +} from "./SchedulerClientInstanceConfig"; /** - * @since 1.0.2 + * @since 1.0.0 */ export interface HttpHandlerOptions { /** @@ -272,14 +278,6 @@ interface SchedulerService$ { >; } -/** - * @since 1.0.0 - * @category models - */ -export class SchedulerService extends Effect.Tag( - "@effect-aws/client-scheduler/SchedulerService", -)() {} - /** * @since 1.0.0 * @category constructors @@ -330,9 +328,53 @@ export const makeSchedulerService = Effect.gen(function* (_) { }, {}) as SchedulerService$; }); +/** + * @since 1.0.0 + * @category models + */ +export class SchedulerService extends Effect.Tag( + "@effect-aws/client-scheduler/SchedulerService", +)() { + static readonly defaultLayer = Layer.effect(this, makeSchedulerService).pipe( + Layer.provide(SchedulerClientInstanceLayer), + Layer.provide(DefaultSchedulerClientConfigLayer), + ); + static readonly layer = (config: SchedulerClientConfig) => + Layer.effect(this, makeSchedulerService).pipe( + Layer.provide(SchedulerClientInstanceLayer), + Layer.provide( + Layer.effect( + SchedulerClientInstanceConfig, + makeDefaultSchedulerClientInstanceConfig.pipe( + Effect.map((defaultConfig) => ({ ...defaultConfig, ...config })), + ), + ), + ), + ); + static readonly baseLayer = ( + evaluate: (defaultConfig: SchedulerClientConfig) => SchedulerClient, + ) => + Layer.effect(this, makeSchedulerService).pipe( + Layer.provide( + Layer.effect( + SchedulerClientInstance, + Effect.map(makeDefaultSchedulerClientInstanceConfig, evaluate), + ), + ), + ); +} + +/** + * @since 1.0.0 + * @category models + * @alias SchedulerService + */ +export const Scheduler = SchedulerService; + /** * @since 1.0.0 * @category layers + * @deprecated use Scheduler.baseLayer instead */ export const BaseSchedulerServiceLayer = Layer.effect( SchedulerService, @@ -342,6 +384,7 @@ export const BaseSchedulerServiceLayer = Layer.effect( /** * @since 1.0.0 * @category layers + * @deprecated use Scheduler.layer instead */ export const SchedulerServiceLayer = BaseSchedulerServiceLayer.pipe( Layer.provide(SchedulerClientInstanceLayer), @@ -350,7 +393,6 @@ export const SchedulerServiceLayer = BaseSchedulerServiceLayer.pipe( /** * @since 1.0.0 * @category layers + * @deprecated use Scheduler.defaultLayer instead */ -export const DefaultSchedulerServiceLayer = SchedulerServiceLayer.pipe( - Layer.provide(DefaultSchedulerClientConfigLayer), -); +export const DefaultSchedulerServiceLayer = SchedulerService.defaultLayer; diff --git a/packages/client-scheduler/test/Scheduler.test.ts b/packages/client-scheduler/test/Scheduler.test.ts index ef09142..3fe5798 100644 --- a/packages/client-scheduler/test/Scheduler.test.ts +++ b/packages/client-scheduler/test/Scheduler.test.ts @@ -4,39 +4,41 @@ import { SchedulerClient, SchedulerServiceException, } from "@aws-sdk/client-scheduler"; +// @ts-ignore +import * as runtimeConfig from "@aws-sdk/client-scheduler/dist-cjs/runtimeConfig"; import { mockClient } from "aws-sdk-client-mock"; import * as Effect from "effect/Effect"; import * as Exit from "effect/Exit"; import { pipe } from "effect/Function"; -import * as Layer from "effect/Layer"; -import { - BaseSchedulerServiceLayer, - DefaultSchedulerClientConfigLayer, - DefaultSchedulerServiceLayer, - SchedulerClientInstance, - SchedulerClientInstanceConfig, - SchedulerService, - SchedulerServiceLayer, - SdkError, -} from "../src"; +import { afterEach, describe, expect, it, vi } from "vitest"; +import { Scheduler, SdkError } from "../src"; +const getRuntimeConfig = vi.spyOn(runtimeConfig, "getRuntimeConfig"); const clientMock = mockClient(SchedulerClient); describe("SchedulerClientImpl", () => { + afterEach(() => { + getRuntimeConfig.mockClear(); + }); + it("default", async () => { clientMock.reset().on(TagResourceCommand).resolves({}); const args = {} as unknown as TagResourceCommandInput; - const program = SchedulerService.tagResource(args); + const program = Scheduler.tagResource(args); const result = await pipe( program, - Effect.provide(DefaultSchedulerServiceLayer), + Effect.provide(Scheduler.defaultLayer), Effect.runPromiseExit, ); expect(result).toEqual(Exit.succeed({})); + expect(getRuntimeConfig).toHaveBeenCalledTimes(1); + expect(getRuntimeConfig).toHaveBeenCalledWith({ + logger: expect.any(Object), + }); expect(clientMock).toHaveReceivedCommandTimes(TagResourceCommand, 1); expect(clientMock).toHaveReceivedCommandWith(TagResourceCommand, args); }); @@ -46,25 +48,20 @@ describe("SchedulerClientImpl", () => { const args = {} as unknown as TagResourceCommandInput; - const program = SchedulerService.tagResource(args); - - const SchedulerClientConfigLayer = Layer.succeed( - SchedulerClientInstanceConfig, - { - region: "eu-central-1", - }, - ); - const CustomSchedulerServiceLayer = SchedulerServiceLayer.pipe( - Layer.provide(SchedulerClientConfigLayer), - ); + const program = Scheduler.tagResource(args); const result = await pipe( program, - Effect.provide(CustomSchedulerServiceLayer), + Effect.provide(Scheduler.layer({ region: "eu-central-1" })), Effect.runPromiseExit, ); expect(result).toEqual(Exit.succeed({})); + expect(getRuntimeConfig).toHaveBeenCalledTimes(1); + expect(getRuntimeConfig).toHaveBeenCalledWith({ + region: "eu-central-1", + logger: expect.any(Object), + }); expect(clientMock).toHaveReceivedCommandTimes(TagResourceCommand, 1); expect(clientMock).toHaveReceivedCommandWith(TagResourceCommand, args); }); @@ -74,23 +71,23 @@ describe("SchedulerClientImpl", () => { const args = {} as unknown as TagResourceCommandInput; - const program = SchedulerService.tagResource(args); - - const SchedulerClientInstanceLayer = Layer.succeed( - SchedulerClientInstance, - new SchedulerClient({ region: "eu-central-1" }), - ); - const CustomSchedulerServiceLayer = BaseSchedulerServiceLayer.pipe( - Layer.provide(SchedulerClientInstanceLayer), - ); + const program = Scheduler.tagResource(args); const result = await pipe( program, - Effect.provide(CustomSchedulerServiceLayer), + Effect.provide( + Scheduler.baseLayer( + () => new SchedulerClient({ region: "eu-central-1" }), + ), + ), Effect.runPromiseExit, ); expect(result).toEqual(Exit.succeed({})); + expect(getRuntimeConfig).toHaveBeenCalledTimes(1); + expect(getRuntimeConfig).toHaveBeenCalledWith({ + region: "eu-central-1", + }); expect(clientMock).toHaveReceivedCommandTimes(TagResourceCommand, 1); expect(clientMock).toHaveReceivedCommandWith(TagResourceCommand, args); }); @@ -100,27 +97,25 @@ describe("SchedulerClientImpl", () => { const args = {} as unknown as TagResourceCommandInput; - const program = SchedulerService.tagResource(args); - - const SchedulerClientInstanceLayer = Layer.effect( - SchedulerClientInstance, - Effect.map( - SchedulerClientInstanceConfig, - (config) => new SchedulerClient({ ...config, region: "eu-central-1" }), - ), - ); - const CustomSchedulerServiceLayer = BaseSchedulerServiceLayer.pipe( - Layer.provide(SchedulerClientInstanceLayer), - Layer.provide(DefaultSchedulerClientConfigLayer), - ); + const program = Scheduler.tagResource(args); const result = await pipe( program, - Effect.provide(CustomSchedulerServiceLayer), + Effect.provide( + Scheduler.baseLayer( + (config) => + new SchedulerClient({ ...config, region: "eu-central-1" }), + ), + ), Effect.runPromiseExit, ); expect(result).toEqual(Exit.succeed({})); + expect(getRuntimeConfig).toHaveBeenCalledTimes(1); + expect(getRuntimeConfig).toHaveBeenCalledWith({ + region: "eu-central-1", + logger: expect.any(Object), + }); expect(clientMock).toHaveReceivedCommandTimes(TagResourceCommand, 1); expect(clientMock).toHaveReceivedCommandWith(TagResourceCommand, args); }); @@ -130,11 +125,11 @@ describe("SchedulerClientImpl", () => { const args = {} as unknown as TagResourceCommandInput; - const program = SchedulerService.tagResource(args); + const program = Scheduler.tagResource(args); const result = await pipe( program, - Effect.provide(DefaultSchedulerServiceLayer), + Effect.provide(Scheduler.defaultLayer), Effect.runPromiseExit, ); @@ -165,13 +160,13 @@ describe("SchedulerClientImpl", () => { const args = {} as unknown as TagResourceCommandInput; - const program = SchedulerService.tagResource(args).pipe( + const program = Scheduler.tagResource(args).pipe( Effect.catchTag("NotHandledException" as any, () => Effect.succeed(null)), ); const result = await pipe( program, - Effect.provide(DefaultSchedulerServiceLayer), + Effect.provide(Scheduler.defaultLayer), Effect.runPromiseExit, ); diff --git a/packages/client-secrets-manager/README.md b/packages/client-secrets-manager/README.md index 6eb77a2..292c0b5 100644 --- a/packages/client-secrets-manager/README.md +++ b/packages/client-secrets-manager/README.md @@ -14,16 +14,13 @@ npm install --save @effect-aws/client-secrets-manager With default SecretsManagerClient instance: ```typescript -import { - SecretsManagerService, - DefaultSecretsManagerServiceLayer, -} from "@effect-aws/client-secrets-manager"; +import { SecretsManager } from "@effect-aws/client-secrets-manager"; -const program = SecretsManagerService.getSecretValue(args); +const program = SecretsManager.getSecretValue(args); const result = pipe( program, - Effect.provide(DefaultSecretsManagerServiceLayer), + Effect.provide(SecretsManager.defaultLayer), Effect.runPromise, ); ``` @@ -31,23 +28,15 @@ const result = pipe( With custom SecretsManagerClient instance: ```typescript -import { - SecretsManagerService, - BaseSecretsManagerServiceLayer, - SecretsManagerClientInstance, -} from "@effect-aws/client-secrets-manager"; +import { SecretsManager } from "@effect-aws/client-secrets-manager"; -const program = SecretsManagerService.getSecretValue(args); - -const SecretsManagerClientInstanceLayer = Layer.succeed( - SecretsManagerClientInstance, - new SecretsManagerClient({ region: "eu-central-1" }), -); +const program = SecretsManager.getSecretValue(args); const result = await pipe( program, - Effect.provide(BaseSecretsManagerServiceLayer), - Effect.provide(SecretsManagerClientInstanceLayer), + Effect.provide( + SecretsManager.baseLayer(() => new SecretsManagerClient({ region: "eu-central-1" })), + ), Effect.runPromise, ); ``` @@ -55,35 +44,15 @@ const result = await pipe( With custom SecretsManagerClient configuration: ```typescript -import { - SecretsManagerService, - BaseSecretsManagerServiceLayer, - DefaultSecretsManagerClientConfigLayer, - SecretsManagerClientInstance, - SecretsManagerClientInstanceConfig, -} from "@effect-aws/client-secrets-manager"; - -const program = SecretsManagerService.getSecretValue(args); - -const SecretsManagerClientInstanceLayer = Layer.provide( - Layer.effect( - SecretsManagerClientInstance, - SecretsManagerClientInstanceConfig.pipe( - Effect.map( - (config) => - new SecretsManagerClient({ ...config, region: "eu-central-1" }), - ), - ), - ), - DefaultSecretsManagerClientConfigLayer, -); +import { SecretsManager } from "@effect-aws/client-secrets-manager"; + +const program = SecretsManager.getSecretValue(args); const result = await pipe( program, - Effect.provide(BaseSecretsManagerServiceLayer), - Effect.provide(SecretsManagerClientInstanceLayer), + Effect.provide(SecretsManager.layer({ region: "eu-central-1" })), Effect.runPromiseExit, ); ``` -or map over `DefaultSecretsManagerClientConfigLayer` layer context and update the configuration... +or use `SecretsManager.baseLayer((default) => new SecretsManagerClient({ ...default, region: "eu-central-1" }))` diff --git a/packages/client-secrets-manager/src/SecretsManagerService.ts b/packages/client-secrets-manager/src/SecretsManagerService.ts index bcce76b..473de0c 100644 --- a/packages/client-secrets-manager/src/SecretsManagerService.ts +++ b/packages/client-secrets-manager/src/SecretsManagerService.ts @@ -3,6 +3,8 @@ */ import { SecretsManagerServiceException, + type SecretsManagerClient, + type SecretsManagerClientConfig, BatchGetSecretValueCommand, type BatchGetSecretValueCommandInput, type BatchGetSecretValueCommandOutput, @@ -95,10 +97,14 @@ import { SecretsManagerClientInstance, SecretsManagerClientInstanceLayer, } from "./SecretsManagerClientInstance"; -import { DefaultSecretsManagerClientConfigLayer } from "./SecretsManagerClientInstanceConfig"; +import { + DefaultSecretsManagerClientConfigLayer, + makeDefaultSecretsManagerClientInstanceConfig, + SecretsManagerClientInstanceConfig, +} from "./SecretsManagerClientInstanceConfig"; /** - * @since 1.2.1 + * @since 1.0.0 */ export interface HttpHandlerOptions { /** @@ -504,14 +510,6 @@ interface SecretsManagerService$ { >; } -/** - * @since 1.0.0 - * @category models - */ -export class SecretsManagerService extends Effect.Tag( - "@effect-aws/client-secrets-manager/SecretsManagerService", -)() {} - /** * @since 1.0.0 * @category constructors @@ -562,9 +560,58 @@ export const makeSecretsManagerService = Effect.gen(function* (_) { }, {}) as SecretsManagerService$; }); +/** + * @since 1.0.0 + * @category models + */ +export class SecretsManagerService extends Effect.Tag( + "@effect-aws/client-secrets-manager/SecretsManagerService", +)() { + static readonly defaultLayer = Layer.effect( + this, + makeSecretsManagerService, + ).pipe( + Layer.provide(SecretsManagerClientInstanceLayer), + Layer.provide(DefaultSecretsManagerClientConfigLayer), + ); + static readonly layer = (config: SecretsManagerClientConfig) => + Layer.effect(this, makeSecretsManagerService).pipe( + Layer.provide(SecretsManagerClientInstanceLayer), + Layer.provide( + Layer.effect( + SecretsManagerClientInstanceConfig, + makeDefaultSecretsManagerClientInstanceConfig.pipe( + Effect.map((defaultConfig) => ({ ...defaultConfig, ...config })), + ), + ), + ), + ); + static readonly baseLayer = ( + evaluate: ( + defaultConfig: SecretsManagerClientConfig, + ) => SecretsManagerClient, + ) => + Layer.effect(this, makeSecretsManagerService).pipe( + Layer.provide( + Layer.effect( + SecretsManagerClientInstance, + Effect.map(makeDefaultSecretsManagerClientInstanceConfig, evaluate), + ), + ), + ); +} + +/** + * @since 1.0.0 + * @category models + * @alias SecretsManagerService + */ +export const SecretsManager = SecretsManagerService; + /** * @since 1.0.0 * @category layers + * @deprecated use SecretsManager.baseLayer instead */ export const BaseSecretsManagerServiceLayer = Layer.effect( SecretsManagerService, @@ -574,6 +621,7 @@ export const BaseSecretsManagerServiceLayer = Layer.effect( /** * @since 1.0.0 * @category layers + * @deprecated use SecretsManager.layer instead */ export const SecretsManagerServiceLayer = BaseSecretsManagerServiceLayer.pipe( Layer.provide(SecretsManagerClientInstanceLayer), @@ -582,8 +630,7 @@ export const SecretsManagerServiceLayer = BaseSecretsManagerServiceLayer.pipe( /** * @since 1.0.0 * @category layers + * @deprecated use SecretsManager.defaultLayer instead */ export const DefaultSecretsManagerServiceLayer = - SecretsManagerServiceLayer.pipe( - Layer.provide(DefaultSecretsManagerClientConfigLayer), - ); + SecretsManagerService.defaultLayer; diff --git a/packages/client-secrets-manager/test/SecretsManager.test.ts b/packages/client-secrets-manager/test/SecretsManager.test.ts index 8c4dd8c..0534930 100644 --- a/packages/client-secrets-manager/test/SecretsManager.test.ts +++ b/packages/client-secrets-manager/test/SecretsManager.test.ts @@ -4,39 +4,41 @@ import { SecretsManagerClient, SecretsManagerServiceException, } from "@aws-sdk/client-secrets-manager"; +// @ts-ignore +import * as runtimeConfig from "@aws-sdk/client-secrets-manager/dist-cjs/runtimeConfig"; import { mockClient } from "aws-sdk-client-mock"; import * as Effect from "effect/Effect"; import * as Exit from "effect/Exit"; import { pipe } from "effect/Function"; -import * as Layer from "effect/Layer"; -import { - BaseSecretsManagerServiceLayer, - DefaultSecretsManagerClientConfigLayer, - DefaultSecretsManagerServiceLayer, - SecretsManagerClientInstance, - SecretsManagerClientInstanceConfig, - SecretsManagerService, - SecretsManagerServiceLayer, - SdkError, -} from "../src"; +import { afterEach, describe, expect, it, vi } from "vitest"; +import { SecretsManager, SdkError } from "../src"; +const getRuntimeConfig = vi.spyOn(runtimeConfig, "getRuntimeConfig"); const clientMock = mockClient(SecretsManagerClient); describe("SecretsManagerClientImpl", () => { + afterEach(() => { + getRuntimeConfig.mockClear(); + }); + it("default", async () => { clientMock.reset().on(GetSecretValueCommand).resolves({}); const args: GetSecretValueCommandInput = { SecretId: "test" }; - const program = SecretsManagerService.getSecretValue(args); + const program = SecretsManager.getSecretValue(args); const result = await pipe( program, - Effect.provide(DefaultSecretsManagerServiceLayer), + Effect.provide(SecretsManager.defaultLayer), Effect.runPromiseExit, ); expect(result).toEqual(Exit.succeed({})); + expect(getRuntimeConfig).toHaveBeenCalledTimes(1); + expect(getRuntimeConfig).toHaveBeenCalledWith({ + logger: expect.any(Object), + }); expect(clientMock).toHaveReceivedCommandTimes(GetSecretValueCommand, 1); expect(clientMock).toHaveReceivedCommandWith(GetSecretValueCommand, args); }); @@ -46,25 +48,20 @@ describe("SecretsManagerClientImpl", () => { const args: GetSecretValueCommandInput = { SecretId: "test" }; - const program = SecretsManagerService.getSecretValue(args); - - const SecretsManagerClientConfigLayer = Layer.succeed( - SecretsManagerClientInstanceConfig, - { - region: "eu-central-1", - }, - ); - const CustomSecretsManagerServiceLayer = SecretsManagerServiceLayer.pipe( - Layer.provide(SecretsManagerClientConfigLayer), - ); + const program = SecretsManager.getSecretValue(args); const result = await pipe( program, - Effect.provide(CustomSecretsManagerServiceLayer), + Effect.provide(SecretsManager.layer({ region: "eu-central-1" })), Effect.runPromiseExit, ); expect(result).toEqual(Exit.succeed({})); + expect(getRuntimeConfig).toHaveBeenCalledTimes(1); + expect(getRuntimeConfig).toHaveBeenCalledWith({ + region: "eu-central-1", + logger: expect.any(Object), + }); expect(clientMock).toHaveReceivedCommandTimes(GetSecretValueCommand, 1); expect(clientMock).toHaveReceivedCommandWith(GetSecretValueCommand, args); }); @@ -74,24 +71,23 @@ describe("SecretsManagerClientImpl", () => { const args: GetSecretValueCommandInput = { SecretId: "test" }; - const program = SecretsManagerService.getSecretValue(args); - - const SecretsManagerClientInstanceLayer = Layer.succeed( - SecretsManagerClientInstance, - new SecretsManagerClient({ region: "eu-central-1" }), - ); - const CustomSecretsManagerServiceLayer = - BaseSecretsManagerServiceLayer.pipe( - Layer.provide(SecretsManagerClientInstanceLayer), - ); + const program = SecretsManager.getSecretValue(args); const result = await pipe( program, - Effect.provide(CustomSecretsManagerServiceLayer), + Effect.provide( + SecretsManager.baseLayer( + () => new SecretsManagerClient({ region: "eu-central-1" }), + ), + ), Effect.runPromiseExit, ); expect(result).toEqual(Exit.succeed({})); + expect(getRuntimeConfig).toHaveBeenCalledTimes(1); + expect(getRuntimeConfig).toHaveBeenCalledWith({ + region: "eu-central-1", + }); expect(clientMock).toHaveReceivedCommandTimes(GetSecretValueCommand, 1); expect(clientMock).toHaveReceivedCommandWith(GetSecretValueCommand, args); }); @@ -101,29 +97,25 @@ describe("SecretsManagerClientImpl", () => { const args: GetSecretValueCommandInput = { SecretId: "test" }; - const program = SecretsManagerService.getSecretValue(args); - - const SecretsManagerClientInstanceLayer = Layer.effect( - SecretsManagerClientInstance, - Effect.map( - SecretsManagerClientInstanceConfig, - (config) => - new SecretsManagerClient({ ...config, region: "eu-central-1" }), - ), - ); - const CustomSecretsManagerServiceLayer = - BaseSecretsManagerServiceLayer.pipe( - Layer.provide(SecretsManagerClientInstanceLayer), - Layer.provide(DefaultSecretsManagerClientConfigLayer), - ); + const program = SecretsManager.getSecretValue(args); const result = await pipe( program, - Effect.provide(CustomSecretsManagerServiceLayer), + Effect.provide( + SecretsManager.baseLayer( + (config) => + new SecretsManagerClient({ ...config, region: "eu-central-1" }), + ), + ), Effect.runPromiseExit, ); expect(result).toEqual(Exit.succeed({})); + expect(getRuntimeConfig).toHaveBeenCalledTimes(1); + expect(getRuntimeConfig).toHaveBeenCalledWith({ + region: "eu-central-1", + logger: expect.any(Object), + }); expect(clientMock).toHaveReceivedCommandTimes(GetSecretValueCommand, 1); expect(clientMock).toHaveReceivedCommandWith(GetSecretValueCommand, args); }); @@ -133,11 +125,11 @@ describe("SecretsManagerClientImpl", () => { const args: GetSecretValueCommandInput = { SecretId: "test" }; - const program = SecretsManagerService.getSecretValue(args); + const program = SecretsManager.getSecretValue(args); const result = await pipe( program, - Effect.provide(DefaultSecretsManagerServiceLayer), + Effect.provide(SecretsManager.defaultLayer), Effect.runPromiseExit, ); @@ -168,13 +160,13 @@ describe("SecretsManagerClientImpl", () => { const args: GetSecretValueCommandInput = { SecretId: "test" }; - const program = SecretsManagerService.getSecretValue(args).pipe( + const program = SecretsManager.getSecretValue(args).pipe( Effect.catchTag("NotHandledException" as any, () => Effect.succeed(null)), ); const result = await pipe( program, - Effect.provide(DefaultSecretsManagerServiceLayer), + Effect.provide(SecretsManager.defaultLayer), Effect.runPromiseExit, ); diff --git a/packages/client-sfn/README.md b/packages/client-sfn/README.md index 0b1cccf..2a2dd68 100644 --- a/packages/client-sfn/README.md +++ b/packages/client-sfn/README.md @@ -14,13 +14,13 @@ npm install --save @effect-aws/client-sfn With default SFNClient instance: ```typescript -import { SFNService, DefaultSFNServiceLayer } from "@effect-aws/client-sfn"; +import { SFN } from "@effect-aws/client-sfn"; -const program = SFNService.startExecution(args); +const program = SFN.startExecution(args); const result = pipe( program, - Effect.provide(DefaultSFNServiceLayer), + Effect.provide(SFN.defaultLayer), Effect.runPromise, ); ``` @@ -28,23 +28,15 @@ const result = pipe( With custom SFNClient instance: ```typescript -import { - SFNService, - BaseSFNServiceLayer, - SFNClientInstance, -} from "@effect-aws/client-sfn"; +import { SFN } from "@effect-aws/client-sfn"; -const program = SFNService.startExecution(args); - -const SFNClientInstanceLayer = Layer.succeed( - SFNClientInstance, - new SFNClient({ region: "eu-central-1" }), -); +const program = SFN.startExecution(args); const result = await pipe( program, - Effect.provide(BaseSFNServiceLayer), - Effect.provide(SFNClientInstanceLayer), + Effect.provide( + SFN.baseLayer(() => new SFNClient({ region: "eu-central-1" })), + ), Effect.runPromise, ); ``` @@ -52,34 +44,15 @@ const result = await pipe( With custom SFNClient configuration: ```typescript -import { - SFNService, - BaseSFNServiceLayer, - DefaultSFNClientConfigLayer, - SFNClientInstance, - SFNClientInstanceConfig, -} from "@effect-aws/client-sfn"; - -const program = SFNService.startExecution(args); - -const SFNClientInstanceLayer = Layer.provide( - Layer.effect( - SFNClientInstance, - SFNClientInstanceConfig.pipe( - Effect.map( - (config) => new SFNClient({ ...config, region: "eu-central-1" }), - ), - ), - ), - DefaultSFNClientConfigLayer, -); +import { SFN } from "@effect-aws/client-sfn"; + +const program = SFN.startExecution(args); const result = await pipe( program, - Effect.provide(BaseSFNServiceLayer), - Effect.provide(SFNClientInstanceLayer), + Effect.provide(SFN.layer({ region: "eu-central-1" })), Effect.runPromiseExit, ); ``` -or map over `DefaultSFNClientConfigLayer` layer context and update the configuration... +or use `SFN.baseLayer((default) => new SFNClient({ ...default, region: "eu-central-1" }))` diff --git a/packages/client-sfn/src/SFNService.ts b/packages/client-sfn/src/SFNService.ts index b882746..e1de1d1 100644 --- a/packages/client-sfn/src/SFNService.ts +++ b/packages/client-sfn/src/SFNService.ts @@ -3,6 +3,8 @@ */ import { SFNServiceException, + type SFNClient, + type SFNClientConfig, CreateActivityCommand, type CreateActivityCommandInput, type CreateActivityCommandOutput, @@ -155,10 +157,14 @@ import { TaggedException, } from "./Errors"; import { SFNClientInstance, SFNClientInstanceLayer } from "./SFNClientInstance"; -import { DefaultSFNClientConfigLayer } from "./SFNClientInstanceConfig"; +import { + DefaultSFNClientConfigLayer, + makeDefaultSFNClientInstanceConfig, + SFNClientInstanceConfig, +} from "./SFNClientInstanceConfig"; /** - * @since 1.4.1 + * @since 1.0.0 */ export interface HttpHandlerOptions { /** @@ -756,15 +762,6 @@ interface SFNService$ { >; } -/** - * @since 1.0.0 - * @category models - */ -export class SFNService extends Effect.Tag("@effect-aws/client-sfn/SFNService")< - SFNService, - SFNService$ ->() {} - /** * @since 1.0.0 * @category constructors @@ -815,15 +812,61 @@ export const makeSFNService = Effect.gen(function* (_) { }, {}) as SFNService$; }); +/** + * @since 1.0.0 + * @category models + */ +export class SFNService extends Effect.Tag("@effect-aws/client-sfn/SFNService")< + SFNService, + SFNService$ +>() { + static readonly defaultLayer = Layer.effect(this, makeSFNService).pipe( + Layer.provide(SFNClientInstanceLayer), + Layer.provide(DefaultSFNClientConfigLayer), + ); + static readonly layer = (config: SFNClientConfig) => + Layer.effect(this, makeSFNService).pipe( + Layer.provide(SFNClientInstanceLayer), + Layer.provide( + Layer.effect( + SFNClientInstanceConfig, + makeDefaultSFNClientInstanceConfig.pipe( + Effect.map((defaultConfig) => ({ ...defaultConfig, ...config })), + ), + ), + ), + ); + static readonly baseLayer = ( + evaluate: (defaultConfig: SFNClientConfig) => SFNClient, + ) => + Layer.effect(this, makeSFNService).pipe( + Layer.provide( + Layer.effect( + SFNClientInstance, + Effect.map(makeDefaultSFNClientInstanceConfig, evaluate), + ), + ), + ); +} + +/** + * @since 1.0.0 + * @category models + * @alias SFNService + */ +export const SFN = SFNService; + /** * @since 1.0.0 * @category layers + * @deprecated use SFN.baseLayer instead */ export const BaseSFNServiceLayer = Layer.effect(SFNService, makeSFNService); /** * @since 1.0.0 * @category layers + * @deprecated use SFN.layer instead */ export const SFNServiceLayer = BaseSFNServiceLayer.pipe( Layer.provide(SFNClientInstanceLayer), @@ -832,7 +875,6 @@ export const SFNServiceLayer = BaseSFNServiceLayer.pipe( /** * @since 1.0.0 * @category layers + * @deprecated use SFN.defaultLayer instead */ -export const DefaultSFNServiceLayer = SFNServiceLayer.pipe( - Layer.provide(DefaultSFNClientConfigLayer), -); +export const DefaultSFNServiceLayer = SFNService.defaultLayer; diff --git a/packages/client-sfn/test/SFN.test.ts b/packages/client-sfn/test/SFN.test.ts index 6b424ba..9d34620 100644 --- a/packages/client-sfn/test/SFN.test.ts +++ b/packages/client-sfn/test/SFN.test.ts @@ -4,25 +4,23 @@ import { SFNClient, SFNServiceException, } from "@aws-sdk/client-sfn"; +// @ts-ignore +import * as runtimeConfig from "@aws-sdk/client-sfn/dist-cjs/runtimeConfig"; import { mockClient } from "aws-sdk-client-mock"; import * as Effect from "effect/Effect"; import * as Exit from "effect/Exit"; import { pipe } from "effect/Function"; -import * as Layer from "effect/Layer"; -import { - BaseSFNServiceLayer, - DefaultSFNClientConfigLayer, - DefaultSFNServiceLayer, - SFNClientInstance, - SFNClientInstanceConfig, - SFNService, - SFNServiceLayer, - SdkError, -} from "../src"; +import { afterEach, describe, expect, it, vi } from "vitest"; +import { SFN, SdkError } from "../src"; +const getRuntimeConfig = vi.spyOn(runtimeConfig, "getRuntimeConfig"); const clientMock = mockClient(SFNClient); describe("SFNClientImpl", () => { + afterEach(() => { + getRuntimeConfig.mockClear(); + }); + it("default", async () => { clientMock.reset().on(StartExecutionCommand).resolves({}); @@ -31,15 +29,19 @@ describe("SFNClientImpl", () => { input: "test", }; - const program = SFNService.startExecution(args); + const program = SFN.startExecution(args); const result = await pipe( program, - Effect.provide(DefaultSFNServiceLayer), + Effect.provide(SFN.defaultLayer), Effect.runPromiseExit, ); expect(result).toEqual(Exit.succeed({})); + expect(getRuntimeConfig).toHaveBeenCalledTimes(1); + expect(getRuntimeConfig).toHaveBeenCalledWith({ + logger: expect.any(Object), + }); expect(clientMock).toHaveReceivedCommandTimes(StartExecutionCommand, 1); expect(clientMock).toHaveReceivedCommandWith(StartExecutionCommand, args); }); @@ -52,22 +54,20 @@ describe("SFNClientImpl", () => { input: "test", }; - const program = SFNService.startExecution(args); - - const SFNClientConfigLayer = Layer.succeed(SFNClientInstanceConfig, { - region: "eu-central-1", - }); - const CustomSFNServiceLayer = SFNServiceLayer.pipe( - Layer.provide(SFNClientConfigLayer), - ); + const program = SFN.startExecution(args); const result = await pipe( program, - Effect.provide(CustomSFNServiceLayer), + Effect.provide(SFN.layer({ region: "eu-central-1" })), Effect.runPromiseExit, ); expect(result).toEqual(Exit.succeed({})); + expect(getRuntimeConfig).toHaveBeenCalledTimes(1); + expect(getRuntimeConfig).toHaveBeenCalledWith({ + region: "eu-central-1", + logger: expect.any(Object), + }); expect(clientMock).toHaveReceivedCommandTimes(StartExecutionCommand, 1); expect(clientMock).toHaveReceivedCommandWith(StartExecutionCommand, args); }); @@ -80,23 +80,21 @@ describe("SFNClientImpl", () => { input: "test", }; - const program = SFNService.startExecution(args); - - const SFNClientInstanceLayer = Layer.succeed( - SFNClientInstance, - new SFNClient({ region: "eu-central-1" }), - ); - const CustomSFNServiceLayer = BaseSFNServiceLayer.pipe( - Layer.provide(SFNClientInstanceLayer), - ); + const program = SFN.startExecution(args); const result = await pipe( program, - Effect.provide(CustomSFNServiceLayer), + Effect.provide( + SFN.baseLayer(() => new SFNClient({ region: "eu-central-1" })), + ), Effect.runPromiseExit, ); expect(result).toEqual(Exit.succeed({})); + expect(getRuntimeConfig).toHaveBeenCalledTimes(1); + expect(getRuntimeConfig).toHaveBeenCalledWith({ + region: "eu-central-1", + }); expect(clientMock).toHaveReceivedCommandTimes(StartExecutionCommand, 1); expect(clientMock).toHaveReceivedCommandWith(StartExecutionCommand, args); }); @@ -109,27 +107,24 @@ describe("SFNClientImpl", () => { input: "test", }; - const program = SFNService.startExecution(args); - - const SFNClientInstanceLayer = Layer.effect( - SFNClientInstance, - Effect.map( - SFNClientInstanceConfig, - (config) => new SFNClient({ ...config, region: "eu-central-1" }), - ), - ); - const CustomSFNServiceLayer = BaseSFNServiceLayer.pipe( - Layer.provide(SFNClientInstanceLayer), - Layer.provide(DefaultSFNClientConfigLayer), - ); + const program = SFN.startExecution(args); const result = await pipe( program, - Effect.provide(CustomSFNServiceLayer), + Effect.provide( + SFN.baseLayer( + (config) => new SFNClient({ ...config, region: "eu-central-1" }), + ), + ), Effect.runPromiseExit, ); expect(result).toEqual(Exit.succeed({})); + expect(getRuntimeConfig).toHaveBeenCalledTimes(1); + expect(getRuntimeConfig).toHaveBeenCalledWith({ + region: "eu-central-1", + logger: expect.any(Object), + }); expect(clientMock).toHaveReceivedCommandTimes(StartExecutionCommand, 1); expect(clientMock).toHaveReceivedCommandWith(StartExecutionCommand, args); }); @@ -142,11 +137,11 @@ describe("SFNClientImpl", () => { input: "test", }; - const program = SFNService.startExecution(args); + const program = SFN.startExecution(args); const result = await pipe( program, - Effect.provide(DefaultSFNServiceLayer), + Effect.provide(SFN.defaultLayer), Effect.runPromiseExit, ); @@ -180,13 +175,13 @@ describe("SFNClientImpl", () => { input: "test", }; - const program = SFNService.startExecution(args).pipe( + const program = SFN.startExecution(args).pipe( Effect.catchTag("NotHandledException" as any, () => Effect.succeed(null)), ); const result = await pipe( program, - Effect.provide(DefaultSFNServiceLayer), + Effect.provide(SFN.defaultLayer), Effect.runPromiseExit, ); diff --git a/packages/client-sns/README.md b/packages/client-sns/README.md index aa4d0f9..6a6c84a 100644 --- a/packages/client-sns/README.md +++ b/packages/client-sns/README.md @@ -14,13 +14,13 @@ npm install --save @effect-aws/client-sns With default SNSClient instance: ```typescript -import { SNSService, DefaultSNSServiceLayer } from "@effect-aws/client-sns"; +import { SNS } from "@effect-aws/client-sns"; -const program = SNSService.publish(args); +const program = SNS.publish(args); const result = pipe( program, - Effect.provide(DefaultSNSServiceLayer), + Effect.provide(SNS.defaultLayer), Effect.runPromise, ); ``` @@ -28,23 +28,15 @@ const result = pipe( With custom SNSClient instance: ```typescript -import { - SNSService, - BaseSNSServiceLayer, - SNSClientInstance, -} from "@effect-aws/client-sns"; +import { SNS } from "@effect-aws/client-sns"; -const program = SNSService.publish(args); - -const SNSClientInstanceLayer = Layer.succeed( - SNSClientInstance, - new SNSClient({ region: "eu-central-1" }), -); +const program = SNS.publish(args); const result = await pipe( program, - Effect.provide(BaseSNSServiceLayer), - Effect.provide(SNSClientInstanceLayer), + Effect.provide( + SNS.baseLayer(() => new SNSClient({ region: "eu-central-1" })), + ), Effect.runPromise, ); ``` @@ -52,34 +44,15 @@ const result = await pipe( With custom SNSClient configuration: ```typescript -import { - SNSService, - BaseSNSServiceLayer, - DefaultSNSClientConfigLayer, - SNSClientInstance, - SNSClientInstanceConfig, -} from "@effect-aws/client-sns"; - -const program = SNSService.publish(args); - -const SNSClientInstanceLayer = Layer.provide( - Layer.effect( - SNSClientInstance, - SNSClientInstanceConfig.pipe( - Effect.map( - (config) => new SNSClient({ ...config, region: "eu-central-1" }), - ), - ), - ), - DefaultSNSClientConfigLayer, -); +import { SNS } from "@effect-aws/client-sns"; + +const program = SNS.publish(args); const result = await pipe( program, - Effect.provide(BaseSNSServiceLayer), - Effect.provide(SNSClientInstanceLayer), + Effect.provide(SNS.layer({ region: "eu-central-1" })), Effect.runPromiseExit, ); ``` -or map over `DefaultSNSClientConfigLayer` layer context and update the configuration... +or use `SNS.baseLayer((default) => new SNSClient({ ...default, region: "eu-central-1" }))` diff --git a/packages/client-sns/src/SNSService.ts b/packages/client-sns/src/SNSService.ts index e3115ea..8d51023 100644 --- a/packages/client-sns/src/SNSService.ts +++ b/packages/client-sns/src/SNSService.ts @@ -3,6 +3,8 @@ */ import { SNSServiceException, + type SNSClient, + type SNSClientConfig, AddPermissionCommand, type AddPermissionCommandInput, type AddPermissionCommandOutput, @@ -171,10 +173,14 @@ import { TaggedException, } from "./Errors"; import { SNSClientInstance, SNSClientInstanceLayer } from "./SNSClientInstance"; -import { DefaultSNSClientConfigLayer } from "./SNSClientInstanceConfig"; +import { + DefaultSNSClientConfigLayer, + makeDefaultSNSClientInstanceConfig, + SNSClientInstanceConfig, +} from "./SNSClientInstanceConfig"; /** - * @since 1.4.1 + * @since 1.0.0 */ export interface HttpHandlerOptions { /** @@ -900,15 +906,6 @@ interface SNSService$ { >; } -/** - * @since 1.0.0 - * @category models - */ -export class SNSService extends Effect.Tag("@effect-aws/client-sns/SNSService")< - SNSService, - SNSService$ ->() {} - /** * @since 1.0.0 * @category constructors @@ -959,15 +956,61 @@ export const makeSNSService = Effect.gen(function* (_) { }, {}) as SNSService$; }); +/** + * @since 1.0.0 + * @category models + */ +export class SNSService extends Effect.Tag("@effect-aws/client-sns/SNSService")< + SNSService, + SNSService$ +>() { + static readonly defaultLayer = Layer.effect(this, makeSNSService).pipe( + Layer.provide(SNSClientInstanceLayer), + Layer.provide(DefaultSNSClientConfigLayer), + ); + static readonly layer = (config: SNSClientConfig) => + Layer.effect(this, makeSNSService).pipe( + Layer.provide(SNSClientInstanceLayer), + Layer.provide( + Layer.effect( + SNSClientInstanceConfig, + makeDefaultSNSClientInstanceConfig.pipe( + Effect.map((defaultConfig) => ({ ...defaultConfig, ...config })), + ), + ), + ), + ); + static readonly baseLayer = ( + evaluate: (defaultConfig: SNSClientConfig) => SNSClient, + ) => + Layer.effect(this, makeSNSService).pipe( + Layer.provide( + Layer.effect( + SNSClientInstance, + Effect.map(makeDefaultSNSClientInstanceConfig, evaluate), + ), + ), + ); +} + +/** + * @since 1.0.0 + * @category models + * @alias SNSService + */ +export const SNS = SNSService; + /** * @since 1.0.0 * @category layers + * @deprecated use SNS.baseLayer instead */ export const BaseSNSServiceLayer = Layer.effect(SNSService, makeSNSService); /** * @since 1.0.0 * @category layers + * @deprecated use SNS.layer instead */ export const SNSServiceLayer = BaseSNSServiceLayer.pipe( Layer.provide(SNSClientInstanceLayer), @@ -976,7 +1019,6 @@ export const SNSServiceLayer = BaseSNSServiceLayer.pipe( /** * @since 1.0.0 * @category layers + * @deprecated use SNS.defaultLayer instead */ -export const DefaultSNSServiceLayer = SNSServiceLayer.pipe( - Layer.provide(DefaultSNSClientConfigLayer), -); +export const DefaultSNSServiceLayer = SNSService.defaultLayer; diff --git a/packages/client-sns/test/SNS.test.ts b/packages/client-sns/test/SNS.test.ts index ffc5faa..568e82c 100644 --- a/packages/client-sns/test/SNS.test.ts +++ b/packages/client-sns/test/SNS.test.ts @@ -4,39 +4,41 @@ import { SNSClient, SNSServiceException, } from "@aws-sdk/client-sns"; +// @ts-ignore +import * as runtimeConfig from "@aws-sdk/client-sns/dist-cjs/runtimeConfig"; import { mockClient } from "aws-sdk-client-mock"; import * as Effect from "effect/Effect"; import * as Exit from "effect/Exit"; import { pipe } from "effect/Function"; -import * as Layer from "effect/Layer"; -import { - BaseSNSServiceLayer, - DefaultSNSClientConfigLayer, - DefaultSNSServiceLayer, - SNSClientInstance, - SNSClientInstanceConfig, - SNSService, - SNSServiceLayer, - SdkError, -} from "../src"; +import { afterEach, describe, expect, it, vi } from "vitest"; +import { SNS, SdkError } from "../src"; +const getRuntimeConfig = vi.spyOn(runtimeConfig, "getRuntimeConfig"); const clientMock = mockClient(SNSClient); describe("SNSClientImpl", () => { + afterEach(() => { + getRuntimeConfig.mockClear(); + }); + it("default", async () => { clientMock.reset().on(PublishCommand).resolves({}); const args: PublishCommandInput = { TopicArn: "test", Message: "test" }; - const program = SNSService.publish(args); + const program = SNS.publish(args); const result = await pipe( program, - Effect.provide(DefaultSNSServiceLayer), + Effect.provide(SNS.defaultLayer), Effect.runPromiseExit, ); expect(result).toEqual(Exit.succeed({})); + expect(getRuntimeConfig).toHaveBeenCalledTimes(1); + expect(getRuntimeConfig).toHaveBeenCalledWith({ + logger: expect.any(Object), + }); expect(clientMock).toHaveReceivedCommandTimes(PublishCommand, 1); expect(clientMock).toHaveReceivedCommandWith(PublishCommand, args); }); @@ -46,22 +48,20 @@ describe("SNSClientImpl", () => { const args: PublishCommandInput = { TopicArn: "test", Message: "test" }; - const program = SNSService.publish(args); - - const SNSClientConfigLayer = Layer.succeed(SNSClientInstanceConfig, { - region: "eu-central-1", - }); - const CustomSNSServiceLayer = SNSServiceLayer.pipe( - Layer.provide(SNSClientConfigLayer), - ); + const program = SNS.publish(args); const result = await pipe( program, - Effect.provide(CustomSNSServiceLayer), + Effect.provide(SNS.layer({ region: "eu-central-1" })), Effect.runPromiseExit, ); expect(result).toEqual(Exit.succeed({})); + expect(getRuntimeConfig).toHaveBeenCalledTimes(1); + expect(getRuntimeConfig).toHaveBeenCalledWith({ + region: "eu-central-1", + logger: expect.any(Object), + }); expect(clientMock).toHaveReceivedCommandTimes(PublishCommand, 1); expect(clientMock).toHaveReceivedCommandWith(PublishCommand, args); }); @@ -71,23 +71,21 @@ describe("SNSClientImpl", () => { const args: PublishCommandInput = { TopicArn: "test", Message: "test" }; - const program = SNSService.publish(args); - - const SNSClientInstanceLayer = Layer.succeed( - SNSClientInstance, - new SNSClient({ region: "eu-central-1" }), - ); - const CustomSNSServiceLayer = BaseSNSServiceLayer.pipe( - Layer.provide(SNSClientInstanceLayer), - ); + const program = SNS.publish(args); const result = await pipe( program, - Effect.provide(CustomSNSServiceLayer), + Effect.provide( + SNS.baseLayer(() => new SNSClient({ region: "eu-central-1" })), + ), Effect.runPromiseExit, ); expect(result).toEqual(Exit.succeed({})); + expect(getRuntimeConfig).toHaveBeenCalledTimes(1); + expect(getRuntimeConfig).toHaveBeenCalledWith({ + region: "eu-central-1", + }); expect(clientMock).toHaveReceivedCommandTimes(PublishCommand, 1); expect(clientMock).toHaveReceivedCommandWith(PublishCommand, args); }); @@ -97,27 +95,24 @@ describe("SNSClientImpl", () => { const args: PublishCommandInput = { TopicArn: "test", Message: "test" }; - const program = SNSService.publish(args); - - const SNSClientInstanceLayer = Layer.effect( - SNSClientInstance, - Effect.map( - SNSClientInstanceConfig, - (config) => new SNSClient({ ...config, region: "eu-central-1" }), - ), - ); - const CustomSNSServiceLayer = BaseSNSServiceLayer.pipe( - Layer.provide(SNSClientInstanceLayer), - Layer.provide(DefaultSNSClientConfigLayer), - ); + const program = SNS.publish(args); const result = await pipe( program, - Effect.provide(CustomSNSServiceLayer), + Effect.provide( + SNS.baseLayer( + (config) => new SNSClient({ ...config, region: "eu-central-1" }), + ), + ), Effect.runPromiseExit, ); expect(result).toEqual(Exit.succeed({})); + expect(getRuntimeConfig).toHaveBeenCalledTimes(1); + expect(getRuntimeConfig).toHaveBeenCalledWith({ + region: "eu-central-1", + logger: expect.any(Object), + }); expect(clientMock).toHaveReceivedCommandTimes(PublishCommand, 1); expect(clientMock).toHaveReceivedCommandWith(PublishCommand, args); }); @@ -127,11 +122,11 @@ describe("SNSClientImpl", () => { const args: PublishCommandInput = { TopicArn: "test", Message: "test" }; - const program = SNSService.publish(args); + const program = SNS.publish(args); const result = await pipe( program, - Effect.provide(DefaultSNSServiceLayer), + Effect.provide(SNS.defaultLayer), Effect.runPromiseExit, ); @@ -162,13 +157,13 @@ describe("SNSClientImpl", () => { const args: PublishCommandInput = { TopicArn: "test", Message: "test" }; - const program = SNSService.publish(args).pipe( + const program = SNS.publish(args).pipe( Effect.catchTag("NotHandledException" as any, () => Effect.succeed(null)), ); const result = await pipe( program, - Effect.provide(DefaultSNSServiceLayer), + Effect.provide(SNS.defaultLayer), Effect.runPromiseExit, ); diff --git a/packages/client-sqs/README.md b/packages/client-sqs/README.md index ac0101f..101c836 100644 --- a/packages/client-sqs/README.md +++ b/packages/client-sqs/README.md @@ -14,13 +14,13 @@ npm install --save @effect-aws/client-sqs With default SQSClient instance: ```typescript -import { SQSService, DefaultSQSServiceLayer } from "@effect-aws/client-sqs"; +import { SQS } from "@effect-aws/client-sqs"; -const program = SQSService.sendMessage(args); +const program = SQS.sendMessage(args); const result = pipe( program, - Effect.provide(DefaultSQSServiceLayer), + Effect.provide(SQS.defaultLayer), Effect.runPromise, ); ``` @@ -28,23 +28,15 @@ const result = pipe( With custom SQSClient instance: ```typescript -import { - SQSService, - BaseSQSServiceLayer, - SQSClientInstance, -} from "@effect-aws/client-sqs"; +import { SQS } from "@effect-aws/client-sqs"; -const program = SQSService.sendMessage(args); - -const SQSClientInstanceLayer = Layer.succeed( - SQSClientInstance, - new SQSClient({ region: "eu-central-1" }), -); +const program = SQS.sendMessage(args); const result = await pipe( program, - Effect.provide(BaseSQSServiceLayer), - Effect.provide(SQSClientInstanceLayer), + Effect.provide( + SQS.baseLayer(() => new SQSClient({ region: "eu-central-1" })), + ), Effect.runPromise, ); ``` @@ -52,34 +44,15 @@ const result = await pipe( With custom SQSClient configuration: ```typescript -import { - SQSService, - BaseSQSServiceLayer, - DefaultSQSClientConfigLayer, - SQSClientInstance, - SQSClientInstanceConfig, -} from "@effect-aws/client-sqs"; - -const program = SQSService.sendMessage(args); - -const SQSClientInstanceLayer = Layer.provide( - Layer.effect( - SQSClientInstance, - SQSClientInstanceConfig.pipe( - Effect.map( - (config) => new SQSClient({ ...config, region: "eu-central-1" }), - ), - ), - ), - DefaultSQSClientConfigLayer, -); +import { SQS } from "@effect-aws/client-sqs"; + +const program = SQS.sendMessage(args); const result = await pipe( program, - Effect.provide(BaseSQSServiceLayer), - Effect.provide(SQSClientInstanceLayer), + Effect.provide(SQS.layer({ region: "eu-central-1" })), Effect.runPromiseExit, ); ``` -or map over `DefaultSQSClientConfigLayer` layer context and update the configuration... +or use `SQS.baseLayer((default) => new SQSClient({ ...default, region: "eu-central-1" }))` diff --git a/packages/client-sqs/src/SQSService.ts b/packages/client-sqs/src/SQSService.ts index 67b923a..64a4de8 100644 --- a/packages/client-sqs/src/SQSService.ts +++ b/packages/client-sqs/src/SQSService.ts @@ -3,6 +3,8 @@ */ import { SQSServiceException, + type SQSClient, + type SQSClientConfig, AddPermissionCommand, type AddPermissionCommandInput, type AddPermissionCommandOutput, @@ -108,10 +110,14 @@ import { TaggedException, } from "./Errors"; import { SQSClientInstance, SQSClientInstanceLayer } from "./SQSClientInstance"; -import { DefaultSQSClientConfigLayer } from "./SQSClientInstanceConfig"; +import { + DefaultSQSClientConfigLayer, + makeDefaultSQSClientInstanceConfig, + SQSClientInstanceConfig, +} from "./SQSClientInstanceConfig"; /** - * @since 1.5.1 + * @since 1.0.0 */ export interface HttpHandlerOptions { /** @@ -567,15 +573,6 @@ interface SQSService$ { >; } -/** - * @since 1.0.0 - * @category models - */ -export class SQSService extends Effect.Tag("@effect-aws/client-sqs/SQSService")< - SQSService, - SQSService$ ->() {} - /** * @since 1.0.0 * @category constructors @@ -626,15 +623,61 @@ export const makeSQSService = Effect.gen(function* (_) { }, {}) as SQSService$; }); +/** + * @since 1.0.0 + * @category models + */ +export class SQSService extends Effect.Tag("@effect-aws/client-sqs/SQSService")< + SQSService, + SQSService$ +>() { + static readonly defaultLayer = Layer.effect(this, makeSQSService).pipe( + Layer.provide(SQSClientInstanceLayer), + Layer.provide(DefaultSQSClientConfigLayer), + ); + static readonly layer = (config: SQSClientConfig) => + Layer.effect(this, makeSQSService).pipe( + Layer.provide(SQSClientInstanceLayer), + Layer.provide( + Layer.effect( + SQSClientInstanceConfig, + makeDefaultSQSClientInstanceConfig.pipe( + Effect.map((defaultConfig) => ({ ...defaultConfig, ...config })), + ), + ), + ), + ); + static readonly baseLayer = ( + evaluate: (defaultConfig: SQSClientConfig) => SQSClient, + ) => + Layer.effect(this, makeSQSService).pipe( + Layer.provide( + Layer.effect( + SQSClientInstance, + Effect.map(makeDefaultSQSClientInstanceConfig, evaluate), + ), + ), + ); +} + +/** + * @since 1.0.0 + * @category models + * @alias SQSService + */ +export const SQS = SQSService; + /** * @since 1.0.0 * @category layers + * @deprecated use SQS.baseLayer instead */ export const BaseSQSServiceLayer = Layer.effect(SQSService, makeSQSService); /** * @since 1.0.0 * @category layers + * @deprecated use SQS.layer instead */ export const SQSServiceLayer = BaseSQSServiceLayer.pipe( Layer.provide(SQSClientInstanceLayer), @@ -643,7 +686,6 @@ export const SQSServiceLayer = BaseSQSServiceLayer.pipe( /** * @since 1.0.0 * @category layers + * @deprecated use SQS.defaultLayer instead */ -export const DefaultSQSServiceLayer = SQSServiceLayer.pipe( - Layer.provide(DefaultSQSClientConfigLayer), -); +export const DefaultSQSServiceLayer = SQSService.defaultLayer; diff --git a/packages/client-sqs/test/SQS.test.ts b/packages/client-sqs/test/SQS.test.ts index 428676e..4d6d537 100644 --- a/packages/client-sqs/test/SQS.test.ts +++ b/packages/client-sqs/test/SQS.test.ts @@ -4,25 +4,23 @@ import { SQSClient, SQSServiceException, } from "@aws-sdk/client-sqs"; +// @ts-ignore +import * as runtimeConfig from "@aws-sdk/client-sqs/dist-cjs/runtimeConfig"; import { mockClient } from "aws-sdk-client-mock"; import * as Effect from "effect/Effect"; import * as Exit from "effect/Exit"; import { pipe } from "effect/Function"; -import * as Layer from "effect/Layer"; -import { - BaseSQSServiceLayer, - DefaultSQSClientConfigLayer, - DefaultSQSServiceLayer, - SQSClientInstance, - SQSClientInstanceConfig, - SQSService, - SQSServiceLayer, - SdkError, -} from "../src"; +import { afterEach, describe, expect, it, vi } from "vitest"; +import { SQS, SdkError } from "../src"; +const getRuntimeConfig = vi.spyOn(runtimeConfig, "getRuntimeConfig"); const clientMock = mockClient(SQSClient); describe("SQSClientImpl", () => { + afterEach(() => { + getRuntimeConfig.mockClear(); + }); + it("default", async () => { clientMock.reset().on(SendMessageCommand).resolves({}); @@ -31,15 +29,19 @@ describe("SQSClientImpl", () => { MessageBody: "Hello world!", }; - const program = SQSService.sendMessage(args); + const program = SQS.sendMessage(args); const result = await pipe( program, - Effect.provide(DefaultSQSServiceLayer), + Effect.provide(SQS.defaultLayer), Effect.runPromiseExit, ); expect(result).toEqual(Exit.succeed({})); + expect(getRuntimeConfig).toHaveBeenCalledTimes(1); + expect(getRuntimeConfig).toHaveBeenCalledWith({ + logger: expect.any(Object), + }); expect(clientMock).toHaveReceivedCommandTimes(SendMessageCommand, 1); expect(clientMock).toHaveReceivedCommandWith(SendMessageCommand, args); }); @@ -52,22 +54,20 @@ describe("SQSClientImpl", () => { MessageBody: "Hello world!", }; - const program = SQSService.sendMessage(args); - - const SQSClientConfigLayer = Layer.succeed(SQSClientInstanceConfig, { - region: "eu-central-1", - }); - const CustomSQSServiceLayer = SQSServiceLayer.pipe( - Layer.provide(SQSClientConfigLayer), - ); + const program = SQS.sendMessage(args); const result = await pipe( program, - Effect.provide(CustomSQSServiceLayer), + Effect.provide(SQS.layer({ region: "eu-central-1" })), Effect.runPromiseExit, ); expect(result).toEqual(Exit.succeed({})); + expect(getRuntimeConfig).toHaveBeenCalledTimes(1); + expect(getRuntimeConfig).toHaveBeenCalledWith({ + region: "eu-central-1", + logger: expect.any(Object), + }); expect(clientMock).toHaveReceivedCommandTimes(SendMessageCommand, 1); expect(clientMock).toHaveReceivedCommandWith(SendMessageCommand, args); }); @@ -80,23 +80,21 @@ describe("SQSClientImpl", () => { MessageBody: "Hello world!", }; - const program = SQSService.sendMessage(args); - - const SQSClientInstanceLayer = Layer.succeed( - SQSClientInstance, - new SQSClient({ region: "eu-central-1" }), - ); - const CustomSQSServiceLayer = BaseSQSServiceLayer.pipe( - Layer.provide(SQSClientInstanceLayer), - ); + const program = SQS.sendMessage(args); const result = await pipe( program, - Effect.provide(CustomSQSServiceLayer), + Effect.provide( + SQS.baseLayer(() => new SQSClient({ region: "eu-central-1" })), + ), Effect.runPromiseExit, ); expect(result).toEqual(Exit.succeed({})); + expect(getRuntimeConfig).toHaveBeenCalledTimes(1); + expect(getRuntimeConfig).toHaveBeenCalledWith({ + region: "eu-central-1", + }); expect(clientMock).toHaveReceivedCommandTimes(SendMessageCommand, 1); expect(clientMock).toHaveReceivedCommandWith(SendMessageCommand, args); }); @@ -109,27 +107,24 @@ describe("SQSClientImpl", () => { MessageBody: "Hello world!", }; - const program = SQSService.sendMessage(args); - - const SQSClientInstanceLayer = Layer.effect( - SQSClientInstance, - Effect.map( - SQSClientInstanceConfig, - (config) => new SQSClient({ ...config, region: "eu-central-1" }), - ), - ); - const CustomSQSServiceLayer = BaseSQSServiceLayer.pipe( - Layer.provide(SQSClientInstanceLayer), - Layer.provide(DefaultSQSClientConfigLayer), - ); + const program = SQS.sendMessage(args); const result = await pipe( program, - Effect.provide(CustomSQSServiceLayer), + Effect.provide( + SQS.baseLayer( + (config) => new SQSClient({ ...config, region: "eu-central-1" }), + ), + ), Effect.runPromiseExit, ); expect(result).toEqual(Exit.succeed({})); + expect(getRuntimeConfig).toHaveBeenCalledTimes(1); + expect(getRuntimeConfig).toHaveBeenCalledWith({ + region: "eu-central-1", + logger: expect.any(Object), + }); expect(clientMock).toHaveReceivedCommandTimes(SendMessageCommand, 1); expect(clientMock).toHaveReceivedCommandWith(SendMessageCommand, args); }); @@ -142,11 +137,11 @@ describe("SQSClientImpl", () => { MessageBody: "Hello world!", }; - const program = SQSService.sendMessage(args); + const program = SQS.sendMessage(args); const result = await pipe( program, - Effect.provide(DefaultSQSServiceLayer), + Effect.provide(SQS.defaultLayer), Effect.runPromiseExit, ); @@ -180,13 +175,13 @@ describe("SQSClientImpl", () => { MessageBody: "Hello world!", }; - const program = SQSService.sendMessage(args).pipe( + const program = SQS.sendMessage(args).pipe( Effect.catchTag("NotHandledException" as any, () => Effect.succeed(null)), ); const result = await pipe( program, - Effect.provide(DefaultSQSServiceLayer), + Effect.provide(SQS.defaultLayer), Effect.runPromiseExit, ); diff --git a/packages/client-ssm/README.md b/packages/client-ssm/README.md index 3e5f0f2..d00ea4c 100644 --- a/packages/client-ssm/README.md +++ b/packages/client-ssm/README.md @@ -14,13 +14,13 @@ npm install --save @effect-aws/client-ssm With default SSMClient instance: ```typescript -import { SSMService, DefaultSSMServiceLayer } from "@effect-aws/client-ssm"; +import { SSM } from "@effect-aws/client-ssm"; -const program = SSMService.describeParameters(args); +const program = SSM.describeParameters(args); const result = pipe( program, - Effect.provide(DefaultSSMServiceLayer), + Effect.provide(SSM.defaultLayer), Effect.runPromise, ); ``` @@ -28,23 +28,15 @@ const result = pipe( With custom SSMClient instance: ```typescript -import { - SSMService, - BaseSSMServiceLayer, - SSMClientInstance, -} from "@effect-aws/client-ssm"; +import { SSM } from "@effect-aws/client-ssm"; -const program = SSMService.describeParameters(args); - -const SSMClientInstanceLayer = Layer.succeed( - SSMClientInstance, - new SSMClient({ region: "eu-central-1" }), -); +const program = SSM.describeParameters(args); const result = await pipe( program, - Effect.provide(BaseSSMServiceLayer), - Effect.provide(SSMClientInstanceLayer), + Effect.provide( + SSM.baseLayer(() => new SSMClient({ region: "eu-central-1" })), + ), Effect.runPromise, ); ``` @@ -52,34 +44,15 @@ const result = await pipe( With custom SSMClient configuration: ```typescript -import { - SSMService, - BaseSSMServiceLayer, - DefaultSSMClientConfigLayer, - SSMClientInstance, - SSMClientInstanceConfig, -} from "@effect-aws/client-ssm"; - -const program = SSMService.describeParameters(args); - -const SSMClientInstanceLayer = Layer.provide( - Layer.effect( - SSMClientInstance, - SSMClientInstanceConfig.pipe( - Effect.map( - (config) => new SSMClient({ ...config, region: "eu-central-1" }), - ), - ), - ), - DefaultSSMClientConfigLayer, -); +import { SSM } from "@effect-aws/client-ssm"; + +const program = SSM.describeParameters(args); const result = await pipe( program, - Effect.provide(BaseSSMServiceLayer), - Effect.provide(SSMClientInstanceLayer), + Effect.provide(SSM.layer({ region: "eu-central-1" })), Effect.runPromiseExit, ); ``` -or map over `DefaultSSMClientConfigLayer` layer context and update the configuration... +or use `SSM.baseLayer((default) => new SSMClient({ ...default, region: "eu-central-1" }))` diff --git a/packages/client-ssm/src/SSMService.ts b/packages/client-ssm/src/SSMService.ts index 17d1a28..2abc4d3 100644 --- a/packages/client-ssm/src/SSMService.ts +++ b/packages/client-ssm/src/SSMService.ts @@ -3,6 +3,8 @@ */ import { SSMServiceException, + type SSMClient, + type SSMClientConfig, AddTagsToResourceCommand, type AddTagsToResourceCommandInput, type AddTagsToResourceCommandOutput, @@ -564,10 +566,14 @@ import { TaggedException, } from "./Errors"; import { SSMClientInstance, SSMClientInstanceLayer } from "./SSMClientInstance"; -import { DefaultSSMClientConfigLayer } from "./SSMClientInstanceConfig"; +import { + DefaultSSMClientConfigLayer, + makeDefaultSSMClientInstanceConfig, + SSMClientInstanceConfig, +} from "./SSMClientInstanceConfig"; /** - * @since 1.1.1 + * @since 1.0.0 */ export interface HttpHandlerOptions { /** @@ -2695,15 +2701,6 @@ interface SSMService$ { >; } -/** - * @since 1.0.0 - * @category models - */ -export class SSMService extends Effect.Tag("@effect-aws/client-ssm/SSMService")< - SSMService, - SSMService$ ->() {} - /** * @since 1.0.0 * @category constructors @@ -2754,15 +2751,61 @@ export const makeSSMService = Effect.gen(function* (_) { }, {}) as SSMService$; }); +/** + * @since 1.0.0 + * @category models + */ +export class SSMService extends Effect.Tag("@effect-aws/client-ssm/SSMService")< + SSMService, + SSMService$ +>() { + static readonly defaultLayer = Layer.effect(this, makeSSMService).pipe( + Layer.provide(SSMClientInstanceLayer), + Layer.provide(DefaultSSMClientConfigLayer), + ); + static readonly layer = (config: SSMClientConfig) => + Layer.effect(this, makeSSMService).pipe( + Layer.provide(SSMClientInstanceLayer), + Layer.provide( + Layer.effect( + SSMClientInstanceConfig, + makeDefaultSSMClientInstanceConfig.pipe( + Effect.map((defaultConfig) => ({ ...defaultConfig, ...config })), + ), + ), + ), + ); + static readonly baseLayer = ( + evaluate: (defaultConfig: SSMClientConfig) => SSMClient, + ) => + Layer.effect(this, makeSSMService).pipe( + Layer.provide( + Layer.effect( + SSMClientInstance, + Effect.map(makeDefaultSSMClientInstanceConfig, evaluate), + ), + ), + ); +} + +/** + * @since 1.0.0 + * @category models + * @alias SSMService + */ +export const SSM = SSMService; + /** * @since 1.0.0 * @category layers + * @deprecated use SSM.baseLayer instead */ export const BaseSSMServiceLayer = Layer.effect(SSMService, makeSSMService); /** * @since 1.0.0 * @category layers + * @deprecated use SSM.layer instead */ export const SSMServiceLayer = BaseSSMServiceLayer.pipe( Layer.provide(SSMClientInstanceLayer), @@ -2771,7 +2814,6 @@ export const SSMServiceLayer = BaseSSMServiceLayer.pipe( /** * @since 1.0.0 * @category layers + * @deprecated use SSM.defaultLayer instead */ -export const DefaultSSMServiceLayer = SSMServiceLayer.pipe( - Layer.provide(DefaultSSMClientConfigLayer), -); +export const DefaultSSMServiceLayer = SSMService.defaultLayer; diff --git a/packages/client-ssm/test/SSM.test.ts b/packages/client-ssm/test/SSM.test.ts index 9dfd90f..b905b9d 100644 --- a/packages/client-ssm/test/SSM.test.ts +++ b/packages/client-ssm/test/SSM.test.ts @@ -4,39 +4,41 @@ import { SSMClient, SSMServiceException, } from "@aws-sdk/client-ssm"; +// @ts-ignore +import * as runtimeConfig from "@aws-sdk/client-ssm/dist-cjs/runtimeConfig"; import { mockClient } from "aws-sdk-client-mock"; import * as Effect from "effect/Effect"; import * as Exit from "effect/Exit"; import { pipe } from "effect/Function"; -import * as Layer from "effect/Layer"; -import { - BaseSSMServiceLayer, - DefaultSSMClientConfigLayer, - DefaultSSMServiceLayer, - SSMClientInstance, - SSMClientInstanceConfig, - SSMService, - SSMServiceLayer, - SdkError, -} from "../src"; +import { afterEach, describe, expect, it, vi } from "vitest"; +import { SSM, SdkError } from "../src"; +const getRuntimeConfig = vi.spyOn(runtimeConfig, "getRuntimeConfig"); const clientMock = mockClient(SSMClient); describe("SSMClientImpl", () => { + afterEach(() => { + getRuntimeConfig.mockClear(); + }); + it("default", async () => { clientMock.reset().on(DescribeParametersCommand).resolves({}); const args = {} as unknown as DescribeParametersCommandInput; - const program = SSMService.describeParameters(args); + const program = SSM.describeParameters(args); const result = await pipe( program, - Effect.provide(DefaultSSMServiceLayer), + Effect.provide(SSM.defaultLayer), Effect.runPromiseExit, ); expect(result).toEqual(Exit.succeed({})); + expect(getRuntimeConfig).toHaveBeenCalledTimes(1); + expect(getRuntimeConfig).toHaveBeenCalledWith({ + logger: expect.any(Object), + }); expect(clientMock).toHaveReceivedCommandTimes(DescribeParametersCommand, 1); expect(clientMock).toHaveReceivedCommandWith( DescribeParametersCommand, @@ -49,22 +51,20 @@ describe("SSMClientImpl", () => { const args = {} as unknown as DescribeParametersCommandInput; - const program = SSMService.describeParameters(args); - - const SSMClientConfigLayer = Layer.succeed(SSMClientInstanceConfig, { - region: "eu-central-1", - }); - const CustomSSMServiceLayer = SSMServiceLayer.pipe( - Layer.provide(SSMClientConfigLayer), - ); + const program = SSM.describeParameters(args); const result = await pipe( program, - Effect.provide(CustomSSMServiceLayer), + Effect.provide(SSM.layer({ region: "eu-central-1" })), Effect.runPromiseExit, ); expect(result).toEqual(Exit.succeed({})); + expect(getRuntimeConfig).toHaveBeenCalledTimes(1); + expect(getRuntimeConfig).toHaveBeenCalledWith({ + region: "eu-central-1", + logger: expect.any(Object), + }); expect(clientMock).toHaveReceivedCommandTimes(DescribeParametersCommand, 1); expect(clientMock).toHaveReceivedCommandWith( DescribeParametersCommand, @@ -77,23 +77,21 @@ describe("SSMClientImpl", () => { const args = {} as unknown as DescribeParametersCommandInput; - const program = SSMService.describeParameters(args); - - const SSMClientInstanceLayer = Layer.succeed( - SSMClientInstance, - new SSMClient({ region: "eu-central-1" }), - ); - const CustomSSMServiceLayer = BaseSSMServiceLayer.pipe( - Layer.provide(SSMClientInstanceLayer), - ); + const program = SSM.describeParameters(args); const result = await pipe( program, - Effect.provide(CustomSSMServiceLayer), + Effect.provide( + SSM.baseLayer(() => new SSMClient({ region: "eu-central-1" })), + ), Effect.runPromiseExit, ); expect(result).toEqual(Exit.succeed({})); + expect(getRuntimeConfig).toHaveBeenCalledTimes(1); + expect(getRuntimeConfig).toHaveBeenCalledWith({ + region: "eu-central-1", + }); expect(clientMock).toHaveReceivedCommandTimes(DescribeParametersCommand, 1); expect(clientMock).toHaveReceivedCommandWith( DescribeParametersCommand, @@ -106,27 +104,24 @@ describe("SSMClientImpl", () => { const args = {} as unknown as DescribeParametersCommandInput; - const program = SSMService.describeParameters(args); - - const SSMClientInstanceLayer = Layer.effect( - SSMClientInstance, - Effect.map( - SSMClientInstanceConfig, - (config) => new SSMClient({ ...config, region: "eu-central-1" }), - ), - ); - const CustomSSMServiceLayer = BaseSSMServiceLayer.pipe( - Layer.provide(SSMClientInstanceLayer), - Layer.provide(DefaultSSMClientConfigLayer), - ); + const program = SSM.describeParameters(args); const result = await pipe( program, - Effect.provide(CustomSSMServiceLayer), + Effect.provide( + SSM.baseLayer( + (config) => new SSMClient({ ...config, region: "eu-central-1" }), + ), + ), Effect.runPromiseExit, ); expect(result).toEqual(Exit.succeed({})); + expect(getRuntimeConfig).toHaveBeenCalledTimes(1); + expect(getRuntimeConfig).toHaveBeenCalledWith({ + region: "eu-central-1", + logger: expect.any(Object), + }); expect(clientMock).toHaveReceivedCommandTimes(DescribeParametersCommand, 1); expect(clientMock).toHaveReceivedCommandWith( DescribeParametersCommand, @@ -139,11 +134,11 @@ describe("SSMClientImpl", () => { const args = {} as unknown as DescribeParametersCommandInput; - const program = SSMService.describeParameters(args); + const program = SSM.describeParameters(args); const result = await pipe( program, - Effect.provide(DefaultSSMServiceLayer), + Effect.provide(SSM.defaultLayer), Effect.runPromiseExit, ); @@ -177,13 +172,13 @@ describe("SSMClientImpl", () => { const args = {} as unknown as DescribeParametersCommandInput; - const program = SSMService.describeParameters(args).pipe( + const program = SSM.describeParameters(args).pipe( Effect.catchTag("NotHandledException" as any, () => Effect.succeed(null)), ); const result = await pipe( program, - Effect.provide(DefaultSSMServiceLayer), + Effect.provide(SSM.defaultLayer), Effect.runPromiseExit, ); diff --git a/packages/client-sts/README.md b/packages/client-sts/README.md index bd682d1..9fa3536 100644 --- a/packages/client-sts/README.md +++ b/packages/client-sts/README.md @@ -14,13 +14,13 @@ npm install --save @effect-aws/client-sts With default STSClient instance: ```typescript -import { STSService, DefaultSTSServiceLayer } from "@effect-aws/client-sts"; +import { STS } from "@effect-aws/client-sts"; -const program = STSService.getCallerIdentity(args); +const program = STS.getCallerIdentity(args); const result = pipe( program, - Effect.provide(DefaultSTSServiceLayer), + Effect.provide(STS.defaultLayer), Effect.runPromise, ); ``` @@ -28,23 +28,15 @@ const result = pipe( With custom STSClient instance: ```typescript -import { - STSService, - BaseSTSServiceLayer, - STSClientInstance, -} from "@effect-aws/client-sts"; +import { STS } from "@effect-aws/client-sts"; -const program = STSService.getCallerIdentity(args); - -const STSClientInstanceLayer = Layer.succeed( - STSClientInstance, - new STSClient({ region: "eu-central-1" }), -); +const program = STS.getCallerIdentity(args); const result = await pipe( program, - Effect.provide(BaseSTSServiceLayer), - Effect.provide(STSClientInstanceLayer), + Effect.provide( + STS.baseLayer(() => new STSClient({ region: "eu-central-1" })), + ), Effect.runPromise, ); ``` @@ -52,34 +44,15 @@ const result = await pipe( With custom STSClient configuration: ```typescript -import { - STSService, - BaseSTSServiceLayer, - DefaultSTSClientConfigLayer, - STSClientInstance, - STSClientInstanceConfig, -} from "@effect-aws/client-sts"; - -const program = STSService.getCallerIdentity(args); - -const STSClientInstanceLayer = Layer.provide( - Layer.effect( - STSClientInstance, - STSClientInstanceConfig.pipe( - Effect.map( - (config) => new STSClient({ ...config, region: "eu-central-1" }), - ), - ), - ), - DefaultSTSClientConfigLayer, -); +import { STS } from "@effect-aws/client-sts"; + +const program = STS.getCallerIdentity(args); const result = await pipe( program, - Effect.provide(BaseSTSServiceLayer), - Effect.provide(STSClientInstanceLayer), + Effect.provide(STS.layer({ region: "eu-central-1" })), Effect.runPromiseExit, ); ``` -or map over `DefaultSTSClientConfigLayer` layer context and update the configuration... +or use `STS.baseLayer((default) => new STSClient({ ...default, region: "eu-central-1" }))` diff --git a/packages/client-sts/src/STSService.ts b/packages/client-sts/src/STSService.ts index ed316ab..fb9806f 100644 --- a/packages/client-sts/src/STSService.ts +++ b/packages/client-sts/src/STSService.ts @@ -3,6 +3,8 @@ */ import { STSServiceException, + type STSClient, + type STSClientConfig, AssumeRoleCommand, type AssumeRoleCommandInput, type AssumeRoleCommandOutput, @@ -43,10 +45,14 @@ import { TaggedException, } from "./Errors"; import { STSClientInstance, STSClientInstanceLayer } from "./STSClientInstance"; -import { DefaultSTSClientConfigLayer } from "./STSClientInstanceConfig"; +import { + DefaultSTSClientConfigLayer, + makeDefaultSTSClientInstanceConfig, + STSClientInstanceConfig, +} from "./STSClientInstanceConfig"; /** - * @since 1.0.1 + * @since 1.0.0 */ export interface HttpHandlerOptions { /** @@ -173,15 +179,6 @@ interface STSService$ { >; } -/** - * @since 1.0.0 - * @category models - */ -export class STSService extends Effect.Tag("@effect-aws/client-sts/STSService")< - STSService, - STSService$ ->() {} - /** * @since 1.0.0 * @category constructors @@ -232,15 +229,61 @@ export const makeSTSService = Effect.gen(function* (_) { }, {}) as STSService$; }); +/** + * @since 1.0.0 + * @category models + */ +export class STSService extends Effect.Tag("@effect-aws/client-sts/STSService")< + STSService, + STSService$ +>() { + static readonly defaultLayer = Layer.effect(this, makeSTSService).pipe( + Layer.provide(STSClientInstanceLayer), + Layer.provide(DefaultSTSClientConfigLayer), + ); + static readonly layer = (config: STSClientConfig) => + Layer.effect(this, makeSTSService).pipe( + Layer.provide(STSClientInstanceLayer), + Layer.provide( + Layer.effect( + STSClientInstanceConfig, + makeDefaultSTSClientInstanceConfig.pipe( + Effect.map((defaultConfig) => ({ ...defaultConfig, ...config })), + ), + ), + ), + ); + static readonly baseLayer = ( + evaluate: (defaultConfig: STSClientConfig) => STSClient, + ) => + Layer.effect(this, makeSTSService).pipe( + Layer.provide( + Layer.effect( + STSClientInstance, + Effect.map(makeDefaultSTSClientInstanceConfig, evaluate), + ), + ), + ); +} + +/** + * @since 1.0.0 + * @category models + * @alias STSService + */ +export const STS = STSService; + /** * @since 1.0.0 * @category layers + * @deprecated use STS.baseLayer instead */ export const BaseSTSServiceLayer = Layer.effect(STSService, makeSTSService); /** * @since 1.0.0 * @category layers + * @deprecated use STS.layer instead */ export const STSServiceLayer = BaseSTSServiceLayer.pipe( Layer.provide(STSClientInstanceLayer), @@ -249,7 +292,6 @@ export const STSServiceLayer = BaseSTSServiceLayer.pipe( /** * @since 1.0.0 * @category layers + * @deprecated use STS.defaultLayer instead */ -export const DefaultSTSServiceLayer = STSServiceLayer.pipe( - Layer.provide(DefaultSTSClientConfigLayer), -); +export const DefaultSTSServiceLayer = STSService.defaultLayer; diff --git a/packages/client-sts/test/STS.test.ts b/packages/client-sts/test/STS.test.ts index 7429d1f..f98c2cd 100644 --- a/packages/client-sts/test/STS.test.ts +++ b/packages/client-sts/test/STS.test.ts @@ -4,39 +4,41 @@ import { STSClient, STSServiceException, } from "@aws-sdk/client-sts"; +// @ts-ignore +import * as runtimeConfig from "@aws-sdk/client-sts/dist-cjs/runtimeConfig"; import { mockClient } from "aws-sdk-client-mock"; import * as Effect from "effect/Effect"; import * as Exit from "effect/Exit"; import { pipe } from "effect/Function"; -import * as Layer from "effect/Layer"; -import { - BaseSTSServiceLayer, - DefaultSTSClientConfigLayer, - DefaultSTSServiceLayer, - STSClientInstance, - STSClientInstanceConfig, - STSService, - STSServiceLayer, - SdkError, -} from "../src"; +import { afterEach, describe, expect, it, vi } from "vitest"; +import { STS, SdkError } from "../src"; +const getRuntimeConfig = vi.spyOn(runtimeConfig, "getRuntimeConfig"); const clientMock = mockClient(STSClient); describe("STSClientImpl", () => { + afterEach(() => { + getRuntimeConfig.mockClear(); + }); + it("default", async () => { clientMock.reset().on(GetCallerIdentityCommand).resolves({}); const args = {} as unknown as GetCallerIdentityCommandInput; - const program = STSService.getCallerIdentity(args); + const program = STS.getCallerIdentity(args); const result = await pipe( program, - Effect.provide(DefaultSTSServiceLayer), + Effect.provide(STS.defaultLayer), Effect.runPromiseExit, ); expect(result).toEqual(Exit.succeed({})); + expect(getRuntimeConfig).toHaveBeenCalledTimes(1); + expect(getRuntimeConfig).toHaveBeenCalledWith({ + logger: expect.any(Object), + }); expect(clientMock).toHaveReceivedCommandTimes(GetCallerIdentityCommand, 1); expect(clientMock).toHaveReceivedCommandWith( GetCallerIdentityCommand, @@ -49,22 +51,20 @@ describe("STSClientImpl", () => { const args = {} as unknown as GetCallerIdentityCommandInput; - const program = STSService.getCallerIdentity(args); - - const STSClientConfigLayer = Layer.succeed(STSClientInstanceConfig, { - region: "eu-central-1", - }); - const CustomSTSServiceLayer = STSServiceLayer.pipe( - Layer.provide(STSClientConfigLayer), - ); + const program = STS.getCallerIdentity(args); const result = await pipe( program, - Effect.provide(CustomSTSServiceLayer), + Effect.provide(STS.layer({ region: "eu-central-1" })), Effect.runPromiseExit, ); expect(result).toEqual(Exit.succeed({})); + expect(getRuntimeConfig).toHaveBeenCalledTimes(1); + expect(getRuntimeConfig).toHaveBeenCalledWith({ + region: "eu-central-1", + logger: expect.any(Object), + }); expect(clientMock).toHaveReceivedCommandTimes(GetCallerIdentityCommand, 1); expect(clientMock).toHaveReceivedCommandWith( GetCallerIdentityCommand, @@ -77,23 +77,21 @@ describe("STSClientImpl", () => { const args = {} as unknown as GetCallerIdentityCommandInput; - const program = STSService.getCallerIdentity(args); - - const STSClientInstanceLayer = Layer.succeed( - STSClientInstance, - new STSClient({ region: "eu-central-1" }), - ); - const CustomSTSServiceLayer = BaseSTSServiceLayer.pipe( - Layer.provide(STSClientInstanceLayer), - ); + const program = STS.getCallerIdentity(args); const result = await pipe( program, - Effect.provide(CustomSTSServiceLayer), + Effect.provide( + STS.baseLayer(() => new STSClient({ region: "eu-central-1" })), + ), Effect.runPromiseExit, ); expect(result).toEqual(Exit.succeed({})); + expect(getRuntimeConfig).toHaveBeenCalledTimes(1); + expect(getRuntimeConfig).toHaveBeenCalledWith({ + region: "eu-central-1", + }); expect(clientMock).toHaveReceivedCommandTimes(GetCallerIdentityCommand, 1); expect(clientMock).toHaveReceivedCommandWith( GetCallerIdentityCommand, @@ -106,27 +104,24 @@ describe("STSClientImpl", () => { const args = {} as unknown as GetCallerIdentityCommandInput; - const program = STSService.getCallerIdentity(args); - - const STSClientInstanceLayer = Layer.effect( - STSClientInstance, - Effect.map( - STSClientInstanceConfig, - (config) => new STSClient({ ...config, region: "eu-central-1" }), - ), - ); - const CustomSTSServiceLayer = BaseSTSServiceLayer.pipe( - Layer.provide(STSClientInstanceLayer), - Layer.provide(DefaultSTSClientConfigLayer), - ); + const program = STS.getCallerIdentity(args); const result = await pipe( program, - Effect.provide(CustomSTSServiceLayer), + Effect.provide( + STS.baseLayer( + (config) => new STSClient({ ...config, region: "eu-central-1" }), + ), + ), Effect.runPromiseExit, ); expect(result).toEqual(Exit.succeed({})); + expect(getRuntimeConfig).toHaveBeenCalledTimes(1); + expect(getRuntimeConfig).toHaveBeenCalledWith({ + region: "eu-central-1", + logger: expect.any(Object), + }); expect(clientMock).toHaveReceivedCommandTimes(GetCallerIdentityCommand, 1); expect(clientMock).toHaveReceivedCommandWith( GetCallerIdentityCommand, @@ -139,11 +134,11 @@ describe("STSClientImpl", () => { const args = {} as unknown as GetCallerIdentityCommandInput; - const program = STSService.getCallerIdentity(args); + const program = STS.getCallerIdentity(args); const result = await pipe( program, - Effect.provide(DefaultSTSServiceLayer), + Effect.provide(STS.defaultLayer), Effect.runPromiseExit, ); @@ -177,13 +172,13 @@ describe("STSClientImpl", () => { const args = {} as unknown as GetCallerIdentityCommandInput; - const program = STSService.getCallerIdentity(args).pipe( + const program = STS.getCallerIdentity(args).pipe( Effect.catchTag("NotHandledException" as any, () => Effect.succeed(null)), ); const result = await pipe( program, - Effect.provide(DefaultSTSServiceLayer), + Effect.provide(STS.defaultLayer), Effect.runPromiseExit, ); diff --git a/packages/client-textract/README.md b/packages/client-textract/README.md index 1fcd957..e719bdf 100644 --- a/packages/client-textract/README.md +++ b/packages/client-textract/README.md @@ -14,13 +14,13 @@ npm install --save @effect-aws/client-textract With default TextractClient instance: ```typescript -import { TextractService, DefaultTextractServiceLayer } from "@effect-aws/client-textract"; +import { Textract } from "@effect-aws/client-textract"; -const program = TextractService.listAdapters(args); +const program = Textract.listAdapters(args); const result = pipe( program, - Effect.provide(DefaultTextractServiceLayer), + Effect.provide(Textract.defaultLayer), Effect.runPromise, ); ``` @@ -28,23 +28,15 @@ const result = pipe( With custom TextractClient instance: ```typescript -import { - TextractService, - BaseTextractServiceLayer, - TextractClientInstance, -} from "@effect-aws/client-textract"; +import { Textract } from "@effect-aws/client-textract"; -const program = TextractService.listAdapters(args); - -const TextractClientInstanceLayer = Layer.succeed( - TextractClientInstance, - new TextractClient({ region: "eu-central-1" }), -); +const program = Textract.listAdapters(args); const result = await pipe( program, - Effect.provide(BaseTextractServiceLayer), - Effect.provide(TextractClientInstanceLayer), + Effect.provide( + Textract.baseLayer(() => new TextractClient({ region: "eu-central-1" })), + ), Effect.runPromise, ); ``` @@ -52,34 +44,15 @@ const result = await pipe( With custom TextractClient configuration: ```typescript -import { - TextractService, - BaseTextractServiceLayer, - DefaultTextractClientConfigLayer, - TextractClientInstance, - TextractClientInstanceConfig, -} from "@effect-aws/client-textract"; - -const program = TextractService.listAdapters(args); - -const TextractClientInstanceLayer = Layer.provide( - Layer.effect( - TextractClientInstance, - TextractClientInstanceConfig.pipe( - Effect.map( - (config) => new TextractClient({ ...config, region: "eu-central-1" }), - ), - ), - ), - DefaultTextractClientConfigLayer, -); +import { Textract } from "@effect-aws/client-textract"; + +const program = Textract.listAdapters(args); const result = await pipe( program, - Effect.provide(BaseTextractServiceLayer), - Effect.provide(TextractClientInstanceLayer), + Effect.provide(Textract.layer({ region: "eu-central-1" })), Effect.runPromiseExit, ); ``` -or map over `DefaultTextractClientConfigLayer` layer context and update the configuration... +or use `Textract.baseLayer((default) => new TextractClient({ ...default, region: "eu-central-1" }))` diff --git a/packages/client-textract/src/TextractService.ts b/packages/client-textract/src/TextractService.ts index c02c92e..5ae3604 100644 --- a/packages/client-textract/src/TextractService.ts +++ b/packages/client-textract/src/TextractService.ts @@ -3,6 +3,8 @@ */ import { TextractServiceException, + type TextractClient, + type TextractClientConfig, AnalyzeDocumentCommand, type AnalyzeDocumentCommandInput, type AnalyzeDocumentCommandOutput, @@ -107,10 +109,14 @@ import { TextractClientInstance, TextractClientInstanceLayer, } from "./TextractClientInstance"; -import { DefaultTextractClientConfigLayer } from "./TextractClientInstanceConfig"; +import { + DefaultTextractClientConfigLayer, + makeDefaultTextractClientInstanceConfig, + TextractClientInstanceConfig, +} from "./TextractClientInstanceConfig"; /** - * @since 1.0.1 + * @since 1.0.0 */ export interface HttpHandlerOptions { /** @@ -648,14 +654,6 @@ interface TextractService$ { >; } -/** - * @since 1.0.0 - * @category models - */ -export class TextractService extends Effect.Tag( - "@effect-aws/client-textract/TextractService", -)() {} - /** * @since 1.0.0 * @category constructors @@ -706,9 +704,53 @@ export const makeTextractService = Effect.gen(function* (_) { }, {}) as TextractService$; }); +/** + * @since 1.0.0 + * @category models + */ +export class TextractService extends Effect.Tag( + "@effect-aws/client-textract/TextractService", +)() { + static readonly defaultLayer = Layer.effect(this, makeTextractService).pipe( + Layer.provide(TextractClientInstanceLayer), + Layer.provide(DefaultTextractClientConfigLayer), + ); + static readonly layer = (config: TextractClientConfig) => + Layer.effect(this, makeTextractService).pipe( + Layer.provide(TextractClientInstanceLayer), + Layer.provide( + Layer.effect( + TextractClientInstanceConfig, + makeDefaultTextractClientInstanceConfig.pipe( + Effect.map((defaultConfig) => ({ ...defaultConfig, ...config })), + ), + ), + ), + ); + static readonly baseLayer = ( + evaluate: (defaultConfig: TextractClientConfig) => TextractClient, + ) => + Layer.effect(this, makeTextractService).pipe( + Layer.provide( + Layer.effect( + TextractClientInstance, + Effect.map(makeDefaultTextractClientInstanceConfig, evaluate), + ), + ), + ); +} + +/** + * @since 1.0.0 + * @category models + * @alias TextractService + */ +export const Textract = TextractService; + /** * @since 1.0.0 * @category layers + * @deprecated use Textract.baseLayer instead */ export const BaseTextractServiceLayer = Layer.effect( TextractService, @@ -718,6 +760,7 @@ export const BaseTextractServiceLayer = Layer.effect( /** * @since 1.0.0 * @category layers + * @deprecated use Textract.layer instead */ export const TextractServiceLayer = BaseTextractServiceLayer.pipe( Layer.provide(TextractClientInstanceLayer), @@ -726,7 +769,6 @@ export const TextractServiceLayer = BaseTextractServiceLayer.pipe( /** * @since 1.0.0 * @category layers + * @deprecated use Textract.defaultLayer instead */ -export const DefaultTextractServiceLayer = TextractServiceLayer.pipe( - Layer.provide(DefaultTextractClientConfigLayer), -); +export const DefaultTextractServiceLayer = TextractService.defaultLayer; diff --git a/packages/client-textract/test/Textract.test.ts b/packages/client-textract/test/Textract.test.ts index a791056..7ff5fe6 100644 --- a/packages/client-textract/test/Textract.test.ts +++ b/packages/client-textract/test/Textract.test.ts @@ -4,39 +4,41 @@ import { TextractClient, TextractServiceException, } from "@aws-sdk/client-textract"; +// @ts-ignore +import * as runtimeConfig from "@aws-sdk/client-textract/dist-cjs/runtimeConfig"; import { mockClient } from "aws-sdk-client-mock"; import * as Effect from "effect/Effect"; import * as Exit from "effect/Exit"; import { pipe } from "effect/Function"; -import * as Layer from "effect/Layer"; -import { - BaseTextractServiceLayer, - DefaultTextractClientConfigLayer, - DefaultTextractServiceLayer, - TextractClientInstance, - TextractClientInstanceConfig, - TextractService, - TextractServiceLayer, - SdkError, -} from "../src"; +import { afterEach, describe, expect, it, vi } from "vitest"; +import { Textract, SdkError } from "../src"; +const getRuntimeConfig = vi.spyOn(runtimeConfig, "getRuntimeConfig"); const clientMock = mockClient(TextractClient); describe("TextractClientImpl", () => { + afterEach(() => { + getRuntimeConfig.mockClear(); + }); + it("default", async () => { clientMock.reset().on(ListAdaptersCommand).resolves({}); const args = {} as unknown as ListAdaptersCommandInput; - const program = TextractService.listAdapters(args); + const program = Textract.listAdapters(args); const result = await pipe( program, - Effect.provide(DefaultTextractServiceLayer), + Effect.provide(Textract.defaultLayer), Effect.runPromiseExit, ); expect(result).toEqual(Exit.succeed({})); + expect(getRuntimeConfig).toHaveBeenCalledTimes(1); + expect(getRuntimeConfig).toHaveBeenCalledWith({ + logger: expect.any(Object), + }); expect(clientMock).toHaveReceivedCommandTimes(ListAdaptersCommand, 1); expect(clientMock).toHaveReceivedCommandWith(ListAdaptersCommand, args); }); @@ -46,25 +48,20 @@ describe("TextractClientImpl", () => { const args = {} as unknown as ListAdaptersCommandInput; - const program = TextractService.listAdapters(args); - - const TextractClientConfigLayer = Layer.succeed( - TextractClientInstanceConfig, - { - region: "eu-central-1", - }, - ); - const CustomTextractServiceLayer = TextractServiceLayer.pipe( - Layer.provide(TextractClientConfigLayer), - ); + const program = Textract.listAdapters(args); const result = await pipe( program, - Effect.provide(CustomTextractServiceLayer), + Effect.provide(Textract.layer({ region: "eu-central-1" })), Effect.runPromiseExit, ); expect(result).toEqual(Exit.succeed({})); + expect(getRuntimeConfig).toHaveBeenCalledTimes(1); + expect(getRuntimeConfig).toHaveBeenCalledWith({ + region: "eu-central-1", + logger: expect.any(Object), + }); expect(clientMock).toHaveReceivedCommandTimes(ListAdaptersCommand, 1); expect(clientMock).toHaveReceivedCommandWith(ListAdaptersCommand, args); }); @@ -74,23 +71,23 @@ describe("TextractClientImpl", () => { const args = {} as unknown as ListAdaptersCommandInput; - const program = TextractService.listAdapters(args); - - const TextractClientInstanceLayer = Layer.succeed( - TextractClientInstance, - new TextractClient({ region: "eu-central-1" }), - ); - const CustomTextractServiceLayer = BaseTextractServiceLayer.pipe( - Layer.provide(TextractClientInstanceLayer), - ); + const program = Textract.listAdapters(args); const result = await pipe( program, - Effect.provide(CustomTextractServiceLayer), + Effect.provide( + Textract.baseLayer( + () => new TextractClient({ region: "eu-central-1" }), + ), + ), Effect.runPromiseExit, ); expect(result).toEqual(Exit.succeed({})); + expect(getRuntimeConfig).toHaveBeenCalledTimes(1); + expect(getRuntimeConfig).toHaveBeenCalledWith({ + region: "eu-central-1", + }); expect(clientMock).toHaveReceivedCommandTimes(ListAdaptersCommand, 1); expect(clientMock).toHaveReceivedCommandWith(ListAdaptersCommand, args); }); @@ -100,27 +97,24 @@ describe("TextractClientImpl", () => { const args = {} as unknown as ListAdaptersCommandInput; - const program = TextractService.listAdapters(args); - - const TextractClientInstanceLayer = Layer.effect( - TextractClientInstance, - Effect.map( - TextractClientInstanceConfig, - (config) => new TextractClient({ ...config, region: "eu-central-1" }), - ), - ); - const CustomTextractServiceLayer = BaseTextractServiceLayer.pipe( - Layer.provide(TextractClientInstanceLayer), - Layer.provide(DefaultTextractClientConfigLayer), - ); + const program = Textract.listAdapters(args); const result = await pipe( program, - Effect.provide(CustomTextractServiceLayer), + Effect.provide( + Textract.baseLayer( + (config) => new TextractClient({ ...config, region: "eu-central-1" }), + ), + ), Effect.runPromiseExit, ); expect(result).toEqual(Exit.succeed({})); + expect(getRuntimeConfig).toHaveBeenCalledTimes(1); + expect(getRuntimeConfig).toHaveBeenCalledWith({ + region: "eu-central-1", + logger: expect.any(Object), + }); expect(clientMock).toHaveReceivedCommandTimes(ListAdaptersCommand, 1); expect(clientMock).toHaveReceivedCommandWith(ListAdaptersCommand, args); }); @@ -130,11 +124,11 @@ describe("TextractClientImpl", () => { const args = {} as unknown as ListAdaptersCommandInput; - const program = TextractService.listAdapters(args); + const program = Textract.listAdapters(args); const result = await pipe( program, - Effect.provide(DefaultTextractServiceLayer), + Effect.provide(Textract.defaultLayer), Effect.runPromiseExit, ); @@ -165,13 +159,13 @@ describe("TextractClientImpl", () => { const args = {} as unknown as ListAdaptersCommandInput; - const program = TextractService.listAdapters(args).pipe( + const program = Textract.listAdapters(args).pipe( Effect.catchTag("NotHandledException" as any, () => Effect.succeed(null)), ); const result = await pipe( program, - Effect.provide(DefaultTextractServiceLayer), + Effect.provide(Textract.defaultLayer), Effect.runPromiseExit, ); diff --git a/scripts/client-singularities.json b/scripts/client-singularities.json new file mode 100644 index 0000000..0d3656b --- /dev/null +++ b/scripts/client-singularities.json @@ -0,0 +1,124 @@ +{ + "client-account": { + "commandToTest": "ListRegions" + }, + "client-api-gateway-management-api": { + "commandToTest": "PostToConnection", + "inputToTest": { + "ConnectionId": "test", + "Data": "test" + } + }, + "client-bedrock": { + "commandToTest": "ListCustomModels" + }, + "client-cloudsearch": { + "commandToTest": "DescribeDomains" + }, + "client-cloudtrail": { + "commandToTest": "ListTrails" + }, + "client-cloudwatch": { + "commandToTest": "DescribeAlarms" + }, + "client-cloudwatch-events": { + "commandToTest": "ListRules" + }, + "client-cloudwatch-logs": { + "commandToTest": "DescribeLogGroups" + }, + "client-codedeploy": { + "commandToTest": "ListApplications" + }, + "client-cognito-identity-provider": { + "commandToTest": "ListUserPools" + }, + "client-dynamodb": { + "commandToTest": "PutItem", + "inputToTest": { + "TableName": "test", + "Item": { "testAttr": { "S": "test" } } + } + }, + "client-elasticache": { + "commandToTest": "ListTagsForResource", + "inputToTest": { + "ResourceName": "test" + } + }, + "client-eventbridge": { + "commandToTest": "PutEvents", + "inputToTest": { "Entries": [{ "Detail": "test" }] } + }, + "client-iam": { + "commandToTest": "CreateRole" + }, + "client-kinesis": { + "commandToTest": "PutRecord" + }, + "client-kms": { + "commandToTest": "ListKeys" + }, + "client-lambda": { + "commandToTest": "Invoke", + "inputToTest": { + "FunctionName": "test", + "Payload": "test" + } + }, + "client-mq": { + "commandToTest": "ListBrokers" + }, + "client-opensearch": { + "commandToTest": "DescribeDomains" + }, + "client-opensearch-serverless": { + "commandToTest": "ListCollections" + }, + "client-rds": { + "commandToTest": "DescribeDBInstances" + }, + "client-s3": { + "commandToTest": "HeadObject", + "inputToTest": { + "Key": "test", + "Bucket": "test" + } + }, + "client-scheduler": { + "commandToTest": "TagResource" + }, + "client-secrets-manager": { + "commandToTest": "GetSecretValue", + "inputToTest": { + "SecretId": "test" + } + }, + "client-sfn": { + "commandToTest": "StartExecution", + "inputToTest": { + "stateMachineArn": "test", + "input": "test" + } + }, + "client-sns": { + "commandToTest": "Publish", + "inputToTest": { + "TopicArn": "test", + "Message": "test" + } + }, + "client-sqs": { + "commandToTest": "SendMessage", + "inputToTest": { + "QueueUrl": "https://sqs.eu-central-1.amazonaws.com/123456789012/MyQueue", + "MessageBody": "Hello world!" + } + }, + "client-ssm": { + "commandToTest": "DescribeParameters" + }, + "client-textract": { + "commandToTest": "ListAdapters" + } +} diff --git a/scripts/codegen-client.ts b/scripts/codegen-client.ts index 580752b..6805de6 100644 --- a/scripts/codegen-client.ts +++ b/scripts/codegen-client.ts @@ -6,21 +6,23 @@ * 3. Run `Run pnpm run eslint --fix` to fix the formatting. * 4. Commit the changes and enjoy. */ +import { exec } from "node:child_process"; import { mkdir, readdir, writeFile } from "node:fs/promises"; import { + Array, Effect, + Exit, Option, - Array, + Predicate, Record, String, Struct, Tuple, - Exit, - Predicate, } from "effect"; import { constVoid, flow, pipe } from "effect/Function"; import Enquirer from "enquirer"; +import singularities from "./client-singularities.json"; type Shape = | { type: "boolean" } @@ -107,30 +109,38 @@ async function main() { Array.map(getNameFromTarget), ); - const { commandToTest } = await enquirer.prompt({ - type: "autocomplete", - name: "commandToTest", - message: `Which command do you want to test in ${packageName} ?`, - multiple: false, - choices: operationNames, - }); - - const { inputToTest } = await enquirer.prompt({ - type: "input", - name: "inputToTest", - message: `Which input do you want to test of ${commandToTest} ? (optional)`, - validate: Predicate.or(String.isEmpty)( - flow( - Effect.succeed, - Effect.tryMap({ - try: JSON.parse, - catch: constVoid, - }), - Effect.runSyncExit, - Exit.isSuccess, - ), - ), - }); + const { commandToTest } = + (singularities as any)[packageName] ?? + (await enquirer.prompt({ + type: "autocomplete", + name: "commandToTest", + message: `Which command do you want to test in ${packageName} ?`, + multiple: false, + choices: operationNames, + })); + + const { inputToTest } = (singularities as any)[packageName]?.inputToTest + ? { + inputToTest: JSON.stringify( + (singularities as any)[packageName].inputToTest, + ), + } + : await enquirer.prompt({ + type: "input", + name: "inputToTest", + message: `Which input do you want to test of ${commandToTest} ? (optional)`, + validate: Predicate.or(String.isEmpty)( + flow( + Effect.succeed, + Effect.tryMap({ + try: JSON.parse, + catch: constVoid, + }), + Effect.runSyncExit, + Exit.isSuccess, + ), + ), + }); return [packageName, commandToTest, inputToTest] as const; }), @@ -386,6 +396,8 @@ export * from "./${sdkName}Service"; */ import { ${sdkName}ServiceException, + type ${sdkName}Client, + type ${sdkName}ClientConfig, ${pipe( operationNames, Array.map( @@ -401,7 +413,11 @@ import { ${sdkName}ClientInstance, ${sdkName}ClientInstanceLayer, } from "./${sdkName}ClientInstance"; -import { Default${sdkName}ClientConfigLayer } from "./${sdkName}ClientInstanceConfig"; +import { + Default${sdkName}ClientConfigLayer, + makeDefault${sdkName}ClientInstanceConfig, + ${sdkName}ClientInstanceConfig, +} from "./${sdkName}ClientInstanceConfig"; import { AllServiceErrors, ${pipe( @@ -416,7 +432,7 @@ import { } from "./Errors"; /** - * @since 1.0.1 + * @since 1.0.0 */ export interface HttpHandlerOptions { /** @@ -463,15 +479,6 @@ ${pipe( )} } -/** - * @since 1.0.0 - * @category models - */ -export class ${sdkName}Service extends Effect.Tag("@effect-aws/client-${serviceName}/${sdkName}Service")< - ${sdkName}Service, - ${sdkName}Service$ ->() {} - /** * @since 1.0.0 * @category constructors @@ -519,9 +526,54 @@ export const make${sdkName}Service = Effect.gen(function* (_) { }, {}) as ${sdkName}Service$; }); +/** + * @since 1.0.0 + * @category models + */ +export class ${sdkName}Service extends Effect.Tag("@effect-aws/client-${serviceName}/${sdkName}Service")< + ${sdkName}Service, + ${sdkName}Service$ +>() { + static readonly defaultLayer = Layer.effect(this, make${sdkName}Service).pipe( + Layer.provide(${sdkName}ClientInstanceLayer), + Layer.provide(Default${sdkName}ClientConfigLayer), + ); + static readonly layer = (config: ${sdkName}ClientConfig) => + Layer.effect(this, make${sdkName}Service).pipe( + Layer.provide(${sdkName}ClientInstanceLayer), + Layer.provide( + Layer.effect( + ${sdkName}ClientInstanceConfig, + makeDefault${sdkName}ClientInstanceConfig.pipe( + Effect.map((defaultConfig) => ({ ...defaultConfig, ...config })), + ), + ), + ), + ); + static readonly baseLayer = ( + evaluate: (defaultConfig: ${sdkName}ClientConfig) => ${sdkName}Client, + ) => + Layer.effect(this, make${sdkName}Service).pipe( + Layer.provide( + Layer.effect( + ${sdkName}ClientInstance, + Effect.map(makeDefault${sdkName}ClientInstanceConfig, evaluate), + ), + ), + ); +} + +/** + * @since 1.0.0 + * @category models + * @alias ${sdkName}Service + */ +export const ${sdkName} = ${sdkName}Service; + /** * @since 1.0.0 * @category layers + * @deprecated use ${sdkName}.baseLayer instead */ export const Base${sdkName}ServiceLayer = Layer.effect( ${sdkName}Service, @@ -531,6 +583,7 @@ export const Base${sdkName}ServiceLayer = Layer.effect( /** * @since 1.0.0 * @category layers + * @deprecated use ${sdkName}.layer instead */ export const ${sdkName}ServiceLayer = Base${sdkName}ServiceLayer.pipe( Layer.provide(${sdkName}ClientInstanceLayer), @@ -539,10 +592,9 @@ export const ${sdkName}ServiceLayer = Base${sdkName}ServiceLayer.pipe( /** * @since 1.0.0 * @category layers + * @deprecated use ${sdkName}.defaultLayer instead */ -export const Default${sdkName}ServiceLayer = ${sdkName}ServiceLayer.pipe( - Layer.provide(Default${sdkName}ClientConfigLayer), -); +export const Default${sdkName}ServiceLayer = ${sdkName}Service.defaultLayer; `, ); @@ -555,25 +607,23 @@ export const Default${sdkName}ServiceLayer = ${sdkName}ServiceLayer.pipe( ${sdkName}Client, ${sdkName}ServiceException, } from "@aws-sdk/client-${originalServiceName}"; +// @ts-ignore +import * as runtimeConfig from "@aws-sdk/client-${originalServiceName}/dist-cjs/runtimeConfig"; import { mockClient } from "aws-sdk-client-mock"; import * as Effect from "effect/Effect"; import * as Exit from "effect/Exit"; import { pipe } from "effect/Function"; -import * as Layer from "effect/Layer"; -import { - Base${sdkName}ServiceLayer, - Default${sdkName}ClientConfigLayer, - Default${sdkName}ServiceLayer, - ${sdkName}ClientInstance, - ${sdkName}ClientInstanceConfig, - ${sdkName}Service, - ${sdkName}ServiceLayer, - SdkError, -} from "../src"; +import { afterEach, describe, expect, it, vi } from "vitest"; +import { ${sdkName}, SdkError } from "../src"; +const getRuntimeConfig = vi.spyOn(runtimeConfig, "getRuntimeConfig"); const clientMock = mockClient(${sdkName}Client); describe("${sdkName}ClientImpl", () => { + afterEach(() => { + getRuntimeConfig.mockClear(); + }); + it("default", async () => { clientMock.reset().on(${commandToTest}Command).resolves({}); @@ -583,15 +633,19 @@ describe("${sdkName}ClientImpl", () => { : `const args = {} as unknown as ${commandToTest}CommandInput` } - const program = ${sdkName}Service.${pipe(commandToTest, lowerFirst)}(args); + const program = ${sdkName}.${pipe(commandToTest, lowerFirst)}(args); const result = await pipe( program, - Effect.provide(Default${sdkName}ServiceLayer), + Effect.provide(${sdkName}.defaultLayer), Effect.runPromiseExit, ); expect(result).toEqual(Exit.succeed({})); + expect(getRuntimeConfig).toHaveBeenCalledTimes(1); + expect(getRuntimeConfig).toHaveBeenCalledWith({ + logger: expect.any(Object), + }); expect(clientMock).toHaveReceivedCommandTimes(${commandToTest}Command, 1); expect(clientMock).toHaveReceivedCommandWith(${commandToTest}Command, args); }); @@ -605,22 +659,20 @@ describe("${sdkName}ClientImpl", () => { : `const args = {} as unknown as ${commandToTest}CommandInput` } - const program = ${sdkName}Service.${pipe(commandToTest, lowerFirst)}(args); - - const ${sdkName}ClientConfigLayer = Layer.succeed(${sdkName}ClientInstanceConfig, { - region: "eu-central-1", - }); - const Custom${sdkName}ServiceLayer = ${sdkName}ServiceLayer.pipe( - Layer.provide(${sdkName}ClientConfigLayer), - ); + const program = ${sdkName}.${pipe(commandToTest, lowerFirst)}(args); const result = await pipe( program, - Effect.provide(Custom${sdkName}ServiceLayer), + Effect.provide(${sdkName}.layer({ region: "eu-central-1" })), Effect.runPromiseExit, ); expect(result).toEqual(Exit.succeed({})); + expect(getRuntimeConfig).toHaveBeenCalledTimes(1); + expect(getRuntimeConfig).toHaveBeenCalledWith({ + region: "eu-central-1", + logger: expect.any(Object), + }); expect(clientMock).toHaveReceivedCommandTimes(${commandToTest}Command, 1); expect(clientMock).toHaveReceivedCommandWith(${commandToTest}Command, args); }); @@ -634,23 +686,21 @@ describe("${sdkName}ClientImpl", () => { : `const args = {} as unknown as ${commandToTest}CommandInput` } - const program = ${sdkName}Service.${pipe(commandToTest, lowerFirst)}(args); - - const ${sdkName}ClientInstanceLayer = Layer.succeed( - ${sdkName}ClientInstance, - new ${sdkName}Client({ region: "eu-central-1" }), - ); - const Custom${sdkName}ServiceLayer = Base${sdkName}ServiceLayer.pipe( - Layer.provide(${sdkName}ClientInstanceLayer), - ); + const program = ${sdkName}.${pipe(commandToTest, lowerFirst)}(args); const result = await pipe( program, - Effect.provide(Custom${sdkName}ServiceLayer), + Effect.provide( + ${sdkName}.baseLayer(() => new ${sdkName}Client({ region: "eu-central-1" })), + ), Effect.runPromiseExit, ); expect(result).toEqual(Exit.succeed({})); + expect(getRuntimeConfig).toHaveBeenCalledTimes(1); + expect(getRuntimeConfig).toHaveBeenCalledWith({ + region: "eu-central-1", + }); expect(clientMock).toHaveReceivedCommandTimes(${commandToTest}Command, 1); expect(clientMock).toHaveReceivedCommandWith(${commandToTest}Command, args); }); @@ -664,27 +714,24 @@ describe("${sdkName}ClientImpl", () => { : `const args = {} as unknown as ${commandToTest}CommandInput` } - const program = ${sdkName}Service.${pipe(commandToTest, lowerFirst)}(args); - - const ${sdkName}ClientInstanceLayer = Layer.effect( - ${sdkName}ClientInstance, - Effect.map( - ${sdkName}ClientInstanceConfig, - (config) => new ${sdkName}Client({ ...config, region: "eu-central-1" }), - ), - ); - const Custom${sdkName}ServiceLayer = Base${sdkName}ServiceLayer.pipe( - Layer.provide(${sdkName}ClientInstanceLayer), - Layer.provide(Default${sdkName}ClientConfigLayer), - ); + const program = ${sdkName}.${pipe(commandToTest, lowerFirst)}(args); const result = await pipe( program, - Effect.provide(Custom${sdkName}ServiceLayer), + Effect.provide( + ${sdkName}.baseLayer( + (config) => new ${sdkName}Client({ ...config, region: "eu-central-1" }), + ), + ), Effect.runPromiseExit, ); expect(result).toEqual(Exit.succeed({})); + expect(getRuntimeConfig).toHaveBeenCalledTimes(1); + expect(getRuntimeConfig).toHaveBeenCalledWith({ + region: "eu-central-1", + logger: expect.any(Object), + }); expect(clientMock).toHaveReceivedCommandTimes(${commandToTest}Command, 1); expect(clientMock).toHaveReceivedCommandWith(${commandToTest}Command, args); }); @@ -698,11 +745,11 @@ describe("${sdkName}ClientImpl", () => { : `const args = {} as unknown as ${commandToTest}CommandInput` } - const program = ${sdkName}Service.${pipe(commandToTest, lowerFirst)}(args); + const program = ${sdkName}.${pipe(commandToTest, lowerFirst)}(args); const result = await pipe( program, - Effect.provide(Default${sdkName}ServiceLayer), + Effect.provide(${sdkName}.defaultLayer), Effect.runPromiseExit, ); @@ -737,13 +784,13 @@ describe("${sdkName}ClientImpl", () => { : `const args = {} as unknown as ${commandToTest}CommandInput` } - const program = ${sdkName}Service.${pipe(commandToTest, lowerFirst)}(args).pipe( + const program = ${sdkName}.${pipe(commandToTest, lowerFirst)}(args).pipe( Effect.catchTag("NotHandledException" as any, () => Effect.succeed(null)), ); const result = await pipe( program, - Effect.provide(Default${sdkName}ServiceLayer), + Effect.provide(${sdkName}.defaultLayer), Effect.runPromiseExit, ); @@ -782,13 +829,13 @@ npm install --save @effect-aws/client-${serviceName} With default ${sdkName}Client instance: \`\`\`typescript -import { ${sdkName}Service, Default${sdkName}ServiceLayer } from "@effect-aws/client-${serviceName}"; +import { ${sdkName} } from "@effect-aws/client-${serviceName}"; -const program = ${sdkName}Service.${pipe(commandToTest, lowerFirst)}(args); +const program = ${sdkName}.${pipe(commandToTest, lowerFirst)}(args); const result = pipe( program, - Effect.provide(Default${sdkName}ServiceLayer), + Effect.provide(${sdkName}.defaultLayer), Effect.runPromise, ); \`\`\` @@ -796,23 +843,15 @@ const result = pipe( With custom ${sdkName}Client instance: \`\`\`typescript -import { - ${sdkName}Service, - Base${sdkName}ServiceLayer, - ${sdkName}ClientInstance, -} from "@effect-aws/client-${serviceName}"; - -const program = ${sdkName}Service.${pipe(commandToTest, lowerFirst)}(args); +import { ${sdkName} } from "@effect-aws/client-${serviceName}"; -const ${sdkName}ClientInstanceLayer = Layer.succeed( - ${sdkName}ClientInstance, - new ${sdkName}Client({ region: "eu-central-1" }), -); +const program = ${sdkName}.${pipe(commandToTest, lowerFirst)}(args); const result = await pipe( program, - Effect.provide(Base${sdkName}ServiceLayer), - Effect.provide(${sdkName}ClientInstanceLayer), + Effect.provide( + ${sdkName}.baseLayer(() => new ${sdkName}Client({ region: "eu-central-1" })), + ), Effect.runPromise, ); \`\`\` @@ -820,37 +859,20 @@ const result = await pipe( With custom ${sdkName}Client configuration: \`\`\`typescript -import { - ${sdkName}Service, - Base${sdkName}ServiceLayer, - Default${sdkName}ClientConfigLayer, - ${sdkName}ClientInstance, - ${sdkName}ClientInstanceConfig, -} from "@effect-aws/client-${serviceName}"; - -const program = ${sdkName}Service.${pipe(commandToTest, lowerFirst)}(args); +import { ${sdkName} } from "@effect-aws/client-${serviceName}"; -const ${sdkName}ClientInstanceLayer = Layer.provide( - Layer.effect( - ${sdkName}ClientInstance, - ${sdkName}ClientInstanceConfig.pipe( - Effect.map( - (config) => new ${sdkName}Client({ ...config, region: "eu-central-1" }), - ), - ), - ), - Default${sdkName}ClientConfigLayer, -); +const program = ${sdkName}.${pipe(commandToTest, lowerFirst)}(args); const result = await pipe( program, - Effect.provide(Base${sdkName}ServiceLayer), - Effect.provide(${sdkName}ClientInstanceLayer), + Effect.provide(${sdkName}.layer({ region: "eu-central-1" })), Effect.runPromiseExit, ); \`\`\` -or map over \`Default${sdkName}ClientConfigLayer\` layer context and update the configuration... +or use \`${sdkName}.baseLayer((default) => new ${sdkName}Client({ ...default, region: "eu-central-1" }))\` `, ); + + exec(`pnpm exec nx run @effect-aws/client-${serviceName}:eslint --fix`); }