aws/aws-sdk-js — pull request #90 by lsegal (2013-03-28 23:56:52+00:00)
Title: Add support for apiVersion

This change allows users to construct services locked at a specific API version. To lock to a version, set the `apiVersion` or `apiVersions` configuration option. This can be set globally or locally per-service (see examples below). The `apiConfig` can also be passed to the client class to create one-off clients based on custom API configurations.

Version strings can be "fuzzy", in other words, they can represent a date in time (in `YYYY-MM-DD` format) rather than a specific service API version. In this case, the SDK will search for the *latest* matching API that is *before* the given date. The version string can also accept the special value 'latest', which uses the latest available API version for a matching service.

This change also makes API loading lazy, which improves load time of the SDK by ~100ms on my dev machine.

Example: Specifying an API version at service instantiation

```js
var ec2 = new AWS.EC2({apiVersion: '2009-05-05'}); // use older API version
```

Example: Creating a manifest of API versions

```js
AWS.config.apiVersions = {
ec2: '2012-03-04',
dynamodb: '2011-12-05',
s3: '2006-03-01',
...
};

// constructing an EC2, DynamoDB, or S3 service will use
// the respective API versions
```

Example: Overriding the global API version

```js
// use latest for most services
AWS.config.apiVersion = 'latest';

// lock dynamodb to earlier version
AWS.config.apiVersions = {
dynamodb: '2011-12-05'
};
```

Example: Creating one-off clients

```js
var myConfig = require('myconfig'); // has a bunch of operations
var myClient = AWS.Client({apiConfig: myConfig});
```