forked from matt-major-zz/do-wrapper
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdo-wrapper.js
1 lines (1 loc) · 12.6 KB
/
do-wrapper.js
1
"use strict";function _interopRequireDefault(e){return e&&e.__esModule?e:{"default":e}}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(exports,"__esModule",{value:!0});var _createClass=function(){function e(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}}(),_requestHelper=require("./request-helper"),_requestHelper2=_interopRequireDefault(_requestHelper),DigitalOcean=function(){function e(t,n){_classCallCheck(this,e),this.per_page=n,this.requestHelper=new _requestHelper2["default"](t)}return _createClass(e,[{key:"account",value:function(e){var t={actionPath:"account"};return this.requestHelper.request(t,e)}},{key:"accountGetActions",value:function(e,t){var n={actionPath:"actions",key:"actions",qs:{tag_name:e?e.tag_name||"":"",per_page:e?e.per_page||this.per_page:this.per_page,page:e?e.page||1:1},includeAll:e?e.includeAll||!1:!1};return this.requestHelper.request(n,t)}},{key:"accountGetAction",value:function(e,t){var n={actionPath:"actions/"+encodeURIComponent(e)};return this.requestHelper.request(n,t)}},{key:"accountGetKeys",value:function(e,t){var n={actionPath:"account/keys",key:"ssh_keys",qs:{tag_name:e?e.tag_name||"":"",per_page:e?e.per_page||this.per_page:this.per_page,page:e?e.page||1:1},includeAll:e?e.includeAll||!1:!1};return this.requestHelper.request(n,t)}},{key:"accountAddKey",value:function(e,t){var n={actionPath:"account/keys",method:"POST",body:e};return this.requestHelper.request(n,t)}},{key:"accountGetKeyById",value:function(e,t){var n={actionPath:"account/keys/"+encodeURIComponent(e)};return this.requestHelper.request(n,t)}},{key:"accountGetKeyByFingerprint",value:function(e,t){var n={actionPath:"account/keys/"+encodeURIComponent(e)};return this.requestHelper.request(n,t)}},{key:"accountRenameKey",value:function(e,t,n){var a={actionPath:"account/keys/"+encodeURIComponent(e),method:"PUT",body:{name:t}};return this.requestHelper.request(a,n)}},{key:"accountDeleteKey",value:function(e,t){var n={actionPath:"account/keys/"+encodeURIComponent(e),method:"DELETE"};return this.requestHelper.request(n,t)}},{key:"dropletsGetAll",value:function(e,t){var n={actionPath:"droplets",key:"droplets",qs:{tag_name:e.tag_name||void 0,per_page:e?e.per_page||this.per_page:this.per_page,page:e?e.page||1:1},includeAll:e?e.includeAll||!1:!1};return this.requestHelper.request(n,t)}},{key:"dropletsGetKernels",value:function(e,t,n){var a={actionPath:"droplets/"+encodeURIComponent(e)+"/kernels",key:"kernels",qs:{tag_name:t?t.tag_name||"":"",per_page:t?t.per_page||this.per_page:this.per_page,page:t?t.page||1:1},includeAll:t?t.includeAll||!1:!1};return this.requestHelper.request(a,n)}},{key:"dropletsGetSnapshots",value:function(e,t,n){var a={actionPath:"droplets/"+encodeURIComponent(e)+"/snapshots",key:"snapshots",qs:{tag_name:t?t.tag_name||"":"",per_page:t?t.per_page||this.per_page:this.per_page,page:t?t.page||1:1},includeAll:t?t.includeAll||!1:!1};return this.requestHelper.request(a,n)}},{key:"dropletsGetBackups",value:function(e,t,n){var a={actionPath:"droplets/"+encodeURIComponent(e)+"/backups",key:"backups",qs:{tag_name:t?t.tag_name||"":"",per_page:t?t.per_page||this.per_page:this.per_page,page:t?t.page||1:1},includeAll:t?t.includeAll||!1:!1};return this.requestHelper.request(a,n)}},{key:"dropletsGetActions",value:function(e,t,n){var a={actionPath:"droplets/"+encodeURIComponent(e)+"/actions",key:"actions",qs:{tag_name:t?t.tag_name||"":"",per_page:t?t.per_page||this.per_page:this.per_page,page:t?t.page||1:1},includeAll:t?t.includeAll||!1:!1};return this.requestHelper.request(a,n)}},{key:"dropletsCreate",value:function(e,t){var n={actionPath:"droplets",method:"POST",body:e};return this.requestHelper.request(n,t)}},{key:"dropletsGetById",value:function(e,t){var n={actionPath:"droplets/"+encodeURIComponent(e)};return this.requestHelper.request(n,t)}},{key:"dropletsDelete",value:function(e,t){var n={actionPath:"droplets/"+encodeURIComponent(e),method:"DELETE"};return this.requestHelper.request(n,t)}},{key:"dropletsGetNeighbors",value:function(e,t){var n={actionPath:"droplets/"+encodeURIComponent(e)+"/neighbors"};return this.requestHelper.request(n,t)}},{key:"dropletsGetNeighborsReport",value:function(e){var t={actionPath:"reports/droplet_neighbors"};return this.requestHelper.request(t,e)}},{key:"dropletsGetUpgrades",value:function(e){var t={actionPath:"droplet_upgrades"};return this.requestHelper.request(t,e)}},{key:"dropletsRequestAction",value:function(e,t,n){var a={actionPath:"droplets/"+encodeURIComponent(e)+"/actions",method:"POST",body:t};return this.requestHelper.request(a,n)}},{key:"dropletsGetAction",value:function(e,t,n){var a={actionPath:"droplets/"+encodeURIComponent(e)+"/actions/"+encodeURIComponent(t)};return this.requestHelper.request(a,n)}},{key:"domainsGetAll",value:function(e,t){var n={actionPath:"domains",key:"domains",qs:{tag_name:e&&e?e.tag_name||"":"",per_page:e?e.per_page||this.per_page:this.per_page,page:e?e.page||1:1}};return this.requestHelper.request(n,t)}},{key:"domainsCreate",value:function(e,t,n){var a={actionPath:"domains",method:"POST",body:{name:e,ip_address:t}};return this.requestHelper.request(a,n)}},{key:"domainsGet",value:function(e,t){var n={actionPath:"domains/"+encodeURIComponent(e)};return this.requestHelper.request(n,t)}},{key:"domainsDelete",value:function(e,t){var n={actionPath:"domains/"+encodeURIComponent(e),method:"DELETE"};return this.requestHelper.request(n,t)}},{key:"domainRecordsGetAll",value:function(e,t,n){var a={actionPath:"domains/"+encodeURIComponent(e)+"/records",key:"domain_records",qs:{tag_name:t?t.tag_name||"":"",per_page:t?t.per_page||this.per_page:this.per_page,page:t?t.page||1:1},includeAll:t?t.includeAll||!1:!1};return this.requestHelper.request(a,n)}},{key:"domainRecordsCreate",value:function(e,t,n){var a={actionPath:"domains/"+encodeURIComponent(e)+"/records",method:"POST",body:t};return this.requestHelper.request(a,n)}},{key:"domainRecordsGet",value:function(e,t,n){var a={actionPath:"domains/"+encodeURIComponent(e)+"/records/"+encodeURIComponent(t)};return this.requestHelper.request(a,n)}},{key:"domainRecordsUpdate",value:function(e,t,n,a){var r={actionPath:"domains/"+encodeURIComponent(e)+"/records/"+encodeURIComponent(t),method:"PUT",body:n};return this.requestHelper.request(r,a)}},{key:"domainRecordsDelete",value:function(e,t,n){var a={actionPath:"domains/"+encodeURIComponent(e)+"/records/"+encodeURIComponent(t),method:"DELETE"};return this.requestHelper.request(a,n)}},{key:"regionsGetAll",value:function(e,t){var n={actionPath:"regions",key:"regions",qs:{tag_name:e?e.tag_name||"":"",per_page:e?e.per_page||this.per_page:this.per_page,page:e?e.page||1:1},includeAll:e?e.includeAll||!1:!1};return this.requestHelper.request(n,t)}},{key:"sizesGetAll",value:function(e,t){var n={actionPath:"sizes",key:"sizes",qs:{tag_name:e?e.tag_name||"":"",per_page:e?e.per_page||this.per_page:this.per_page,page:e?e.page||1:1},includeAll:e?e.includeAll||!1:!1};return this.requestHelper.request(n,t)}},{key:"imagesGetAll",value:function(e,t){var n={actionPath:"images",key:"images",qs:{tag_name:e?e.tag_name||"":"",per_page:e?e.per_page||this.per_page:this.per_page,page:e?e.page||1:1,"private":e["private"]||!1,type:e.type||null},includeAll:e?e.includeAll||!1:!1};return this.requestHelper.request(n,t)}},{key:"imagesGetById",value:function(e,t){var n={actionPath:"images/"+encodeURIComponent(e)};return this.requestHelper.request(n,t)}},{key:"imagesGetBySlug",value:function(e,t){var n={actionPath:"images/"+encodeURIComponent(e)};return this.requestHelper.request(n,t)}},{key:"imagesGetActions",value:function(e,t,n){var a={actionPath:"images/"+encodeURIComponent(e)+"/actions",key:"actions",qs:{tag_name:t?t.tag_name||"":"",per_page:t?t.per_page||this.per_page:this.per_page,page:t?t.page||1:1},includeAll:t?t.includeAll||!1:!1};return this.requestHelper.request(a,n)}},{key:"imagesUpdate",value:function(e,t,n){var a={actionPath:"images/"+encodeURIComponent(e),body:{name:t},method:"PUT"};return this.requestHelper.request(a,n)}},{key:"imagesDelete",value:function(e,t){var n={actionPath:"images/"+encodeURIComponent(e),method:"DELETE"};return this.requestHelper.request(n,t)}},{key:"imagesRequestAction",value:function(e,t,n){var a={actionPath:"images/"+encodeURIComponent(e)+"/actions",method:"POST",body:t};return this.requestHelper.request(a,n)}},{key:"imagesGetAction",value:function(e,t,n){var a={actionPath:"images/"+encodeURIComponent(e)+"/actions/"+encodeURIComponent(t)};return this.requestHelper.request(a,n)}},{key:"floatingIpsGetAll",value:function(e,t){var n={actionPath:"floating_ips",key:"floating_ips",qs:{tag_name:e?e.tag_name||"":"",per_page:e?e.per_page||this.per_page:this.per_page,page:e?e.page||1:1},includeAll:e?e.includeAll||!1:!1};return this.requestHelper.request(n,t)}},{key:"floatingIpsAssignDroplet",value:function(e,t){var n={actionPath:"floating_ips",method:"POST",body:{droplet_id:e}};return this.requestHelper.request(n,t)}},{key:"floatingIpsAssignRegion",value:function(e,t){var n={actionPath:"floating_ips",method:"POST",body:{region:e}};return this.requestHelper.request(n,t)}},{key:"floatingIpsGet",value:function(e,t){var n={actionPath:"floating_ips/"+encodeURIComponent(e)};return this.requestHelper.request(n,t)}},{key:"floatingIpsDelete",value:function(e,t){var n={actionPath:"floating_ips/"+encodeURIComponent(e),method:"DELETE"};return this.requestHelper.request(n,t)}},{key:"floatingIpsRequestAction",value:function(e,t,n){var a={actionPath:"floating_ips/"+encodeURIComponent(e)+"/actions",method:"POST",body:t};return this.requestHelper.request(a,n)}},{key:"floatingIpsGetActions",value:function(e,t,n){var a={actionPath:"floating_ips/"+encodeURIComponent(e)+"/actions",key:"actions",qs:{tag_name:t?t.tag_name||"":"",per_page:t?t.per_page||this.per_page:this.per_page,page:t?t.page||1:1},includeAll:t?t.includeAll||!1:!1};return this.requestHelper.request(a,n)}},{key:"floatingIpsGetAction",value:function(e,t,n){var a={actionPath:"floating_ips/"+encodeURIComponent(e)+"/actions/"+encodeURIComponent(t)};return this.requestHelper.request(a,n)}},{key:"tagsCreate",value:function(e,t){var n={actionPath:"tags",method:"POST",body:{name:e}};return this.requestHelper.request(n,t)}},{key:"tagsDelete",value:function(e,t){var n={actionPath:"tags/"+encodeURIComponent(e),method:"DELETE"};return this.requestHelper.request(n,t)}},{key:"tagsGet",value:function(e,t){var n={actionPath:"tags/"+encodeURIComponent(e)};return this.requestHelper.request(n,t)}},{key:"tagsGetAll",value:function(e,t){var n={actionPath:"tags",key:"tags",qs:{tag_name:e?e.tag_name||"":"",per_page:e?e.per_page||this.per_page:this.per_page,page:e?e.page||1:1},includeAll:e?e.includeAll||!1:!1};return this.requestHelper.request(n,t)}},{key:"tagsAddResources",value:function(e,t,n){var a={actionPath:"tags/"+encodeURIComponent(e)+"/resources",method:"POST",body:t};return this.requestHelper.request(a,n)}},{key:"tagsDeleteResource",value:function(e,t,n){var a={actionPath:"tags/"+encodeURIComponent(e)+"/resources",method:"DELETE",body:t};return this.requestHelper.request(a,n)}},{key:"tagsGetDroplets",value:function(e,t,n){var a={actionPath:"droplets",key:"droplets",qs:{per_page:t?t.per_page||this.per_page:this.per_page,page:t?t.page||1:1,tag_name:e},includeAll:t?t.includeAll||!1:!1};return this.requestHelper.request(a,n)}},{key:"tagsDeleteDroplets",value:function(e,t){var n={actionPath:"droplets",method:"DELETE",qs:{tag_name:e}};return this.requestHelper.request(n,t)}},{key:"tagsRequestAction",value:function(e,t,n){var a={actionPath:"droplets/actions",method:"POST",qs:{tag_name:e},body:t};return this.requestHelper.request(a,n)}},{key:"volumes",value:function(e,t){var n={actionPath:"volumes",method:"GET",qs:{region:e||""}};return this.requestHelper.request(n,t)}},{key:"volumesCreate",value:function(e,t){var n={actionPath:"volumes",method:"POST",body:e};return this.requestHelper.request(n,t)}},{key:"volumesGetById",value:function(e,t){var n={actionPath:"volumes/"+e,method:"GET"};return this.requestHelper.request(n,t)}},{key:"volumesGetByName",value:function(e,t,n){var a={actionPath:"volumes",method:"GET",qs:{name:e,region:t}};return this.requestHelper.request(a,n)}},{key:"volumesDeleteById",value:function(e,t){var n={actionPath:"volumes/"+e,method:"DELETE"};return this.requestHelper.request(n,t)}},{key:"volumesDeleteByName",value:function(e,t,n){var a={actionPath:"volumes",method:"DELETE",qs:{name:e,region:t}};return this.requestHelper.request(a,n)}},{key:"volumesRequestAction",value:function(e,t,n){var a={actionPath:"volumes/"+encodeURIComponent(e)+"/actions",method:"POST",body:t};return this.requestHelper.request(a,n)}}]),e}();exports["default"]=DigitalOcean,module.exports=exports["default"];