github.com/opentelekomcloud/gophertelekomcloud@v0.9.3/openstack/dws/v1/cluster/ListClusterDetails.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 ListClusterDetails(client *golangsdk.ServiceClient, clusterId string) (*ClusterDetail, error) {
    10  	// GET /v1.0/{project_id}/clusters/{cluster_id}
    11  	raw, err := client.Get(client.ServiceURL("clusters", clusterId), nil, openstack.StdRequestOpts())
    12  	if err != nil {
    13  		return nil, err
    14  	}
    15  
    16  	var res ClusterDetail
    17  	err = extract.IntoStructPtr(raw.Body, &res, "cluster")
    18  	return &res, err
    19  }
    20  
    21  type ClusterDetail struct {
    22  	// Cluster ID
    23  	Id string `json:"id"`
    24  	// Cluster name
    25  	Name string `json:"name"`
    26  	// Cluster status. The value can be one of the following:
    27  	// CREATING
    28  	// AVAILABLE
    29  	// UNAVAILABLE
    30  	// CREATION FAILED
    31  	Status string `json:"status"`
    32  	// Data warehouse version
    33  	Version string `json:"version"`
    34  	// Last modification time of a cluster. Format: ISO8601:YYYY-MM-DDThh:mm:ssZ
    35  	Updated string `json:"updated"`
    36  	// Cluster creation time. Format: ISO8601: YYYY-MM-DDThh:mm:ssZ
    37  	Created string `json:"created"`
    38  	// Service port of a cluster. The value ranges from 8000 to 30000. The default value is 8000.
    39  	Port int `json:"port"`
    40  	// Private network connection information about the cluster.
    41  	Endpoints []Endpoints `json:"endpoints"`
    42  	// Unused
    43  	Nodes []Nodes `json:"nodes"`
    44  	// Labels in a cluster
    45  	Tags []Tags `json:"tags"`
    46  	// Administrator name
    47  	UserName string `json:"user_name"`
    48  	// Number of nodes in a cluster. The value ranges from 2 to 256.
    49  	NumberOfNode int `json:"number_of_node"`
    50  	// Number of events
    51  	RecentEvent int `json:"recent_event"`
    52  	// AZ
    53  	AvailabilityZone string `json:"availability_zone"`
    54  	// Enterprise project ID. The value 0 indicates the ID of the default enterprise project.
    55  	EnterpriseProjectId string `json:"enterprise_project_id"`
    56  	// Node type
    57  	NodeType string `json:"node_type"`
    58  	// VPC ID
    59  	VpcId string `json:"vpc_id"`
    60  	// Subnet ID
    61  	SubnetId string `json:"subnet_id"`
    62  	// Public IP address. If the parameter is not specified, public connection is not used by default.
    63  	PublicIp PublicIp `json:"public_ip"`
    64  	// Public network connection information about the cluster. If the parameter is not specified, the public network connection information is not used by default.
    65  	PublicEndpoints []PublicEndpoints `json:"public_endpoints"`
    66  	// The key indicates an ongoing task. The value can be one of the following:
    67  	// GROWING
    68  	// RESTORING
    69  	// SNAPSHOTTING
    70  	// REPAIRING
    71  	// CREATING
    72  	// The value indicates the task progress.
    73  	ActionProgress map[string]interface{} `json:"action_progress"`
    74  	// Sub-status of clusters in the AVAILABLE state. The value can be one of the following:
    75  	// NORMAL
    76  	// READONLY
    77  	// REDISTRIBUTING
    78  	// REDISTRIBUTION-FAILURE
    79  	// UNBALANCED
    80  	// UNBALANCED | READONLY
    81  	// DEGRADED
    82  	// DEGRADED | READONLY
    83  	// DEGRADED | UNBALANCED
    84  	// UNBALANCED | REDISTRIBUTING
    85  	// UNBALANCED | REDISTRIBUTION-FAILURE
    86  	// READONLY | REDISTRIBUTION-FAILURE
    87  	// UNBALANCED | READONLY | REDISTRIBUTION-FAILURE
    88  	// DEGRADED | REDISTRIBUTION-FAILURE
    89  	// DEGRADED | UNBALANCED | REDISTRIBUTION-FAILURE
    90  	// DEGRADED | UNBALANCED | READONLY | REDISTRIBUTION-FAILURE
    91  	// DEGRADED | UNBALANCED | READONLY
    92  	SubStatus string `json:"sub_status"`
    93  	// Cluster management task. The value can be one of the following:
    94  	// RESTORING
    95  	// SNAPSHOTTING
    96  	// GROWING
    97  	// REBOOTING
    98  	// SETTING_CONFIGURATION
    99  	// CONFIGURING_EXT_DATASOURCE
   100  	// DELETING_EXT_DATASOURCE
   101  	// REBOOT_FAILURE
   102  	// RESIZE_FAILURE
   103  	TaskStatus string `json:"task_status"`
   104  	// Parameter group details
   105  	ParameterGroup ParameterGroup `json:"parameter_group,omitempty"`
   106  	// Node type ID
   107  	NodeTypeId string `json:"node_type_id"`
   108  	// Security group ID
   109  	SecurityGroupId string `json:"security_group_id"`
   110  	// List of private network IP addresses
   111  	PrivateIp []string `json:"private_ip"`
   112  	// Cluster maintenance window
   113  	MaintainWindow MaintainWindow `json:"maintain_window"`
   114  	// Cluster scale-out details
   115  	ResizeInfo ResizeInfo `json:"resize_info,omitempty"`
   116  	// Cause of failure. If the parameter is left empty, the cluster is in the normal state.
   117  	FailedReasons FailedReason `json:"failed_reasons,omitempty"`
   118  }
   119  
   120  type Endpoints struct {
   121  	// Private network connection information
   122  	ConnectInfo string `json:"connect_info,omitempty"`
   123  	// JDBC URL on the private network. The following is the default format:
   124  	//jdbc:postgresql://< connect_info>/<YOUR_DATABASE_name>
   125  	JdbcUrl string `json:"jdbc_url,omitempty"`
   126  }
   127  
   128  type Nodes struct {
   129  	Id     string `json:"id"`
   130  	Status string `json:"status"`
   131  }
   132  
   133  type Tags struct {
   134  	// Key. A key can contain a maximum of 36 Unicode characters, which cannot be null.
   135  	// The first and last characters cannot be spaces.
   136  	// Only letters, digits, hyphens (-), and underscores (_) are allowed. It cannot contain the following characters: =*<>\,|/
   137  	Key string `json:"key"`
   138  	// Value. A value can contain a maximum of 43 Unicode characters, which can be null. The first and last characters cannot be spaces.
   139  	// Only letters, digits, hyphens (-), and underscores (_) are allowed. It cannot contain the following characters: =*<>\,|/
   140  	Value string `json:"value"`
   141  }
   142  
   143  type PublicEndpoints struct {
   144  	// Public network connection information
   145  	PublicConnectInfo string `json:"public_connect_info,omitempty"`
   146  	// JDBC URL of the public network. The following is the default format:
   147  	//jdbc:postgresql://< public_connect_info>/<YOUR_DATABASE_name>
   148  	JdbcUrl string `json:"jdbc_url,omitempty"`
   149  }
   150  
   151  type ParameterGroup struct {
   152  	// Parameter group ID
   153  	Id string `json:"id"`
   154  	// Parameter group name
   155  	Name string `json:"name"`
   156  	// Cluster parameter status. The value can be one of the following:
   157  	// In-Sync: synchronized
   158  	// Applying: in application
   159  	// Pending-Reboot: restart for the modification to take effect
   160  	// Sync-Failure: application failure
   161  	Status string `json:"status"`
   162  }
   163  
   164  type MaintainWindow struct {
   165  	// Maintenance time in each week in the unit of day. The value can be one of the following:
   166  	// Mon
   167  	// Tue
   168  	// Wed
   169  	// Thu
   170  	// Fri
   171  	// Sat
   172  	// Sun
   173  	Day string `json:"day,omitempty"`
   174  	// Maintenance start time in HH:mm format. The time zone is GMT+0.
   175  	StartTime string `json:"start_time,omitempty"`
   176  	// Maintenance end time in HH:mm format. The time zone is GMT+0.
   177  	EndTime string `json:"end_time,omitempty"`
   178  }
   179  
   180  type ResizeInfo struct {
   181  	// Number of nodes after the scale-out
   182  	TargetNodeNum int `json:"target_node_num,omitempty"`
   183  	// Number of nodes before the scale-out
   184  	OriginNodeNum int `json:"origin_node_num,omitempty"`
   185  	// Scale-out status. The value can be one of the following:
   186  	// GROWING
   187  	// RESIZE_FAILURE
   188  	ResizeStatus string `json:"resize_status,omitempty"`
   189  	// Scale-out start time. Format: ISO8601:YYYY-MM-DDThh:mm:ss
   190  	StartTime string `json:"start_time,omitempty"`
   191  }
   192  
   193  type FailedReason struct {
   194  	// Error code
   195  	ErrorCode string `json:"error_code,omitempty"`
   196  	// Error message
   197  	ErrorMsg string `json:"error_msg,omitempty"`
   198  }