github.com/opentelekomcloud/gophertelekomcloud@v0.9.3/openstack/swr/v2/domains/Get.go (about)

     1  package domains
     2  
     3  import (
     4  	"fmt"
     5  
     6  	"github.com/opentelekomcloud/gophertelekomcloud"
     7  	"github.com/opentelekomcloud/gophertelekomcloud/internal/extract"
     8  )
     9  
    10  func Get(client *golangsdk.ServiceClient, opts GetOpts) (*AccessDomain, error) {
    11  	// GET /v2/manage/namespaces/{namespace}/repositories/{repository}/access-domains/{access_domain}
    12  	url := fmt.Sprintf("%s/%s", client.ServiceURL("manage", "namespaces", opts.Namespace, "repos", opts.Repository, "access-domains"), opts.AccessDomain)
    13  	raw, err := client.Get(url, nil, nil)
    14  	if err != nil {
    15  		return nil, err
    16  	}
    17  
    18  	var res AccessDomain
    19  	err = extract.Into(raw.Body, &res)
    20  	return &res, err
    21  }
    22  
    23  type AccessDomain struct {
    24  	Exist bool `json:"exist"`
    25  	// Organization name.
    26  	Namespace string `json:"namespace"`
    27  	// Image repository name.
    28  	Repository string `json:"repository"`
    29  	// Name of the account used for image sharing
    30  	AccessDomain string `json:"access_domain"`
    31  	// Permission
    32  	Permit string `json:"permit"`
    33  	// Expiration time.
    34  	Deadline string `json:"deadline"`
    35  	// Description
    36  	Description string `json:"description"`
    37  	// Creator ID.
    38  	CreatorID string `json:"creator_id"`
    39  	// Name of the creator.
    40  	CreatorName string `json:"creator_name"`
    41  	// Time when an image is created. It is the UTC standard time.
    42  	Created string `json:"created"`
    43  	// Time when an image is updated. It is the UTC standard time.
    44  	Updated string `json:"updated"`
    45  	// Status. `true`: valid `false`: expired
    46  	Status bool `json:"status"`
    47  }