github.com/opentelekomcloud/gophertelekomcloud@v0.9.3/openstack/csbs/v1/policies/Get.go (about)

     1  package policies
     2  
     3  import (
     4  	"github.com/opentelekomcloud/gophertelekomcloud"
     5  	"github.com/opentelekomcloud/gophertelekomcloud/internal/extract"
     6  	"github.com/opentelekomcloud/gophertelekomcloud/openstack"
     7  )
     8  
     9  // Get will get a single backup policy with specific ID. call the Extract method on the GetResult.
    10  func Get(client *golangsdk.ServiceClient, policyId string) (*BackupPolicy, error) {
    11  	// GET https://{endpoint}/v1/{project_id}/policies/{policy_id}
    12  	raw, err := client.Get(client.ServiceURL("policies", policyId), nil, openstack.StdRequestOpts())
    13  
    14  	if err != nil {
    15  		return nil, err
    16  	}
    17  
    18  	var res BackupPolicy
    19  	err = extract.IntoStructPtr(raw.Body, &res, "policy")
    20  	return &res, err
    21  }