Skip to content

Commit

Permalink
chore: migrate AWS SDK for JavaScript v2 APIs to v3
Browse files Browse the repository at this point in the history
  • Loading branch information
trivikr committed Jul 31, 2024
1 parent 38de866 commit 68487a6
Show file tree
Hide file tree
Showing 62 changed files with 380 additions and 148 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
var AWS = require('aws-sdk');

const { fromEnv } = require('@aws-sdk/credential-providers');

var path = require('path');

console.log('Loading function');
Expand All @@ -10,8 +13,11 @@ var esDomain = {
doctype: 'lambda-type'
};

var creds = new AWS.EnvironmentCredentials('AWS');
var endpoint = new AWS.Endpoint(esDomain.endpoint);
var creds = // JS SDK v3 switched credential providers from classes to functions.
// This is the closest approximation from codemod of what your application needs.
// Reference: https://www.npmjs.com/package/@aws-sdk/credential-providers
fromEnv('AWS');
var endpoint = new URL(esDomain.endpoint);

function postDocumentToES(doc, context, id) {
var req = new AWS.HttpRequest(endpoint);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
var AWS = require('aws-sdk');

const { fromEnv } = require('@aws-sdk/credential-providers');

var path = require('path');

console.log('Loading function');
Expand All @@ -10,8 +13,11 @@ var esDomain = {
doctype: 'lambda-type'
};

var creds = new AWS.EnvironmentCredentials('AWS');
var endpoint = new AWS.Endpoint(esDomain.endpoint);
var creds = // JS SDK v3 switched credential providers from classes to functions.
// This is the closest approximation from codemod of what your application needs.
// Reference: https://www.npmjs.com/package/@aws-sdk/credential-providers
fromEnv('AWS');
var endpoint = new URL(esDomain.endpoint);

function postDocumentToES(doc, context, id) {
var req = new AWS.HttpRequest(endpoint);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
var AWS = require('aws-sdk');

const { fromEnv } = require('@aws-sdk/credential-providers');

var path = require('path');

console.log('Loading function');
Expand All @@ -10,8 +13,11 @@ var esDomain = {
doctype: 'lambda-type'
};

var creds = new AWS.EnvironmentCredentials('AWS');
var endpoint = new AWS.Endpoint(esDomain.endpoint);
var creds = // JS SDK v3 switched credential providers from classes to functions.
// This is the closest approximation from codemod of what your application needs.
// Reference: https://www.npmjs.com/package/@aws-sdk/credential-providers
fromEnv('AWS');
var endpoint = new URL(esDomain.endpoint);

function postDocumentToES(doc, context, id) {
var req = new AWS.HttpRequest(endpoint);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
var AWS = require('aws-sdk');

const { fromEnv } = require('@aws-sdk/credential-providers');

var path = require('path');

console.log('Loading function');
Expand All @@ -10,8 +13,11 @@ var esDomain = {
doctype: 'movie'
};

var creds = new AWS.EnvironmentCredentials('AWS');
var endpoint = new AWS.Endpoint(esDomain.endpoint);
var creds = // JS SDK v3 switched credential providers from classes to functions.
// This is the closest approximation from codemod of what your application needs.
// Reference: https://www.npmjs.com/package/@aws-sdk/credential-providers
fromEnv('AWS');
var endpoint = new URL(esDomain.endpoint);

function postDocumentToES(doc, context) {
var req = new AWS.HttpRequest(endpoint);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
var AWS = require('aws-sdk');

const { fromEnv } = require('@aws-sdk/credential-providers');

var path = require('path');

console.log('Loading function');
Expand All @@ -10,8 +13,11 @@ var esDomain = {
doctype: 'movie'
};

var creds = new AWS.EnvironmentCredentials('AWS');
var endpoint = new AWS.Endpoint(esDomain.endpoint);
var creds = // JS SDK v3 switched credential providers from classes to functions.
// This is the closest approximation from codemod of what your application needs.
// Reference: https://www.npmjs.com/package/@aws-sdk/credential-providers
fromEnv('AWS');
var endpoint = new URL(esDomain.endpoint);

function postDocumentToES(doc, context) {
var req = new AWS.HttpRequest(endpoint);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
var AWS = require('aws-sdk');

const { fromEnv } = require('@aws-sdk/credential-providers');

var path = require('path');

console.log('Loading function');
Expand All @@ -10,8 +13,11 @@ var esDomain = {
doctype: 'movie'
};

var creds = new AWS.EnvironmentCredentials('AWS');
var endpoint = new AWS.Endpoint(esDomain.endpoint);
var creds = // JS SDK v3 switched credential providers from classes to functions.
// This is the closest approximation from codemod of what your application needs.
// Reference: https://www.npmjs.com/package/@aws-sdk/credential-providers
fromEnv('AWS');
var endpoint = new URL(esDomain.endpoint);

function postDocumentToES(doc, context) {
var req = new AWS.HttpRequest(endpoint);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
var AWS = require('aws-sdk');

const { fromEnv } = require('@aws-sdk/credential-providers');

var path = require('path');

console.log('Loading function');
Expand All @@ -10,8 +13,11 @@ var esDomain = {
doctype: 'movie'
};

var creds = new AWS.EnvironmentCredentials('AWS');
var endpoint = new AWS.Endpoint(esDomain.endpoint);
var creds = // JS SDK v3 switched credential providers from classes to functions.
// This is the closest approximation from codemod of what your application needs.
// Reference: https://www.npmjs.com/package/@aws-sdk/credential-providers
fromEnv('AWS');
var endpoint = new URL(esDomain.endpoint);

function postDocumentToES(doc, context) {
var req = new AWS.HttpRequest(endpoint);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
var AWS = require('aws-sdk');

const { fromEnv } = require('@aws-sdk/credential-providers');

var path = require('path');

console.log('Loading function');
Expand All @@ -10,8 +13,11 @@ var esDomain = {
doctype: 'movie'
};

var creds = new AWS.EnvironmentCredentials('AWS');
var endpoint = new AWS.Endpoint(esDomain.endpoint);
var creds = // JS SDK v3 switched credential providers from classes to functions.
// This is the closest approximation from codemod of what your application needs.
// Reference: https://www.npmjs.com/package/@aws-sdk/credential-providers
fromEnv('AWS');
var endpoint = new URL(esDomain.endpoint);

function postDocumentToES(doc, context) {
var req = new AWS.HttpRequest(endpoint);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
var AWS = require('aws-sdk');

const { fromEnv } = require('@aws-sdk/credential-providers');

var path = require('path');

console.log('Loading function');
Expand All @@ -10,8 +13,11 @@ var esDomain = {
doctype: 'movie'
};

var creds = new AWS.EnvironmentCredentials('AWS');
var endpoint = new AWS.Endpoint(esDomain.endpoint);
var creds = // JS SDK v3 switched credential providers from classes to functions.
// This is the closest approximation from codemod of what your application needs.
// Reference: https://www.npmjs.com/package/@aws-sdk/credential-providers
fromEnv('AWS');
var endpoint = new URL(esDomain.endpoint);

function postDocumentToES(doc, context) {
var req = new AWS.HttpRequest(endpoint);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
var AWS = require('aws-sdk');

const { fromEnv } = require('@aws-sdk/credential-providers');

var path = require('path');

console.log('Loading function');
Expand All @@ -10,8 +13,11 @@ var esDomain = {
doctype: 'movie'
};

var creds = new AWS.EnvironmentCredentials('AWS');
var endpoint = new AWS.Endpoint(esDomain.endpoint);
var creds = // JS SDK v3 switched credential providers from classes to functions.
// This is the closest approximation from codemod of what your application needs.
// Reference: https://www.npmjs.com/package/@aws-sdk/credential-providers
fromEnv('AWS');
var endpoint = new URL(esDomain.endpoint);

function postDocumentToES(doc, context) {
var req = new AWS.HttpRequest(endpoint);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
var AWS = require('aws-sdk');

const { fromEnv } = require('@aws-sdk/credential-providers');

var path = require('path');

console.log('Loading function');
Expand All @@ -10,8 +13,11 @@ var esDomain = {
doctype: 'movie'
};

var creds = new AWS.EnvironmentCredentials('AWS');
var endpoint = new AWS.Endpoint(esDomain.endpoint);
var creds = // JS SDK v3 switched credential providers from classes to functions.
// This is the closest approximation from codemod of what your application needs.
// Reference: https://www.npmjs.com/package/@aws-sdk/credential-providers
fromEnv('AWS');
var endpoint = new URL(esDomain.endpoint);

function postDocumentToES(doc, context) {
var req = new AWS.HttpRequest(endpoint);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,11 @@
* and limitations under the License.
*/

const aws = require('aws-sdk');
const eventbridge = new aws.EventBridge();


const { EventBridge } = require('@aws-sdk/client-eventbridge');

const eventbridge = new EventBridge();
exports.handler = () => {
const params = {
Entries: [{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,11 @@
* and limitations under the License.
*/

const aws = require('aws-sdk');
const eventbridge = new aws.EventBridge();


const { EventBridge } = require('@aws-sdk/client-eventbridge');

const eventbridge = new EventBridge();
exports.handler = () => {
const params = {
Entries: [{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,11 @@
* and limitations under the License.
*/

const aws = require('aws-sdk');
const eventbridge = new aws.EventBridge();


const { EventBridge } = require('@aws-sdk/client-eventbridge');

const eventbridge = new EventBridge();
exports.handler = () => {
const params = {
Entries: [{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,11 @@
* and limitations under the License.
*/

const aws = require('aws-sdk');
const eventbridge = new aws.EventBridge();


const { EventBridge } = require('@aws-sdk/client-eventbridge');

const eventbridge = new EventBridge();
exports.handler = () => {
const params = {
Entries: [{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,11 @@
* and limitations under the License.
*/

const aws = require('aws-sdk');
const eventbridge = new aws.EventBridge();


const { EventBridge } = require('@aws-sdk/client-eventbridge');

const eventbridge = new EventBridge();
exports.handler = () => {
const params = {
Entries: [{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,11 @@
* and limitations under the License.
*/

const aws = require('aws-sdk');
const eventbridge = new aws.EventBridge();


const { EventBridge } = require('@aws-sdk/client-eventbridge');

const eventbridge = new EventBridge();
exports.handler = () => {
const params = {
Entries: [{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
var AWS = require('aws-sdk');

const { fromEnv } = require('@aws-sdk/credential-providers');

var path = require('path');

console.log('Loading function');
Expand All @@ -10,8 +13,11 @@ var openSearchDomain = {
doctype: 'movie'
};

var creds = new AWS.EnvironmentCredentials('AWS');
var endpoint = new AWS.Endpoint(openSearchDomain.endpoint);
var creds = // JS SDK v3 switched credential providers from classes to functions.
// This is the closest approximation from codemod of what your application needs.
// Reference: https://www.npmjs.com/package/@aws-sdk/credential-providers
fromEnv('AWS');
var endpoint = new URL(openSearchDomain.endpoint);

function postDocumentToOpenSearch(doc, context) {
var req = new AWS.HttpRequest(endpoint);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
var AWS = require('aws-sdk');

const { fromEnv } = require('@aws-sdk/credential-providers');

var path = require('path');

console.log('Loading function');
Expand All @@ -10,8 +13,11 @@ var openSearchDomain = {
doctype: 'movie'
};

var creds = new AWS.EnvironmentCredentials('AWS');
var endpoint = new AWS.Endpoint(openSearchDomain.endpoint);
var creds = // JS SDK v3 switched credential providers from classes to functions.
// This is the closest approximation from codemod of what your application needs.
// Reference: https://www.npmjs.com/package/@aws-sdk/credential-providers
fromEnv('AWS');
var endpoint = new URL(openSearchDomain.endpoint);

function postDocumentToOpenSearch(doc, context) {
var req = new AWS.HttpRequest(endpoint);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
var AWS = require('aws-sdk');

const { fromEnv } = require('@aws-sdk/credential-providers');

var path = require('path');

console.log('Loading function');
Expand All @@ -10,8 +13,11 @@ var openSearchDomain = {
doctype: 'movie'
};

var creds = new AWS.EnvironmentCredentials('AWS');
var endpoint = new AWS.Endpoint(openSearchDomain.endpoint);
var creds = // JS SDK v3 switched credential providers from classes to functions.
// This is the closest approximation from codemod of what your application needs.
// Reference: https://www.npmjs.com/package/@aws-sdk/credential-providers
fromEnv('AWS');
var endpoint = new URL(openSearchDomain.endpoint);

function postDocumentToOpenSearch(doc, context) {
var req = new AWS.HttpRequest(endpoint);
Expand Down
Loading

0 comments on commit 68487a6

Please sign in to comment.