Skip to content

Commit

Permalink
Add support for AWS.CloudSearchDomain
Browse files Browse the repository at this point in the history
Closes #134
  • Loading branch information
lsegal committed Jun 26, 2014
1 parent 61f146d commit aa73f96
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ The SDK currently supports the following services:
<tr><td>2013-11-11</td></tr>
<tr><td rowspan="2">Amazon CloudSearch</td><td rowspan="2">AWS.CloudSearch</td><td>2011-02-01</td></tr>
<tr><td>2013-01-01</td></tr>
<tr><td>Amazon CloudSearch Domain</td><td>2013-01-01</td></tr>
<tr><td>Amazon CloudWatch</td><td>AWS.CloudWatch</td><td>2010-08-01</td></tr>
<tr><td rowspan="2">Amazon DynamoDB</td><td rowspan="2">AWS.DynamoDB</td><td>2011-12-05</td></tr>
<tr><td>2012-08-10</td></tr>
Expand Down
1 change: 1 addition & 0 deletions doc-src/guide/node-services.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ The supported services are:
* [AWS.CloudFormation](http://docs.amazonwebservices.com/AWSJavaScriptSDK/latest/frames.html#!AWS/CloudFormation.html)
* [AWS.CloudFront](http://docs.amazonwebservices.com/AWSJavaScriptSDK/latest/frames.html#!AWS/CloudFront.html)
* [AWS.CloudSearch](http://docs.amazonwebservices.com/AWSJavaScriptSDK/latest/frames.html#!AWS/CloudSearch.html)
* [AWS.CloudSearchDomain](http://docs.amazonwebservices.com/AWSJavaScriptSDK/latest/frames.html#!AWS/CloudSearchDomain.html)
* [AWS.DataPipeline](http://docs.amazonwebservices.com/AWSJavaScriptSDK/latest/frames.html#!AWS/DataPipeline.html)
* [AWS.DirectConnect](http://docs.amazonwebservices.com/AWSJavaScriptSDK/latest/frames.html#!AWS/DirectConnect.html)
* [AWS.DynamoDB](http://docs.amazonwebservices.com/AWSJavaScriptSDK/latest/frames.html#!AWS/DynamoDB.html)
Expand Down
19 changes: 19 additions & 0 deletions lib/services/cloudsearchdomain.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
var AWS = require('../core');

/**
* Note: the `AWS.CloudSearchDomain` constructor must be created with a
* valid endpoint.
*/
AWS.util.update(AWS.CloudSearchDomain.prototype, {
/**
* @api private
*/
validateService: function validateService() {
if (!this.config.endpoint || this.config.endpoint.indexOf('{') >= 0) {
var msg = 'AWS.CloudSearchDomain requires an explicit '+
'`endpoint\' configuration option.';
throw AWS.util.error(new Error(),
{name: 'InvalidEndpoint', message: msg});
}
}
});
5 changes: 4 additions & 1 deletion scripts/console
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,10 @@ try {

// load services as defined instances
for (var key in AWS) {
if (AWS[key].serviceIdentifier) {
var id = AWS[key].serviceIdentifier;
if (id) {
if (id === 'cloudsearchdomain') continue; // this required an explicit endpoint

var svcClass = AWS[key];
var svc = new svcClass(defaultOptions);
svc.with = function(config) {
Expand Down
23 changes: 23 additions & 0 deletions test/services/cloudsearchdomain.spec.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
helpers = require('../helpers')
AWS = helpers.AWS

describe 'AWS.CloudSearchDomain', ->
describe 'constructor', ->
it 'fails if there is no provided endpoint', ->
err = {}
try
new AWS.CloudSearchDomain
catch e
err = e
expect(err.name).toEqual('InvalidEndpoint')

it 'fails if the endpoint is a template', ->
err = {}
try
new AWS.CloudSearchDomain endpoint: '{region}.domain'
catch e
err = e
expect(err.name).toEqual('InvalidEndpoint')

it 'allows explicit endpoint', ->
expect(-> new AWS.CloudSearchDomain endpoint: 'host.domain').not.toThrow()

0 comments on commit aa73f96

Please sign in to comment.