Skip to content

Commit 8e1310c

Browse files
nayanjd-doNayanJD
andauthored
Add POST body for registry start GC (#1028)
* Add POST body for /v2/registry/<registry name/garbage-collection * Update permission to run garbage collection * Fix curl and python code snippet --------- Co-authored-by: Nayan Das <dastms@gmail.com>
1 parent dac3f9c commit 8e1310c

4 files changed

Lines changed: 27 additions & 2 deletions

File tree

specification/resources/registry/examples/curl/registry_run_garbageCollection.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@ source: |-
33
curl -X POST \
44
-H "Content-Type: application/json" \
55
-H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \
6+
-d '{ "type": "unreferenced blobs only"}' \
67
"https://api.digitalocean.com/v2/registry/example/garbage-collection"

specification/resources/registry/examples/python/registry_run_garbageCollection.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,10 @@ source: |-
44
from pydo import Client
55
66
client = Client(token=os.environ.get("DIGITALOCEAN_TOKEN"))
7+
8+
req = {
9+
"type": "unreferenced blobs only"
10+
11+
}
712
8-
resp = client.registry.run_garbage_collection(registry_name="example")
13+
resp = client.registry.run_garbage_collection(registry_name="example",body=req)
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
type: object
2+
3+
properties:
4+
type:
5+
type: string
6+
enum:
7+
- untagged manifests only
8+
- unreferenced blobs only
9+
- untagged manifests and unreferenced blobs
10+
example: unreferenced blobs only
11+
description: Type of the garbage collection to run against this registry

specification/resources/registry/registry_run_garbageCollection.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,14 @@ description: |
2828
tags:
2929
- Container Registry
3030

31+
requestBody:
32+
required: false
33+
34+
content:
35+
application/json:
36+
schema:
37+
$ref: 'models/registry_run_gc.yml'
38+
3139
parameters:
3240
- $ref: 'parameters.yml#/registry_name'
3341

@@ -56,4 +64,4 @@ x-codeSamples:
5664

5765
security:
5866
- bearer_auth:
59-
- 'registry:create'
67+
- 'registry:update'

0 commit comments

Comments
 (0)