-
Notifications
You must be signed in to change notification settings - Fork 7
/
Update.go
37 lines (32 loc) · 1.25 KB
/
Update.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package domains
import (
"fmt"
"github.com/opentelekomcloud/gophertelekomcloud"
"github.com/opentelekomcloud/gophertelekomcloud/internal/build"
)
type UpdateOpts struct {
// Organization name
Namespace string `json:"-" required:"true"`
// Image repository name
Repository string `json:"-" required:"true"`
// Name of the account used for image sharing
AccessDomain string `json:"-" required:"true"`
// Currently, only the read permission is supported.
Permit string `json:"permit"`
// Valid until (UTC). If the sharing is permanent, the value is forever. Otherwise, the sharing is valid until 00:00:00 of the next day.
Deadline string `json:"deadline"`
// Description. This parameter is left blank by default.
Description string `json:"description,omitempty"`
}
func Update(client *golangsdk.ServiceClient, opts UpdateOpts) (err error) {
b, err := build.RequestBody(opts, "")
if err != nil {
return
}
// PATCH /v2/manage/namespaces/{namespace}/repositories/{repository}/access-domains/{access_domain}
url := fmt.Sprintf("%s/%s", client.ServiceURL("manage", "namespaces", opts.Namespace, "repos", opts.Repository, "access-domains"), opts.AccessDomain)
_, err = client.Patch(url, b, nil, &golangsdk.RequestOpts{
OkCodes: []int{201},
})
return
}