Skip to content

Commit

Permalink
Add Client#createDeployment
Browse files Browse the repository at this point in the history
  • Loading branch information
r7kamura committed Aug 3, 2015
1 parent 57515ef commit 0ffcd87
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/client.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import AwsSignerV4 from 'stackable-fetcher-aws-signer-v4'
import { Fetcher, JsonRequestEncoder, JsonResponseDecoder, RejectLogger } from 'stackable-fetcher'
import Deployment from './deployment'
import Integration from './integration'
import IntegrationResponse from './integration-response'
import Method from './method'
Expand All @@ -26,6 +27,28 @@ export default class Client {
this.secretAccessKey = secretAccessKey;
}

/**
* @param {Boolean=} cacheClusterEnabled
* @param {Integer=} cacheClusterSize
* @param {String=} description
* @param {String} restapiId
* @param {String} stageDescription
* @param {String} stageName
* @return {Promise}
*/
createDeployment({ cacheClusterEnabled, cacheClusterSize, description, restapiId, stageDescription, stageName }) {
return this.getFetcher().post(
`${this._getBaseUrl()}/restapis/${restapiId}/deployments`,
{
cacheClusterEnabled: cacheClusterEnabled,
cacheClusterSize: cacheClusterSize,
description: description,
stageDescription: stageDescription,
stageName: stageName
}
).then(body => new Deployment(body));
}

/**
* @param {String} parentId
* @param {String} pathPart
Expand Down
11 changes: 11 additions & 0 deletions src/deployment.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/**
* @class
*/
export default class Deployment {
/**
* @param {Object} source
*/
constructor(source) {
this.source = source;
}
}
19 changes: 19 additions & 0 deletions test/client-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,25 @@ describe('Client', () => {
secretAccessKey: 'secretAccessKey',
});

describe('#createDeployment', () => {
it('does not raise any error', (done) => {
client.use(
Mock,
{
body: JSON.stringify({}),
headers: {
'Content-Type': 'application/json'
}
}
).createDeployment({
restapiId: 'restapiId',
stageName: 'production'
}).then((resource) => {
done();
});
});
});

describe('#createResource', () => {
it('does not raise any error', (done) => {
client.use(
Expand Down

0 comments on commit 0ffcd87

Please sign in to comment.