Skip to content

Commit

Permalink
chore: remove uses of aws-sdk outside cli (#31275)
Browse files Browse the repository at this point in the history
Every use of sdkv2, besides what is used inside the cli has been removed as of this change.

### Checklist
- [ ] My code adheres to the [CONTRIBUTING GUIDE](https:/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https:/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md)

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
  • Loading branch information
TheRealAmazonKendra authored Sep 4, 2024
1 parent 47605c2 commit 52c1117
Show file tree
Hide file tree
Showing 8 changed files with 8 additions and 89 deletions.
1 change: 0 additions & 1 deletion packages/@aws-cdk-testing/framework-integ/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
"@aws-cdk/lambda-layer-kubectl-v29": "^2.1.0",
"@aws-cdk/lambda-layer-kubectl-v30": "^2.0.0",
"aws-cdk-lib": "0.0.0",
"aws-sdk": "^2.1653.0",
"aws-sdk-mock": "5.6.0",
"cdk8s": "2.68.85",
"cdk8s-plus-27": "2.9.5",
Expand Down
1 change: 0 additions & 1 deletion packages/@aws-cdk/custom-resource-handlers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@
"@types/jest": "^29.5.12",
"aws-sdk-client-mock": "^3.1.0",
"aws-sdk-client-mock-jest": "^3.1.0",
"aws-sdk-mock": "5.8.0",
"@cdklabs/typewriter": "^0.0.3",
"jest": "^29.7.0",
"sinon": "^9.2.4",
Expand Down
7 changes: 4 additions & 3 deletions packages/aws-cdk-lib/aws-events-targets/lib/aws-api.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
import { metadata } from './sdk-api-metadata.generated';
import { addLambdaPermission } from './util';
import * as events from '../../aws-events';
import * as iam from '../../aws-iam';
import * as lambda from '../../aws-lambda';
import { Annotations, Duration } from '../../core';
import { AwsApiSingletonFunction } from '../../custom-resource-handlers/dist/aws-events-targets/aws-api-provider.generated';
import * as metadata from '../../custom-resources/lib/helpers-internal/sdk-v3-metadata.json';

type AwsSdkMetadataItem = { iamPrefix: string };
/**
* AWS SDK service metadata.
*/
export type AwsSdkMetadata = {[key: string]: any};
export type AwsSdkMetadata = {[key: string]: AwsSdkMetadataItem | {}};

const awsSdkMetadata: AwsSdkMetadata = metadata;

Expand Down Expand Up @@ -135,7 +136,7 @@ services and actions from https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/in
*/
function awsSdkToIamAction(service: string, action: string): string {
const srv = service.toLowerCase();
const iamService = awsSdkMetadata[srv].prefix || srv;
const iamService = (awsSdkMetadata[srv] as AwsSdkMetadataItem).iamPrefix || srv;
const iamAction = action.charAt(0).toUpperCase() + action.slice(1);
return `${iamService}:${iamAction}`;
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ test('use AwsApi as an event rule target', () => {
parameters: {
service: 'cool-service',
forceNewDeployment: true,
} as AWS.ECS.UpdateServiceRequest,
},
catchErrorPattern: 'error',
apiVersion: '2019-01-01',
}));
Expand All @@ -28,7 +28,7 @@ test('use AwsApi as an event rule target', () => {
action: 'createDBSnapshot',
parameters: {
DBInstanceIdentifier: 'cool-instance',
} as AWS.RDS.CreateDBSnapshotMessage,
},
}));

// THEN
Expand Down
2 changes: 0 additions & 2 deletions packages/aws-cdk-lib/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -167,10 +167,8 @@
"@types/punycode": "^2.1.4",
"@types/mime-types": "^2.1.4",
"@aws-cdk/lazify": "0.0.0",
"aws-sdk": "^2.1653.0",
"aws-sdk-client-mock": "^3.1.0",
"aws-sdk-client-mock-jest": "^3.1.0",
"aws-sdk-mock": "5.8.0",
"cdk8s": "2.68.85",
"constructs": "^10.0.0",
"delay": "5.0.0",
Expand Down
39 changes: 0 additions & 39 deletions packages/aws-cdk-lib/scripts/submodules/aws-events-targets.ts

This file was deleted.

2 changes: 0 additions & 2 deletions packages/aws-cdk-lib/scripts/submodules/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import * as path from 'node:path';
import { createLibraryReadme } from '@aws-cdk/pkglint';
import * as fs from 'fs-extra';
import awsEventsTargets from './aws-events-targets';
import cloudformationInclude from './cloudformation-include';
import { ModuleMap, ModuleMapEntry } from '../codegen';

Expand All @@ -16,7 +15,6 @@ export default async function submodulesGen(modules: ModuleMap, outPath: string)
}

// Do specific code gen for certain submodules
await awsEventsTargets(modules, outPath);
await cloudformationInclude(modules, outPath);
}

Expand Down
41 changes: 2 additions & 39 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6205,13 +6205,6 @@
dependencies:
"@sinonjs/commons" "^1.7.0"

