nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: aws/aws-sdk-js
Pull request #3170 (2020-03-20 19:49:55)

Add EC2ThrottledException to throttledError list
<!--
Thank you for your pull request. Please provide a description below.
-->

##### Checklist
<!-- Remove items that do not apply. For completed items, change [ ] to [x]. -->

- [x] `npm run test` passes
- [x] changelog is added, `npm run add-change`

aws-sdk-js-automation: 
### AWS CodeBuild CI Report

* CodeBuild project: sdk-v2-github
* Commit ID: b9e420b49ef0336ee519ab8ee0f12c0c74c8435d
* Result: SUCCEEDED
* [Build Logs](https://r6vdd33du7.execute-api.us-west-2.amazonaws.com/Prod/buildlogs?key=6498a55a-b3ba-444d-bbf2-32b3af12375b%2Fbuild.log) (available for 30 days)

*Powered by [github-codebuild-logs](https://serverlessrepo.aws.amazon.com/applications/arn:aws:serverlessrepo:us-east-1:277187709615:applications~github-codebuild-logs), available on the [AWS Serverless Application Repository](https://aws.amazon.com/serverless/serverlessrepo/)*


<!--
CREATED BY GITHUB-CODEBUILD-LOGS
-->



Patch:
diff --git a/.changes/next-release/feature-EC2-0ecd30a7.json b/.changes/next-release/feature-EC2-0ecd30a7.json
new file mode 100644
index 000000000..26c1ede42
--- /dev/null
+++ b/.changes/next-release/feature-EC2-0ecd30a7.json
@@ -0,0 +1,5 @@
+{
+  "type": "feature",
+  "category": "EC2",
+  "description": "Add EC2ThrottledException to throttledError"
+}
\ No newline at end of file
diff --git a/lib/service.js b/lib/service.js
index ac6ad7f2e..54c029f36 100644
--- a/lib/service.js
+++ b/lib/service.js
@@ -611,6 +611,7 @@ AWS.Service = inherit({
       case 'RequestThrottledException':
       case 'TooManyRequestsException':
       case 'TransactionInProgressException': //dynamodb
+      case 'EC2ThrottledException':
         return true;
       default:
         return false;


Test patch:
diff --git a/test/service.spec.js b/test/service.spec.js
index f43f4f6c9..59f631099 100644
--- a/test/service.spec.js
+++ b/test/service.spec.js
@@ -532,6 +532,10 @@
           code: 'TransactionInProgressException',
           statusCode: 400
         }, true);
+        retryableError({
+          code: 'EC2ThrottledException',
+          statusCode: 400
+        }, true);
       });
       it('should retry on expired credentials error', function() {
         return retryableError({
Repository: aws/aws-sdk-js
Pull request #4022 (2022-02-10 22:45:05)

disable validation for non-object values to document members
Follow-up to https://github.com/aws/aws-sdk-js/pull/4011
Fix the validation error when assign non-object values to member with document trait

##### Checklist
<!-- Remove items that do not apply. For completed items, change [ ] to [x]. -->

- [x] `npm run test` passes
- [x] changelog is added, `npm run add-change`



Patch:
diff --git a/.changes/next-release/bugfix-ParamValidator-72a79dfa.json b/.changes/next-release/bugfix-ParamValidator-72a79dfa.json
new file mode 100644
index 000000000..2e563660b
--- /dev/null
+++ b/.changes/next-release/bugfix-ParamValidator-72a79dfa.json
@@ -0,0 +1,5 @@
+{
+  "type": "bugfix",
+  "category": "ParamValidator",
+  "description": "Fix the validation error when assign non-object values to member with document trait"
+}
\ No newline at end of file
diff --git a/apis/ssm-2014-11-06.normal.json b/apis/ssm-2014-11-06.normal.json
index 414dfb8ef..5d7c3830a 100644
--- a/apis/ssm-2014-11-06.normal.json
+++ b/apis/ssm-2014-11-06.normal.json
@@ -3217,9 +3217,6 @@
         "shape": "TerminateSessionResponse"
       },
       "errors": [
-        {
-          "shape": "DoesNotExistException"
-        },
         {
           "shape": "InternalServerError"
         }
diff --git a/lib/param_validator.js b/lib/param_validator.js
index 2875663e9..99391ad6e 100644
--- a/lib/param_validator.js
+++ b/lib/param_validator.js
@@ -51,10 +51,9 @@ AWS.ParamValidator = AWS.util.inherit({
   },
 
   validateStructure: function validateStructure(shape, params, context) {
-    this.validateType(params, context, ['object'], 'structure');
-
     if (shape.isDocument) return true;
 
+    this.validateType(params, context, ['object'], 'structure');
     var paramName;
     for (var i = 0; shape.required && i < shape.required.length; i++) {
       paramName = shape.required[i];


Test patch:
diff --git a/test/param_validator.spec.js b/test/param_validator.spec.js
index ad844842f..9387032c0 100644
--- a/test/param_validator.spec.js
+++ b/test/param_validator.spec.js
@@ -226,6 +226,7 @@
                 },
                 hash3: {
                   type: 'structure',
+                  members: {},
                   document: true
                 }
               }
@@ -275,13 +276,21 @@
           }
         });
       });
