Skip to content

Commit

Permalink
Updated to use the latest auth helper (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
cgalvan authored Oct 29, 2024
1 parent 91e98ac commit 452a303
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 44 deletions.
50 changes: 16 additions & 34 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,10 @@ This example uses the Amazon Location Client to make a request that authenticate
```

```javascript
// Create an authentication helper instance using an API key
const authHelper = await amazonLocationClient.withAPIKey("<API Key>");
// Create an authentication helper instance using an API key and region
const authHelper = await amazonLocationClient.withAPIKey("<API Key>", "<Region>");

const client = new amazonLocationClient.GeoRoutesClient({
region: "<Region>", // Region containing Amazon Location resource
...authHelper.getClientConfig(), // Provides credentials obtained via API key
});
const client = new amazonLocationClient.GeoRoutesClient(authHelper.getClientConfig());
const input = { ... };
const command = new amazonLocationClient.routes.CalculateRoutesCommand(input);
const response = await client.send(command);
Expand All @@ -50,10 +47,7 @@ This example uses the Amazon Location Client to make a request that authenticate
// Create an authentication helper instance using credentials from Amazon Cognito
const authHelper = await amazonLocationClient.withIdentityPoolId("<Identity Pool ID>");

const client = new amazonLocationClient.GeoRoutesClient({
region: "<Region>", // region containing Amazon Location resources
...authHelper.getClientConfig(), // Provides credentials obtained via Amazon Cognito
});
const client = new amazonLocationClient.GeoRoutesClient(authHelper.getClientConfig());
const input = { ... };
const command = new amazonLocationClient.routes.CalculateRoutesCommand(input);
const response = await client.send(command);
Expand All @@ -68,13 +62,10 @@ The APIs for the different client SDKs are grouped separately.
The standalone Maps SDK commands are grouped into a `maps` namespace. For example:

```javascript
// Create an authentication helper instance using an API key
const authHelper = await amazonLocationClient.withAPIKey("<API Key>");
// Create an authentication helper instance using an API key and region
const authHelper = await amazonLocationClient.withAPIKey("<API Key>", "<Region>");

const client = new amazonLocationClient.GeoMapsClient({
region: "<Region>", // Region containing Amazon Location resource
...authHelper.getClientConfig(), // Provides credentials obtained via API key
});
const client = new amazonLocationClient.GeoMapsClient(authHelper.getClientConfig());
const input = { ... };
const command = new amazonLocationClient.maps.GetStaticMapCommand(input);
const response = await client.send(command);
Expand All @@ -85,13 +76,10 @@ const response = await client.send(command);
The standalone Places SDK commands are grouped into a `places` namespace. For example:

```javascript
// Create an authentication helper instance using an API key
const authHelper = await amazonLocationClient.withAPIKey("<API Key>");
// Create an authentication helper instance using an API key and region
const authHelper = await amazonLocationClient.withAPIKey("<API Key>", "<Region>");

const client = new amazonLocationClient.GeoPlacesClient({
region: "<Region>", // Region containing Amazon Location resource
...authHelper.getClientConfig(), // Provides credentials obtained via API key
});
const client = new amazonLocationClient.GeoPlacesClient(authHelper.getClientConfig());
const input = { ... };
const command = new amazonLocationClient.places.GetPlaceCommand(input);
const response = await client.send(command);
Expand All @@ -102,13 +90,10 @@ const response = await client.send(command);
The standalone Routes SDK commands are grouped into a `routes` namespace. For example:

```javascript
// Create an authentication helper instance using an API key
const authHelper = await amazonLocationClient.withAPIKey("<API Key>");
// Create an authentication helper instance using an API key and region
const authHelper = await amazonLocationClient.withAPIKey("<API Key>", "<Region>");

const client = new amazonLocationClient.GeoRoutesClient({
region: "<Region>", // Region containing Amazon Location resource
...authHelper.getClientConfig(), // Provides credentials obtained via API key
});
const client = new amazonLocationClient.GeoRoutesClient(authHelper.getClientConfig());
const input = { ... };
const command = new amazonLocationClient.routes.CalculateRoutesCommand(input);
const response = await client.send(command);
Expand All @@ -119,13 +104,10 @@ const response = await client.send(command);
The Location SDK commands are under the top-level namespace. For example:

```javascript
// Create an authentication helper instance using an API key
const authHelper = await amazonLocationClient.withAPIKey("<API Key>");
// Create an authentication helper instance using an API key and region
const authHelper = await amazonLocationClient.withAPIKey("<API Key>", "<Region>");

const client = new amazonLocationClient.LocationClient({
region: "<Region>", // Region containing Amazon Location resource
...authHelper.getClientConfig(), // Provides credentials obtained via API key
});
const client = new amazonLocationClient.LocationClient(authHelper.getClientConfig());
const input = { ... };
const command = new amazonLocationClient.ListGeofencesCommand(input);
const response = await client.send(command);
Expand Down
16 changes: 7 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"@amzn/geomaps-client": "file:temp_clients/amzn-geomaps-client-0.0.1.tgz",
"@amzn/geoplaces-client": "file:temp_clients/amzn-geoplaces-client-0.0.1.tgz",
"@amzn/georoutes-client": "file:temp_clients/amzn-georoutes-client-0.0.1.tgz",
"@aws/amazon-location-utilities-auth-helper": "^1.0.7",
"@aws/amazon-location-utilities-auth-helper": "file:temp_clients/aws-amazon-location-utilities-auth-helper-1.1.0.tgz",
"@aws-sdk/client-location": "^3.621.0",
"@aws-sdk/credential-providers": "^3.621.0"
},
Expand Down
Binary file not shown.

0 comments on commit 452a303

Please sign in to comment.