From 2f96a5add718693beaa8c267b8cd1f5711012dba Mon Sep 17 00:00:00 2001 From: Nayan Das Date: Tue, 12 Nov 2024 08:06:54 +0000 Subject: [PATCH 01/15] Add name registry get spec --- specification/DigitalOcean-public.v2.yaml | 3 ++ .../resources/registry/named_registry_get.yml | 33 +++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 specification/resources/registry/named_registry_get.yml diff --git a/specification/DigitalOcean-public.v2.yaml b/specification/DigitalOcean-public.v2.yaml index ff8df2f4..2ccfe320 100644 --- a/specification/DigitalOcean-public.v2.yaml +++ b/specification/DigitalOcean-public.v2.yaml @@ -1485,6 +1485,9 @@ paths: delete: $ref: 'resources/registry/registry_delete.yml' + /v2/registries: + get: + $ref: 'resources/registry/named_registry_get.yml' /v2/registry/subscription: get: diff --git a/specification/resources/registry/named_registry_get.yml b/specification/resources/registry/named_registry_get.yml new file mode 100644 index 00000000..478a5dda --- /dev/null +++ b/specification/resources/registry/named_registry_get.yml @@ -0,0 +1,33 @@ +operationId: named_registry_get + +summary: Get Named Container Registry (Beta) + +description: To get information about your container registry, send a GET + request to `/v2/registries/{registry_name}`. + +tags: + - Container Registry + +responses: + '200': + $ref: 'responses/registry_info.yml' + + '401': + $ref: '../../shared/responses/unauthorized.yml' + + '429': + $ref: '../../shared/responses/too_many_requests.yml' + + '500': + $ref: '../../shared/responses/server_error.yml' + + default: + $ref: '../../shared/responses/unexpected_error.yml' + +x-codeSamples: + - $ref: 'examples/curl/registry_get.yml' + - $ref: 'examples/python/registry_get.yml' + +security: + - bearer_auth: + - 'registry:read' From 8075611bf3f80414197490f996f43b1eb69117dc Mon Sep 17 00:00:00 2001 From: Nayan Das Date: Tue, 12 Nov 2024 11:06:06 +0000 Subject: [PATCH 02/15] Add name registry post spec --- specification/DigitalOcean-public.v2.yaml | 4 ++ .../examples/curl/named_registry_create.yml | 7 +++ .../examples/python/named_registry_create.yml | 13 ++++++ .../registry/models/named_registry_create.yml | 25 +++++++++++ .../registry/named_registry_create.yml | 45 +++++++++++++++++++ .../resources/registry/named_registry_get.yml | 2 +- 6 files changed, 95 insertions(+), 1 deletion(-) create mode 100644 specification/resources/registry/examples/curl/named_registry_create.yml create mode 100644 specification/resources/registry/examples/python/named_registry_create.yml create mode 100644 specification/resources/registry/models/named_registry_create.yml create mode 100644 specification/resources/registry/named_registry_create.yml diff --git a/specification/DigitalOcean-public.v2.yaml b/specification/DigitalOcean-public.v2.yaml index 2ccfe320..c7929630 100644 --- a/specification/DigitalOcean-public.v2.yaml +++ b/specification/DigitalOcean-public.v2.yaml @@ -1485,9 +1485,13 @@ paths: delete: $ref: 'resources/registry/registry_delete.yml' + /v2/registries: get: $ref: 'resources/registry/named_registry_get.yml' + + post: + $ref: 'resources/registry/named_registry_create.yml' /v2/registry/subscription: get: diff --git a/specification/resources/registry/examples/curl/named_registry_create.yml b/specification/resources/registry/examples/curl/named_registry_create.yml new file mode 100644 index 00000000..a81dbdc9 --- /dev/null +++ b/specification/resources/registry/examples/curl/named_registry_create.yml @@ -0,0 +1,7 @@ +lang: cURL +source: |- + curl -X POST \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \ + -d '{"name": "example", "region": "fra1"}' \ + "https://api.digitalocean.com/v2/registry" diff --git a/specification/resources/registry/examples/python/named_registry_create.yml b/specification/resources/registry/examples/python/named_registry_create.yml new file mode 100644 index 00000000..f60a12a1 --- /dev/null +++ b/specification/resources/registry/examples/python/named_registry_create.yml @@ -0,0 +1,13 @@ +lang: Python +source: |- + import os + from pydo import Client + + client = Client(token=os.environ.get("DIGITALOCEAN_TOKEN")) + + req = { + "name": "example", + "region": "fra1" + } + + resp = client.registry.create(body=req) diff --git a/specification/resources/registry/models/named_registry_create.yml b/specification/resources/registry/models/named_registry_create.yml new file mode 100644 index 00000000..a3c8008d --- /dev/null +++ b/specification/resources/registry/models/named_registry_create.yml @@ -0,0 +1,25 @@ +type: object + +properties: + name: + type: string + maxLength: 63 + pattern: '^[a-z0-9-]{1,63}$' + example: example + description: A globally unique name for the container registry. Must be + lowercase and be composed only of numbers, letters and `-`, up to a limit + of 63 characters. + + region: + type: string + enum: + - nyc3 + - sfo3 + - ams3 + - sgp1 + - fra1 + example: fra1 + description: Slug of the region where registry data is stored. When not provided, a region will be selected. + +required: +- name diff --git a/specification/resources/registry/named_registry_create.yml b/specification/resources/registry/named_registry_create.yml new file mode 100644 index 00000000..4a39c83b --- /dev/null +++ b/specification/resources/registry/named_registry_create.yml @@ -0,0 +1,45 @@ +operationId: named_registry_create + +summary: Create Named Container Registry (Beta) + +description: | + To create your container registry, send a POST request to `/v2/registries`. + + The `name` becomes part of the URL for images stored in the registry. For + example, if your registry is called `example`, an image in it will have the + URL `registry.digitalocean.com/example/image:tag`. + +tags: + - Container Registry + +requestBody: + required: true + + content: + application/json: + schema: + $ref: 'models/named_registry_create.yml' + +responses: + '201': + $ref: 'responses/registry_info.yml' + + '401': + $ref: '../../shared/responses/unauthorized.yml' + + '429': + $ref: '../../shared/responses/too_many_requests.yml' + + '500': + $ref: '../../shared/responses/server_error.yml' + + default: + $ref: '../../shared/responses/unexpected_error.yml' + +x-codeSamples: + - $ref: 'examples/curl/named_registry_create.yml' + - $ref: 'examples/python/named_registry_create.yml' + +security: + - bearer_auth: + - 'registry:create' diff --git a/specification/resources/registry/named_registry_get.yml b/specification/resources/registry/named_registry_get.yml index 478a5dda..34398e9d 100644 --- a/specification/resources/registry/named_registry_get.yml +++ b/specification/resources/registry/named_registry_get.yml @@ -2,7 +2,7 @@ operationId: named_registry_get summary: Get Named Container Registry (Beta) -description: To get information about your container registry, send a GET +description: To get information about any container registry in your account, send a GET request to `/v2/registries/{registry_name}`. tags: From 6db6f2160f41a5f686f61a70ff216f5b56ca344c Mon Sep 17 00:00:00 2001 From: Nayan Das Date: Wed, 13 Nov 2024 07:33:51 +0000 Subject: [PATCH 03/15] Update naming --- specification/DigitalOcean-public.v2.yaml | 7 ++-- ...ry_create.yml => multiregistry_create.yml} | 2 +- ...ry_create.yml => multiregistry_create.yml} | 0 ...ry_create.yml => multiregistry_create.yml} | 0 ...ry_create.yml => multiregistry_create.yml} | 8 ++--- .../registry/multiregistry_delete.yml | 36 +++++++++++++++++++ ...registry_get.yml => multiregistry_get.yml} | 2 +- 7 files changed, 47 insertions(+), 8 deletions(-) rename specification/resources/registry/examples/curl/{named_registry_create.yml => multiregistry_create.yml} (78%) rename specification/resources/registry/examples/python/{named_registry_create.yml => multiregistry_create.yml} (100%) rename specification/resources/registry/models/{named_registry_create.yml => multiregistry_create.yml} (100%) rename specification/resources/registry/{named_registry_create.yml => multiregistry_create.yml} (81%) create mode 100644 specification/resources/registry/multiregistry_delete.yml rename specification/resources/registry/{named_registry_get.yml => multiregistry_get.yml} (95%) diff --git a/specification/DigitalOcean-public.v2.yaml b/specification/DigitalOcean-public.v2.yaml index c7929630..76feb469 100644 --- a/specification/DigitalOcean-public.v2.yaml +++ b/specification/DigitalOcean-public.v2.yaml @@ -1488,10 +1488,13 @@ paths: /v2/registries: get: - $ref: 'resources/registry/named_registry_get.yml' + $ref: 'resources/registry/multiregistry_get.yml' post: - $ref: 'resources/registry/named_registry_create.yml' + $ref: 'resources/registry/multiregistry_create.yml' + + delete: + $ref: 'resources/registry/multiregistry_delete.yml' /v2/registry/subscription: get: diff --git a/specification/resources/registry/examples/curl/named_registry_create.yml b/specification/resources/registry/examples/curl/multiregistry_create.yml similarity index 78% rename from specification/resources/registry/examples/curl/named_registry_create.yml rename to specification/resources/registry/examples/curl/multiregistry_create.yml index a81dbdc9..cc0907de 100644 --- a/specification/resources/registry/examples/curl/named_registry_create.yml +++ b/specification/resources/registry/examples/curl/multiregistry_create.yml @@ -4,4 +4,4 @@ source: |- -H "Content-Type: application/json" \ -H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \ -d '{"name": "example", "region": "fra1"}' \ - "https://api.digitalocean.com/v2/registry" + "https://api.digitalocean.com/v2/registries" diff --git a/specification/resources/registry/examples/python/named_registry_create.yml b/specification/resources/registry/examples/python/multiregistry_create.yml similarity index 100% rename from specification/resources/registry/examples/python/named_registry_create.yml rename to specification/resources/registry/examples/python/multiregistry_create.yml diff --git a/specification/resources/registry/models/named_registry_create.yml b/specification/resources/registry/models/multiregistry_create.yml similarity index 100% rename from specification/resources/registry/models/named_registry_create.yml rename to specification/resources/registry/models/multiregistry_create.yml diff --git a/specification/resources/registry/named_registry_create.yml b/specification/resources/registry/multiregistry_create.yml similarity index 81% rename from specification/resources/registry/named_registry_create.yml rename to specification/resources/registry/multiregistry_create.yml index 4a39c83b..f1244b38 100644 --- a/specification/resources/registry/named_registry_create.yml +++ b/specification/resources/registry/multiregistry_create.yml @@ -1,4 +1,4 @@ -operationId: named_registry_create +operationId: multiregistry_create summary: Create Named Container Registry (Beta) @@ -18,7 +18,7 @@ requestBody: content: application/json: schema: - $ref: 'models/named_registry_create.yml' + $ref: 'models/multiregistry_create.yml' responses: '201': @@ -37,8 +37,8 @@ responses: $ref: '../../shared/responses/unexpected_error.yml' x-codeSamples: - - $ref: 'examples/curl/named_registry_create.yml' - - $ref: 'examples/python/named_registry_create.yml' + - $ref: 'examples/curl/multiregistry_create.yml' + - $ref: 'examples/python/multiregistry_create.yml' security: - bearer_auth: diff --git a/specification/resources/registry/multiregistry_delete.yml b/specification/resources/registry/multiregistry_delete.yml new file mode 100644 index 00000000..6ca42756 --- /dev/null +++ b/specification/resources/registry/multiregistry_delete.yml @@ -0,0 +1,36 @@ +operationId: multiregistry_delete + +summary: Delete Container Registry By Name (Beta) + +description: To delete your container registry, destroying all container image + data stored in it, send a DELETE request to `/v2/registries/{registry_name}`. + +tags: + - Container Registry + +responses: + '204': + $ref: '../../shared/responses/no_content.yml' + + '401': + $ref: '../../shared/responses/unauthorized.yml' + + '404': + $ref: '../../shared/responses/not_found.yml' + + '429': + $ref: '../../shared/responses/too_many_requests.yml' + + '500': + $ref: '../../shared/responses/server_error.yml' + + default: + $ref: '../../shared/responses/unexpected_error.yml' + +x-codeSamples: + - $ref: 'examples/curl/registry_delete.yml' + - $ref: 'examples/python/registry_delete.yml' + +security: + - bearer_auth: + - 'registry:delete' diff --git a/specification/resources/registry/named_registry_get.yml b/specification/resources/registry/multiregistry_get.yml similarity index 95% rename from specification/resources/registry/named_registry_get.yml rename to specification/resources/registry/multiregistry_get.yml index 34398e9d..ad37fd98 100644 --- a/specification/resources/registry/named_registry_get.yml +++ b/specification/resources/registry/multiregistry_get.yml @@ -1,4 +1,4 @@ -operationId: named_registry_get +operationId: multiregistry_get summary: Get Named Container Registry (Beta) From c5b53c1748162830fa0d01c5e4082d1ac190e62a Mon Sep 17 00:00:00 2001 From: Nayan Das Date: Wed, 13 Nov 2024 11:09:34 +0000 Subject: [PATCH 04/15] Add all registries get spec --- specification/DigitalOcean-public.v2.yaml | 4 +++ .../examples/curl/all_registries_get.yml | 6 ++++ .../registry/multiregistry_create.yml | 2 +- .../registry/multiregistry_delete.yml | 2 +- .../resources/registry/multiregistry_get.yml | 2 +- .../registry/multiregistry_get_all.yml | 33 +++++++++++++++++++ .../responses/all_registries_info.yml | 20 +++++++++++ 7 files changed, 66 insertions(+), 3 deletions(-) create mode 100644 specification/resources/registry/examples/curl/all_registries_get.yml create mode 100644 specification/resources/registry/multiregistry_get_all.yml create mode 100644 specification/resources/registry/responses/all_registries_info.yml diff --git a/specification/DigitalOcean-public.v2.yaml b/specification/DigitalOcean-public.v2.yaml index 76feb469..53c807a8 100644 --- a/specification/DigitalOcean-public.v2.yaml +++ b/specification/DigitalOcean-public.v2.yaml @@ -1487,6 +1487,10 @@ paths: $ref: 'resources/registry/registry_delete.yml' /v2/registries: + get: + $ref: 'resources/registry/multiregistry_get_all.yml' + + /v2/registries/{registry_name}: get: $ref: 'resources/registry/multiregistry_get.yml' diff --git a/specification/resources/registry/examples/curl/all_registries_get.yml b/specification/resources/registry/examples/curl/all_registries_get.yml new file mode 100644 index 00000000..89ca32bd --- /dev/null +++ b/specification/resources/registry/examples/curl/all_registries_get.yml @@ -0,0 +1,6 @@ +lang: cURL +source: |- + curl -X GET \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \ + "https://api.digitalocean.com/v2/registry" diff --git a/specification/resources/registry/multiregistry_create.yml b/specification/resources/registry/multiregistry_create.yml index f1244b38..b771fe33 100644 --- a/specification/resources/registry/multiregistry_create.yml +++ b/specification/resources/registry/multiregistry_create.yml @@ -38,7 +38,7 @@ responses: x-codeSamples: - $ref: 'examples/curl/multiregistry_create.yml' - - $ref: 'examples/python/multiregistry_create.yml' + # - $ref: 'examples/python/multiregistry_create.yml' security: - bearer_auth: diff --git a/specification/resources/registry/multiregistry_delete.yml b/specification/resources/registry/multiregistry_delete.yml index 6ca42756..74db3be5 100644 --- a/specification/resources/registry/multiregistry_delete.yml +++ b/specification/resources/registry/multiregistry_delete.yml @@ -29,7 +29,7 @@ responses: x-codeSamples: - $ref: 'examples/curl/registry_delete.yml' - - $ref: 'examples/python/registry_delete.yml' + # - $ref: 'examples/python/registry_delete.yml' security: - bearer_auth: diff --git a/specification/resources/registry/multiregistry_get.yml b/specification/resources/registry/multiregistry_get.yml index ad37fd98..455fdf30 100644 --- a/specification/resources/registry/multiregistry_get.yml +++ b/specification/resources/registry/multiregistry_get.yml @@ -26,7 +26,7 @@ responses: x-codeSamples: - $ref: 'examples/curl/registry_get.yml' - - $ref: 'examples/python/registry_get.yml' + # - $ref: 'examples/python/registry_get.yml' security: - bearer_auth: diff --git a/specification/resources/registry/multiregistry_get_all.yml b/specification/resources/registry/multiregistry_get_all.yml new file mode 100644 index 00000000..9dde4e13 --- /dev/null +++ b/specification/resources/registry/multiregistry_get_all.yml @@ -0,0 +1,33 @@ +operationId: multiregistry_get_all + +summary: Get All Container Registries (Beta) + +description: To get information about any container registry in your account, send a GET + request to `/v2/registries/`. + +tags: + - Container Registry + +responses: + '200': + $ref: 'responses/all_registries_info.yml' + + '401': + $ref: '../../shared/responses/unauthorized.yml' + + '429': + $ref: '../../shared/responses/too_many_requests.yml' + + '500': + $ref: '../../shared/responses/server_error.yml' + + default: + $ref: '../../shared/responses/unexpected_error.yml' + +x-codeSamples: + - $ref: 'examples/curl/registry_get.yml' + - $ref: 'examples/python/registry_get.yml' + +security: + - bearer_auth: + - 'registry:read' diff --git a/specification/resources/registry/responses/all_registries_info.yml b/specification/resources/registry/responses/all_registries_info.yml new file mode 100644 index 00000000..c76dd2bf --- /dev/null +++ b/specification/resources/registry/responses/all_registries_info.yml @@ -0,0 +1,20 @@ +description: The response will be a JSON object with the key `registry` + containing information about your registry. + +headers: + ratelimit-limit: + $ref: '../../../shared/headers.yml#/ratelimit-limit' + ratelimit-remaining: + $ref: '../../../shared/headers.yml#/ratelimit-remaining' + ratelimit-reset: + $ref: '../../../shared/headers.yml#/ratelimit-reset' + +content: + application/json: + schema: + properties: + registry: + type: array + items: + oneOf: + - $ref: '../models/registry.yml' From 85995e19485452bc25be41acdcc343a9a447264d Mon Sep 17 00:00:00 2001 From: Nayan Das Date: Wed, 13 Nov 2024 13:46:24 +0000 Subject: [PATCH 05/15] Add docker credentials endpoint for multi beta api --- specification/DigitalOcean-public.v2.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/specification/DigitalOcean-public.v2.yaml b/specification/DigitalOcean-public.v2.yaml index 53c807a8..82872c98 100644 --- a/specification/DigitalOcean-public.v2.yaml +++ b/specification/DigitalOcean-public.v2.yaml @@ -1500,6 +1500,10 @@ paths: delete: $ref: 'resources/registry/multiregistry_delete.yml' + /v2/registries/{registry_name}/docker-credentials: + get: + $ref: 'resources/registry/multiregistry_get_dockerCredentials.yml' + /v2/registry/subscription: get: $ref: 'resources/registry/registry_get_subscription.yml' From caa87504c3d305c121f4c6e5e2d16bda28e26f86 Mon Sep 17 00:00:00 2001 From: Nayan Das Date: Thu, 14 Nov 2024 06:00:01 +0000 Subject: [PATCH 06/15] Add docker credentials endpoint for multi beta api --- .../multiregistry_get_dockerCredentials.yml | 59 +++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 specification/resources/registry/multiregistry_get_dockerCredentials.yml diff --git a/specification/resources/registry/multiregistry_get_dockerCredentials.yml b/specification/resources/registry/multiregistry_get_dockerCredentials.yml new file mode 100644 index 00000000..15e73f8b --- /dev/null +++ b/specification/resources/registry/multiregistry_get_dockerCredentials.yml @@ -0,0 +1,59 @@ +operationId: multiregistry_get_dockerCredentials + +summary: Get Docker Credentials By Registry Name (Beta) + +description: | + In order to access your container registry with the Docker client or from a + Kubernetes cluster, you will need to configure authentication. The necessary + JSON configuration can be retrieved by sending a GET request to + `/v2/registries/docker-credentials/{registry_name}`. + + The response will be in the format of a Docker `config.json` file. To use the + config in your Kubernetes cluster, create a Secret with: + + kubectl create secret generic docr \ + --from-file=.dockerconfigjson=config.json \ + --type=kubernetes.io/dockerconfigjson + + By default, the returned credentials have read-only access to your registry + and cannot be used to push images. This is appropriate for most Kubernetes + clusters. To retrieve read/write credentials, suitable for use with the Docker + client or in a CI system, read_write may be provided as query parameter. For + example: `/v2/registries/docker-credentials/{registry_name}?read_write=true` + + By default, the returned credentials will not expire. To retrieve credentials + with an expiry set, expiry_seconds may be provided as a query parameter. For + example: `/v2/registry/docker-credentials/{registry_name}?expiry_seconds=3600` will return + credentials that expire after one hour. + +tags: + - Container Registry + +parameters: + - $ref: 'parameters.yml#/registry_expiry_seconds' + - $ref: 'parameters.yml#/registry_read_write' + +responses: + '200': + $ref: 'responses/docker_credentials.yml' + + '401': + $ref: '../../shared/responses/unauthorized.yml' + + '429': + $ref: '../../shared/responses/too_many_requests.yml' + + '500': + $ref: '../../shared/responses/server_error.yml' + + default: + $ref: '../../shared/responses/unexpected_error.yml' + +x-codeSamples: + - $ref: 'examples/curl/registry_get_dockerCredentials.yml' + - $ref: 'examples/python/registry_get_dockerCredentials.yml' + +security: + - bearer_auth: + - 'registry:read' + - 'registry:update' From 5c535bee26702107ec28ff10de0eb38769cb6d02 Mon Sep 17 00:00:00 2001 From: Nayan Das Date: Thu, 14 Nov 2024 12:05:54 +0000 Subject: [PATCH 07/15] Fix multiregistry create spec --- .../registry/models/multiregistry.yml | 39 +++++++++++++++++++ .../registry/models/multiregistry_create.yml | 3 ++ .../registry/multiregistry_create.yml | 4 +- .../registry/responses/multiregistry_info.yml | 17 ++++++++ 4 files changed, 61 insertions(+), 2 deletions(-) create mode 100644 specification/resources/registry/models/multiregistry.yml create mode 100644 specification/resources/registry/responses/multiregistry_info.yml diff --git a/specification/resources/registry/models/multiregistry.yml b/specification/resources/registry/models/multiregistry.yml new file mode 100644 index 00000000..f7dd7757 --- /dev/null +++ b/specification/resources/registry/models/multiregistry.yml @@ -0,0 +1,39 @@ +type: object + +properties: + name: + type: string + maxLength: 63 + pattern: '^[a-z0-9-]{1,63}$' + example: example + description: A globally unique name for the container registry. Must be + lowercase and be composed only of numbers, letters and `-`, up to a limit + of 63 characters. + + created_at: + type: string + format: date-time + readOnly: true + example: '2020-03-21T16:02:37Z' + description: A time value given in ISO8601 combined date and time format + that represents when the registry was created. + + region: + type: string + example: fra1 + description: Slug of the region where registry data is stored + + storage_usage_bytes: + type: integer + readOnly: true + example: 29393920 + description: The amount of storage used in the registry in bytes. + + storage_usage_bytes_updated_at: + type: string + format: date-time + readOnly: true + example: '2020-11-04T21:39:49.530562231Z' + description: The time at which the storage usage was updated. Storage usage + is calculated asynchronously, and may not immediately reflect pushes to + the registry. diff --git a/specification/resources/registry/models/multiregistry_create.yml b/specification/resources/registry/models/multiregistry_create.yml index a3c8008d..9267fc74 100644 --- a/specification/resources/registry/models/multiregistry_create.yml +++ b/specification/resources/registry/models/multiregistry_create.yml @@ -15,9 +15,12 @@ properties: enum: - nyc3 - sfo3 + - sfo2 - ams3 - sgp1 - fra1 + - blr1 + - syd1 example: fra1 description: Slug of the region where registry data is stored. When not provided, a region will be selected. diff --git a/specification/resources/registry/multiregistry_create.yml b/specification/resources/registry/multiregistry_create.yml index b771fe33..26527362 100644 --- a/specification/resources/registry/multiregistry_create.yml +++ b/specification/resources/registry/multiregistry_create.yml @@ -1,6 +1,6 @@ operationId: multiregistry_create -summary: Create Named Container Registry (Beta) +summary: Create Container Registry By Name (Beta) description: | To create your container registry, send a POST request to `/v2/registries`. @@ -22,7 +22,7 @@ requestBody: responses: '201': - $ref: 'responses/registry_info.yml' + $ref: 'responses/multiregistry_info.yml' '401': $ref: '../../shared/responses/unauthorized.yml' diff --git a/specification/resources/registry/responses/multiregistry_info.yml b/specification/resources/registry/responses/multiregistry_info.yml new file mode 100644 index 00000000..a2bba4c0 --- /dev/null +++ b/specification/resources/registry/responses/multiregistry_info.yml @@ -0,0 +1,17 @@ +description: The response will be a JSON object with the key `registry` + containing information about your registry. + +headers: + ratelimit-limit: + $ref: '../../../shared/headers.yml#/ratelimit-limit' + ratelimit-remaining: + $ref: '../../../shared/headers.yml#/ratelimit-remaining' + ratelimit-reset: + $ref: '../../../shared/headers.yml#/ratelimit-reset' + +content: + application/json: + schema: + properties: + registry: + $ref: '../models/multiregistry.yml' From 41c1cafb312c2b382610e599a225c6f4341b9daa Mon Sep 17 00:00:00 2001 From: Nayan Das Date: Thu, 14 Nov 2024 12:33:21 +0000 Subject: [PATCH 08/15] Update curl --- .../resources/registry/examples/curl/multiregistry_get.yml | 6 ++++++ specification/resources/registry/multiregistry_get.yml | 6 +++--- 2 files changed, 9 insertions(+), 3 deletions(-) create mode 100644 specification/resources/registry/examples/curl/multiregistry_get.yml diff --git a/specification/resources/registry/examples/curl/multiregistry_get.yml b/specification/resources/registry/examples/curl/multiregistry_get.yml new file mode 100644 index 00000000..d89e3841 --- /dev/null +++ b/specification/resources/registry/examples/curl/multiregistry_get.yml @@ -0,0 +1,6 @@ +lang: cURL +source: |- + curl -X GET \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \ + "https://api.digitalocean.com/v2/registries" diff --git a/specification/resources/registry/multiregistry_get.yml b/specification/resources/registry/multiregistry_get.yml index 455fdf30..a32b1b57 100644 --- a/specification/resources/registry/multiregistry_get.yml +++ b/specification/resources/registry/multiregistry_get.yml @@ -1,6 +1,6 @@ operationId: multiregistry_get -summary: Get Named Container Registry (Beta) +summary: Get Container Registry By Name (Beta) description: To get information about any container registry in your account, send a GET request to `/v2/registries/{registry_name}`. @@ -10,7 +10,7 @@ tags: responses: '200': - $ref: 'responses/registry_info.yml' + $ref: 'responses/multiregistry_info.yml' '401': $ref: '../../shared/responses/unauthorized.yml' @@ -25,7 +25,7 @@ responses: $ref: '../../shared/responses/unexpected_error.yml' x-codeSamples: - - $ref: 'examples/curl/registry_get.yml' + - $ref: 'examples/curl/multiregistry_get.yml' # - $ref: 'examples/python/registry_get.yml' security: From df4b5dc9b145b09868c36960ca0b00f9167fdbfb Mon Sep 17 00:00:00 2001 From: Nayan Das Date: Thu, 14 Nov 2024 12:40:09 +0000 Subject: [PATCH 09/15] Update multiregistry get all --- .../registry/examples/curl/multiregistry_get_all.yml | 6 ++++++ specification/resources/registry/multiregistry_get_all.yml | 4 ++-- .../resources/registry/responses/all_registries_info.yml | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) create mode 100644 specification/resources/registry/examples/curl/multiregistry_get_all.yml diff --git a/specification/resources/registry/examples/curl/multiregistry_get_all.yml b/specification/resources/registry/examples/curl/multiregistry_get_all.yml new file mode 100644 index 00000000..d89e3841 --- /dev/null +++ b/specification/resources/registry/examples/curl/multiregistry_get_all.yml @@ -0,0 +1,6 @@ +lang: cURL +source: |- + curl -X GET \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \ + "https://api.digitalocean.com/v2/registries" diff --git a/specification/resources/registry/multiregistry_get_all.yml b/specification/resources/registry/multiregistry_get_all.yml index 9dde4e13..a60758e7 100644 --- a/specification/resources/registry/multiregistry_get_all.yml +++ b/specification/resources/registry/multiregistry_get_all.yml @@ -25,8 +25,8 @@ responses: $ref: '../../shared/responses/unexpected_error.yml' x-codeSamples: - - $ref: 'examples/curl/registry_get.yml' - - $ref: 'examples/python/registry_get.yml' + - $ref: 'examples/curl/multiregistry_get_all.yml' + # - $ref: 'examples/python/registry_get.yml' security: - bearer_auth: diff --git a/specification/resources/registry/responses/all_registries_info.yml b/specification/resources/registry/responses/all_registries_info.yml index c76dd2bf..27b1923c 100644 --- a/specification/resources/registry/responses/all_registries_info.yml +++ b/specification/resources/registry/responses/all_registries_info.yml @@ -13,7 +13,7 @@ content: application/json: schema: properties: - registry: + registries: type: array items: oneOf: From dea998490948f4410e74eef580303e62b343811b Mon Sep 17 00:00:00 2001 From: Nayan Das Date: Thu, 14 Nov 2024 12:59:40 +0000 Subject: [PATCH 10/15] Update docker credentials --- .../examples/curl/multiregistry_get_dockerCredentials.yml | 6 ++++++ .../registry/multiregistry_get_dockerCredentials.yml | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 specification/resources/registry/examples/curl/multiregistry_get_dockerCredentials.yml diff --git a/specification/resources/registry/examples/curl/multiregistry_get_dockerCredentials.yml b/specification/resources/registry/examples/curl/multiregistry_get_dockerCredentials.yml new file mode 100644 index 00000000..53767ec8 --- /dev/null +++ b/specification/resources/registry/examples/curl/multiregistry_get_dockerCredentials.yml @@ -0,0 +1,6 @@ +lang: cURL +source: |- + curl -X GET \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \ + "https://api.digitalocean.com/v2/registries/example/docker-credentials" diff --git a/specification/resources/registry/multiregistry_get_dockerCredentials.yml b/specification/resources/registry/multiregistry_get_dockerCredentials.yml index 15e73f8b..a5f84a1b 100644 --- a/specification/resources/registry/multiregistry_get_dockerCredentials.yml +++ b/specification/resources/registry/multiregistry_get_dockerCredentials.yml @@ -6,7 +6,7 @@ description: | In order to access your container registry with the Docker client or from a Kubernetes cluster, you will need to configure authentication. The necessary JSON configuration can be retrieved by sending a GET request to - `/v2/registries/docker-credentials/{registry_name}`. + `/v2/registries/{registry_name}/docker-credentials`. The response will be in the format of a Docker `config.json` file. To use the config in your Kubernetes cluster, create a Secret with: @@ -50,7 +50,7 @@ responses: $ref: '../../shared/responses/unexpected_error.yml' x-codeSamples: - - $ref: 'examples/curl/registry_get_dockerCredentials.yml' + - $ref: 'examples/curl/multiregistry_get_dockerCredentials.yml' - $ref: 'examples/python/registry_get_dockerCredentials.yml' security: From 7785fe298d13d07fe97155fe7cfddab2a2d33aa0 Mon Sep 17 00:00:00 2001 From: Nayan Das Date: Thu, 14 Nov 2024 13:30:37 +0000 Subject: [PATCH 11/15] Add path parameter --- specification/DigitalOcean-public.v2.yaml | 16 ++++++++++++++++ .../examples/curl/multiregistry_delete.yml | 6 ++++++ .../resources/registry/multiregistry_delete.yml | 2 +- 3 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 specification/resources/registry/examples/curl/multiregistry_delete.yml diff --git a/specification/DigitalOcean-public.v2.yaml b/specification/DigitalOcean-public.v2.yaml index 82872c98..c398c9e2 100644 --- a/specification/DigitalOcean-public.v2.yaml +++ b/specification/DigitalOcean-public.v2.yaml @@ -1491,6 +1491,14 @@ paths: $ref: 'resources/registry/multiregistry_get_all.yml' /v2/registries/{registry_name}: + parameters: + - name: registry_name + in: path + required: true + description: The name of the registry + schema: + type: string + get: $ref: 'resources/registry/multiregistry_get.yml' @@ -1501,6 +1509,14 @@ paths: $ref: 'resources/registry/multiregistry_delete.yml' /v2/registries/{registry_name}/docker-credentials: + parameters: + - name: registry_name + in: path + required: true + description: The name of the registry + schema: + type: string + get: $ref: 'resources/registry/multiregistry_get_dockerCredentials.yml' diff --git a/specification/resources/registry/examples/curl/multiregistry_delete.yml b/specification/resources/registry/examples/curl/multiregistry_delete.yml new file mode 100644 index 00000000..11348af1 --- /dev/null +++ b/specification/resources/registry/examples/curl/multiregistry_delete.yml @@ -0,0 +1,6 @@ +lang: cURL +source: |- + curl -X DELETE \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \ + "https://api.digitalocean.com/v2/registries/example" diff --git a/specification/resources/registry/multiregistry_delete.yml b/specification/resources/registry/multiregistry_delete.yml index 74db3be5..a819cc91 100644 --- a/specification/resources/registry/multiregistry_delete.yml +++ b/specification/resources/registry/multiregistry_delete.yml @@ -28,7 +28,7 @@ responses: $ref: '../../shared/responses/unexpected_error.yml' x-codeSamples: - - $ref: 'examples/curl/registry_delete.yml' + - $ref: 'examples/curl/multiregistry_delete.yml' # - $ref: 'examples/python/registry_delete.yml' security: From aa27aa2a07c4cdbb046e9fe9899107882242aae8 Mon Sep 17 00:00:00 2001 From: Nayan Das Date: Thu, 14 Nov 2024 14:45:20 +0000 Subject: [PATCH 12/15] Add parameters --- package.json | 2 +- specification/DigitalOcean-public.v2.yaml | 18 +----------------- .../registry/multiregistry_create.yml | 3 +++ .../registry/multiregistry_delete.yml | 3 +++ .../resources/registry/multiregistry_get.yml | 3 +++ .../registry/multiregistry_get_all.yml | 3 +++ .../multiregistry_get_dockerCredentials.yml | 3 +-- .../resources/registry/parameters.yml | 2 +- 8 files changed, 16 insertions(+), 21 deletions(-) diff --git a/package.json b/package.json index 8d260254..1d5d9da5 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ }, "scripts": { "test": "make test", - "lint": "spectral lint", + "lint": "spectral lint --debug", "bundle": "openapi bundle", "collection": "openapi2postmanv2", "autorest": " autorest", diff --git a/specification/DigitalOcean-public.v2.yaml b/specification/DigitalOcean-public.v2.yaml index c398c9e2..177910d8 100644 --- a/specification/DigitalOcean-public.v2.yaml +++ b/specification/DigitalOcean-public.v2.yaml @@ -1491,17 +1491,9 @@ paths: $ref: 'resources/registry/multiregistry_get_all.yml' /v2/registries/{registry_name}: - parameters: - - name: registry_name - in: path - required: true - description: The name of the registry - schema: - type: string - get: $ref: 'resources/registry/multiregistry_get.yml' - + post: $ref: 'resources/registry/multiregistry_create.yml' @@ -1509,14 +1501,6 @@ paths: $ref: 'resources/registry/multiregistry_delete.yml' /v2/registries/{registry_name}/docker-credentials: - parameters: - - name: registry_name - in: path - required: true - description: The name of the registry - schema: - type: string - get: $ref: 'resources/registry/multiregistry_get_dockerCredentials.yml' diff --git a/specification/resources/registry/multiregistry_create.yml b/specification/resources/registry/multiregistry_create.yml index 26527362..d831cf4d 100644 --- a/specification/resources/registry/multiregistry_create.yml +++ b/specification/resources/registry/multiregistry_create.yml @@ -12,6 +12,9 @@ description: | tags: - Container Registry +parameters: + - $ref: 'parameters.yml#/registry_name' + requestBody: required: true diff --git a/specification/resources/registry/multiregistry_delete.yml b/specification/resources/registry/multiregistry_delete.yml index a819cc91..b2042061 100644 --- a/specification/resources/registry/multiregistry_delete.yml +++ b/specification/resources/registry/multiregistry_delete.yml @@ -8,6 +8,9 @@ description: To delete your container registry, destroying all container image tags: - Container Registry +parameters: + - $ref: 'parameters.yml#/registry_name' + responses: '204': $ref: '../../shared/responses/no_content.yml' diff --git a/specification/resources/registry/multiregistry_get.yml b/specification/resources/registry/multiregistry_get.yml index a32b1b57..13e02a7e 100644 --- a/specification/resources/registry/multiregistry_get.yml +++ b/specification/resources/registry/multiregistry_get.yml @@ -8,6 +8,9 @@ description: To get information about any container registry in your account, se tags: - Container Registry +parameters: + - $ref: 'parameters.yml#/registry_name' + responses: '200': $ref: 'responses/multiregistry_info.yml' diff --git a/specification/resources/registry/multiregistry_get_all.yml b/specification/resources/registry/multiregistry_get_all.yml index a60758e7..8ffe1e92 100644 --- a/specification/resources/registry/multiregistry_get_all.yml +++ b/specification/resources/registry/multiregistry_get_all.yml @@ -8,6 +8,9 @@ description: To get information about any container registry in your account, se tags: - Container Registry +parameters: + - $ref: 'parameters.yml#/registry_name' + responses: '200': $ref: 'responses/all_registries_info.yml' diff --git a/specification/resources/registry/multiregistry_get_dockerCredentials.yml b/specification/resources/registry/multiregistry_get_dockerCredentials.yml index a5f84a1b..d7b55a14 100644 --- a/specification/resources/registry/multiregistry_get_dockerCredentials.yml +++ b/specification/resources/registry/multiregistry_get_dockerCredentials.yml @@ -30,8 +30,7 @@ tags: - Container Registry parameters: - - $ref: 'parameters.yml#/registry_expiry_seconds' - - $ref: 'parameters.yml#/registry_read_write' + - $ref: 'parameters.yml#/registry_name' responses: '200': diff --git a/specification/resources/registry/parameters.yml b/specification/resources/registry/parameters.yml index 041d3f69..0f1ba211 100644 --- a/specification/resources/registry/parameters.yml +++ b/specification/resources/registry/parameters.yml @@ -85,4 +85,4 @@ token_pagination_page_token: description: Token to retrieve of the next or previous set of results more quickly than using 'page'. schema: type: string - example: eyJUb2tlbiI6IkNnZGpiMjlz \ No newline at end of file + example: eyJUb2tlbiI6IkNnZGpiMjlz From 6d6556f5ee3d541ac27223523c3a8d33f2f9ffee Mon Sep 17 00:00:00 2001 From: Nayan Das Date: Thu, 14 Nov 2024 14:47:30 +0000 Subject: [PATCH 13/15] Fix package.json --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 1d5d9da5..8d260254 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ }, "scripts": { "test": "make test", - "lint": "spectral lint --debug", + "lint": "spectral lint", "bundle": "openapi bundle", "collection": "openapi2postmanv2", "autorest": " autorest", From 754d60d54d9f528e919d91b1a2750334f1a4377f Mon Sep 17 00:00:00 2001 From: Nayan Das Date: Thu, 14 Nov 2024 14:53:12 +0000 Subject: [PATCH 14/15] Undo parameters.yml --- specification/resources/registry/parameters.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/specification/resources/registry/parameters.yml b/specification/resources/registry/parameters.yml index 0f1ba211..041d3f69 100644 --- a/specification/resources/registry/parameters.yml +++ b/specification/resources/registry/parameters.yml @@ -85,4 +85,4 @@ token_pagination_page_token: description: Token to retrieve of the next or previous set of results more quickly than using 'page'. schema: type: string - example: eyJUb2tlbiI6IkNnZGpiMjlz + example: eyJUb2tlbiI6IkNnZGpiMjlz \ No newline at end of file From f1156f64e56a21aaff9d7d5b3dcba6d32e402bcf Mon Sep 17 00:00:00 2001 From: Nayan Das Date: Fri, 15 Nov 2024 06:02:19 +0000 Subject: [PATCH 15/15] Fix linting --- .../resources/registry/multiregistry_create.yml | 3 +++ specification/resources/registry/multiregistry_get.yml | 3 +++ .../resources/registry/multiregistry_get_all.yml | 3 --- .../registry/multiregistry_get_dockerCredentials.yml | 9 ++++++--- 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/specification/resources/registry/multiregistry_create.yml b/specification/resources/registry/multiregistry_create.yml index d831cf4d..ef5ad63a 100644 --- a/specification/resources/registry/multiregistry_create.yml +++ b/specification/resources/registry/multiregistry_create.yml @@ -29,6 +29,9 @@ responses: '401': $ref: '../../shared/responses/unauthorized.yml' + + '404': + $ref: '../../shared/responses/not_found.yml' '429': $ref: '../../shared/responses/too_many_requests.yml' diff --git a/specification/resources/registry/multiregistry_get.yml b/specification/resources/registry/multiregistry_get.yml index 13e02a7e..e98b0480 100644 --- a/specification/resources/registry/multiregistry_get.yml +++ b/specification/resources/registry/multiregistry_get.yml @@ -18,6 +18,9 @@ responses: '401': $ref: '../../shared/responses/unauthorized.yml' + '404': + $ref: '../../shared/responses/not_found.yml' + '429': $ref: '../../shared/responses/too_many_requests.yml' diff --git a/specification/resources/registry/multiregistry_get_all.yml b/specification/resources/registry/multiregistry_get_all.yml index 8ffe1e92..a60758e7 100644 --- a/specification/resources/registry/multiregistry_get_all.yml +++ b/specification/resources/registry/multiregistry_get_all.yml @@ -8,9 +8,6 @@ description: To get information about any container registry in your account, se tags: - Container Registry -parameters: - - $ref: 'parameters.yml#/registry_name' - responses: '200': $ref: 'responses/all_registries_info.yml' diff --git a/specification/resources/registry/multiregistry_get_dockerCredentials.yml b/specification/resources/registry/multiregistry_get_dockerCredentials.yml index d7b55a14..641b4387 100644 --- a/specification/resources/registry/multiregistry_get_dockerCredentials.yml +++ b/specification/resources/registry/multiregistry_get_dockerCredentials.yml @@ -19,11 +19,11 @@ description: | and cannot be used to push images. This is appropriate for most Kubernetes clusters. To retrieve read/write credentials, suitable for use with the Docker client or in a CI system, read_write may be provided as query parameter. For - example: `/v2/registries/docker-credentials/{registry_name}?read_write=true` + example: `/v2/registries/{registry_name}/docker-credentials?read_write=true` By default, the returned credentials will not expire. To retrieve credentials with an expiry set, expiry_seconds may be provided as a query parameter. For - example: `/v2/registry/docker-credentials/{registry_name}?expiry_seconds=3600` will return + example: `/v2/registries/{registry_name}/docker-credentials?expiry_seconds=3600` will return credentials that expire after one hour. tags: @@ -35,7 +35,10 @@ parameters: responses: '200': $ref: 'responses/docker_credentials.yml' - + + '404': + $ref: '../../shared/responses/not_found.yml' + '401': $ref: '../../shared/responses/unauthorized.yml'