"@sinonjs/fake-timers@^9.1.2":
version "9.1.2"
resolved "https://registry.npmjs.org/@sinonjs/fake-timers/-/fake-timers-9.1.2.tgz#4eaab737fab77332ab132d396a3c0d364bd0ea8c"
integrity sha512-BPS4ynJW/o92PUR4wgriz2Ud5gpST5vz6GQfMixEDK0Z8ZCUv2M7SkBLykH56T++Xs+8ln9zTGbOvNGIe02/jw==
dependencies:
"@sinonjs/commons" "^1.7.0"

"@sinonjs/samsam@^5.3.1":
version "5.3.1"
resolved "https://registry.npmjs.org/@sinonjs/samsam/-/samsam-5.3.1.tgz#375a45fe6ed4e92fca2fb920e007c48232a6507f"
Expand All @@ -6230,15 +6223,6 @@
lodash.get "^4.4.2"
type-detect "^4.0.8"

"@sinonjs/samsam@^7.0.1":
version "7.0.1"
resolved "https://registry.npmjs.org/@sinonjs/samsam/-/samsam-7.0.1.tgz#5b5fa31c554636f78308439d220986b9523fc51f"
integrity sha512-zsAk2Jkiq89mhZovB2LLOdTCxJF4hqqTToGP0ASWlhp4I1hqOjcfmZGafXntCN7MDC6yySH0mFHrYtHceOeLmw==
dependencies:
"@sinonjs/commons" "^2.0.0"
lodash.get "^4.4.2"
type-detect "^4.0.8"

"@sinonjs/samsam@^8.0.0":
version "8.0.0"
resolved "https://registry.npmjs.org/@sinonjs/samsam/-/samsam-8.0.0.tgz#0d488c91efb3fa1442e26abea81759dfc8b5ac60"
Expand Down Expand Up @@ -8474,16 +8458,7 @@ [email protected]:
sinon "^11.1.1"
traverse "^0.6.6"

[email protected]:
version "5.8.0"
resolved "https://registry.npmjs.org/aws-sdk-mock/-/aws-sdk-mock-5.8.0.tgz#2556a79010a883f4bd5a566ce63bc244cee67579"
integrity sha512-s0Vy4DObFmVJ6h1uTw1LGInOop77oF0JXH2N39Lv+1Wss274EowVk9odhM4Sji4mynXcM5oSu68uYqkJRviDRA==
dependencies:
aws-sdk "^2.1231.0"
sinon "^14.0.1"
traverse "^0.6.6"

aws-sdk@^2.1231.0, aws-sdk@^2.1653.0, aws-sdk@^2.928.0:
aws-sdk@^2.1653.0, aws-sdk@^2.928.0:
version "2.1653.0"
resolved "https://registry.npmjs.org/aws-sdk/-/aws-sdk-2.1653.0.tgz#2cd9b2ea77b0fc6d59a03f0d26801300dec6adf0"
integrity sha512-9f42kuLpMcL1EPZOsLM8u6wlnOMtFwED1b24SN0fBbi/N7N1xTLZ7vbEMt/haz06Lc3Vr3VMDyv0atfMmkboBw==
Expand Down Expand Up @@ -14242,7 +14217,7 @@ nise@^4.0.4:
just-extend "^4.0.2"
path-to-regexp "^1.7.0"

nise@^5.1.0, nise@^5.1.2, nise@^5.1.4:
nise@^5.1.0, nise@^5.1.4:
version "5.1.9"
resolved "https://registry.npmjs.org/nise/-/nise-5.1.9.tgz#0cb73b5e4499d738231a473cd89bd8afbb618139"
integrity sha512-qOnoujW4SV6e40dYxJOb3uvuoPHtmLzIk4TFo+j0jPJoC+5Z9xja5qH5JZobEPsa8+YYphMrOSwnrshEhG2qww==
Expand Down Expand Up @@ -16451,18 +16426,6 @@ sinon@^11.1.1:
nise "^5.1.0"
supports-color "^7.2.0"

sinon@^14.0.1:
version "14.0.2"
resolved "https://registry.npmjs.org/sinon/-/sinon-14.0.2.tgz#585a81a3c7b22cf950762ac4e7c28eb8b151c46f"
integrity sha512-PDpV0ZI3ZCS3pEqx0vpNp6kzPhHrLx72wA0G+ZLaaJjLIYeE0n8INlgaohKuGy7hP0as5tbUd23QWu5U233t+w==
dependencies:
"@sinonjs/commons" "^2.0.0"
"@sinonjs/fake-timers" "^9.1.2"
"@sinonjs/samsam" "^7.0.1"
diff "^5.0.0"
nise "^5.1.2"
supports-color "^7.2.0"

sinon@^16.1.3:
version "16.1.3"
resolved "https://registry.npmjs.org/sinon/-/sinon-16.1.3.tgz#b760ddafe785356e2847502657b4a0da5501fba8"
Expand Down

0 comments on commit 52c1117

Please sign in to comment.