@@ -26,9 +26,9 @@ func (c Client) Registries(ctx context.Context, orgID string) ([]Registry, error
26
26
}
27
27
28
28
// RegistryByID fetches a registry resource by its ID.
29
- func (c Client ) RegistryByID (ctx context.Context , orgID , registryID string ) (* Registry , error ) {
29
+ func (c Client ) RegistryByID (ctx context.Context , registryID string ) (* Registry , error ) {
30
30
var r Registry
31
- if err := c .requestBody (ctx , http .MethodGet , "/api/private/orgs/" + orgID + "/ registries/"+ registryID , nil , & r ); err != nil {
31
+ if err := c .requestBody (ctx , http .MethodGet , "/api/private/registries/" + registryID , nil , & r ); err != nil {
32
32
return nil , err
33
33
}
34
34
return & r , nil
@@ -43,11 +43,28 @@ type UpdateRegistryReq struct {
43
43
}
44
44
45
45
// UpdateRegistry applies a partial update to a registry resource.
46
- func (c Client ) UpdateRegistry (ctx context.Context , orgID , registryID string , req UpdateRegistryReq ) error {
47
- return c .requestBody (ctx , http .MethodPatch , "/api/private/orgs/" + orgID + "/ registries/"+ registryID , req , nil )
46
+ func (c Client ) UpdateRegistry (ctx context.Context , registryID string , req UpdateRegistryReq ) error {
47
+ return c .requestBody (ctx , http .MethodPatch , "/api/private/registries/" + registryID , req , nil )
48
48
}
49
49
50
50
// DeleteRegistry deletes a registry resource by its ID.
51
- func (c Client ) DeleteRegistry (ctx context.Context , orgID , registryID string ) error {
52
- return c .requestBody (ctx , http .MethodDelete , "/api/private/orgs/" + orgID + "/registries/" + registryID , nil , nil )
51
+ func (c Client ) DeleteRegistry (ctx context.Context , registryID string ) error {
52
+ return c .requestBody (ctx , http .MethodDelete , "/api/private/registries/" + registryID , nil , nil )
53
+ }
54
+
55
+ // CreateRegistryReq defines the request parameters for creating a new registry resource.
56
+ type CreateRegistryReq struct {
57
+ FriendlyName string `json:"friendly_name"`
58
+ Registry string `json:"registry"`
59
+ Username string `json:"username"`
60
+ Password string `json:"password"`
61
+ }
62
+
63
+ // CreateRegistry creates a new registry resource in an organization.
64
+ func (c Client ) CreateRegistry (ctx context.Context , orgID string , req CreateRegistryReq ) (* Registry , error ) {
65
+ var r Registry
66
+ if err := c .requestBody (ctx , http .MethodPost , "/api/private/orgs/" + orgID + "/registries" , req , & r ); err != nil {
67
+ return nil , err
68
+ }
69
+ return & r , nil
53
70
}
0 commit comments