github.com/opentelekomcloud/gophertelekomcloud@v0.9.3/openstack/swr/v2/domains/Create.go (about) 1 package domains 2 3 import ( 4 "github.com/opentelekomcloud/gophertelekomcloud" 5 "github.com/opentelekomcloud/gophertelekomcloud/internal/build" 6 ) 7 8 type CreateOpts struct { 9 // Organization name 10 Namespace string `json:"-" required:"true"` 11 // Image repository name 12 Repository string `json:"-" required:"true"` 13 // Name of the account used for image sharing. 14 AccessDomain string `json:"access_domain"` 15 // Currently, only the read permission is supported. 16 Permit string `json:"permit"` 17 // 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. 18 Deadline string `json:"deadline"` 19 // Description 20 Description string `json:"description"` 21 } 22 23 func Create(client *golangsdk.ServiceClient, opts CreateOpts) (err error) { 24 b, err := build.RequestBody(opts, "") 25 if err != nil { 26 return 27 } 28 29 // POST /v2/manage/namespaces/{namespace}/repositories/{repository}/access-domains 30 url := client.ServiceURL("manage", "namespaces", opts.Namespace, "repos", opts.Repository, "access-domains") 31 _, err = client.Post(url, b, nil, nil) 32 return 33 }