Add service cluster for go sdk (#68)
This commit is contained in:
parent
89180cfe07
commit
547691370d
|
@ -0,0 +1,853 @@
|
|||
// +-------------------------------------------------------------------------
|
||||
// | Copyright (C) 2016 Yunify, Inc.
|
||||
// +-------------------------------------------------------------------------
|
||||
// | Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// | you may not use this work except in compliance with the License.
|
||||
// | You may obtain a copy of the License in the LICENSE file, or at:
|
||||
// |
|
||||
// | http://www.apache.org/licenses/LICENSE-2.0
|
||||
// |
|
||||
// | Unless required by applicable law or agreed to in writing, software
|
||||
// | distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// | See the License for the specific language governing permissions and
|
||||
// | limitations under the License.
|
||||
// +-------------------------------------------------------------------------
|
||||
|
||||
package service
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/yunify/qingcloud-sdk-go/config"
|
||||
"github.com/yunify/qingcloud-sdk-go/request"
|
||||
"github.com/yunify/qingcloud-sdk-go/request/data"
|
||||
"github.com/yunify/qingcloud-sdk-go/request/errors"
|
||||
)
|
||||
|
||||
var _ fmt.State
|
||||
var _ time.Time
|
||||
|
||||
type ClusterService struct {
|
||||
Config *config.Config
|
||||
Properties *ClusterServiceProperties
|
||||
}
|
||||
|
||||
type ClusterServiceProperties struct {
|
||||
// QingCloud Zone ID
|
||||
Zone *string `json:"zone" name:"zone"` // Required
|
||||
}
|
||||
|
||||
func (s *QingCloudService) Cluster(zone string) (*ClusterService, error) {
|
||||
properties := &ClusterServiceProperties{
|
||||
Zone: &zone,
|
||||
}
|
||||
|
||||
return &ClusterService{Config: s.Config, Properties: properties}, nil
|
||||
}
|
||||
|
||||
// Documentation URL: https://docs.qingcloud.com/api/cluster/add_cluster_nodes.html
|
||||
func (s *ClusterService) AddClusterNodes(i *AddClusterNodesInput) (*AddClusterNodesOutput, error) {
|
||||
if i == nil {
|
||||
i = &AddClusterNodesInput{}
|
||||
}
|
||||
o := &data.Operation{
|
||||
Config: s.Config,
|
||||
Properties: s.Properties,
|
||||
APIName: "AddClusterNodes",
|
||||
RequestMethod: "GET",
|
||||
}
|
||||
|
||||
x := &AddClusterNodesOutput{}
|
||||
r, err := request.New(o, i, x)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
err = r.Send()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return x, err
|
||||
}
|
||||
|
||||
type AddClusterNodesInput struct {
|
||||
Cluster *string `json:"cluster" name:"cluster" location:"params"`
|
||||
NodeCount *int `json:"node_count" name:"node_count" location:"params"`
|
||||
NodeName *string `json:"node_name" name:"node_name" location:"params"`
|
||||
NodeRole *string `json:"node_role" name:"node_role" location:"params"`
|
||||
PrivateIPs []*string `json:"private_ips" name:"private_ips" location:"params"`
|
||||
}
|
||||
|
||||
func (v *AddClusterNodesInput) Validate() error {
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
type AddClusterNodesOutput struct {
|
||||
Message *string `json:"message" name:"message"`
|
||||
Action *string `json:"action" name:"action" location:"elements"`
|
||||
RetCode *int `json:"ret_code" name:"ret_code" location:"elements"`
|
||||
}
|
||||
|
||||
// Documentation URL: https://docs.qingcloud.com/api/cluster/change_cluster_vxnet.html
|
||||
func (s *ClusterService) ChangeClusterVxNet(i *ChangeClusterVxNetInput) (*ChangeClusterVxNetOutput, error) {
|
||||
if i == nil {
|
||||
i = &ChangeClusterVxNetInput{}
|
||||
}
|
||||
o := &data.Operation{
|
||||
Config: s.Config,
|
||||
Properties: s.Properties,
|
||||
APIName: "ChangeClusterVxnet",
|
||||
RequestMethod: "GET",
|
||||
}
|
||||
|
||||
x := &ChangeClusterVxNetOutput{}
|
||||
r, err := request.New(o, i, x)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
err = r.Send()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return x, err
|
||||
}
|
||||
|
||||
type ChangeClusterVxNetInput struct {
|
||||
Cluster *string `json:"cluster" name:"cluster" location:"params"`
|
||||
PrivateIPs interface{} `json:"private_ips" name:"private_ips" location:"params"`
|
||||
Roles []*string `json:"roles" name:"roles" location:"params"`
|
||||
VxNet *string `json:"vxnet" name:"vxnet" location:"params"`
|
||||
}
|
||||
|
||||
func (v *ChangeClusterVxNetInput) Validate() error {
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
type ChangeClusterVxNetOutput struct {
|
||||
Message *string `json:"message" name:"message"`
|
||||
Action *string `json:"action" name:"action" location:"elements"`
|
||||
RetCode *int `json:"ret_code" name:"ret_code" location:"elements"`
|
||||
}
|
||||
|
||||
// Documentation URL: https://docs.qingcloud.com/api/cluster/create_clusters.html
|
||||
func (s *ClusterService) CreateCluster(i *CreateClusterInput) (*CreateClusterOutput, error) {
|
||||
if i == nil {
|
||||
i = &CreateClusterInput{}
|
||||
}
|
||||
o := &data.Operation{
|
||||
Config: s.Config,
|
||||
Properties: s.Properties,
|
||||
APIName: "CreateCluster",
|
||||
RequestMethod: "GET",
|
||||
}
|
||||
|
||||
x := &CreateClusterOutput{}
|
||||
r, err := request.New(o, i, x)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
err = r.Send()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return x, err
|
||||
}
|
||||
|
||||
type CreateClusterInput struct {
|
||||
Conf *string `json:"conf" name:"conf" location:"params"` // Required
|
||||
}
|
||||
|
||||
func (v *CreateClusterInput) Validate() error {
|
||||
|
||||
if v.Conf == nil {
|
||||
return errors.ParameterRequiredError{
|
||||
ParameterName: "Conf",
|
||||
ParentName: "CreateClusterInput",
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
type CreateClusterOutput struct {
|
||||
Message *string `json:"message" name:"message"`
|
||||
Action *string `json:"action" name:"action" location:"elements"`
|
||||
RetCode *int `json:"ret_code" name:"ret_code" location:"elements"`
|
||||
}
|
||||
|
||||
// Documentation URL: https://docs.qingcloud.com/api/cluster/delete_cluster_nodes.html
|
||||
func (s *ClusterService) DeleteClusterNodes(i *DeleteClusterNodesInput) (*DeleteClusterNodesOutput, error) {
|
||||
if i == nil {
|
||||
i = &DeleteClusterNodesInput{}
|
||||
}
|
||||
o := &data.Operation{
|
||||
Config: s.Config,
|
||||
Properties: s.Properties,
|
||||
APIName: "DeleteClusterNodes",
|
||||
RequestMethod: "GET",
|
||||
}
|
||||
|
||||
x := &DeleteClusterNodesOutput{}
|
||||
r, err := request.New(o, i, x)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
err = r.Send()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return x, err
|
||||
}
|
||||
|
||||
type DeleteClusterNodesInput struct {
|
||||
Cluster *string `json:"cluster" name:"cluster" location:"params"`
|
||||
Force *int `json:"force" name:"force" location:"params"`
|
||||
Nodes []*string `json:"nodes" name:"nodes" location:"params"`
|
||||
}
|
||||
|
||||
func (v *DeleteClusterNodesInput) Validate() error {
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
type DeleteClusterNodesOutput struct {
|
||||
Message *string `json:"message" name:"message"`
|
||||
Action *string `json:"action" name:"action" location:"elements"`
|
||||
RetCode *int `json:"ret_code" name:"ret_code" location:"elements"`
|
||||
}
|
||||
|
||||
// Documentation URL: https://docs.qingcloud.com/api/cluster/delete_clusters.html
|
||||
func (s *ClusterService) DeleteClusters(i *DeleteClustersInput) (*DeleteClustersOutput, error) {
|
||||
if i == nil {
|
||||
i = &DeleteClustersInput{}
|
||||
}
|
||||
o := &data.Operation{
|
||||
Config: s.Config,
|
||||
Properties: s.Properties,
|
||||
APIName: "DeleteClusters",
|
||||
RequestMethod: "GET",
|
||||
}
|
||||
|
||||
x := &DeleteClustersOutput{}
|
||||
r, err := request.New(o, i, x)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
err = r.Send()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return x, err
|
||||
}
|
||||
|
||||
type DeleteClustersInput struct {
|
||||
Clusters []*string `json:"clusters" name:"clusters" location:"params"`
|
||||
}
|
||||
|
||||
func (v *DeleteClustersInput) Validate() error {
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
type DeleteClustersOutput struct {
|
||||
Message *string `json:"message" name:"message"`
|
||||
Action *string `json:"action" name:"action" location:"elements"`
|
||||
RetCode *int `json:"ret_code" name:"ret_code" location:"elements"`
|
||||
}
|
||||
|
||||
// Documentation URL: https://docs.qingcloud.com/api/cluster/describe_cluster_nodes.html
|
||||
func (s *ClusterService) DescribeClusterNodes(i *DescribeClusterNodesInput) (*DescribeClusterNodesOutput, error) {
|
||||
if i == nil {
|
||||
i = &DescribeClusterNodesInput{}
|
||||
}
|
||||
o := &data.Operation{
|
||||
Config: s.Config,
|
||||
Properties: s.Properties,
|
||||
APIName: "DescribeClusterNodes",
|
||||
RequestMethod: "GET",
|
||||
}
|
||||
|
||||
x := &DescribeClusterNodesOutput{}
|
||||
r, err := request.New(o, i, x)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
err = r.Send()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return x, err
|
||||
}
|
||||
|
||||
type DescribeClusterNodesInput struct {
|
||||
Cluster *string `json:"cluster" name:"cluster" location:"params"`
|
||||
ClusterNodes []*string `json:"cluster_nodes" name:"cluster_nodes" location:"params"`
|
||||
Role *string `json:"role" name:"role" location:"params"`
|
||||
}
|
||||
|
||||
func (v *DescribeClusterNodesInput) Validate() error {
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
type DescribeClusterNodesOutput struct {
|
||||
Message *string `json:"message" name:"message"`
|
||||
Action *string `json:"action" name:"action" location:"elements"`
|
||||
NodeSet []*ClusterNode `json:"node_set" name:"node_set" location:"elements"`
|
||||
RetCode *int `json:"ret_code" name:"ret_code" location:"elements"`
|
||||
TotalCount *int `json:"total_count" name:"total_count" location:"elements"`
|
||||
}
|
||||
|
||||
// Documentation URL: https://docs.qingcloud.com/api/cluster/describe_cluster_users.html
|
||||
func (s *ClusterService) DescribeClusterUsers(i *DescribeClusterUsersInput) (*DescribeClusterUsersOutput, error) {
|
||||
if i == nil {
|
||||
i = &DescribeClusterUsersInput{}
|
||||
}
|
||||
o := &data.Operation{
|
||||
Config: s.Config,
|
||||
Properties: s.Properties,
|
||||
APIName: "DescribeClusterUsers",
|
||||
RequestMethod: "GET",
|
||||
}
|
||||
|
||||
x := &DescribeClusterUsersOutput{}
|
||||
r, err := request.New(o, i, x)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
err = r.Send()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return x, err
|
||||
}
|
||||
|
||||
type DescribeClusterUsersInput struct {
|
||||
AppVersions []*string `json:"app_versions" name:"app_versions" location:"params"`
|
||||
Apps []*string `json:"apps" name:"apps" location:"params"`
|
||||
ClusterStatus []*string `json:"cluster_status" name:"cluster_status" location:"params"`
|
||||
Users []*string `json:"users" name:"users" location:"params"`
|
||||
Zones []*string `json:"zones" name:"zones" location:"params"`
|
||||
}
|
||||
|
||||
func (v *DescribeClusterUsersInput) Validate() error {
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
type DescribeClusterUsersOutput struct {
|
||||
Message *string `json:"message" name:"message"`
|
||||
Action *string `json:"action" name:"action" location:"elements"`
|
||||
RetCode *int `json:"ret_code" name:"ret_code" location:"elements"`
|
||||
}
|
||||
|
||||
// Documentation URL: https://docs.qingcloud.com/api/cluster/describe_clusters.html
|
||||
func (s *ClusterService) DescribeClusters(i *DescribeClustersInput) (*DescribeClustersOutput, error) {
|
||||
if i == nil {
|
||||
i = &DescribeClustersInput{}
|
||||
}
|
||||
o := &data.Operation{
|
||||
Config: s.Config,
|
||||
Properties: s.Properties,
|
||||
APIName: "DescribeClusters",
|
||||
RequestMethod: "GET",
|
||||
}
|
||||
|
||||
x := &DescribeClustersOutput{}
|
||||
r, err := request.New(o, i, x)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
err = r.Send()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return x, err
|
||||
}
|
||||
|
||||
type DescribeClustersInput struct {
|
||||
AppID []*string `json:"app_id" name:"app_id" location:"params"`
|
||||
AppVersion []*string `json:"app_version" name:"app_version" location:"params"`
|
||||
Clusters []*string `json:"clusters" name:"clusters" location:"params"`
|
||||
Role *string `json:"role" name:"role" location:"params"`
|
||||
// Scope's available values: all, cfgmgmt
|
||||
Scope *string `json:"scope" name:"scope" location:"params"`
|
||||
Users []*string `json:"users" name:"users" location:"params"`
|
||||
}
|
||||
|
||||
func (v *DescribeClustersInput) Validate() error {
|
||||
|
||||
if v.Scope != nil {
|
||||
scopeValidValues := []string{"all", "cfgmgmt"}
|
||||
scopeParameterValue := fmt.Sprint(*v.Scope)
|
||||
|
||||
scopeIsValid := false
|
||||
for _, value := range scopeValidValues {
|
||||
if value == scopeParameterValue {
|
||||
scopeIsValid = true
|
||||
}
|
||||
}
|
||||
|
||||
if !scopeIsValid {
|
||||
return errors.ParameterValueNotAllowedError{
|
||||
ParameterName: "Scope",
|
||||
ParameterValue: scopeParameterValue,
|
||||
AllowedValues: scopeValidValues,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
type DescribeClustersOutput struct {
|
||||
Message *string `json:"message" name:"message"`
|
||||
Action *string `json:"action" name:"action" location:"elements"`
|
||||
ClusterSet []*Cluster `json:"cluster_set" name:"cluster_set" location:"elements"`
|
||||
RetCode *int `json:"ret_code" name:"ret_code" location:"elements"`
|
||||
TotalCount *int `json:"total_count" name:"total_count" location:"elements"`
|
||||
}
|
||||
|
||||
// Documentation URL: https://docs.qingcloud.com/api/cluster/get_clusters_stats.html
|
||||
func (s *ClusterService) GetClustersStats(i *GetClustersStatsInput) (*GetClustersStatsOutput, error) {
|
||||
if i == nil {
|
||||
i = &GetClustersStatsInput{}
|
||||
}
|
||||
o := &data.Operation{
|
||||
Config: s.Config,
|
||||
Properties: s.Properties,
|
||||
APIName: "GetClustersStats",
|
||||
RequestMethod: "GET",
|
||||
}
|
||||
|
||||
x := &GetClustersStatsOutput{}
|
||||
r, err := request.New(o, i, x)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
err = r.Send()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return x, err
|
||||
}
|
||||
|
||||
type GetClustersStatsInput struct {
|
||||
Zones []*string `json:"zones" name:"zones" location:"params"`
|
||||
}
|
||||
|
||||
func (v *GetClustersStatsInput) Validate() error {
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
type GetClustersStatsOutput struct {
|
||||
Message *string `json:"message" name:"message"`
|
||||
Action *string `json:"action" name:"action" location:"elements"`
|
||||
RetCode *int `json:"ret_code" name:"ret_code" location:"elements"`
|
||||
}
|
||||
|
||||
// Documentation URL: https://docs.qingcloud.com/api/cluster/modify_cluster_attributes.html
|
||||
func (s *ClusterService) ModifyClusterAttributes(i *ModifyClusterAttributesInput) (*ModifyClusterAttributesOutput, error) {
|
||||
if i == nil {
|
||||
i = &ModifyClusterAttributesInput{}
|
||||
}
|
||||
o := &data.Operation{
|
||||
Config: s.Config,
|
||||
Properties: s.Properties,
|
||||
APIName: "ModifyClusterAttributes",
|
||||
RequestMethod: "GET",
|
||||
}
|
||||
|
||||
x := &ModifyClusterAttributesOutput{}
|
||||
r, err := request.New(o, i, x)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
err = r.Send()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return x, err
|
||||
}
|
||||
|
||||
type ModifyClusterAttributesInput struct {
|
||||
Cluster *string `json:"cluster" name:"cluster" location:"params"`
|
||||
Description *string `json:"description" name:"description" location:"params"`
|
||||
Name *string `json:"name" name:"name" location:"params"`
|
||||
}
|
||||
|
||||
func (v *ModifyClusterAttributesInput) Validate() error {
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
type ModifyClusterAttributesOutput struct {
|
||||
Message *string `json:"message" name:"message"`
|
||||
Action *string `json:"action" name:"action" location:"elements"`
|
||||
RetCode *int `json:"ret_code" name:"ret_code" location:"elements"`
|
||||
}
|
||||
|
||||
// Documentation URL: https://docs.qingcloud.com/api/cluster/modify_cluster_node_attributes.html
|
||||
func (s *ClusterService) ModifyClusterNodeAttributes(i *ModifyClusterNodeAttributesInput) (*ModifyClusterNodeAttributesOutput, error) {
|
||||
if i == nil {
|
||||
i = &ModifyClusterNodeAttributesInput{}
|
||||
}
|
||||
o := &data.Operation{
|
||||
Config: s.Config,
|
||||
Properties: s.Properties,
|
||||
APIName: "ModifyClusterNodeAttributes",
|
||||
RequestMethod: "GET",
|
||||
}
|
||||
|
||||
x := &ModifyClusterNodeAttributesOutput{}
|
||||
r, err := request.New(o, i, x)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
err = r.Send()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return x, err
|
||||
}
|
||||
|
||||
type ModifyClusterNodeAttributesInput struct {
|
||||
Cluster *string `json:"cluster" name:"cluster" location:"params"`
|
||||
ClusterNode *string `json:"cluster_node" name:"cluster_node" location:"params"`
|
||||
Name *string `json:"name" name:"name" location:"params"`
|
||||
}
|
||||
|
||||
func (v *ModifyClusterNodeAttributesInput) Validate() error {
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
type ModifyClusterNodeAttributesOutput struct {
|
||||
Message *string `json:"message" name:"message"`
|
||||
Action *string `json:"action" name:"action" location:"elements"`
|
||||
RetCode *int `json:"ret_code" name:"ret_code" location:"elements"`
|
||||
}
|
||||
|
||||
// Documentation URL: https://docs.qingcloud.com/api/cluster/resize_cluster.html
|
||||
func (s *ClusterService) ResizeCluster(i *ResizeClusterInput) (*ResizeClusterOutput, error) {
|
||||
if i == nil {
|
||||
i = &ResizeClusterInput{}
|
||||
}
|
||||
o := &data.Operation{
|
||||
Config: s.Config,
|
||||
Properties: s.Properties,
|
||||
APIName: "ResizeCluster",
|
||||
RequestMethod: "GET",
|
||||
}
|
||||
|
||||
x := &ResizeClusterOutput{}
|
||||
r, err := request.New(o, i, x)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
err = r.Send()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return x, err
|
||||
}
|
||||
|
||||
type ResizeClusterInput struct {
|
||||
Cluster *string `json:"cluster" name:"cluster" location:"params"`
|
||||
CPU *int `json:"cpu" name:"cpu" location:"params"`
|
||||
Memory *int `json:"memory" name:"memory" location:"params"`
|
||||
NodeRole *string `json:"node_role" name:"node_role" location:"params"`
|
||||
StorageSize *int `json:"storage_size" name:"storage_size" location:"params"`
|
||||
}
|
||||
|
||||
func (v *ResizeClusterInput) Validate() error {
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
type ResizeClusterOutput struct {
|
||||
Message *string `json:"message" name:"message"`
|
||||
Action *string `json:"action" name:"action" location:"elements"`
|
||||
RetCode *int `json:"ret_code" name:"ret_code" location:"elements"`
|
||||
}
|
||||
|
||||
// Documentation URL: https://docs.qingcloud.com/api/cluster/restart_cluster_service.html
|
||||
func (s *ClusterService) RestartClusterService(i *RestartClusterServiceInput) (*RestartClusterServiceOutput, error) {
|
||||
if i == nil {
|
||||
i = &RestartClusterServiceInput{}
|
||||
}
|
||||
o := &data.Operation{
|
||||
Config: s.Config,
|
||||
Properties: s.Properties,
|
||||
APIName: "RestartClusterService",
|
||||
RequestMethod: "GET",
|
||||
}
|
||||
|
||||
x := &RestartClusterServiceOutput{}
|
||||
r, err := request.New(o, i, x)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
err = r.Send()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return x, err
|
||||
}
|
||||
|
||||
type RestartClusterServiceInput struct {
|
||||
Cluster *string `json:"cluster" name:"cluster" location:"params"`
|
||||
Role *string `json:"role" name:"role" location:"params"`
|
||||
}
|
||||
|
||||
func (v *RestartClusterServiceInput) Validate() error {
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
type RestartClusterServiceOutput struct {
|
||||
Message *string `json:"message" name:"message"`
|
||||
Action *string `json:"action" name:"action" location:"elements"`
|
||||
RetCode *int `json:"ret_code" name:"ret_code" location:"elements"`
|
||||
}
|
||||
|
||||
// Documentation URL: https://docs.qingcloud.com/api/cluster/start_clusters.html
|
||||
func (s *ClusterService) StartClusters(i *StartClustersInput) (*StartClustersOutput, error) {
|
||||
if i == nil {
|
||||
i = &StartClustersInput{}
|
||||
}
|
||||
o := &data.Operation{
|
||||
Config: s.Config,
|
||||
Properties: s.Properties,
|
||||
APIName: "StartClusters",
|
||||
RequestMethod: "GET",
|
||||
}
|
||||
|
||||
x := &StartClustersOutput{}
|
||||
r, err := request.New(o, i, x)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
err = r.Send()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return x, err
|
||||
}
|
||||
|
||||
type StartClustersInput struct {
|
||||
Clusters []*string `json:"clusters" name:"clusters" location:"params"`
|
||||
}
|
||||
|
||||
func (v *StartClustersInput) Validate() error {
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
type StartClustersOutput struct {
|
||||
Message *string `json:"message" name:"message"`
|
||||
Action *string `json:"action" name:"action" location:"elements"`
|
||||
JobIDs map[string]*string `json:"job_ids" name:"job_ids" location:"elements"`
|
||||
RetCode *int `json:"ret_code" name:"ret_code" location:"elements"`
|
||||
}
|
||||
|
||||
// Documentation URL: https://docs.qingcloud.com/api/cluster/stop_clusters.html
|
||||
func (s *ClusterService) StopClusters(i *StopClustersInput) (*StopClustersOutput, error) {
|
||||
if i == nil {
|
||||
i = &StopClustersInput{}
|
||||
}
|
||||
o := &data.Operation{
|
||||
Config: s.Config,
|
||||
Properties: s.Properties,
|
||||
APIName: "StopClusters",
|
||||
RequestMethod: "GET",
|
||||
}
|
||||
|
||||
x := &StopClustersOutput{}
|
||||
r, err := request.New(o, i, x)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
err = r.Send()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return x, err
|
||||
}
|
||||
|
||||
type StopClustersInput struct {
|
||||
Clusters []*string `json:"clusters" name:"clusters" location:"params"`
|
||||
Force *int `json:"force" name:"force" location:"params"`
|
||||
}
|
||||
|
||||
func (v *StopClustersInput) Validate() error {
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
type StopClustersOutput struct {
|
||||
Message *string `json:"message" name:"message"`
|
||||
Action *string `json:"action" name:"action" location:"elements"`
|
||||
JobIDs map[string]*string `json:"job_ids" name:"job_ids" location:"elements"`
|
||||
RetCode *int `json:"ret_code" name:"ret_code" location:"elements"`
|
||||
}
|
||||
|
||||
// Documentation URL: https://docs.qingcloud.com/api/cluster/suspend_clusters.html
|
||||
func (s *ClusterService) SuspendClusters(i *SuspendClustersInput) (*SuspendClustersOutput, error) {
|
||||
if i == nil {
|
||||
i = &SuspendClustersInput{}
|
||||
}
|
||||
o := &data.Operation{
|
||||
Config: s.Config,
|
||||
Properties: s.Properties,
|
||||
APIName: "SuspendClusters",
|
||||
RequestMethod: "GET",
|
||||
}
|
||||
|
||||
x := &SuspendClustersOutput{}
|
||||
r, err := request.New(o, i, x)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
err = r.Send()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return x, err
|
||||
}
|
||||
|
||||
type SuspendClustersInput struct {
|
||||
Clusters []*string `json:"clusters" name:"clusters" location:"params"`
|
||||
}
|
||||
|
||||
func (v *SuspendClustersInput) Validate() error {
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
type SuspendClustersOutput struct {
|
||||
Message *string `json:"message" name:"message"`
|
||||
Action *string `json:"action" name:"action" location:"elements"`
|
||||
RetCode *int `json:"ret_code" name:"ret_code" location:"elements"`
|
||||
}
|
||||
|
||||
// Documentation URL: https://docs.qingcloud.com/api/cluster/update_cluster_environment.html
|
||||
func (s *ClusterService) UpdateClusterEnvironment(i *UpdateClusterEnvironmentInput) (*UpdateClusterEnvironmentOutput, error) {
|
||||
if i == nil {
|
||||
i = &UpdateClusterEnvironmentInput{}
|
||||
}
|
||||
o := &data.Operation{
|
||||
Config: s.Config,
|
||||
Properties: s.Properties,
|
||||
APIName: "UpdateClusterEnvironment",
|
||||
RequestMethod: "GET",
|
||||
}
|
||||
|
||||
x := &UpdateClusterEnvironmentOutput{}
|
||||
r, err := request.New(o, i, x)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
err = r.Send()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return x, err
|
||||
}
|
||||
|
||||
type UpdateClusterEnvironmentInput struct {
|
||||
Cluster *string `json:"cluster" name:"cluster" location:"params"`
|
||||
Env interface{} `json:"env" name:"env" location:"params"`
|
||||
Roles []*string `json:"roles" name:"roles" location:"params"`
|
||||
}
|
||||
|
||||
func (v *UpdateClusterEnvironmentInput) Validate() error {
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
type UpdateClusterEnvironmentOutput struct {
|
||||
Message *string `json:"message" name:"message"`
|
||||
Action *string `json:"action" name:"action" location:"elements"`
|
||||
RetCode *int `json:"ret_code" name:"ret_code" location:"elements"`
|
||||
}
|
||||
|
||||
// Documentation URL: https://docs.qingcloud.com/api/cluster/upgrade_clusters.html
|
||||
func (s *ClusterService) UpgradeClusters(i *UpgradeClustersInput) (*UpgradeClustersOutput, error) {
|
||||
if i == nil {
|
||||
i = &UpgradeClustersInput{}
|
||||
}
|
||||
o := &data.Operation{
|
||||
Config: s.Config,
|
||||
Properties: s.Properties,
|
||||
APIName: "UpgradeClusters",
|
||||
RequestMethod: "GET",
|
||||
}
|
||||
|
||||
x := &UpgradeClustersOutput{}
|
||||
r, err := request.New(o, i, x)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
err = r.Send()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return x, err
|
||||
}
|
||||
|
||||
type UpgradeClustersInput struct {
|
||||
AppVersion *string `json:"app_version" name:"app_version" location:"params"`
|
||||
Clusters []*string `json:"clusters" name:"clusters" location:"params"`
|
||||
}
|
||||
|
||||
func (v *UpgradeClustersInput) Validate() error {
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
type UpgradeClustersOutput struct {
|
||||
Message *string `json:"message" name:"message"`
|
||||
Action *string `json:"action" name:"action" location:"elements"`
|
||||
RetCode *int `json:"ret_code" name:"ret_code" location:"elements"`
|
||||
}
|
|
@ -600,7 +600,9 @@ type RunInstancesInput struct {
|
|||
BillingID *string `json:"billing_id" name:"billing_id" location:"params"`
|
||||
Count *int `json:"count" name:"count" default:"1" location:"params"`
|
||||
// CPU's available values: 1, 2, 4, 8, 16
|
||||
CPU *int `json:"cpu" name:"cpu" default:"1" location:"params"`
|
||||
CPU *int `json:"cpu" name:"cpu" default:"1" location:"params"`
|
||||
// CPUMax's available values: 1, 2, 4, 8, 16
|
||||
CPUMax *int `json:"cpu_max" name:"cpu_max" location:"params"`
|
||||
Hostname *string `json:"hostname" name:"hostname" location:"params"`
|
||||
ImageID *string `json:"image_id" name:"image_id" location:"params"` // Required
|
||||
// InstanceClass's available values: 0, 1
|
||||
|
@ -611,6 +613,8 @@ type RunInstancesInput struct {
|
|||
// LoginMode's available values: keypair, passwd
|
||||
LoginMode *string `json:"login_mode" name:"login_mode" location:"params"` // Required
|
||||
LoginPasswd *string `json:"login_passwd" name:"login_passwd" location:"params"`
|
||||
// MemMax's available values: 1024, 2048, 4096, 6144, 8192, 12288, 16384, 24576, 32768
|
||||
MemMax *int `json:"mem_max" name:"mem_max" location:"params"`
|
||||
// Memory's available values: 1024, 2048, 4096, 6144, 8192, 12288, 16384, 24576, 32768
|
||||
Memory *int `json:"memory" name:"memory" default:"1024" location:"params"`
|
||||
// NeedNewSID's available values: 0, 1
|
||||
|
@ -650,6 +654,26 @@ func (v *RunInstancesInput) Validate() error {
|
|||
}
|
||||
}
|
||||
|
||||
if v.CPUMax != nil {
|
||||
cpuMaxValidValues := []string{"1", "2", "4", "8", "16"}
|
||||
cpuMaxParameterValue := fmt.Sprint(*v.CPUMax)
|
||||
|
||||
cpuMaxIsValid := false
|
||||
for _, value := range cpuMaxValidValues {
|
||||
if value == cpuMaxParameterValue {
|
||||
cpuMaxIsValid = true
|
||||
}
|
||||
}
|
||||
|
||||
if !cpuMaxIsValid {
|
||||
return errors.ParameterValueNotAllowedError{
|
||||
ParameterName: "CPUMax",
|
||||
ParameterValue: cpuMaxParameterValue,
|
||||
AllowedValues: cpuMaxValidValues,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if v.ImageID == nil {
|
||||
return errors.ParameterRequiredError{
|
||||
ParameterName: "ImageID",
|
||||
|
@ -704,6 +728,26 @@ func (v *RunInstancesInput) Validate() error {
|
|||
}
|
||||
}
|
||||
|
||||
if v.MemMax != nil {
|
||||
memMaxValidValues := []string{"1024", "2048", "4096", "6144", "8192", "12288", "16384", "24576", "32768"}
|
||||
memMaxParameterValue := fmt.Sprint(*v.MemMax)
|
||||
|
||||
memMaxIsValid := false
|
||||
for _, value := range memMaxValidValues {
|
||||
if value == memMaxParameterValue {
|
||||
memMaxIsValid = true
|
||||
}
|
||||
}
|
||||
|
||||
if !memMaxIsValid {
|
||||
return errors.ParameterValueNotAllowedError{
|
||||
ParameterName: "MemMax",
|
||||
ParameterValue: memMaxParameterValue,
|
||||
AllowedValues: memMaxValidValues,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if v.Memory != nil {
|
||||
memoryValidValues := []string{"1024", "2048", "4096", "6144", "8192", "12288", "16384", "24576", "32768"}
|
||||
memoryParameterValue := fmt.Sprint(*v.Memory)
|
||||
|
|
|
@ -395,6 +395,103 @@ func (v *CachePrivateIP) Validate() error {
|
|||
return nil
|
||||
}
|
||||
|
||||
type Cluster struct {
|
||||
AppID *string `json:"app_id" name:"app_id"`
|
||||
AppVersion *string `json:"app_version" name:"app_version"`
|
||||
AutoBackupTime *int `json:"auto_backup_time" name:"auto_backup_time"`
|
||||
CfgmgmtID *string `json:"cfgmgmt_id" name:"cfgmgmt_id"`
|
||||
ClusterID *string `json:"cluster_id" name:"cluster_id"`
|
||||
ClusterType *int `json:"cluster_type" name:"cluster_type"`
|
||||
ConsoleID *string `json:"console_id" name:"console_id"`
|
||||
Controller *string `json:"controller" name:"controller"`
|
||||
CreateTime *time.Time `json:"create_time" name:"create_time" format:"ISO 8601"`
|
||||
Debug *int `json:"debug" name:"debug"`
|
||||
Description *string `json:"description" name:"description"`
|
||||
GlobalUUID *string `json:"global_uuid" name:"global_uuid"`
|
||||
IncrementalBackupSupported *int `json:"incremental_backup_supported" name:"incremental_backup_supported"`
|
||||
LatestSnapshotTime *string `json:"latest_snapshot_time" name:"latest_snapshot_time"`
|
||||
MetadataRootAccess *int `json:"metadata_root_access" name:"metadata_root_access"`
|
||||
Name *string `json:"name" name:"name"`
|
||||
NodeCount *int `json:"node_count" name:"node_count"`
|
||||
Owner *string `json:"owner" name:"owner"`
|
||||
PartnerAccess *int `json:"partner_access" name:"partner_access"`
|
||||
ReuseHyper *int `json:"reuse_hyper" name:"reuse_hyper"`
|
||||
Roles []*string `json:"roles" name:"roles"`
|
||||
RootUserID *string `json:"root_user_id" name:"root_user_id"`
|
||||
Status *string `json:"status" name:"status"`
|
||||
StatusTime *time.Time `json:"status_time" name:"status_time" format:"ISO 8601"`
|
||||
SubCode *int `json:"sub_code" name:"sub_code"`
|
||||
TransitionStatus *string `json:"transition_status" name:"transition_status"`
|
||||
UpgradeStatus *string `json:"upgrade_status" name:"upgrade_status"`
|
||||
UpgradeTime *time.Time `json:"upgrade_time" name:"upgrade_time" format:"ISO 8601"`
|
||||
VxNet *VxNet `json:"vxnet" name:"vxnet"`
|
||||
}
|
||||
|
||||
func (v *Cluster) Validate() error {
|
||||
|
||||
if v.VxNet != nil {
|
||||
if err := v.VxNet.Validate(); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
type ClusterNode struct {
|
||||
AgentInstalled *int `json:"agent_installed" name:"agent_installed"`
|
||||
AlarmStatus *string `json:"alarm_status" name:"alarm_status"`
|
||||
AppID *string `json:"app_id" name:"app_id"`
|
||||
AppVersion *string `json:"app_version" name:"app_version"`
|
||||
AutoBackup *int `json:"auto_backup" name:"auto_backup"`
|
||||
ClusterID *string `json:"cluster_id" name:"cluster_id"`
|
||||
ConsoleID *string `json:"console_id" name:"console_id"`
|
||||
Controller *string `json:"controller" name:"controller"`
|
||||
CPU *int `json:"cpu" name:"cpu"`
|
||||
CreateTime *time.Time `json:"create_time" name:"create_time" format:"ISO 8601"`
|
||||
CustomService *string `json:"custom_service" name:"custom_service"`
|
||||
Debug *int `json:"debug" name:"debug"`
|
||||
GlobalServerID *int `json:"global_server_id" name:"global_server_id"`
|
||||
GroupID *int `json:"group_id" name:"group_id"`
|
||||
HealthCheck *string `json:"health_check" name:"health_check"`
|
||||
HealthStatus *string `json:"health_status" name:"health_status"`
|
||||
Hypervisor *string `json:"hypervisor" name:"hypervisor"`
|
||||
ImageID *string `json:"image_id" name:"image_id"`
|
||||
IncrementalBackupSupported *int `json:"incremental_backup_supported" name:"incremental_backup_supported"`
|
||||
InitService *string `json:"init_service" name:"init_service"`
|
||||
InstanceID *string `json:"instance_id" name:"instance_id"`
|
||||
IsBackup *int `json:"is_backup" name:"is_backup"`
|
||||
Memory *int `json:"memory" name:"memory"`
|
||||
Monitor *string `json:"monitor" name:"monitor"`
|
||||
Name *string `json:"name" name:"name"`
|
||||
NodeID *string `json:"node_id" name:"node_id"`
|
||||
Owner *string `json:"owner" name:"owner"`
|
||||
PrivateIP *string `json:"private_ip" name:"private_ip"`
|
||||
Repl *string `json:"repl" name:"repl"`
|
||||
RestartService *string `json:"restart_service" name:"restart_service"`
|
||||
Role *string `json:"role" name:"role"`
|
||||
RootUserID *string `json:"root_user_id" name:"root_user_id"`
|
||||
ScaleInService *string `json:"scale_in_service" name:"scale_in_service"`
|
||||
ScaleOutService *string `json:"scale_out_service" name:"scale_out_service"`
|
||||
ServerID *int `json:"server_id" name:"server_id"`
|
||||
SingleNodeRepl *string `json:"single_node_repl" name:"single_node_repl"`
|
||||
StartService *string `json:"start_service" name:"start_service"`
|
||||
Status *string `json:"status" name:"status"`
|
||||
StatusTime *time.Time `json:"status_time" name:"status_time" format:"ISO 8601"`
|
||||
StopService *string `json:"stop_service" name:"stop_service"`
|
||||
StorageSize *int `json:"storage_size" name:"storage_size"`
|
||||
TransitionStatus *string `json:"transition_status" name:"transition_status"`
|
||||
UserAccess *string `json:"user_access" name:"user_access"`
|
||||
VerticalScalingPolicy *string `json:"vertical_scaling_policy" name:"vertical_scaling_policy"`
|
||||
VolumeIDs *string `json:"volume_ids" name:"volume_ids"`
|
||||
VxNetID *string `json:"vxnet_id" name:"vxnet_id"`
|
||||
}
|
||||
|
||||
func (v *ClusterNode) Validate() error {
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
type Data struct {
|
||||
Data *string `json:"data" name:"data"`
|
||||
EIPID *string `json:"eip_id" name:"eip_id"`
|
||||
|
|
Loading…
Reference in New Issue