Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>
| ... | ... |
@@ -240,7 +240,7 @@ List containers |
| 240 | 240 |
- `volume`=(`<volume name>` or `<mount point destination>`) |
| 241 | 241 |
- `network`=(`<network id>` or `<network name>`) |
| 242 | 242 |
- `health`=(`starting`|`healthy`|`unhealthy`|`none`) |
| 243 |
- |
|
| 243 |
+ |
|
| 244 | 244 |
**Status codes**: |
| 245 | 245 |
|
| 246 | 246 |
- **200** – no error |
| ... | ... |
@@ -5842,6 +5842,134 @@ Get details on a task |
| 5842 | 5842 |
- **404** – unknown task |
| 5843 | 5843 |
- **500** – server error |
| 5844 | 5844 |
|
| 5845 |
+## 3.11 Secrets |
|
| 5846 |
+ |
|
| 5847 |
+**Note**: Secret operations require the engine to be part of a swarm. |
|
| 5848 |
+ |
|
| 5849 |
+### List secrets |
|
| 5850 |
+ |
|
| 5851 |
+`GET /secrets` |
|
| 5852 |
+ |
|
| 5853 |
+List secrets |
|
| 5854 |
+ |
|
| 5855 |
+**Example request**: |
|
| 5856 |
+ |
|
| 5857 |
+ GET /secrets HTTP/1.1 |
|
| 5858 |
+ |
|
| 5859 |
+**Example response**: |
|
| 5860 |
+ |
|
| 5861 |
+ [ |
|
| 5862 |
+ {
|
|
| 5863 |
+ "ID": "ktnbjxoalbkvbvedmg1urrz8h", |
|
| 5864 |
+ "Version": {
|
|
| 5865 |
+ "Index": 11 |
|
| 5866 |
+ }, |
|
| 5867 |
+ "CreatedAt": "2016-11-05T01:20:17.327670065Z", |
|
| 5868 |
+ "UpdatedAt": "2016-11-05T01:20:17.327670065Z", |
|
| 5869 |
+ "Spec": {
|
|
| 5870 |
+ "Name": "app-dev.crt" |
|
| 5871 |
+ }, |
|
| 5872 |
+ "Digest": "sha256:11d7c6f38253b73e608153c9f662a191ae605e1a3d9b756b0b3426388f91d3fa", |
|
| 5873 |
+ "SecretSize": 31 |
|
| 5874 |
+ } |
|
| 5875 |
+ ] |
|
| 5876 |
+ |
|
| 5877 |
+ |
|
| 5878 |
+**Query parameters**: |
|
| 5879 |
+ |
|
| 5880 |
+- **filters** - a JSON encoded value of the filters (a `map[string][]string`) to process on the secrets list. Available filters: |
|
| 5881 |
+ - `names=<secret name>` |
|
| 5882 |
+ |
|
| 5883 |
+**Status codes**: |
|
| 5884 |
+ |
|
| 5885 |
+- **200** – no error |
|
| 5886 |
+ |
|
| 5887 |
+### Create a secret |
|
| 5888 |
+ |
|
| 5889 |
+`POST /secrets/create` |
|
| 5890 |
+ |
|
| 5891 |
+Create a secret |
|
| 5892 |
+ |
|
| 5893 |
+**Example request**: |
|
| 5894 |
+ |
|
| 5895 |
+ POST /secrets/create HTTP/1.1 |
|
| 5896 |
+ Content-Type: application/json |
|
| 5897 |
+ |
|
| 5898 |
+ {
|
|
| 5899 |
+ "Name": "app-key.crt", |
|
| 5900 |
+ "Labels": {
|
|
| 5901 |
+ "foo": "bar" |
|
| 5902 |
+ }, |
|
| 5903 |
+ "Data": "VEhJUyBJUyBOT1QgQSBSRUFMIENFUlRJRklDQVRFCg==" |
|
| 5904 |
+ } |
|
| 5905 |
+ |
|
| 5906 |
+**Example response**: |
|
| 5907 |
+ |
|
| 5908 |
+ HTTP/1.1 201 Created |
|
| 5909 |
+ Content-Type: application/json |
|
| 5910 |
+ |
|
| 5911 |
+ {
|
|
| 5912 |
+ "ID": "ktnbjxoalbkvbvedmg1urrz8h" |
|
| 5913 |
+ } |
|
| 5914 |
+ |
|
| 5915 |
+**Status codes**: |
|
| 5916 |
+ |
|
| 5917 |
+- **201** – no error |
|
| 5918 |
+- **406** – server error or node is not part of a swarm |
|
| 5919 |
+- **409** – name conflicts with an existing object |
|
| 5920 |
+ |
|
| 5921 |
+**JSON Parameters**: |
|
| 5922 |
+ |
|
| 5923 |
+- **Name** – User-defined name for the secret. |
|
| 5924 |
+- **Labels** – A map of labels to associate with the secret (e.g., `{"key":"value", "key2":"value2"}`).
|
|
| 5925 |
+- **Data** – Base64-url-safe-encoded secret data |
|
| 5926 |
+ |
|
| 5927 |
+### Inspect a secret |
|
| 5928 |
+ |
|
| 5929 |
+`GET /secrets/(secret id)` |
|
| 5930 |
+ |
|
| 5931 |
+Get details on a secret |
|
| 5932 |
+ |
|
| 5933 |
+**Example request**: |
|
| 5934 |
+ |
|
| 5935 |
+ GET /secrets/ktnbjxoalbkvbvedmg1urrz8h HTTP/1.1 |
|
| 5936 |
+ |
|
| 5937 |
+**Example response**: |
|
| 5938 |
+ |
|
| 5939 |
+ {
|
|
| 5940 |
+ "ID": "ktnbjxoalbkvbvedmg1urrz8h", |
|
| 5941 |
+ "Version": {
|
|
| 5942 |
+ "Index": 11 |
|
| 5943 |
+ }, |
|
| 5944 |
+ "CreatedAt": "2016-11-05T01:20:17.327670065Z", |
|
| 5945 |
+ "UpdatedAt": "2016-11-05T01:20:17.327670065Z", |
|
| 5946 |
+ "Spec": {
|
|
| 5947 |
+ "Name": "app-dev.crt" |
|
| 5948 |
+ }, |
|
| 5949 |
+ "Digest": "sha256:11d7c6f38253b73e608153c9f662a191ae605e1a3d9b756b0b3426388f91d3fa", |
|
| 5950 |
+ "SecretSize": 31 |
|
| 5951 |
+ } |
|
| 5952 |
+ |
|
| 5953 |
+**Status codes**: |
|
| 5954 |
+ |
|
| 5955 |
+- **200** – no error |
|
| 5956 |
+- **404** – unknown secret |
|
| 5957 |
+- **500** – server error |
|
| 5958 |
+ |
|
| 5959 |
+### Remove a secret |
|
| 5960 |
+ |
|
| 5961 |
+`DELETE /secrets/(id)` |
|
| 5962 |
+ |
|
| 5963 |
+Remove the secret `id` from the secret store |
|
| 5964 |
+ |
|
| 5965 |
+**Example request**: |
|
| 5966 |
+ |
|
| 5967 |
+ DELETE /secrets/ktnbjxoalbkvbvedmg1urrz8h HTTP/1.1 |
|
| 5968 |
+ |
|
| 5969 |
+**Example response**: |
|
| 5970 |
+ |
|
| 5971 |
+ HTTP/1.1 204 No Content |
|
| 5972 |
+ |
|
| 5845 | 5973 |
# 4. Going further |
| 5846 | 5974 |
|
| 5847 | 5975 |
## 4.1 Inside `docker run` |