{"_id":"@firstandthird/dockercloud","_rev":"30-f7d58c8d7da6b2c8b513ba8dbeef2b24","name":"@firstandthird/dockercloud","description":"Node.js library for Docker Cloud API","dist-tags":{"latest":"0.4.1"},"versions":{"0.3.0":{"name":"@firstandthird/dockercloud","version":"0.3.0","description":"Node.js library for Docker Cloud API","main":"lib/dockercloud.js","scripts":{"dev":"babel-node ./test/playground.js --presets=es2015,stage-0","compile":"babel --presets es2015,stage-0 -d lib/ src/","test":"babel-node ./node_modules/.bin/isparta cover _mocha","test:report":"mocha --compilers js:babel-core/register --reporter mocha-junit-reporter","prepublish":"npm run compile"},"repository":{"type":"git","url":"git+https://github.com/firstandthird/dockercloud.git"},"keywords":["docker","dockercloud"],"author":{"name":"Viatcheslav Ivanov","url":"viatcheslav.ivanov@surrey.ca"},"license":"ISC","bugs":{"url":"https://github.com/firstandthird/dockercloud/issues"},"homepage":"https://github.com/firstandthird/dockercloud#readme","dependencies":{"babel-polyfill":"^6.9.1","request":"^2.71.0","ws":"^1.1.0"},"devDependencies":{"babel-cli":"^6.7.5","babel-eslint":"^6.0.2","babel-preset-es2015":"^6.6.0","babel-preset-stage-0":"^6.5.0","babel-register":"^6.7.2","chai":"^3.5.0","eslint":"^2.8.0","eslint-config-airbnb":"^7.0.0","eslint-plugin-jsx-a11y":"^0.6.2","eslint-plugin-react":"^5.0.1","isparta":"^4.0.0","istanbul":"^0.4.3","mocha":"^2.4.5","mocha-junit-reporter":"^1.11.1"},"gitHead":"dbacd0336514c282edc86bf6082207fbbc85243e","_id":"@firstandthird/dockercloud@0.3.0","_shasum":"34dc1b91c33baff7a478767114b1e47637cd0309","_from":".","_npmVersion":"4.1.2","_nodeVersion":"6.9.1","_npmUser":{"name":"jga","email":"code@firstandthird.com"},"dist":{"shasum":"34dc1b91c33baff7a478767114b1e47637cd0309","tarball":"https://registry.npmjs.org/@firstandthird/dockercloud/-/dockercloud-0.3.0.tgz","integrity":"sha512-YUTwIckcRRZZXDP/RPTas3Y+VBLM/D4Hrb2kYyjxX2fH4kOVeokhcRbTSKdOpuL5iXroouytN1usqjgN2RhJ6Q==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC1GvQ14mCV9WiCS8cRVDAUOmYpXF9NpieUEqWpCOCMVQIgZFj0aSSU4vCSrJKf8NcuJD5wyaS0BdaWsFTHpIimeUQ="}]},"maintainers":[{"name":"jga","email":"code@firstandthird.com"}],"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/dockercloud-0.3.0.tgz_1487560875245_0.16212022327817976"},"directories":{}},"0.4.0":{"name":"@firstandthird/dockercloud","version":"0.4.0","description":"Node.js library for Docker Cloud API","main":"lib/dockercloud.js","scripts":{"dev":"babel-node ./test/playground.js --presets=es2015,stage-0","compile":"babel --presets es2015,stage-0 -d lib/ src/","test":"babel-node ./node_modules/.bin/isparta cover _mocha","test:report":"mocha --compilers js:babel-core/register --reporter mocha-junit-reporter","prepublish":"npm run compile"},"repository":{"type":"git","url":"git+https://github.com/firstandthird/dockercloud.git"},"keywords":["docker","dockercloud"],"author":{"name":"Viatcheslav Ivanov","url":"viatcheslav.ivanov@surrey.ca"},"license":"ISC","bugs":{"url":"https://github.com/firstandthird/dockercloud/issues"},"homepage":"https://github.com/firstandthird/dockercloud#readme","dependencies":{"babel-polyfill":"^6.9.1","request":"^2.71.0","ws":"^1.1.0"},"devDependencies":{"babel-cli":"^6.7.5","babel-eslint":"^6.0.2","babel-preset-es2015":"^6.6.0","babel-preset-stage-0":"^6.5.0","babel-register":"^6.7.2","chai":"^3.5.0","eslint":"^2.8.0","eslint-config-airbnb":"^7.0.0","eslint-plugin-jsx-a11y":"^0.6.2","eslint-plugin-react":"^5.0.1","isparta":"^4.0.0","istanbul":"^0.4.3","mocha":"^2.4.5","mocha-junit-reporter":"^1.11.1"},"gitHead":"a97c479950ae1ef2b75514b90d35fce11936d298","_id":"@firstandthird/dockercloud@0.4.0","_shasum":"c88573d74336a2ded82f895223b0d0a2e97c0c46","_from":".","_npmVersion":"4.1.2","_nodeVersion":"6.9.1","_npmUser":{"name":"jga","email":"code@firstandthird.com"},"dist":{"shasum":"c88573d74336a2ded82f895223b0d0a2e97c0c46","tarball":"https://registry.npmjs.org/@firstandthird/dockercloud/-/dockercloud-0.4.0.tgz","integrity":"sha512-P0+tydanCuJC843m5sJ/+IFXUmAhcSCdfrzepLj3Uy5ydyUc/IhOqcTULsOSuGlYmz3XVqEhQ9b5aJKZrfNsrw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDVWoBzrhofJI6iB9b1eXWJPVZyCa/heDKugrrWRfQQsQIgZ5JNloWl5zzE6WJIBSrJnPHZYx36DKyg99WmFYd1Rng="}]},"maintainers":[{"name":"alaguna","email":"sombragriselros@gmail.com"},{"name":"dawnerd","email":"troy@somany.us"},{"name":"ecwillis","email":"eric@ecwillis.com"},{"name":"jga","email":"code@firstandthird.com"},{"name":"orthagonal1","email":"orthagonal1@gmail.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/dockercloud-0.4.0.tgz_1487562099618_0.23974548932164907"},"directories":{}},"0.4.1":{"name":"@firstandthird/dockercloud","version":"0.4.1","description":"Node.js library for Docker Cloud API","main":"lib/dockercloud.js","scripts":{"dev":"babel-node ./test/playground.js --presets=es2015,stage-0","compile":"babel --presets es2015,stage-0 -d lib/ src/","test":"babel-node ./node_modules/.bin/isparta cover _mocha","test:report":"mocha --compilers js:babel-core/register --reporter mocha-junit-reporter","prepublish":"npm run compile"},"repository":{"type":"git","url":"git+https://github.com/firstandthird/dockercloud.git"},"keywords":["docker","dockercloud"],"author":{"name":"Viatcheslav Ivanov","url":"viatcheslav.ivanov@surrey.ca"},"license":"ISC","bugs":{"url":"https://github.com/firstandthird/dockercloud/issues"},"homepage":"https://github.com/firstandthird/dockercloud#readme","dependencies":{"babel-polyfill":"^6.9.1","request":"^2.71.0","ws":"^1.1.0"},"devDependencies":{"babel-cli":"^6.7.5","babel-eslint":"^6.0.2","babel-preset-es2015":"^6.6.0","babel-preset-stage-0":"^6.5.0","babel-register":"^6.7.2","chai":"^3.5.0","eslint":"^2.8.0","eslint-config-airbnb":"^7.0.0","eslint-plugin-jsx-a11y":"^0.6.2","eslint-plugin-react":"^5.0.1","isparta":"^4.0.0","istanbul":"^0.4.3","mocha":"^2.4.5","mocha-junit-reporter":"^1.11.1"},"gitHead":"eeba4a9b137f3161a5484e0a4700e57cd6290888","_id":"@firstandthird/dockercloud@0.4.1","_shasum":"89144f5eb8f5e4119d91800596e0db79b7ec51ab","_from":".","_npmVersion":"4.1.2","_nodeVersion":"6.9.1","_npmUser":{"name":"jga","email":"code@firstandthird.com"},"dist":{"shasum":"89144f5eb8f5e4119d91800596e0db79b7ec51ab","tarball":"https://registry.npmjs.org/@firstandthird/dockercloud/-/dockercloud-0.4.1.tgz","integrity":"sha512-uAnZqSyvDFIQNMQjJuxePj0Ag2NI8TCI+vlHUdgQ+Lwhx11QsDlzNevOcyzb1iqVpCtwrVaF3MvB9GHyPaobWg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCKSgRNdQeaJQ5VRvoEuFEdFQyY6ymt2l7jkKNpaYMISwIhAPNoitI7PREEdgLnug/G0/lMBq06h3ct2jfP1F5hCUse"}]},"maintainers":[{"name":"alaguna","email":"sombragriselros@gmail.com"},{"name":"dawnerd","email":"troy@somany.us"},{"name":"ecwillis","email":"eric@ecwillis.com"},{"name":"jga","email":"code@firstandthird.com"},{"name":"orthagonal1","email":"orthagonal1@gmail.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/dockercloud-0.4.1.tgz_1487562359794_0.9869134409818798"},"directories":{}}},"readme":"# Dockercloud\n\n[![Circle CI](https://circleci.com/gh/cityofsurrey/dockercloud.svg?style=svg&circle-token=f548071bbc6fe1b232c2f32b197a04c7bcafa50b)](https://circleci.com/gh/CityofSurrey/dockercloud)\n<a href=\"https://codeclimate.com/github/CityofSurrey/dockercloud\"><img src=\"https://codeclimate.com/github/CityofSurrey/dockercloud/badges/gpa.svg\" /></a>\n<a href=\"https://codeclimate.com/github/CityofSurrey/dockercloud/coverage\"><img src=\"https://codeclimate.com/github/CityofSurrey/dockercloud/badges/coverage.svg\" /></a>\n\nNode.js library for Docker Cloud API\n\n## Installation\n\n```\nnpm install @firstandthird/dockercloud\n```\n\n## Usage\n\n### Initilization\n\nTo use this class firstly you need to instantiate a new instance:\n```js\nimport DockerCloud from 'dockercloud'\n\nconst dockerCloud = new DockerCloud('username', 'password', 'namespace')\n```\n\n### Methods\n\nAll methods return promises.\n\n#### connect\n\nConnect to DockerCloud and listen for events.\nThis method is required to be called before using the waitUntil* methods.\n\nExample:\n```js\nawait dockerCloud.connect()\nconst stack = await dockerCloud.findStackById('stackId')\nawait dockerCloud.waitUntilStackIsTerminated(stack)\n\n```\n\n#### disconnect\n\nDisconnect from DockerCloud.\nThis method returns nothing.\n\n#### queryStacks\n\nThe value returned by the promise will be a list of the stacks in your account.\n\n```js\nconst stacks = await dockerCloud.queryStacks()\n```\n\n#### findStackById\n\nThe value returned by the promise will be the stack with the id passed.\n\n```js\ntry {\n  const stack = await dockerCloud.findStackById('stackId')\n  // Do something with the stack\n} catch (error) {\n  // If the error is empty the stack isn't found (404)\n}\n```\n\n\n#### findStackByName\n\nSame as findStackById, but if the stack isn't found instead of rejection the promise resolves returning nothing\n\n#### createStack\n\nCreate a new stack\n\n```js\nawait dockerCloud.createStack({\n  name: 'human readable name',\n  nickname: 'optional nickname',\n  services: [{\n    \"name\": \"hello-word\",\n    \"image\": \"tutum/hello-world\",\n    \"target_num_containers\": 2\n  }]\n})\n```\n\n#### removeStack\n\nRemove a stack; the parameter is the stack object.\n\n```js\nconst stack = await dockerCloud.findStackById('uuid')\ndockerCloud.removeStack(stack)\n```\n\n#### startStack\n\nStart a stack; the parameter is the stack object.\n\n```js\nconst stack = await dockerCloud.findStackById('uuid')\ndockerCloud.startStack(stack)\n```\n\n#### getStackServices\n\nGet the services connected to a stack; the parameter is the stack object.\n\n```js\nconst stack = await dockerCloud.findStackById('uuid')\nconst services = dockerCloud.getStackServices(stack)\n```\n\n#### waitUntilStackIsTerminated\n\nWait until a stack is terminated\n\n```js\nawait dockerCloud.connect()\nconst stack = await dockerCloud.findStackById('stackId')\nawait dockerCloud.waitUntilStackIsTerminated(stack)\n```\n\n#### waitUntilStackIsRunning\n\nWait until a stack is running\n\n```js\nawait dockerCloud.connect()\nconst stack = await dockerCloud.findStackById('stackId')\nawait dockerCloud.waitUntilStackIsRunning(stack)\n```\n\n#### findServiceById\n\nThe value returned by the promise will be the service with the id passed.\n\n```js\ntry {\n  const stack = await dockerCloud.findServiceById('serviceId')\n} catch (error) {\n  // If the error is empty the service isn't found (404)\n}\n```\n\n#### findServiceByName\n\nSame as findServiceById, but if the service isn't found instead of rejection the promise resolves returning nothing\n\n#### createService\n\nCreate a new service\n\n```js\nawait dockerCloud.createService({\n  image: \"tutum/hello-world\",\n  name: \"Optional name\",\n  target_num_containers: 2, // Optional, default 1\n  run_command: \"/run.sh\", // Optional, The command used to start the containers of this service, overriding the value specified in the image. (default: null)\n  entrypoint: \"/usr/sbin/sshd\", // Optional, The command prefix used to start the containers of this service, overriding the value specified in the image. (default: null)\n  container_ports: [{ // Optional, An array of objects with port information to be published in the containers for this service, which will be added to the image port information. (default: [])\n    protocol: \"tcp\",\n    inner_port: 80,\n    outer_port: 80,\n    published: false\n  }],\n  container_envvars: [{ // Optional, An array of objects with environment variables to be added in the service containers on launch (overriding any image-defined environment variables). (default: [])\n    key: \"DB_PASSWORD\",\n    value: \"mypass\"\n  }],\n  linked_to_service: [{ // Optional, An array of service resource URIs to link this service to, including the link name. (default: [])\n    to_service: \"/api/app/v1/service/80ff1635-2d56-478d-a97f-9b59c720e513/\",\n    name: \"db\"\n  }],\n  bindings: [{ // Optional, An array of bindings this service has to mount. (default: [])\n    volumes_from: \"/api/app/v1/service/80ff1635-2d56-478d-a97f-9b59c720e513/\",\n    container_path: \"\",\n    rewritable: true,\n    host_path: \"\"\n  }],\n  autorestart: \"OFF\", // Optional,  Whether the containers for this service should be restarted if they stop, i.e. ALWAYS (default: OFF, possible values: OFF, ON_FAILURE, ALWAYS)\n  autodestroy: \"OFF\", // Optional, Whether the containers should be terminated if they stop, i.e. OFF (default: OFF, possible values: OFF, ON_SUCCESS, ALWAYS)\n  sequential_deployment: false, // Optional, Whether the containers should be launched and scaled in sequence. (default: false)\n  roles: [\"global\"], // Optional, A list of Docker Cloud API roles to grant the service\n  privileged: false, // Optional, Whether to start the containers with Docker’s privileged flag set or not\n  deployment_strategy: \"EMPTIEST_NODE\", // Optional, Container distribution among nodes\n  tags: [\"tag1\",\"tag2\"],\n  autoredeploy: false, // Optional,  Whether to redeploy the containers of the service when its image is updated in Docker Cloud registry. (default: false)\n  net: \"bridge\", // Optional, possible values: bridge, host\n  pid: \"host\", // Optional, Set the PID (Process) Namespace mode for the containers. (default: none)\n  working_dir: \"/var/app/\", // Optional, Working directory for running binaries within a container of this service. (default: /)\n  nickname: \"Optional nickname\"\n})\n```\n\n#### removeService\n\nRemove a service; the parameter is the service object.\n\n```js\nconst service = await dockerCloud.findServiceById('uuid')\ndockerCloud.removeService(service)\n```\n\n#### startService\n\nStart a service; the parameter is the service object.\n\n```js\nconst service = await dockerCloud.findServiceById('uuid')\ndockerCloud.startService(service)\n```\n\n#### redeployService\n\nRedeploy a service; the parameter is the service object.\n\n```js\nconst service = await dockerCloud.findServiceById('uuid')\ndockerCloud.redeployService(service)\n```\n\n#### getServiceContainers\n\nGet the containers connected to a service; the parameter is the service object.\n\n```js\nconst service = await dockerCloud.findServiceById('uuid')\nconst containers = dockerCloud.getServiceContainers(service)\n```\n\n#### findContainerById\n\nThe value returned by the promise will be the container with the id passed.\n\n```js\ntry {\n  const stack = await dockerCloud.findContainerById('containerId')\n} catch (error) {\n  // If the error is empty the container isn't found (404)\n}\n```\n\n\n#### waitUntilContainerIsStopped\n\nWait until a container is stopped\n\n```js\nawait dockerCloud.connect()\nconst container = await dockerCloud.findContainerById('containerId')\nawait dockerCloud.waitUntilContainerIsStopped(container)\n```\n\n\n#### findActionById\n\nThe value returned by the promise will be the action with the id passed.\n\n```js\ntry {\n  const stack = await dockerCloud.findActionById('actionId')\n} catch (error) {\n  // If the error is empty the action isn't found (404)\n}\n```\n\n\n#### waitUntilActionIsSuccess\n\nWait until an action is successful\n\n```js\nawait dockerCloud.connect()\nconst action = await dockerCloud.findActionById('actionId')\nawait dockerCloud.waitUntilActionIsSuccess(action)\n```\n\n#### extractUuid\n\nExtract the UUID from an URL\n\n```js\nconst uuuid = dockerCloud.extractUuid('/api/app/v1/action/7c42003e-eb39-4adc-b5b9-cbb7607fc698/')\nuuuid === '7c42003e-eb39-4adc-b5b9-cbb7607fc698'\n```\n","maintainers":[{"email":"code@firstandthird.com","name":"jga"},{"email":"troy@somany.us","name":"dawnerd"},{"email":"eric@ecwillis.com","name":"ecwillis"},{"email":"orthagonal1@gmail.com","name":"orthagonal1"},{"email":"sombragriselros@gmail.com","name":"alaguna"},{"email":"aleperez92@gmail.com","name":"aleperez92"}],"time":{"modified":"2022-06-12T17:57:53.548Z","created":"2017-02-20T03:21:17.168Z","0.3.0":"2017-02-20T03:21:17.168Z","0.4.0":"2017-02-20T03:41:39.855Z","0.4.1":"2017-02-20T03:46:00.028Z"},"homepage":"https://github.com/firstandthird/dockercloud#readme","keywords":["docker","dockercloud"],"repository":{"type":"git","url":"git+https://github.com/firstandthird/dockercloud.git"},"author":{"name":"Viatcheslav Ivanov","url":"viatcheslav.ivanov@surrey.ca"},"bugs":{"url":"https://github.com/firstandthird/dockercloud/issues"},"license":"ISC","readmeFilename":"README.md"}