Skip to content

Commit e3f8e88

Browse files
authored
Remove JS SDK v2 examples (#222)
1 parent 9976dea commit e3f8e88

File tree

13 files changed

+48
-451
lines changed

13 files changed

+48
-451
lines changed
Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,37 @@
11
---
22
name: Bug report
33
about: Create a report to help us improve
4-
title: ''
5-
labels: ''
6-
assignees: ''
7-
4+
title: ""
5+
labels: ""
6+
assignees: ""
87
---
98

109
<!--
1110
This template is for cutting bugs with aws-sdk-js-tests package.
12-
Use the following links for creating bugs with AWS JS SDK v2/v3:
13-
* v2 https://github.com/aws/aws-sdk-js/issues/new/choose
14-
* v3 https://github.com/aws/aws-sdk-js-v3/issues/new/choose
11+
Use the following link for creating bugs with AWS SDK for JavaScript:
12+
* https://github.com/aws/aws-sdk-js-v3/issues/new/choose
1513
-->
1614

1715
## Describe the bug
16+
1817
A clear and concise description of what the bug is.
1918

2019
## Steps to reproduce
20+
2121
Steps to reproduce the behavior.
2222

2323
#### Observed behavior
24+
2425
A clear and concise description of what happens.
2526

2627
#### Expected behavior
28+
2729
A clear and concise description of what you were expecting to happen.
2830

2931
#### Screenshots
32+
3033
If applicable, add screenshots to help explain your problem.
3134

3235
## Additional context
36+
3337
Add any other context about the problem here.
Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,29 @@
11
---
22
name: Feature request
33
about: Suggest an idea for this project
4-
title: ''
5-
labels: ''
6-
assignees: ''
7-
4+
title: ""
5+
labels: ""
6+
assignees: ""
87
---
98

109
<!--
1110
This template is for creating feature requests with aws-sdk-js-tests package.
12-
Use the following links for creating feature requests with AWS JS SDK v2/v3:
13-
* v2 https://github.com/aws/aws-sdk-js/issues/new/choose
14-
* v3 https://github.com/aws/aws-sdk-js-v3/issues/new/choose
11+
Use the following link for creating feature request with AWS SDK for JavaScript:
12+
* https://github.com/aws/aws-sdk-js-v3/issues/new/choose
1513
-->
1614

1715
### Is your feature request related to a problem? Please describe.
16+
1817
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
1918

2019
### Describe the solution you'd like
20+
2121
A clear and concise description of what you want to happen.
2222

2323
### Describe alternatives you've considered
24+
2425
A clear and concise description of any alternative solutions or features you've considered.
2526

2627
### Additional context
28+
2729
Add any other context or screenshots about the feature request here.

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ Code Samples for testing AWS SDK for JavaScript.
1515
- Run `corepack enable` to let corepack manage version of yarn.
1616
- Update REGION in [`packages/utils/src/config.js`](./packages/utils/src/config.js).
1717
- For browser and react-native, IDENTITY_POOL_ID also needs to be updated.
18-
- [Create a Amazon Cognito Identity pool for testing](https://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/getting-started-browser.html#getting-started-browser-create-identity-pool)
18+
- [Create a Amazon Cognito Identity pool for testing](https://docs.aws.amazon.com/sdk-for-javascript/v3/developer-guide/getting-started-browser.html#getting-started-browser-create-identity-pool)
1919
- Note down IDENTITY_POOL_ID
20-
- [Add a Policy to the test Unauthenticated IAM Role](https://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/getting-started-browser.html#getting-started-browser-iam-role)
20+
- [Add a Policy to the test Unauthenticated IAM Role](https://docs.aws.amazon.com/sdk-for-javascript/v3/developer-guide/getting-started-browser.html#getting-started-browser-iam-role)
2121
- The policy should be specific to the operations you want to test
2222
- Update the IDENTITY_POOL_ID in [`packages/utils/src/config.js`](./packages/utils/src/config.js).
2323

@@ -28,7 +28,7 @@ Code Samples for testing AWS SDK for JavaScript.
2828

2929
### Node.js:
3030

31-
- Run `yarn start:node` to run both v2 and v3 clients in Node.js
31+
- Run `yarn start:node` to run SDK clients in Node.js
3232
- The responses returned by clients will be printed in console, and will re-run when code is updated.
3333
- The file being run is at [`packages/node/src/index.js`](./packages/node/src/index.js).
3434

img/screenshot-android.png

92.2 KB
Loading

img/screenshot-ios.png

-24.2 KB
Loading

img/screenshot-node.png

429 KB
Loading

img/screenshot-web.png

203 KB
Loading

packages/node/src/index.js

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
1-
import { REGION, getV2Response, getV3Response } from "@aws-sdk/test-utils";
1+
import { REGION, getResponse } from "@aws-sdk/test-utils";
22

33
(async () => {
44
let response;
55

6-
response = await getV2Response({ region: REGION });
7-
console.log("Data returned by v2:");
8-
console.log(JSON.stringify(response, null, 2));
9-
10-
response = await getV3Response({ region: REGION });
11-
console.log("\nData returned by v3:");
6+
response = await getResponse({ region: REGION });
7+
console.log("\nData returned:");
128
console.log(JSON.stringify(response, null, 2));
139
})();

packages/react-native/App.js

Lines changed: 10 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -17,52 +17,31 @@ import 'react-native-get-random-values';
1717
import 'react-native-url-polyfill/auto';
1818
import 'web-streams-polyfill/dist/polyfill';
1919

20-
import {getV2BrowserResponse, getV3BrowserResponse} from '@aws-sdk/test-utils';
20+
import {getBrowserResponse} from '@aws-sdk/test-utils';
2121

2222
const App: () => Node = () => {
23-
const [v2Response, setV2Response] = useState('');
24-
const [v3Response, setV3Response] = useState('');
23+
const [response, setResponse] = useState('');
2524

26-
const fetchV2Response = async () => {
25+
const fetchResponse = async () => {
2726
try {
28-
const v2Response = await getV2BrowserResponse();
29-
setV2Response(JSON.stringify(v2Response, null, 2));
27+
const response = await getBrowserResponse();
28+
setResponse(JSON.stringify(response, null, 2));
3029
} catch (err) {
3130
console.error(serializeError(err));
32-
setV2Response(`Error: ${err}. Check console for more details.`);
33-
}
34-
};
35-
36-
const fetchV3Response = async () => {
37-
try {
38-
const v3Response = await getV3BrowserResponse();
39-
setV3Response(JSON.stringify(v3Response, null, 2));
40-
} catch (err) {
41-
console.error(serializeError(err));
42-
setV3Response(`Error: ${err}. Check console for more details.`);
31+
setResponse(`Error: ${err}. Check console for more details.`);
4332
}
4433
};
4534

4635
return (
4736
<View style={styles.container}>
4837
<View style={styles.sectionContainer}>
49-
<Text style={styles.sectionTitle}>AWS SDK for JavaScript (v2):</Text>
50-
<Button title="Call with v2" onPress={fetchV2Response} />
51-
<TextInput
52-
style={styles.sectionDescription}
53-
multiline={true}
54-
placeholder="v2 response will be populated here"
55-
value={v2Response}
56-
/>
57-
</View>
58-
<View style={styles.sectionContainer}>
59-
<Text style={styles.sectionTitle}>AWS SDK for JavaScript (v3):</Text>
60-
<Button title="Call with v3" onPress={fetchV3Response} />
38+
<Text style={styles.sectionTitle}>AWS SDK for JavaScript:</Text>
39+
<Button title="Click to make a call" onPress={fetchResponse} />
6140
<TextInput
6241
style={styles.sectionDescription}
6342
multiline={true}
64-
placeholder="v3 response will be populated here"
65-
value={v3Response}
43+
placeholder="Response will be populated here"
44+
value={response}
6645
/>
6746
</View>
6847
</View>

packages/utils/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@
77
"dependencies": {
88
"@aws-sdk/client-cognito-identity": "^3.540.0",
99
"@aws-sdk/client-dynamodb": "^3.540.0",
10-
"@aws-sdk/credential-provider-cognito-identity": "^3.540.0",
11-
"aws-sdk": "^2.1588.0"
10+
"@aws-sdk/credential-provider-cognito-identity": "^3.540.0"
1211
},
1312
"author": {
1413
"name": "AWS SDK for JavaScript Team",

0 commit comments

Comments
 (0)