Skip to content

Commit 3e8caf6

Browse files
committed
remove interface
1 parent 0675afe commit 3e8caf6

File tree

2 files changed

+4
-23
lines changed

2 files changed

+4
-23
lines changed

packages/core/src/shared/awsClientBuilderV3.ts

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import {
1515
HandlerExecutionContext,
1616
HttpHandlerOptions,
1717
MetadataBearer,
18-
//MiddlewareStack,
1918
Provider,
2019
RetryStrategy,
2120
UserAgent,
@@ -32,11 +31,10 @@ import { Client, SmithyResolvedConfiguration } from '@aws-sdk/smithy-client'
3231
export type AwsClient = Client<HttpHandlerOptions, any, MetadataBearer, SmithyResolvedConfiguration<HttpHandlerOptions>>
3332
export type AwsClientConstructor<C> = new (o: AwsClientOptions) => C
3433

35-
interface AwsClient2<Input extends object, Output extends MetadataBearer> {
36-
middlewareStack: AwsMiddlewareStack<Input, Output>
34+
interface AwsClient2 {
35+
middlewareStack: any // Ideally this would extends MiddlewareStack<Input, Output>, but this causes issues on client construction.
3736
}
3837

39-
type AwsMiddlewareStack<Input extends object, Output extends object> = any
4038
interface AwsConfigOptions {
4139
credentials: AwsCredentialIdentityProvider
4240
region: string | Provider<string>
@@ -48,16 +46,6 @@ interface AwsConfigOptions {
4846
}
4947
export type AwsClientOptions = AwsConfigOptions
5048

51-
// export interface AWSClientBuilderV3 {
52-
// createAwsService<Input extends object, Output extends MetadataBearer, C extends AwsClient2<Input, Output>>(
53-
// type: AwsClientConstructor<C>,
54-
// options?: Partial<AwsClientOptions>,
55-
// region?: string,
56-
// userAgent?: boolean,
57-
// settings?: DevSettings
58-
// ): Promise<C>
59-
// }
60-
6149
export class DefaultAWSClientBuilderV3 {
6250
public constructor(private readonly context: AwsContext) {}
6351

@@ -69,11 +57,7 @@ export class DefaultAWSClientBuilderV3 {
6957
return shim
7058
}
7159

72-
public async createAwsService<
73-
Input extends object,
74-
Output extends MetadataBearer,
75-
C extends AwsClient2<Input, Output>,
76-
>(
60+
public async createAwsService<C extends AwsClient2>(
7761
type: AwsClientConstructor<C>,
7862
options?: Partial<AwsClientOptions>,
7963
region?: string,
@@ -106,7 +90,7 @@ export class DefaultAWSClientBuilderV3 {
10690

10791
const service = new type(opt)
10892
// TODO: add middleware for logging, telemetry, endpoints.
109-
service.middlewareStack.add!(telemetryMiddleware, { step: 'deserialize' } as DeserializeHandlerOptions)
93+
service.middlewareStack.add(telemetryMiddleware, { step: 'deserialize' } as DeserializeHandlerOptions)
11094
return service
11195
}
11296
}

packages/core/src/test/shared/defaultAwsClientBuilderV3.test.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,12 @@ import { Client } from '@aws-sdk/smithy-client'
1414
import { extensionVersion } from '../../shared'
1515
import { assertTelemetry } from '../testUtil'
1616
import { telemetry } from '../../shared/telemetry'
17-
//import { ActivateOrganizationsAccessCommand, CloudFormationClient } from '@aws-sdk/client-cloudformation'
1817

1918
describe('DefaultAwsClientBuilderV3', function () {
2019
let builder: DefaultAWSClientBuilderV3
2120

2221
beforeEach(async function () {
2322
builder = new DefaultAWSClientBuilderV3(new FakeAwsContext())
24-
//const c = await builder.createAwsService(CloudFormationClient, undefined, 'us-east-1')
25-
//await c.send(new ActivateOrganizationsAccessCommand({ dryRun: true }))
2623
})
2724

2825
describe('createAndConfigureSdkClient', function () {

0 commit comments

Comments
 (0)