-      it('accepts document type members', function () {
-        return expectValid({
-          hash1: {
-            hash3: {foo: 'foo', bar: ['bar']}
-          }
+      for (const documentMember of [
+        'string',
+        1,
+        true,
+        { foo: 'foo', bar: ['bar'] },
+        [1, 'array', false, { baz: 'baz' }]
+      ]) {
+        it('accepts document type member of ' + JSON.stringify(documentMember), function () {
+          return expectValid({
+            hash1: {
+              hash3: documentMember
+            }
+          });
         });
-      });
+      }
       return it('does not check inherited properties on parameters', function() {
         var cls, obj;
         cls = function() {
Repository: aws/aws-sdk-js
Pull request #4254 (2022-10-25 00:34:07)

Read awsQueryCompatible trait from  metadata with tests
Read awsQueryCompatible trait from metadata with tests

##### Checklist

- [x ] `npm run test` passes
- [ x] changelog is added, `npm run add-change`



Patch:
diff --git a/.changes/next-release/bugfix-AWSQueryCompatible-f891b653.json b/.changes/next-release/bugfix-AWSQueryCompatible-f891b653.json
new file mode 100644
index 000000000..1059ec4d6
--- /dev/null
+++ b/.changes/next-release/bugfix-AWSQueryCompatible-f891b653.json
@@ -0,0 +1,5 @@
+{
+  "type": "bugfix",
+  "category": "AWSQueryCompatible",
+  "description": "Read trait from metadata"
+}
\ No newline at end of file
diff --git a/lib/model/api.js b/lib/model/api.js
index f59f1a6ff..542d1d2c0 100644
--- a/lib/model/api.js
+++ b/lib/model/api.js
@@ -80,7 +80,7 @@ function Api(api, options) {
     property(this, 'documentation', api.documentation);
     property(this, 'documentationUrl', api.documentationUrl);
   }
-  property(this, 'awsQueryCompatible', api.awsQueryCompatible);
+  property(this, 'awsQueryCompatible', api.metadata.awsQueryCompatible);
 }
 
 /**


Test patch:
diff --git a/test/service.spec.js b/test/service.spec.js
index 3c5cb43c1..a3a5fd4b3 100644
--- a/test/service.spec.js
+++ b/test/service.spec.js
@@ -15,9 +15,15 @@
   describe('AWSQuery compatible error codes', function () {
     let service;
     let AwsQueryService;
+    let metadata = {
+      endpointPrefix : 'mockservice',
+      signatureVersion : 'v4'
+    };
 
     beforeEach(function(done) {
-      AwsQueryService = MockServiceFromApi({awsQueryCompatible: {}});
+      AwsQueryService = MockServiceFromApi({
+        metadata: {...metadata, awsQueryCompatible: {}}
+      });
       service = new AwsQueryService({maxRetries: 0});
       return done();
     });
@@ -26,6 +32,19 @@
       return expect(service.api.awsQueryCompatible).to.eql({});
     });
 
+    it('can receive default error code when trait is not present', function() {
+      AwsQueryService = MockServiceFromApi({ metadata: metadata });
+      service = new AwsQueryService({maxRetries: 0});
+      helpers.mockHttpResponse(500, {
+        'x-amzn-query-error': 'AwsQueryError;Sender'
+      }, ['ServiceError']);
+      return (service.makeRequest('operation', {}, function (err, data) {
+        expect(err.code).to.equal('ServiceError');
+        expect(err.statusCode).to.equal(500);
+        return expect(data).to.equal(null);
+      }));
+    });
+
     it('can receive awsquery compatible error code when header present', function () {
       helpers.mockHttpResponse(500, {
         'x-amzn-query-error': 'AwsQueryError;Sender'
Repository: aws/aws-sdk-js
Pull request #4458 (2023-06-27 22:01:44)

fix: recognize cost explorer global endpoints
# Description

Cost explorer seems to be missing from being as recognized as a global endpoint. While a "region" is specified, this service is only available in one region at a single endpoint in both the commercial and cn partitions.

Commercial: https://docs.aws.amazon.com/cost-management/latest/userguide/ce-api.html
China: https://docs.amazonaws.cn/en_us/cost-management/latest/userguide/ce-api.html

# Checklist

- [x] `npm run test` passes
- [x] changelog is added, `npm run add-change`

Root of this change is that I am running into token signature problems when using. Similar to the problems that this PR solved: https://github.com/aws/aws-sdk-js/pull/3274


Patch:
diff --git a/.changes/next-release/bugfix-Global-Services-2456cbf7.json b/.changes/next-release/bugfix-Global-Services-2456cbf7.json
new file mode 100644
index 000000000..013274426
--- /dev/null
+++ b/.changes/next-release/bugfix-Global-Services-2456cbf7.json
@@ -0,0 +1,5 @@
+{
+  "type": "bugfix",
+  "category": "Cost Explorer",
+  "description": "recognize Cost Explorer global endpoints."
+}
\ No newline at end of file
diff --git a/lib/region_config_data.json b/lib/region_config_data.json
index 98474df10..c1309f73c 100644
--- a/lib/region_config_data.json
+++ b/lib/region_config_data.json
@@ -50,6 +50,18 @@
     },
 
     "us-gov-*/iam": "globalGovCloud",
+
+    "*/ce": {
+      "endpoint": "{service}.us-east-1.amazonaws.com",
+      "globalEndpoint": true,
+      "signingRegion": "us-east-1"
+    },
+    "cn-*/ce": {
+      "endpoint": "{service}.cn-northwest-1.amazonaws.com.cn",
+      "globalEndpoint": true,
+      "signingRegion": "cn-northwest-1"
+    },
+
     "us-gov-*/sts": {
       "endpoint": "{service}.{region}.amazonaws.com"
     },


Test patch:
diff --git a/test/region_config.spec.js b/test/region_config.spec.js
index 5a0b48578..3a3bbe3e6 100644
--- a/test/region_config.spec.js
+++ b/test/region_config.spec.js
@@ -47,6 +47,24 @@ describe('region_config.js', function() {
     expect(service.endpoint.host).to.equal('iam.cn-north-1.amazonaws.com.cn');
   });
 
+  it('uses "global" endpoint for Cost Explorer in us-east-2', function() {
+    var service = new AWS.CostExplorer({
+      region: 'us-east-2'
+    });
+    expect(service.isGlobalEndpoint).to.equal(true);
+    expect(service.signingRegion).to.equal('us-east-1');
+    expect(service.endpoint.host).to.equal('ce.us-east-1.amazonaws.com');
+  });
+
+  it('uses "global" endpoint for Cost Explorer in cn-north-1', function() {
+    var service = new AWS.CostExplorer({
+      region: 'cn-north-1'
+    });
+    expect(service.isGlobalEndpoint).to.equal(true);
+    expect(service.signingRegion).to.equal('cn-northwest-1');
+    expect(service.endpoint.host).to.equal('ce.cn-northwest-1.amazonaws.com.cn');
+  });
+
   [
     ['cn-north-1', 'cn-northwest-1', 'route53.amazonaws.com.cn'],
     ['us-gov-west-1', 'us-gov-west-1', 'route53.us-gov.amazonaws.com'],
Repository: aws/aws-xray-sdk-node
Pull request #69 (2018-10-31 10:05:48)

Improved Utils#processTraceData type safety
*Issue #, if available:* #67

*Description of changes:*
* This adds type safety by checking for empty/malformed values.
* Earlier, stirng trim and split were being called indiscriminately.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.



Patch:
diff --git a/packages/core/lib/utils.js b/packages/core/lib/utils.js
index 728c09b..1ad3221 100644
--- a/packages/core/lib/utils.js
+++ b/packages/core/lib/utils.js
@@ -4,6 +4,7 @@
 
 var each = require('lodash/each');
 var isNull = require('lodash/isNull');
+var isString = require('lodash/isString');
 var isUndefined = require('lodash/isUndefined');
 
 var logger = require('./logger');
@@ -163,9 +164,17 @@ var utils = {
   processTraceData: function processTraceData(traceData) {
     var amznTraceData = {};
 
+    if (!(isString(traceData) && traceData))
+      return amznTraceData;
+
     each(traceData.split(';'), function(header) {
+      if (!header)
+        return;
+
       var pair = header.split('=');
-      amznTraceData[pair[0].trim()] = pair[1].trim();
+
+      if (pair[0] && pair[1])
+        amznTraceData[pair[0].trim()] = pair[1].trim();
     });
 
     return amznTraceData;


Test patch:
diff --git a/packages/core/test/unit/utils.test.js b/packages/core/test/unit/utils.test.js
index 0d60f65..490bf5b 100644
--- a/packages/core/test/unit/utils.test.js
+++ b/packages/core/test/unit/utils.test.js
@@ -37,6 +37,38 @@ describe('Utils', function() {
       assert.propertyVal(parsed, 'Parent', '48af77592b6dd73f');
       assert.propertyVal(parsed, 'Sampled', '1');
     });
+
+    it('should bail out for missing trace values', function() {
+        assert.deepEqual(Utils.processTraceData(), {});
+    });
+
+    it('should bail out for empty trace values', function() {
+        assert.deepEqual(Utils.processTraceData(''), {});
+    });
+
+    it('should handle trace header values with excess semicolons correctly', function() {
+        assert.deepEqual(Utils.processTraceData('Root=1-58ed6027-14afb2e09172c337713486c0;'), {
+          Root: '1-58ed6027-14afb2e09172c337713486c0'
+        });
+    });
+
+    it('should handle malformed key=value pairs correctly (missing value)', function() {
+        assert.deepEqual(Utils.processTraceData('Root=1-58ed6027-14afb2e09172c337713486c0;Parent'), {
+          Root: '1-58ed6027-14afb2e09172c337713486c0'
+        });
+    });
+
+    it('should handle malformed key=value pairs correctly (empty key)', function() {
+        assert.deepEqual(Utils.processTraceData('Root=1-58ed6027-14afb2e09172c337713486c0;=48af77592b6dd73f'), {
+          Root: '1-58ed6027-14afb2e09172c337713486c0'
+        });
+    });
+
+    it('should handle malformed key=value pairs correctly (empty value)', function() {
+        assert.deepEqual(Utils.processTraceData('Root=1-58ed6027-14afb2e09172c337713486c0;Parent='), {
+          Root: '1-58ed6027-14afb2e09172c337713486c0'
+        });
+    });
   });
 
   describe('#processTraceData', function() {
Repository: aws/aws-sdk-js
Pull request #4657 (2024-07-08 14:33:35)

update getEndpointSuffix for eu-isoe-west-1
add endpoint suffix for region

Note: this is a private API, calling this function directly is not supported.


Patch:
diff --git a/lib/region_config.js b/lib/region_config.js
index b0fbb3fee..f2809c521 100644
--- a/lib/region_config.js
+++ b/lib/region_config.js
@@ -90,7 +90,8 @@ function getEndpointSuffix(region) {
     '^cn\\-\\w+\\-\\d+$': 'amazonaws.com.cn',
     '^us\\-gov\\-\\w+\\-\\d+$': 'amazonaws.com',
     '^us\\-iso\\-\\w+\\-\\d+$': 'c2s.ic.gov',
-    '^us\\-isob\\-\\w+\\-\\d+$': 'sc2s.sgov.gov'
+    '^us\\-isob\\-\\w+\\-\\d+$': 'sc2s.sgov.gov',
+    '^eu\\-isoe\\-west\\-1$': 'cloud.adc-e.uk',
   };
   var defaultSuffix = 'amazonaws.com';
   var regexes = Object.keys(regionRegexes);


Test patch:
diff --git a/test/region_config.spec.js b/test/region_config.spec.js
index 3a3bbe3e6..4d7ddc0e4 100644
--- a/test/region_config.spec.js
+++ b/test/region_config.spec.js
@@ -1,6 +1,7 @@
 const helpers = require('./helpers');
 const AWS = helpers.AWS;
 const MockService = helpers.MockService;
+var getEndpointSuffix = require('../lib/region_config').getEndpointSuffix;
 
 describe('region_config.js', function() {
   it('sets endpoint configuration option for default regions', function() {
@@ -134,6 +135,10 @@ describe('region_config.js', function() {
     expect(service.isGlobalEndpoint).to.equal(false);
     expect(service.endpoint.host).to.equal('sts.us-gov-west-1.amazonaws.com');
   });
+
+  it('resolves the endpoint suffix for eu-isoe-west-1', function() {
+    expect(getEndpointSuffix('eu-isoe-west-1')).to.equal('cloud.adc-e.uk');
+  });
 });
 
 describe('region_config_data.json', function() {
Repository: aws/aws-sdk-js
Pull request #4674 (2024-08-30 16:56:55)

update getEndpointSuffix for us-isof-south-1
add endpoint suffix for a region

Note: this is a private API, calling this function directly is not supported.

##### Checklist

- [x] changelog is added, `npm run add-change`



Patch:
diff --git a/.changes/next-release/bugfix-region-endpoint-0496c4f3.json b/.changes/next-release/bugfix-region-endpoint-0496c4f3.json
new file mode 100644
index 000000000..14e33a830
--- /dev/null
+++ b/.changes/next-release/bugfix-region-endpoint-0496c4f3.json
@@ -0,0 +1,5 @@
+{
+  "type": "bugfix",
+  "category": "region endpoint",
+  "description": "add endpoint suffix for a region"
+}
\ No newline at end of file
diff --git a/lib/region_config.js b/lib/region_config.js
index f2809c521..04aa8de1b 100644
--- a/lib/region_config.js
+++ b/lib/region_config.js
@@ -92,6 +92,7 @@ function getEndpointSuffix(region) {
     '^us\\-iso\\-\\w+\\-\\d+$': 'c2s.ic.gov',
     '^us\\-isob\\-\\w+\\-\\d+$': 'sc2s.sgov.gov',
     '^eu\\-isoe\\-west\\-1$': 'cloud.adc-e.uk',
+    '^us\\-isof\\-\\w+\\-\\d+$': 'csp.hci.ic.gov',
   };
   var defaultSuffix = 'amazonaws.com';
   var regexes = Object.keys(regionRegexes);


Test patch:
diff --git a/test/region_config.spec.js b/test/region_config.spec.js
index 4d7ddc0e4..5712c1b05 100644
--- a/test/region_config.spec.js
+++ b/test/region_config.spec.js
@@ -139,6 +139,10 @@ describe('region_config.js', function() {
   it('resolves the endpoint suffix for eu-isoe-west-1', function() {
     expect(getEndpointSuffix('eu-isoe-west-1')).to.equal('cloud.adc-e.uk');
   });
+
+  it('resolves the endpoint suffix for us-isof-south-1', function() {
+    expect(getEndpointSuffix('us-isof-south-1')).to.equal('csp.hci.ic.gov');
+  });
 });
 
 describe('region_config_data.json', function() {