Socket
Socket
Sign inDemoInstall

aws-sdk

Package Overview
Dependencies
Maintainers
1
Versions
1964
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

aws-sdk - npm Package Compare versions

Comparing version 2.0.0-rc1 to 2.0.0-rc10

apis/autoscaling-2011-01-01.json

15

lib/aws.js

@@ -1,16 +0,1 @@

/**
* Copyright 2012-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You
* may not use this file except in compliance with the License. A copy of
* the License is located at
*
* http://aws.amazon.com/apache2.0/
*
* or in the "license" file accompanying this file. This file is
* distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
* ANY KIND, either express or implied. See the License for the specific
* language governing permissions and limitations under the License.
*/
var AWS = require('./core');

@@ -17,0 +2,0 @@ module.exports = AWS;

@@ -1,18 +0,3 @@

/**
* Copyright 2012-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You
* may not use this file except in compliance with the License. A copy of
* the License is located at
*
* http://aws.amazon.com/apache2.0/
*
* or in the "license" file accompanying this file. This file is
* distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
* ANY KIND, either express or implied. See the License for the specific
* language governing permissions and limitations under the License.
*/
window.AWS = module.exports = require('./core');
require('./http/xhr');
require('./services');

26

lib/config.js

@@ -1,16 +0,1 @@

/**
* Copyright 2012-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You
* may not use this file except in compliance with the License. A copy of
* the License is located at
*
* http://aws.amazon.com/apache2.0/
*
* or in the "license" file accompanying this file. This file is
* distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
* ANY KIND, either express or implied. See the License for the specific
* language governing permissions and limitations under the License.
*/
var AWS = require('./core');

@@ -84,2 +69,6 @@ require('./credentials');

* requests
*
* @!attribute signatureVersion
* @return [String] the signature version to sign requests with (overriding
* the API configuration). Possible values are: 'v2', 'v3', 'v4'.
*/

