Socket
Socket
Sign inDemoInstall

aws-sdk

Package Overview
Dependencies
3
Maintainers
1
Versions
1912
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.9.9-pre.10 to 1.0.0

doc-src/guide/Introduction.md

67

doc-src/guide/Configuring.md

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

# @title Configuring
# @title Configuring the SDK
# Configuration Guide
# Configuring the SDK

@@ -21,7 +21,10 @@ ## The Configuration Object

* `accessKeyId`, `secretAccessKey`, `sessionToken` — for credential management
* `region` — to set the region for requests
* `sslEnabled` — whether SSL is enabled or not
* `maxRetries` — to control the number of retries for a request
1. `accessKeyId`, `secretAccessKey`, `sessionToken` — for credential management
2. `region` — to set the region for requests
3. `sslEnabled` — whether SSL is enabled or not
4. `maxRetries` — to control the number of retries for a request
More configuration settings can be found in the
[API reference documentation](http://docs.aws.amazon.com/AWSJavaScriptSDK/latest/frames.html).
The only things you *need* to set in order to use the SDK are credentials and

@@ -118,2 +121,52 @@ the region value. Let's discuss how to do that.

### Locking API Versions
<p class="note">For more information on API version locking in the SDK, see the
{file:Services.md} section
</p>
You can globally configure a set of API versions to use for each service by
specifying the `apiVersions` parameter in `AWS.config`. For example,
you can choose to set specific versions of the DynamoDB and EC2 services,
while selecting the "latest" version of Redshift:
```js
AWS.config.apiVersions = {
dynamodb: '2011-12-05',
ec2: '2013-02-01',
redshift: 'latest'
}
```
Note that by default, the SDK will use the "latest" available API version
when constructing a service.
You can also lock all services at a specific point in time by using a "fuzzy
version":
```js
// Try to use latest available APIs before this date
AWS.config.apiVersion = '2012-05-04';
```
### Configuring a Proxy
If you cannot connect to the internet directly, the SDK supports the use of
HTTP or HTTPS proxies through global or per-service configuration options. To
set a proxy, pass the `proxy` option to the `httpOptions` setting of your
config object. This is how you could set a global proxy:
```js
AWS.config.update({
httpOptions: {
proxy: 'http://localhost:8080'
}
});
var s3 = new AWS.S3();
s3.getObject({Bucket: 'bucket', Key: 'key'}, function (err, data) {
console.log(err, data);
});
```
## Service-Specific Configuration

@@ -141,3 +194,3 @@

configuration data, or recreated using the following command (assuming an
existing s3 service object):
existing `s3` service object):

@@ -144,0 +197,0 @@ ```js

43

doc-src/guide/Examples.md

@@ -106,3 +106,4 @@ # Examples

<p class="note"><em>Note: this example assumes you have already created a vault
named "YOUR_VAULT_NAME".</em></p>
named "YOUR_VAULT_NAME".</em>
</p>

@@ -127,4 +128,6 @@ The following example will upload a single Buffer object as an entire archive.

<p class="note"><em>Note: this example assumes you have already created a vault
named "YOUR_VAULT_NAME".</em></p>
<p class="note">
<em>Note: this example assumes you have already created a vault
named "YOUR_VAULT_NAME".</em>
</p>

@@ -194,35 +197,1 @@ The following example will create a multi-part upload out of 1MB chunks of a

```
## Using Proxies
### Setting a Global Proxy
If you cannot connect to the internet directly, the SDK supports the use of
HTTP or HTTPS proxies through global or per-service configuration options. To
set a proxy, pass the `proxy` option to the `httpOptions` setting of your
config object. This is how you could set a global proxy:
```js
AWS.config.update({
httpOptions: {
proxy: 'http://localhost:8080'
}
});
var s3 = new AWS.S3();
s3.getObject({Bucket: 'bucket', Key: 'key'}, function (err, data) {
console.log(err, data);
});
```
### Setting a Per-Service Proxy
If you want to use a proxy on a per-service basis, you can also pass this
same configuration option to the service constructor:
```js
var s3 = new AWS.S3({httpOptions: {proxy: 'http://localhost:8080'}});
s3.getObject({Bucket: 'bucket', Key: 'key'}, function (err, data) {
console.log(err, data);
});
```

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

# @title Installing
# @title Installing the SDK
# Installing
# Installing the SDK

@@ -8,4 +8,4 @@ ## NPM Installation

