github.com/opentelekomcloud/gophertelekomcloud@v0.9.3/openstack/apigw/v2/key/ListAPIBoundKeys.go (about)

     1  package key
     2  
     3  import (
     4  	golangsdk "github.com/opentelekomcloud/gophertelekomcloud"
     5  	"github.com/opentelekomcloud/gophertelekomcloud/pagination"
     6  )
     7  
     8  type ListBoundOpts struct {
     9  	GatewayID string `json:"-"`
    10  	ApiID     string `q:"api_id"`
    11  	SignID    string `q:"sign_id"`
    12  	EnvID     string `q:"env_id"`
    13  	ApiName   string `q:"api_name"`
    14  	GroupID   string `q:"group_id"`
    15  }
    16  
    17  // ListAPIBoundKeys This func basically copies ListBoundKeys without signature info
    18  // I guess the intended way was to return []ApiForSign here but something went wrong along the way
    19  func ListAPIBoundKeys(client *golangsdk.ServiceClient, opts ListBoundOpts) ([]BindSignResp, error) {
    20  	q, err := golangsdk.BuildQueryString(&opts)
    21  	if err != nil {
    22  		return nil, err
    23  	}
    24  	pages, err := pagination.Pager{
    25  		Client: client,
    26  		InitialURL: client.ServiceURL("apigw", "instances", opts.GatewayID, "sign-bindings",
    27  			"binded-apis") + q.String(),
    28  		CreatePage: func(r pagination.NewPageResult) pagination.NewPage {
    29  			return BindingPage{NewSinglePageBase: pagination.NewSinglePageBase{NewPageResult: r}}
    30  		},
    31  	}.NewAllPages()
    32  
    33  	if err != nil {
    34  		return nil, err
    35  	}
    36  	return ExtractBindings(pages)
    37  }