@@ -132,4 +121,4 @@ AWS.Config = AWS.util.inherit({

* Node.js environment.
* * **timeout** [Integer] — The number of milliseconds to wait before
* giving up on a connection attempt. Defaults to no timeout.
* * **timeout** [Integer] — Sets the socket to timeout after timeout
* milliseconds of inactivity on the socket. Defaults to no timeout.
* @option options apiVersion [String, Date] a String in YYYY-MM-DD format

@@ -146,2 +135,5 @@ * (or a date) that represents the latest possible API version that can be

* information about requests
* @option options signatureVersion [String] the signature version to sign
* requests with (overriding the API configuration). Possible values are:
* 'v2', 'v3', 'v4'.
*/

@@ -148,0 +140,0 @@ constructor: function Config(options) {

/**
* Copyright 2012-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You
* may not use this file except in compliance with the License. A copy of
* the License is located at
*
* http://aws.amazon.com/apache2.0/
*
* or in the "license" file accompanying this file. This file is
* distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
* ANY KIND, either express or implied. See the License for the specific
* language governing permissions and limitations under the License.
* The main AWS namespace
*/
var AWS = {};
/**
* The main AWS namespace
*
* @api private
* @!macro [new] nobrowser
* @note This feature is not supported in the browser environment of the SDK.
*/
var AWS = {};
var _hidden = {}; _hidden = {}; // hack to parse macro
module.exports = AWS;

@@ -31,3 +21,3 @@ require('./util');

*/
VERSION: '2.0.0-rc1',
VERSION: '2.0.0-rc10',

@@ -57,2 +47,3 @@ /**

require('./credentials/web_identity_credentials');
require('./credentials/saml_credentials');

@@ -64,2 +55,4 @@ require('./config');

require('./request');
require('./response');
require('./resource_waiter');
require('./signers/request_signer');

@@ -66,0 +59,0 @@ require('./param_validator');

@@ -1,16 +0,1 @@

/**
* Copyright 2012-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You
* may not use this file except in compliance with the License. A copy of
* the License is located at
*
* http://aws.amazon.com/apache2.0/
*
* or in the "license" file accompanying this file. This file is
* distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
* ANY KIND, either express or implied. See the License for the specific
* language governing permissions and limitations under the License.
*/
var AWS = require('./core');

@@ -17,0 +2,0 @@

@@ -1,18 +0,2 @@

/**
* Copyright 2012-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You
* may not use this file except in compliance with the License. A copy of
* the License is located at
*
* http://aws.amazon.com/apache2.0/
*
* or in the "license" file accompanying this file. This file is
* distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
* ANY KIND, either express or implied. See the License for the specific
* language governing permissions and limitations under the License.
*/
var AWS = require('../core');
require('../credentials');

@@ -19,0 +3,0 @@ /**

@@ -1,18 +0,2 @@

/**
* Copyright 2012-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You
* may not use this file except in compliance with the License. A copy of
* the License is located at
*
* http://aws.amazon.com/apache2.0/
*
* or in the "license" file accompanying this file. This file is
* distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
* ANY KIND, either express or implied. See the License for the specific
* language governing permissions and limitations under the License.
*/
var AWS = require('../core');
require('../credentials');
require('../metadata_service');

@@ -33,3 +17,2 @@

AWS.Credentials.call(this);
this.serviceError = null;
this.metadataService = new AWS.MetadataService(options);

@@ -53,11 +36,5 @@ this.metadata = {};

if (!callback) callback = function(err) { if (err) throw err; };
if (self.serviceError) {
callback(self.serviceError);
return;
}
self.metadataService.loadCredentials(function (err, creds) {
if (err) {
self.serviceError = err;
} else {
if (!err) {
self.expired = false;

@@ -64,0 +41,0 @@ self.metadata = creds;

@@ -1,18 +0,2 @@

/**
* Copyright 2012-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You
* may not use this file except in compliance with the License. A copy of
* the License is located at
*
* http://aws.amazon.com/apache2.0/
*
* or in the "license" file accompanying this file. This file is
* distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
* ANY KIND, either express or implied. See the License for the specific
* language governing permissions and limitations under the License.
*/
var AWS = require('../core');
require('../credentials');

@@ -19,0 +3,0 @@ /**

@@ -1,18 +0,2 @@

/**
* Copyright 2012-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You
* may not use this file except in compliance with the License. A copy of
* the License is located at
*
* http://aws.amazon.com/apache2.0/
*
* or in the "license" file accompanying this file. This file is
* distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
* ANY KIND, either express or implied. See the License for the specific
* language governing permissions and limitations under the License.
*/
var AWS = require('../core');
require('../credentials');

@@ -19,0 +3,0 @@ /**

@@ -1,19 +0,2 @@

/**
* Copyright 2012-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You
* may not use this file except in compliance with the License. A copy of
* the License is located at
*
* http://aws.amazon.com/apache2.0/
*
* or in the "license" file accompanying this file. This file is
* distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
* ANY KIND, either express or implied. See the License for the specific
* language governing permissions and limitations under the License.
*/
var AWS = require('../core');
require('../credentials');
require('../services/sts');

@@ -73,3 +56,2 @@ /**

this.loadMasterCredentials();
this.serviceError = null;
this.service = new AWS.STS();

@@ -101,6 +83,2 @@ this.expired = true;

if (!callback) callback = function(err) { if (err) throw err; };
if (self.serviceError) {
callback(self.serviceError);
return;
}

@@ -111,5 +89,3 @@ self.service.config.credentials = self.masterCredentials;

operation.call(self.service, self.params, function (err, data) {
if (err) {
self.serviceError = err;
} else {
if (!err) {
self.service.credentialsFrom(data, self);

@@ -116,0 +92,0 @@ }

@@ -1,19 +0,2 @@

/**
* Copyright 2012-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You
* may not use this file except in compliance with the License. A copy of
* the License is located at
*
* http://aws.amazon.com/apache2.0/
*
* or in the "license" file accompanying this file. This file is
* distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
* ANY KIND, either express or implied. See the License for the specific
* language governing permissions and limitations under the License.
*/
var AWS = require('../core');
require('../credentials');
require('../services/sts');

@@ -69,3 +52,2 @@ /**

AWS.Credentials.call(this);
this.serviceError = null;
this.expired = true;

@@ -91,11 +73,5 @@ this.service = new AWS.STS();

if (!callback) callback = function(err) { if (err) throw err; };
if (self.serviceError) {
callback(self.serviceError);
return;
}
self.service.assumeRoleWithWebIdentity(self.params, function (err, data) {
if (err) {
self.serviceError = err;
} else {
if (!err) {
self.service.credentialsFrom(data, self);

@@ -102,0 +78,0 @@ }

@@ -1,16 +0,1 @@

/**
* Copyright 2012-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You
* may not use this file except in compliance with the License. A copy of
* the License is located at
*
* http://aws.amazon.com/apache2.0/
*
* or in the "license" file accompanying this file. This file is
* distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
* ANY KIND, either express or implied. See the License for the specific
* language governing permissions and limitations under the License.
*/
var AWS = require('./core');

@@ -24,6 +9,2 @@ require('./sequential_executor');

/* jshint -W079 */
var Buffer = require('buffer').Buffer;
/* jshint +W079 */
/**

@@ -93,9 +74,9 @@ * The namespace used to register global event listeners for request building

addAsync('VALIDATE_CREDENTIALS', 'validate',
function VALIDATE_CREDENTIALS(req, doneCallback) {
function VALIDATE_CREDENTIALS(req, done) {
req.service.config.getCredentials(function(err) {
if (err) {
err = AWS.util.error(err,
req.response.err = AWS.util.error(err,
{code: 'SigningError', message: 'Missing credentials in config'});
}
doneCallback(err);
done();
});

@@ -105,4 +86,4 @@ });

add('VALIDATE_REGION', 'validate', function VALIDATE_REGION(req) {
if (!req.service.config.region && !req.service.api.globalEndpoint) {
throw AWS.util.error(new Error(),
if (!req.service.config.region && !req.service.hasGlobalEndpoint()) {
req.response.error = AWS.util.error(new Error(),
{code: 'SigningError', message: 'Missing region in config'});

@@ -128,12 +109,14 @@ }

addAsync('SIGN', 'sign', function SIGN(req, doneCallback) {
if (!req.service.api.signatureVersion) return doneCallback(); // none
addAsync('SIGN', 'sign', function SIGN(req, done) {
if (!req.service.api.signatureVersion) return done(); // none
req.service.config.getCredentials(function (err, credentials) {
if (err) {
req.response.error = err;
return done();
}
try {
if (err) return doneCallback(err);
var date = AWS.util.date.getDate();
var sigVersion = req.service.api.signatureVersion;
var SignerClass = AWS.Signers.RequestSigner.getVersion(sigVersion);
var SignerClass = req.service.getSignerClass(req);
var signer = new SignerClass(req.httpRequest,

@@ -149,55 +132,62 @@ req.service.api.signingName || req.service.api.endpointPrefix);

signer.addAuthorization(credentials, date);
doneCallback();
} catch (e) {
doneCallback(e);
req.response.error = e;
}
done();
});
});
add('SETUP_ERROR', 'extractError', function SETUP_ERROR(resp) {
add('VALIDATE_RESPONSE', 'validateResponse', function VALIDATE_RESPONSE(resp) {
if (this.service.successfulResponse(resp, this)) {
// throwing null will stop the error extraction chain
// but will not set an error for data extraction
throw null;
resp.data = {};
resp.error = null;
} else {
resp.data = null;
resp.error = AWS.util.error(new Error(),
{code: 'UnknownError', message: 'An unknown error occurred.'});
}
resp.error = AWS.util.error(new Error(),
{code: 'UnknownError', message: 'An unknown error occurred.'});
resp.data = null;
});
add('SETUP_DATA', 'extractData', function SETUP_DATA(resp) {
resp.data = {};
resp.error = null;
});
add('SEND', 'send', function SEND(resp) {
addAsync('SEND', 'send', function SEND(resp, done) {
function callback(httpResp) {
resp.httpStream = httpResp;
resp.httpResponse.stream = httpResp;
resp.httpResponse._abortCallback = done;
var headers = [httpResp.statusCode, httpResp.headers, resp];
resp.request.emitEvent('httpHeaders', headers);
httpResp.on('headers', function onHeaders(statusCode, headers) {
resp.request.emit('httpHeaders', [statusCode, headers, resp]);
if (resp.httpStream) {
if (AWS.HttpClient.streamsApiVersion === 2) { // streams2 API check
httpResp.on('readable', function onReadable() {
var data = httpResp.read();
if (data !== null) {
resp.request.emitEvent('httpData', [data, resp]);
}
});
} else { // legacy streams API
httpResp.on('data', function onData(data) {
resp.request.emitEvent('httpData', [data, resp]);
});
if (!resp.request.httpRequest._streaming) {
if (AWS.HttpClient.streamsApiVersion === 2) { // streams2 API check
httpResp.on('readable', function onReadable() {
var data = httpResp.read();
if (data !== null) {
resp.request.emit('httpData', [data, resp]);
}
});
} else { // legacy streams API
httpResp.on('data', function onData(data) {
resp.request.emit('httpData', [data, resp]);
});
}
}
});
httpResp.on('end', function onEnd() {
resp.request.emitEvent('httpDone', [resp]);
});
}
httpResp.on('end', function onEnd() {
resp.request.emit('httpDone');
done();
});
}
function progress(httpResp) {
httpResp.on('sendProgress', function onSendProgress(progress) {
resp.request.emit('httpUploadProgress', [progress, resp]);
});
httpResp.on('receiveProgress', function onReceiveProgress(progress) {
resp.request.emit('httpDownloadProgress', [progress, resp]);
});
}
function error(err) {
err = AWS.util.error(err, {
resp.error = AWS.util.error(err, {
code: 'NetworkingError',

@@ -208,8 +198,14 @@ region: resp.request.httpRequest.region,

});
resp.request.emitEvent('httpError', [err, resp]);
resp.request.emit('httpError', [resp.error, resp], function() {
done();
});
}
resp.error = null;
resp.data = null;
var http = AWS.HttpClient.getInstance();
var httpOptions = resp.request.service.config.httpOptions || {};
http.handleRequest(this.httpRequest, httpOptions, callback, error);
var s = http.handleRequest(this.httpRequest, httpOptions, callback, error);
progress(s);
});

@@ -221,8 +217,19 @@

resp.httpResponse.headers = headers;
resp.httpResponse.body = new Buffer('');
resp.httpResponse.body = new AWS.util.Buffer('');
resp.httpResponse.buffers = [];
resp.httpResponse.numBytes = 0;
});
add('HTTP_DATA', 'httpData', function HTTP_DATA(chunk, resp) {
if (chunk) resp.httpResponse.buffers.push(new Buffer(chunk));
if (chunk) {
if (AWS.util.isNode()) {
resp.httpResponse.numBytes += chunk.length;
var total = resp.httpResponse.headers['content-length'];
var progress = { loaded: resp.httpResponse.numBytes, total: total };
resp.request.emit('httpDownloadProgress', [progress, resp]);
}
resp.httpResponse.buffers.push(new AWS.util.Buffer(chunk));
}
});

@@ -236,16 +243,12 @@

}
delete resp.httpResponse.numBytes;
delete resp.httpResponse.buffers;
this.completeRequest(resp);
});
add('HTTP_ERROR', 'httpError', function HTTP_ERROR(error, resp) {
resp.error = error;
this.completeRequest(resp);
});
add('FINALIZE_ERROR', 'retry', function FINALIZE_ERROR(resp) {
resp.error.statusCode = resp.httpResponse.statusCode;
if (resp.error.retryable === undefined) {
resp.error.retryable = this.service.retryableError(resp.error, this);
if (resp.httpResponse.statusCode) {
resp.error.statusCode = resp.httpResponse.statusCode;
if (resp.error.retryable === undefined) {
resp.error.retryable = this.service.retryableError(resp.error, this);
}
}

@@ -276,8 +279,13 @@ });

if (resp.error) {
if (resp.error.redirect && resp.redirectCount < this.service.config.maxRedirects) {
if (resp.error.redirect && resp.redirectCount < resp.maxRedirects) {
resp.error.retryDelay = 0;
resp.redirectCount++;
} else if (resp.error.retryable && resp.retryCount < this.service.numRetries()) {
resp.error._willRetry = true;
} else if (resp.error.retryable && resp.retryCount < resp.maxRetries) {
var delays = this.service.retryDelays();
resp.error.retryDelay = delays[resp.retryCount] || 0;
resp.retryCount++;
resp.error._willRetry = true;
} else {
throw resp.error;
resp.error._willRetry = false;
}

@@ -287,21 +295,19 @@ }

addAsync('RETRY_SIGN', 'retry', function RETRY_SIGN(resp, doneCallback) {
this.emitEvent('sign', resp, doneCallback);
addAsync('RESET_RETRY_STATE', 'afterRetry', function RESET_RETRY_STATE(resp, done) {
if (resp.error && resp.error._willRetry) {
var delay = resp.error.retryDelay || 0;
resp.error = null;
setTimeout(done, delay);
} else {
done();
}
});
addAsync('RETRY_DELAY_SEND', 'retry', function RETRY_DELAY_SEND(resp, doneCallback) {
var delay = 0;
if (!resp.error.redirect) {
delay = this.service.retryDelays()[resp.retryCount-1] || 0;
}
}),
resp.error = null;
resp.data = null;
setTimeout(function() {
resp.request.emitEvent('send', resp, doneCallback);
}, delay);
CorePost: new AWS.SequentialExecutor().addNamedListeners(function(add) {
add('EXTRACT_REQUEST_ID', 'extractData', function EXTRACT_REQUEST_ID(resp) {
resp.requestId = resp.httpResponse.headers['x-amz-request-id'] ||
resp.httpResponse.headers['x-amzn-requestid'];
});
}),

@@ -308,0 +314,0 @@

@@ -1,16 +0,1 @@

/**
* Copyright 2012-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You
* may not use this file except in compliance with the License. A copy of
* the License is located at
*
* http://aws.amazon.com/apache2.0/
*
* or in the "license" file accompanying this file. This file is
* distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
* ANY KIND, either express or implied. See the License for the specific
* language governing permissions and limitations under the License.
*/
var AWS = require('./core');

@@ -17,0 +2,0 @@ var inherit = AWS.util.inherit;

@@ -1,18 +0,5 @@

/**
* Copyright 2012-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You
* may not use this file except in compliance with the License. A copy of
* the License is located at
*
* http://aws.amazon.com/apache2.0/
*
* or in the "license" file accompanying this file. This file is
* distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
* ANY KIND, either express or implied. See the License for the specific
* language governing permissions and limitations under the License.
*/
var AWS = require('../core');
var Stream = require('stream').Stream;
var WritableStream = require('stream').Writable;
var ReadableStream = require('stream').Readable;
require('../http');

@@ -47,3 +34,3 @@

if (useSSL && !httpOptions.agent) {
options.agent = this.sslAgent(http);
options.agent = this.sslAgent();
}

@@ -55,3 +42,6 @@

var stream = http.request(options, callback);
var stream = http.request(options, function (httpResp) {
callback(httpResp);
httpResp.emit('headers', httpResp.statusCode, httpResp.headers);
});
httpRequest.stream = stream; // attach stream to httpRequest

@@ -79,6 +69,13 @@

writeBody: function writeBody(stream, httpRequest) {
if (httpRequest.body instanceof Stream) {
httpRequest.body.pipe(stream);
} else if (httpRequest.body) {
stream.end(httpRequest.body);
var body = httpRequest.body;
if (body && WritableStream && ReadableStream) { // progress support
if (!(body instanceof Stream)) body = this.bufferToStream(body);
body.pipe(this.progressStream(stream, httpRequest));
}
if (body instanceof Stream) {
body.pipe(stream);
} else if (body) {
stream.end(body);
} else {

@@ -89,10 +86,50 @@ stream.end();

sslAgent: function sslAgent(http) {
sslAgent: function sslAgent() {
var https = require('https');
if (!AWS.NodeHttpClient.sslAgent) {
AWS.NodeHttpClient.sslAgent = new http.Agent({
rejectUnauthorized: true
AWS.NodeHttpClient.sslAgent = new https.Agent({rejectUnauthorized: true});
AWS.NodeHttpClient.sslAgent.setMaxListeners(0);
// delegate maxSockets to globalAgent
Object.defineProperty(AWS.NodeHttpClient.sslAgent, 'maxSockets', {
enumerable: true,
get: function() { return https.globalAgent.maxSockets; }
});
}
return AWS.NodeHttpClient.sslAgent;
}
},
progressStream: function progressStream(stream, httpRequest) {
var numBytes = 0;
var totalBytes = httpRequest.headers['Content-Length'];
var writer = new WritableStream();
writer._write = function(chunk, encoding, callback) {
if (chunk) {
numBytes += chunk.length;
stream.emit('sendProgress', {
loaded: numBytes, total: totalBytes
});
}
callback();
};
return writer;
},
bufferToStream: function bufferToStream(buffer) {
if (!AWS.util.Buffer.isBuffer(buffer)) buffer = new AWS.util.Buffer(buffer);
var readable = new ReadableStream();
var pos = 0;
readable._read = function(size) {
var end = pos + size;
if (end > buffer.length) end = buffer.length;
readable.push(buffer.slice(pos, end));
pos = end;
};
return readable;
},
emitter: null
});

@@ -112,2 +149,2 @@

*/
AWS.HttpClient.streamsApiVersion = require('stream').Readable ? 2 : 1;
AWS.HttpClient.streamsApiVersion = ReadableStream ? 2 : 1;

@@ -1,16 +0,1 @@

/**
* Copyright 2012-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You
* may not use this file except in compliance with the License. A copy of
* the License is located at
*
* http://aws.amazon.com/apache2.0/
*
* or in the "license" file accompanying this file. This file is
* distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
* ANY KIND, either express or implied. See the License for the specific
* language governing permissions and limitations under the License.
*/
var AWS = require('../core');

@@ -27,5 +12,4 @@ var EventEmitter = require('events').EventEmitter;

var endpoint = httpRequest.endpoint;
var xhr = new XMLHttpRequest();
var emitter = new EventEmitter();
var href = endpoint.protocol + '//' + endpoint.host;
var href = endpoint.protocol + '//' + endpoint.hostname;
if (endpoint.port != 80 && endpoint.port != 443) {

@@ -36,2 +20,5 @@ href += ':' + endpoint.port;

var xhr = new XMLHttpRequest();
httpRequest.stream = xhr;
if (httpOptions.timeout) {

@@ -42,2 +29,3 @@ xhr.timeout = httpOptions.timeout;

xhr.addEventListener('readystatechange', function() {
if (xhr.status === 0) return; // 0 code is invalid
if (this.readyState === this.HEADERS_RECEIVED) {

@@ -47,24 +35,13 @@ try { xhr.responseType = 'arraybuffer'; } catch (e) {}

emitter.headers = self.parseHeaders(xhr.getAllResponseHeaders());
callback(emitter);
emitter.emit('headers', emitter.statusCode, emitter.headers);
} else if (this.readyState === this.DONE) {
var buffer;
if (xhr.responseType === 'arraybuffer' && xhr.response) {
var ab = xhr.response;
buffer = new Buffer(ab.byteLength);
var view = new Uint8Array(ab);
for (var i = 0; i < buffer.length; ++i) {
buffer[i] = view[i];
}
}
try {
if (!buffer && typeof xhr.responseText === 'string') {
buffer = new Buffer(xhr.responseText);
}
} catch (e) {}
if (buffer) emitter.emit('data', buffer);
emitter.emit('end');
self.finishRequest(xhr, emitter);
}
}, false);
xhr.upload.addEventListener('progress', function (evt) {
emitter.emit('sendProgress', evt);
});
xhr.addEventListener('progress', function (evt) {
emitter.emit('receiveProgress', evt);
}, false);
xhr.addEventListener('timeout', function () {

@@ -74,5 +51,8 @@ errCallback(AWS.util.error(new Error('Timeout'), {code: 'TimeoutError'}));

xhr.addEventListener('error', function () {
errCallback(new Error('Network Failure'));
errCallback(AWS.util.error(new Error('Network Failure'), {
code: 'NetworkingError'
}));
}, false);
callback(emitter);
xhr.open(httpRequest.method, href, true);

@@ -99,5 +79,26 @@ AWS.util.each(httpRequest.headers, function (key, value) {

var value = line.substring(key.length + 2);
headers[key] = value;
if (key.length > 0) headers[key] = value;
});
return headers;
},
finishRequest: function finishRequest(xhr, emitter) {
var buffer;
if (xhr.responseType === 'arraybuffer' && xhr.response) {
var ab = xhr.response;
buffer = new AWS.util.Buffer(ab.byteLength);
var view = new Uint8Array(ab);
for (var i = 0; i < buffer.length; ++i) {
buffer[i] = view[i];
}
}
try {
if (!buffer && typeof xhr.responseText === 'string') {
buffer = new AWS.util.Buffer(xhr.responseText);
}
} catch (e) {}
if (buffer) emitter.emit('data', buffer);
emitter.emit('end');
}

@@ -104,0 +105,0 @@ });

@@ -1,16 +0,1 @@

/**
* Copyright 2012-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You
* may not use this file except in compliance with the License. A copy of
* the License is located at
*
* http://aws.amazon.com/apache2.0/
*
* or in the "license" file accompanying this file. This file is
* distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
* ANY KIND, either express or implied. See the License for the specific
* language governing permissions and limitations under the License.
*/
var AWS = require('../core');

@@ -29,3 +14,3 @@ var inherit = AWS.util.inherit;

constructor: function XMLBuilder(rules, options) {
constructor: function JSONBuilder(rules, options) {
this.rules = rules;

@@ -35,3 +20,3 @@ this.timestampFormat = options.timestampFormat;

toJSON: function toJSON(params) {
build: function build(params) {
return JSON.stringify(this.translate(this.rules, params));

@@ -41,2 +26,4 @@ },

translate: function translate(rules, value) {
if (value === null || value === undefined) return undefined;
if (rules.type == 'structure') {

@@ -47,4 +34,5 @@

AWS.util.each.call(this, value, function (memberName, memberValue) {
var memberRules = rules[memberName] || {};
struct[memberName] = this.translate(memberRules, memberValue);
var memberRules = rules.members[memberName] || {};
var result = this.translate(memberRules, memberValue);
if (result !== undefined) struct[memberName] = result;
});

@@ -59,3 +47,4 @@ return struct;

var memberRules = rules.members || {};
list.push(this.translate(memberRules, memberValue));
var result = this.translate(memberRules, memberValue);
if (result !== undefined) list.push(result);
});

@@ -70,3 +59,4 @@ return list;

var memberRules = rules.members || {};
map[memberName] = translate(memberRules, memberValue);
var result = this.translate(memberRules, memberValue);
if (result !== undefined) map[memberName] = result;
});

@@ -80,2 +70,6 @@ return map;

} else if (rules.type == 'integer') {
return parseInt(value, 10);
} else if (rules.type == 'float') {
return parseFloat(value);
} else {

@@ -82,0 +76,0 @@

@@ -1,16 +0,1 @@

/**
* Copyright 2012-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You
* may not use this file except in compliance with the License. A copy of
* the License is located at
*
* http://aws.amazon.com/apache2.0/
*
* or in the "license" file accompanying this file. This file is
* distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
* ANY KIND, either express or implied. See the License for the specific
* language governing permissions and limitations under the License.
*/
var AWS = require('./core');

@@ -17,0 +2,0 @@ require('./http');

@@ -1,16 +0,1 @@

/**
* Copyright 2012-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You
* may not use this file except in compliance with the License. A copy of
* the License is located at
*
* http://aws.amazon.com/apache2.0/
*
* or in the "license" file accompanying this file. This file is
* distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
* ANY KIND, either express or implied. See the License for the specific
* language governing permissions and limitations under the License.
*/
var AWS = require('./core');

@@ -40,3 +25,5 @@

if (!rules.hasOwnProperty(paramName)) continue;
if (rules[paramName].required && params[paramName] === undefined) {
var value = params[paramName];
var notSet = value === undefined || value === null;
if (rules[paramName].required && notSet) {
this.fail('MissingRequiredParameter',

@@ -112,3 +99,3 @@ 'Missing required key \'' + paramName + '\' in ' + context);

case 'float':
return this.validateType(context, value, ['number']);
return this.validateNumber(context, value);
case 'boolean':

@@ -131,3 +118,5 @@ return this.validateType(context, value, ['boolean']);

validateType: function validateType(context, value, acceptedTypes, type) {
/*jshint maxcomplexity:12*/
/*jshint maxcomplexity:14*/
if (value === null || value === undefined) return;
var foundInvalidType = false;

@@ -159,3 +148,14 @@ for (var i = 0; i < acceptedTypes.length; i++) {

validateNumber: function validateNumber(context, value) {
if (value === null || value === undefined) return;
if (typeof value === 'string') {
var castedValue = parseFloat(value);
if (castedValue.toString() === value) value = castedValue;
}
return this.validateType(context, value, ['number']);
},
validatePayload: function validatePayload(context, value) {
/*jshint maxcomplexity:14*/
if (value === null || value === undefined) return;
if (typeof value === 'string') return;

@@ -165,3 +165,3 @@ if (value && typeof value.byteLength === 'number') return; // typed arrays

var Stream = require('stream').Stream;
if (value instanceof Buffer || value instanceof Stream) return;
if (AWS.util.Buffer.isBuffer(value) || value instanceof Stream) return;
}

@@ -168,0 +168,0 @@

@@ -1,19 +0,66 @@

/**
* Copyright 2012-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You
* may not use this file except in compliance with the License. A copy of
* the License is located at
*
* http://aws.amazon.com/apache2.0/
*
* or in the "license" file accompanying this file. This file is
* distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
* ANY KIND, either express or implied. See the License for the specific
* language governing permissions and limitations under the License.
*/
var AWS = require('./core');
var AcceptorStateMachine = require('./state_machine');
var inherit = AWS.util.inherit;
var fsm = new AcceptorStateMachine();
fsm.setupStates = function() {
var hardErrorStates = ['success', 'error', 'complete'];
var transition = function transition(err, done) {
try {
var self = this;
var origError = self.response.error;
self.emit(self._asm.currentState, function() {
if (self.response.error && origError != self.response.error) {
if (hardErrorStates.indexOf(this._asm.currentState) >= 0) {
this._hardError = true;
}
}
done(self.response.error);
});
} catch (e) {
this.response.error = e;
if (hardErrorStates.indexOf(this._asm.currentState) >= 0) {
this._hardError = true;
}
done(e);
}
};
this.addState('validate', 'build', 'error', transition);
this.addState('restart', 'build', 'error', function(err, done) {
err = this.response.error;
if (!err) return done();
if (!err.retryable) return done(err);
if (this.response.retryCount < this.service.config.maxRetries) {
this.response.retryCount++;
done();
} else {
done(err);
}
});
this.addState('build', 'afterBuild', 'restart', transition);
this.addState('afterBuild', 'sign', 'restart', transition);
this.addState('sign', 'send', 'retry', transition);
this.addState('retry', 'afterRetry', 'afterRetry', transition);
this.addState('afterRetry', 'sign', 'error', transition);
this.addState('send', 'validateResponse', 'retry', transition);
this.addState('validateResponse', 'extractData', 'extractError', transition);
this.addState('extractError', 'extractData', 'retry', transition);
this.addState('extractData', 'success', 'retry', transition);
this.addState('success', 'complete', 'complete', transition);
this.addState('error', 'complete', 'complete', transition);
this.addState('complete', null, 'uncaughtException', transition);
this.addState('uncaughtException', function(err, done) {
try {
AWS.SequentialExecutor.prototype.unhandledErrorCallback.call(this, err);
} catch (e) {
if (this._hardError) throw err;
}
done(err);
});
};
fsm.setupStates();
/**

@@ -195,2 +242,18 @@ * ## Asynchronous Requests

*
* @!event httpUploadProgress(progress, response)
* Triggered when the HTTP request has uploaded more data
* @param progress [map] An object containing the `loaded` and `total` bytes
* of the request.
* @param (see AWS.Request~send)
* @context (see AWS.Request~send)
* @note This event will not be emitted in Node.js 0.8.x.
*
* @!event httpDownloadProgress(progress, response)
* Triggered when the HTTP request has downloaded more data
* @param progress [map] An object containing the `loaded` and `total` bytes
* of the request.
* @param (see AWS.Request~send)
* @context (see AWS.Request~send)
* @note This event will not be emitted in Node.js 0.8.x.
*
* @!event httpError(error, response)

@@ -226,3 +289,3 @@ * Triggered when the HTTP request failed

// global endpoints sign as us-east-1
if (service.api.globalEndpoint) region = 'us-east-1';
if (service.hasGlobalEndpoint()) region = 'us-east-1';

@@ -235,3 +298,8 @@ this.service = service;

this.response = new AWS.Response(this);
this.restartCount = 0;
this._asm = new AcceptorStateMachine(fsm.states, 'validate');
AWS.SequentialExecutor.call(this);
this.emit = this.emitEvent;
},

@@ -262,22 +330,28 @@

*/
send: function send(callback, response) {
send: function send(callback) {
if (callback) {
this.on('complete', function (resp) {
callback.call(resp, resp.error, resp.data);
try {
callback.call(resp, resp.error, resp.data);
} catch (e) {
resp.request._hardError = true;
throw e;
}
});
}
this.runTo();
if (!response) response = new AWS.Response(this);
var eventNames = ['validate', 'build', 'afterBuild', 'sign', 'send'];
this.emitEvents(eventNames, response, function(err) {
if (err) {
// calling failRequest instead of completeRequest because errors
// raised before we have finished sending the request should never
// get retried
this.failRequest(response);
}
});
return response;
return this.response;
},
build: function build(callback) {
this._hardError = callback ? false : true;
return this.runTo('send', callback);
},
runTo: function runTo(state, done) {
this._asm.runTo(state, done, this);
return this;
},
/**

@@ -306,18 +380,15 @@ * Aborts a request, emitting the error and complete events.

abort: function abort() {
this._events = { // reset events
error: this._events.error,
complete: this._events.complete
};
this.removeAllListeners('validateResponse');
this.removeAllListeners('extractError');
this.on('validateResponse', function addAbortedError(resp) {
resp.error = AWS.util.error(new Error('Request aborted by user'), {
code: 'RequestAbortedError', retryable: false
});
});
if (this.httpRequest.stream) { // abort HTTP stream
this.httpRequest.stream.abort();
this.httpRequest._abortCallback();
}
// emit only error and complete callbacks
var response = new AWS.Response(this);
response.error = AWS.util.error(new Error('Request aborted by user'), {
code: 'RequestAbortedError', retryable: false
});
this.failRequest(response);
return this;

@@ -438,3 +509,3 @@ },

stream.sent = true;
process.nextTick(function() { req.send(); });
process.nextTick(function() { req.send(function() { }); });
}

@@ -445,2 +516,4 @@ });

if (statusCode < 300) {
this.httpRequest._streaming = true;
req.removeListener('httpData', AWS.EventListeners.Core.HTTP_DATA);

@@ -451,6 +524,5 @@ req.removeListener('httpError', AWS.EventListeners.Core.HTTP_ERROR);

resp.error.retryable = false;
this.completeRequest(resp);
});
var httpStream = resp.httpStream;
var httpStream = resp.httpResponse.stream;
stream.response = resp;

@@ -472,4 +544,2 @@ stream._read = function() {

});
resp.httpStream = null; // take ownership of the stream object
}

@@ -486,47 +556,2 @@ });

/**
* @api private
*/
completeRequest: function completeRequest(response) {
this.emitEvents(['extractError', 'extractData'], response, function(err) {
if (err) {
this.emitEvent('retry', response, function(retryError) {
if (retryError) this.failRequest(response);
});
} else {
this.emitEvent('success', [response], this.unhandledErrorCallback);
this.emitEvent('complete', [response], this.unhandledErrorCallback);
}
});
},
/**
* @api private
*/
failRequest: function failRequest(response) {
this.emitEvent('error', [response.error, response], this.unhandledErrorCallback);
this.emitEvent('complete', [response], this.unhandledErrorCallback);
},
/**
* @api private
*/
emitEvents: function emitEvents(eventNames, response, doneCallback) {
if (!doneCallback) doneCallback = this.unhandledErrorCallback;
if (response.error) {
doneCallback.call(this, response.error);
} else if (eventNames.length === 0) {
doneCallback.call(this);
} else {
this.emitEvent(eventNames[0], response, function(err) {
if (err) {
doneCallback.call(this, err);
} else {
// next event (eventNames is a reducing set)
this.emitEvents(eventNames.slice(1), response, doneCallback);
}
});
}
},
/**
* @param [Array,Response] args This should be the response object,

@@ -536,17 +561,11 @@ * or an array of args to send to the event.

*/
emitEvent: function emitEvent(eventName, args, doneCallback) {
if (!doneCallback) doneCallback = this.unhandledErrorCallback;
var response = null;
if (Array.isArray(args)) {
response = args[args.length - 1];
} else {
response = args;
args = this.eventParameters(eventName, response);
}
emitEvent: function emit(eventName, args, done) {
if (typeof args === 'function') { done = args; args = null; }
if (!done) done = this.unhandledErrorCallback;
if (!args) args = this.eventParameters(eventName, this.response);
this.emit(eventName, args, function (err) {
if (err) {
response.error = err;
}
doneCallback.call(this, err);
var origEmit = AWS.SequentialExecutor.prototype.emit;
origEmit.call(this, eventName, args, function (err) {
if (err) this.response.error = err;
done.call(this, err);
});

@@ -558,3 +577,3 @@ },

*/
eventParameters: function eventParameters(eventName, response) {
eventParameters: function eventParameters(eventName) {
switch (eventName) {

@@ -566,4 +585,6 @@ case 'validate':

return [this];
case 'error':
return [this.response.error, this.response];
default:
return [response];
return [this.response];
}

@@ -574,201 +595,1 @@ }

AWS.util.mixin(AWS.Request, AWS.SequentialExecutor);
/**
* This class encapsulates the the response information
* from a service request operation sent through {AWS.Request}.
* The response object has two main properties for getting information
* back from a request:
*
* ## The `data` property
*
* The `response.data` property contains the serialized object data
* retrieved from the service request. For instance, for an
* Amazon DynamoDB `listTables` method call, the response data might
* look like:
*
* ```
* > resp.data
* { TableNames:
* [ 'table1', 'table2', ... ] }
* ```
*
* The `data` property can be null if an error occurs (see below).
*
* ## The `error` property
*
* In the event of a service error (or transfer error), the
* `response.error` property will be filled with the given
* error data in the form:
*
* ```
* { code: 'SHORT_UNIQUE_ERROR_CODE',
* message: 'Some human readable error message' }
* ```
*
* In the case of an error, the `data` property will be `null`.
* Note that if you handle events that can be in a failure state,
* you should always check whether `response.error` is set
* before attempting to access the `response.data` property.
*
* @!attribute data
* @readonly
* @!group Data Properties
* @note Inside of a {AWS.Request~httpData} event, this
* property contains a single raw packet instead of the
* full de-serialized service response.
* @return [Object] the de-serialized response data
* from the service.
*
* @!attribute error
* An structure containing information about a service
* or networking error.
* @readonly
* @!group Data Properties
* @note This attribute is only filled if a service or
* networking error occurs.
* @return [Object]
* * code [String] a unique short code representing the
* error that was emitted.
* * message [String] a longer human readable error message
* * retryable [Boolean] whether the error message is
* retryable.
*
* @!attribute service
* @readonly
* @!group Operation Properties
* @return [AWS.Service] The service object that initiated the request.
*
* @!attribute operation
* @readonly
* @!group Operation Properties
* @return [String] the name of the operation executed on
* the service.
*
* @!attribute params
* @readonly
* @!group Operation Properties
* @return [Object] the parameters sent in the request to
* the service.
*
* @!attribute retryCount
* @readonly
* @!group Operation Properties
* @return [Integer] the number of retries that were
* attempted before the request was completed.
*
* @!attribute redirectCount
* @readonly
* @!group Operation Properties
* @return [Integer] the number of redirects that were
* followed before the request was completed.
*
* @!attribute httpResponse
* @readonly
* @!group HTTP Properties
* @return [AWS.HttpResponse] the raw HTTP response object
* containing the response headers and body information
* from the server.
*
* @see AWS.Request
*/
AWS.Response = inherit({
/**
* @api private
*/
constructor: function Response(request) {
this.request = request;
this.data = null;
this.error = null;
this.retryCount = 0;
this.redirectCount = 0;
this.httpResponse = new AWS.HttpResponse();
},
/**
* Creates a new request for the next page of response data, calling the
* callback with the page data if a callback is provided.
*
* @callback callback function(err, data)
* Called when a page of data is returned from the next request.
*
* @param err [Error] an error object, if an error occurred in the request
* @param data [Object] the next page of data, or null, if there are no
* more pages left.
* @return [AWS.Request] the request object for the next page of data
* @return [null] if no callback is provided and there are no pages left
* to retrieve.
* @api experimental
* @since v1.4.0
*/
nextPage: function nextPage(callback) {
var config;
var service = this.request.service;
var operation = this.request.operation;
try {
config = service.paginationConfig(operation, true);
} catch (e) { this.error = e; }
if (!this.hasNextPage()) {
if (callback) callback(this.error, null);
else if (this.error) throw this.error;
return null;
}
var params = AWS.util.copy(this.request.params);
if (!this.nextPageTokens) {
return callback ? callback(null, null) : null;
} else {
var inputTokens = config.inputToken;
if (typeof inputTokens === 'string') inputTokens = [inputTokens];
for (var i = 0; i < inputTokens.length; i++) {
params[inputTokens[i]] = this.nextPageTokens[i];
}
return service.makeRequest(this.request.operation, params, callback);
}
},
/**
* @return [Boolean] whether more pages of data can be returned by further
* requests
* @api experimental
* @since v1.4.0
*/
hasNextPage: function hasNextPage() {
this.cacheNextPageTokens();
if (this.nextPageTokens) return true;
if (this.nextPageTokens === undefined) return undefined;
else return false;
},
/**
* @api private
*/
cacheNextPageTokens: function cacheNextPageTokens() {
if (this.hasOwnProperty('nextPageTokens')) return this.nextPageTokens;
this.nextPageTokens = undefined;
var config = this.request.service.paginationConfig(this.request.operation);
if (!config) return this.nextPageTokens;
this.nextPageTokens = null;
if (config.moreResults) {
if (!AWS.util.jamespath.find(config.moreResults, this.data)) {
return this.nextPageTokens;
}
}
var exprs = config.outputToken;
if (typeof exprs === 'string') exprs = [exprs];
AWS.util.arrayEach.call(this, exprs, function (expr) {
var output = AWS.util.jamespath.find(expr, this.data);
if (output) {
this.nextPageTokens = this.nextPageTokens || [];
this.nextPageTokens.push(output);
}
});
return this.nextPageTokens;
}
});

@@ -1,18 +0,3 @@

/**
* Copyright 2012-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You
* may not use this file except in compliance with the License. A copy of
* the License is located at
*
* http://aws.amazon.com/apache2.0/
*
* or in the "license" file accompanying this file. This file is
* distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
* ANY KIND, either express or implied. See the License for the specific
* language governing permissions and limitations under the License.
*/
var AWS = require('./core');
var domain;
var domain = AWS.util.nodeRequire('domain');

@@ -32,7 +17,3 @@ /**

constructor: function SequentialExecutor() {
this.domain = null;
if (require('events').usingDomains) {
domain = require('domain');
if (domain.active) this.domain = domain.active;
}
this.domain = domain && domain.active;
this._events = {};

@@ -261,5 +242,2 @@ },

this.domain.emit('error', err);
} else if (process.exit) {
console.error(err.stack ? err.stack : err);
process.exit(1);
} else {

@@ -266,0 +244,0 @@ throw err;

@@ -1,16 +0,1 @@

/**
* Copyright 2012-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You
* may not use this file except in compliance with the License. A copy of
* the License is located at
*
* http://aws.amazon.com/apache2.0/
*
* or in the "license" file accompanying this file. This file is
* distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
* ANY KIND, either express or implied. See the License for the specific
* language governing permissions and limitations under the License.
*/
var AWS = require('../core');

@@ -32,4 +17,3 @@ require('../json/builder');

httpRequest.path = '/';
httpRequest.body = builder.toJSON(req.params || {});
httpRequest.body = builder.build(req.params || {});
httpRequest.headers['Content-Type'] = 'application/x-amz-json-' + version;

@@ -36,0 +20,0 @@ httpRequest.headers['X-Amz-Target'] = target;

@@ -1,16 +0,1 @@

/**
* Copyright 2012-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You
* may not use this file except in compliance with the License. A copy of
* the License is located at
*
* http://aws.amazon.com/apache2.0/
*
* or in the "license" file accompanying this file. This file is
* distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
* ANY KIND, either express or implied. See the License for the specific
* language governing permissions and limitations under the License.
*/
var AWS = require('../core');

@@ -28,3 +13,2 @@ var inherit = AWS.util.inherit;

var httpRequest = req.httpRequest;
httpRequest.path = '/';
httpRequest.headers['Content-Type'] =

@@ -99,9 +83,2 @@ 'application/x-www-form-urlencoded; charset=utf-8';

AWS.util.each((operation.output || {}).members || {}, function (memberName, memberRules) {
if (memberRules.wrapper && data[memberName]) {
AWS.util.update(data, data[memberName]);
delete data[memberName];
}
});
resp.data = data;

@@ -167,2 +144,3 @@ }

serializeMember: function serializeMember(name, value, rules, fn) {
if (value === null || value === undefined) return;
if (rules.type === 'structure') {

@@ -169,0 +147,0 @@ this.serializeStructure(name, value, rules.members, fn);

@@ -1,16 +0,1 @@

/**
* Copyright 2012-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You
* may not use this file except in compliance with the License. A copy of
* the License is located at
*
* http://aws.amazon.com/apache2.0/
*
* or in the "license" file accompanying this file. This file is
* distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
* ANY KIND, either express or implied. See the License for the specific
* language governing permissions and limitations under the License.
*/
var AWS = require('../core');

@@ -49,6 +34,2 @@ require('./rest');

}
// extract request id
resp.data.RequestId = resp.httpResponse.headers['x-amz-request-id'] ||
resp.httpResponse.headers['x-amzn-requestid'];
},

@@ -69,3 +50,3 @@

if (rules.type === 'structure') {
req.httpRequest.body = this.toJSON(params, input, req.service.api);
req.httpRequest.body = this.buildJSON(params, input, req.service.api);
} else {

@@ -83,3 +64,3 @@ // non-xml paylaod

});
req.httpRequest.body = this.toJSON(params, input, req.service.api);
req.httpRequest.body = this.buildJSON(params, input, req.service.api);

@@ -89,7 +70,7 @@ }

toJSON: function toJSON(params, rules, api) {
buildJSON: function buildJSON(params, rules, api) {
var builder = new AWS.JSON.Builder(rules, api);
return builder.toJSON(params);
return builder.build(params);
}
};

@@ -1,16 +0,1 @@

/**
* Copyright 2012-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You
* may not use this file except in compliance with the License. A copy of
* the License is located at
*
* http://aws.amazon.com/apache2.0/
*
* or in the "license" file accompanying this file. This file is
* distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
* ANY KIND, either express or implied. See the License for the specific
* language governing permissions and limitations under the License.
*/
var AWS = require('../core');

@@ -69,6 +54,2 @@ require('../xml/builder');

}
// extract request id
resp.data.RequestId = httpResponse.headers['x-amz-request-id'] ||
httpResponse.headers['x-amzn-requestid'];
},

@@ -75,0 +56,0 @@

@@ -1,16 +0,1 @@

/**
* Copyright 2012-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You
* may not use this file except in compliance with the License. A copy of
* the License is located at
*
* http://aws.amazon.com/apache2.0/
*
* or in the "license" file accompanying this file. This file is
* distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
* ANY KIND, either express or implied. See the License for the specific
* language governing permissions and limitations under the License.
*/
var AWS = require('../core');

@@ -74,3 +59,4 @@

var operation = req.service.api.operations[req.operation];
var uri = operation.http.uri;
var uri = [req.httpRequest.endpoint.path, operation.http.uri].join('/');
uri = uri.replace(/\/+/g, '/');
var pathPattern = uri.split(/\?/)[0];

@@ -77,0 +63,0 @@ var rules = (operation.input || {}).members || {};

@@ -1,17 +0,3 @@

/**
* Copyright 2012-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You
* may not use this file except in compliance with the License. A copy of
* the License is located at
*
* http://aws.amazon.com/apache2.0/
*
* or in the "license" file accompanying this file. This file is
* distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
* ANY KIND, either express or implied. See the License for the specific
* language governing permissions and limitations under the License.
*/
var AWS = require('./core');
var Translator = require('./api/translator');
var inherit = AWS.util.inherit;

@@ -175,7 +161,63 @@

/**
* Calls an operation on a service with the given input parameters, without
* any authentication data. This method is useful for "public" API operations.
*
* @param operation [String] the name of the operation to call on the service.
* @param params [map] a map of input options for the operation
* @callback callback function(err, data)
* If a callback is supplied, it is called when a response is returned
* from the service.
* @param err [Error] the error object returned from the request.
* Set to `null` if the request is successful.
* @param data [Object] the de-serialized data returned from
* the request. Set to `null` if a request error occurs.
*/
makeUnauthenticatedRequest: function makeUnauthenticatedRequest(operation, params, callback) {
if (typeof params === 'function') {
callback = params;
params = {};
}
var request = this.makeRequest(operation, params);
request.removeListener('validate', AWS.EventListeners.Core.VALIDATE_CREDENTIALS);
request.removeListener('sign', AWS.EventListeners.Core.SIGN);
if (this.api.format === 'query') { // query services turn into GET requests
request.addListener('build', function convertToGET(request) {
request.httpRequest.method = 'GET';
request.httpRequest.path = '/?' + request.httpRequest.body;
request.httpRequest.body = '';
// don't need these headers on a GET request
delete request.httpRequest.headers['Content-Length'];
delete request.httpRequest.headers['Content-Type'];
});
}
return callback ? request.send(callback) : request;
},
/**
* Waits for a given state
*
* @param state [String] the state on the service to wait for
* @param params [map] a map of parameters to pass with each request
* @callback callback function(err, data)
* If a callback is supplied, it is called when a response is returned
* from the service.
* @param err [Error] the error object returned from the request.
* Set to `null` if the request is successful.
* @param data [Object] the de-serialized data returned from
* the request. Set to `null` if a request error occurs.
*/
waitFor: function waitFor(state, params, callback) {
var waiter = new AWS.ResourceWaiter(this, state);
return waiter.wait(params, callback);
},
/**
* @api private
*/
addAllRequestListeners: function addAllRequestListeners(request) {
var list = [AWS.events, AWS.EventListeners.Core,
this.serviceInterface()];
var list = [AWS.events, AWS.EventListeners.Core, this.serviceInterface(),
AWS.EventListeners.CorePost];
for (var i = 0; i < list.length; i++) {

@@ -208,4 +250,15 @@ if (list[i]) request.addListeners(list[i]);

/**
* Gets the signer class for a given request
* @api private
*/
getSignerClass: function getSignerClass() {
var version = this.api.signatureVersion;
if (this.config.signatureVersion) version = this.config.signatureVersion;
else if (this.isRegionV4()) version = 'v4';
return AWS.Signers.RequestSigner.getVersion(version);
},
/**
* @api private
*/
serviceInterface: function serviceInterface() {

@@ -297,6 +350,7 @@ switch (this.api.format) {

this.endpoint = new AWS.Endpoint(endpoint, this.config);
} else if (this.api.globalEndpoint) {
} else if (this.hasGlobalEndpoint()) {
this.endpoint = new AWS.Endpoint(this.api.globalEndpoint, this.config);
} else {
var host = this.api.endpointPrefix + '.' + this.config.region + '.amazonaws.com';
var host = this.api.endpointPrefix + '.' + this.config.region +
this.endpointSuffix();
this.endpoint = new AWS.Endpoint(host, this.config);

@@ -309,2 +363,34 @@ }

*/
hasGlobalEndpoint: function hasGlobalEndpoint() {
if (this.isRegionV4()) return false;
return this.api.globalEndpoint;
},
/**
* @api private
*/
endpointSuffix: function endpointSuffix() {
var suffix = '.amazonaws.com';
if (this.isRegionCN()) return suffix + '.cn';
else return suffix;
},
/**
* @api private
*/
isRegionCN: function isRegionCN() {
if (!this.config.region) return false;
return this.config.region.match(/^cn-/) ? true : false;
},
/**
* @api private
*/
isRegionV4: function isRegionV4() {
return this.isRegionCN();
},
/**
* @api private
*/
paginationConfig: function paginationConfig(operation, throwException) {

@@ -359,3 +445,2 @@ function fail(name) {

var svc = inherit(AWS.Service, features || {});
svc.Client = svc; // backward compatibility for Client class

@@ -388,10 +473,25 @@ if (typeof serviceIdentifier === 'string') {

function setApi(api) {
/* jshint camelcase:false */
if (api.type && api.api_version) {
svc.prototype.api = new Translator(api, {documentation: false});
} else {
svc.prototype.api = api;
}
}
if (typeof version === 'string') {
var apiFile = superclass.serviceIdentifier + '-' + version;
try {
svc.prototype.api = apiConfig || require('./services/api/' + apiFile);
} catch (err) {
throw AWS.util.error(err, {
message: 'Could not find API configuration ' + apiFile
});
if (apiConfig) {
setApi(apiConfig);
} else {
var file = superclass.serviceIdentifier + '-' + version;
var path = __dirname + '/../apis/' + file + '.json';
try {
var fs = require('fs');
setApi(JSON.parse(fs.readFileSync(path)));
} catch (err) {
throw AWS.util.error(err, {
message: 'Could not find API configuration ' + file
});
}
}

@@ -403,3 +503,3 @@ if (!superclass.services.hasOwnProperty(version)) {

} else {
svc.prototype.api = version;
setApi(version);
}

@@ -406,0 +506,0 @@

@@ -1,16 +0,1 @@

/**
* Copyright 2012-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You
* may not use this file except in compliance with the License. A copy of
* the License is located at
*
* http://aws.amazon.com/apache2.0/
*
* or in the "license" file accompanying this file. This file is
* distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
* ANY KIND, either express or implied. See the License for the specific
* language governing permissions and limitations under the License.
*/
/* This file is auto-generated. DO NOT EDIT. */

@@ -22,2 +7,3 @@

require('./services/cloudsearch');
require('./services/cloudtrail');
require('./services/cloudwatch');

@@ -36,2 +22,3 @@ require('./services/datapipeline');

require('./services/importexport');
require('./services/kinesis');
require('./services/opsworks');

@@ -38,0 +25,0 @@ require('./services/rds');

@@ -1,16 +0,1 @@

/**
* Copyright 2012-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You
* may not use this file except in compliance with the License. A copy of
* the License is located at
*
* http://aws.amazon.com/apache2.0/
*
* or in the "license" file accompanying this file. This file is
* distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
* ANY KIND, either express or implied. See the License for the specific
* language governing permissions and limitations under the License.
*/
var AWS = require('../core');

@@ -17,0 +2,0 @@

@@ -1,16 +0,1 @@

/**
* Copyright 2012-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You
* may not use this file except in compliance with the License. A copy of
* the License is located at
*
* http://aws.amazon.com/apache2.0/
*
* or in the "license" file accompanying this file. This file is
* distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
* ANY KIND, either express or implied. See the License for the specific
* language governing permissions and limitations under the License.
*/
var AWS = require('../core');

@@ -17,0 +2,0 @@

@@ -1,20 +0,5 @@

/**
* Copyright 2012-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You
* may not use this file except in compliance with the License. A copy of
* the License is located at
*
* http://aws.amazon.com/apache2.0/
*
* or in the "license" file accompanying this file. This file is
* distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
* ANY KIND, either express or implied. See the License for the specific
* language governing permissions and limitations under the License.
*/
var AWS = require('../core');
AWS.CloudFront = AWS.Service.defineService('cloudfront', ['2012-05-05', '2013-05-12', '2013-08-26*', '2013-09-27']);
AWS.CloudFront = AWS.Service.defineService('cloudfront', ['2012-05-05', '2013-05-12*', '2013-08-26*', '2013-09-27*', '2013-11-11*', '2013-11-22']);
module.exports = AWS.CloudFront;

@@ -1,16 +0,1 @@

/**
* Copyright 2012-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You
* may not use this file except in compliance with the License. A copy of
* the License is located at
*
* http://aws.amazon.com/apache2.0/
*
* or in the "license" file accompanying this file. This file is
* distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
* ANY KIND, either express or implied. See the License for the specific
* language governing permissions and limitations under the License.
*/
var AWS = require('../core');

@@ -17,0 +2,0 @@

@@ -1,16 +0,1 @@

/**
* Copyright 2012-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You
* may not use this file except in compliance with the License. A copy of
* the License is located at
*
* http://aws.amazon.com/apache2.0/
*
* or in the "license" file accompanying this file. This file is
* distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
* ANY KIND, either express or implied. See the License for the specific
* language governing permissions and limitations under the License.
*/
var AWS = require('../core');

@@ -17,0 +2,0 @@

@@ -1,16 +0,1 @@

/**
* Copyright 2012-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You
* may not use this file except in compliance with the License. A copy of
* the License is located at
*
* http://aws.amazon.com/apache2.0/
*
* or in the "license" file accompanying this file. This file is
* distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
* ANY KIND, either express or implied. See the License for the specific
* language governing permissions and limitations under the License.
*/
var AWS = require('../core');

@@ -17,0 +2,0 @@

@@ -1,16 +0,1 @@

/**
* Copyright 2012-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You
* may not use this file except in compliance with the License. A copy of
* the License is located at
*
* http://aws.amazon.com/apache2.0/
*
* or in the "license" file accompanying this file. This file is
* distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
* ANY KIND, either express or implied. See the License for the specific
* language governing permissions and limitations under the License.
*/
var AWS = require('../core');

@@ -17,0 +2,0 @@

@@ -1,16 +0,1 @@

/**
* Copyright 2012-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You
* may not use this file except in compliance with the License. A copy of
* the License is located at
*
* http://aws.amazon.com/apache2.0/
*
* or in the "license" file accompanying this file. This file is
* distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
* ANY KIND, either express or implied. See the License for the specific
* language governing permissions and limitations under the License.
*/
var AWS = require('../core');

@@ -17,0 +2,0 @@

@@ -1,19 +0,7 @@

/**
* Copyright 2012-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You
* may not use this file except in compliance with the License. A copy of
* the License is located at
*
* http://aws.amazon.com/apache2.0/
*
* or in the "license" file accompanying this file. This file is
* distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
* ANY KIND, either express or implied. See the License for the specific
* language governing permissions and limitations under the License.
*/
var AWS = require('../core');
AWS.EC2 = AWS.Service.defineService('ec2', ['2013-06-15*', '2013-07-15*', '2013-08-15*', '2013-10-01'], {
AWS.EC2 = AWS.Service.defineService('ec2', ['2013-06-15*', '2013-07-15*', '2013-08-15*', '2013-10-01*', '2013-10-15'], {
/**
* @api private
*/
setupRequestListeners: function setupRequestListeners(request) {

@@ -20,0 +8,0 @@ request.removeListener('extractError', AWS.EventListeners.Query.EXTRACT_ERROR);

@@ -1,16 +0,1 @@

/**
* Copyright 2012-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You
* may not use this file except in compliance with the License. A copy of
* the License is located at
*
* http://aws.amazon.com/apache2.0/
*
* or in the "license" file accompanying this file. This file is
* distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
* ANY KIND, either express or implied. See the License for the specific
* language governing permissions and limitations under the License.
*/
var AWS = require('../core');

@@ -17,0 +2,0 @@

@@ -1,16 +0,1 @@

/**
* Copyright 2012-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You
* may not use this file except in compliance with the License. A copy of
* the License is located at
*
* http://aws.amazon.com/apache2.0/
*
* or in the "license" file accompanying this file. This file is
* distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
* ANY KIND, either express or implied. See the License for the specific
* language governing permissions and limitations under the License.
*/
var AWS = require('../core');

@@ -17,0 +2,0 @@

@@ -1,16 +0,1 @@

/**
* Copyright 2012-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You
* may not use this file except in compliance with the License. A copy of
* the License is located at
*
* http://aws.amazon.com/apache2.0/
*
* or in the "license" file accompanying this file. This file is
* distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
* ANY KIND, either express or implied. See the License for the specific
* language governing permissions and limitations under the License.
*/
var AWS = require('../core');

@@ -17,0 +2,0 @@

@@ -1,16 +0,1 @@

/**
* Copyright 2012-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You
* may not use this file except in compliance with the License. A copy of
* the License is located at
*
* http://aws.amazon.com/apache2.0/
*
* or in the "license" file accompanying this file. This file is
* distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
* ANY KIND, either express or implied. See the License for the specific
* language governing permissions and limitations under the License.
*/
var AWS = require('../core');

@@ -17,0 +2,0 @@

@@ -1,16 +0,1 @@

/**
* Copyright 2012-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You
* may not use this file except in compliance with the License. A copy of
* the License is located at
*
* http://aws.amazon.com/apache2.0/
*
* or in the "license" file accompanying this file. This file is
* distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
* ANY KIND, either express or implied. See the License for the specific
* language governing permissions and limitations under the License.
*/
var AWS = require('../core');

@@ -17,0 +2,0 @@

@@ -1,16 +0,1 @@

/**
* Copyright 2012-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You
* may not use this file except in compliance with the License. A copy of
* the License is located at
*
* http://aws.amazon.com/apache2.0/
*
* or in the "license" file accompanying this file. This file is
* distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
* ANY KIND, either express or implied. See the License for the specific
* language governing permissions and limitations under the License.
*/
var AWS = require('../core');

@@ -72,3 +57,3 @@

computeChecksums: function computeChecksums(data) {
if (!(data instanceof Buffer)) data = new Buffer(data);
if (!AWS.util.Buffer.isBuffer(data)) data = new AWS.util.Buffer(data);

@@ -101,3 +86,3 @@ var mb = 1024 * 1024;

if (hashes[i+1]) {
var tmpHash = new Buffer(64);
var tmpHash = new AWS.util.Buffer(64);
tmpHash.write(hashes[i], 0, 32, 'binary');

@@ -104,0 +89,0 @@ tmpHash.write(hashes[i+1], 32, 32, 'binary');

@@ -1,16 +0,1 @@

/**
* Copyright 2012-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You
* may not use this file except in compliance with the License. A copy of
* the License is located at
*
* http://aws.amazon.com/apache2.0/
*
* or in the "license" file accompanying this file. This file is
* distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
* ANY KIND, either express or implied. See the License for the specific
* language governing permissions and limitations under the License.
*/
var AWS = require('../core');

@@ -17,0 +2,0 @@

@@ -1,16 +0,1 @@

/**
* Copyright 2012-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You
* may not use this file except in compliance with the License. A copy of
* the License is located at
*
* http://aws.amazon.com/apache2.0/
*
* or in the "license" file accompanying this file. This file is
* distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
* ANY KIND, either express or implied. See the License for the specific
* language governing permissions and limitations under the License.
*/
var AWS = require('../core');

@@ -17,0 +2,0 @@

@@ -1,16 +0,1 @@

/**
* Copyright 2012-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You
* may not use this file except in compliance with the License. A copy of
* the License is located at
*
* http://aws.amazon.com/apache2.0/
*
* or in the "license" file accompanying this file. This file is
* distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
* ANY KIND, either express or implied. See the License for the specific
* language governing permissions and limitations under the License.
*/
var AWS = require('../core');

@@ -17,0 +2,0 @@

@@ -1,20 +0,5 @@

/**
* Copyright 2012-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You
* may not use this file except in compliance with the License. A copy of
* the License is located at
*
* http://aws.amazon.com/apache2.0/
*
* or in the "license" file accompanying this file. This file is
* distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
* ANY KIND, either express or implied. See the License for the specific
* language governing permissions and limitations under the License.
*/
var AWS = require('../core');
AWS.RDS = AWS.Service.defineService('rds', ['2013-05-15', '2013-02-12', '2013-01-10']);
AWS.RDS = AWS.Service.defineService('rds', ['2013-01-10', '2013-02-12', '2013-05-15*', '2013-09-09']);
module.exports = AWS.RDS;

@@ -1,16 +0,1 @@

/**
* Copyright 2012-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You
* may not use this file except in compliance with the License. A copy of
* the License is located at
*
* http://aws.amazon.com/apache2.0/
*
* or in the "license" file accompanying this file. This file is
* distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
* ANY KIND, either express or implied. See the License for the specific
* language governing permissions and limitations under the License.
*/
var AWS = require('../core');

@@ -17,0 +2,0 @@

@@ -1,19 +0,4 @@

/**
* Copyright 2012-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You
* may not use this file except in compliance with the License. A copy of
* the License is located at
*
* http://aws.amazon.com/apache2.0/
*
* or in the "license" file accompanying this file. This file is
* distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
* ANY KIND, either express or implied. See the License for the specific
* language governing permissions and limitations under the License.
*/
var AWS = require('../core');
AWS.Route53 = AWS.Service.defineService('route53', ['2012-12-12'], {
AWS.Route53 = AWS.Service.defineService('route53', ['2013-04-01'], {
/**

@@ -20,0 +5,0 @@ * @api private

@@ -1,22 +0,3 @@

/**
* Copyright 2012-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You
* may not use this file except in compliance with the License. A copy of
* the License is located at
*
* http://aws.amazon.com/apache2.0/
*
* or in the "license" file accompanying this file. This file is
* distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
* ANY KIND, either express or implied. See the License for the specific
* language governing permissions and limitations under the License.
*/
var AWS = require('../core');
/* jshint -W079 */
var Buffer = require('buffer').Buffer;
/* jshint +W079 */
AWS.S3 = AWS.Service.defineService('s3', ['2006-03-01'], {

@@ -31,2 +12,5 @@ /**

/**
* @api private
*/
setupRequestListeners: function setupRequestListeners(request) {

@@ -36,2 +20,3 @@ request.addListener('build', this.addContentType);

request.addListener('build', this.computeContentMd5);
request.addListener('build', this.computeSha256);
request.removeListener('validate',

@@ -78,4 +63,6 @@ AWS.EventListeners.Core.VALIDATE_REGION);

httpRequest.headers['Content-Type'] = 'application/octet-stream';
if (AWS.util.isBrowser() && navigator.userAgent.match(/Firefox/)) {
var charset = '; charset=' + document.characterSet;
}
if (AWS.util.isBrowser() && navigator.userAgent.match(/Firefox/)) {
if (!httpRequest.headers['Content-Type'].match(/;/)) {
var charset = '; charset=UTF-8';
httpRequest.headers['Content-Type'] += charset;

@@ -111,3 +98,3 @@ }

// TODO: compute checksums for Stream objects
if (!Buffer.isBuffer(req.httpRequest.body) &&
if (!AWS.util.Buffer.isBuffer(req.httpRequest.body) &&
typeof req.httpRequest.body !== 'string') {

@@ -118,2 +105,8 @@ return false;

var rules = req.service.api.operations[req.operation].input.members;
// V4 signer uses SHA256 signatures so only compute MD5 if it is required
if (req.service.getSignerClass(req) === AWS.Signers.V4) {
if (rules.ContentMD5 && !rules.ContentMD5.required) return false;
}
if (rules.ContentMD5 && !req.params.ContentMD5) return true;

@@ -135,2 +128,12 @@ },

/**
* @api private
*/
computeSha256: function computeSha256(req) {
if (req.service.getSignerClass(req) === AWS.Signers.V4) {
req.httpRequest.headers['X-Amz-Content-Sha256'] =
AWS.util.crypto.sha256(req.httpRequest.body || '', 'hex');
}
},
/**
* Returns true if the bucket name should be left in the URI path for

@@ -258,3 +261,5 @@ * a request to S3. This function takes into account the current

} else if (this.config.region && this.config.region !== 'us-east-1') {
var hostname = 's3-' + this.config.region + '.amazonaws.com';
var sep = '-';
if (this.isRegionV4()) sep = '.';
var hostname = 's3' + sep + this.config.region + this.endpointSuffix();
this.endpoint = new AWS.Endpoint(hostname);

@@ -307,6 +312,5 @@ } else {

getSignedUrl: function getSignedUrl(operation, params, callback) {
params = AWS.util.copy(params || {});
var expires = params.Expires || 900;
delete params.Expires; // we can't validate this
var url = require('url');
var events = ['validate', 'build', 'sign'];
var request = this.makeRequest(operation, params);

@@ -319,4 +323,16 @@

delete request.httpRequest.headers['X-Amz-User-Agent'];
request.httpRequest.headers[expiresHeader] = parseInt(
AWS.util.date.unixTimestamp() + expires, 10).toString();
if (request.service.getSignerClass() === AWS.Signers.V4) {
if (expires > 604800) { // one week expiry is invalid
var message = 'getSignedUrl() does not support expiry time greater ' +
'than a week with SigV4 signing.';
throw AWS.util.error(new Error(), {
code: 'InvalidExpiryTime', message: message, retryable: false
});
}
request.httpRequest.headers[expiresHeader] = expires;
} else {
request.httpRequest.headers[expiresHeader] = parseInt(
AWS.util.date.unixTimestamp() + expires, 10).toString();
}
}

@@ -333,11 +349,20 @@

var auth = queryParams['Authorization'].split(':');
var auth = queryParams['Authorization'].split(' ');
if (auth[0] === 'AWS') {
auth = auth[1].split(':');
queryParams['AWSAccessKeyId'] = auth[0];
queryParams['Signature'] = auth[1];
} else if (auth[0] === 'AWS4-HMAC-SHA256') { // SigV4 signing
auth.shift();
var rest = auth.join(' ');
var signature = rest.match(/Signature=(.*?)(?:,|\s|\r?\n|$)/)[1];
queryParams['X-Amz-Signature'] = signature;
delete queryParams['Expires'];
}
delete queryParams['Authorization'];
delete queryParams['Host'];
queryParams['AWSAccessKeyId'] = auth[0].split(' ')[1];
queryParams['Signature'] = auth[1];
// build URL
var endpoint = request.httpRequest.endpoint;
var parsedUrl = url.parse(request.httpRequest.path);
var parsedUrl = AWS.util.urlParse(request.httpRequest.path);
var querystring = AWS.util.queryParamsToString(queryParams);

@@ -352,16 +377,16 @@ endpoint.pathname = parsedUrl.pathname;

request.removeListener('build', this.addContentType);
if (!params.Body) { // no Content-MD5 signing if body is not provided
request.removeAllListeners('afterBuild');
if (!params.Body) { // no Content-MD5/SHA-256 if body is not provided
request.removeListener('build', this.computeContentMd5);
request.removeListener('build', this.computeSha256);
}
if (callback) {
request.emitEvents(events, new AWS.Response(request), function (err) {
if (err) callback(err, null);
else callback(null, url.format(request.httpRequest.endpoint));
request.build(function() {
if (request.response.error) callback(request.response.error, null);
else callback(null, AWS.util.urlFormat(request.httpRequest.endpoint));
});
} else {
AWS.util.arrayEach(events, function (item) {
request.emitEvent(item, [request]);
});
return url.format(request.httpRequest.endpoint);
request.build();
return AWS.util.urlFormat(request.httpRequest.endpoint);
}

@@ -368,0 +393,0 @@ }

@@ -1,16 +0,1 @@

/**
* Copyright 2012-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You
* may not use this file except in compliance with the License. A copy of
* the License is located at
*
* http://aws.amazon.com/apache2.0/
*
* or in the "license" file accompanying this file. This file is
* distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
* ANY KIND, either express or implied. See the License for the specific
* language governing permissions and limitations under the License.
*/
var AWS = require('../core');

@@ -23,4 +8,2 @@

initialize: function initialize(options) {
options = options || {};
options.region = options.region || 'us-east-1';
AWS.Service.prototype.initialize.call(this, options);

@@ -27,0 +10,0 @@ },

@@ -1,16 +0,1 @@

/**
* Copyright 2012-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You
* may not use this file except in compliance with the License. A copy of
* the License is located at
*
* http://aws.amazon.com/apache2.0/
*
* or in the "license" file accompanying this file. This file is
* distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
* ANY KIND, either express or implied. See the License for the specific
* language governing permissions and limitations under the License.
*/
var AWS = require('../core');

@@ -17,0 +2,0 @@

@@ -1,16 +0,1 @@

/**
* Copyright 2012-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You
* may not use this file except in compliance with the License. A copy of
* the License is located at
*
* http://aws.amazon.com/apache2.0/
*
* or in the "license" file accompanying this file. This file is
* distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
* ANY KIND, either express or implied. See the License for the specific
* language governing permissions and limitations under the License.
*/
var AWS = require('../core');

@@ -17,0 +2,0 @@

@@ -1,16 +0,1 @@

/**
* Copyright 2012-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You
* may not use this file except in compliance with the License. A copy of
* the License is located at
*
* http://aws.amazon.com/apache2.0/
*
* or in the "license" file accompanying this file. This file is
* distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
* ANY KIND, either express or implied. See the License for the specific
* language governing permissions and limitations under the License.
*/
var AWS = require('../core');

@@ -17,0 +2,0 @@

@@ -1,16 +0,1 @@

/**
* Copyright 2012-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You
* may not use this file except in compliance with the License. A copy of
* the License is located at
*
* http://aws.amazon.com/apache2.0/
*
* or in the "license" file accompanying this file. This file is
* distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
* ANY KIND, either express or implied. See the License for the specific
* language governing permissions and limitations under the License.
*/
var AWS = require('../core');

@@ -17,0 +2,0 @@

@@ -1,20 +0,5 @@

/**
* Copyright 2012-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You
* may not use this file except in compliance with the License. A copy of
* the License is located at
*
* http://aws.amazon.com/apache2.0/
*
* or in the "license" file accompanying this file. This file is
* distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
* ANY KIND, either express or implied. See the License for the specific
* language governing permissions and limitations under the License.
*/
var AWS = require('../core');
AWS.StorageGateway = AWS.Service.defineService('storagegateway', ['2012-06-30']);
AWS.StorageGateway = AWS.Service.defineService('storagegateway', ['2013-06-30', '2012-06-30']);
module.exports = AWS.StorageGateway;

@@ -1,16 +0,1 @@

/**
* Copyright 2012-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You
* may not use this file except in compliance with the License. A copy of
* the License is located at
*
* http://aws.amazon.com/apache2.0/
*
* or in the "license" file accompanying this file. This file is
* distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
* ANY KIND, either express or implied. See the License for the specific
* language governing permissions and limitations under the License.
*/
var AWS = require('../core');

@@ -57,23 +42,9 @@

AWS.STS.prototype.assumeRoleWithWebIdentity = function assumeRoleWithWebIdentity(params, callback) {
if (typeof params === 'function') {
callback = params;
params = {};
}
return this.makeUnauthenticatedRequest('assumeRoleWithWebIdentity', params, callback);
};
var request = this.makeRequest('assumeRoleWithWebIdentity', params);
request.removeListener('validate', AWS.EventListeners.Core.VALIDATE_CREDENTIALS);
request.removeListener('sign', AWS.EventListeners.Core.SIGN);
request.addListener('build', function convertToGET(request) {
request.httpRequest.method = 'GET';
request.httpRequest.path = '/?' + request.httpRequest.body;
request.httpRequest.body = '';
// don't need these headers on a GET request
delete request.httpRequest.headers['Content-Length'];
delete request.httpRequest.headers['Content-Type'];
});
return callback ? request.send(callback) : request;
AWS.STS.prototype.assumeRoleWithSAML = function assumeRoleWithSAML(params, callback) {
return this.makeUnauthenticatedRequest('assumeRoleWithSAML', params, callback);
};
module.exports = AWS.STS;

@@ -1,16 +0,1 @@

/**
* Copyright 2012-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You
* may not use this file except in compliance with the License. A copy of
* the License is located at
*
* http://aws.amazon.com/apache2.0/
*
* or in the "license" file accompanying this file. This file is
* distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
* ANY KIND, either express or implied. See the License for the specific
* language governing permissions and limitations under the License.
*/
var AWS = require('../core');

@@ -17,0 +2,0 @@

@@ -1,16 +0,1 @@

/**
* Copyright 2012-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You
* may not use this file except in compliance with the License. A copy of
* the License is located at
*
* http://aws.amazon.com/apache2.0/
*
* or in the "license" file accompanying this file. This file is
* distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
* ANY KIND, either express or implied. See the License for the specific
* language governing permissions and limitations under the License.
*/
var AWS = require('../core');

@@ -17,0 +2,0 @@ require('./v3');

@@ -1,16 +0,1 @@

/**
* Copyright 2012-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You
* may not use this file except in compliance with the License. A copy of
* the License is located at
*
* http://aws.amazon.com/apache2.0/
*
* or in the "license" file accompanying this file. This file is
* distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
* ANY KIND, either express or implied. See the License for the specific
* language governing permissions and limitations under the License.
*/
var AWS = require('../core');

@@ -17,0 +2,0 @@ var inherit = AWS.util.inherit;

@@ -1,16 +0,1 @@

/**
* Copyright 2012-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You
* may not use this file except in compliance with the License. A copy of
* the License is located at
*
* http://aws.amazon.com/apache2.0/
*
* or in the "license" file accompanying this file. This file is
* distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
* ANY KIND, either express or implied. See the License for the specific
* language governing permissions and limitations under the License.
*/
var AWS = require('../core');

@@ -38,2 +23,3 @@ var inherit = AWS.util.inherit;

'requestPayment': 1,
'restore': 1,
'tagging': 1,

@@ -40,0 +26,0 @@ 'torrent': 1,

@@ -1,16 +0,1 @@

/**
* Copyright 2012-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You
* may not use this file except in compliance with the License. A copy of
* the License is located at
*
* http://aws.amazon.com/apache2.0/
*
* or in the "license" file accompanying this file. This file is
* distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
* ANY KIND, either express or implied. See the License for the specific
* language governing permissions and limitations under the License.
*/
var AWS = require('../core');

@@ -17,0 +2,0 @@ var inherit = AWS.util.inherit;

@@ -1,16 +0,1 @@

/**
* Copyright 2012-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You
* may not use this file except in compliance with the License. A copy of
* the License is located at
*
* http://aws.amazon.com/apache2.0/
*
* or in the "license" file accompanying this file. This file is
* distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
* ANY KIND, either express or implied. See the License for the specific
* language governing permissions and limitations under the License.
*/
var AWS = require('../core');

@@ -17,0 +2,0 @@ var inherit = AWS.util.inherit;

@@ -1,16 +0,1 @@

/**
* Copyright 2012-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You
* may not use this file except in compliance with the License. A copy of
* the License is located at
*
* http://aws.amazon.com/apache2.0/
*
* or in the "license" file accompanying this file. This file is
* distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
* ANY KIND, either express or implied. See the License for the specific
* language governing permissions and limitations under the License.
*/
var AWS = require('../core');

@@ -17,0 +2,0 @@ var inherit = AWS.util.inherit;

@@ -1,16 +0,1 @@

/**
* Copyright 2012-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You
* may not use this file except in compliance with the License. A copy of
* the License is located at
*
* http://aws.amazon.com/apache2.0/
*
* or in the "license" file accompanying this file. This file is
* distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
* ANY KIND, either express or implied. See the License for the specific
* language governing permissions and limitations under the License.
*/
var AWS = require('../core');

@@ -36,2 +21,3 @@ var inherit = AWS.util.inherit;

this.addHeaders(credentials, datetime);
this.updateBody(credentials);
this.request.headers['Authorization'] =

@@ -48,2 +34,15 @@ this.authorization(credentials, datetime);

updateBody: function updateBody(credentials) {
if (this.request.params) {
this.request.params.AWSAccessKeyId = credentials.accessKeyId;
if (credentials.sessionToken) {
this.request.params.SecurityToken = credentials.sessionToken;
}
this.request.body = AWS.util.queryParamsToString(this.request.params);
this.request.headers['Content-Length'] = this.request.body.length;
}
},
authorization: function authorization(credentials, datetime) {

@@ -97,3 +96,3 @@ var parts = [];

parts.push(this.signedHeaders());
parts.push(this.hexEncodedHash(this.request.body));
parts.push(this.hexEncodedBodyHash());
return parts.join('\n');

@@ -112,6 +111,5 @@ },

AWS.util.arrayEach.call(this, headers, function (item) {
if (item[0] !== 'Authorization' &&
item[0] !== 'User-Agent' && item[0] !== 'X-Amz-User-Agent' &&
item[0] !== 'Content-Type') {
parts.push(item[0].toLowerCase() + ':' +
var key = item[0].toLowerCase();
if (this.isSignableHeader(key)) {
parts.push(key + ':' +
this.canonicalHeaderValues(item[1].toString()));

@@ -131,4 +129,3 @@ }

key = key.toLowerCase();
if (key !== 'authorization' && key !== 'user-agent' &&
key !== 'x-amz-user-agent' && key !== 'content-type') keys.push(key);
if (this.isSignableHeader(key)) keys.push(key);
});

@@ -149,2 +146,17 @@ return keys.sort().join(';');

return AWS.util.crypto.sha256(string, 'hex');
},
hexEncodedBodyHash: function hexEncodedBodyHash() {
if (this.request.headers['X-Amz-Content-Sha256']) {
return this.request.headers['X-Amz-Content-Sha256'];
} else {
return this.hexEncodedHash(this.request.body || '');
}
},
unsignableHeaders: ['authorization', 'content-type', 'user-agent',
'x-amz-user-agent', 'x-amz-content-sha256'],
isSignableHeader: function isSignableHeader(key) {
return this.unsignableHeaders.indexOf(key) < 0;
}

@@ -151,0 +163,0 @@

@@ -1,16 +0,1 @@

/**
* Copyright 2012-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You
* may not use this file except in compliance with the License. A copy of
* the License is located at
*
* http://aws.amazon.com/apache2.0/
*
* or in the "license" file accompanying this file. This file is
* distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
* ANY KIND, either express or implied. See the License for the specific
* language governing permissions and limitations under the License.
*/
/*global escape:true */

@@ -29,3 +14,3 @@

* @!attribute abort
* Return this value from an iterator function ({each} or {arrayEach})
* Return this value from an iterator function {each} or {arrayEach}
* to break out of the iteration.

@@ -58,2 +43,5 @@ * @example Breaking out of an iterator function

isNode: function isNode() { return !AWS.util.isBrowser(); },
nodeRequire: function nodeRequire(module) {
if (AWS.util.isNode()) return require(module);
},

@@ -85,2 +73,6 @@ uriEscape: function uriEscape(string) {

urlFormat: function urlFormat(url) {
return require('url').format(url);
},
queryParamsToString: function queryParamsToString(params) {

@@ -125,5 +117,5 @@ var items = [];

Buffer: Buffer,
buffer: {
Buffer: Buffer,
/**

@@ -169,2 +161,10 @@ * Concatenates a list of Buffer objects.

}
},
upperFirst: function upperFirst(string) {
return string[0].toUpperCase() + string.substr(1);
},
lowerFirst: function lowerFirst(string) {
return string[0].toLowerCase() + string.substr(1);
}

@@ -183,3 +183,3 @@ },

AWS.util.arrayEach.call(this, tokens, function (token) {
var match = token.match('^(.+?)(?:\\[(-?\\d+|\\*)\\])?$');
var match = token.match('^(.+?)(?:\\[(-?\\d+|\\*|)\\])?$');
var newObjects = [];

@@ -198,7 +198,7 @@ AWS.util.arrayEach.call(this, objects, function (obj) {

// handle indexing (token[0], token[-1])
if (match[2]) {
if (match[2] !== undefined) {
newObjects = [];
AWS.util.arrayEach.call(this, objects, function (obj) {
if (Array.isArray(obj)) {
if (match[2] === '*') {
if (match[2] === '*' || match[2] === '') {
newObjects = newObjects.concat(obj);

@@ -472,2 +472,9 @@ } else {

error: function error(err, options) {
var originalError = null;
if (typeof err.message === 'string' && err.message !== '') {
if (typeof options === 'string' || (options && options.message)) {
originalError = AWS.util.copy(err);
originalError.message = err.message;
}
}
err.message = err.message || null;

@@ -481,3 +488,12 @@

err.name = err.code || 'Error';
if (typeof Object.defineProperty === 'function') {
Object.defineProperty(err, 'name', {writable: true, enumerable: false});
Object.defineProperty(err, 'message', {enumerable: true});
}
err.name = err.name || err.code || 'Error';
err.time = new Date();
if (originalError) err.originalError = originalError;
return err;

@@ -484,0 +500,0 @@ },

@@ -1,16 +0,1 @@

/**
* Copyright 2012-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You
* may not use this file except in compliance with the License. A copy of
* the License is located at
*
* http://aws.amazon.com/apache2.0/
*
* or in the "license" file accompanying this file. This file is
* distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
* ANY KIND, either express or implied. See the License for the specific
* language governing permissions and limitations under the License.
*/
var AWS = require('../core');

@@ -40,3 +25,2 @@ var builder = require('xmlbuilder');

serializeStructure: function serializeStructure(rules, params, xml) {
AWS.util.each.call(this, rules || {}, function (memberName, memberRules) {

@@ -69,2 +53,4 @@ var value = params[memberName];

serializeMember: function serializeMember(memberName, rules, params, xml) {
if (params === null || params === undefined) return;
var name = memberName;

@@ -71,0 +57,0 @@ if (rules.type === 'structure') {

@@ -1,16 +0,1 @@

/**
* Copyright 2012-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You
* may not use this file except in compliance with the License. A copy of
* the License is located at
*
* http://aws.amazon.com/apache2.0/
*
* or in the "license" file accompanying this file. This file is
* distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
* ANY KIND, either express or implied. See the License for the specific
* language governing permissions and limitations under the License.
*/
var AWS = require('../core');

@@ -17,0 +2,0 @@ var inherit = AWS.util.inherit;

@@ -1,2 +0,2 @@

Copyright 2012-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
Copyright 2012-2014 Amazon.com, Inc. or its affiliates. All Rights Reserved.

@@ -3,0 +3,0 @@ Licensed under the Apache License, Version 2.0 (the "License"). You

{
"name": "aws-sdk",
"description": "AWS SDK for JavaScript",
"version": "2.0.0-rc1",
"version": "2.0.0-rc10",
"author": {

@@ -16,12 +16,13 @@ "name":"Amazon Web Services",

"devDependencies": {
"repl.history": "latest",
"jasmine-node": "latest",
"semver": "latest",
"coffee-script": "latest",
"jshint": "latest",
"cucumber": "latest"
"repl.history": "",
"jasmine-node": "",
"semver": "",
"coffee-script": "1.6.3",
"jshint": "",
"cucumber": "",
"coffeeify": ""
},
"dependencies": {
"xml2js": "0.2.4",
"xmlbuilder": "latest"
"xmlbuilder": "0.4.2"
},

@@ -28,0 +29,0 @@ "main": "lib/aws.js",

@@ -15,3 +15,3 @@ # AWS SDK for JavaScript [![Version](https://badge.fury.io/js/aws-sdk.png)](http://badge.fury.io/js/aws-sdk) [![Build Status](https://travis-ci.org/aws/aws-sdk-js.png?branch=master)](https://travis-ci.org/aws/aws-sdk-js)

<script src="https://sdk.amazonaws.com/js/aws-sdk-2.0.0-rc1.min.js"></script>
<script src="https://sdk.amazonaws.com/js/aws-sdk-2.0.0-rc10.min.js"></script>

@@ -36,2 +36,11 @@ ### In Node.js

<p class="note"><strong>Note</strong>:
Although all services are supported in the browser version of the SDK,
not all of the services are available in the default hosted build (using the
script tag provided above). A list of services in the hosted build are provided
in the "<a href="http://docs.aws.amazon.com/AWSJavaScriptSDK/guide/browser-services.html">Working With Services</a>"
section of the browser SDK guide, including instructions on how to build a
custom version of the SDK with extra services.
</p>
The SDK currently supports the following services:

@@ -46,5 +55,4 @@

<tbody>
<tr><td rowspan="3">Amazon CloudFront</td><td rowspan="3">AWS.CloudFront</td><td>2012-05-05</td></tr>
<tr><td>2013-05-12</td></tr>
<tr><td>2013-09-27</td></tr>
<tr><td rowspan="2">Amazon CloudFront</td><td rowspan="2">AWS.CloudFront</td><td>2012-05-05</td></tr>
<tr><td>2013-11-11</td></tr>
<tr><td>Amazon CloudSearch</td><td>AWS.CloudSearch</td><td>2011-02-01</td></tr>

@@ -54,3 +62,3 @@ <tr><td>Amazon CloudWatch</td><td>AWS.CloudWatch</td><td>2010-08-01</td></tr>

<tr><td>2012-08-10</td></tr>
<tr><td>Amazon Elastic Compute Cloud</td><td>AWS.EC2</td><td>2013-10-01</td></tr>
<tr><td>Amazon Elastic Compute Cloud</td><td>AWS.EC2</td><td>2013-10-15</td></tr>
<tr><td>Amazon Elastic MapReduce</td><td>AWS.EMR</td><td>2009-03-31</td></tr>

@@ -60,7 +68,8 @@ <tr><td>Amazon Elastic Transcoder</td><td>AWS.ElasticTranscoder</td><td>2012-09-25</td></tr>

<tr><td>Amazon Glacier</td><td>AWS.Glacier</td><td>2012-06-01</td></tr>
<tr><td>Amazon Kinesis</td><td>AWS.Kinesis</td><td>2013-12-02</td></tr>
<tr><td>Amazon Redshift</td><td>AWS.Redshift</td><td>2012-12-01</td></tr>
<tr><td rowspan="3">Amazon Relational Database Service</td><td rowspan="3">AWS.RDS</td><td>2013-01-10</td></tr>
<tr><td>2013-02-12</td></tr>
<tr><td>2013-05-15</td></tr>
<tr><td>Amazon Route 53</td><td>AWS.Route53</td><td>2012-12-12</td></tr>
<tr><td>2013-09-09</td></tr>
<tr><td>Amazon Route 53</td><td>AWS.Route53</td><td>2013-04-01</td></tr>
<tr><td>Amazon Simple Email Service</td><td>AWS.SES</td><td>2010-12-01</td></tr>

@@ -74,2 +83,3 @@ <tr><td>Amazon Simple Notification Service</td><td>AWS.SNS</td><td>2010-03-31</td></tr>

<tr><td>AWS CloudFormation</td><td>AWS.CloudFormation</td><td>2010-05-15</td></tr>
<tr><td>AWS CloudTrail</td><td>AWS.CloudTrail</td><td>2013-11-01</td></tr>
<tr><td>AWS Data Pipeline</td><td>AWS.DataPipeline</td><td>2012-10-29</td></tr>

@@ -82,3 +92,4 @@ <tr><td>AWS Direct Connect</td><td>AWS.DirectConnect</td><td>2012-10-25</td></tr>

<tr><td>AWS Security Token Service</td><td>AWS.STS</td><td>2011-06-15</td></tr>
<tr><td>AWS Storage Gateway</td><td>AWS.StorageGateway</td><td>2012-06-30</td></tr>
<tr><td rowspan="2">AWS Storage Gateway</td><td rowspan="2">AWS.StorageGateway</td><td>2012-06-30</td></tr>
<tr><td>2013-06-30</td></tr>
<tr><td>AWS Support</td><td>AWS.Support</td><td>2013-04-15</td></tr>

@@ -95,3 +106,3 @@ <tr><td>Elastic Load Balancing</td><td>AWS.ELB</td><td>2012-06-01</td></tr>

```no-highlight
Copyright 2012. Amazon Web Services, Inc. All Rights Reserved.
Copyright 2012-2014. Amazon Web Services, Inc. All Rights Reserved.

@@ -98,0 +109,0 @@ Licensed under the Apache License, Version 2.0 (the "License");

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc