github.com/opentelekomcloud/gophertelekomcloud@v0.9.3/openstack/gaussdb/v3/ListConfigurations.go (about)

     1  package v3
     2  
     3  import (
     4  	golangsdk "github.com/opentelekomcloud/gophertelekomcloud"
     5  	"github.com/opentelekomcloud/gophertelekomcloud/internal/extract"
     6  )
     7  
     8  type ListConfigOpts struct {
     9  	// Index offset. If offset is set to N, the resource query starts from the N+1 piece of data.
    10  	// The default value is 0, indicating that the query starts from the first piece of data.
    11  	// The value must be a positive integer
    12  	Offset int `q:"offset"`
    13  	// Number of records to be queried. The default value is 100.
    14  	// The value must be a positive integer.
    15  	// The minimum value is 1 and the maximum value is 100.
    16  	Limit int `q:"limit"`
    17  }
    18  
    19  func ListConfigurations(client *golangsdk.ServiceClient, opts ListConfigOpts) (*ListConfigResponse, error) {
    20  	url, err := golangsdk.NewURLBuilder().WithEndpoints("configurations").WithQueryParams(&opts).Build()
    21  	if err != nil {
    22  		return nil, err
    23  	}
    24  
    25  	// GET https://{Endpoint}/mysql/v3/{project_id}/configurations
    26  	raw, err := client.Get(client.ServiceURL(url.String()), nil, nil)
    27  	if err != nil {
    28  		return nil, err
    29  	}
    30  
    31  	var res ListConfigResponse
    32  	err = extract.Into(raw.Body, &res)
    33  	return &res, err
    34  }
    35  
    36  type ListConfigResponse struct {
    37  	// Parameter template information
    38  	Configurations []ConfigurationSummary `json:"configurations"`
    39  	// Total number of parameter templates
    40  	TotalCount int32 `json:"total_count"`
    41  }
    42  
    43  type ConfigurationSummary struct {
    44  	// Parameter template ID
    45  	Id string `json:"id"`
    46  	// Parameter template name
    47  	Name string `json:"name"`
    48  	// Parameter template description
    49  	Description string `json:"description"`
    50  	// DB version name
    51  	DatastoreVersionName string `json:"datastore_version_name"`
    52  	// Database name
    53  	DatastoreName string `json:"datastore_name"`
    54  	// Creation time in the "yyyy-MM-ddTHH:mm:ssZ" format.
    55  	// T is the separator between the calendar and the hourly notation of time.
    56  	// Z indicates the time zone offset.
    57  	// For example, for French Winter Time (FWT), the time offset is shown as +0200.
    58  	Created string `json:"created"`
    59  	// Update time in the "yyyy-MM-ddTHH:mm:ssZ" format.
    60  	// T is the separator between the calendar and the hourly notation of time.
    61  	// Z indicates the time zone offset.
    62  	// For example, for French Winter Time (FWT), the time offset is shown as +0200.
    63  	Updated string `json:"updated"`
    64  	// Whether the parameter template is a custom template.
    65  	// false: The parameter template is a default template.
    66  	// true: The parameter template is a custom template.
    67  	UserDefined bool `json:"user_defined"`
    68  }