Skip to content

Commit 4d1903c

Browse files
committed
feat(toolkit-lib)!: allow custom https.Agent for SDK requests
1 parent 11b393a commit 4d1903c

File tree

9 files changed

+8
-82
lines changed

9 files changed

+8
-82
lines changed

.projenrc.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -751,7 +751,6 @@ const toolkitLib = configureProject(
751751
'glob',
752752
'minimatch',
753753
'p-limit@^3',
754-
'proxy-agent',
755754
'semver',
756755
'split2',
757756
'uuid',

packages/@aws-cdk/toolkit-lib/.projen/deps.json

Lines changed: 0 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk/toolkit-lib/.projen/tasks.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk/toolkit-lib/lib/api/aws-auth/awscli-compatible.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@ import { MetadataService } from '@aws-sdk/ec2-metadata-service';
66
import type { NodeHttpHandlerOptions } from '@smithy/node-http-handler';
77
import { loadSharedConfigFiles } from '@smithy/shared-ini-file-loader';
88
import { makeCachingProvider } from './provider-caching';
9-
import { ProxyAgentProvider } from './proxy-agent';
109
import type { ISdkLogger } from './sdk-logger';
11-
import type { SdkHttpOptions } from './types';
1210
import { AuthenticationError } from '../../toolkit/toolkit-error';
1311
import { IO, type IoHelper } from '../io/private';
1412

@@ -279,8 +277,3 @@ export function sdkRequestHandler(agent?: Agent): NodeHttpHandlerOptions {
279277
httpAgent: agent,
280278
};
281279
}
282-
283-
export async function makeRequestHandler(ioHelper: IoHelper, options: SdkHttpOptions = {}): Promise<NodeHttpHandlerOptions> {
284-
const agent = await new ProxyAgentProvider(ioHelper).create(options);
285-
return sdkRequestHandler(agent);
286-
}

packages/@aws-cdk/toolkit-lib/lib/api/aws-auth/private/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
export * from '../proxy-agent';
21
export * from '../sdk';
32
export * from '../sdk-provider';
43
export * from '../sdk-logger';

packages/@aws-cdk/toolkit-lib/lib/api/aws-auth/proxy-agent.ts

Lines changed: 0 additions & 56 deletions
This file was deleted.

packages/@aws-cdk/toolkit-lib/lib/api/aws-auth/types.ts

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import type { Agent } from 'node:https';
12
import type { SDKv3CompatibleCredentialProvider } from '@aws-cdk/cli-plugin-contract';
23
import { AwsCliCompatible } from './awscli-compatible';
34
import type { SdkProviderServices } from './sdk-provider';
@@ -32,18 +33,13 @@ export interface SdkConfig {
3233
*/
3334
export interface SdkHttpOptions {
3435
/**
35-
* Proxy address to use
36+
* The agent responsible for making the network requests.
3637
*
37-
* @default No proxy
38-
*/
39-
readonly proxyAddress?: string;
40-
41-
/**
42-
* A path to a certificate bundle that contains a cert to be trusted.
38+
* Use this so set up a proxy connection.
4339
*
44-
* @default No certificate bundle
40+
* @default - uses the shared global node agent
4541
*/
46-
readonly caBundlePath?: string;
42+
readonly agent?: Agent;
4743
}
4844

4945
export abstract class BaseCredentials {

packages/@aws-cdk/toolkit-lib/lib/toolkit/toolkit.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ import { type SynthOptions } from '../actions/synth';
3333
import type { WatchOptions } from '../actions/watch';
3434
import { patternsArrayForWatch } from '../actions/watch/private';
3535
import { BaseCredentials, type SdkConfig } from '../api/aws-auth';
36-
import { makeRequestHandler } from '../api/aws-auth/awscli-compatible';
36+
import { sdkRequestHandler } from '../api/aws-auth/awscli-compatible';
3737
import type { SdkProviderServices } from '../api/aws-auth/private';
3838
import { SdkProvider, IoHostSdkLogger } from '../api/aws-auth/private';
3939
import { Bootstrapper } from '../api/bootstrap';
@@ -184,7 +184,7 @@ export class Toolkit extends CloudAssemblySourceBuilder {
184184
const ioHelper = asIoHelper(this.ioHost, action);
185185
const services: SdkProviderServices = {
186186
ioHelper,
187-
requestHandler: await makeRequestHandler(ioHelper, this.props.sdkConfig?.httpOptions),
187+
requestHandler: sdkRequestHandler(this.props.sdkConfig?.httpOptions?.agent),
188188
logger: new IoHostSdkLogger(ioHelper),
189189
pluginHost: this.pluginHost,
190190
};

packages/@aws-cdk/toolkit-lib/package.json

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)