github.com/opentelekomcloud/gophertelekomcloud@v0.9.3/openstack/mrs/v1/cluster/List.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 type ListOpts struct { 10 // Maximum number of clusters displayed on a page 11 // Value range: 1 to 2147483646 12 PageSize string `q:"pageSize,omitempty"` 13 // Current page number 14 CurrentPage string `q:"currentPage,omitempty"` 15 // You can query a cluster list by cluster status. 16 // - starting: Query a list of clusters that are being started. 17 // - running: Query a list of running clusters. 18 // - terminated: Query a list of terminated clusters. 19 // - failed: Query a list of failed clusters. 20 // - abnormal: Query a list of abnormal clusters. 21 // - terminating: Query a list of clusters that are being terminated. 22 // - frozen: Query a list of frozen clusters. 23 // - scaling-out: Query a list of clusters that are being scaled out. 24 // - scaling-in: Query a list of clusters that are being scaled in. 25 ClusterState string `q:"clusterState,omitempty"` 26 // You can search for a cluster by its tag. 27 // If you specify multiple tags, the relationship between them is AND. 28 // - The format of the tags parameter is tags=k1*v1,k2*v2,k3*v3. 29 // - When the values of some tags are null, the format is tags=k1,k2,k3*v3. 30 Tags string `q:"tags,omitempty"` 31 } 32 33 func List(client *golangsdk.ServiceClient, opts ListOpts) (*ListResponse, error) { 34 url, err := golangsdk.NewURLBuilder().WithEndpoints("cluster_infos").WithQueryParams(&opts).Build() 35 if err != nil { 36 return nil, err 37 } 38 39 // GET /v1.1/{project_id}/cluster_infos 40 raw, err := client.Get(client.ServiceURL(url.String()), nil, openstack.StdRequestOpts()) 41 if err != nil { 42 return nil, err 43 } 44 45 var res ListResponse 46 err = extract.Into(raw.Body, &res) 47 return &res, err 48 } 49 50 type ListResponse struct { 51 // Total number of clusters in a list 52 ClusterTotal int `json:"clusterTotal,omitempty"` 53 // Cluster parameters. 54 Clusters []Cluster `json:"clusters,omitempty"` 55 } 56 57 type Cluster struct { 58 // Cluster ID 59 ClusterId string `json:"clusterId"` 60 // Cluster name 61 ClusterName string `json:"clusterName"` 62 // Number of Master nodes deployed in a cluster 63 MasterNodeNum string `json:"masterNodeNum"` 64 // Number of Core nodes deployed in a cluster 65 CoreNodeNum string `json:"coreNodeNum"` 66 // Total number of nodes deployed in a cluster 67 TotalNodeNum string `json:"totalNodeNum"` 68 // Cluster status. 69 // Valid values include: 70 // - starting: The cluster is being started. 71 // - running: The cluster is running. 72 // - terminated: The cluster has been terminated. 73 // - failed: The cluster fails. 74 // - abnormal: The cluster is abnormal. 75 // - terminating: The cluster is being terminated. 76 // - frozen: The cluster has been frozen. 77 // - scaling-out: The cluster is being scaled out. 78 // - scaling-in: The cluster is being scaled in. 79 ClusterState string `json:"clusterState"` 80 // Cluster creation time, which is a 10-bit timestamp 81 CreateAt string `json:"createAt"` 82 // Cluster update time, which is a 10-bit timestamp 83 UpdateAt string `json:"updateAt"` 84 // Cluster billing mode 85 BillingType string `json:"billingType"` 86 // Cluster work region 87 DataCenter string `json:"dataCenter"` 88 // VPC name 89 Vpc string `json:"vpc"` 90 // Cluster creation fee, which is automatically calculated 91 Fee string `json:"fee"` 92 // Hadoop version 93 HadoopVersion string `json:"hadoopVersion"` 94 // Instance specifications of a Master node 95 MasterNodeSize string `json:"masterNodeSize"` 96 // Instance specifications of a Core node 97 CoreNodeSize string `json:"coreNodeSize"` 98 // Component list 99 ComponentList []Component `json:"componentList"` 100 // External IP address 101 ExternalIp string `json:"externalIp"` 102 // Backup external IP address 103 ExternalAlternateIp string `json:"externalAlternateIp"` 104 // Internal IP address 105 InternalIp string `json:"internalIp"` 106 // Cluster deployment ID 107 DeploymentId string `json:"deploymentId"` 108 // Cluster remarks 109 Remark string `json:"remark"` 110 // Cluster creation order ID 111 OrderId string `json:"orderId"` 112 // AZ ID 113 AzId string `json:"azId"` 114 // Product ID of a Master node 115 MasterNodeProductId string `json:"masterNodeProductId"` 116 // Specification ID of a Master node 117 MasterNodeSpecId string `json:"masterNodeSpecId"` 118 // Product ID of a Core node 119 CoreNodeProductId string `json:"coreNodeProductId"` 120 // Specification ID of a Core node 121 CoreNodeSpecId string `json:"coreNodeSpecId"` 122 // AZ name 123 AzName string `json:"azName"` 124 // Instance ID 125 InstanceId string `json:"instanceId"` 126 // URI for remotely logging in to an ECS 127 Vnc string `json:"vnc"` 128 // Project ID 129 TenantId string `json:"tenantId"` 130 // Disk storage space 131 VolumeSize int `json:"volumeSize"` 132 VolumeType string `json:"volumeType"` 133 // Subnet ID 134 SubnetId string `json:"subnetId"` 135 // Cluster type 136 ClusterType int `json:"clusterType"` 137 // Subnet name 138 SubnetName string `json:"subnetName"` 139 // Security group ID 140 SecurityGroupsId string `json:"securityGroupsId"` 141 // Security group ID of a non-Master node. 142 // Currently, one MRS cluster uses only one security group. 143 // Therefore, this field has been discarded. 144 // This field returns the same value as securityGroupsId does for compatibility consideration. 145 SlaveSecurityGroupsId string `json:"slaveSecurityGroupsId"` 146 // Bootstrap action script information. 147 // MRS 1.7.2 or later supports this parameter. 148 BootstrapScripts []ScriptResult `json:"bootstrapScripts"` 149 // Cluster operation progress description. 150 // The cluster installation progress includes: 151 // - Verifying cluster parameters: Cluster parameters are being verified. 152 // - Applying for cluster resources: Cluster resources are being applied for. 153 // - Creating VMs: The VMs are being created. 154 // - Initializing VMs: The VMs are being initialized. 155 // - Installing MRS Manager: MRS Manager is being installed. 156 // - Deploying the cluster: The cluster is being deployed. 157 // - Cluster installation failed: Failed to install the cluster. 158 // The cluster scale-out progress includes: 159 // - Preparing for scale-out: Cluster scale-out is being prepared. 160 // - Creating VMs: The VMs are being created. 161 // - Initializing VMs: The VMs are being initialized. 162 // - Adding nodes to the cluster: The nodes are being added to the cluster. 163 // - Scale-out failed: Failed to scale out the cluster. 164 // The cluster scale-in progress includes: 165 // - Preparing for scale-in: Cluster scale-in is being prepared. 166 // - Decommissioning instance: The instance is being decommissioned. 167 // - Deleting VMs: The VMs are being deleted. 168 // - Deleting nodes from the cluster: The nodes are being deleted from the cluster. 169 // - Scale-in failed: Failed to scale in the cluster. 170 // If the cluster installation, scale-out, or scale-in fails, stageDesc will display the failure cause. 171 StageDesc string `json:"stageDesc"` 172 // Whether MRS Manager installation is finished during cluster creation. 173 // - true: MRS Manager installation is finished. 174 // - false: MRS Manager installation is not finished. 175 MrsManagerFinish bool `json:"mrsManagerFinish"` 176 // Running mode of an MRS cluster 177 // - 0: Normal cluster 178 // - 1: Security cluster 179 SafeMode int `json:"safeMode"` 180 // Cluster version 181 ClusterVersion string `json:"clusterVersion"` 182 // Name of the public key file 183 NodePublicCertName string `json:"nodePublicCertName"` 184 // IP address of a Master node 185 MasterNodeIp string `json:"masterNodeIp"` 186 // Preferred private IP address 187 PrivateIpFirst string `json:"privateIpFirst"` 188 // Error message 189 ErrorInfo string `json:"errorInfo"` 190 // Tag information 191 Tags string `json:"tags"` 192 // Start time of billing 193 ChargingStartTime string `json:"chargingStartTime"` 194 // Whether to collect logs when cluster installation fails 195 // - 0: Do not collect. 196 // - 1: Collect. 197 LogCollection int `json:"logCollection"` 198 // List of Task nodes. 199 TaskNodeGroups []NodeGroupV10 `json:"taskNodeGroups"` 200 // List of Master, Core and Task nodes 201 NodeGroups []NodeGroupV10 `json:"nodeGroups"` 202 // Data disk storage type of the Master node. 203 // Currently, SATA, SAS and SSD are supported. 204 MasterDataVolumeType string `json:"masterDataVolumeType"` 205 // Data disk storage space of the Master node. 206 // To increase data storage capacity, you can add disks at the same time when creating a cluster. 207 // Value range: 100 GB to 32,000 GB 208 MasterDataVolumeSize int `json:"masterDataVolumeSize"` 209 // Number of data disks of the Master node. 210 // The value can be set to 1 only. 211 MasterDataVolumeCount int `json:"masterDataVolumeCount"` 212 // Data disk storage type of the Core node. 213 // Currently, SATA, SAS and SSD are supported. 214 CoreDataVolumeType string `json:"coreDataVolumeType"` 215 // Data disk storage space of the Core node. 216 // To increase data storage capacity, you can add disks at the same time when creating a cluster. 217 // Value range: 100 GB to 32,000 GB 218 CoreDataVolumeSize int `json:"coreDataVolumeSize"` 219 // Number of data disks of the Core node. 220 // Value range: 1 to 10 221 CoreDataVolumeCount int `json:"coreDataVolumeCount"` 222 // Node change status. 223 // If this parameter is left blank, the cluster nodes are not changed. 224 // Possible values are as follows: 225 // - scaling-out: The cluster is being scaled out. 226 // - scaling-in: The cluster is being scaled in. 227 // - scaling-error: The cluster is in the running state 228 // and fails to be scaled in or out or the specifications fail to be scaled up for the last time. 229 // - scaling-up: The Master node specifications are being scaled up. 230 // - scaling_up_first: The standby Master node specifications are being scaled up. 231 // - scaled_up_first: The standby Master node specifications have been scaled up successfully. 232 // - scaled-up-success: The Master node specifications have been scaled up successfully. 233 Scale string `json:"scale"` 234 }