├── .dockerignore ├── .eslintrc.js ├── .github ├── ISSUE_TEMPLATE.md ├── PULL_REQUEST_TEMPLATE.md └── workflows │ ├── main.yml │ └── release.yml ├── .gitignore ├── Dockerfile ├── LICENSE ├── Makefile ├── NOTICE ├── README.md ├── babel.config.js ├── examples ├── README.md ├── compose.ts ├── context-ls.ts ├── exec.ts ├── ps.ts ├── start-stop.ts └── volume.ts ├── package.json ├── protos.sh ├── publish.sh ├── scripts ├── download-cli.ts └── download-protos.ts ├── src ├── compose.ts ├── containers.ts ├── contexts.ts ├── index.ts ├── protos │ ├── compose │ │ └── v1 │ │ │ ├── compose.proto │ │ │ ├── compose_grpc_pb.d.ts │ │ │ ├── compose_grpc_pb.js │ │ │ ├── compose_pb.d.ts │ │ │ └── compose_pb.js │ ├── containers │ │ └── v1 │ │ │ ├── containers.proto │ │ │ ├── containers_grpc_pb.d.ts │ │ │ ├── containers_grpc_pb.js │ │ │ ├── containers_pb.d.ts │ │ │ └── containers_pb.js │ ├── contexts │ │ └── v1 │ │ │ ├── contexts.proto │ │ │ ├── contexts_grpc_pb.d.ts │ │ │ ├── contexts_grpc_pb.js │ │ │ ├── contexts_pb.d.ts │ │ │ └── contexts_pb.js │ ├── streams │ │ └── v1 │ │ │ ├── streams.proto │ │ │ ├── streams_grpc_pb.d.ts │ │ │ ├── streams_grpc_pb.js │ │ │ ├── streams_pb.d.ts │ │ │ └── streams_pb.js │ └── volumes │ │ └── v1 │ │ ├── volumes.proto │ │ ├── volumes_grpc_pb.d.ts │ │ ├── volumes_grpc_pb.js │ │ ├── volumes_pb.d.ts │ │ └── volumes_pb.js ├── streams.ts └── volumes.ts ├── test └── context-ls.test.ts ├── tsconfig.json └── yarn.lock /.dockerignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .git 3 | Makefile 4 | -------------------------------------------------------------------------------- /.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | "env": { 3 | "browser": true, 4 | "es2020": true, 5 | "node": true 6 | }, 7 | "extends": [ 8 | "eslint:recommended", 9 | "plugin:@typescript-eslint/eslint-recommended", 10 | "plugin:@typescript-eslint/recommended" 11 | ], 12 | "parser": "@typescript-eslint/parser", 13 | "parserOptions": { 14 | "ecmaVersion": 11, 15 | "sourceType": "module" 16 | }, 17 | "plugins": [ 18 | "@typescript-eslint" 19 | ], 20 | "rules": { 21 | } 22 | }; 23 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | 29 | 30 | **Description** 31 | 32 | 35 | 36 | **Steps to reproduce the issue:** 37 | 1. 38 | 2. 39 | 3. 40 | 41 | **Describe the results you received:** 42 | 43 | 44 | **Describe the results you expected:** 45 | 46 | 47 | **Additional information you deem important (e.g. issue happens only occasionally):** 48 | 49 | **Output of `docker version`:** 50 | 51 | ``` 52 | (paste your output here) 53 | ``` 54 | 55 | **Output of `docker context show`:** 56 | You can also run `docker context inspect context-name` to give us more details but don't forget to remove sensitive content. 57 | 58 | ``` 59 | (paste your output here) 60 | ``` 61 | 62 | **Additional environment details (AWS ECS, Azure ACI, local, etc.):** 63 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | **What I did** 2 | 3 | **Related issue** 4 | 5 | 6 | **(not mandatory) A picture of a cute animal, if possible in relation with what you did** 7 | -------------------------------------------------------------------------------- /.github/workflows/main.yml: -------------------------------------------------------------------------------- 1 | name: CI 2 | on: 3 | push: 4 | branches: 5 | - main 6 | pull_request: 7 | 8 | jobs: 9 | build: 10 | runs-on: ubuntu-latest 11 | 12 | steps: 13 | - name: Begin CI... 14 | uses: actions/checkout@v2 15 | 16 | - name: Lint 17 | run: make lint 18 | 19 | - name: Test 20 | run: make test 21 | 22 | - name: Build 23 | run: make build 24 | -------------------------------------------------------------------------------- /.github/workflows/release.yml: -------------------------------------------------------------------------------- 1 | name: Release 2 | on: 3 | push: 4 | tags: 5 | - 'v*' 6 | 7 | jobs: 8 | publish-npm: 9 | runs-on: ubuntu-latest 10 | steps: 11 | - uses: actions/checkout@v2 12 | - name: Set env 13 | run: echo "RELEASE_VERSION=${GITHUB_REF:11}" >> $GITHUB_ENV 14 | - uses: actions/setup-node@v1 15 | with: 16 | node-version: 12 17 | registry-url: https://registry.npmjs.org/ 18 | - run: ./publish.sh ${RELEASE_VERSION} 19 | env: 20 | NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.log 2 | node_modules 3 | src/*.js 4 | src/*.map 5 | src/*.d.ts 6 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | # syntax = docker/dockerfile:experimental 2 | 3 | # Copyright 2020 Docker CLI JavaScript SDK authors 4 | 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | 18 | FROM node:12-buster-slim AS base 19 | WORKDIR /src 20 | COPY package.json . 21 | COPY yarn.lock . 22 | 23 | RUN --mount=type=cache,target=/usr/local/share/.cache/yarn/v6 \ 24 | yarn install --frozen-lockfile 25 | 26 | COPY . . 27 | 28 | FROM base AS run-build 29 | RUN yarn build 30 | 31 | FROM scratch AS build 32 | COPY --from=run-build /src/src / 33 | 34 | FROM base AS lint 35 | RUN yarn lint 36 | 37 | FROM base AS test 38 | CMD ["yarn", "test"] 39 | VOLUME ["/var/run/docker.sock"] 40 | COPY --from=docker /usr/local/bin/docker /usr/local/bin/com.docker.cli 41 | RUN yarn download-cli 42 | 43 | FROM base AS download-protos 44 | RUN yarn download-protos 45 | RUN ./protos.sh 46 | 47 | FROM scratch AS protos 48 | COPY --from=download-protos /src/src / 49 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | 2 | Apache License 3 | Version 2.0, January 2004 4 | https://www.apache.org/licenses/ 5 | 6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 7 | 8 | 1. Definitions. 9 | 10 | "License" shall mean the terms and conditions for use, reproduction, 11 | and distribution as defined by Sections 1 through 9 of this document. 12 | 13 | "Licensor" shall mean the copyright owner or entity authorized by 14 | the copyright owner that is granting the License. 15 | 16 | "Legal Entity" shall mean the union of the acting entity and all 17 | other entities that control, are controlled by, or are under common 18 | control with that entity. For the purposes of this definition, 19 | "control" means (i) the power, direct or indirect, to cause the 20 | direction or management of such entity, whether by contract or 21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 22 | outstanding shares, or (iii) beneficial ownership of such entity. 23 | 24 | "You" (or "Your") shall mean an individual or Legal Entity 25 | exercising permissions granted by this License. 26 | 27 | "Source" form shall mean the preferred form for making modifications, 28 | including but not limited to software source code, documentation 29 | source, and configuration files. 30 | 31 | "Object" form shall mean any form resulting from mechanical 32 | transformation or translation of a Source form, including but 33 | not limited to compiled object code, generated documentation, 34 | and conversions to other media types. 35 | 36 | "Work" shall mean the work of authorship, whether in Source or 37 | Object form, made available under the License, as indicated by a 38 | copyright notice that is included in or attached to the work 39 | (an example is provided in the Appendix below). 40 | 41 | "Derivative Works" shall mean any work, whether in Source or Object 42 | form, that is based on (or derived from) the Work and for which the 43 | editorial revisions, annotations, elaborations, or other modifications 44 | represent, as a whole, an original work of authorship. For the purposes 45 | of this License, Derivative Works shall not include works that remain 46 | separable from, or merely link (or bind by name) to the interfaces of, 47 | the Work and Derivative Works thereof. 48 | 49 | "Contribution" shall mean any work of authorship, including 50 | the original version of the Work and any modifications or additions 51 | to that Work or Derivative Works thereof, that is intentionally 52 | submitted to Licensor for inclusion in the Work by the copyright owner 53 | or by an individual or Legal Entity authorized to submit on behalf of 54 | the copyright owner. For the purposes of this definition, "submitted" 55 | means any form of electronic, verbal, or written communication sent 56 | to the Licensor or its representatives, including but not limited to 57 | communication on electronic mailing lists, source code control systems, 58 | and issue tracking systems that are managed by, or on behalf of, the 59 | Licensor for the purpose of discussing and improving the Work, but 60 | excluding communication that is conspicuously marked or otherwise 61 | designated in writing by the copyright owner as "Not a Contribution." 62 | 63 | "Contributor" shall mean Licensor and any individual or Legal Entity 64 | on behalf of whom a Contribution has been received by Licensor and 65 | subsequently incorporated within the Work. 66 | 67 | 2. Grant of Copyright License. Subject to the terms and conditions of 68 | this License, each Contributor hereby grants to You a perpetual, 69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 70 | copyright license to reproduce, prepare Derivative Works of, 71 | publicly display, publicly perform, sublicense, and distribute the 72 | Work and such Derivative Works in Source or Object form. 73 | 74 | 3. Grant of Patent License. Subject to the terms and conditions of 75 | this License, each Contributor hereby grants to You a perpetual, 76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 77 | (except as stated in this section) patent license to make, have made, 78 | use, offer to sell, sell, import, and otherwise transfer the Work, 79 | where such license applies only to those patent claims licensable 80 | by such Contributor that are necessarily infringed by their 81 | Contribution(s) alone or by combination of their Contribution(s) 82 | with the Work to which such Contribution(s) was submitted. If You 83 | institute patent litigation against any entity (including a 84 | cross-claim or counterclaim in a lawsuit) alleging that the Work 85 | or a Contribution incorporated within the Work constitutes direct 86 | or contributory patent infringement, then any patent licenses 87 | granted to You under this License for that Work shall terminate 88 | as of the date such litigation is filed. 89 | 90 | 4. Redistribution. You may reproduce and distribute copies of the 91 | Work or Derivative Works thereof in any medium, with or without 92 | modifications, and in Source or Object form, provided that You 93 | meet the following conditions: 94 | 95 | (a) You must give any other recipients of the Work or 96 | Derivative Works a copy of this License; and 97 | 98 | (b) You must cause any modified files to carry prominent notices 99 | stating that You changed the files; and 100 | 101 | (c) You must retain, in the Source form of any Derivative Works 102 | that You distribute, all copyright, patent, trademark, and 103 | attribution notices from the Source form of the Work, 104 | excluding those notices that do not pertain to any part of 105 | the Derivative Works; and 106 | 107 | (d) If the Work includes a "NOTICE" text file as part of its 108 | distribution, then any Derivative Works that You distribute must 109 | include a readable copy of the attribution notices contained 110 | within such NOTICE file, excluding those notices that do not 111 | pertain to any part of the Derivative Works, in at least one 112 | of the following places: within a NOTICE text file distributed 113 | as part of the Derivative Works; within the Source form or 114 | documentation, if provided along with the Derivative Works; or, 115 | within a display generated by the Derivative Works, if and 116 | wherever such third-party notices normally appear. The contents 117 | of the NOTICE file are for informational purposes only and 118 | do not modify the License. You may add Your own attribution 119 | notices within Derivative Works that You distribute, alongside 120 | or as an addendum to the NOTICE text from the Work, provided 121 | that such additional attribution notices cannot be construed 122 | as modifying the License. 123 | 124 | You may add Your own copyright statement to Your modifications and 125 | may provide additional or different license terms and conditions 126 | for use, reproduction, or distribution of Your modifications, or 127 | for any such Derivative Works as a whole, provided Your use, 128 | reproduction, and distribution of the Work otherwise complies with 129 | the conditions stated in this License. 130 | 131 | 5. Submission of Contributions. Unless You explicitly state otherwise, 132 | any Contribution intentionally submitted for inclusion in the Work 133 | by You to the Licensor shall be under the terms and conditions of 134 | this License, without any additional terms or conditions. 135 | Notwithstanding the above, nothing herein shall supersede or modify 136 | the terms of any separate license agreement you may have executed 137 | with Licensor regarding such Contributions. 138 | 139 | 6. Trademarks. This License does not grant permission to use the trade 140 | names, trademarks, service marks, or product names of the Licensor, 141 | except as required for reasonable and customary use in describing the 142 | origin of the Work and reproducing the content of the NOTICE file. 143 | 144 | 7. Disclaimer of Warranty. Unless required by applicable law or 145 | agreed to in writing, Licensor provides the Work (and each 146 | Contributor provides its Contributions) on an "AS IS" BASIS, 147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 148 | implied, including, without limitation, any warranties or conditions 149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 150 | PARTICULAR PURPOSE. You are solely responsible for determining the 151 | appropriateness of using or redistributing the Work and assume any 152 | risks associated with Your exercise of permissions under this License. 153 | 154 | 8. Limitation of Liability. In no event and under no legal theory, 155 | whether in tort (including negligence), contract, or otherwise, 156 | unless required by applicable law (such as deliberate and grossly 157 | negligent acts) or agreed to in writing, shall any Contributor be 158 | liable to You for damages, including any direct, indirect, special, 159 | incidental, or consequential damages of any character arising as a 160 | result of this License or out of the use or inability to use the 161 | Work (including but not limited to damages for loss of goodwill, 162 | work stoppage, computer failure or malfunction, or any and all 163 | other commercial damages or losses), even if such Contributor 164 | has been advised of the possibility of such damages. 165 | 166 | 9. Accepting Warranty or Additional Liability. While redistributing 167 | the Work or Derivative Works thereof, You may choose to offer, 168 | and charge a fee for, acceptance of support, warranty, indemnity, 169 | or other liability obligations and/or rights consistent with this 170 | License. However, in accepting such obligations, You may act only 171 | on Your own behalf and on Your sole responsibility, not on behalf 172 | of any other Contributor, and only if You agree to indemnify, 173 | defend, and hold each Contributor harmless for any liability 174 | incurred by, or claims asserted against, such Contributor by reason 175 | of your accepting any such warranty or additional liability. 176 | 177 | END OF TERMS AND CONDITIONS 178 | 179 | Copyright [yyyy] [name of copyright owner] 180 | 181 | Licensed under the Apache License, Version 2.0 (the "License"); 182 | you may not use this file except in compliance with the License. 183 | You may obtain a copy of the License at 184 | 185 | https://www.apache.org/licenses/LICENSE-2.0 186 | 187 | Unless required by applicable law or agreed to in writing, software 188 | distributed under the License is distributed on an "AS IS" BASIS, 189 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 190 | See the License for the specific language governing permissions and 191 | limitations under the License. 192 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | # Copyright 2020 Docker Node SDK authors 2 | 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | export DOCKER_BUILDKIT=1 16 | 17 | IMG?=node-sdk-test 18 | 19 | all: build 20 | 21 | .PHONY: build 22 | build: 23 | @docker build --target build --output ./src . 24 | 25 | .PHONY: test 26 | test: 27 | @docker build --target test --tag ${IMG} . 28 | @docker run --rm \ 29 | -v /var/run/docker.sock:/var/run/docker.sock \ 30 | ${IMG} 31 | @docker rmi ${IMG} 32 | 33 | .PHONY: lint 34 | lint: 35 | @docker build --target lint . 36 | 37 | .PHONY: protos 38 | protos: 39 | @docker build --target protos --output ./src . 40 | 41 | -------------------------------------------------------------------------------- /NOTICE: -------------------------------------------------------------------------------- 1 | Docker CLI JavaScript SDK 2 | Copyright 2020 Docker CLI JavaScript SDK authors 3 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Docker CLI JavaScript SDK 2 | 3 | ![CI](https://github.com/docker/node-sdk/workflows/CI/badge.svg) 4 | 5 | This repository contains the source for the Node SDK to work with the 6 | experimental Docker command line for Azure integration. The SDK is available as 7 | an [npm package](https://www.npmjs.com/package/@docker/sdk) 8 | 9 | > :warning: This SDK is in beta, expect things to change or break! 10 | 11 | ## Getting started 12 | 13 | Add `@docker/sdk` to the dependencies 14 | 15 | ```console 16 | yarn add @docker/sdk 17 | ``` 18 | 19 | You can then use the SDK: 20 | 21 | ```typescript 22 | // import the contexts client 23 | import { Contexts } from '@docker/sdk'; 24 | // import request and response classes 25 | import { ListRequest, ListResponse } from '@docker/sdk/contexts'; 26 | 27 | const client = new Contexts(); 28 | 29 | // Get the list of contexts 30 | client.list(new ListRequest(), (err: any, resp: ListResponse) => { 31 | if (err) { 32 | console.error(err); 33 | return; 34 | } 35 | 36 | const contexts = resp.getContextsList().map((c) => c.getName()); 37 | 38 | console.log(contexts); 39 | }); 40 | ``` 41 | 42 | When you run this code you should see a list of contexts, for example: 43 | 44 | ```console 45 | $ ts-node example.ts 46 | aci-context 47 | default 48 | ``` 49 | 50 | ## Examples 51 | 52 | You can find examples for how to use this SDK in the [examples](./examples) 53 | directory. 54 | -------------------------------------------------------------------------------- /babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: [ 3 | ['@babel/preset-env', { targets: { node: 'current' } }], 4 | '@babel/preset-typescript', 5 | ], 6 | }; 7 | -------------------------------------------------------------------------------- /examples/README.md: -------------------------------------------------------------------------------- 1 | # Examples 2 | 3 | This folder contains examples of how to use the Docker CLI JavaScript SDK. 4 | 5 | ## Prerequisites 6 | 7 | * [Node.js 10 or later](https://nodejs.org/en/download/) 8 | * [yarn](https://yarnpkg.com/getting-started/install) 9 | 10 | To run the examples you will need to have an ACI context as default and the 11 | Docker CLI API server running. You can do this by running: 12 | 13 | ```console 14 | $ docker context create aci-context aci 15 | $ docker context use aci-context 16 | $ docker serve --address unix:///tmp/backend.sock 17 | ``` 18 | 19 | To make sure that you have the example dependencies installed, use: 20 | 21 | ```console 22 | $ yarn 23 | ``` 24 | 25 | ## Running examples 26 | 27 | You can then run any an example from the root of this repository as follows: 28 | 29 | ```console 30 | $ npm run example examples/ 31 | ``` 32 | 33 | ## List of examples 34 | 35 | * [Listing contexts](./context-ls.ts) 36 | * [Listing containers](./ps.ts) 37 | * [Exec interactively into a container](./exec.ts) 38 | -------------------------------------------------------------------------------- /examples/compose.ts: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020 Docker CLI JavaScript SDK authors 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | import * as grpc from '@grpc/grpc-js'; 18 | 19 | import { Compose } from '../src'; 20 | import { ComposeStacksRequest, ComposeStacksResponse } from '../src/compose'; 21 | 22 | const client = new Compose(); 23 | 24 | client.stacks(new ComposeStacksRequest(), 25 | (error: grpc.ServiceError | null, res: ComposeStacksResponse) => { 26 | if (error != null) { 27 | throw error; 28 | } 29 | res.getStacksList().forEach(stack => { 30 | console.log(stack.getName() + " - " + stack.getStatus()) 31 | }); 32 | } 33 | ) 34 | -------------------------------------------------------------------------------- /examples/context-ls.ts: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020 Docker CLI JavaScript SDK authors 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | import * as grpc from '@grpc/grpc-js'; 18 | 19 | import { Contexts } from '../src'; 20 | import { ListRequest, ListResponse } from '../src/contexts'; 21 | 22 | const client = new Contexts(); 23 | client.list( 24 | new ListRequest(), 25 | (error: grpc.ServiceError | null, res: ListResponse) => { 26 | if (error != null) { 27 | throw error; 28 | } 29 | 30 | res.getContextsList().forEach((context) => { 31 | console.log( 32 | context.getName(), 33 | context.getDescription(), 34 | context.getContexttype(), 35 | context.getCurrent() ? '*' : '', 36 | context.hasDockerEndpoint()? 'host:' + context.getDockerEndpoint()?.getHost():'', 37 | context.hasEcsEndpoint()? context.getEcsEndpoint()?.getProfile():'', 38 | context.hasAciEndpoint()? context.getAciEndpoint()?.getResourceGroup():'', 39 | context.hasAciEndpoint()? context.getAciEndpoint()?.getRegion():'' 40 | ); 41 | }); 42 | } 43 | ); 44 | -------------------------------------------------------------------------------- /examples/exec.ts: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020 Docker CLI JavaScript SDK authors 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | import * as grpc from '@grpc/grpc-js'; 18 | import * as readline from 'readline'; 19 | 20 | import { ExecRequest, ExecResponse } from '../src/containers'; 21 | import { Containers, Streams } from '../src/index'; 22 | import { BytesMessage } from '../src/streams'; 23 | 24 | const containerId = process.argv[2]; 25 | 26 | const client = new Containers(); 27 | const streamsClient = new Streams(); 28 | 29 | // We ask for a stream first 30 | const stream = streamsClient.newStream(); 31 | 32 | stream.on('metadata', (metadata: grpc.Metadata) => { 33 | // the stream id is returned in a gRPC header, we get it 34 | const streamId = metadata.get('id')[0] as string; 35 | // Put the streamId into the exec request in order to 36 | // be able to have an interactive session 37 | const request = new ExecRequest() 38 | .setCommand('/bin/bash') 39 | .setStreamId(streamId) 40 | .setId(containerId) 41 | .setTty(true); 42 | 43 | client.exec(request, (err: grpc.ServiceError | null, _: ExecResponse) => { 44 | if (err != null) { 45 | throw err; 46 | } 47 | // The `exec` request finishes once the stream is closed, we can exit now. 48 | process.exit(); 49 | }); 50 | }); 51 | 52 | readline.emitKeypressEvents(process.stdin); 53 | process.stdin.setRawMode(true); 54 | 55 | // Send each keypress over the stream 56 | process.stdin.on('keypress', (_, key) => { 57 | const mess = new BytesMessage(); 58 | const a = new Uint8Array(key.sequence.length); 59 | for (let i = 0; i <= key.sequence.length; i++) { 60 | a[i] = key.sequence.charCodeAt(i); 61 | } 62 | mess.setValue(a); 63 | stream.write(mess.toAny()); 64 | }); 65 | 66 | // Print everything we receive on the stream 67 | stream.on('data', (chunk: any) => { 68 | const m = BytesMessage.fromAny(chunk); 69 | process.stdout.write(m.getValue()); 70 | }); 71 | -------------------------------------------------------------------------------- /examples/ps.ts: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020 Docker CLI JavaScript SDK authors 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | import * as grpc from '@grpc/grpc-js'; 18 | 19 | import { Containers } from '../src/index'; 20 | import { ListRequest, ListResponse } from '../src/containers'; 21 | 22 | const client = new Containers(); 23 | client.list( 24 | new ListRequest(), 25 | (error: grpc.ServiceError | null, response: ListResponse) => { 26 | if (error != null) { 27 | throw error; 28 | } 29 | const containers = response.getContainersList(); 30 | containers.forEach((container) => { 31 | console.log( 32 | container.getId(), 33 | container.getImage(), 34 | container.getStatus() 35 | ); 36 | }); 37 | } 38 | ); 39 | -------------------------------------------------------------------------------- /examples/start-stop.ts: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020 Docker CLI JavaScript SDK authors 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | import { Containers } from '../src'; 18 | import { StartRequest, StopRequest } from '../src/containers'; 19 | 20 | const containerClient = new Containers(); 21 | 22 | const start = (id: string) => { 23 | const startRequest = new StartRequest(); 24 | startRequest.setId(id); 25 | containerClient.start(startRequest, () => { 26 | console.log('started'); 27 | }); 28 | }; 29 | 30 | const stop = (id: string) => { 31 | const stopRequest = new StopRequest(); 32 | stopRequest.setId(id); 33 | containerClient.stop(stopRequest, () => { 34 | console.log('stopped'); 35 | }); 36 | }; 37 | 38 | if (process.argv[2] === 'start') { 39 | start(process.argv[3]); 40 | } 41 | 42 | if (process.argv[2] === 'stop') { 43 | stop(process.argv[3]); 44 | } 45 | -------------------------------------------------------------------------------- /examples/volume.ts: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020 The Authors 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | import * as grpc from '@grpc/grpc-js'; 18 | 19 | import { Volumes } from '../src/index'; 20 | import { 21 | AciVolumeCreateOptions, 22 | VolumesCreateRequest, 23 | VolumesCreateResponse, 24 | VolumesListRequest, 25 | VolumesListResponse, 26 | } from '../src/volumes'; 27 | 28 | const client = new Volumes(); 29 | 30 | client.volumesList( 31 | new VolumesListRequest(), 32 | (error: grpc.ServiceError | null, response: VolumesListResponse) => { 33 | if (error != null) { 34 | throw error; 35 | } 36 | response.getVolumesList().forEach((volume) => { 37 | console.log( 38 | volume.getId() + " : " + volume.getDescription() 39 | ); 40 | }); 41 | } 42 | ); 43 | 44 | let request = new VolumesCreateRequest(); 45 | request.setName("test-volume") 46 | let aciVolumeCreateOptions = new AciVolumeCreateOptions(); 47 | aciVolumeCreateOptions.setStorageAccount("mystorageaccount") 48 | request.setAciOption(aciVolumeCreateOptions) 49 | 50 | client.volumesCreate( 51 | request, 52 | (error: grpc.ServiceError | null, response: VolumesCreateResponse) => { 53 | if (error != null) { 54 | console.log(error.message); 55 | } else { 56 | console.log( 57 | response.getVolume()?.getId() 58 | ); 59 | } 60 | } 61 | ); 62 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.1.0", 3 | "license": "Apache-2.0", 4 | "main": "index.js", 5 | "typings": "index.d.ts", 6 | "engines": { 7 | "node": ">=10" 8 | }, 9 | "scripts": { 10 | "start": "rollup -w -c", 11 | "build": "tsc", 12 | "test": "jest", 13 | "test:watch": "jest --watch", 14 | "lint": "eslint src --ext .ts", 15 | "download-protos": "ts-node scripts/download-protos.ts", 16 | "download-cli": "ts-node scripts/download-cli.ts", 17 | "copy": "cp -f package.json README.md src", 18 | "example": "ts-node" 19 | }, 20 | "prettier": { 21 | "printWidth": 80, 22 | "semi": true, 23 | "singleQuote": true, 24 | "trailingComma": "es5" 25 | }, 26 | "name": "@docker/sdk", 27 | "author": "Docker Inc.", 28 | "devDependencies": { 29 | "@babel/core": "^7.10.2", 30 | "@babel/preset-env": "^7.10.2", 31 | "@babel/preset-typescript": "^7.10.1", 32 | "@octokit/request": "^5.4.5", 33 | "@octokit/rest": "^18.0.0", 34 | "@types/google-protobuf": "^3.7.2", 35 | "@types/node": "^14.0.13", 36 | "@types/tar": "^4.0.3", 37 | "@typescript-eslint/eslint-plugin": "^3.1.0", 38 | "@typescript-eslint/parser": "^3.1.0", 39 | "eslint": "^7.2.0", 40 | "eslint-config-airbnb-base": "^14.1.0", 41 | "eslint-plugin-import": "^2.20.2", 42 | "grpc-tools": "^1.9.0", 43 | "grpc_tools_node_protoc_ts": "^4.0.0", 44 | "jest": "^26.0.1", 45 | "prettier": "^2.0.5", 46 | "tar": "^6.0.5", 47 | "ts-node": "^8.10.2", 48 | "typescript": "^3.9.5" 49 | }, 50 | "dependencies": { 51 | "@grpc/grpc-js": "^1.0.5", 52 | "google-auth-library": "^6.1.3", 53 | "google-protobuf": "^3.12.2", 54 | "tslib": "^2.0.0" 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /protos.sh: -------------------------------------------------------------------------------- 1 | # Copyright 2020 Docker CLI JavaScript SDK authors 2 | 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | #!/bin/bash 16 | 17 | node_modules/.bin/grpc_tools_node_protoc \ 18 | --js_out=import_style=commonjs,binary:./src/protos \ 19 | --grpc_out=grpc_js:./src/protos \ 20 | -I src/protos \ 21 | src/protos/contexts/v1/*.proto \ 22 | src/protos/containers/v1/*.proto \ 23 | src/protos/compose/v1/*.proto \ 24 | src/protos/volumes/v1/*.proto \ 25 | src/protos/streams/v1/*.proto 26 | 27 | # generate d.ts codes 28 | node_modules/.bin/grpc_tools_node_protoc \ 29 | --plugin=protoc-gen-ts=./node_modules/.bin/protoc-gen-ts \ 30 | --ts_out=generate_package_definition:./src/protos \ 31 | -I src/protos \ 32 | src/protos/contexts/v1/*.proto \ 33 | src/protos/containers/v1/*.proto \ 34 | src/protos/compose/v1/*.proto \ 35 | src/protos/volumes/v1/*.proto \ 36 | src/protos/streams/v1/*.proto 37 | -------------------------------------------------------------------------------- /publish.sh: -------------------------------------------------------------------------------- 1 | # Copyright 2020 Docker CLI JavaScript SDK authors 2 | 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | #!/bin/bash 16 | 17 | set -e 18 | 19 | yarn install 20 | yarn build 21 | yarn run copy 22 | cd src 23 | yarn publish --no-git-tag-version --new-version $1 24 | -------------------------------------------------------------------------------- /scripts/download-cli.ts: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020 Docker CLI JavaScript SDK authors 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | import * as fs from 'fs'; 18 | import * as path from 'path'; 19 | import * as tar from 'tar'; 20 | import { Octokit } from '@octokit/rest'; 21 | const { request } = require('@octokit/request'); 22 | 23 | const download = async () => { 24 | const octokit = new Octokit({ 25 | auth: process.env.DOCKER_GITHUB_TOKEN, 26 | }); 27 | 28 | const asdf = new Octokit(); 29 | 30 | const latestReleases = await octokit.repos.listReleases({ 31 | owner: 'docker', 32 | repo: 'compose-cli', 33 | page: 1, 34 | per_page: 1, 35 | }); 36 | 37 | if (latestReleases.data.length !== 1) { 38 | throw new Error('Found more than one release'); 39 | } 40 | 41 | const latestRelease = latestReleases.data[0]; 42 | 43 | console.log(`Found release ${latestRelease.name}`); 44 | 45 | const linuxAsset = latestRelease.assets.find( 46 | (asset) => asset.name == 'docker-linux-amd64.tar.gz' 47 | ); 48 | 49 | if (!linuxAsset) { 50 | throw new Error('linux asset not found'); 51 | } 52 | 53 | const options = asdf.repos.getReleaseAsset.endpoint.merge({ 54 | headers: { 55 | Accept: 'application/octet-stream', 56 | }, 57 | owner: 'docker', 58 | repo: 'compose-cli', 59 | asset_id: linuxAsset.id, 60 | }); 61 | 62 | const response = await request(options); 63 | 64 | const binPath = "docker"; 65 | const tarPath = linuxAsset.name; 66 | const file = fs.createWriteStream(tarPath); 67 | 68 | file.write(Buffer.from(response.data)); 69 | console.log(`downloaded ${tarPath}`); 70 | file.end(() => { 71 | tar.x( 72 | { 73 | file: tarPath, 74 | strip:1 75 | }, 76 | ).then(() => { 77 | console.log(`extracted ${tarPath}`); 78 | fs.chmodSync(path.resolve(binPath), 755); 79 | console.log(`updated ${binPath} as executable`); 80 | }) 81 | }); 82 | }; 83 | 84 | (async function () { 85 | try { 86 | await download(); 87 | } catch (e) { 88 | console.log(e); 89 | process.exit(1); 90 | } 91 | })(); 92 | -------------------------------------------------------------------------------- /scripts/download-protos.ts: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020 Docker CLI JavaScript SDK authors 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | import * as fs from 'fs'; 18 | import * as path from 'path'; 19 | import { Readable } from 'stream'; 20 | import { Octokit } from '@octokit/rest'; 21 | 22 | const octokit = new Octokit({}); 23 | 24 | const get = async (p: string) => { 25 | try { 26 | const response = await octokit.repos.getContent({ 27 | owner: 'docker', 28 | repo: 'compose-cli', 29 | path: p, 30 | }); 31 | if (Array.isArray(response.data)) { 32 | for (let n of response.data) { 33 | await get(n.path); 34 | } 35 | return; 36 | } 37 | 38 | if (p.endsWith('.proto')) { 39 | const targetFile = response.data.path.replace("cli/server/protos", "protos") 40 | console.log(`Downloading ${response.data.path} to ${targetFile}`); 41 | const dir = path.dirname(targetFile); 42 | fs.mkdirSync(`src/${dir}`, { recursive: true }); 43 | const buffer = Buffer.from(response.data.content, 'base64'); 44 | const data = Readable.from(buffer.toString('ascii')); 45 | data.pipe(fs.createWriteStream(`src/${targetFile}`)); 46 | } 47 | } catch (e) { 48 | console.error(e); 49 | } 50 | }; 51 | 52 | (async function () { 53 | get('cli/server/protos'); 54 | })(); 55 | -------------------------------------------------------------------------------- /src/compose.ts: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020 Docker CLI JavaScript SDK authors 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | export * from './protos/compose/v1/compose_pb'; 18 | -------------------------------------------------------------------------------- /src/containers.ts: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020 Docker CLI JavaScript SDK authors 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | export * from './protos/containers/v1/containers_pb'; 18 | -------------------------------------------------------------------------------- /src/contexts.ts: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020 Docker CLI JavaScript SDK authors 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | export * from './protos/contexts/v1/contexts_pb'; 18 | -------------------------------------------------------------------------------- /src/index.ts: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020 Docker CLI JavaScript SDK authors 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | import { homedir, platform } from 'os'; 18 | 19 | import { credentials } from '@grpc/grpc-js'; 20 | import { ContainersClient } from './protos/containers/v1/containers_grpc_pb'; 21 | import { VolumesClient } from './protos/volumes/v1/volumes_grpc_pb'; 22 | import { ContextsClient } from './protos/contexts/v1/contexts_grpc_pb'; 23 | import { ComposeClient } from './protos/compose/v1/compose_grpc_pb'; 24 | import { StreamingClient } from './protos/streams/v1/streams_grpc_pb'; 25 | 26 | let addr = 'unix:////./pipe/dockerCliApi'; 27 | if (platform() !== 'win32') { 28 | const homeDir = homedir(); 29 | addr = `unix://${homeDir}/.docker/run/docker-cli-api.sock`; 30 | } 31 | export class Containers extends ContainersClient { 32 | constructor(address: string = addr) { 33 | super(address, credentials.createInsecure()); 34 | } 35 | } 36 | 37 | export class Volumes extends VolumesClient { 38 | constructor(address: string = addr) { 39 | super(address, credentials.createInsecure()); 40 | } 41 | } 42 | 43 | export class Contexts extends ContextsClient { 44 | constructor(address: string = addr) { 45 | super(address, credentials.createInsecure()); 46 | } 47 | } 48 | 49 | export class Compose extends ComposeClient { 50 | constructor(address: string = addr) { 51 | super(address, credentials.createInsecure()); 52 | } 53 | } 54 | 55 | export class Streams extends StreamingClient { 56 | constructor(address: string = addr) { 57 | super(address, credentials.createInsecure()); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /src/protos/compose/v1/compose.proto: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2020 Docker Compose CLI authors 3 | 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | syntax = "proto3"; 17 | 18 | package com.docker.api.protos.compose.v1; 19 | 20 | option go_package = "github.com/docker/compose-cli/cli/server/protos/compose/v1;v1"; 21 | 22 | service Compose { 23 | rpc Up(ComposeUpRequest) returns (ComposeUpResponse); 24 | rpc Down(ComposeDownRequest) returns (ComposeDownResponse); 25 | rpc Stacks(ComposeStacksRequest)returns (ComposeStacksResponse); 26 | rpc Services(ComposeServicesRequest)returns (ComposeServicesResponse); 27 | } 28 | 29 | message ComposeUpRequest { 30 | string projectName = 1; 31 | string workDir = 2; 32 | repeated string files = 3; 33 | } 34 | 35 | message ComposeUpResponse { 36 | string projectName = 1; 37 | } 38 | 39 | message ComposeDownRequest { 40 | string projectName = 1; 41 | string workDir = 2; 42 | repeated string files = 3; 43 | } 44 | 45 | message ComposeDownResponse { 46 | string projectName = 1; 47 | } 48 | 49 | message ComposeStacksRequest { 50 | string projectName = 1; 51 | bool all = 2; 52 | } 53 | 54 | message ComposeStacksResponse { 55 | repeated Stack stacks = 1; 56 | } 57 | 58 | message Stack { 59 | string id = 1; 60 | string name = 2; 61 | string status = 3; 62 | string reason = 4; 63 | } 64 | 65 | message ComposeServicesRequest { 66 | string projectName = 1; 67 | string workDir = 2; 68 | repeated string files = 3; 69 | } 70 | 71 | message ComposeServicesResponse { 72 | repeated Service services = 1; 73 | } 74 | 75 | message Service { 76 | string id = 1; 77 | string name = 2; 78 | uint32 replicas = 3; 79 | uint32 desired = 4; 80 | repeated string Ports = 5; 81 | } 82 | -------------------------------------------------------------------------------- /src/protos/compose/v1/compose_grpc_pb.d.ts: -------------------------------------------------------------------------------- 1 | // package: com.docker.api.protos.compose.v1 2 | // file: compose/v1/compose.proto 3 | 4 | /* tslint:disable */ 5 | /* eslint-disable */ 6 | 7 | import * as grpc from "@grpc/grpc-js"; 8 | import {handleClientStreamingCall} from "@grpc/grpc-js/build/src/server-call"; 9 | import * as compose_v1_compose_pb from "../../compose/v1/compose_pb"; 10 | 11 | interface IComposeService extends grpc.ServiceDefinition { 12 | up: IComposeService_IUp; 13 | down: IComposeService_IDown; 14 | stacks: IComposeService_IStacks; 15 | services: IComposeService_IServices; 16 | } 17 | 18 | interface IComposeService_IUp extends grpc.MethodDefinition { 19 | path: string; // "/com.docker.api.protos.compose.v1.Compose/Up" 20 | requestStream: false; 21 | responseStream: false; 22 | requestSerialize: grpc.serialize; 23 | requestDeserialize: grpc.deserialize; 24 | responseSerialize: grpc.serialize; 25 | responseDeserialize: grpc.deserialize; 26 | } 27 | interface IComposeService_IDown extends grpc.MethodDefinition { 28 | path: string; // "/com.docker.api.protos.compose.v1.Compose/Down" 29 | requestStream: false; 30 | responseStream: false; 31 | requestSerialize: grpc.serialize; 32 | requestDeserialize: grpc.deserialize; 33 | responseSerialize: grpc.serialize; 34 | responseDeserialize: grpc.deserialize; 35 | } 36 | interface IComposeService_IStacks extends grpc.MethodDefinition { 37 | path: string; // "/com.docker.api.protos.compose.v1.Compose/Stacks" 38 | requestStream: false; 39 | responseStream: false; 40 | requestSerialize: grpc.serialize; 41 | requestDeserialize: grpc.deserialize; 42 | responseSerialize: grpc.serialize; 43 | responseDeserialize: grpc.deserialize; 44 | } 45 | interface IComposeService_IServices extends grpc.MethodDefinition { 46 | path: string; // "/com.docker.api.protos.compose.v1.Compose/Services" 47 | requestStream: false; 48 | responseStream: false; 49 | requestSerialize: grpc.serialize; 50 | requestDeserialize: grpc.deserialize; 51 | responseSerialize: grpc.serialize; 52 | responseDeserialize: grpc.deserialize; 53 | } 54 | 55 | export const ComposeService: IComposeService; 56 | 57 | export interface IComposeServer { 58 | up: grpc.handleUnaryCall; 59 | down: grpc.handleUnaryCall; 60 | stacks: grpc.handleUnaryCall; 61 | services: grpc.handleUnaryCall; 62 | } 63 | 64 | export interface IComposeClient { 65 | up(request: compose_v1_compose_pb.ComposeUpRequest, callback: (error: grpc.ServiceError | null, response: compose_v1_compose_pb.ComposeUpResponse) => void): grpc.ClientUnaryCall; 66 | up(request: compose_v1_compose_pb.ComposeUpRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: compose_v1_compose_pb.ComposeUpResponse) => void): grpc.ClientUnaryCall; 67 | up(request: compose_v1_compose_pb.ComposeUpRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: compose_v1_compose_pb.ComposeUpResponse) => void): grpc.ClientUnaryCall; 68 | down(request: compose_v1_compose_pb.ComposeDownRequest, callback: (error: grpc.ServiceError | null, response: compose_v1_compose_pb.ComposeDownResponse) => void): grpc.ClientUnaryCall; 69 | down(request: compose_v1_compose_pb.ComposeDownRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: compose_v1_compose_pb.ComposeDownResponse) => void): grpc.ClientUnaryCall; 70 | down(request: compose_v1_compose_pb.ComposeDownRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: compose_v1_compose_pb.ComposeDownResponse) => void): grpc.ClientUnaryCall; 71 | stacks(request: compose_v1_compose_pb.ComposeStacksRequest, callback: (error: grpc.ServiceError | null, response: compose_v1_compose_pb.ComposeStacksResponse) => void): grpc.ClientUnaryCall; 72 | stacks(request: compose_v1_compose_pb.ComposeStacksRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: compose_v1_compose_pb.ComposeStacksResponse) => void): grpc.ClientUnaryCall; 73 | stacks(request: compose_v1_compose_pb.ComposeStacksRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: compose_v1_compose_pb.ComposeStacksResponse) => void): grpc.ClientUnaryCall; 74 | services(request: compose_v1_compose_pb.ComposeServicesRequest, callback: (error: grpc.ServiceError | null, response: compose_v1_compose_pb.ComposeServicesResponse) => void): grpc.ClientUnaryCall; 75 | services(request: compose_v1_compose_pb.ComposeServicesRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: compose_v1_compose_pb.ComposeServicesResponse) => void): grpc.ClientUnaryCall; 76 | services(request: compose_v1_compose_pb.ComposeServicesRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: compose_v1_compose_pb.ComposeServicesResponse) => void): grpc.ClientUnaryCall; 77 | } 78 | 79 | export class ComposeClient extends grpc.Client implements IComposeClient { 80 | constructor(address: string, credentials: grpc.ChannelCredentials, options?: object); 81 | public up(request: compose_v1_compose_pb.ComposeUpRequest, callback: (error: grpc.ServiceError | null, response: compose_v1_compose_pb.ComposeUpResponse) => void): grpc.ClientUnaryCall; 82 | public up(request: compose_v1_compose_pb.ComposeUpRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: compose_v1_compose_pb.ComposeUpResponse) => void): grpc.ClientUnaryCall; 83 | public up(request: compose_v1_compose_pb.ComposeUpRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: compose_v1_compose_pb.ComposeUpResponse) => void): grpc.ClientUnaryCall; 84 | public down(request: compose_v1_compose_pb.ComposeDownRequest, callback: (error: grpc.ServiceError | null, response: compose_v1_compose_pb.ComposeDownResponse) => void): grpc.ClientUnaryCall; 85 | public down(request: compose_v1_compose_pb.ComposeDownRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: compose_v1_compose_pb.ComposeDownResponse) => void): grpc.ClientUnaryCall; 86 | public down(request: compose_v1_compose_pb.ComposeDownRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: compose_v1_compose_pb.ComposeDownResponse) => void): grpc.ClientUnaryCall; 87 | public stacks(request: compose_v1_compose_pb.ComposeStacksRequest, callback: (error: grpc.ServiceError | null, response: compose_v1_compose_pb.ComposeStacksResponse) => void): grpc.ClientUnaryCall; 88 | public stacks(request: compose_v1_compose_pb.ComposeStacksRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: compose_v1_compose_pb.ComposeStacksResponse) => void): grpc.ClientUnaryCall; 89 | public stacks(request: compose_v1_compose_pb.ComposeStacksRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: compose_v1_compose_pb.ComposeStacksResponse) => void): grpc.ClientUnaryCall; 90 | public services(request: compose_v1_compose_pb.ComposeServicesRequest, callback: (error: grpc.ServiceError | null, response: compose_v1_compose_pb.ComposeServicesResponse) => void): grpc.ClientUnaryCall; 91 | public services(request: compose_v1_compose_pb.ComposeServicesRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: compose_v1_compose_pb.ComposeServicesResponse) => void): grpc.ClientUnaryCall; 92 | public services(request: compose_v1_compose_pb.ComposeServicesRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: compose_v1_compose_pb.ComposeServicesResponse) => void): grpc.ClientUnaryCall; 93 | } 94 | -------------------------------------------------------------------------------- /src/protos/compose/v1/compose_grpc_pb.js: -------------------------------------------------------------------------------- 1 | // GENERATED CODE -- DO NOT EDIT! 2 | 3 | // Original file comments: 4 | // 5 | // Copyright 2020 Docker Compose CLI authors 6 | // 7 | // Licensed under the Apache License, Version 2.0 (the "License"); 8 | // you may not use this file except in compliance with the License. 9 | // You may obtain a copy of the License at 10 | // 11 | // http://www.apache.org/licenses/LICENSE-2.0 12 | // 13 | // Unless required by applicable law or agreed to in writing, software 14 | // distributed under the License is distributed on an "AS IS" BASIS, 15 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | // See the License for the specific language governing permissions and 17 | // limitations under the License. 18 | // 19 | 'use strict'; 20 | var grpc = require('@grpc/grpc-js'); 21 | var compose_v1_compose_pb = require('../../compose/v1/compose_pb.js'); 22 | 23 | function serialize_com_docker_api_protos_compose_v1_ComposeDownRequest(arg) { 24 | if (!(arg instanceof compose_v1_compose_pb.ComposeDownRequest)) { 25 | throw new Error('Expected argument of type com.docker.api.protos.compose.v1.ComposeDownRequest'); 26 | } 27 | return Buffer.from(arg.serializeBinary()); 28 | } 29 | 30 | function deserialize_com_docker_api_protos_compose_v1_ComposeDownRequest(buffer_arg) { 31 | return compose_v1_compose_pb.ComposeDownRequest.deserializeBinary(new Uint8Array(buffer_arg)); 32 | } 33 | 34 | function serialize_com_docker_api_protos_compose_v1_ComposeDownResponse(arg) { 35 | if (!(arg instanceof compose_v1_compose_pb.ComposeDownResponse)) { 36 | throw new Error('Expected argument of type com.docker.api.protos.compose.v1.ComposeDownResponse'); 37 | } 38 | return Buffer.from(arg.serializeBinary()); 39 | } 40 | 41 | function deserialize_com_docker_api_protos_compose_v1_ComposeDownResponse(buffer_arg) { 42 | return compose_v1_compose_pb.ComposeDownResponse.deserializeBinary(new Uint8Array(buffer_arg)); 43 | } 44 | 45 | function serialize_com_docker_api_protos_compose_v1_ComposeServicesRequest(arg) { 46 | if (!(arg instanceof compose_v1_compose_pb.ComposeServicesRequest)) { 47 | throw new Error('Expected argument of type com.docker.api.protos.compose.v1.ComposeServicesRequest'); 48 | } 49 | return Buffer.from(arg.serializeBinary()); 50 | } 51 | 52 | function deserialize_com_docker_api_protos_compose_v1_ComposeServicesRequest(buffer_arg) { 53 | return compose_v1_compose_pb.ComposeServicesRequest.deserializeBinary(new Uint8Array(buffer_arg)); 54 | } 55 | 56 | function serialize_com_docker_api_protos_compose_v1_ComposeServicesResponse(arg) { 57 | if (!(arg instanceof compose_v1_compose_pb.ComposeServicesResponse)) { 58 | throw new Error('Expected argument of type com.docker.api.protos.compose.v1.ComposeServicesResponse'); 59 | } 60 | return Buffer.from(arg.serializeBinary()); 61 | } 62 | 63 | function deserialize_com_docker_api_protos_compose_v1_ComposeServicesResponse(buffer_arg) { 64 | return compose_v1_compose_pb.ComposeServicesResponse.deserializeBinary(new Uint8Array(buffer_arg)); 65 | } 66 | 67 | function serialize_com_docker_api_protos_compose_v1_ComposeStacksRequest(arg) { 68 | if (!(arg instanceof compose_v1_compose_pb.ComposeStacksRequest)) { 69 | throw new Error('Expected argument of type com.docker.api.protos.compose.v1.ComposeStacksRequest'); 70 | } 71 | return Buffer.from(arg.serializeBinary()); 72 | } 73 | 74 | function deserialize_com_docker_api_protos_compose_v1_ComposeStacksRequest(buffer_arg) { 75 | return compose_v1_compose_pb.ComposeStacksRequest.deserializeBinary(new Uint8Array(buffer_arg)); 76 | } 77 | 78 | function serialize_com_docker_api_protos_compose_v1_ComposeStacksResponse(arg) { 79 | if (!(arg instanceof compose_v1_compose_pb.ComposeStacksResponse)) { 80 | throw new Error('Expected argument of type com.docker.api.protos.compose.v1.ComposeStacksResponse'); 81 | } 82 | return Buffer.from(arg.serializeBinary()); 83 | } 84 | 85 | function deserialize_com_docker_api_protos_compose_v1_ComposeStacksResponse(buffer_arg) { 86 | return compose_v1_compose_pb.ComposeStacksResponse.deserializeBinary(new Uint8Array(buffer_arg)); 87 | } 88 | 89 | function serialize_com_docker_api_protos_compose_v1_ComposeUpRequest(arg) { 90 | if (!(arg instanceof compose_v1_compose_pb.ComposeUpRequest)) { 91 | throw new Error('Expected argument of type com.docker.api.protos.compose.v1.ComposeUpRequest'); 92 | } 93 | return Buffer.from(arg.serializeBinary()); 94 | } 95 | 96 | function deserialize_com_docker_api_protos_compose_v1_ComposeUpRequest(buffer_arg) { 97 | return compose_v1_compose_pb.ComposeUpRequest.deserializeBinary(new Uint8Array(buffer_arg)); 98 | } 99 | 100 | function serialize_com_docker_api_protos_compose_v1_ComposeUpResponse(arg) { 101 | if (!(arg instanceof compose_v1_compose_pb.ComposeUpResponse)) { 102 | throw new Error('Expected argument of type com.docker.api.protos.compose.v1.ComposeUpResponse'); 103 | } 104 | return Buffer.from(arg.serializeBinary()); 105 | } 106 | 107 | function deserialize_com_docker_api_protos_compose_v1_ComposeUpResponse(buffer_arg) { 108 | return compose_v1_compose_pb.ComposeUpResponse.deserializeBinary(new Uint8Array(buffer_arg)); 109 | } 110 | 111 | 112 | var ComposeService = exports.ComposeService = { 113 | up: { 114 | path: '/com.docker.api.protos.compose.v1.Compose/Up', 115 | requestStream: false, 116 | responseStream: false, 117 | requestType: compose_v1_compose_pb.ComposeUpRequest, 118 | responseType: compose_v1_compose_pb.ComposeUpResponse, 119 | requestSerialize: serialize_com_docker_api_protos_compose_v1_ComposeUpRequest, 120 | requestDeserialize: deserialize_com_docker_api_protos_compose_v1_ComposeUpRequest, 121 | responseSerialize: serialize_com_docker_api_protos_compose_v1_ComposeUpResponse, 122 | responseDeserialize: deserialize_com_docker_api_protos_compose_v1_ComposeUpResponse, 123 | }, 124 | down: { 125 | path: '/com.docker.api.protos.compose.v1.Compose/Down', 126 | requestStream: false, 127 | responseStream: false, 128 | requestType: compose_v1_compose_pb.ComposeDownRequest, 129 | responseType: compose_v1_compose_pb.ComposeDownResponse, 130 | requestSerialize: serialize_com_docker_api_protos_compose_v1_ComposeDownRequest, 131 | requestDeserialize: deserialize_com_docker_api_protos_compose_v1_ComposeDownRequest, 132 | responseSerialize: serialize_com_docker_api_protos_compose_v1_ComposeDownResponse, 133 | responseDeserialize: deserialize_com_docker_api_protos_compose_v1_ComposeDownResponse, 134 | }, 135 | stacks: { 136 | path: '/com.docker.api.protos.compose.v1.Compose/Stacks', 137 | requestStream: false, 138 | responseStream: false, 139 | requestType: compose_v1_compose_pb.ComposeStacksRequest, 140 | responseType: compose_v1_compose_pb.ComposeStacksResponse, 141 | requestSerialize: serialize_com_docker_api_protos_compose_v1_ComposeStacksRequest, 142 | requestDeserialize: deserialize_com_docker_api_protos_compose_v1_ComposeStacksRequest, 143 | responseSerialize: serialize_com_docker_api_protos_compose_v1_ComposeStacksResponse, 144 | responseDeserialize: deserialize_com_docker_api_protos_compose_v1_ComposeStacksResponse, 145 | }, 146 | services: { 147 | path: '/com.docker.api.protos.compose.v1.Compose/Services', 148 | requestStream: false, 149 | responseStream: false, 150 | requestType: compose_v1_compose_pb.ComposeServicesRequest, 151 | responseType: compose_v1_compose_pb.ComposeServicesResponse, 152 | requestSerialize: serialize_com_docker_api_protos_compose_v1_ComposeServicesRequest, 153 | requestDeserialize: deserialize_com_docker_api_protos_compose_v1_ComposeServicesRequest, 154 | responseSerialize: serialize_com_docker_api_protos_compose_v1_ComposeServicesResponse, 155 | responseDeserialize: deserialize_com_docker_api_protos_compose_v1_ComposeServicesResponse, 156 | }, 157 | }; 158 | 159 | exports.ComposeClient = grpc.makeGenericClientConstructor(ComposeService); 160 | -------------------------------------------------------------------------------- /src/protos/compose/v1/compose_pb.d.ts: -------------------------------------------------------------------------------- 1 | // package: com.docker.api.protos.compose.v1 2 | // file: compose/v1/compose.proto 3 | 4 | /* tslint:disable */ 5 | /* eslint-disable */ 6 | 7 | import * as jspb from "google-protobuf"; 8 | 9 | export class ComposeUpRequest extends jspb.Message { 10 | getProjectname(): string; 11 | setProjectname(value: string): ComposeUpRequest; 12 | 13 | getWorkdir(): string; 14 | setWorkdir(value: string): ComposeUpRequest; 15 | 16 | clearFilesList(): void; 17 | getFilesList(): Array; 18 | setFilesList(value: Array): ComposeUpRequest; 19 | addFiles(value: string, index?: number): string; 20 | 21 | 22 | serializeBinary(): Uint8Array; 23 | toObject(includeInstance?: boolean): ComposeUpRequest.AsObject; 24 | static toObject(includeInstance: boolean, msg: ComposeUpRequest): ComposeUpRequest.AsObject; 25 | static extensions: {[key: number]: jspb.ExtensionFieldInfo}; 26 | static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; 27 | static serializeBinaryToWriter(message: ComposeUpRequest, writer: jspb.BinaryWriter): void; 28 | static deserializeBinary(bytes: Uint8Array): ComposeUpRequest; 29 | static deserializeBinaryFromReader(message: ComposeUpRequest, reader: jspb.BinaryReader): ComposeUpRequest; 30 | } 31 | 32 | export namespace ComposeUpRequest { 33 | export type AsObject = { 34 | projectname: string, 35 | workdir: string, 36 | filesList: Array, 37 | } 38 | } 39 | 40 | export class ComposeUpResponse extends jspb.Message { 41 | getProjectname(): string; 42 | setProjectname(value: string): ComposeUpResponse; 43 | 44 | 45 | serializeBinary(): Uint8Array; 46 | toObject(includeInstance?: boolean): ComposeUpResponse.AsObject; 47 | static toObject(includeInstance: boolean, msg: ComposeUpResponse): ComposeUpResponse.AsObject; 48 | static extensions: {[key: number]: jspb.ExtensionFieldInfo}; 49 | static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; 50 | static serializeBinaryToWriter(message: ComposeUpResponse, writer: jspb.BinaryWriter): void; 51 | static deserializeBinary(bytes: Uint8Array): ComposeUpResponse; 52 | static deserializeBinaryFromReader(message: ComposeUpResponse, reader: jspb.BinaryReader): ComposeUpResponse; 53 | } 54 | 55 | export namespace ComposeUpResponse { 56 | export type AsObject = { 57 | projectname: string, 58 | } 59 | } 60 | 61 | export class ComposeDownRequest extends jspb.Message { 62 | getProjectname(): string; 63 | setProjectname(value: string): ComposeDownRequest; 64 | 65 | getWorkdir(): string; 66 | setWorkdir(value: string): ComposeDownRequest; 67 | 68 | clearFilesList(): void; 69 | getFilesList(): Array; 70 | setFilesList(value: Array): ComposeDownRequest; 71 | addFiles(value: string, index?: number): string; 72 | 73 | 74 | serializeBinary(): Uint8Array; 75 | toObject(includeInstance?: boolean): ComposeDownRequest.AsObject; 76 | static toObject(includeInstance: boolean, msg: ComposeDownRequest): ComposeDownRequest.AsObject; 77 | static extensions: {[key: number]: jspb.ExtensionFieldInfo}; 78 | static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; 79 | static serializeBinaryToWriter(message: ComposeDownRequest, writer: jspb.BinaryWriter): void; 80 | static deserializeBinary(bytes: Uint8Array): ComposeDownRequest; 81 | static deserializeBinaryFromReader(message: ComposeDownRequest, reader: jspb.BinaryReader): ComposeDownRequest; 82 | } 83 | 84 | export namespace ComposeDownRequest { 85 | export type AsObject = { 86 | projectname: string, 87 | workdir: string, 88 | filesList: Array, 89 | } 90 | } 91 | 92 | export class ComposeDownResponse extends jspb.Message { 93 | getProjectname(): string; 94 | setProjectname(value: string): ComposeDownResponse; 95 | 96 | 97 | serializeBinary(): Uint8Array; 98 | toObject(includeInstance?: boolean): ComposeDownResponse.AsObject; 99 | static toObject(includeInstance: boolean, msg: ComposeDownResponse): ComposeDownResponse.AsObject; 100 | static extensions: {[key: number]: jspb.ExtensionFieldInfo}; 101 | static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; 102 | static serializeBinaryToWriter(message: ComposeDownResponse, writer: jspb.BinaryWriter): void; 103 | static deserializeBinary(bytes: Uint8Array): ComposeDownResponse; 104 | static deserializeBinaryFromReader(message: ComposeDownResponse, reader: jspb.BinaryReader): ComposeDownResponse; 105 | } 106 | 107 | export namespace ComposeDownResponse { 108 | export type AsObject = { 109 | projectname: string, 110 | } 111 | } 112 | 113 | export class ComposeStacksRequest extends jspb.Message { 114 | getProjectname(): string; 115 | setProjectname(value: string): ComposeStacksRequest; 116 | 117 | getAll(): boolean; 118 | setAll(value: boolean): ComposeStacksRequest; 119 | 120 | 121 | serializeBinary(): Uint8Array; 122 | toObject(includeInstance?: boolean): ComposeStacksRequest.AsObject; 123 | static toObject(includeInstance: boolean, msg: ComposeStacksRequest): ComposeStacksRequest.AsObject; 124 | static extensions: {[key: number]: jspb.ExtensionFieldInfo}; 125 | static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; 126 | static serializeBinaryToWriter(message: ComposeStacksRequest, writer: jspb.BinaryWriter): void; 127 | static deserializeBinary(bytes: Uint8Array): ComposeStacksRequest; 128 | static deserializeBinaryFromReader(message: ComposeStacksRequest, reader: jspb.BinaryReader): ComposeStacksRequest; 129 | } 130 | 131 | export namespace ComposeStacksRequest { 132 | export type AsObject = { 133 | projectname: string, 134 | all: boolean, 135 | } 136 | } 137 | 138 | export class ComposeStacksResponse extends jspb.Message { 139 | clearStacksList(): void; 140 | getStacksList(): Array; 141 | setStacksList(value: Array): ComposeStacksResponse; 142 | addStacks(value?: Stack, index?: number): Stack; 143 | 144 | 145 | serializeBinary(): Uint8Array; 146 | toObject(includeInstance?: boolean): ComposeStacksResponse.AsObject; 147 | static toObject(includeInstance: boolean, msg: ComposeStacksResponse): ComposeStacksResponse.AsObject; 148 | static extensions: {[key: number]: jspb.ExtensionFieldInfo}; 149 | static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; 150 | static serializeBinaryToWriter(message: ComposeStacksResponse, writer: jspb.BinaryWriter): void; 151 | static deserializeBinary(bytes: Uint8Array): ComposeStacksResponse; 152 | static deserializeBinaryFromReader(message: ComposeStacksResponse, reader: jspb.BinaryReader): ComposeStacksResponse; 153 | } 154 | 155 | export namespace ComposeStacksResponse { 156 | export type AsObject = { 157 | stacksList: Array, 158 | } 159 | } 160 | 161 | export class Stack extends jspb.Message { 162 | getId(): string; 163 | setId(value: string): Stack; 164 | 165 | getName(): string; 166 | setName(value: string): Stack; 167 | 168 | getStatus(): string; 169 | setStatus(value: string): Stack; 170 | 171 | getReason(): string; 172 | setReason(value: string): Stack; 173 | 174 | 175 | serializeBinary(): Uint8Array; 176 | toObject(includeInstance?: boolean): Stack.AsObject; 177 | static toObject(includeInstance: boolean, msg: Stack): Stack.AsObject; 178 | static extensions: {[key: number]: jspb.ExtensionFieldInfo}; 179 | static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; 180 | static serializeBinaryToWriter(message: Stack, writer: jspb.BinaryWriter): void; 181 | static deserializeBinary(bytes: Uint8Array): Stack; 182 | static deserializeBinaryFromReader(message: Stack, reader: jspb.BinaryReader): Stack; 183 | } 184 | 185 | export namespace Stack { 186 | export type AsObject = { 187 | id: string, 188 | name: string, 189 | status: string, 190 | reason: string, 191 | } 192 | } 193 | 194 | export class ComposeServicesRequest extends jspb.Message { 195 | getProjectname(): string; 196 | setProjectname(value: string): ComposeServicesRequest; 197 | 198 | getWorkdir(): string; 199 | setWorkdir(value: string): ComposeServicesRequest; 200 | 201 | clearFilesList(): void; 202 | getFilesList(): Array; 203 | setFilesList(value: Array): ComposeServicesRequest; 204 | addFiles(value: string, index?: number): string; 205 | 206 | 207 | serializeBinary(): Uint8Array; 208 | toObject(includeInstance?: boolean): ComposeServicesRequest.AsObject; 209 | static toObject(includeInstance: boolean, msg: ComposeServicesRequest): ComposeServicesRequest.AsObject; 210 | static extensions: {[key: number]: jspb.ExtensionFieldInfo}; 211 | static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; 212 | static serializeBinaryToWriter(message: ComposeServicesRequest, writer: jspb.BinaryWriter): void; 213 | static deserializeBinary(bytes: Uint8Array): ComposeServicesRequest; 214 | static deserializeBinaryFromReader(message: ComposeServicesRequest, reader: jspb.BinaryReader): ComposeServicesRequest; 215 | } 216 | 217 | export namespace ComposeServicesRequest { 218 | export type AsObject = { 219 | projectname: string, 220 | workdir: string, 221 | filesList: Array, 222 | } 223 | } 224 | 225 | export class ComposeServicesResponse extends jspb.Message { 226 | clearServicesList(): void; 227 | getServicesList(): Array; 228 | setServicesList(value: Array): ComposeServicesResponse; 229 | addServices(value?: Service, index?: number): Service; 230 | 231 | 232 | serializeBinary(): Uint8Array; 233 | toObject(includeInstance?: boolean): ComposeServicesResponse.AsObject; 234 | static toObject(includeInstance: boolean, msg: ComposeServicesResponse): ComposeServicesResponse.AsObject; 235 | static extensions: {[key: number]: jspb.ExtensionFieldInfo}; 236 | static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; 237 | static serializeBinaryToWriter(message: ComposeServicesResponse, writer: jspb.BinaryWriter): void; 238 | static deserializeBinary(bytes: Uint8Array): ComposeServicesResponse; 239 | static deserializeBinaryFromReader(message: ComposeServicesResponse, reader: jspb.BinaryReader): ComposeServicesResponse; 240 | } 241 | 242 | export namespace ComposeServicesResponse { 243 | export type AsObject = { 244 | servicesList: Array, 245 | } 246 | } 247 | 248 | export class Service extends jspb.Message { 249 | getId(): string; 250 | setId(value: string): Service; 251 | 252 | getName(): string; 253 | setName(value: string): Service; 254 | 255 | getReplicas(): number; 256 | setReplicas(value: number): Service; 257 | 258 | getDesired(): number; 259 | setDesired(value: number): Service; 260 | 261 | clearPortsList(): void; 262 | getPortsList(): Array; 263 | setPortsList(value: Array): Service; 264 | addPorts(value: string, index?: number): string; 265 | 266 | 267 | serializeBinary(): Uint8Array; 268 | toObject(includeInstance?: boolean): Service.AsObject; 269 | static toObject(includeInstance: boolean, msg: Service): Service.AsObject; 270 | static extensions: {[key: number]: jspb.ExtensionFieldInfo}; 271 | static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; 272 | static serializeBinaryToWriter(message: Service, writer: jspb.BinaryWriter): void; 273 | static deserializeBinary(bytes: Uint8Array): Service; 274 | static deserializeBinaryFromReader(message: Service, reader: jspb.BinaryReader): Service; 275 | } 276 | 277 | export namespace Service { 278 | export type AsObject = { 279 | id: string, 280 | name: string, 281 | replicas: number, 282 | desired: number, 283 | portsList: Array, 284 | } 285 | } 286 | -------------------------------------------------------------------------------- /src/protos/containers/v1/containers.proto: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2020 Docker Compose CLI authors 3 | 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | syntax = "proto3"; 17 | 18 | package com.docker.api.protos.containers.v1; 19 | 20 | option go_package = "github.com/docker/compose-cli/cli/server/protos/containers/v1;v1"; 21 | 22 | service Containers { 23 | rpc List(ListRequest) returns (ListResponse); 24 | rpc Start(StartRequest) returns (StartResponse); 25 | rpc Stop(StopRequest) returns (StopResponse); 26 | rpc Kill(KillRequest) returns (KillResponse); 27 | rpc Run(RunRequest) returns (RunResponse); 28 | rpc Exec(ExecRequest) returns (ExecResponse); 29 | rpc Logs(LogsRequest) returns (stream LogsResponse); 30 | rpc Delete(DeleteRequest) returns (DeleteResponse); 31 | rpc Inspect(InspectRequest) returns (InspectResponse); 32 | } 33 | 34 | message Port { 35 | uint32 host_port = 1; 36 | uint32 container_port = 2; 37 | string protocol = 3; 38 | string host_ip = 4; 39 | } 40 | 41 | message Container { 42 | string id = 1; 43 | string image = 2; 44 | string status = 3; 45 | string command = 4; 46 | uint64 cpu_time = 5; 47 | uint64 memory_usage = 6; 48 | uint64 pids_current = 8; 49 | uint64 pids_limit = 9; 50 | repeated string labels = 10; 51 | repeated Port ports = 11; 52 | string platform = 13; 53 | HostConfig host_config = 15; 54 | Healthcheck healthcheck = 16; 55 | } 56 | 57 | message HostConfig { 58 | uint64 memory_reservation = 1; 59 | uint64 memory_limit = 2; 60 | uint64 cpu_reservation = 3; 61 | uint64 cpu_limit = 4; 62 | string restart_policy = 5; 63 | bool auto_remove = 6; 64 | } 65 | 66 | message Healthcheck { 67 | bool disable = 1; 68 | repeated string test = 2; 69 | int64 interval = 3; 70 | } 71 | 72 | message InspectRequest { 73 | string id = 1; 74 | } 75 | 76 | message InspectResponse { 77 | Container container = 1; 78 | } 79 | 80 | message DeleteRequest { 81 | string id = 1; 82 | bool force = 2; 83 | } 84 | 85 | message DeleteResponse { 86 | } 87 | 88 | message StartRequest { 89 | string id = 1; 90 | } 91 | 92 | message StartResponse { 93 | } 94 | 95 | message StopRequest { 96 | string id = 1; 97 | uint32 timeout = 2; 98 | } 99 | 100 | message StopResponse { 101 | } 102 | 103 | message KillRequest { 104 | string id = 1; 105 | string signal = 2; 106 | } 107 | 108 | message KillResponse { 109 | } 110 | 111 | message RunRequest { 112 | string id = 1; 113 | string image = 2; 114 | repeated Port ports = 3; 115 | map labels = 4; 116 | repeated string volumes = 5; 117 | uint64 memory_limit = 6; 118 | uint64 cpu_limit = 7; 119 | string restart_policy_condition = 8; 120 | repeated string command = 9; 121 | repeated string environment = 10; 122 | bool auto_remove = 11; 123 | Healthcheck healthcheck = 12; 124 | string platform = 13; 125 | } 126 | 127 | message RunResponse { 128 | } 129 | 130 | message ExecRequest { 131 | string id = 1; 132 | string command = 2; 133 | string stream_id = 3; 134 | repeated string args = 4; 135 | repeated string env = 5; 136 | bool tty = 6; 137 | } 138 | 139 | message ExecResponse { 140 | bytes output = 1; 141 | } 142 | 143 | message ListRequest { 144 | bool all = 1; 145 | } 146 | 147 | message ListResponse { 148 | repeated Container containers = 1; 149 | } 150 | 151 | message LogsRequest { 152 | string container_id = 1; 153 | bool follow = 3; 154 | } 155 | 156 | message LogsResponse { 157 | bytes value = 1; 158 | } 159 | -------------------------------------------------------------------------------- /src/protos/containers/v1/containers_grpc_pb.d.ts: -------------------------------------------------------------------------------- 1 | // package: com.docker.api.protos.containers.v1 2 | // file: containers/v1/containers.proto 3 | 4 | /* tslint:disable */ 5 | /* eslint-disable */ 6 | 7 | import * as grpc from "@grpc/grpc-js"; 8 | import {handleClientStreamingCall} from "@grpc/grpc-js/build/src/server-call"; 9 | import * as containers_v1_containers_pb from "../../containers/v1/containers_pb"; 10 | 11 | interface IContainersService extends grpc.ServiceDefinition { 12 | list: IContainersService_IList; 13 | start: IContainersService_IStart; 14 | stop: IContainersService_IStop; 15 | kill: IContainersService_IKill; 16 | run: IContainersService_IRun; 17 | exec: IContainersService_IExec; 18 | logs: IContainersService_ILogs; 19 | delete: IContainersService_IDelete; 20 | inspect: IContainersService_IInspect; 21 | } 22 | 23 | interface IContainersService_IList extends grpc.MethodDefinition { 24 | path: string; // "/com.docker.api.protos.containers.v1.Containers/List" 25 | requestStream: false; 26 | responseStream: false; 27 | requestSerialize: grpc.serialize; 28 | requestDeserialize: grpc.deserialize; 29 | responseSerialize: grpc.serialize; 30 | responseDeserialize: grpc.deserialize; 31 | } 32 | interface IContainersService_IStart extends grpc.MethodDefinition { 33 | path: string; // "/com.docker.api.protos.containers.v1.Containers/Start" 34 | requestStream: false; 35 | responseStream: false; 36 | requestSerialize: grpc.serialize; 37 | requestDeserialize: grpc.deserialize; 38 | responseSerialize: grpc.serialize; 39 | responseDeserialize: grpc.deserialize; 40 | } 41 | interface IContainersService_IStop extends grpc.MethodDefinition { 42 | path: string; // "/com.docker.api.protos.containers.v1.Containers/Stop" 43 | requestStream: false; 44 | responseStream: false; 45 | requestSerialize: grpc.serialize; 46 | requestDeserialize: grpc.deserialize; 47 | responseSerialize: grpc.serialize; 48 | responseDeserialize: grpc.deserialize; 49 | } 50 | interface IContainersService_IKill extends grpc.MethodDefinition { 51 | path: string; // "/com.docker.api.protos.containers.v1.Containers/Kill" 52 | requestStream: false; 53 | responseStream: false; 54 | requestSerialize: grpc.serialize; 55 | requestDeserialize: grpc.deserialize; 56 | responseSerialize: grpc.serialize; 57 | responseDeserialize: grpc.deserialize; 58 | } 59 | interface IContainersService_IRun extends grpc.MethodDefinition { 60 | path: string; // "/com.docker.api.protos.containers.v1.Containers/Run" 61 | requestStream: false; 62 | responseStream: false; 63 | requestSerialize: grpc.serialize; 64 | requestDeserialize: grpc.deserialize; 65 | responseSerialize: grpc.serialize; 66 | responseDeserialize: grpc.deserialize; 67 | } 68 | interface IContainersService_IExec extends grpc.MethodDefinition { 69 | path: string; // "/com.docker.api.protos.containers.v1.Containers/Exec" 70 | requestStream: false; 71 | responseStream: false; 72 | requestSerialize: grpc.serialize; 73 | requestDeserialize: grpc.deserialize; 74 | responseSerialize: grpc.serialize; 75 | responseDeserialize: grpc.deserialize; 76 | } 77 | interface IContainersService_ILogs extends grpc.MethodDefinition { 78 | path: string; // "/com.docker.api.protos.containers.v1.Containers/Logs" 79 | requestStream: false; 80 | responseStream: true; 81 | requestSerialize: grpc.serialize; 82 | requestDeserialize: grpc.deserialize; 83 | responseSerialize: grpc.serialize; 84 | responseDeserialize: grpc.deserialize; 85 | } 86 | interface IContainersService_IDelete extends grpc.MethodDefinition { 87 | path: string; // "/com.docker.api.protos.containers.v1.Containers/Delete" 88 | requestStream: false; 89 | responseStream: false; 90 | requestSerialize: grpc.serialize; 91 | requestDeserialize: grpc.deserialize; 92 | responseSerialize: grpc.serialize; 93 | responseDeserialize: grpc.deserialize; 94 | } 95 | interface IContainersService_IInspect extends grpc.MethodDefinition { 96 | path: string; // "/com.docker.api.protos.containers.v1.Containers/Inspect" 97 | requestStream: false; 98 | responseStream: false; 99 | requestSerialize: grpc.serialize; 100 | requestDeserialize: grpc.deserialize; 101 | responseSerialize: grpc.serialize; 102 | responseDeserialize: grpc.deserialize; 103 | } 104 | 105 | export const ContainersService: IContainersService; 106 | 107 | export interface IContainersServer { 108 | list: grpc.handleUnaryCall; 109 | start: grpc.handleUnaryCall; 110 | stop: grpc.handleUnaryCall; 111 | kill: grpc.handleUnaryCall; 112 | run: grpc.handleUnaryCall; 113 | exec: grpc.handleUnaryCall; 114 | logs: grpc.handleServerStreamingCall; 115 | delete: grpc.handleUnaryCall; 116 | inspect: grpc.handleUnaryCall; 117 | } 118 | 119 | export interface IContainersClient { 120 | list(request: containers_v1_containers_pb.ListRequest, callback: (error: grpc.ServiceError | null, response: containers_v1_containers_pb.ListResponse) => void): grpc.ClientUnaryCall; 121 | list(request: containers_v1_containers_pb.ListRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: containers_v1_containers_pb.ListResponse) => void): grpc.ClientUnaryCall; 122 | list(request: containers_v1_containers_pb.ListRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: containers_v1_containers_pb.ListResponse) => void): grpc.ClientUnaryCall; 123 | start(request: containers_v1_containers_pb.StartRequest, callback: (error: grpc.ServiceError | null, response: containers_v1_containers_pb.StartResponse) => void): grpc.ClientUnaryCall; 124 | start(request: containers_v1_containers_pb.StartRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: containers_v1_containers_pb.StartResponse) => void): grpc.ClientUnaryCall; 125 | start(request: containers_v1_containers_pb.StartRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: containers_v1_containers_pb.StartResponse) => void): grpc.ClientUnaryCall; 126 | stop(request: containers_v1_containers_pb.StopRequest, callback: (error: grpc.ServiceError | null, response: containers_v1_containers_pb.StopResponse) => void): grpc.ClientUnaryCall; 127 | stop(request: containers_v1_containers_pb.StopRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: containers_v1_containers_pb.StopResponse) => void): grpc.ClientUnaryCall; 128 | stop(request: containers_v1_containers_pb.StopRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: containers_v1_containers_pb.StopResponse) => void): grpc.ClientUnaryCall; 129 | kill(request: containers_v1_containers_pb.KillRequest, callback: (error: grpc.ServiceError | null, response: containers_v1_containers_pb.KillResponse) => void): grpc.ClientUnaryCall; 130 | kill(request: containers_v1_containers_pb.KillRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: containers_v1_containers_pb.KillResponse) => void): grpc.ClientUnaryCall; 131 | kill(request: containers_v1_containers_pb.KillRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: containers_v1_containers_pb.KillResponse) => void): grpc.ClientUnaryCall; 132 | run(request: containers_v1_containers_pb.RunRequest, callback: (error: grpc.ServiceError | null, response: containers_v1_containers_pb.RunResponse) => void): grpc.ClientUnaryCall; 133 | run(request: containers_v1_containers_pb.RunRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: containers_v1_containers_pb.RunResponse) => void): grpc.ClientUnaryCall; 134 | run(request: containers_v1_containers_pb.RunRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: containers_v1_containers_pb.RunResponse) => void): grpc.ClientUnaryCall; 135 | exec(request: containers_v1_containers_pb.ExecRequest, callback: (error: grpc.ServiceError | null, response: containers_v1_containers_pb.ExecResponse) => void): grpc.ClientUnaryCall; 136 | exec(request: containers_v1_containers_pb.ExecRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: containers_v1_containers_pb.ExecResponse) => void): grpc.ClientUnaryCall; 137 | exec(request: containers_v1_containers_pb.ExecRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: containers_v1_containers_pb.ExecResponse) => void): grpc.ClientUnaryCall; 138 | logs(request: containers_v1_containers_pb.LogsRequest, options?: Partial): grpc.ClientReadableStream; 139 | logs(request: containers_v1_containers_pb.LogsRequest, metadata?: grpc.Metadata, options?: Partial): grpc.ClientReadableStream; 140 | delete(request: containers_v1_containers_pb.DeleteRequest, callback: (error: grpc.ServiceError | null, response: containers_v1_containers_pb.DeleteResponse) => void): grpc.ClientUnaryCall; 141 | delete(request: containers_v1_containers_pb.DeleteRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: containers_v1_containers_pb.DeleteResponse) => void): grpc.ClientUnaryCall; 142 | delete(request: containers_v1_containers_pb.DeleteRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: containers_v1_containers_pb.DeleteResponse) => void): grpc.ClientUnaryCall; 143 | inspect(request: containers_v1_containers_pb.InspectRequest, callback: (error: grpc.ServiceError | null, response: containers_v1_containers_pb.InspectResponse) => void): grpc.ClientUnaryCall; 144 | inspect(request: containers_v1_containers_pb.InspectRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: containers_v1_containers_pb.InspectResponse) => void): grpc.ClientUnaryCall; 145 | inspect(request: containers_v1_containers_pb.InspectRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: containers_v1_containers_pb.InspectResponse) => void): grpc.ClientUnaryCall; 146 | } 147 | 148 | export class ContainersClient extends grpc.Client implements IContainersClient { 149 | constructor(address: string, credentials: grpc.ChannelCredentials, options?: object); 150 | public list(request: containers_v1_containers_pb.ListRequest, callback: (error: grpc.ServiceError | null, response: containers_v1_containers_pb.ListResponse) => void): grpc.ClientUnaryCall; 151 | public list(request: containers_v1_containers_pb.ListRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: containers_v1_containers_pb.ListResponse) => void): grpc.ClientUnaryCall; 152 | public list(request: containers_v1_containers_pb.ListRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: containers_v1_containers_pb.ListResponse) => void): grpc.ClientUnaryCall; 153 | public start(request: containers_v1_containers_pb.StartRequest, callback: (error: grpc.ServiceError | null, response: containers_v1_containers_pb.StartResponse) => void): grpc.ClientUnaryCall; 154 | public start(request: containers_v1_containers_pb.StartRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: containers_v1_containers_pb.StartResponse) => void): grpc.ClientUnaryCall; 155 | public start(request: containers_v1_containers_pb.StartRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: containers_v1_containers_pb.StartResponse) => void): grpc.ClientUnaryCall; 156 | public stop(request: containers_v1_containers_pb.StopRequest, callback: (error: grpc.ServiceError | null, response: containers_v1_containers_pb.StopResponse) => void): grpc.ClientUnaryCall; 157 | public stop(request: containers_v1_containers_pb.StopRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: containers_v1_containers_pb.StopResponse) => void): grpc.ClientUnaryCall; 158 | public stop(request: containers_v1_containers_pb.StopRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: containers_v1_containers_pb.StopResponse) => void): grpc.ClientUnaryCall; 159 | public kill(request: containers_v1_containers_pb.KillRequest, callback: (error: grpc.ServiceError | null, response: containers_v1_containers_pb.KillResponse) => void): grpc.ClientUnaryCall; 160 | public kill(request: containers_v1_containers_pb.KillRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: containers_v1_containers_pb.KillResponse) => void): grpc.ClientUnaryCall; 161 | public kill(request: containers_v1_containers_pb.KillRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: containers_v1_containers_pb.KillResponse) => void): grpc.ClientUnaryCall; 162 | public run(request: containers_v1_containers_pb.RunRequest, callback: (error: grpc.ServiceError | null, response: containers_v1_containers_pb.RunResponse) => void): grpc.ClientUnaryCall; 163 | public run(request: containers_v1_containers_pb.RunRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: containers_v1_containers_pb.RunResponse) => void): grpc.ClientUnaryCall; 164 | public run(request: containers_v1_containers_pb.RunRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: containers_v1_containers_pb.RunResponse) => void): grpc.ClientUnaryCall; 165 | public exec(request: containers_v1_containers_pb.ExecRequest, callback: (error: grpc.ServiceError | null, response: containers_v1_containers_pb.ExecResponse) => void): grpc.ClientUnaryCall; 166 | public exec(request: containers_v1_containers_pb.ExecRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: containers_v1_containers_pb.ExecResponse) => void): grpc.ClientUnaryCall; 167 | public exec(request: containers_v1_containers_pb.ExecRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: containers_v1_containers_pb.ExecResponse) => void): grpc.ClientUnaryCall; 168 | public logs(request: containers_v1_containers_pb.LogsRequest, options?: Partial): grpc.ClientReadableStream; 169 | public logs(request: containers_v1_containers_pb.LogsRequest, metadata?: grpc.Metadata, options?: Partial): grpc.ClientReadableStream; 170 | public delete(request: containers_v1_containers_pb.DeleteRequest, callback: (error: grpc.ServiceError | null, response: containers_v1_containers_pb.DeleteResponse) => void): grpc.ClientUnaryCall; 171 | public delete(request: containers_v1_containers_pb.DeleteRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: containers_v1_containers_pb.DeleteResponse) => void): grpc.ClientUnaryCall; 172 | public delete(request: containers_v1_containers_pb.DeleteRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: containers_v1_containers_pb.DeleteResponse) => void): grpc.ClientUnaryCall; 173 | public inspect(request: containers_v1_containers_pb.InspectRequest, callback: (error: grpc.ServiceError | null, response: containers_v1_containers_pb.InspectResponse) => void): grpc.ClientUnaryCall; 174 | public inspect(request: containers_v1_containers_pb.InspectRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: containers_v1_containers_pb.InspectResponse) => void): grpc.ClientUnaryCall; 175 | public inspect(request: containers_v1_containers_pb.InspectRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: containers_v1_containers_pb.InspectResponse) => void): grpc.ClientUnaryCall; 176 | } 177 | -------------------------------------------------------------------------------- /src/protos/containers/v1/containers_grpc_pb.js: -------------------------------------------------------------------------------- 1 | // GENERATED CODE -- DO NOT EDIT! 2 | 3 | // Original file comments: 4 | // 5 | // Copyright 2020 Docker Compose CLI authors 6 | // 7 | // Licensed under the Apache License, Version 2.0 (the "License"); 8 | // you may not use this file except in compliance with the License. 9 | // You may obtain a copy of the License at 10 | // 11 | // http://www.apache.org/licenses/LICENSE-2.0 12 | // 13 | // Unless required by applicable law or agreed to in writing, software 14 | // distributed under the License is distributed on an "AS IS" BASIS, 15 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | // See the License for the specific language governing permissions and 17 | // limitations under the License. 18 | // 19 | 'use strict'; 20 | var grpc = require('@grpc/grpc-js'); 21 | var containers_v1_containers_pb = require('../../containers/v1/containers_pb.js'); 22 | 23 | function serialize_com_docker_api_protos_containers_v1_DeleteRequest(arg) { 24 | if (!(arg instanceof containers_v1_containers_pb.DeleteRequest)) { 25 | throw new Error('Expected argument of type com.docker.api.protos.containers.v1.DeleteRequest'); 26 | } 27 | return Buffer.from(arg.serializeBinary()); 28 | } 29 | 30 | function deserialize_com_docker_api_protos_containers_v1_DeleteRequest(buffer_arg) { 31 | return containers_v1_containers_pb.DeleteRequest.deserializeBinary(new Uint8Array(buffer_arg)); 32 | } 33 | 34 | function serialize_com_docker_api_protos_containers_v1_DeleteResponse(arg) { 35 | if (!(arg instanceof containers_v1_containers_pb.DeleteResponse)) { 36 | throw new Error('Expected argument of type com.docker.api.protos.containers.v1.DeleteResponse'); 37 | } 38 | return Buffer.from(arg.serializeBinary()); 39 | } 40 | 41 | function deserialize_com_docker_api_protos_containers_v1_DeleteResponse(buffer_arg) { 42 | return containers_v1_containers_pb.DeleteResponse.deserializeBinary(new Uint8Array(buffer_arg)); 43 | } 44 | 45 | function serialize_com_docker_api_protos_containers_v1_ExecRequest(arg) { 46 | if (!(arg instanceof containers_v1_containers_pb.ExecRequest)) { 47 | throw new Error('Expected argument of type com.docker.api.protos.containers.v1.ExecRequest'); 48 | } 49 | return Buffer.from(arg.serializeBinary()); 50 | } 51 | 52 | function deserialize_com_docker_api_protos_containers_v1_ExecRequest(buffer_arg) { 53 | return containers_v1_containers_pb.ExecRequest.deserializeBinary(new Uint8Array(buffer_arg)); 54 | } 55 | 56 | function serialize_com_docker_api_protos_containers_v1_ExecResponse(arg) { 57 | if (!(arg instanceof containers_v1_containers_pb.ExecResponse)) { 58 | throw new Error('Expected argument of type com.docker.api.protos.containers.v1.ExecResponse'); 59 | } 60 | return Buffer.from(arg.serializeBinary()); 61 | } 62 | 63 | function deserialize_com_docker_api_protos_containers_v1_ExecResponse(buffer_arg) { 64 | return containers_v1_containers_pb.ExecResponse.deserializeBinary(new Uint8Array(buffer_arg)); 65 | } 66 | 67 | function serialize_com_docker_api_protos_containers_v1_InspectRequest(arg) { 68 | if (!(arg instanceof containers_v1_containers_pb.InspectRequest)) { 69 | throw new Error('Expected argument of type com.docker.api.protos.containers.v1.InspectRequest'); 70 | } 71 | return Buffer.from(arg.serializeBinary()); 72 | } 73 | 74 | function deserialize_com_docker_api_protos_containers_v1_InspectRequest(buffer_arg) { 75 | return containers_v1_containers_pb.InspectRequest.deserializeBinary(new Uint8Array(buffer_arg)); 76 | } 77 | 78 | function serialize_com_docker_api_protos_containers_v1_InspectResponse(arg) { 79 | if (!(arg instanceof containers_v1_containers_pb.InspectResponse)) { 80 | throw new Error('Expected argument of type com.docker.api.protos.containers.v1.InspectResponse'); 81 | } 82 | return Buffer.from(arg.serializeBinary()); 83 | } 84 | 85 | function deserialize_com_docker_api_protos_containers_v1_InspectResponse(buffer_arg) { 86 | return containers_v1_containers_pb.InspectResponse.deserializeBinary(new Uint8Array(buffer_arg)); 87 | } 88 | 89 | function serialize_com_docker_api_protos_containers_v1_KillRequest(arg) { 90 | if (!(arg instanceof containers_v1_containers_pb.KillRequest)) { 91 | throw new Error('Expected argument of type com.docker.api.protos.containers.v1.KillRequest'); 92 | } 93 | return Buffer.from(arg.serializeBinary()); 94 | } 95 | 96 | function deserialize_com_docker_api_protos_containers_v1_KillRequest(buffer_arg) { 97 | return containers_v1_containers_pb.KillRequest.deserializeBinary(new Uint8Array(buffer_arg)); 98 | } 99 | 100 | function serialize_com_docker_api_protos_containers_v1_KillResponse(arg) { 101 | if (!(arg instanceof containers_v1_containers_pb.KillResponse)) { 102 | throw new Error('Expected argument of type com.docker.api.protos.containers.v1.KillResponse'); 103 | } 104 | return Buffer.from(arg.serializeBinary()); 105 | } 106 | 107 | function deserialize_com_docker_api_protos_containers_v1_KillResponse(buffer_arg) { 108 | return containers_v1_containers_pb.KillResponse.deserializeBinary(new Uint8Array(buffer_arg)); 109 | } 110 | 111 | function serialize_com_docker_api_protos_containers_v1_ListRequest(arg) { 112 | if (!(arg instanceof containers_v1_containers_pb.ListRequest)) { 113 | throw new Error('Expected argument of type com.docker.api.protos.containers.v1.ListRequest'); 114 | } 115 | return Buffer.from(arg.serializeBinary()); 116 | } 117 | 118 | function deserialize_com_docker_api_protos_containers_v1_ListRequest(buffer_arg) { 119 | return containers_v1_containers_pb.ListRequest.deserializeBinary(new Uint8Array(buffer_arg)); 120 | } 121 | 122 | function serialize_com_docker_api_protos_containers_v1_ListResponse(arg) { 123 | if (!(arg instanceof containers_v1_containers_pb.ListResponse)) { 124 | throw new Error('Expected argument of type com.docker.api.protos.containers.v1.ListResponse'); 125 | } 126 | return Buffer.from(arg.serializeBinary()); 127 | } 128 | 129 | function deserialize_com_docker_api_protos_containers_v1_ListResponse(buffer_arg) { 130 | return containers_v1_containers_pb.ListResponse.deserializeBinary(new Uint8Array(buffer_arg)); 131 | } 132 | 133 | function serialize_com_docker_api_protos_containers_v1_LogsRequest(arg) { 134 | if (!(arg instanceof containers_v1_containers_pb.LogsRequest)) { 135 | throw new Error('Expected argument of type com.docker.api.protos.containers.v1.LogsRequest'); 136 | } 137 | return Buffer.from(arg.serializeBinary()); 138 | } 139 | 140 | function deserialize_com_docker_api_protos_containers_v1_LogsRequest(buffer_arg) { 141 | return containers_v1_containers_pb.LogsRequest.deserializeBinary(new Uint8Array(buffer_arg)); 142 | } 143 | 144 | function serialize_com_docker_api_protos_containers_v1_LogsResponse(arg) { 145 | if (!(arg instanceof containers_v1_containers_pb.LogsResponse)) { 146 | throw new Error('Expected argument of type com.docker.api.protos.containers.v1.LogsResponse'); 147 | } 148 | return Buffer.from(arg.serializeBinary()); 149 | } 150 | 151 | function deserialize_com_docker_api_protos_containers_v1_LogsResponse(buffer_arg) { 152 | return containers_v1_containers_pb.LogsResponse.deserializeBinary(new Uint8Array(buffer_arg)); 153 | } 154 | 155 | function serialize_com_docker_api_protos_containers_v1_RunRequest(arg) { 156 | if (!(arg instanceof containers_v1_containers_pb.RunRequest)) { 157 | throw new Error('Expected argument of type com.docker.api.protos.containers.v1.RunRequest'); 158 | } 159 | return Buffer.from(arg.serializeBinary()); 160 | } 161 | 162 | function deserialize_com_docker_api_protos_containers_v1_RunRequest(buffer_arg) { 163 | return containers_v1_containers_pb.RunRequest.deserializeBinary(new Uint8Array(buffer_arg)); 164 | } 165 | 166 | function serialize_com_docker_api_protos_containers_v1_RunResponse(arg) { 167 | if (!(arg instanceof containers_v1_containers_pb.RunResponse)) { 168 | throw new Error('Expected argument of type com.docker.api.protos.containers.v1.RunResponse'); 169 | } 170 | return Buffer.from(arg.serializeBinary()); 171 | } 172 | 173 | function deserialize_com_docker_api_protos_containers_v1_RunResponse(buffer_arg) { 174 | return containers_v1_containers_pb.RunResponse.deserializeBinary(new Uint8Array(buffer_arg)); 175 | } 176 | 177 | function serialize_com_docker_api_protos_containers_v1_StartRequest(arg) { 178 | if (!(arg instanceof containers_v1_containers_pb.StartRequest)) { 179 | throw new Error('Expected argument of type com.docker.api.protos.containers.v1.StartRequest'); 180 | } 181 | return Buffer.from(arg.serializeBinary()); 182 | } 183 | 184 | function deserialize_com_docker_api_protos_containers_v1_StartRequest(buffer_arg) { 185 | return containers_v1_containers_pb.StartRequest.deserializeBinary(new Uint8Array(buffer_arg)); 186 | } 187 | 188 | function serialize_com_docker_api_protos_containers_v1_StartResponse(arg) { 189 | if (!(arg instanceof containers_v1_containers_pb.StartResponse)) { 190 | throw new Error('Expected argument of type com.docker.api.protos.containers.v1.StartResponse'); 191 | } 192 | return Buffer.from(arg.serializeBinary()); 193 | } 194 | 195 | function deserialize_com_docker_api_protos_containers_v1_StartResponse(buffer_arg) { 196 | return containers_v1_containers_pb.StartResponse.deserializeBinary(new Uint8Array(buffer_arg)); 197 | } 198 | 199 | function serialize_com_docker_api_protos_containers_v1_StopRequest(arg) { 200 | if (!(arg instanceof containers_v1_containers_pb.StopRequest)) { 201 | throw new Error('Expected argument of type com.docker.api.protos.containers.v1.StopRequest'); 202 | } 203 | return Buffer.from(arg.serializeBinary()); 204 | } 205 | 206 | function deserialize_com_docker_api_protos_containers_v1_StopRequest(buffer_arg) { 207 | return containers_v1_containers_pb.StopRequest.deserializeBinary(new Uint8Array(buffer_arg)); 208 | } 209 | 210 | function serialize_com_docker_api_protos_containers_v1_StopResponse(arg) { 211 | if (!(arg instanceof containers_v1_containers_pb.StopResponse)) { 212 | throw new Error('Expected argument of type com.docker.api.protos.containers.v1.StopResponse'); 213 | } 214 | return Buffer.from(arg.serializeBinary()); 215 | } 216 | 217 | function deserialize_com_docker_api_protos_containers_v1_StopResponse(buffer_arg) { 218 | return containers_v1_containers_pb.StopResponse.deserializeBinary(new Uint8Array(buffer_arg)); 219 | } 220 | 221 | 222 | var ContainersService = exports.ContainersService = { 223 | list: { 224 | path: '/com.docker.api.protos.containers.v1.Containers/List', 225 | requestStream: false, 226 | responseStream: false, 227 | requestType: containers_v1_containers_pb.ListRequest, 228 | responseType: containers_v1_containers_pb.ListResponse, 229 | requestSerialize: serialize_com_docker_api_protos_containers_v1_ListRequest, 230 | requestDeserialize: deserialize_com_docker_api_protos_containers_v1_ListRequest, 231 | responseSerialize: serialize_com_docker_api_protos_containers_v1_ListResponse, 232 | responseDeserialize: deserialize_com_docker_api_protos_containers_v1_ListResponse, 233 | }, 234 | start: { 235 | path: '/com.docker.api.protos.containers.v1.Containers/Start', 236 | requestStream: false, 237 | responseStream: false, 238 | requestType: containers_v1_containers_pb.StartRequest, 239 | responseType: containers_v1_containers_pb.StartResponse, 240 | requestSerialize: serialize_com_docker_api_protos_containers_v1_StartRequest, 241 | requestDeserialize: deserialize_com_docker_api_protos_containers_v1_StartRequest, 242 | responseSerialize: serialize_com_docker_api_protos_containers_v1_StartResponse, 243 | responseDeserialize: deserialize_com_docker_api_protos_containers_v1_StartResponse, 244 | }, 245 | stop: { 246 | path: '/com.docker.api.protos.containers.v1.Containers/Stop', 247 | requestStream: false, 248 | responseStream: false, 249 | requestType: containers_v1_containers_pb.StopRequest, 250 | responseType: containers_v1_containers_pb.StopResponse, 251 | requestSerialize: serialize_com_docker_api_protos_containers_v1_StopRequest, 252 | requestDeserialize: deserialize_com_docker_api_protos_containers_v1_StopRequest, 253 | responseSerialize: serialize_com_docker_api_protos_containers_v1_StopResponse, 254 | responseDeserialize: deserialize_com_docker_api_protos_containers_v1_StopResponse, 255 | }, 256 | kill: { 257 | path: '/com.docker.api.protos.containers.v1.Containers/Kill', 258 | requestStream: false, 259 | responseStream: false, 260 | requestType: containers_v1_containers_pb.KillRequest, 261 | responseType: containers_v1_containers_pb.KillResponse, 262 | requestSerialize: serialize_com_docker_api_protos_containers_v1_KillRequest, 263 | requestDeserialize: deserialize_com_docker_api_protos_containers_v1_KillRequest, 264 | responseSerialize: serialize_com_docker_api_protos_containers_v1_KillResponse, 265 | responseDeserialize: deserialize_com_docker_api_protos_containers_v1_KillResponse, 266 | }, 267 | run: { 268 | path: '/com.docker.api.protos.containers.v1.Containers/Run', 269 | requestStream: false, 270 | responseStream: false, 271 | requestType: containers_v1_containers_pb.RunRequest, 272 | responseType: containers_v1_containers_pb.RunResponse, 273 | requestSerialize: serialize_com_docker_api_protos_containers_v1_RunRequest, 274 | requestDeserialize: deserialize_com_docker_api_protos_containers_v1_RunRequest, 275 | responseSerialize: serialize_com_docker_api_protos_containers_v1_RunResponse, 276 | responseDeserialize: deserialize_com_docker_api_protos_containers_v1_RunResponse, 277 | }, 278 | exec: { 279 | path: '/com.docker.api.protos.containers.v1.Containers/Exec', 280 | requestStream: false, 281 | responseStream: false, 282 | requestType: containers_v1_containers_pb.ExecRequest, 283 | responseType: containers_v1_containers_pb.ExecResponse, 284 | requestSerialize: serialize_com_docker_api_protos_containers_v1_ExecRequest, 285 | requestDeserialize: deserialize_com_docker_api_protos_containers_v1_ExecRequest, 286 | responseSerialize: serialize_com_docker_api_protos_containers_v1_ExecResponse, 287 | responseDeserialize: deserialize_com_docker_api_protos_containers_v1_ExecResponse, 288 | }, 289 | logs: { 290 | path: '/com.docker.api.protos.containers.v1.Containers/Logs', 291 | requestStream: false, 292 | responseStream: true, 293 | requestType: containers_v1_containers_pb.LogsRequest, 294 | responseType: containers_v1_containers_pb.LogsResponse, 295 | requestSerialize: serialize_com_docker_api_protos_containers_v1_LogsRequest, 296 | requestDeserialize: deserialize_com_docker_api_protos_containers_v1_LogsRequest, 297 | responseSerialize: serialize_com_docker_api_protos_containers_v1_LogsResponse, 298 | responseDeserialize: deserialize_com_docker_api_protos_containers_v1_LogsResponse, 299 | }, 300 | delete: { 301 | path: '/com.docker.api.protos.containers.v1.Containers/Delete', 302 | requestStream: false, 303 | responseStream: false, 304 | requestType: containers_v1_containers_pb.DeleteRequest, 305 | responseType: containers_v1_containers_pb.DeleteResponse, 306 | requestSerialize: serialize_com_docker_api_protos_containers_v1_DeleteRequest, 307 | requestDeserialize: deserialize_com_docker_api_protos_containers_v1_DeleteRequest, 308 | responseSerialize: serialize_com_docker_api_protos_containers_v1_DeleteResponse, 309 | responseDeserialize: deserialize_com_docker_api_protos_containers_v1_DeleteResponse, 310 | }, 311 | inspect: { 312 | path: '/com.docker.api.protos.containers.v1.Containers/Inspect', 313 | requestStream: false, 314 | responseStream: false, 315 | requestType: containers_v1_containers_pb.InspectRequest, 316 | responseType: containers_v1_containers_pb.InspectResponse, 317 | requestSerialize: serialize_com_docker_api_protos_containers_v1_InspectRequest, 318 | requestDeserialize: deserialize_com_docker_api_protos_containers_v1_InspectRequest, 319 | responseSerialize: serialize_com_docker_api_protos_containers_v1_InspectResponse, 320 | responseDeserialize: deserialize_com_docker_api_protos_containers_v1_InspectResponse, 321 | }, 322 | }; 323 | 324 | exports.ContainersClient = grpc.makeGenericClientConstructor(ContainersService); 325 | -------------------------------------------------------------------------------- /src/protos/containers/v1/containers_pb.d.ts: -------------------------------------------------------------------------------- 1 | // package: com.docker.api.protos.containers.v1 2 | // file: containers/v1/containers.proto 3 | 4 | /* tslint:disable */ 5 | /* eslint-disable */ 6 | 7 | import * as jspb from "google-protobuf"; 8 | 9 | export class Port extends jspb.Message { 10 | getHostPort(): number; 11 | setHostPort(value: number): Port; 12 | 13 | getContainerPort(): number; 14 | setContainerPort(value: number): Port; 15 | 16 | getProtocol(): string; 17 | setProtocol(value: string): Port; 18 | 19 | getHostIp(): string; 20 | setHostIp(value: string): Port; 21 | 22 | 23 | serializeBinary(): Uint8Array; 24 | toObject(includeInstance?: boolean): Port.AsObject; 25 | static toObject(includeInstance: boolean, msg: Port): Port.AsObject; 26 | static extensions: {[key: number]: jspb.ExtensionFieldInfo}; 27 | static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; 28 | static serializeBinaryToWriter(message: Port, writer: jspb.BinaryWriter): void; 29 | static deserializeBinary(bytes: Uint8Array): Port; 30 | static deserializeBinaryFromReader(message: Port, reader: jspb.BinaryReader): Port; 31 | } 32 | 33 | export namespace Port { 34 | export type AsObject = { 35 | hostPort: number, 36 | containerPort: number, 37 | protocol: string, 38 | hostIp: string, 39 | } 40 | } 41 | 42 | export class Container extends jspb.Message { 43 | getId(): string; 44 | setId(value: string): Container; 45 | 46 | getImage(): string; 47 | setImage(value: string): Container; 48 | 49 | getStatus(): string; 50 | setStatus(value: string): Container; 51 | 52 | getCommand(): string; 53 | setCommand(value: string): Container; 54 | 55 | getCpuTime(): number; 56 | setCpuTime(value: number): Container; 57 | 58 | getMemoryUsage(): number; 59 | setMemoryUsage(value: number): Container; 60 | 61 | getPidsCurrent(): number; 62 | setPidsCurrent(value: number): Container; 63 | 64 | getPidsLimit(): number; 65 | setPidsLimit(value: number): Container; 66 | 67 | clearLabelsList(): void; 68 | getLabelsList(): Array; 69 | setLabelsList(value: Array): Container; 70 | addLabels(value: string, index?: number): string; 71 | 72 | clearPortsList(): void; 73 | getPortsList(): Array; 74 | setPortsList(value: Array): Container; 75 | addPorts(value?: Port, index?: number): Port; 76 | 77 | getPlatform(): string; 78 | setPlatform(value: string): Container; 79 | 80 | 81 | hasHostConfig(): boolean; 82 | clearHostConfig(): void; 83 | getHostConfig(): HostConfig | undefined; 84 | setHostConfig(value?: HostConfig): Container; 85 | 86 | 87 | hasHealthcheck(): boolean; 88 | clearHealthcheck(): void; 89 | getHealthcheck(): Healthcheck | undefined; 90 | setHealthcheck(value?: Healthcheck): Container; 91 | 92 | 93 | serializeBinary(): Uint8Array; 94 | toObject(includeInstance?: boolean): Container.AsObject; 95 | static toObject(includeInstance: boolean, msg: Container): Container.AsObject; 96 | static extensions: {[key: number]: jspb.ExtensionFieldInfo}; 97 | static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; 98 | static serializeBinaryToWriter(message: Container, writer: jspb.BinaryWriter): void; 99 | static deserializeBinary(bytes: Uint8Array): Container; 100 | static deserializeBinaryFromReader(message: Container, reader: jspb.BinaryReader): Container; 101 | } 102 | 103 | export namespace Container { 104 | export type AsObject = { 105 | id: string, 106 | image: string, 107 | status: string, 108 | command: string, 109 | cpuTime: number, 110 | memoryUsage: number, 111 | pidsCurrent: number, 112 | pidsLimit: number, 113 | labelsList: Array, 114 | portsList: Array, 115 | platform: string, 116 | hostConfig?: HostConfig.AsObject, 117 | healthcheck?: Healthcheck.AsObject, 118 | } 119 | } 120 | 121 | export class HostConfig extends jspb.Message { 122 | getMemoryReservation(): number; 123 | setMemoryReservation(value: number): HostConfig; 124 | 125 | getMemoryLimit(): number; 126 | setMemoryLimit(value: number): HostConfig; 127 | 128 | getCpuReservation(): number; 129 | setCpuReservation(value: number): HostConfig; 130 | 131 | getCpuLimit(): number; 132 | setCpuLimit(value: number): HostConfig; 133 | 134 | getRestartPolicy(): string; 135 | setRestartPolicy(value: string): HostConfig; 136 | 137 | getAutoRemove(): boolean; 138 | setAutoRemove(value: boolean): HostConfig; 139 | 140 | 141 | serializeBinary(): Uint8Array; 142 | toObject(includeInstance?: boolean): HostConfig.AsObject; 143 | static toObject(includeInstance: boolean, msg: HostConfig): HostConfig.AsObject; 144 | static extensions: {[key: number]: jspb.ExtensionFieldInfo}; 145 | static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; 146 | static serializeBinaryToWriter(message: HostConfig, writer: jspb.BinaryWriter): void; 147 | static deserializeBinary(bytes: Uint8Array): HostConfig; 148 | static deserializeBinaryFromReader(message: HostConfig, reader: jspb.BinaryReader): HostConfig; 149 | } 150 | 151 | export namespace HostConfig { 152 | export type AsObject = { 153 | memoryReservation: number, 154 | memoryLimit: number, 155 | cpuReservation: number, 156 | cpuLimit: number, 157 | restartPolicy: string, 158 | autoRemove: boolean, 159 | } 160 | } 161 | 162 | export class Healthcheck extends jspb.Message { 163 | getDisable(): boolean; 164 | setDisable(value: boolean): Healthcheck; 165 | 166 | clearTestList(): void; 167 | getTestList(): Array; 168 | setTestList(value: Array): Healthcheck; 169 | addTest(value: string, index?: number): string; 170 | 171 | getInterval(): number; 172 | setInterval(value: number): Healthcheck; 173 | 174 | 175 | serializeBinary(): Uint8Array; 176 | toObject(includeInstance?: boolean): Healthcheck.AsObject; 177 | static toObject(includeInstance: boolean, msg: Healthcheck): Healthcheck.AsObject; 178 | static extensions: {[key: number]: jspb.ExtensionFieldInfo}; 179 | static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; 180 | static serializeBinaryToWriter(message: Healthcheck, writer: jspb.BinaryWriter): void; 181 | static deserializeBinary(bytes: Uint8Array): Healthcheck; 182 | static deserializeBinaryFromReader(message: Healthcheck, reader: jspb.BinaryReader): Healthcheck; 183 | } 184 | 185 | export namespace Healthcheck { 186 | export type AsObject = { 187 | disable: boolean, 188 | testList: Array, 189 | interval: number, 190 | } 191 | } 192 | 193 | export class InspectRequest extends jspb.Message { 194 | getId(): string; 195 | setId(value: string): InspectRequest; 196 | 197 | 198 | serializeBinary(): Uint8Array; 199 | toObject(includeInstance?: boolean): InspectRequest.AsObject; 200 | static toObject(includeInstance: boolean, msg: InspectRequest): InspectRequest.AsObject; 201 | static extensions: {[key: number]: jspb.ExtensionFieldInfo}; 202 | static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; 203 | static serializeBinaryToWriter(message: InspectRequest, writer: jspb.BinaryWriter): void; 204 | static deserializeBinary(bytes: Uint8Array): InspectRequest; 205 | static deserializeBinaryFromReader(message: InspectRequest, reader: jspb.BinaryReader): InspectRequest; 206 | } 207 | 208 | export namespace InspectRequest { 209 | export type AsObject = { 210 | id: string, 211 | } 212 | } 213 | 214 | export class InspectResponse extends jspb.Message { 215 | 216 | hasContainer(): boolean; 217 | clearContainer(): void; 218 | getContainer(): Container | undefined; 219 | setContainer(value?: Container): InspectResponse; 220 | 221 | 222 | serializeBinary(): Uint8Array; 223 | toObject(includeInstance?: boolean): InspectResponse.AsObject; 224 | static toObject(includeInstance: boolean, msg: InspectResponse): InspectResponse.AsObject; 225 | static extensions: {[key: number]: jspb.ExtensionFieldInfo}; 226 | static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; 227 | static serializeBinaryToWriter(message: InspectResponse, writer: jspb.BinaryWriter): void; 228 | static deserializeBinary(bytes: Uint8Array): InspectResponse; 229 | static deserializeBinaryFromReader(message: InspectResponse, reader: jspb.BinaryReader): InspectResponse; 230 | } 231 | 232 | export namespace InspectResponse { 233 | export type AsObject = { 234 | container?: Container.AsObject, 235 | } 236 | } 237 | 238 | export class DeleteRequest extends jspb.Message { 239 | getId(): string; 240 | setId(value: string): DeleteRequest; 241 | 242 | getForce(): boolean; 243 | setForce(value: boolean): DeleteRequest; 244 | 245 | 246 | serializeBinary(): Uint8Array; 247 | toObject(includeInstance?: boolean): DeleteRequest.AsObject; 248 | static toObject(includeInstance: boolean, msg: DeleteRequest): DeleteRequest.AsObject; 249 | static extensions: {[key: number]: jspb.ExtensionFieldInfo}; 250 | static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; 251 | static serializeBinaryToWriter(message: DeleteRequest, writer: jspb.BinaryWriter): void; 252 | static deserializeBinary(bytes: Uint8Array): DeleteRequest; 253 | static deserializeBinaryFromReader(message: DeleteRequest, reader: jspb.BinaryReader): DeleteRequest; 254 | } 255 | 256 | export namespace DeleteRequest { 257 | export type AsObject = { 258 | id: string, 259 | force: boolean, 260 | } 261 | } 262 | 263 | export class DeleteResponse extends jspb.Message { 264 | 265 | serializeBinary(): Uint8Array; 266 | toObject(includeInstance?: boolean): DeleteResponse.AsObject; 267 | static toObject(includeInstance: boolean, msg: DeleteResponse): DeleteResponse.AsObject; 268 | static extensions: {[key: number]: jspb.ExtensionFieldInfo}; 269 | static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; 270 | static serializeBinaryToWriter(message: DeleteResponse, writer: jspb.BinaryWriter): void; 271 | static deserializeBinary(bytes: Uint8Array): DeleteResponse; 272 | static deserializeBinaryFromReader(message: DeleteResponse, reader: jspb.BinaryReader): DeleteResponse; 273 | } 274 | 275 | export namespace DeleteResponse { 276 | export type AsObject = { 277 | } 278 | } 279 | 280 | export class StartRequest extends jspb.Message { 281 | getId(): string; 282 | setId(value: string): StartRequest; 283 | 284 | 285 | serializeBinary(): Uint8Array; 286 | toObject(includeInstance?: boolean): StartRequest.AsObject; 287 | static toObject(includeInstance: boolean, msg: StartRequest): StartRequest.AsObject; 288 | static extensions: {[key: number]: jspb.ExtensionFieldInfo}; 289 | static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; 290 | static serializeBinaryToWriter(message: StartRequest, writer: jspb.BinaryWriter): void; 291 | static deserializeBinary(bytes: Uint8Array): StartRequest; 292 | static deserializeBinaryFromReader(message: StartRequest, reader: jspb.BinaryReader): StartRequest; 293 | } 294 | 295 | export namespace StartRequest { 296 | export type AsObject = { 297 | id: string, 298 | } 299 | } 300 | 301 | export class StartResponse extends jspb.Message { 302 | 303 | serializeBinary(): Uint8Array; 304 | toObject(includeInstance?: boolean): StartResponse.AsObject; 305 | static toObject(includeInstance: boolean, msg: StartResponse): StartResponse.AsObject; 306 | static extensions: {[key: number]: jspb.ExtensionFieldInfo}; 307 | static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; 308 | static serializeBinaryToWriter(message: StartResponse, writer: jspb.BinaryWriter): void; 309 | static deserializeBinary(bytes: Uint8Array): StartResponse; 310 | static deserializeBinaryFromReader(message: StartResponse, reader: jspb.BinaryReader): StartResponse; 311 | } 312 | 313 | export namespace StartResponse { 314 | export type AsObject = { 315 | } 316 | } 317 | 318 | export class StopRequest extends jspb.Message { 319 | getId(): string; 320 | setId(value: string): StopRequest; 321 | 322 | getTimeout(): number; 323 | setTimeout(value: number): StopRequest; 324 | 325 | 326 | serializeBinary(): Uint8Array; 327 | toObject(includeInstance?: boolean): StopRequest.AsObject; 328 | static toObject(includeInstance: boolean, msg: StopRequest): StopRequest.AsObject; 329 | static extensions: {[key: number]: jspb.ExtensionFieldInfo}; 330 | static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; 331 | static serializeBinaryToWriter(message: StopRequest, writer: jspb.BinaryWriter): void; 332 | static deserializeBinary(bytes: Uint8Array): StopRequest; 333 | static deserializeBinaryFromReader(message: StopRequest, reader: jspb.BinaryReader): StopRequest; 334 | } 335 | 336 | export namespace StopRequest { 337 | export type AsObject = { 338 | id: string, 339 | timeout: number, 340 | } 341 | } 342 | 343 | export class StopResponse extends jspb.Message { 344 | 345 | serializeBinary(): Uint8Array; 346 | toObject(includeInstance?: boolean): StopResponse.AsObject; 347 | static toObject(includeInstance: boolean, msg: StopResponse): StopResponse.AsObject; 348 | static extensions: {[key: number]: jspb.ExtensionFieldInfo}; 349 | static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; 350 | static serializeBinaryToWriter(message: StopResponse, writer: jspb.BinaryWriter): void; 351 | static deserializeBinary(bytes: Uint8Array): StopResponse; 352 | static deserializeBinaryFromReader(message: StopResponse, reader: jspb.BinaryReader): StopResponse; 353 | } 354 | 355 | export namespace StopResponse { 356 | export type AsObject = { 357 | } 358 | } 359 | 360 | export class KillRequest extends jspb.Message { 361 | getId(): string; 362 | setId(value: string): KillRequest; 363 | 364 | getSignal(): string; 365 | setSignal(value: string): KillRequest; 366 | 367 | 368 | serializeBinary(): Uint8Array; 369 | toObject(includeInstance?: boolean): KillRequest.AsObject; 370 | static toObject(includeInstance: boolean, msg: KillRequest): KillRequest.AsObject; 371 | static extensions: {[key: number]: jspb.ExtensionFieldInfo}; 372 | static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; 373 | static serializeBinaryToWriter(message: KillRequest, writer: jspb.BinaryWriter): void; 374 | static deserializeBinary(bytes: Uint8Array): KillRequest; 375 | static deserializeBinaryFromReader(message: KillRequest, reader: jspb.BinaryReader): KillRequest; 376 | } 377 | 378 | export namespace KillRequest { 379 | export type AsObject = { 380 | id: string, 381 | signal: string, 382 | } 383 | } 384 | 385 | export class KillResponse extends jspb.Message { 386 | 387 | serializeBinary(): Uint8Array; 388 | toObject(includeInstance?: boolean): KillResponse.AsObject; 389 | static toObject(includeInstance: boolean, msg: KillResponse): KillResponse.AsObject; 390 | static extensions: {[key: number]: jspb.ExtensionFieldInfo}; 391 | static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; 392 | static serializeBinaryToWriter(message: KillResponse, writer: jspb.BinaryWriter): void; 393 | static deserializeBinary(bytes: Uint8Array): KillResponse; 394 | static deserializeBinaryFromReader(message: KillResponse, reader: jspb.BinaryReader): KillResponse; 395 | } 396 | 397 | export namespace KillResponse { 398 | export type AsObject = { 399 | } 400 | } 401 | 402 | export class RunRequest extends jspb.Message { 403 | getId(): string; 404 | setId(value: string): RunRequest; 405 | 406 | getImage(): string; 407 | setImage(value: string): RunRequest; 408 | 409 | clearPortsList(): void; 410 | getPortsList(): Array; 411 | setPortsList(value: Array): RunRequest; 412 | addPorts(value?: Port, index?: number): Port; 413 | 414 | 415 | getLabelsMap(): jspb.Map; 416 | clearLabelsMap(): void; 417 | 418 | clearVolumesList(): void; 419 | getVolumesList(): Array; 420 | setVolumesList(value: Array): RunRequest; 421 | addVolumes(value: string, index?: number): string; 422 | 423 | getMemoryLimit(): number; 424 | setMemoryLimit(value: number): RunRequest; 425 | 426 | getCpuLimit(): number; 427 | setCpuLimit(value: number): RunRequest; 428 | 429 | getRestartPolicyCondition(): string; 430 | setRestartPolicyCondition(value: string): RunRequest; 431 | 432 | clearCommandList(): void; 433 | getCommandList(): Array; 434 | setCommandList(value: Array): RunRequest; 435 | addCommand(value: string, index?: number): string; 436 | 437 | clearEnvironmentList(): void; 438 | getEnvironmentList(): Array; 439 | setEnvironmentList(value: Array): RunRequest; 440 | addEnvironment(value: string, index?: number): string; 441 | 442 | getAutoRemove(): boolean; 443 | setAutoRemove(value: boolean): RunRequest; 444 | 445 | 446 | hasHealthcheck(): boolean; 447 | clearHealthcheck(): void; 448 | getHealthcheck(): Healthcheck | undefined; 449 | setHealthcheck(value?: Healthcheck): RunRequest; 450 | 451 | getPlatform(): string; 452 | setPlatform(value: string): RunRequest; 453 | 454 | 455 | serializeBinary(): Uint8Array; 456 | toObject(includeInstance?: boolean): RunRequest.AsObject; 457 | static toObject(includeInstance: boolean, msg: RunRequest): RunRequest.AsObject; 458 | static extensions: {[key: number]: jspb.ExtensionFieldInfo}; 459 | static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; 460 | static serializeBinaryToWriter(message: RunRequest, writer: jspb.BinaryWriter): void; 461 | static deserializeBinary(bytes: Uint8Array): RunRequest; 462 | static deserializeBinaryFromReader(message: RunRequest, reader: jspb.BinaryReader): RunRequest; 463 | } 464 | 465 | export namespace RunRequest { 466 | export type AsObject = { 467 | id: string, 468 | image: string, 469 | portsList: Array, 470 | 471 | labelsMap: Array<[string, string]>, 472 | volumesList: Array, 473 | memoryLimit: number, 474 | cpuLimit: number, 475 | restartPolicyCondition: string, 476 | commandList: Array, 477 | environmentList: Array, 478 | autoRemove: boolean, 479 | healthcheck?: Healthcheck.AsObject, 480 | platform: string, 481 | } 482 | } 483 | 484 | export class RunResponse extends jspb.Message { 485 | 486 | serializeBinary(): Uint8Array; 487 | toObject(includeInstance?: boolean): RunResponse.AsObject; 488 | static toObject(includeInstance: boolean, msg: RunResponse): RunResponse.AsObject; 489 | static extensions: {[key: number]: jspb.ExtensionFieldInfo}; 490 | static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; 491 | static serializeBinaryToWriter(message: RunResponse, writer: jspb.BinaryWriter): void; 492 | static deserializeBinary(bytes: Uint8Array): RunResponse; 493 | static deserializeBinaryFromReader(message: RunResponse, reader: jspb.BinaryReader): RunResponse; 494 | } 495 | 496 | export namespace RunResponse { 497 | export type AsObject = { 498 | } 499 | } 500 | 501 | export class ExecRequest extends jspb.Message { 502 | getId(): string; 503 | setId(value: string): ExecRequest; 504 | 505 | getCommand(): string; 506 | setCommand(value: string): ExecRequest; 507 | 508 | getStreamId(): string; 509 | setStreamId(value: string): ExecRequest; 510 | 511 | clearArgsList(): void; 512 | getArgsList(): Array; 513 | setArgsList(value: Array): ExecRequest; 514 | addArgs(value: string, index?: number): string; 515 | 516 | clearEnvList(): void; 517 | getEnvList(): Array; 518 | setEnvList(value: Array): ExecRequest; 519 | addEnv(value: string, index?: number): string; 520 | 521 | getTty(): boolean; 522 | setTty(value: boolean): ExecRequest; 523 | 524 | 525 | serializeBinary(): Uint8Array; 526 | toObject(includeInstance?: boolean): ExecRequest.AsObject; 527 | static toObject(includeInstance: boolean, msg: ExecRequest): ExecRequest.AsObject; 528 | static extensions: {[key: number]: jspb.ExtensionFieldInfo}; 529 | static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; 530 | static serializeBinaryToWriter(message: ExecRequest, writer: jspb.BinaryWriter): void; 531 | static deserializeBinary(bytes: Uint8Array): ExecRequest; 532 | static deserializeBinaryFromReader(message: ExecRequest, reader: jspb.BinaryReader): ExecRequest; 533 | } 534 | 535 | export namespace ExecRequest { 536 | export type AsObject = { 537 | id: string, 538 | command: string, 539 | streamId: string, 540 | argsList: Array, 541 | envList: Array, 542 | tty: boolean, 543 | } 544 | } 545 | 546 | export class ExecResponse extends jspb.Message { 547 | getOutput(): Uint8Array | string; 548 | getOutput_asU8(): Uint8Array; 549 | getOutput_asB64(): string; 550 | setOutput(value: Uint8Array | string): ExecResponse; 551 | 552 | 553 | serializeBinary(): Uint8Array; 554 | toObject(includeInstance?: boolean): ExecResponse.AsObject; 555 | static toObject(includeInstance: boolean, msg: ExecResponse): ExecResponse.AsObject; 556 | static extensions: {[key: number]: jspb.ExtensionFieldInfo}; 557 | static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; 558 | static serializeBinaryToWriter(message: ExecResponse, writer: jspb.BinaryWriter): void; 559 | static deserializeBinary(bytes: Uint8Array): ExecResponse; 560 | static deserializeBinaryFromReader(message: ExecResponse, reader: jspb.BinaryReader): ExecResponse; 561 | } 562 | 563 | export namespace ExecResponse { 564 | export type AsObject = { 565 | output: Uint8Array | string, 566 | } 567 | } 568 | 569 | export class ListRequest extends jspb.Message { 570 | getAll(): boolean; 571 | setAll(value: boolean): ListRequest; 572 | 573 | 574 | serializeBinary(): Uint8Array; 575 | toObject(includeInstance?: boolean): ListRequest.AsObject; 576 | static toObject(includeInstance: boolean, msg: ListRequest): ListRequest.AsObject; 577 | static extensions: {[key: number]: jspb.ExtensionFieldInfo}; 578 | static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; 579 | static serializeBinaryToWriter(message: ListRequest, writer: jspb.BinaryWriter): void; 580 | static deserializeBinary(bytes: Uint8Array): ListRequest; 581 | static deserializeBinaryFromReader(message: ListRequest, reader: jspb.BinaryReader): ListRequest; 582 | } 583 | 584 | export namespace ListRequest { 585 | export type AsObject = { 586 | all: boolean, 587 | } 588 | } 589 | 590 | export class ListResponse extends jspb.Message { 591 | clearContainersList(): void; 592 | getContainersList(): Array; 593 | setContainersList(value: Array): ListResponse; 594 | addContainers(value?: Container, index?: number): Container; 595 | 596 | 597 | serializeBinary(): Uint8Array; 598 | toObject(includeInstance?: boolean): ListResponse.AsObject; 599 | static toObject(includeInstance: boolean, msg: ListResponse): ListResponse.AsObject; 600 | static extensions: {[key: number]: jspb.ExtensionFieldInfo}; 601 | static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; 602 | static serializeBinaryToWriter(message: ListResponse, writer: jspb.BinaryWriter): void; 603 | static deserializeBinary(bytes: Uint8Array): ListResponse; 604 | static deserializeBinaryFromReader(message: ListResponse, reader: jspb.BinaryReader): ListResponse; 605 | } 606 | 607 | export namespace ListResponse { 608 | export type AsObject = { 609 | containersList: Array, 610 | } 611 | } 612 | 613 | export class LogsRequest extends jspb.Message { 614 | getContainerId(): string; 615 | setContainerId(value: string): LogsRequest; 616 | 617 | getFollow(): boolean; 618 | setFollow(value: boolean): LogsRequest; 619 | 620 | 621 | serializeBinary(): Uint8Array; 622 | toObject(includeInstance?: boolean): LogsRequest.AsObject; 623 | static toObject(includeInstance: boolean, msg: LogsRequest): LogsRequest.AsObject; 624 | static extensions: {[key: number]: jspb.ExtensionFieldInfo}; 625 | static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; 626 | static serializeBinaryToWriter(message: LogsRequest, writer: jspb.BinaryWriter): void; 627 | static deserializeBinary(bytes: Uint8Array): LogsRequest; 628 | static deserializeBinaryFromReader(message: LogsRequest, reader: jspb.BinaryReader): LogsRequest; 629 | } 630 | 631 | export namespace LogsRequest { 632 | export type AsObject = { 633 | containerId: string, 634 | follow: boolean, 635 | } 636 | } 637 | 638 | export class LogsResponse extends jspb.Message { 639 | getValue(): Uint8Array | string; 640 | getValue_asU8(): Uint8Array; 641 | getValue_asB64(): string; 642 | setValue(value: Uint8Array | string): LogsResponse; 643 | 644 | 645 | serializeBinary(): Uint8Array; 646 | toObject(includeInstance?: boolean): LogsResponse.AsObject; 647 | static toObject(includeInstance: boolean, msg: LogsResponse): LogsResponse.AsObject; 648 | static extensions: {[key: number]: jspb.ExtensionFieldInfo}; 649 | static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; 650 | static serializeBinaryToWriter(message: LogsResponse, writer: jspb.BinaryWriter): void; 651 | static deserializeBinary(bytes: Uint8Array): LogsResponse; 652 | static deserializeBinaryFromReader(message: LogsResponse, reader: jspb.BinaryReader): LogsResponse; 653 | } 654 | 655 | export namespace LogsResponse { 656 | export type AsObject = { 657 | value: Uint8Array | string, 658 | } 659 | } 660 | -------------------------------------------------------------------------------- /src/protos/contexts/v1/contexts.proto: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2020 Docker Compose CLI authors 3 | 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | syntax = "proto3"; 17 | 18 | package com.docker.api.protos.context.v1; 19 | 20 | option go_package = "github.com/docker/compose-cli/cli/server/protos/context/v1;v1"; 21 | 22 | service Contexts { 23 | // Sets the current request for all calls 24 | rpc SetCurrent(SetCurrentRequest) returns (SetCurrentResponse); 25 | // Returns the list of existing contexts 26 | rpc List(ListRequest) returns (ListResponse); 27 | } 28 | 29 | message Context { 30 | string name = 1; 31 | string contextType = 2; 32 | bool current = 3; 33 | string description = 4; 34 | oneof Endpoint { 35 | DockerEndpoint docker_endpoint = 5; 36 | AciEndpoint aci_endpoint = 6; 37 | EcsEndpoint ecs_endpoint = 7; 38 | } 39 | } 40 | 41 | message DockerEndpoint { 42 | string host = 1; 43 | } 44 | 45 | message AciEndpoint { 46 | string region = 1; 47 | string resource_group = 2; 48 | string subscription_id = 3; 49 | } 50 | 51 | message EcsEndpoint { 52 | string profile = 1; 53 | bool from_environment = 2; 54 | } 55 | 56 | message SetCurrentRequest { 57 | string name = 1; 58 | } 59 | 60 | message SetCurrentResponse { 61 | } 62 | 63 | message ListRequest { 64 | } 65 | 66 | message ListResponse { 67 | repeated Context contexts = 1; 68 | } 69 | -------------------------------------------------------------------------------- /src/protos/contexts/v1/contexts_grpc_pb.d.ts: -------------------------------------------------------------------------------- 1 | // package: com.docker.api.protos.context.v1 2 | // file: contexts/v1/contexts.proto 3 | 4 | /* tslint:disable */ 5 | /* eslint-disable */ 6 | 7 | import * as grpc from "@grpc/grpc-js"; 8 | import {handleClientStreamingCall} from "@grpc/grpc-js/build/src/server-call"; 9 | import * as contexts_v1_contexts_pb from "../../contexts/v1/contexts_pb"; 10 | 11 | interface IContextsService extends grpc.ServiceDefinition { 12 | setCurrent: IContextsService_ISetCurrent; 13 | list: IContextsService_IList; 14 | } 15 | 16 | interface IContextsService_ISetCurrent extends grpc.MethodDefinition { 17 | path: string; // "/com.docker.api.protos.context.v1.Contexts/SetCurrent" 18 | requestStream: false; 19 | responseStream: false; 20 | requestSerialize: grpc.serialize; 21 | requestDeserialize: grpc.deserialize; 22 | responseSerialize: grpc.serialize; 23 | responseDeserialize: grpc.deserialize; 24 | } 25 | interface IContextsService_IList extends grpc.MethodDefinition { 26 | path: string; // "/com.docker.api.protos.context.v1.Contexts/List" 27 | requestStream: false; 28 | responseStream: false; 29 | requestSerialize: grpc.serialize; 30 | requestDeserialize: grpc.deserialize; 31 | responseSerialize: grpc.serialize; 32 | responseDeserialize: grpc.deserialize; 33 | } 34 | 35 | export const ContextsService: IContextsService; 36 | 37 | export interface IContextsServer { 38 | setCurrent: grpc.handleUnaryCall; 39 | list: grpc.handleUnaryCall; 40 | } 41 | 42 | export interface IContextsClient { 43 | setCurrent(request: contexts_v1_contexts_pb.SetCurrentRequest, callback: (error: grpc.ServiceError | null, response: contexts_v1_contexts_pb.SetCurrentResponse) => void): grpc.ClientUnaryCall; 44 | setCurrent(request: contexts_v1_contexts_pb.SetCurrentRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: contexts_v1_contexts_pb.SetCurrentResponse) => void): grpc.ClientUnaryCall; 45 | setCurrent(request: contexts_v1_contexts_pb.SetCurrentRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: contexts_v1_contexts_pb.SetCurrentResponse) => void): grpc.ClientUnaryCall; 46 | list(request: contexts_v1_contexts_pb.ListRequest, callback: (error: grpc.ServiceError | null, response: contexts_v1_contexts_pb.ListResponse) => void): grpc.ClientUnaryCall; 47 | list(request: contexts_v1_contexts_pb.ListRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: contexts_v1_contexts_pb.ListResponse) => void): grpc.ClientUnaryCall; 48 | list(request: contexts_v1_contexts_pb.ListRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: contexts_v1_contexts_pb.ListResponse) => void): grpc.ClientUnaryCall; 49 | } 50 | 51 | export class ContextsClient extends grpc.Client implements IContextsClient { 52 | constructor(address: string, credentials: grpc.ChannelCredentials, options?: object); 53 | public setCurrent(request: contexts_v1_contexts_pb.SetCurrentRequest, callback: (error: grpc.ServiceError | null, response: contexts_v1_contexts_pb.SetCurrentResponse) => void): grpc.ClientUnaryCall; 54 | public setCurrent(request: contexts_v1_contexts_pb.SetCurrentRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: contexts_v1_contexts_pb.SetCurrentResponse) => void): grpc.ClientUnaryCall; 55 | public setCurrent(request: contexts_v1_contexts_pb.SetCurrentRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: contexts_v1_contexts_pb.SetCurrentResponse) => void): grpc.ClientUnaryCall; 56 | public list(request: contexts_v1_contexts_pb.ListRequest, callback: (error: grpc.ServiceError | null, response: contexts_v1_contexts_pb.ListResponse) => void): grpc.ClientUnaryCall; 57 | public list(request: contexts_v1_contexts_pb.ListRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: contexts_v1_contexts_pb.ListResponse) => void): grpc.ClientUnaryCall; 58 | public list(request: contexts_v1_contexts_pb.ListRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: contexts_v1_contexts_pb.ListResponse) => void): grpc.ClientUnaryCall; 59 | } 60 | -------------------------------------------------------------------------------- /src/protos/contexts/v1/contexts_grpc_pb.js: -------------------------------------------------------------------------------- 1 | // GENERATED CODE -- DO NOT EDIT! 2 | 3 | // Original file comments: 4 | // 5 | // Copyright 2020 Docker Compose CLI authors 6 | // 7 | // Licensed under the Apache License, Version 2.0 (the "License"); 8 | // you may not use this file except in compliance with the License. 9 | // You may obtain a copy of the License at 10 | // 11 | // http://www.apache.org/licenses/LICENSE-2.0 12 | // 13 | // Unless required by applicable law or agreed to in writing, software 14 | // distributed under the License is distributed on an "AS IS" BASIS, 15 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | // See the License for the specific language governing permissions and 17 | // limitations under the License. 18 | // 19 | 'use strict'; 20 | var grpc = require('@grpc/grpc-js'); 21 | var contexts_v1_contexts_pb = require('../../contexts/v1/contexts_pb.js'); 22 | 23 | function serialize_com_docker_api_protos_context_v1_ListRequest(arg) { 24 | if (!(arg instanceof contexts_v1_contexts_pb.ListRequest)) { 25 | throw new Error('Expected argument of type com.docker.api.protos.context.v1.ListRequest'); 26 | } 27 | return Buffer.from(arg.serializeBinary()); 28 | } 29 | 30 | function deserialize_com_docker_api_protos_context_v1_ListRequest(buffer_arg) { 31 | return contexts_v1_contexts_pb.ListRequest.deserializeBinary(new Uint8Array(buffer_arg)); 32 | } 33 | 34 | function serialize_com_docker_api_protos_context_v1_ListResponse(arg) { 35 | if (!(arg instanceof contexts_v1_contexts_pb.ListResponse)) { 36 | throw new Error('Expected argument of type com.docker.api.protos.context.v1.ListResponse'); 37 | } 38 | return Buffer.from(arg.serializeBinary()); 39 | } 40 | 41 | function deserialize_com_docker_api_protos_context_v1_ListResponse(buffer_arg) { 42 | return contexts_v1_contexts_pb.ListResponse.deserializeBinary(new Uint8Array(buffer_arg)); 43 | } 44 | 45 | function serialize_com_docker_api_protos_context_v1_SetCurrentRequest(arg) { 46 | if (!(arg instanceof contexts_v1_contexts_pb.SetCurrentRequest)) { 47 | throw new Error('Expected argument of type com.docker.api.protos.context.v1.SetCurrentRequest'); 48 | } 49 | return Buffer.from(arg.serializeBinary()); 50 | } 51 | 52 | function deserialize_com_docker_api_protos_context_v1_SetCurrentRequest(buffer_arg) { 53 | return contexts_v1_contexts_pb.SetCurrentRequest.deserializeBinary(new Uint8Array(buffer_arg)); 54 | } 55 | 56 | function serialize_com_docker_api_protos_context_v1_SetCurrentResponse(arg) { 57 | if (!(arg instanceof contexts_v1_contexts_pb.SetCurrentResponse)) { 58 | throw new Error('Expected argument of type com.docker.api.protos.context.v1.SetCurrentResponse'); 59 | } 60 | return Buffer.from(arg.serializeBinary()); 61 | } 62 | 63 | function deserialize_com_docker_api_protos_context_v1_SetCurrentResponse(buffer_arg) { 64 | return contexts_v1_contexts_pb.SetCurrentResponse.deserializeBinary(new Uint8Array(buffer_arg)); 65 | } 66 | 67 | 68 | var ContextsService = exports.ContextsService = { 69 | // Sets the current request for all calls 70 | setCurrent: { 71 | path: '/com.docker.api.protos.context.v1.Contexts/SetCurrent', 72 | requestStream: false, 73 | responseStream: false, 74 | requestType: contexts_v1_contexts_pb.SetCurrentRequest, 75 | responseType: contexts_v1_contexts_pb.SetCurrentResponse, 76 | requestSerialize: serialize_com_docker_api_protos_context_v1_SetCurrentRequest, 77 | requestDeserialize: deserialize_com_docker_api_protos_context_v1_SetCurrentRequest, 78 | responseSerialize: serialize_com_docker_api_protos_context_v1_SetCurrentResponse, 79 | responseDeserialize: deserialize_com_docker_api_protos_context_v1_SetCurrentResponse, 80 | }, 81 | // Returns the list of existing contexts 82 | list: { 83 | path: '/com.docker.api.protos.context.v1.Contexts/List', 84 | requestStream: false, 85 | responseStream: false, 86 | requestType: contexts_v1_contexts_pb.ListRequest, 87 | responseType: contexts_v1_contexts_pb.ListResponse, 88 | requestSerialize: serialize_com_docker_api_protos_context_v1_ListRequest, 89 | requestDeserialize: deserialize_com_docker_api_protos_context_v1_ListRequest, 90 | responseSerialize: serialize_com_docker_api_protos_context_v1_ListResponse, 91 | responseDeserialize: deserialize_com_docker_api_protos_context_v1_ListResponse, 92 | }, 93 | }; 94 | 95 | exports.ContextsClient = grpc.makeGenericClientConstructor(ContextsService); 96 | -------------------------------------------------------------------------------- /src/protos/contexts/v1/contexts_pb.d.ts: -------------------------------------------------------------------------------- 1 | // package: com.docker.api.protos.context.v1 2 | // file: contexts/v1/contexts.proto 3 | 4 | /* tslint:disable */ 5 | /* eslint-disable */ 6 | 7 | import * as jspb from "google-protobuf"; 8 | 9 | export class Context extends jspb.Message { 10 | getName(): string; 11 | setName(value: string): Context; 12 | 13 | getContexttype(): string; 14 | setContexttype(value: string): Context; 15 | 16 | getCurrent(): boolean; 17 | setCurrent(value: boolean): Context; 18 | 19 | getDescription(): string; 20 | setDescription(value: string): Context; 21 | 22 | 23 | hasDockerEndpoint(): boolean; 24 | clearDockerEndpoint(): void; 25 | getDockerEndpoint(): DockerEndpoint | undefined; 26 | setDockerEndpoint(value?: DockerEndpoint): Context; 27 | 28 | 29 | hasAciEndpoint(): boolean; 30 | clearAciEndpoint(): void; 31 | getAciEndpoint(): AciEndpoint | undefined; 32 | setAciEndpoint(value?: AciEndpoint): Context; 33 | 34 | 35 | hasEcsEndpoint(): boolean; 36 | clearEcsEndpoint(): void; 37 | getEcsEndpoint(): EcsEndpoint | undefined; 38 | setEcsEndpoint(value?: EcsEndpoint): Context; 39 | 40 | 41 | getEndpointCase(): Context.EndpointCase; 42 | 43 | serializeBinary(): Uint8Array; 44 | toObject(includeInstance?: boolean): Context.AsObject; 45 | static toObject(includeInstance: boolean, msg: Context): Context.AsObject; 46 | static extensions: {[key: number]: jspb.ExtensionFieldInfo}; 47 | static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; 48 | static serializeBinaryToWriter(message: Context, writer: jspb.BinaryWriter): void; 49 | static deserializeBinary(bytes: Uint8Array): Context; 50 | static deserializeBinaryFromReader(message: Context, reader: jspb.BinaryReader): Context; 51 | } 52 | 53 | export namespace Context { 54 | export type AsObject = { 55 | name: string, 56 | contexttype: string, 57 | current: boolean, 58 | description: string, 59 | dockerEndpoint?: DockerEndpoint.AsObject, 60 | aciEndpoint?: AciEndpoint.AsObject, 61 | ecsEndpoint?: EcsEndpoint.AsObject, 62 | } 63 | 64 | export enum EndpointCase { 65 | ENDPOINT_NOT_SET = 0, 66 | 67 | DOCKER_ENDPOINT = 5, 68 | 69 | ACI_ENDPOINT = 6, 70 | 71 | ECS_ENDPOINT = 7, 72 | 73 | } 74 | 75 | } 76 | 77 | export class DockerEndpoint extends jspb.Message { 78 | getHost(): string; 79 | setHost(value: string): DockerEndpoint; 80 | 81 | 82 | serializeBinary(): Uint8Array; 83 | toObject(includeInstance?: boolean): DockerEndpoint.AsObject; 84 | static toObject(includeInstance: boolean, msg: DockerEndpoint): DockerEndpoint.AsObject; 85 | static extensions: {[key: number]: jspb.ExtensionFieldInfo}; 86 | static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; 87 | static serializeBinaryToWriter(message: DockerEndpoint, writer: jspb.BinaryWriter): void; 88 | static deserializeBinary(bytes: Uint8Array): DockerEndpoint; 89 | static deserializeBinaryFromReader(message: DockerEndpoint, reader: jspb.BinaryReader): DockerEndpoint; 90 | } 91 | 92 | export namespace DockerEndpoint { 93 | export type AsObject = { 94 | host: string, 95 | } 96 | } 97 | 98 | export class AciEndpoint extends jspb.Message { 99 | getRegion(): string; 100 | setRegion(value: string): AciEndpoint; 101 | 102 | getResourceGroup(): string; 103 | setResourceGroup(value: string): AciEndpoint; 104 | 105 | getSubscriptionId(): string; 106 | setSubscriptionId(value: string): AciEndpoint; 107 | 108 | 109 | serializeBinary(): Uint8Array; 110 | toObject(includeInstance?: boolean): AciEndpoint.AsObject; 111 | static toObject(includeInstance: boolean, msg: AciEndpoint): AciEndpoint.AsObject; 112 | static extensions: {[key: number]: jspb.ExtensionFieldInfo}; 113 | static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; 114 | static serializeBinaryToWriter(message: AciEndpoint, writer: jspb.BinaryWriter): void; 115 | static deserializeBinary(bytes: Uint8Array): AciEndpoint; 116 | static deserializeBinaryFromReader(message: AciEndpoint, reader: jspb.BinaryReader): AciEndpoint; 117 | } 118 | 119 | export namespace AciEndpoint { 120 | export type AsObject = { 121 | region: string, 122 | resourceGroup: string, 123 | subscriptionId: string, 124 | } 125 | } 126 | 127 | export class EcsEndpoint extends jspb.Message { 128 | getProfile(): string; 129 | setProfile(value: string): EcsEndpoint; 130 | 131 | getFromEnvironment(): boolean; 132 | setFromEnvironment(value: boolean): EcsEndpoint; 133 | 134 | 135 | serializeBinary(): Uint8Array; 136 | toObject(includeInstance?: boolean): EcsEndpoint.AsObject; 137 | static toObject(includeInstance: boolean, msg: EcsEndpoint): EcsEndpoint.AsObject; 138 | static extensions: {[key: number]: jspb.ExtensionFieldInfo}; 139 | static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; 140 | static serializeBinaryToWriter(message: EcsEndpoint, writer: jspb.BinaryWriter): void; 141 | static deserializeBinary(bytes: Uint8Array): EcsEndpoint; 142 | static deserializeBinaryFromReader(message: EcsEndpoint, reader: jspb.BinaryReader): EcsEndpoint; 143 | } 144 | 145 | export namespace EcsEndpoint { 146 | export type AsObject = { 147 | profile: string, 148 | fromEnvironment: boolean, 149 | } 150 | } 151 | 152 | export class SetCurrentRequest extends jspb.Message { 153 | getName(): string; 154 | setName(value: string): SetCurrentRequest; 155 | 156 | 157 | serializeBinary(): Uint8Array; 158 | toObject(includeInstance?: boolean): SetCurrentRequest.AsObject; 159 | static toObject(includeInstance: boolean, msg: SetCurrentRequest): SetCurrentRequest.AsObject; 160 | static extensions: {[key: number]: jspb.ExtensionFieldInfo}; 161 | static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; 162 | static serializeBinaryToWriter(message: SetCurrentRequest, writer: jspb.BinaryWriter): void; 163 | static deserializeBinary(bytes: Uint8Array): SetCurrentRequest; 164 | static deserializeBinaryFromReader(message: SetCurrentRequest, reader: jspb.BinaryReader): SetCurrentRequest; 165 | } 166 | 167 | export namespace SetCurrentRequest { 168 | export type AsObject = { 169 | name: string, 170 | } 171 | } 172 | 173 | export class SetCurrentResponse extends jspb.Message { 174 | 175 | serializeBinary(): Uint8Array; 176 | toObject(includeInstance?: boolean): SetCurrentResponse.AsObject; 177 | static toObject(includeInstance: boolean, msg: SetCurrentResponse): SetCurrentResponse.AsObject; 178 | static extensions: {[key: number]: jspb.ExtensionFieldInfo}; 179 | static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; 180 | static serializeBinaryToWriter(message: SetCurrentResponse, writer: jspb.BinaryWriter): void; 181 | static deserializeBinary(bytes: Uint8Array): SetCurrentResponse; 182 | static deserializeBinaryFromReader(message: SetCurrentResponse, reader: jspb.BinaryReader): SetCurrentResponse; 183 | } 184 | 185 | export namespace SetCurrentResponse { 186 | export type AsObject = { 187 | } 188 | } 189 | 190 | export class ListRequest extends jspb.Message { 191 | 192 | serializeBinary(): Uint8Array; 193 | toObject(includeInstance?: boolean): ListRequest.AsObject; 194 | static toObject(includeInstance: boolean, msg: ListRequest): ListRequest.AsObject; 195 | static extensions: {[key: number]: jspb.ExtensionFieldInfo}; 196 | static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; 197 | static serializeBinaryToWriter(message: ListRequest, writer: jspb.BinaryWriter): void; 198 | static deserializeBinary(bytes: Uint8Array): ListRequest; 199 | static deserializeBinaryFromReader(message: ListRequest, reader: jspb.BinaryReader): ListRequest; 200 | } 201 | 202 | export namespace ListRequest { 203 | export type AsObject = { 204 | } 205 | } 206 | 207 | export class ListResponse extends jspb.Message { 208 | clearContextsList(): void; 209 | getContextsList(): Array; 210 | setContextsList(value: Array): ListResponse; 211 | addContexts(value?: Context, index?: number): Context; 212 | 213 | 214 | serializeBinary(): Uint8Array; 215 | toObject(includeInstance?: boolean): ListResponse.AsObject; 216 | static toObject(includeInstance: boolean, msg: ListResponse): ListResponse.AsObject; 217 | static extensions: {[key: number]: jspb.ExtensionFieldInfo}; 218 | static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; 219 | static serializeBinaryToWriter(message: ListResponse, writer: jspb.BinaryWriter): void; 220 | static deserializeBinary(bytes: Uint8Array): ListResponse; 221 | static deserializeBinaryFromReader(message: ListResponse, reader: jspb.BinaryReader): ListResponse; 222 | } 223 | 224 | export namespace ListResponse { 225 | export type AsObject = { 226 | contextsList: Array, 227 | } 228 | } 229 | -------------------------------------------------------------------------------- /src/protos/streams/v1/streams.proto: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2020 Docker Compose CLI authors 3 | 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | syntax = "proto3"; 17 | 18 | package com.docker.api.protos.streams.v1; 19 | 20 | import "google/protobuf/any.proto"; 21 | 22 | option go_package = "github.com/docker/compose-cli/cli/server/protos/streams/v1;v1"; 23 | 24 | service Streaming { 25 | rpc NewStream(stream google.protobuf.Any) returns (stream google.protobuf.Any); 26 | } 27 | 28 | enum IOStream { 29 | STDIN = 0; 30 | STDOUT = 1; 31 | STDERR = 2; 32 | } 33 | 34 | message BytesMessage { 35 | IOStream type = 1; 36 | bytes value = 2; 37 | } 38 | 39 | message ResizeMessage { 40 | uint32 width = 1; 41 | uint32 height = 2; 42 | } 43 | 44 | message ExitMessage { 45 | uint32 status = 1; 46 | } 47 | -------------------------------------------------------------------------------- /src/protos/streams/v1/streams_grpc_pb.d.ts: -------------------------------------------------------------------------------- 1 | // package: com.docker.api.protos.streams.v1 2 | // file: streams/v1/streams.proto 3 | 4 | /* tslint:disable */ 5 | /* eslint-disable */ 6 | 7 | import * as grpc from "@grpc/grpc-js"; 8 | import {handleClientStreamingCall} from "@grpc/grpc-js/build/src/server-call"; 9 | import * as streams_v1_streams_pb from "../../streams/v1/streams_pb"; 10 | import * as google_protobuf_any_pb from "google-protobuf/google/protobuf/any_pb"; 11 | 12 | interface IStreamingService extends grpc.ServiceDefinition { 13 | newStream: IStreamingService_INewStream; 14 | } 15 | 16 | interface IStreamingService_INewStream extends grpc.MethodDefinition { 17 | path: string; // "/com.docker.api.protos.streams.v1.Streaming/NewStream" 18 | requestStream: true; 19 | responseStream: true; 20 | requestSerialize: grpc.serialize; 21 | requestDeserialize: grpc.deserialize; 22 | responseSerialize: grpc.serialize; 23 | responseDeserialize: grpc.deserialize; 24 | } 25 | 26 | export const StreamingService: IStreamingService; 27 | 28 | export interface IStreamingServer { 29 | newStream: grpc.handleBidiStreamingCall; 30 | } 31 | 32 | export interface IStreamingClient { 33 | newStream(): grpc.ClientDuplexStream; 34 | newStream(options: Partial): grpc.ClientDuplexStream; 35 | newStream(metadata: grpc.Metadata, options?: Partial): grpc.ClientDuplexStream; 36 | } 37 | 38 | export class StreamingClient extends grpc.Client implements IStreamingClient { 39 | constructor(address: string, credentials: grpc.ChannelCredentials, options?: object); 40 | public newStream(options?: Partial): grpc.ClientDuplexStream; 41 | public newStream(metadata?: grpc.Metadata, options?: Partial): grpc.ClientDuplexStream; 42 | } 43 | -------------------------------------------------------------------------------- /src/protos/streams/v1/streams_grpc_pb.js: -------------------------------------------------------------------------------- 1 | // GENERATED CODE -- DO NOT EDIT! 2 | 3 | // Original file comments: 4 | // 5 | // Copyright 2020 Docker Compose CLI authors 6 | // 7 | // Licensed under the Apache License, Version 2.0 (the "License"); 8 | // you may not use this file except in compliance with the License. 9 | // You may obtain a copy of the License at 10 | // 11 | // http://www.apache.org/licenses/LICENSE-2.0 12 | // 13 | // Unless required by applicable law or agreed to in writing, software 14 | // distributed under the License is distributed on an "AS IS" BASIS, 15 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | // See the License for the specific language governing permissions and 17 | // limitations under the License. 18 | // 19 | 'use strict'; 20 | var grpc = require('@grpc/grpc-js'); 21 | var streams_v1_streams_pb = require('../../streams/v1/streams_pb.js'); 22 | var google_protobuf_any_pb = require('google-protobuf/google/protobuf/any_pb.js'); 23 | 24 | function serialize_google_protobuf_Any(arg) { 25 | if (!(arg instanceof google_protobuf_any_pb.Any)) { 26 | throw new Error('Expected argument of type google.protobuf.Any'); 27 | } 28 | return Buffer.from(arg.serializeBinary()); 29 | } 30 | 31 | function deserialize_google_protobuf_Any(buffer_arg) { 32 | return google_protobuf_any_pb.Any.deserializeBinary(new Uint8Array(buffer_arg)); 33 | } 34 | 35 | 36 | var StreamingService = exports.StreamingService = { 37 | newStream: { 38 | path: '/com.docker.api.protos.streams.v1.Streaming/NewStream', 39 | requestStream: true, 40 | responseStream: true, 41 | requestType: google_protobuf_any_pb.Any, 42 | responseType: google_protobuf_any_pb.Any, 43 | requestSerialize: serialize_google_protobuf_Any, 44 | requestDeserialize: deserialize_google_protobuf_Any, 45 | responseSerialize: serialize_google_protobuf_Any, 46 | responseDeserialize: deserialize_google_protobuf_Any, 47 | }, 48 | }; 49 | 50 | exports.StreamingClient = grpc.makeGenericClientConstructor(StreamingService); 51 | -------------------------------------------------------------------------------- /src/protos/streams/v1/streams_pb.d.ts: -------------------------------------------------------------------------------- 1 | // package: com.docker.api.protos.streams.v1 2 | // file: streams/v1/streams.proto 3 | 4 | /* tslint:disable */ 5 | /* eslint-disable */ 6 | 7 | import * as jspb from "google-protobuf"; 8 | import * as google_protobuf_any_pb from "google-protobuf/google/protobuf/any_pb"; 9 | 10 | export class BytesMessage extends jspb.Message { 11 | getType(): IOStream; 12 | setType(value: IOStream): BytesMessage; 13 | 14 | getValue(): Uint8Array | string; 15 | getValue_asU8(): Uint8Array; 16 | getValue_asB64(): string; 17 | setValue(value: Uint8Array | string): BytesMessage; 18 | 19 | 20 | serializeBinary(): Uint8Array; 21 | toObject(includeInstance?: boolean): BytesMessage.AsObject; 22 | static toObject(includeInstance: boolean, msg: BytesMessage): BytesMessage.AsObject; 23 | static extensions: {[key: number]: jspb.ExtensionFieldInfo}; 24 | static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; 25 | static serializeBinaryToWriter(message: BytesMessage, writer: jspb.BinaryWriter): void; 26 | static deserializeBinary(bytes: Uint8Array): BytesMessage; 27 | static deserializeBinaryFromReader(message: BytesMessage, reader: jspb.BinaryReader): BytesMessage; 28 | } 29 | 30 | export namespace BytesMessage { 31 | export type AsObject = { 32 | type: IOStream, 33 | value: Uint8Array | string, 34 | } 35 | } 36 | 37 | export class ResizeMessage extends jspb.Message { 38 | getWidth(): number; 39 | setWidth(value: number): ResizeMessage; 40 | 41 | getHeight(): number; 42 | setHeight(value: number): ResizeMessage; 43 | 44 | 45 | serializeBinary(): Uint8Array; 46 | toObject(includeInstance?: boolean): ResizeMessage.AsObject; 47 | static toObject(includeInstance: boolean, msg: ResizeMessage): ResizeMessage.AsObject; 48 | static extensions: {[key: number]: jspb.ExtensionFieldInfo}; 49 | static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; 50 | static serializeBinaryToWriter(message: ResizeMessage, writer: jspb.BinaryWriter): void; 51 | static deserializeBinary(bytes: Uint8Array): ResizeMessage; 52 | static deserializeBinaryFromReader(message: ResizeMessage, reader: jspb.BinaryReader): ResizeMessage; 53 | } 54 | 55 | export namespace ResizeMessage { 56 | export type AsObject = { 57 | width: number, 58 | height: number, 59 | } 60 | } 61 | 62 | export class ExitMessage extends jspb.Message { 63 | getStatus(): number; 64 | setStatus(value: number): ExitMessage; 65 | 66 | 67 | serializeBinary(): Uint8Array; 68 | toObject(includeInstance?: boolean): ExitMessage.AsObject; 69 | static toObject(includeInstance: boolean, msg: ExitMessage): ExitMessage.AsObject; 70 | static extensions: {[key: number]: jspb.ExtensionFieldInfo}; 71 | static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; 72 | static serializeBinaryToWriter(message: ExitMessage, writer: jspb.BinaryWriter): void; 73 | static deserializeBinary(bytes: Uint8Array): ExitMessage; 74 | static deserializeBinaryFromReader(message: ExitMessage, reader: jspb.BinaryReader): ExitMessage; 75 | } 76 | 77 | export namespace ExitMessage { 78 | export type AsObject = { 79 | status: number, 80 | } 81 | } 82 | 83 | export enum IOStream { 84 | STDIN = 0, 85 | STDOUT = 1, 86 | STDERR = 2, 87 | } 88 | -------------------------------------------------------------------------------- /src/protos/streams/v1/streams_pb.js: -------------------------------------------------------------------------------- 1 | // source: streams/v1/streams.proto 2 | /** 3 | * @fileoverview 4 | * @enhanceable 5 | * @suppress {messageConventions} JS Compiler reports an error if a variable or 6 | * field starts with 'MSG_' and isn't a translatable message. 7 | * @public 8 | */ 9 | // GENERATED CODE -- DO NOT EDIT! 10 | 11 | var jspb = require('google-protobuf'); 12 | var goog = jspb; 13 | var global = Function('return this')(); 14 | 15 | var google_protobuf_any_pb = require('google-protobuf/google/protobuf/any_pb.js'); 16 | goog.object.extend(proto, google_protobuf_any_pb); 17 | goog.exportSymbol('proto.com.docker.api.protos.streams.v1.BytesMessage', null, global); 18 | goog.exportSymbol('proto.com.docker.api.protos.streams.v1.ExitMessage', null, global); 19 | goog.exportSymbol('proto.com.docker.api.protos.streams.v1.IOStream', null, global); 20 | goog.exportSymbol('proto.com.docker.api.protos.streams.v1.ResizeMessage', null, global); 21 | /** 22 | * Generated by JsPbCodeGenerator. 23 | * @param {Array=} opt_data Optional initial data array, typically from a 24 | * server response, or constructed directly in Javascript. The array is used 25 | * in place and becomes part of the constructed object. It is not cloned. 26 | * If no data is provided, the constructed object will be empty, but still 27 | * valid. 28 | * @extends {jspb.Message} 29 | * @constructor 30 | */ 31 | proto.com.docker.api.protos.streams.v1.BytesMessage = function(opt_data) { 32 | jspb.Message.initialize(this, opt_data, 0, -1, null, null); 33 | }; 34 | goog.inherits(proto.com.docker.api.protos.streams.v1.BytesMessage, jspb.Message); 35 | if (goog.DEBUG && !COMPILED) { 36 | /** 37 | * @public 38 | * @override 39 | */ 40 | proto.com.docker.api.protos.streams.v1.BytesMessage.displayName = 'proto.com.docker.api.protos.streams.v1.BytesMessage'; 41 | } 42 | /** 43 | * Generated by JsPbCodeGenerator. 44 | * @param {Array=} opt_data Optional initial data array, typically from a 45 | * server response, or constructed directly in Javascript. The array is used 46 | * in place and becomes part of the constructed object. It is not cloned. 47 | * If no data is provided, the constructed object will be empty, but still 48 | * valid. 49 | * @extends {jspb.Message} 50 | * @constructor 51 | */ 52 | proto.com.docker.api.protos.streams.v1.ResizeMessage = function(opt_data) { 53 | jspb.Message.initialize(this, opt_data, 0, -1, null, null); 54 | }; 55 | goog.inherits(proto.com.docker.api.protos.streams.v1.ResizeMessage, jspb.Message); 56 | if (goog.DEBUG && !COMPILED) { 57 | /** 58 | * @public 59 | * @override 60 | */ 61 | proto.com.docker.api.protos.streams.v1.ResizeMessage.displayName = 'proto.com.docker.api.protos.streams.v1.ResizeMessage'; 62 | } 63 | /** 64 | * Generated by JsPbCodeGenerator. 65 | * @param {Array=} opt_data Optional initial data array, typically from a 66 | * server response, or constructed directly in Javascript. The array is used 67 | * in place and becomes part of the constructed object. It is not cloned. 68 | * If no data is provided, the constructed object will be empty, but still 69 | * valid. 70 | * @extends {jspb.Message} 71 | * @constructor 72 | */ 73 | proto.com.docker.api.protos.streams.v1.ExitMessage = function(opt_data) { 74 | jspb.Message.initialize(this, opt_data, 0, -1, null, null); 75 | }; 76 | goog.inherits(proto.com.docker.api.protos.streams.v1.ExitMessage, jspb.Message); 77 | if (goog.DEBUG && !COMPILED) { 78 | /** 79 | * @public 80 | * @override 81 | */ 82 | proto.com.docker.api.protos.streams.v1.ExitMessage.displayName = 'proto.com.docker.api.protos.streams.v1.ExitMessage'; 83 | } 84 | 85 | 86 | 87 | if (jspb.Message.GENERATE_TO_OBJECT) { 88 | /** 89 | * Creates an object representation of this proto. 90 | * Field names that are reserved in JavaScript and will be renamed to pb_name. 91 | * Optional fields that are not set will be set to undefined. 92 | * To access a reserved field use, foo.pb_, eg, foo.pb_default. 93 | * For the list of reserved names please see: 94 | * net/proto2/compiler/js/internal/generator.cc#kKeyword. 95 | * @param {boolean=} opt_includeInstance Deprecated. whether to include the 96 | * JSPB instance for transitional soy proto support: 97 | * http://goto/soy-param-migration 98 | * @return {!Object} 99 | */ 100 | proto.com.docker.api.protos.streams.v1.BytesMessage.prototype.toObject = function(opt_includeInstance) { 101 | return proto.com.docker.api.protos.streams.v1.BytesMessage.toObject(opt_includeInstance, this); 102 | }; 103 | 104 | 105 | /** 106 | * Static version of the {@see toObject} method. 107 | * @param {boolean|undefined} includeInstance Deprecated. Whether to include 108 | * the JSPB instance for transitional soy proto support: 109 | * http://goto/soy-param-migration 110 | * @param {!proto.com.docker.api.protos.streams.v1.BytesMessage} msg The msg instance to transform. 111 | * @return {!Object} 112 | * @suppress {unusedLocalVariables} f is only used for nested messages 113 | */ 114 | proto.com.docker.api.protos.streams.v1.BytesMessage.toObject = function(includeInstance, msg) { 115 | var f, obj = { 116 | type: jspb.Message.getFieldWithDefault(msg, 1, 0), 117 | value: msg.getValue_asB64() 118 | }; 119 | 120 | if (includeInstance) { 121 | obj.$jspbMessageInstance = msg; 122 | } 123 | return obj; 124 | }; 125 | } 126 | 127 | 128 | /** 129 | * Deserializes binary data (in protobuf wire format). 130 | * @param {jspb.ByteSource} bytes The bytes to deserialize. 131 | * @return {!proto.com.docker.api.protos.streams.v1.BytesMessage} 132 | */ 133 | proto.com.docker.api.protos.streams.v1.BytesMessage.deserializeBinary = function(bytes) { 134 | var reader = new jspb.BinaryReader(bytes); 135 | var msg = new proto.com.docker.api.protos.streams.v1.BytesMessage; 136 | return proto.com.docker.api.protos.streams.v1.BytesMessage.deserializeBinaryFromReader(msg, reader); 137 | }; 138 | 139 | 140 | /** 141 | * Deserializes binary data (in protobuf wire format) from the 142 | * given reader into the given message object. 143 | * @param {!proto.com.docker.api.protos.streams.v1.BytesMessage} msg The message object to deserialize into. 144 | * @param {!jspb.BinaryReader} reader The BinaryReader to use. 145 | * @return {!proto.com.docker.api.protos.streams.v1.BytesMessage} 146 | */ 147 | proto.com.docker.api.protos.streams.v1.BytesMessage.deserializeBinaryFromReader = function(msg, reader) { 148 | while (reader.nextField()) { 149 | if (reader.isEndGroup()) { 150 | break; 151 | } 152 | var field = reader.getFieldNumber(); 153 | switch (field) { 154 | case 1: 155 | var value = /** @type {!proto.com.docker.api.protos.streams.v1.IOStream} */ (reader.readEnum()); 156 | msg.setType(value); 157 | break; 158 | case 2: 159 | var value = /** @type {!Uint8Array} */ (reader.readBytes()); 160 | msg.setValue(value); 161 | break; 162 | default: 163 | reader.skipField(); 164 | break; 165 | } 166 | } 167 | return msg; 168 | }; 169 | 170 | 171 | /** 172 | * Serializes the message to binary data (in protobuf wire format). 173 | * @return {!Uint8Array} 174 | */ 175 | proto.com.docker.api.protos.streams.v1.BytesMessage.prototype.serializeBinary = function() { 176 | var writer = new jspb.BinaryWriter(); 177 | proto.com.docker.api.protos.streams.v1.BytesMessage.serializeBinaryToWriter(this, writer); 178 | return writer.getResultBuffer(); 179 | }; 180 | 181 | 182 | /** 183 | * Serializes the given message to binary data (in protobuf wire 184 | * format), writing to the given BinaryWriter. 185 | * @param {!proto.com.docker.api.protos.streams.v1.BytesMessage} message 186 | * @param {!jspb.BinaryWriter} writer 187 | * @suppress {unusedLocalVariables} f is only used for nested messages 188 | */ 189 | proto.com.docker.api.protos.streams.v1.BytesMessage.serializeBinaryToWriter = function(message, writer) { 190 | var f = undefined; 191 | f = message.getType(); 192 | if (f !== 0.0) { 193 | writer.writeEnum( 194 | 1, 195 | f 196 | ); 197 | } 198 | f = message.getValue_asU8(); 199 | if (f.length > 0) { 200 | writer.writeBytes( 201 | 2, 202 | f 203 | ); 204 | } 205 | }; 206 | 207 | 208 | /** 209 | * optional IOStream type = 1; 210 | * @return {!proto.com.docker.api.protos.streams.v1.IOStream} 211 | */ 212 | proto.com.docker.api.protos.streams.v1.BytesMessage.prototype.getType = function() { 213 | return /** @type {!proto.com.docker.api.protos.streams.v1.IOStream} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); 214 | }; 215 | 216 | 217 | /** 218 | * @param {!proto.com.docker.api.protos.streams.v1.IOStream} value 219 | * @return {!proto.com.docker.api.protos.streams.v1.BytesMessage} returns this 220 | */ 221 | proto.com.docker.api.protos.streams.v1.BytesMessage.prototype.setType = function(value) { 222 | return jspb.Message.setProto3EnumField(this, 1, value); 223 | }; 224 | 225 | 226 | /** 227 | * optional bytes value = 2; 228 | * @return {!(string|Uint8Array)} 229 | */ 230 | proto.com.docker.api.protos.streams.v1.BytesMessage.prototype.getValue = function() { 231 | return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 2, "")); 232 | }; 233 | 234 | 235 | /** 236 | * optional bytes value = 2; 237 | * This is a type-conversion wrapper around `getValue()` 238 | * @return {string} 239 | */ 240 | proto.com.docker.api.protos.streams.v1.BytesMessage.prototype.getValue_asB64 = function() { 241 | return /** @type {string} */ (jspb.Message.bytesAsB64( 242 | this.getValue())); 243 | }; 244 | 245 | 246 | /** 247 | * optional bytes value = 2; 248 | * Note that Uint8Array is not supported on all browsers. 249 | * @see http://caniuse.com/Uint8Array 250 | * This is a type-conversion wrapper around `getValue()` 251 | * @return {!Uint8Array} 252 | */ 253 | proto.com.docker.api.protos.streams.v1.BytesMessage.prototype.getValue_asU8 = function() { 254 | return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( 255 | this.getValue())); 256 | }; 257 | 258 | 259 | /** 260 | * @param {!(string|Uint8Array)} value 261 | * @return {!proto.com.docker.api.protos.streams.v1.BytesMessage} returns this 262 | */ 263 | proto.com.docker.api.protos.streams.v1.BytesMessage.prototype.setValue = function(value) { 264 | return jspb.Message.setProto3BytesField(this, 2, value); 265 | }; 266 | 267 | 268 | 269 | 270 | 271 | if (jspb.Message.GENERATE_TO_OBJECT) { 272 | /** 273 | * Creates an object representation of this proto. 274 | * Field names that are reserved in JavaScript and will be renamed to pb_name. 275 | * Optional fields that are not set will be set to undefined. 276 | * To access a reserved field use, foo.pb_, eg, foo.pb_default. 277 | * For the list of reserved names please see: 278 | * net/proto2/compiler/js/internal/generator.cc#kKeyword. 279 | * @param {boolean=} opt_includeInstance Deprecated. whether to include the 280 | * JSPB instance for transitional soy proto support: 281 | * http://goto/soy-param-migration 282 | * @return {!Object} 283 | */ 284 | proto.com.docker.api.protos.streams.v1.ResizeMessage.prototype.toObject = function(opt_includeInstance) { 285 | return proto.com.docker.api.protos.streams.v1.ResizeMessage.toObject(opt_includeInstance, this); 286 | }; 287 | 288 | 289 | /** 290 | * Static version of the {@see toObject} method. 291 | * @param {boolean|undefined} includeInstance Deprecated. Whether to include 292 | * the JSPB instance for transitional soy proto support: 293 | * http://goto/soy-param-migration 294 | * @param {!proto.com.docker.api.protos.streams.v1.ResizeMessage} msg The msg instance to transform. 295 | * @return {!Object} 296 | * @suppress {unusedLocalVariables} f is only used for nested messages 297 | */ 298 | proto.com.docker.api.protos.streams.v1.ResizeMessage.toObject = function(includeInstance, msg) { 299 | var f, obj = { 300 | width: jspb.Message.getFieldWithDefault(msg, 1, 0), 301 | height: jspb.Message.getFieldWithDefault(msg, 2, 0) 302 | }; 303 | 304 | if (includeInstance) { 305 | obj.$jspbMessageInstance = msg; 306 | } 307 | return obj; 308 | }; 309 | } 310 | 311 | 312 | /** 313 | * Deserializes binary data (in protobuf wire format). 314 | * @param {jspb.ByteSource} bytes The bytes to deserialize. 315 | * @return {!proto.com.docker.api.protos.streams.v1.ResizeMessage} 316 | */ 317 | proto.com.docker.api.protos.streams.v1.ResizeMessage.deserializeBinary = function(bytes) { 318 | var reader = new jspb.BinaryReader(bytes); 319 | var msg = new proto.com.docker.api.protos.streams.v1.ResizeMessage; 320 | return proto.com.docker.api.protos.streams.v1.ResizeMessage.deserializeBinaryFromReader(msg, reader); 321 | }; 322 | 323 | 324 | /** 325 | * Deserializes binary data (in protobuf wire format) from the 326 | * given reader into the given message object. 327 | * @param {!proto.com.docker.api.protos.streams.v1.ResizeMessage} msg The message object to deserialize into. 328 | * @param {!jspb.BinaryReader} reader The BinaryReader to use. 329 | * @return {!proto.com.docker.api.protos.streams.v1.ResizeMessage} 330 | */ 331 | proto.com.docker.api.protos.streams.v1.ResizeMessage.deserializeBinaryFromReader = function(msg, reader) { 332 | while (reader.nextField()) { 333 | if (reader.isEndGroup()) { 334 | break; 335 | } 336 | var field = reader.getFieldNumber(); 337 | switch (field) { 338 | case 1: 339 | var value = /** @type {number} */ (reader.readUint32()); 340 | msg.setWidth(value); 341 | break; 342 | case 2: 343 | var value = /** @type {number} */ (reader.readUint32()); 344 | msg.setHeight(value); 345 | break; 346 | default: 347 | reader.skipField(); 348 | break; 349 | } 350 | } 351 | return msg; 352 | }; 353 | 354 | 355 | /** 356 | * Serializes the message to binary data (in protobuf wire format). 357 | * @return {!Uint8Array} 358 | */ 359 | proto.com.docker.api.protos.streams.v1.ResizeMessage.prototype.serializeBinary = function() { 360 | var writer = new jspb.BinaryWriter(); 361 | proto.com.docker.api.protos.streams.v1.ResizeMessage.serializeBinaryToWriter(this, writer); 362 | return writer.getResultBuffer(); 363 | }; 364 | 365 | 366 | /** 367 | * Serializes the given message to binary data (in protobuf wire 368 | * format), writing to the given BinaryWriter. 369 | * @param {!proto.com.docker.api.protos.streams.v1.ResizeMessage} message 370 | * @param {!jspb.BinaryWriter} writer 371 | * @suppress {unusedLocalVariables} f is only used for nested messages 372 | */ 373 | proto.com.docker.api.protos.streams.v1.ResizeMessage.serializeBinaryToWriter = function(message, writer) { 374 | var f = undefined; 375 | f = message.getWidth(); 376 | if (f !== 0) { 377 | writer.writeUint32( 378 | 1, 379 | f 380 | ); 381 | } 382 | f = message.getHeight(); 383 | if (f !== 0) { 384 | writer.writeUint32( 385 | 2, 386 | f 387 | ); 388 | } 389 | }; 390 | 391 | 392 | /** 393 | * optional uint32 width = 1; 394 | * @return {number} 395 | */ 396 | proto.com.docker.api.protos.streams.v1.ResizeMessage.prototype.getWidth = function() { 397 | return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); 398 | }; 399 | 400 | 401 | /** 402 | * @param {number} value 403 | * @return {!proto.com.docker.api.protos.streams.v1.ResizeMessage} returns this 404 | */ 405 | proto.com.docker.api.protos.streams.v1.ResizeMessage.prototype.setWidth = function(value) { 406 | return jspb.Message.setProto3IntField(this, 1, value); 407 | }; 408 | 409 | 410 | /** 411 | * optional uint32 height = 2; 412 | * @return {number} 413 | */ 414 | proto.com.docker.api.protos.streams.v1.ResizeMessage.prototype.getHeight = function() { 415 | return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); 416 | }; 417 | 418 | 419 | /** 420 | * @param {number} value 421 | * @return {!proto.com.docker.api.protos.streams.v1.ResizeMessage} returns this 422 | */ 423 | proto.com.docker.api.protos.streams.v1.ResizeMessage.prototype.setHeight = function(value) { 424 | return jspb.Message.setProto3IntField(this, 2, value); 425 | }; 426 | 427 | 428 | 429 | 430 | 431 | if (jspb.Message.GENERATE_TO_OBJECT) { 432 | /** 433 | * Creates an object representation of this proto. 434 | * Field names that are reserved in JavaScript and will be renamed to pb_name. 435 | * Optional fields that are not set will be set to undefined. 436 | * To access a reserved field use, foo.pb_, eg, foo.pb_default. 437 | * For the list of reserved names please see: 438 | * net/proto2/compiler/js/internal/generator.cc#kKeyword. 439 | * @param {boolean=} opt_includeInstance Deprecated. whether to include the 440 | * JSPB instance for transitional soy proto support: 441 | * http://goto/soy-param-migration 442 | * @return {!Object} 443 | */ 444 | proto.com.docker.api.protos.streams.v1.ExitMessage.prototype.toObject = function(opt_includeInstance) { 445 | return proto.com.docker.api.protos.streams.v1.ExitMessage.toObject(opt_includeInstance, this); 446 | }; 447 | 448 | 449 | /** 450 | * Static version of the {@see toObject} method. 451 | * @param {boolean|undefined} includeInstance Deprecated. Whether to include 452 | * the JSPB instance for transitional soy proto support: 453 | * http://goto/soy-param-migration 454 | * @param {!proto.com.docker.api.protos.streams.v1.ExitMessage} msg The msg instance to transform. 455 | * @return {!Object} 456 | * @suppress {unusedLocalVariables} f is only used for nested messages 457 | */ 458 | proto.com.docker.api.protos.streams.v1.ExitMessage.toObject = function(includeInstance, msg) { 459 | var f, obj = { 460 | status: jspb.Message.getFieldWithDefault(msg, 1, 0) 461 | }; 462 | 463 | if (includeInstance) { 464 | obj.$jspbMessageInstance = msg; 465 | } 466 | return obj; 467 | }; 468 | } 469 | 470 | 471 | /** 472 | * Deserializes binary data (in protobuf wire format). 473 | * @param {jspb.ByteSource} bytes The bytes to deserialize. 474 | * @return {!proto.com.docker.api.protos.streams.v1.ExitMessage} 475 | */ 476 | proto.com.docker.api.protos.streams.v1.ExitMessage.deserializeBinary = function(bytes) { 477 | var reader = new jspb.BinaryReader(bytes); 478 | var msg = new proto.com.docker.api.protos.streams.v1.ExitMessage; 479 | return proto.com.docker.api.protos.streams.v1.ExitMessage.deserializeBinaryFromReader(msg, reader); 480 | }; 481 | 482 | 483 | /** 484 | * Deserializes binary data (in protobuf wire format) from the 485 | * given reader into the given message object. 486 | * @param {!proto.com.docker.api.protos.streams.v1.ExitMessage} msg The message object to deserialize into. 487 | * @param {!jspb.BinaryReader} reader The BinaryReader to use. 488 | * @return {!proto.com.docker.api.protos.streams.v1.ExitMessage} 489 | */ 490 | proto.com.docker.api.protos.streams.v1.ExitMessage.deserializeBinaryFromReader = function(msg, reader) { 491 | while (reader.nextField()) { 492 | if (reader.isEndGroup()) { 493 | break; 494 | } 495 | var field = reader.getFieldNumber(); 496 | switch (field) { 497 | case 1: 498 | var value = /** @type {number} */ (reader.readUint32()); 499 | msg.setStatus(value); 500 | break; 501 | default: 502 | reader.skipField(); 503 | break; 504 | } 505 | } 506 | return msg; 507 | }; 508 | 509 | 510 | /** 511 | * Serializes the message to binary data (in protobuf wire format). 512 | * @return {!Uint8Array} 513 | */ 514 | proto.com.docker.api.protos.streams.v1.ExitMessage.prototype.serializeBinary = function() { 515 | var writer = new jspb.BinaryWriter(); 516 | proto.com.docker.api.protos.streams.v1.ExitMessage.serializeBinaryToWriter(this, writer); 517 | return writer.getResultBuffer(); 518 | }; 519 | 520 | 521 | /** 522 | * Serializes the given message to binary data (in protobuf wire 523 | * format), writing to the given BinaryWriter. 524 | * @param {!proto.com.docker.api.protos.streams.v1.ExitMessage} message 525 | * @param {!jspb.BinaryWriter} writer 526 | * @suppress {unusedLocalVariables} f is only used for nested messages 527 | */ 528 | proto.com.docker.api.protos.streams.v1.ExitMessage.serializeBinaryToWriter = function(message, writer) { 529 | var f = undefined; 530 | f = message.getStatus(); 531 | if (f !== 0) { 532 | writer.writeUint32( 533 | 1, 534 | f 535 | ); 536 | } 537 | }; 538 | 539 | 540 | /** 541 | * optional uint32 status = 1; 542 | * @return {number} 543 | */ 544 | proto.com.docker.api.protos.streams.v1.ExitMessage.prototype.getStatus = function() { 545 | return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); 546 | }; 547 | 548 | 549 | /** 550 | * @param {number} value 551 | * @return {!proto.com.docker.api.protos.streams.v1.ExitMessage} returns this 552 | */ 553 | proto.com.docker.api.protos.streams.v1.ExitMessage.prototype.setStatus = function(value) { 554 | return jspb.Message.setProto3IntField(this, 1, value); 555 | }; 556 | 557 | 558 | /** 559 | * @enum {number} 560 | */ 561 | proto.com.docker.api.protos.streams.v1.IOStream = { 562 | STDIN: 0, 563 | STDOUT: 1, 564 | STDERR: 2 565 | }; 566 | 567 | goog.object.extend(exports, proto.com.docker.api.protos.streams.v1); 568 | -------------------------------------------------------------------------------- /src/protos/volumes/v1/volumes.proto: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2020 Docker Compose CLI authors 3 | 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | syntax = "proto3"; 17 | 18 | package com.docker.api.protos.volumes.v1; 19 | 20 | import "google/protobuf/any.proto"; 21 | 22 | option go_package = "github.com/docker/compose-cli/cli/server/protos/volumes/v1;v1"; 23 | 24 | service Volumes { 25 | rpc VolumesCreate(VolumesCreateRequest) returns (VolumesCreateResponse); 26 | rpc VolumesList(VolumesListRequest) returns (VolumesListResponse); 27 | rpc VolumesDelete(VolumesDeleteRequest) returns (VolumesDeleteResponse); 28 | rpc VolumesInspect(VolumesInspectRequest) returns (VolumesInspectResponse); 29 | } 30 | 31 | message Volume { 32 | string id = 1; 33 | string description = 2; 34 | } 35 | 36 | message AciVolumeCreateOptions { 37 | string storage_account = 1; 38 | } 39 | 40 | message VolumesCreateRequest { 41 | string name = 1; 42 | oneof options { 43 | AciVolumeCreateOptions aci_option = 2; 44 | } 45 | } 46 | 47 | message VolumesCreateResponse { 48 | Volume volume = 1; 49 | } 50 | 51 | message VolumesListRequest { 52 | } 53 | 54 | message VolumesListResponse { 55 | repeated Volume volumes = 1; 56 | } 57 | 58 | message VolumesDeleteRequest { 59 | string id = 1; 60 | } 61 | 62 | message VolumesDeleteResponse { 63 | } 64 | 65 | message VolumesInspectRequest { 66 | string id = 1; 67 | } 68 | 69 | message VolumesInspectResponse { 70 | Volume volume = 1; 71 | } 72 | -------------------------------------------------------------------------------- /src/protos/volumes/v1/volumes_grpc_pb.d.ts: -------------------------------------------------------------------------------- 1 | // package: com.docker.api.protos.volumes.v1 2 | // file: volumes/v1/volumes.proto 3 | 4 | /* tslint:disable */ 5 | /* eslint-disable */ 6 | 7 | import * as grpc from "@grpc/grpc-js"; 8 | import {handleClientStreamingCall} from "@grpc/grpc-js/build/src/server-call"; 9 | import * as volumes_v1_volumes_pb from "../../volumes/v1/volumes_pb"; 10 | import * as google_protobuf_any_pb from "google-protobuf/google/protobuf/any_pb"; 11 | 12 | interface IVolumesService extends grpc.ServiceDefinition { 13 | volumesCreate: IVolumesService_IVolumesCreate; 14 | volumesList: IVolumesService_IVolumesList; 15 | volumesDelete: IVolumesService_IVolumesDelete; 16 | volumesInspect: IVolumesService_IVolumesInspect; 17 | } 18 | 19 | interface IVolumesService_IVolumesCreate extends grpc.MethodDefinition { 20 | path: string; // "/com.docker.api.protos.volumes.v1.Volumes/VolumesCreate" 21 | requestStream: false; 22 | responseStream: false; 23 | requestSerialize: grpc.serialize; 24 | requestDeserialize: grpc.deserialize; 25 | responseSerialize: grpc.serialize; 26 | responseDeserialize: grpc.deserialize; 27 | } 28 | interface IVolumesService_IVolumesList extends grpc.MethodDefinition { 29 | path: string; // "/com.docker.api.protos.volumes.v1.Volumes/VolumesList" 30 | requestStream: false; 31 | responseStream: false; 32 | requestSerialize: grpc.serialize; 33 | requestDeserialize: grpc.deserialize; 34 | responseSerialize: grpc.serialize; 35 | responseDeserialize: grpc.deserialize; 36 | } 37 | interface IVolumesService_IVolumesDelete extends grpc.MethodDefinition { 38 | path: string; // "/com.docker.api.protos.volumes.v1.Volumes/VolumesDelete" 39 | requestStream: false; 40 | responseStream: false; 41 | requestSerialize: grpc.serialize; 42 | requestDeserialize: grpc.deserialize; 43 | responseSerialize: grpc.serialize; 44 | responseDeserialize: grpc.deserialize; 45 | } 46 | interface IVolumesService_IVolumesInspect extends grpc.MethodDefinition { 47 | path: string; // "/com.docker.api.protos.volumes.v1.Volumes/VolumesInspect" 48 | requestStream: false; 49 | responseStream: false; 50 | requestSerialize: grpc.serialize; 51 | requestDeserialize: grpc.deserialize; 52 | responseSerialize: grpc.serialize; 53 | responseDeserialize: grpc.deserialize; 54 | } 55 | 56 | export const VolumesService: IVolumesService; 57 | 58 | export interface IVolumesServer { 59 | volumesCreate: grpc.handleUnaryCall; 60 | volumesList: grpc.handleUnaryCall; 61 | volumesDelete: grpc.handleUnaryCall; 62 | volumesInspect: grpc.handleUnaryCall; 63 | } 64 | 65 | export interface IVolumesClient { 66 | volumesCreate(request: volumes_v1_volumes_pb.VolumesCreateRequest, callback: (error: grpc.ServiceError | null, response: volumes_v1_volumes_pb.VolumesCreateResponse) => void): grpc.ClientUnaryCall; 67 | volumesCreate(request: volumes_v1_volumes_pb.VolumesCreateRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: volumes_v1_volumes_pb.VolumesCreateResponse) => void): grpc.ClientUnaryCall; 68 | volumesCreate(request: volumes_v1_volumes_pb.VolumesCreateRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: volumes_v1_volumes_pb.VolumesCreateResponse) => void): grpc.ClientUnaryCall; 69 | volumesList(request: volumes_v1_volumes_pb.VolumesListRequest, callback: (error: grpc.ServiceError | null, response: volumes_v1_volumes_pb.VolumesListResponse) => void): grpc.ClientUnaryCall; 70 | volumesList(request: volumes_v1_volumes_pb.VolumesListRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: volumes_v1_volumes_pb.VolumesListResponse) => void): grpc.ClientUnaryCall; 71 | volumesList(request: volumes_v1_volumes_pb.VolumesListRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: volumes_v1_volumes_pb.VolumesListResponse) => void): grpc.ClientUnaryCall; 72 | volumesDelete(request: volumes_v1_volumes_pb.VolumesDeleteRequest, callback: (error: grpc.ServiceError | null, response: volumes_v1_volumes_pb.VolumesDeleteResponse) => void): grpc.ClientUnaryCall; 73 | volumesDelete(request: volumes_v1_volumes_pb.VolumesDeleteRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: volumes_v1_volumes_pb.VolumesDeleteResponse) => void): grpc.ClientUnaryCall; 74 | volumesDelete(request: volumes_v1_volumes_pb.VolumesDeleteRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: volumes_v1_volumes_pb.VolumesDeleteResponse) => void): grpc.ClientUnaryCall; 75 | volumesInspect(request: volumes_v1_volumes_pb.VolumesInspectRequest, callback: (error: grpc.ServiceError | null, response: volumes_v1_volumes_pb.VolumesInspectResponse) => void): grpc.ClientUnaryCall; 76 | volumesInspect(request: volumes_v1_volumes_pb.VolumesInspectRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: volumes_v1_volumes_pb.VolumesInspectResponse) => void): grpc.ClientUnaryCall; 77 | volumesInspect(request: volumes_v1_volumes_pb.VolumesInspectRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: volumes_v1_volumes_pb.VolumesInspectResponse) => void): grpc.ClientUnaryCall; 78 | } 79 | 80 | export class VolumesClient extends grpc.Client implements IVolumesClient { 81 | constructor(address: string, credentials: grpc.ChannelCredentials, options?: object); 82 | public volumesCreate(request: volumes_v1_volumes_pb.VolumesCreateRequest, callback: (error: grpc.ServiceError | null, response: volumes_v1_volumes_pb.VolumesCreateResponse) => void): grpc.ClientUnaryCall; 83 | public volumesCreate(request: volumes_v1_volumes_pb.VolumesCreateRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: volumes_v1_volumes_pb.VolumesCreateResponse) => void): grpc.ClientUnaryCall; 84 | public volumesCreate(request: volumes_v1_volumes_pb.VolumesCreateRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: volumes_v1_volumes_pb.VolumesCreateResponse) => void): grpc.ClientUnaryCall; 85 | public volumesList(request: volumes_v1_volumes_pb.VolumesListRequest, callback: (error: grpc.ServiceError | null, response: volumes_v1_volumes_pb.VolumesListResponse) => void): grpc.ClientUnaryCall; 86 | public volumesList(request: volumes_v1_volumes_pb.VolumesListRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: volumes_v1_volumes_pb.VolumesListResponse) => void): grpc.ClientUnaryCall; 87 | public volumesList(request: volumes_v1_volumes_pb.VolumesListRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: volumes_v1_volumes_pb.VolumesListResponse) => void): grpc.ClientUnaryCall; 88 | public volumesDelete(request: volumes_v1_volumes_pb.VolumesDeleteRequest, callback: (error: grpc.ServiceError | null, response: volumes_v1_volumes_pb.VolumesDeleteResponse) => void): grpc.ClientUnaryCall; 89 | public volumesDelete(request: volumes_v1_volumes_pb.VolumesDeleteRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: volumes_v1_volumes_pb.VolumesDeleteResponse) => void): grpc.ClientUnaryCall; 90 | public volumesDelete(request: volumes_v1_volumes_pb.VolumesDeleteRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: volumes_v1_volumes_pb.VolumesDeleteResponse) => void): grpc.ClientUnaryCall; 91 | public volumesInspect(request: volumes_v1_volumes_pb.VolumesInspectRequest, callback: (error: grpc.ServiceError | null, response: volumes_v1_volumes_pb.VolumesInspectResponse) => void): grpc.ClientUnaryCall; 92 | public volumesInspect(request: volumes_v1_volumes_pb.VolumesInspectRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: volumes_v1_volumes_pb.VolumesInspectResponse) => void): grpc.ClientUnaryCall; 93 | public volumesInspect(request: volumes_v1_volumes_pb.VolumesInspectRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: volumes_v1_volumes_pb.VolumesInspectResponse) => void): grpc.ClientUnaryCall; 94 | } 95 | -------------------------------------------------------------------------------- /src/protos/volumes/v1/volumes_grpc_pb.js: -------------------------------------------------------------------------------- 1 | // GENERATED CODE -- DO NOT EDIT! 2 | 3 | // Original file comments: 4 | // 5 | // Copyright 2020 Docker Compose CLI authors 6 | // 7 | // Licensed under the Apache License, Version 2.0 (the "License"); 8 | // you may not use this file except in compliance with the License. 9 | // You may obtain a copy of the License at 10 | // 11 | // http://www.apache.org/licenses/LICENSE-2.0 12 | // 13 | // Unless required by applicable law or agreed to in writing, software 14 | // distributed under the License is distributed on an "AS IS" BASIS, 15 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | // See the License for the specific language governing permissions and 17 | // limitations under the License. 18 | // 19 | 'use strict'; 20 | var grpc = require('@grpc/grpc-js'); 21 | var volumes_v1_volumes_pb = require('../../volumes/v1/volumes_pb.js'); 22 | var google_protobuf_any_pb = require('google-protobuf/google/protobuf/any_pb.js'); 23 | 24 | function serialize_com_docker_api_protos_volumes_v1_VolumesCreateRequest(arg) { 25 | if (!(arg instanceof volumes_v1_volumes_pb.VolumesCreateRequest)) { 26 | throw new Error('Expected argument of type com.docker.api.protos.volumes.v1.VolumesCreateRequest'); 27 | } 28 | return Buffer.from(arg.serializeBinary()); 29 | } 30 | 31 | function deserialize_com_docker_api_protos_volumes_v1_VolumesCreateRequest(buffer_arg) { 32 | return volumes_v1_volumes_pb.VolumesCreateRequest.deserializeBinary(new Uint8Array(buffer_arg)); 33 | } 34 | 35 | function serialize_com_docker_api_protos_volumes_v1_VolumesCreateResponse(arg) { 36 | if (!(arg instanceof volumes_v1_volumes_pb.VolumesCreateResponse)) { 37 | throw new Error('Expected argument of type com.docker.api.protos.volumes.v1.VolumesCreateResponse'); 38 | } 39 | return Buffer.from(arg.serializeBinary()); 40 | } 41 | 42 | function deserialize_com_docker_api_protos_volumes_v1_VolumesCreateResponse(buffer_arg) { 43 | return volumes_v1_volumes_pb.VolumesCreateResponse.deserializeBinary(new Uint8Array(buffer_arg)); 44 | } 45 | 46 | function serialize_com_docker_api_protos_volumes_v1_VolumesDeleteRequest(arg) { 47 | if (!(arg instanceof volumes_v1_volumes_pb.VolumesDeleteRequest)) { 48 | throw new Error('Expected argument of type com.docker.api.protos.volumes.v1.VolumesDeleteRequest'); 49 | } 50 | return Buffer.from(arg.serializeBinary()); 51 | } 52 | 53 | function deserialize_com_docker_api_protos_volumes_v1_VolumesDeleteRequest(buffer_arg) { 54 | return volumes_v1_volumes_pb.VolumesDeleteRequest.deserializeBinary(new Uint8Array(buffer_arg)); 55 | } 56 | 57 | function serialize_com_docker_api_protos_volumes_v1_VolumesDeleteResponse(arg) { 58 | if (!(arg instanceof volumes_v1_volumes_pb.VolumesDeleteResponse)) { 59 | throw new Error('Expected argument of type com.docker.api.protos.volumes.v1.VolumesDeleteResponse'); 60 | } 61 | return Buffer.from(arg.serializeBinary()); 62 | } 63 | 64 | function deserialize_com_docker_api_protos_volumes_v1_VolumesDeleteResponse(buffer_arg) { 65 | return volumes_v1_volumes_pb.VolumesDeleteResponse.deserializeBinary(new Uint8Array(buffer_arg)); 66 | } 67 | 68 | function serialize_com_docker_api_protos_volumes_v1_VolumesInspectRequest(arg) { 69 | if (!(arg instanceof volumes_v1_volumes_pb.VolumesInspectRequest)) { 70 | throw new Error('Expected argument of type com.docker.api.protos.volumes.v1.VolumesInspectRequest'); 71 | } 72 | return Buffer.from(arg.serializeBinary()); 73 | } 74 | 75 | function deserialize_com_docker_api_protos_volumes_v1_VolumesInspectRequest(buffer_arg) { 76 | return volumes_v1_volumes_pb.VolumesInspectRequest.deserializeBinary(new Uint8Array(buffer_arg)); 77 | } 78 | 79 | function serialize_com_docker_api_protos_volumes_v1_VolumesInspectResponse(arg) { 80 | if (!(arg instanceof volumes_v1_volumes_pb.VolumesInspectResponse)) { 81 | throw new Error('Expected argument of type com.docker.api.protos.volumes.v1.VolumesInspectResponse'); 82 | } 83 | return Buffer.from(arg.serializeBinary()); 84 | } 85 | 86 | function deserialize_com_docker_api_protos_volumes_v1_VolumesInspectResponse(buffer_arg) { 87 | return volumes_v1_volumes_pb.VolumesInspectResponse.deserializeBinary(new Uint8Array(buffer_arg)); 88 | } 89 | 90 | function serialize_com_docker_api_protos_volumes_v1_VolumesListRequest(arg) { 91 | if (!(arg instanceof volumes_v1_volumes_pb.VolumesListRequest)) { 92 | throw new Error('Expected argument of type com.docker.api.protos.volumes.v1.VolumesListRequest'); 93 | } 94 | return Buffer.from(arg.serializeBinary()); 95 | } 96 | 97 | function deserialize_com_docker_api_protos_volumes_v1_VolumesListRequest(buffer_arg) { 98 | return volumes_v1_volumes_pb.VolumesListRequest.deserializeBinary(new Uint8Array(buffer_arg)); 99 | } 100 | 101 | function serialize_com_docker_api_protos_volumes_v1_VolumesListResponse(arg) { 102 | if (!(arg instanceof volumes_v1_volumes_pb.VolumesListResponse)) { 103 | throw new Error('Expected argument of type com.docker.api.protos.volumes.v1.VolumesListResponse'); 104 | } 105 | return Buffer.from(arg.serializeBinary()); 106 | } 107 | 108 | function deserialize_com_docker_api_protos_volumes_v1_VolumesListResponse(buffer_arg) { 109 | return volumes_v1_volumes_pb.VolumesListResponse.deserializeBinary(new Uint8Array(buffer_arg)); 110 | } 111 | 112 | 113 | var VolumesService = exports.VolumesService = { 114 | volumesCreate: { 115 | path: '/com.docker.api.protos.volumes.v1.Volumes/VolumesCreate', 116 | requestStream: false, 117 | responseStream: false, 118 | requestType: volumes_v1_volumes_pb.VolumesCreateRequest, 119 | responseType: volumes_v1_volumes_pb.VolumesCreateResponse, 120 | requestSerialize: serialize_com_docker_api_protos_volumes_v1_VolumesCreateRequest, 121 | requestDeserialize: deserialize_com_docker_api_protos_volumes_v1_VolumesCreateRequest, 122 | responseSerialize: serialize_com_docker_api_protos_volumes_v1_VolumesCreateResponse, 123 | responseDeserialize: deserialize_com_docker_api_protos_volumes_v1_VolumesCreateResponse, 124 | }, 125 | volumesList: { 126 | path: '/com.docker.api.protos.volumes.v1.Volumes/VolumesList', 127 | requestStream: false, 128 | responseStream: false, 129 | requestType: volumes_v1_volumes_pb.VolumesListRequest, 130 | responseType: volumes_v1_volumes_pb.VolumesListResponse, 131 | requestSerialize: serialize_com_docker_api_protos_volumes_v1_VolumesListRequest, 132 | requestDeserialize: deserialize_com_docker_api_protos_volumes_v1_VolumesListRequest, 133 | responseSerialize: serialize_com_docker_api_protos_volumes_v1_VolumesListResponse, 134 | responseDeserialize: deserialize_com_docker_api_protos_volumes_v1_VolumesListResponse, 135 | }, 136 | volumesDelete: { 137 | path: '/com.docker.api.protos.volumes.v1.Volumes/VolumesDelete', 138 | requestStream: false, 139 | responseStream: false, 140 | requestType: volumes_v1_volumes_pb.VolumesDeleteRequest, 141 | responseType: volumes_v1_volumes_pb.VolumesDeleteResponse, 142 | requestSerialize: serialize_com_docker_api_protos_volumes_v1_VolumesDeleteRequest, 143 | requestDeserialize: deserialize_com_docker_api_protos_volumes_v1_VolumesDeleteRequest, 144 | responseSerialize: serialize_com_docker_api_protos_volumes_v1_VolumesDeleteResponse, 145 | responseDeserialize: deserialize_com_docker_api_protos_volumes_v1_VolumesDeleteResponse, 146 | }, 147 | volumesInspect: { 148 | path: '/com.docker.api.protos.volumes.v1.Volumes/VolumesInspect', 149 | requestStream: false, 150 | responseStream: false, 151 | requestType: volumes_v1_volumes_pb.VolumesInspectRequest, 152 | responseType: volumes_v1_volumes_pb.VolumesInspectResponse, 153 | requestSerialize: serialize_com_docker_api_protos_volumes_v1_VolumesInspectRequest, 154 | requestDeserialize: deserialize_com_docker_api_protos_volumes_v1_VolumesInspectRequest, 155 | responseSerialize: serialize_com_docker_api_protos_volumes_v1_VolumesInspectResponse, 156 | responseDeserialize: deserialize_com_docker_api_protos_volumes_v1_VolumesInspectResponse, 157 | }, 158 | }; 159 | 160 | exports.VolumesClient = grpc.makeGenericClientConstructor(VolumesService); 161 | -------------------------------------------------------------------------------- /src/protos/volumes/v1/volumes_pb.d.ts: -------------------------------------------------------------------------------- 1 | // package: com.docker.api.protos.volumes.v1 2 | // file: volumes/v1/volumes.proto 3 | 4 | /* tslint:disable */ 5 | /* eslint-disable */ 6 | 7 | import * as jspb from "google-protobuf"; 8 | import * as google_protobuf_any_pb from "google-protobuf/google/protobuf/any_pb"; 9 | 10 | export class Volume extends jspb.Message { 11 | getId(): string; 12 | setId(value: string): Volume; 13 | 14 | getDescription(): string; 15 | setDescription(value: string): Volume; 16 | 17 | 18 | serializeBinary(): Uint8Array; 19 | toObject(includeInstance?: boolean): Volume.AsObject; 20 | static toObject(includeInstance: boolean, msg: Volume): Volume.AsObject; 21 | static extensions: {[key: number]: jspb.ExtensionFieldInfo}; 22 | static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; 23 | static serializeBinaryToWriter(message: Volume, writer: jspb.BinaryWriter): void; 24 | static deserializeBinary(bytes: Uint8Array): Volume; 25 | static deserializeBinaryFromReader(message: Volume, reader: jspb.BinaryReader): Volume; 26 | } 27 | 28 | export namespace Volume { 29 | export type AsObject = { 30 | id: string, 31 | description: string, 32 | } 33 | } 34 | 35 | export class AciVolumeCreateOptions extends jspb.Message { 36 | getStorageAccount(): string; 37 | setStorageAccount(value: string): AciVolumeCreateOptions; 38 | 39 | 40 | serializeBinary(): Uint8Array; 41 | toObject(includeInstance?: boolean): AciVolumeCreateOptions.AsObject; 42 | static toObject(includeInstance: boolean, msg: AciVolumeCreateOptions): AciVolumeCreateOptions.AsObject; 43 | static extensions: {[key: number]: jspb.ExtensionFieldInfo}; 44 | static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; 45 | static serializeBinaryToWriter(message: AciVolumeCreateOptions, writer: jspb.BinaryWriter): void; 46 | static deserializeBinary(bytes: Uint8Array): AciVolumeCreateOptions; 47 | static deserializeBinaryFromReader(message: AciVolumeCreateOptions, reader: jspb.BinaryReader): AciVolumeCreateOptions; 48 | } 49 | 50 | export namespace AciVolumeCreateOptions { 51 | export type AsObject = { 52 | storageAccount: string, 53 | } 54 | } 55 | 56 | export class VolumesCreateRequest extends jspb.Message { 57 | getName(): string; 58 | setName(value: string): VolumesCreateRequest; 59 | 60 | 61 | hasAciOption(): boolean; 62 | clearAciOption(): void; 63 | getAciOption(): AciVolumeCreateOptions | undefined; 64 | setAciOption(value?: AciVolumeCreateOptions): VolumesCreateRequest; 65 | 66 | 67 | getOptionsCase(): VolumesCreateRequest.OptionsCase; 68 | 69 | serializeBinary(): Uint8Array; 70 | toObject(includeInstance?: boolean): VolumesCreateRequest.AsObject; 71 | static toObject(includeInstance: boolean, msg: VolumesCreateRequest): VolumesCreateRequest.AsObject; 72 | static extensions: {[key: number]: jspb.ExtensionFieldInfo}; 73 | static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; 74 | static serializeBinaryToWriter(message: VolumesCreateRequest, writer: jspb.BinaryWriter): void; 75 | static deserializeBinary(bytes: Uint8Array): VolumesCreateRequest; 76 | static deserializeBinaryFromReader(message: VolumesCreateRequest, reader: jspb.BinaryReader): VolumesCreateRequest; 77 | } 78 | 79 | export namespace VolumesCreateRequest { 80 | export type AsObject = { 81 | name: string, 82 | aciOption?: AciVolumeCreateOptions.AsObject, 83 | } 84 | 85 | export enum OptionsCase { 86 | OPTIONS_NOT_SET = 0, 87 | 88 | ACI_OPTION = 2, 89 | 90 | } 91 | 92 | } 93 | 94 | export class VolumesCreateResponse extends jspb.Message { 95 | 96 | hasVolume(): boolean; 97 | clearVolume(): void; 98 | getVolume(): Volume | undefined; 99 | setVolume(value?: Volume): VolumesCreateResponse; 100 | 101 | 102 | serializeBinary(): Uint8Array; 103 | toObject(includeInstance?: boolean): VolumesCreateResponse.AsObject; 104 | static toObject(includeInstance: boolean, msg: VolumesCreateResponse): VolumesCreateResponse.AsObject; 105 | static extensions: {[key: number]: jspb.ExtensionFieldInfo}; 106 | static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; 107 | static serializeBinaryToWriter(message: VolumesCreateResponse, writer: jspb.BinaryWriter): void; 108 | static deserializeBinary(bytes: Uint8Array): VolumesCreateResponse; 109 | static deserializeBinaryFromReader(message: VolumesCreateResponse, reader: jspb.BinaryReader): VolumesCreateResponse; 110 | } 111 | 112 | export namespace VolumesCreateResponse { 113 | export type AsObject = { 114 | volume?: Volume.AsObject, 115 | } 116 | } 117 | 118 | export class VolumesListRequest extends jspb.Message { 119 | 120 | serializeBinary(): Uint8Array; 121 | toObject(includeInstance?: boolean): VolumesListRequest.AsObject; 122 | static toObject(includeInstance: boolean, msg: VolumesListRequest): VolumesListRequest.AsObject; 123 | static extensions: {[key: number]: jspb.ExtensionFieldInfo}; 124 | static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; 125 | static serializeBinaryToWriter(message: VolumesListRequest, writer: jspb.BinaryWriter): void; 126 | static deserializeBinary(bytes: Uint8Array): VolumesListRequest; 127 | static deserializeBinaryFromReader(message: VolumesListRequest, reader: jspb.BinaryReader): VolumesListRequest; 128 | } 129 | 130 | export namespace VolumesListRequest { 131 | export type AsObject = { 132 | } 133 | } 134 | 135 | export class VolumesListResponse extends jspb.Message { 136 | clearVolumesList(): void; 137 | getVolumesList(): Array; 138 | setVolumesList(value: Array): VolumesListResponse; 139 | addVolumes(value?: Volume, index?: number): Volume; 140 | 141 | 142 | serializeBinary(): Uint8Array; 143 | toObject(includeInstance?: boolean): VolumesListResponse.AsObject; 144 | static toObject(includeInstance: boolean, msg: VolumesListResponse): VolumesListResponse.AsObject; 145 | static extensions: {[key: number]: jspb.ExtensionFieldInfo}; 146 | static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; 147 | static serializeBinaryToWriter(message: VolumesListResponse, writer: jspb.BinaryWriter): void; 148 | static deserializeBinary(bytes: Uint8Array): VolumesListResponse; 149 | static deserializeBinaryFromReader(message: VolumesListResponse, reader: jspb.BinaryReader): VolumesListResponse; 150 | } 151 | 152 | export namespace VolumesListResponse { 153 | export type AsObject = { 154 | volumesList: Array, 155 | } 156 | } 157 | 158 | export class VolumesDeleteRequest extends jspb.Message { 159 | getId(): string; 160 | setId(value: string): VolumesDeleteRequest; 161 | 162 | 163 | serializeBinary(): Uint8Array; 164 | toObject(includeInstance?: boolean): VolumesDeleteRequest.AsObject; 165 | static toObject(includeInstance: boolean, msg: VolumesDeleteRequest): VolumesDeleteRequest.AsObject; 166 | static extensions: {[key: number]: jspb.ExtensionFieldInfo}; 167 | static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; 168 | static serializeBinaryToWriter(message: VolumesDeleteRequest, writer: jspb.BinaryWriter): void; 169 | static deserializeBinary(bytes: Uint8Array): VolumesDeleteRequest; 170 | static deserializeBinaryFromReader(message: VolumesDeleteRequest, reader: jspb.BinaryReader): VolumesDeleteRequest; 171 | } 172 | 173 | export namespace VolumesDeleteRequest { 174 | export type AsObject = { 175 | id: string, 176 | } 177 | } 178 | 179 | export class VolumesDeleteResponse extends jspb.Message { 180 | 181 | serializeBinary(): Uint8Array; 182 | toObject(includeInstance?: boolean): VolumesDeleteResponse.AsObject; 183 | static toObject(includeInstance: boolean, msg: VolumesDeleteResponse): VolumesDeleteResponse.AsObject; 184 | static extensions: {[key: number]: jspb.ExtensionFieldInfo}; 185 | static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; 186 | static serializeBinaryToWriter(message: VolumesDeleteResponse, writer: jspb.BinaryWriter): void; 187 | static deserializeBinary(bytes: Uint8Array): VolumesDeleteResponse; 188 | static deserializeBinaryFromReader(message: VolumesDeleteResponse, reader: jspb.BinaryReader): VolumesDeleteResponse; 189 | } 190 | 191 | export namespace VolumesDeleteResponse { 192 | export type AsObject = { 193 | } 194 | } 195 | 196 | export class VolumesInspectRequest extends jspb.Message { 197 | getId(): string; 198 | setId(value: string): VolumesInspectRequest; 199 | 200 | 201 | serializeBinary(): Uint8Array; 202 | toObject(includeInstance?: boolean): VolumesInspectRequest.AsObject; 203 | static toObject(includeInstance: boolean, msg: VolumesInspectRequest): VolumesInspectRequest.AsObject; 204 | static extensions: {[key: number]: jspb.ExtensionFieldInfo}; 205 | static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; 206 | static serializeBinaryToWriter(message: VolumesInspectRequest, writer: jspb.BinaryWriter): void; 207 | static deserializeBinary(bytes: Uint8Array): VolumesInspectRequest; 208 | static deserializeBinaryFromReader(message: VolumesInspectRequest, reader: jspb.BinaryReader): VolumesInspectRequest; 209 | } 210 | 211 | export namespace VolumesInspectRequest { 212 | export type AsObject = { 213 | id: string, 214 | } 215 | } 216 | 217 | export class VolumesInspectResponse extends jspb.Message { 218 | 219 | hasVolume(): boolean; 220 | clearVolume(): void; 221 | getVolume(): Volume | undefined; 222 | setVolume(value?: Volume): VolumesInspectResponse; 223 | 224 | 225 | serializeBinary(): Uint8Array; 226 | toObject(includeInstance?: boolean): VolumesInspectResponse.AsObject; 227 | static toObject(includeInstance: boolean, msg: VolumesInspectResponse): VolumesInspectResponse.AsObject; 228 | static extensions: {[key: number]: jspb.ExtensionFieldInfo}; 229 | static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; 230 | static serializeBinaryToWriter(message: VolumesInspectResponse, writer: jspb.BinaryWriter): void; 231 | static deserializeBinary(bytes: Uint8Array): VolumesInspectResponse; 232 | static deserializeBinaryFromReader(message: VolumesInspectResponse, reader: jspb.BinaryReader): VolumesInspectResponse; 233 | } 234 | 235 | export namespace VolumesInspectResponse { 236 | export type AsObject = { 237 | volume?: Volume.AsObject, 238 | } 239 | } 240 | -------------------------------------------------------------------------------- /src/streams.ts: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020 Docker CLI JavaScript SDK authors 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | import { BytesMessage as PbBytesMessage } from './protos/streams/v1/streams_pb'; 18 | import * as google_protobuf_any_pb from 'google-protobuf/google/protobuf/any_pb'; 19 | 20 | export class BytesMessage extends PbBytesMessage { 21 | toAny(): google_protobuf_any_pb.Any { 22 | const any = new google_protobuf_any_pb.Any(); 23 | any.pack(this.serializeBinary(), this.name()); 24 | return any; 25 | } 26 | 27 | static fromAny(any: google_protobuf_any_pb.Any): BytesMessage { 28 | return (any.unpack( 29 | PbBytesMessage.deserializeBinary, 30 | 'com.docker.api.protos.streams.v1.BytesMessage' 31 | ) as unknown) as BytesMessage; 32 | } 33 | 34 | name(): string { 35 | return 'type.googleapis.com/com.docker.api.protos.streams.v1.BytesMessage'; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/volumes.ts: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020 The Authors 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | export * from './protos/volumes/v1/volumes_pb'; 18 | -------------------------------------------------------------------------------- /test/context-ls.test.ts: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020 Docker CLI JavaScript SDK authors 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | const fs = require('fs'); 18 | const path = require('path'); 19 | const { spawn } = require('child_process'); 20 | 21 | import { Contexts } from '../src'; 22 | import { ListRequest, ListResponse } from '../src/contexts'; 23 | import { ServiceError } from '@grpc/grpc-js'; 24 | 25 | describe('SDK', () => { 26 | let proc; 27 | 28 | let cli = path.resolve('docker'); 29 | if (!fs.existsSync(cli)) { 30 | cli = 'docker'; 31 | } 32 | const address = 'unix:///tmp/test.sock'; 33 | 34 | beforeAll((done) => { 35 | proc = spawn(cli, ['serve', '--address', address]); 36 | // Wait for the server to print that it's listening. 37 | proc.stderr.on('data', () => { 38 | done(); 39 | }); 40 | }); 41 | 42 | afterAll(() => { 43 | proc.kill('SIGINT'); 44 | }); 45 | 46 | it('can call the backend', (done) => { 47 | const client = new Contexts(address); 48 | client.list( 49 | new ListRequest(), 50 | (error: ServiceError, response: ListResponse) => { 51 | expect(error).toBeNull(); 52 | expect(response.getContextsList().length).toBeGreaterThan(0); 53 | done(); 54 | } 55 | ); 56 | }); 57 | }); 58 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "include": ["src"], 3 | "exclude": ["src/protos"], 4 | "compilerOptions": { 5 | "module": "CommonJS", 6 | "target": "ES2015", 7 | "lib": ["esnext"], 8 | "importHelpers": true, 9 | "declaration": true, 10 | "sourceMap": true, 11 | "allowJs": true, 12 | "rootDir": "./src", 13 | "strict": true, 14 | "noUnusedLocals": true, 15 | "noUnusedParameters": true, 16 | "noImplicitReturns": true, 17 | "noFallthroughCasesInSwitch": true, 18 | "moduleResolution": "node", 19 | "baseUrl": "./", 20 | "paths": { 21 | "*": ["src/*", "node_modules/*"] 22 | }, 23 | "esModuleInterop": true 24 | } 25 | } 26 | --------------------------------------------------------------------------------