Skip to content

Commit 10606e9

Browse files
stevsmitSteven Smith
andauthored
Adds repo API endpoints (quay#1203)
Co-authored-by: Steven Smith <[email protected]>
1 parent 4936443 commit 10606e9

File tree

4 files changed

+130
-4
lines changed

4 files changed

+130
-4
lines changed

api/master.adoc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,10 @@ include::modules/creating-org-policy-api.adoc[leveloffset=+3]
9797
include::modules/creating-policy-api-current-user.adoc[leveloffset=+3]
9898
include::modules/creating-repository-policy-api.adoc[leveloffset=+3]
9999
include::modules/creating-policy-api-other-user.adoc[leveloffset=+3]
100+
//repo
101+
include::modules/repo-manage-api.adoc[leveloffset=+2]
102+
103+
100104
101105
// team member management?
102106
include::modules/managing-team-members-api.adoc[leveloffset=+3]

modules/adding-a-new-tag-to-image-api.adoc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ You can add a new tag, or restore an old one, to an image by using the API.
66

77
.Prerequisites
88

9-
* You have link:https://access.redhat.com/documentation/en-us/red_hat_quay/3/html-single/red_hat_quay_api_guide/index#creating-oauth-access-token[Created an OAuth access token].
9+
* You have link:https://access.redhat.com/documentation/en-us/red_hat_quay/{producty}/html-single/red_hat_quay_api_guide/index#creating-oauth-access-token[Created an OAuth access token].
1010
* You have set `BROWSER_API_CALLS_XHR_ONLY: false` in your `config.yaml` file.
1111
1212
.Procedure
1313

14-
. You can change which image a tag points to or create a new tag by using the link:https://docs.redhat.com/en/documentation/red_hat_quay/3/html-single/red_hat_quay_api_guide/index#changetag[`PUT /api/v1/repository/{repository}/tag/{tag}`] command:
14+
. You can change which image a tag points to or create a new tag by using the link:https://docs.redhat.com/en/documentation/red_hat_quay/{producty}/html-single/red_hat_quay_api_guide/index#changetag[`PUT /api/v1/repository/{repository}/tag/{tag}`] command:
1515
+
1616
[source,terminal]
1717
----
@@ -31,7 +31,7 @@ $ curl -X PUT \
3131
"Updated"
3232
----
3333

34-
. You can restore a repository tag to its previous image by using the link:https://docs.redhat.com/en/documentation/red_hat_quay/3/html-single/red_hat_quay_api_guide/index#restoretag[`POST /api/v1/repository/{repository}/tag/{tag}/restore`] command. For example:
34+
. You can restore a repository tag to its previous image by using the link:https://docs.redhat.com/en/documentation/red_hat_quay/{producty}/html-single/red_hat_quay_api_guide/index#restoretag[`POST /api/v1/repository/{repository}/tag/{tag}/restore`] command. For example:
3535
+
3636
[source,terminal]
3737
----

modules/repo-manage-api.adoc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[id="repo-manage-api"]
2+
= Creating and configuring repositories by using the {productname} API
3+
4+
Repositories can be created, retrieved, changed, and deleted by using the {productname} API.

modules/repo-policy-api.adoc

Lines changed: 119 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,122 @@
11
[id="policy-api"]
22
= Managing auto-prune policies by using the {productname} API
33

4-
Auto-prune policies can be created, retrieved, changed, and delete for organizations, repositories, and users by using the {productname} API.
4+
Auto-prune policies can be created, retrieved, changed, and delete for organizations, repositories, and users by using the {productname} API.
5+
6+
.Procedure
7+
8+
. Enter the following command to create a repository using the link:https://docs.redhat.com/en/documentation/red_hat_quay/{producty}/html-single/red_hat_quay_api_guide/index#createrepo[`POST /api/v1/repository`] endpoint:
9+
+
10+
[source,terminal]
11+
----
12+
$ curl -X POST \
13+
-H "Authorization: Bearer <bearer_token>" \
14+
-H "Content-Type: application/json" \
15+
-d '{
16+
"repository": "<new_repository_name>",
17+
"visibility": "<private>",
18+
"description": "<This is a description of the new repository>."
19+
}' \
20+
"https://quay-server.example.com/api/v1/repository"
21+
----
22+
+
23+
.Example output
24+
+
25+
[source,terminal]
26+
----
27+
{"namespace": "quayadmin", "name": "<new_repository_name>", "kind": "image"}
28+
----
29+
30+
. You can list a repositories with the link:https://docs.redhat.com/en/documentation/red_hat_quay/3/html-single/red_hat_quay_api_guide/index#listrepos[`GET /api/v1/repository`] endpoint. For example:
31+
+
32+
[source,terminal]
33+
----
34+
$ curl -X GET \
35+
-H "Authorization: Bearer <ACCESS_TOKEN>" \
36+
"https://quay-server.example.com/api/v1/repository?public=true&starred=false&namespace=<NAMESPACE>"
37+
----
38+
+
39+
.Example output
40+
+
41+
[source,terminal]
42+
----
43+
{"repositories": [{"namespace": "quayadmin", "name": "busybox", "description": null, "is_public": false, "kind": "image", "state": "MIRROR", "is_starred": false, "quota_report": {"quota_bytes": 2280675, "configured_quota": 2199023255552}}]}
44+
----
45+
46+
. Visibility can be changed from public to private with the link:https://docs.redhat.com/en/documentation/red_hat_quay/3/html-single/red_hat_quay_api_guide/index#changerepovisibility[`POST /api/v1/repository/{repository}/changevisibility`] endpoint:
47+
+
48+
[source,terminal]
49+
----
50+
$ curl -X POST \
51+
-H "Authorization: Bearer <ACCESS_TOKEN>" \
52+
-H "Content-Type: application/json" \
53+
-d '{
54+
"visibility": "private"
55+
}' \
56+
"https://quay-server.example.com/api/v1/repository/<NAMESPACE>/<REPO_NAME>/changevisibility"
57+
----
58+
.Example output
59+
+
60+
[source,terminal]
61+
----
62+
{"success": true}
63+
----
64+
65+
. You can check the {productname} UI, or you can enter the following link:https://docs.redhat.com/en/documentation/red_hat_quay/3/html-single/red_hat_quay_api_guide/index#getrepo[`GET /api/v1/repository/{repository}`] command to return details about a repository:
66+
+
67+
[source,terminal]
68+
----
69+
$ curl -X GET -H "Authorization: Bearer <bearer_token>" "<quay-server.example.com>/api/v1/repository/<namespace>/<repository_name>"
70+
----
71+
+
72+
Example output
73+
+
74+
[source,terminal]
75+
----
76+
{"detail": "Not Found", "error_message": "Not Found", "error_type": "not_found", "title": "not_found", "type": "http://quay-server.example.com/api/v1/error/not_found", "status": 404}
77+
----
78+
79+
. Repository descriptions can be updated with the link:https://docs.redhat.com/en/documentation/red_hat_quay/3/html-single/red_hat_quay_api_guide/index#updaterepo[`PUT /api/v1/repository/{repository}`] endpoint:
80+
+
81+
[source,terminal]
82+
----
83+
$ curl -X PUT \
84+
-H "Authorization: Bearer <bearer_token>" \
85+
-H "Content-Type: application/json" \
86+
-d '{
87+
"description": "This is an updated description for the repository."
88+
}' \
89+
"https://quay-server.example.com/api/v1/repository/<NAMESPACE>/<REPOSITORY>"
90+
----
91+
+
92+
.Example output
93+
+
94+
[source,terminal]
95+
----
96+
{"success": true}
97+
----
98+
99+
. Enter the following command to delete a repository using the link:https://docs.redhat.com/en/documentation/red_hat_quay/3/html-single/red_hat_quay_api_guide/index#deleterepository[`DELETE /api/v1/repository/{repository}`] endpoint:
100+
+
101+
[source,terminal]
102+
----
103+
$ curl -X DELETE -H "Authorization: Bearer <bearer_token>" "<quay-server.example.com>/api/v1/repository/<namespace>/<repository_name>"
104+
----
105+
+
106+
This command does not return output in the CLI.
107+
108+
////
109+
. The link:https://docs.redhat.com/en/documentation/red_hat_quay/3/html-single/red_hat_quay_api_guide/index#changerepostate[`PUT /api/v1/repository/{repository}/changestate`] API endpoint can be used to change the state of the repository:
110+
+
111+
[source,terminal]
112+
----
113+
114+
----
115+
+
116+
.Example output
117+
+
118+
[source,terminal]
119+
----
120+
121+
----
122+
////

0 commit comments

Comments
 (0)