github.com/opentelekomcloud/gophertelekomcloud@v0.9.3/openstack/dws/v1/cluster/ListClusters.go (about)

     1  package cluster
     2  
     3  import (
     4  	golangsdk "github.com/opentelekomcloud/gophertelekomcloud"
     5  	"github.com/opentelekomcloud/gophertelekomcloud/internal/extract"
     6  	"github.com/opentelekomcloud/gophertelekomcloud/openstack"
     7  )
     8  
     9  func ListClusters(client *golangsdk.ServiceClient) (*ListClustersResponse, error) {
    10  	// GET /v1.0/{project_id}/clusters
    11  	raw, err := client.Get(client.ServiceURL("clusters"), nil, openstack.StdRequestOpts())
    12  	if err != nil {
    13  		return nil, err
    14  	}
    15  
    16  	var res ListClustersResponse
    17  	err = extract.Into(raw.Body, &res)
    18  	return &res, err
    19  }
    20  
    21  type ListClustersResponse struct {
    22  	// List of cluster objects
    23  	Clusters []ClusterInfo `json:"clusters,omitempty"`
    24  	// Total number of cluster objects
    25  	Count int `json:"count,omitempty"`
    26  }
    27  
    28  type ClusterInfo struct {
    29  	// Cluster ID
    30  	Id string `json:"id"`
    31  	// Cluster name
    32  	Name string `json:"name"`
    33  	// Cluster status. The value can be one of the following:
    34  	// CREATING
    35  	// AVAILABLE
    36  	// UNAVAILABLE
    37  	// CREATION FAILED
    38  	Status string `json:"status"`
    39  	// Data warehouse version
    40  	Version string `json:"version"`
    41  	// Last modification time of a cluster. Format: ISO8601:YYYY-MM-DDThh:mm:ssZ
    42  	Updated string `json:"updated"`
    43  	// Cluster creation time. Format: ISO8601:YYYY-MM-DDThh:mm:ssZ
    44  	Created string `json:"created"`
    45  	// Service port of a cluster. The value ranges from 8000 to 30000. The default value is 8000.
    46  	Port int `json:"port"`
    47  	// Private network connection information about the cluster.
    48  	Endpoints []Endpoints `json:"endpoints"`
    49  	// Unused
    50  	Nodes []Nodes `json:"nodes"`
    51  	// Tags in a cluster
    52  	Tags []Tags `json:"tags"`
    53  	// Cluster administrator name
    54  	UserName string `json:"user_name"`
    55  	// Number of nodes in a cluster. The value ranges from 2 to 256.
    56  	NumberOfNode int `json:"number_of_node"`
    57  	// Number of events
    58  	RecentEvent int `json:"recent_event"`
    59  	// AZ
    60  	AvailabilityZone string `json:"availability_zone"`
    61  	// Enterprise project ID. The value 0 indicates the ID of the default enterprise project.
    62  	EnterpriseProjectId string `json:"enterprise_project_id"`
    63  	// Node type
    64  	NodeType string `json:"node_type"`
    65  	// VPC ID
    66  	VpcId string `json:"vpc_id"`
    67  	// Subnet ID
    68  	SubnetId string `json:"subnet_id"`
    69  	// Public IP address. If the parameter is not specified, public connection is not used by default.
    70  	PublicIp PublicIp `json:"public_ip"`
    71  	// Public network connection information about the cluster.
    72  	// If the parameter is not specified, the public network connection information is not used by default.
    73  	PublicEndpoints []PublicEndpoints `json:"public_endpoints"`
    74  	// Task information, consisting of a key and a value. The key indicates an ongoing task, and the value indicates the progress of the ongoing task.
    75  	// Valid key values include:
    76  	// GROWING
    77  	// RESTORING
    78  	// SNAPSHOTTING
    79  	// REPAIRING
    80  	// CREATING
    81  	// The value indicates the task progress.
    82  	// Example:
    83  	// "action_progress":
    84  	// {"SNAPSHOTTING":"16%"}
    85  	ActionProgress map[string]string `json:"action_progress"`
    86  	// Sub-status of clusters in the AVAILABLE state. The value can be one of the following:
    87  	// NORMAL
    88  	// READONLY
    89  	// REDISTRIBUTING
    90  	// REDISTRIBUTION-FAILURE
    91  	// UNBALANCED
    92  	// UNBALANCED | READONLY
    93  	// DEGRADED
    94  	// DEGRADED | READONLY
    95  	// DEGRADED | UNBALANCED
    96  	// UNBALANCED | REDISTRIBUTING
    97  	// UNBALANCED | REDISTRIBUTION-FAILURE
    98  	// READONLY | REDISTRIBUTION-FAILURE
    99  	// UNBALANCED | READONLY | REDISTRIBUTION-FAILURE
   100  	// DEGRADED | REDISTRIBUTION-FAILURE
   101  	// DEGRADED | UNBALANCED | REDISTRIBUTION-FAILURE
   102  	// DEGRADED | UNBALANCED | READONLY | REDISTRIBUTION-FAILURE
   103  	// DEGRADED | UNBALANCED | READONLY
   104  	SubStatus string `json:"sub_status"`
   105  	// Cluster management task. The value can be one of the following:
   106  	// RESTORING
   107  	// SNAPSHOTTING
   108  	// GROWING
   109  	// REBOOTING
   110  	// SETTING_CONFIGURATION
   111  	// CONFIGURING_EXT_DATASOURCE
   112  	// DELETING_EXT_DATASOURCE
   113  	// REBOOT_FAILURE
   114  	// RESIZE_FAILURE
   115  	TaskStatus string `json:"task_status"`
   116  	// Security group ID
   117  	SecurityGroupId string `json:"security_group_id"`
   118  	// Cause of failure. If the parameter is left empty, the cluster is in the normal state.
   119  	FailedReasons FailedReason `json:"failed_reasons,omitempty"`
   120  }