The preferred way to install the AWS SDK for Node.js is to use the
[npm](http://npmjs.org) package manager for Node.js. Simply type the following
into a terminal window:
[npm](http://npmjs.org) package manager for Node.js. To install the SDK,
simply type the following into a terminal window:

@@ -25,2 +25,32 @@ ```sh

You should now be ready to configure and use the SDK.
Here is a quick example that makes some requests against Amazon S3 with the SDK:
```js
// Load the AWS SDK for Node.js
var AWS = require('aws-sdk');
/**
* Don't hard-code your credentials!
* Load them from disk or your environment instead.
*/
// AWS.config.update({accessKeyId: 'AKID', secretAccessKey: 'SECRET'});
// Instead, do this:
AWS.config.loadFromPath('./path/to/credentials.json');
// Set your region for future requests.
AWS.config.update({region: 'us-east-1'});
// Create a bucket using bound parameters and put something in it.
var s3bucket = new AWS.S3({params: {Bucket: 'myBucket'}});
s3bucket.createBucket(function() {
var data = {Key: 'myKey', Body: 'Hello!'};
s3bucket.putObject(data, function(err, data) {
if (err) {
console.log("Error uploading data: ", err);
} else {
console.log("Successfully uploaded data to myBucket/myKey");
}
});
});
```

@@ -5,2 +5,9 @@ # @title Making Requests

A "request" to an AWS service includes the full request and response lifecycle
of a call to an operation on a service object, including any retries that are
transparently attempted on your behalf. A request is encapsulated in the SDK by
the `AWS.Request` object. The semantics of a request are described below,
specifically, the support for callbacks, events, and streaming of raw HTTP
response data.
## Asynchronous Callbacks

@@ -152,4 +159,8 @@

#### `on('success', function(response) { ... })`
#### Event: 'success'
```js
req.on('success', function(response) { ... });
```
This event triggers when a successful response

@@ -177,4 +188,8 @@ from the server is returned. The response contains a `.data` field

#### `on('error', function(error, response) { ... })`
#### Event: 'error'
```js
req.on('error', function(error, response) { ... });
```
The `error` event works similarly to the `success` event, except that it

@@ -201,4 +216,8 @@ triggers in the case of a request failure. In this case, `response.data`

#### `on('complete', function(response) { ... })`
#### Event: 'complete'
```js
req.on('complete', function(response) { ... });
```
The `complete` event triggers a callback in any final state of a request, i.e.,

@@ -221,4 +240,8 @@ both `success` and `error`. Use this callback to handle any request cleanup

#### `on('httpData', function(chunk, response) { ... })`
#### Event: 'httpData'
```js
req.on('httpData', function(chunk, response) { ... });
```
<p class="note">If you register a <code>httpData</code> callback,

@@ -262,1 +285,31 @@ <code>response.data</code> will still contain serialized output

depending on whether the request succeeded or not.
## Streaming Requests
It is possible to stream a request directly to a Node.js Stream object by
calling the `createReadStream()` method on a request. This returns a wrapper
to the raw HTTP stream used to manage the request, and this data can be piped
into any other Node.js stream. This is mostly useful for service operations
that return raw data in the payload, like Amazon S3's `getObject` operation,
which can be used to stream data directly into a file with this functionality:
```js
var s3 = new AWS.S3();
var params = {Bucket: 'myBucket', Key: 'myImageFile.jpg'};
var file = require('fs').createWriteStream('/path/to/file.jpg');
s3.getObject(params).createReadStream().pipe(file);
```
The stream object can be used interchangeably as any other Node.js readable
Stream object.
### Limitations of Streaming
When streaming data from a request using `createReadStream()`, only the raw
HTTP data will be returned (the SDK will not do any post-processing on the
data). Additionally, if the request initially succeeds, retry logic will be
disabled for the rest of the response due to Node.js inability to rewind most
streams. This means that in the event of a socket failure in the middle of a
connection, the SDK will not attempt to retry and send more data to the stream.
It will be your responsibility to manage this logic in your library or
application.

@@ -1,9 +0,15 @@

# @title Services
# @title Working with Services
# Services
# Working with Services
## Supported Services
Here's the list of supported service objects:
The SDK currently supports all available AWS services. Each service object
in the SDK currently provides low-level access to every API call in the
respective AWS service. The full list of methods and their parameters are
documented in the complete API reference documentation (linked from each
service name in the list below).
The supported services are:
* [AWS.AutoScaling](http://docs.aws.amazon.com/AWSJavaScriptSDK/latest/frames.html#!http%3A//docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/AutoScaling_20110101.html)

@@ -40,6 +46,3 @@ * [AWS.CloudFormation](http://docs.aws.amazon.com/AWSJavaScriptSDK/latest/frames.html#!http%3A//docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/CloudFormation_20100515.html)

Each service object in the SDK currently provides low-level access to every
API call in the respective AWS service. The full list of methods and their
parameters are documented in the complete API reference (linked from each
service name in the above list).
<div class="clear"></div>

@@ -55,3 +58,3 @@ ## Constructing a Service

```js
var ec2 = new EC2({region: 'us-west-2'});
var ec2 = new AWS.EC2({region: 'us-west-2'});
```

@@ -61,4 +64,70 @@

## Passing Arguments to a Service Method
## Locking API Versions
Services released by AWS use API versions to keep track of API compatibility.
API versions in AWS services can be identified by a `YYYY-mm-dd` formatted
date string, i.e., 2006-03-01 for Amazon S3. It is recommended to lock into
an API version for a service if you are relying on it for production code.
This way, you can isolate yourself from service changes in updates of the
SDK.
In order to lock into an API version of a given service, simply pass the
`apiVersion` parameter when constructing the object, for example:
```js
var dynamodb = new AWS.DynamoDB({apiVersion: '2011-12-05'});
```
Note that versions can also be locked globally by specifying the `apiVersion`
or `apiVersions` global configuration parameters. This is documented with
more detail in the {file:Configuring.md} file.
### Using the Latest Version
By default, the SDK will select the **latest** available service API version
when constructing a service object (unless overridden globally). You can
also force the latest API version to be used by passing the "latest" value
as the `apiVersion` parameter like so:
```js
var ec2 = new AWS.EC2({apiVersion: 'latest'});
```
### Fuzzy Versions and Date Locking
Since AWS has many services with many different API versions, the SDK allows
for the specification of "fuzzy versions" instead of exact API version
matches. This allows you to specify any date after the API version date,
and the SDK will look for the *last* available matching API version when
loading the service object. For instance, you can also load the 2011-12-05
DynamoDB API by using the following code:
```js
var dynamodb = new AWS.DynamoDB({apiVersion: '2012-04-04'});
```
Note that 2012-04-04 is later than the first API release (2011-12-05)
but earlier than the next revision of the API (2012-08-10), so the *first*
revision will be used.
You can also use this strategy to globally lock your application to a point
in time. For instance, if you begin developing your application on 2012-07-05,
you can add the following global `apiVersion` lock value:
```js
AWS.config.apiVersion = '2012-07-05';
```
This will allow *all* created service objects to use the latest available
API versions at the specified lock time. You can override any API versions
if you need a newer version, or if the service had not yet been released,
by adding the `apiVersion` parameter to the constructor call as normal:
```js
// Amazon Redshift was not yet released in 2012-07-05
var redshift = new AWS.Redshift({apiVersion: '2012-12-01'});
```
## Passing Parameters to a Service Operation
When calling a method to a service, you should pass parameters in as

@@ -75,1 +144,19 @@ option values, similar to the way configuration is passed.

in each service page in the complete API reference documentation.
## Bound Parameters
Parameters can be automatically passed to service operations by binding them
directly when constructing the service object. To do this, pass the `params`
parameter to your constructed service with the map of default parameter
values like so:
```js
var s3bucket = new AWS.S3({ params: {Bucket: 'myBucket'} });
```
The `s3bucket` object will now represent an S3 service object bound to a bucket
named 'myBucket'. Any operation that takes the `Bucket` parameter will now
have it auto-filled with this value. This value can be overridden by passing
a new value in the service operation. Additionally, operations that do not
require a `Bucket` parameter will automatically ignore this bound parameter,
so the `s3bucket` object can still be used to call `listBuckets`, for instance.

@@ -28,3 +28,3 @@ /**

*/
VERSION: 'v0.9.9-pre.10',
VERSION: 'v1.0.0',

@@ -31,0 +31,0 @@ /**

@@ -311,2 +311,3 @@ /**

}
stream.push('');
};

@@ -313,0 +314,0 @@

@@ -401,2 +401,15 @@ /**

},
validationWarnings: {
type: 'list',
members: {
type: 'structure',
members: {
id: {
},
warnings: {
type: 'list'
}
}
}
},
errored: {

@@ -541,4 +554,3 @@ type: 'boolean'

},
errorCode: {
type: 'integer'
errorId: {
},

@@ -612,2 +624,15 @@ errorMessage: {

},
validationWarnings: {
type: 'list',
members: {
type: 'structure',
members: {
id: {
},
warnings: {
type: 'list'
}
}
}
},
errored: {

@@ -614,0 +639,0 @@ type: 'boolean'

@@ -18,3 +18,3 @@ /**

format: 'json',
apiVersion: '2012-12-15',
apiVersion: '2013-04-15',
endpointPrefix: 'support',

@@ -21,0 +21,0 @@ jsonVersion: '1.1',

{
"name": "aws-sdk",
"description": "AWS SDK for JavaScript",
"version": "v0.9.9-pre.10",
"version": "v1.0.0",
"author": {

@@ -6,0 +6,0 @@ "name":"Amazon Web Services",

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

# @title Upgrading Notes
# Upgrading Notes

@@ -2,0 +4,0 @@

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

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc