github.com/opentelekomcloud/gophertelekomcloud@v0.9.3/openstack/dcaas/v2/dc-endpoint-group/List.go (about)

     1  package dc_endpoint_group
     2  
     3  import (
     4  	"fmt"
     5  
     6  	golangsdk "github.com/opentelekomcloud/gophertelekomcloud"
     7  	"github.com/opentelekomcloud/gophertelekomcloud/internal/extract"
     8  	"github.com/opentelekomcloud/gophertelekomcloud/openstack"
     9  )
    10  
    11  type DCEndpointGroup struct {
    12  	// Specifies the project ID.
    13  	TenantId string `json:"tenant_id"`
    14  	// Specifies the ID of the Direct Connect endpoint group.
    15  	ID string `json:"id"`
    16  	// Specifies the name of the Direct Connect endpoint group.
    17  	Name string `json:"name"`
    18  	// Provides supplementary information about the Direct Connect endpoint group.
    19  	Description string `json:"description"`
    20  	// Specifies the list of the endpoints in a Direct Connect endpoint group.
    21  	Endpoints []string `json:"endpoints"`
    22  	// Specifies the type of the Direct Connect endpoints. The value can only be cidr.
    23  	Type string `json:"type"`
    24  }
    25  
    26  type ListOpts struct {
    27  	ID string `q:"id"`
    28  }
    29  
    30  // List is used to obtain the DirectConnects list
    31  func List(c *golangsdk.ServiceClient, id string) ([]DCEndpointGroup, error) {
    32  
    33  	// GET https://{Endpoint}/v2.0/dcaas/dc-endpoint-groups?id={id}
    34  	raw, err := c.Get(c.ServiceURL(fmt.Sprintf("dcaas/dc-endpoint-groups?id=%s", id)), nil, openstack.StdRequestOpts())
    35  	if err != nil {
    36  		return nil, err
    37  	}
    38  
    39  	var res []DCEndpointGroup
    40  	err = extract.IntoSlicePtr(raw.Body, &res, "dc_endpoint_groups")
    41  	return res, err
    42  }