-
Notifications
You must be signed in to change notification settings - Fork 7
/
Get.go
47 lines (42 loc) · 1.43 KB
/
Get.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
38
39
40
41
42
43
44
45
46
47
package domains
import (
"fmt"
"github.com/opentelekomcloud/gophertelekomcloud"
"github.com/opentelekomcloud/gophertelekomcloud/internal/extract"
)
func Get(client *golangsdk.ServiceClient, opts GetOpts) (*AccessDomain, error) {
// GET /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)
raw, err := client.Get(url, nil, nil)
if err != nil {
return nil, err
}
var res AccessDomain
err = extract.Into(raw.Body, &res)
return &res, err
}
type AccessDomain struct {
Exist bool `json:"exist"`
// Organization name.
Namespace string `json:"namespace"`
// Image repository name.
Repository string `json:"repository"`
// Name of the account used for image sharing
AccessDomain string `json:"access_domain"`
// Permission
Permit string `json:"permit"`
// Expiration time.
Deadline string `json:"deadline"`
// Description
Description string `json:"description"`
// Creator ID.
CreatorID string `json:"creator_id"`
// Name of the creator.
CreatorName string `json:"creator_name"`
// Time when an image is created. It is the UTC standard time.
Created string `json:"created"`
// Time when an image is updated. It is the UTC standard time.
Updated string `json:"updated"`
// Status. `true`: valid `false`: expired
Status bool `json:"status"`
}