2016-12-03 09:42:26 +00:00
|
|
|
// +-------------------------------------------------------------------------
|
|
|
|
// | 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.
|
|
|
|
// +-------------------------------------------------------------------------
|
|
|
|
|
2016-12-08 13:02:38 +00:00
|
|
|
package service
|
2016-12-03 09:42:26 +00:00
|
|
|
|
|
|
|
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"
|
2017-01-05 14:03:55 +00:00
|
|
|
"github.com/yunify/qingcloud-sdk-go/request/errors"
|
2016-12-03 09:42:26 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
var _ fmt.State
|
|
|
|
var _ time.Time
|
|
|
|
|
|
|
|
type RDBService struct {
|
|
|
|
Config *config.Config
|
|
|
|
Properties *RDBServiceProperties
|
|
|
|
}
|
|
|
|
|
|
|
|
type RDBServiceProperties struct {
|
|
|
|
// QingCloud Zone ID
|
2017-01-05 14:03:55 +00:00
|
|
|
Zone *string `json:"zone" name:"zone"` // Required
|
2016-12-03 09:42:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (s *QingCloudService) RDB(zone string) (*RDBService, error) {
|
|
|
|
properties := &RDBServiceProperties{
|
2017-01-05 14:03:55 +00:00
|
|
|
Zone: &zone,
|
2016-12-03 09:42:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return &RDBService{Config: s.Config, Properties: properties}, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
// Documentation URL: https://docs.qingcloud.com/api/rdb/apply_rdb_parameter_group.html
|
|
|
|
func (s *RDBService) ApplyRDBParameterGroup(i *ApplyRDBParameterGroupInput) (*ApplyRDBParameterGroupOutput, error) {
|
|
|
|
if i == nil {
|
|
|
|
i = &ApplyRDBParameterGroupInput{}
|
|
|
|
}
|
|
|
|
o := &data.Operation{
|
|
|
|
Config: s.Config,
|
|
|
|
Properties: s.Properties,
|
|
|
|
APIName: "ApplyRDBParameterGroup",
|
|
|
|
RequestMethod: "GET",
|
|
|
|
}
|
|
|
|
|
|
|
|
x := &ApplyRDBParameterGroupOutput{}
|
|
|
|
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 ApplyRDBParameterGroupInput struct {
|
2017-01-05 14:03:55 +00:00
|
|
|
RDB *string `json:"rdb" name:"rdb" location:"params"` // Required
|
2016-12-03 09:42:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (v *ApplyRDBParameterGroupInput) Validate() error {
|
|
|
|
|
2017-01-05 14:03:55 +00:00
|
|
|
if v.RDB == nil {
|
|
|
|
return errors.ParameterRequiredError{
|
2016-12-03 09:42:26 +00:00
|
|
|
ParameterName: "RDB",
|
|
|
|
ParentName: "ApplyRDBParameterGroupInput",
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
type ApplyRDBParameterGroupOutput struct {
|
2017-01-05 14:03:55 +00:00
|
|
|
Message *string `json:"message" name:"message"`
|
|
|
|
Action *string `json:"action" name:"action" location:"elements"`
|
|
|
|
JobID *string `json:"job_id" name:"job_id" location:"elements"`
|
|
|
|
RDB *string `json:"rdb" name:"rdb" location:"elements"`
|
|
|
|
RetCode *int `json:"ret_code" name:"ret_code" location:"elements"`
|
2016-12-03 09:42:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Documentation URL: https://docs.qingcloud.com/api/rdb/cease_rdb_instance.html
|
|
|
|
func (s *RDBService) CeaseRDBInstance(i *CeaseRDBInstanceInput) (*CeaseRDBInstanceOutput, error) {
|
|
|
|
if i == nil {
|
|
|
|
i = &CeaseRDBInstanceInput{}
|
|
|
|
}
|
|
|
|
o := &data.Operation{
|
|
|
|
Config: s.Config,
|
|
|
|
Properties: s.Properties,
|
|
|
|
APIName: "CeaseRDBInstance",
|
|
|
|
RequestMethod: "GET",
|
|
|
|
}
|
|
|
|
|
|
|
|
x := &CeaseRDBInstanceOutput{}
|
|
|
|
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 CeaseRDBInstanceInput struct {
|
2017-01-05 14:03:55 +00:00
|
|
|
RDB *string `json:"rdb" name:"rdb" location:"params"` // Required
|
|
|
|
RDBInstance *string `json:"rdb_instance" name:"rdb_instance" location:"params"` // Required
|
2016-12-03 09:42:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (v *CeaseRDBInstanceInput) Validate() error {
|
|
|
|
|
2017-01-05 14:03:55 +00:00
|
|
|
if v.RDB == nil {
|
|
|
|
return errors.ParameterRequiredError{
|
2016-12-03 09:42:26 +00:00
|
|
|
ParameterName: "RDB",
|
|
|
|
ParentName: "CeaseRDBInstanceInput",
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-01-05 14:03:55 +00:00
|
|
|
if v.RDBInstance == nil {
|
|
|
|
return errors.ParameterRequiredError{
|
2016-12-03 09:42:26 +00:00
|
|
|
ParameterName: "RDBInstance",
|
|
|
|
ParentName: "CeaseRDBInstanceInput",
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
type CeaseRDBInstanceOutput struct {
|
2017-01-05 14:03:55 +00:00
|
|
|
Message *string `json:"message" name:"message"`
|
|
|
|
Action *string `json:"action" name:"action" location:"elements"`
|
|
|
|
JobID *string `json:"job_id" name:"job_id" location:"elements"`
|
|
|
|
RetCode *int `json:"ret_code" name:"ret_code" location:"elements"`
|
2016-12-03 09:42:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Documentation URL: https://docs.qingcloud.com/api/rdb/copy_rdb_instance_files_to_ftp.html
|
|
|
|
func (s *RDBService) CopyRDBInstanceFilesToFTP(i *CopyRDBInstanceFilesToFTPInput) (*CopyRDBInstanceFilesToFTPOutput, error) {
|
|
|
|
if i == nil {
|
|
|
|
i = &CopyRDBInstanceFilesToFTPInput{}
|
|
|
|
}
|
|
|
|
o := &data.Operation{
|
|
|
|
Config: s.Config,
|
|
|
|
Properties: s.Properties,
|
|
|
|
APIName: "CopyRDBInstanceFilesToFTP",
|
|
|
|
RequestMethod: "GET",
|
|
|
|
}
|
|
|
|
|
|
|
|
x := &CopyRDBInstanceFilesToFTPOutput{}
|
|
|
|
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 CopyRDBInstanceFilesToFTPInput struct {
|
2017-01-05 14:03:55 +00:00
|
|
|
Files []*string `json:"files" name:"files" location:"params"` // Required
|
|
|
|
RDBInstance *string `json:"rdb_instance" name:"rdb_instance" location:"params"` // Required
|
2016-12-03 09:42:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (v *CopyRDBInstanceFilesToFTPInput) Validate() error {
|
|
|
|
|
|
|
|
if len(v.Files) == 0 {
|
2017-01-05 14:03:55 +00:00
|
|
|
return errors.ParameterRequiredError{
|
2016-12-03 09:42:26 +00:00
|
|
|
ParameterName: "Files",
|
|
|
|
ParentName: "CopyRDBInstanceFilesToFTPInput",
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-01-05 14:03:55 +00:00
|
|
|
if v.RDBInstance == nil {
|
|
|
|
return errors.ParameterRequiredError{
|
2016-12-03 09:42:26 +00:00
|
|
|
ParameterName: "RDBInstance",
|
|
|
|
ParentName: "CopyRDBInstanceFilesToFTPInput",
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
type CopyRDBInstanceFilesToFTPOutput struct {
|
2017-01-05 14:03:55 +00:00
|
|
|
Message *string `json:"message" name:"message"`
|
|
|
|
Action *string `json:"action" name:"action" location:"elements"`
|
|
|
|
JobID *string `json:"job_id" name:"job_id" location:"elements"`
|
|
|
|
RDBInstance *string `json:"rdb_instance" name:"rdb_instance" location:"elements"`
|
|
|
|
RetCode *int `json:"ret_code" name:"ret_code" location:"elements"`
|
2016-12-03 09:42:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Documentation URL: https://docs.qingcloud.com/api/rdb/create_rdb.html
|
|
|
|
func (s *RDBService) CreateRDB(i *CreateRDBInput) (*CreateRDBOutput, error) {
|
|
|
|
if i == nil {
|
|
|
|
i = &CreateRDBInput{}
|
|
|
|
}
|
|
|
|
o := &data.Operation{
|
|
|
|
Config: s.Config,
|
|
|
|
Properties: s.Properties,
|
|
|
|
APIName: "CreateRDB",
|
|
|
|
RequestMethod: "GET",
|
|
|
|
}
|
|
|
|
|
|
|
|
x := &CreateRDBOutput{}
|
|
|
|
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 CreateRDBInput struct {
|
2017-01-05 14:03:55 +00:00
|
|
|
AutoBackupTime *int `json:"auto_backup_time" name:"auto_backup_time" location:"params"`
|
|
|
|
Description *string `json:"description" name:"description" location:"params"`
|
2016-12-03 09:42:26 +00:00
|
|
|
// EngineVersion's available values: mysql,5.5, mysql,5.6, mysql,5.7, psql,9.3, psql,9.4
|
2017-01-05 14:03:55 +00:00
|
|
|
EngineVersion *string `json:"engine_version" name:"engine_version" default:"mysql,5.7" location:"params"`
|
|
|
|
NodeCount *int `json:"node_count" name:"node_count" location:"params"`
|
2016-12-03 09:42:26 +00:00
|
|
|
PrivateIPs []*RDBPrivateIP `json:"private_ips" name:"private_ips" location:"params"`
|
2017-01-05 14:03:55 +00:00
|
|
|
ProxyCount *int `json:"proxy_count" name:"proxy_count" location:"params"`
|
|
|
|
RDBClass *int `json:"rdb_class" name:"rdb_class" location:"params"`
|
2016-12-03 09:42:26 +00:00
|
|
|
// RDBEngine's available values: mysql, psql
|
2017-01-05 14:03:55 +00:00
|
|
|
RDBEngine *string `json:"rdb_engine" name:"rdb_engine" default:"mysql" location:"params"`
|
|
|
|
RDBName *string `json:"rdb_name" name:"rdb_name" location:"params"`
|
|
|
|
RDBPassword *string `json:"rdb_password" name:"rdb_password" location:"params"` // Required
|
2016-12-03 09:42:26 +00:00
|
|
|
// RDBType's available values: 1, 2, 4, 8, 16, 32
|
2017-01-05 14:03:55 +00:00
|
|
|
RDBType *int `json:"rdb_type" name:"rdb_type" location:"params"` // Required
|
|
|
|
RDBUsername *string `json:"rdb_username" name:"rdb_username" location:"params"` // Required
|
|
|
|
StorageSize *int `json:"storage_size" name:"storage_size" location:"params"` // Required
|
|
|
|
VxNet *string `json:"vxnet" name:"vxnet" location:"params"` // Required
|
2016-12-03 09:42:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (v *CreateRDBInput) Validate() error {
|
|
|
|
|
2017-01-05 14:03:55 +00:00
|
|
|
if v.EngineVersion != nil {
|
2016-12-03 09:42:26 +00:00
|
|
|
engineVersionValidValues := []string{"mysql,5.5", "mysql,5.6", "mysql,5.7", "psql,9.3", "psql,9.4"}
|
2017-01-05 14:03:55 +00:00
|
|
|
engineVersionParameterValue := fmt.Sprint(*v.EngineVersion)
|
2016-12-03 09:42:26 +00:00
|
|
|
|
|
|
|
engineVersionIsValid := false
|
|
|
|
for _, value := range engineVersionValidValues {
|
|
|
|
if value == engineVersionParameterValue {
|
|
|
|
engineVersionIsValid = true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if !engineVersionIsValid {
|
2017-01-05 14:03:55 +00:00
|
|
|
return errors.ParameterValueNotAllowedError{
|
2016-12-03 09:42:26 +00:00
|
|
|
ParameterName: "EngineVersion",
|
|
|
|
ParameterValue: engineVersionParameterValue,
|
|
|
|
AllowedValues: engineVersionValidValues,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if len(v.PrivateIPs) > 0 {
|
|
|
|
for _, property := range v.PrivateIPs {
|
|
|
|
if err := property.Validate(); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-01-05 14:03:55 +00:00
|
|
|
if v.RDBEngine != nil {
|
2016-12-03 09:42:26 +00:00
|
|
|
rdbEngineValidValues := []string{"mysql", "psql"}
|
2017-01-05 14:03:55 +00:00
|
|
|
rdbEngineParameterValue := fmt.Sprint(*v.RDBEngine)
|
2016-12-03 09:42:26 +00:00
|
|
|
|
|
|
|
rdbEngineIsValid := false
|
|
|
|
for _, value := range rdbEngineValidValues {
|
|
|
|
if value == rdbEngineParameterValue {
|
|
|
|
rdbEngineIsValid = true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if !rdbEngineIsValid {
|
2017-01-05 14:03:55 +00:00
|
|
|
return errors.ParameterValueNotAllowedError{
|
2016-12-03 09:42:26 +00:00
|
|
|
ParameterName: "RDBEngine",
|
|
|
|
ParameterValue: rdbEngineParameterValue,
|
|
|
|
AllowedValues: rdbEngineValidValues,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-01-05 14:03:55 +00:00
|
|
|
if v.RDBPassword == nil {
|
|
|
|
return errors.ParameterRequiredError{
|
2016-12-03 09:42:26 +00:00
|
|
|
ParameterName: "RDBPassword",
|
|
|
|
ParentName: "CreateRDBInput",
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-01-05 14:03:55 +00:00
|
|
|
if v.RDBType == nil {
|
|
|
|
return errors.ParameterRequiredError{
|
2016-12-03 09:42:26 +00:00
|
|
|
ParameterName: "RDBType",
|
|
|
|
ParentName: "CreateRDBInput",
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-01-05 14:03:55 +00:00
|
|
|
if v.RDBType != nil {
|
2016-12-03 09:42:26 +00:00
|
|
|
rdbTypeValidValues := []string{"1", "2", "4", "8", "16", "32"}
|
2017-01-05 14:03:55 +00:00
|
|
|
rdbTypeParameterValue := fmt.Sprint(*v.RDBType)
|
2016-12-03 09:42:26 +00:00
|
|
|
|
|
|
|
rdbTypeIsValid := false
|
|
|
|
for _, value := range rdbTypeValidValues {
|
|
|
|
if value == rdbTypeParameterValue {
|
|
|
|
rdbTypeIsValid = true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if !rdbTypeIsValid {
|
2017-01-05 14:03:55 +00:00
|
|
|
return errors.ParameterValueNotAllowedError{
|
2016-12-03 09:42:26 +00:00
|
|
|
ParameterName: "RDBType",
|
|
|
|
ParameterValue: rdbTypeParameterValue,
|
|
|
|
AllowedValues: rdbTypeValidValues,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-01-05 14:03:55 +00:00
|
|
|
if v.RDBUsername == nil {
|
|
|
|
return errors.ParameterRequiredError{
|
2016-12-03 09:42:26 +00:00
|
|
|
ParameterName: "RDBUsername",
|
|
|
|
ParentName: "CreateRDBInput",
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-01-05 14:03:55 +00:00
|
|
|
if v.StorageSize == nil {
|
|
|
|
return errors.ParameterRequiredError{
|
2016-12-03 09:42:26 +00:00
|
|
|
ParameterName: "StorageSize",
|
|
|
|
ParentName: "CreateRDBInput",
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-01-05 14:03:55 +00:00
|
|
|
if v.VxNet == nil {
|
|
|
|
return errors.ParameterRequiredError{
|
2016-12-03 09:42:26 +00:00
|
|
|
ParameterName: "VxNet",
|
|
|
|
ParentName: "CreateRDBInput",
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
type CreateRDBOutput struct {
|
2017-01-05 14:03:55 +00:00
|
|
|
Message *string `json:"message" name:"message"`
|
|
|
|
Action *string `json:"action" name:"action" location:"elements"`
|
|
|
|
JobID *string `json:"job_id" name:"job_id" location:"elements"`
|
|
|
|
RDB *string `json:"rdb" name:"rdb" location:"elements"`
|
|
|
|
RetCode *int `json:"ret_code" name:"ret_code" location:"elements"`
|
2016-12-03 09:42:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Documentation URL: https://docs.qingcloud.com/api/rdb/create_rdb_from_snapshot.html
|
|
|
|
func (s *RDBService) CreateRDBFromSnapshot(i *CreateRDBFromSnapshotInput) (*CreateRDBFromSnapshotOutput, error) {
|
|
|
|
if i == nil {
|
|
|
|
i = &CreateRDBFromSnapshotInput{}
|
|
|
|
}
|
|
|
|
o := &data.Operation{
|
|
|
|
Config: s.Config,
|
|
|
|
Properties: s.Properties,
|
|
|
|
APIName: "CreateRDBFromSnapshot",
|
|
|
|
RequestMethod: "GET",
|
|
|
|
}
|
|
|
|
|
|
|
|
x := &CreateRDBFromSnapshotOutput{}
|
|
|
|
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 CreateRDBFromSnapshotInput struct {
|
2017-01-05 14:03:55 +00:00
|
|
|
AutoBackupTime *int `json:"auto_backup_time" name:"auto_backup_time" location:"params"`
|
|
|
|
Description *string `json:"description" name:"description" location:"params"`
|
2016-12-03 09:42:26 +00:00
|
|
|
// EngineVersion's available values: mysql,5.5, mysql,5.6, mysql,5.7, psql,9.3, psql,9.4
|
2017-01-05 14:03:55 +00:00
|
|
|
EngineVersion *string `json:"engine_version" name:"engine_version" default:"mysql,5.7" location:"params"`
|
|
|
|
NodeCount *int `json:"node_count" name:"node_count" location:"params"`
|
2016-12-03 09:42:26 +00:00
|
|
|
PrivateIPs []*RDBPrivateIP `json:"private_ips" name:"private_ips" location:"params"`
|
2017-01-05 14:03:55 +00:00
|
|
|
ProxyCount *int `json:"proxy_count" name:"proxy_count" location:"params"`
|
2016-12-03 09:42:26 +00:00
|
|
|
// RDBEngine's available values: mysql, psql
|
2017-01-05 14:03:55 +00:00
|
|
|
RDBEngine *string `json:"rdb_engine" name:"rdb_engine" default:"mysql" location:"params"`
|
|
|
|
RDBName *string `json:"rdb_name" name:"rdb_name" location:"params"`
|
2016-12-03 09:42:26 +00:00
|
|
|
// RDBType's available values: 1, 2, 4, 8, 16, 32
|
2017-01-05 14:03:55 +00:00
|
|
|
RDBType *int `json:"rdb_type" name:"rdb_type" location:"params"` // Required
|
|
|
|
Snapshot *string `json:"snapshot" name:"snapshot" location:"params"` // Required
|
|
|
|
StorageSize *int `json:"storage_size" name:"storage_size" location:"params"`
|
|
|
|
VxNet *string `json:"vxnet" name:"vxnet" location:"params"` // Required
|
2016-12-03 09:42:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (v *CreateRDBFromSnapshotInput) Validate() error {
|
|
|
|
|
2017-01-05 14:03:55 +00:00
|
|
|
if v.EngineVersion != nil {
|
2016-12-03 09:42:26 +00:00
|
|
|
engineVersionValidValues := []string{"mysql,5.5", "mysql,5.6", "mysql,5.7", "psql,9.3", "psql,9.4"}
|
2017-01-05 14:03:55 +00:00
|
|
|
engineVersionParameterValue := fmt.Sprint(*v.EngineVersion)
|
2016-12-03 09:42:26 +00:00
|
|
|
|
|
|
|
engineVersionIsValid := false
|
|
|
|
for _, value := range engineVersionValidValues {
|
|
|
|
if value == engineVersionParameterValue {
|
|
|
|
engineVersionIsValid = true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if !engineVersionIsValid {
|
2017-01-05 14:03:55 +00:00
|
|
|
return errors.ParameterValueNotAllowedError{
|
2016-12-03 09:42:26 +00:00
|
|
|
ParameterName: "EngineVersion",
|
|
|
|
ParameterValue: engineVersionParameterValue,
|
|
|
|
AllowedValues: engineVersionValidValues,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if len(v.PrivateIPs) > 0 {
|
|
|
|
for _, property := range v.PrivateIPs {
|
|
|
|
if err := property.Validate(); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-01-05 14:03:55 +00:00
|
|
|
if v.RDBEngine != nil {
|
2016-12-03 09:42:26 +00:00
|
|
|
rdbEngineValidValues := []string{"mysql", "psql"}
|
2017-01-05 14:03:55 +00:00
|
|
|
rdbEngineParameterValue := fmt.Sprint(*v.RDBEngine)
|
2016-12-03 09:42:26 +00:00
|
|
|
|
|
|
|
rdbEngineIsValid := false
|
|
|
|
for _, value := range rdbEngineValidValues {
|
|
|
|
if value == rdbEngineParameterValue {
|
|
|
|
rdbEngineIsValid = true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if !rdbEngineIsValid {
|
2017-01-05 14:03:55 +00:00
|
|
|
return errors.ParameterValueNotAllowedError{
|
2016-12-03 09:42:26 +00:00
|
|
|
ParameterName: "RDBEngine",
|
|
|
|
ParameterValue: rdbEngineParameterValue,
|
|
|
|
AllowedValues: rdbEngineValidValues,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-01-05 14:03:55 +00:00
|
|
|
if v.RDBType == nil {
|
|
|
|
return errors.ParameterRequiredError{
|
2016-12-03 09:42:26 +00:00
|
|
|
ParameterName: "RDBType",
|
|
|
|
ParentName: "CreateRDBFromSnapshotInput",
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-01-05 14:03:55 +00:00
|
|
|
if v.RDBType != nil {
|
2016-12-03 09:42:26 +00:00
|
|
|
rdbTypeValidValues := []string{"1", "2", "4", "8", "16", "32"}
|
2017-01-05 14:03:55 +00:00
|
|
|
rdbTypeParameterValue := fmt.Sprint(*v.RDBType)
|
2016-12-03 09:42:26 +00:00
|
|
|
|
|
|
|
rdbTypeIsValid := false
|
|
|
|
for _, value := range rdbTypeValidValues {
|
|
|
|
if value == rdbTypeParameterValue {
|
|
|
|
rdbTypeIsValid = true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if !rdbTypeIsValid {
|
2017-01-05 14:03:55 +00:00
|
|
|
return errors.ParameterValueNotAllowedError{
|
2016-12-03 09:42:26 +00:00
|
|
|
ParameterName: "RDBType",
|
|
|
|
ParameterValue: rdbTypeParameterValue,
|
|
|
|
AllowedValues: rdbTypeValidValues,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-01-05 14:03:55 +00:00
|
|
|
if v.Snapshot == nil {
|
|
|
|
return errors.ParameterRequiredError{
|
2016-12-03 09:42:26 +00:00
|
|
|
ParameterName: "Snapshot",
|
|
|
|
ParentName: "CreateRDBFromSnapshotInput",
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-01-05 14:03:55 +00:00
|
|
|
if v.VxNet == nil {
|
|
|
|
return errors.ParameterRequiredError{
|
2016-12-03 09:42:26 +00:00
|
|
|
ParameterName: "VxNet",
|
|
|
|
ParentName: "CreateRDBFromSnapshotInput",
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
type CreateRDBFromSnapshotOutput struct {
|
2017-01-05 14:03:55 +00:00
|
|
|
Message *string `json:"message" name:"message"`
|
|
|
|
Action *string `json:"action" name:"action" location:"elements"`
|
|
|
|
JobID *string `json:"job_id" name:"job_id" location:"elements"`
|
|
|
|
RDB *string `json:"rdb" name:"rdb" location:"elements"`
|
|
|
|
RetCode *int `json:"ret_code" name:"ret_code" location:"elements"`
|
2016-12-03 09:42:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Documentation URL: https://docs.qingcloud.com/api/rdb/create_temp_rdb_instance_from_snapshot.html
|
|
|
|
func (s *RDBService) CreateTempRDBInstanceFromSnapshot(i *CreateTempRDBInstanceFromSnapshotInput) (*CreateTempRDBInstanceFromSnapshotOutput, error) {
|
|
|
|
if i == nil {
|
|
|
|
i = &CreateTempRDBInstanceFromSnapshotInput{}
|
|
|
|
}
|
|
|
|
o := &data.Operation{
|
|
|
|
Config: s.Config,
|
|
|
|
Properties: s.Properties,
|
|
|
|
APIName: "CreateTempRDBInstanceFromSnapshot",
|
|
|
|
RequestMethod: "GET",
|
|
|
|
}
|
|
|
|
|
|
|
|
x := &CreateTempRDBInstanceFromSnapshotOutput{}
|
|
|
|
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 CreateTempRDBInstanceFromSnapshotInput struct {
|
2017-01-05 14:03:55 +00:00
|
|
|
RDB *string `json:"rdb" name:"rdb" location:"params"` // Required
|
|
|
|
Snapshot *string `json:"snapshot" name:"snapshot" location:"params"` // Required
|
2016-12-03 09:42:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (v *CreateTempRDBInstanceFromSnapshotInput) Validate() error {
|
|
|
|
|
2017-01-05 14:03:55 +00:00
|
|
|
if v.RDB == nil {
|
|
|
|
return errors.ParameterRequiredError{
|
2016-12-03 09:42:26 +00:00
|
|
|
ParameterName: "RDB",
|
|
|
|
ParentName: "CreateTempRDBInstanceFromSnapshotInput",
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-01-05 14:03:55 +00:00
|
|
|
if v.Snapshot == nil {
|
|
|
|
return errors.ParameterRequiredError{
|
2016-12-03 09:42:26 +00:00
|
|
|
ParameterName: "Snapshot",
|
|
|
|
ParentName: "CreateTempRDBInstanceFromSnapshotInput",
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
type CreateTempRDBInstanceFromSnapshotOutput struct {
|
2017-01-05 14:03:55 +00:00
|
|
|
Message *string `json:"message" name:"message"`
|
|
|
|
Action *string `json:"action" name:"action" location:"elements"`
|
|
|
|
JobID *string `json:"job_id" name:"job_id" location:"elements"`
|
|
|
|
RDB *string `json:"rdb" name:"rdb" location:"elements"`
|
|
|
|
RetCode *int `json:"ret_code" name:"ret_code" location:"elements"`
|
2016-12-03 09:42:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Documentation URL: https://docs.qingcloud.com/api/rdb/delete_rdbs.html
|
|
|
|
func (s *RDBService) DeleteRDBs(i *DeleteRDBsInput) (*DeleteRDBsOutput, error) {
|
|
|
|
if i == nil {
|
|
|
|
i = &DeleteRDBsInput{}
|
|
|
|
}
|
|
|
|
o := &data.Operation{
|
|
|
|
Config: s.Config,
|
|
|
|
Properties: s.Properties,
|
|
|
|
APIName: "DeleteRDBs",
|
|
|
|
RequestMethod: "GET",
|
|
|
|
}
|
|
|
|
|
|
|
|
x := &DeleteRDBsOutput{}
|
|
|
|
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 DeleteRDBsInput struct {
|
2017-01-05 14:03:55 +00:00
|
|
|
RDBs []*string `json:"rdbs" name:"rdbs" location:"params"` // Required
|
2016-12-03 09:42:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (v *DeleteRDBsInput) Validate() error {
|
|
|
|
|
|
|
|
if len(v.RDBs) == 0 {
|
2017-01-05 14:03:55 +00:00
|
|
|
return errors.ParameterRequiredError{
|
2016-12-03 09:42:26 +00:00
|
|
|
ParameterName: "RDBs",
|
|
|
|
ParentName: "DeleteRDBsInput",
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
type DeleteRDBsOutput struct {
|
2017-01-05 14:03:55 +00:00
|
|
|
Message *string `json:"message" name:"message"`
|
|
|
|
Action *string `json:"action" name:"action" location:"elements"`
|
|
|
|
JobID *string `json:"job_id" name:"job_id" location:"elements"`
|
|
|
|
RDBs []*string `json:"rdbs" name:"rdbs" location:"elements"`
|
|
|
|
RetCode *int `json:"ret_code" name:"ret_code" location:"elements"`
|
2016-12-03 09:42:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Documentation URL: https://docs.qingcloud.com/api/rdb/describe_rdb_parameters.html
|
|
|
|
func (s *RDBService) DescribeRDBParameters(i *DescribeRDBParametersInput) (*DescribeRDBParametersOutput, error) {
|
|
|
|
if i == nil {
|
|
|
|
i = &DescribeRDBParametersInput{}
|
|
|
|
}
|
|
|
|
o := &data.Operation{
|
|
|
|
Config: s.Config,
|
|
|
|
Properties: s.Properties,
|
|
|
|
APIName: "DescribeRDBParameters",
|
|
|
|
RequestMethod: "GET",
|
|
|
|
}
|
|
|
|
|
|
|
|
x := &DescribeRDBParametersOutput{}
|
|
|
|
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 DescribeRDBParametersInput struct {
|
2017-01-05 14:03:55 +00:00
|
|
|
Limit *int `json:"limit" name:"limit" location:"params"`
|
|
|
|
Offset *int `json:"offset" name:"offset" location:"params"`
|
|
|
|
ParameterGroup *string `json:"parameter_group" name:"parameter_group" location:"params"`
|
|
|
|
RDB *string `json:"rdb" name:"rdb" location:"params"` // Required
|
2016-12-03 09:42:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (v *DescribeRDBParametersInput) Validate() error {
|
|
|
|
|
2017-01-05 14:03:55 +00:00
|
|
|
if v.RDB == nil {
|
|
|
|
return errors.ParameterRequiredError{
|
2016-12-03 09:42:26 +00:00
|
|
|
ParameterName: "RDB",
|
|
|
|
ParentName: "DescribeRDBParametersInput",
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
type DescribeRDBParametersOutput struct {
|
2017-01-05 14:03:55 +00:00
|
|
|
Message *string `json:"message" name:"message"`
|
|
|
|
Action *string `json:"action" name:"action" location:"elements"`
|
2016-12-03 09:42:26 +00:00
|
|
|
ParameterSet []*RDBParameter `json:"parameter_set" name:"parameter_set" location:"elements"`
|
2017-01-05 14:03:55 +00:00
|
|
|
RetCode *int `json:"ret_code" name:"ret_code" location:"elements"`
|
|
|
|
TotalCount *int `json:"total_count" name:"total_count" location:"elements"`
|
2016-12-03 09:42:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Documentation URL: https://docs.qingcloud.com/api/rdb/describe_rdbs.html
|
|
|
|
func (s *RDBService) DescribeRDBs(i *DescribeRDBsInput) (*DescribeRDBsOutput, error) {
|
|
|
|
if i == nil {
|
|
|
|
i = &DescribeRDBsInput{}
|
|
|
|
}
|
|
|
|
o := &data.Operation{
|
|
|
|
Config: s.Config,
|
|
|
|
Properties: s.Properties,
|
|
|
|
APIName: "DescribeRDBs",
|
|
|
|
RequestMethod: "GET",
|
|
|
|
}
|
|
|
|
|
|
|
|
x := &DescribeRDBsOutput{}
|
|
|
|
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 DescribeRDBsInput struct {
|
2017-01-05 14:03:55 +00:00
|
|
|
Limit *int `json:"limit" name:"limit" location:"params"`
|
|
|
|
Offset *int `json:"offset" name:"offset" location:"params"`
|
2019-07-14 02:27:58 +00:00
|
|
|
ProjectID *string `json:"project_id" name:"project_id" location:"params"`
|
2017-01-05 14:03:55 +00:00
|
|
|
RDBEngine *string `json:"rdb_engine" name:"rdb_engine" location:"params"`
|
|
|
|
RDBName *string `json:"rdb_name" name:"rdb_name" location:"params"`
|
|
|
|
RDBs []*string `json:"rdbs" name:"rdbs" location:"params"`
|
|
|
|
SearchWord *string `json:"search_word" name:"search_word" location:"params"`
|
|
|
|
Status []*string `json:"status" name:"status" location:"params"`
|
|
|
|
Tags []*string `json:"tags" name:"tags" location:"params"`
|
|
|
|
Verbose *int `json:"verbose" name:"verbose" location:"params"`
|
2016-12-03 09:42:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (v *DescribeRDBsInput) Validate() error {
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
type DescribeRDBsOutput struct {
|
2017-01-05 14:03:55 +00:00
|
|
|
Message *string `json:"message" name:"message"`
|
|
|
|
Action *string `json:"action" name:"action" location:"elements"`
|
|
|
|
RDBSet []*RDB `json:"rdb_set" name:"rdb_set" location:"elements"`
|
|
|
|
RetCode *int `json:"ret_code" name:"ret_code" location:"elements"`
|
|
|
|
TotalCount *int `json:"total_count" name:"total_count" location:"elements"`
|
2016-12-03 09:42:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Documentation URL: https://docs.qingcloud.com/api/rdb/get_rdb_instance_files.html
|
|
|
|
func (s *RDBService) GetRDBInstanceFiles(i *GetRDBInstanceFilesInput) (*GetRDBInstanceFilesOutput, error) {
|
|
|
|
if i == nil {
|
|
|
|
i = &GetRDBInstanceFilesInput{}
|
|
|
|
}
|
|
|
|
o := &data.Operation{
|
|
|
|
Config: s.Config,
|
|
|
|
Properties: s.Properties,
|
|
|
|
APIName: "GetRDBInstanceFiles",
|
|
|
|
RequestMethod: "GET",
|
|
|
|
}
|
|
|
|
|
|
|
|
x := &GetRDBInstanceFilesOutput{}
|
|
|
|
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 GetRDBInstanceFilesInput struct {
|
2017-01-05 14:03:55 +00:00
|
|
|
RDBInstance *string `json:"rdb_instance" name:"rdb_instance" location:"params"` // Required
|
2016-12-03 09:42:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (v *GetRDBInstanceFilesInput) Validate() error {
|
|
|
|
|
2017-01-05 14:03:55 +00:00
|
|
|
if v.RDBInstance == nil {
|
|
|
|
return errors.ParameterRequiredError{
|
2016-12-03 09:42:26 +00:00
|
|
|
ParameterName: "RDBInstance",
|
|
|
|
ParentName: "GetRDBInstanceFilesInput",
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
type GetRDBInstanceFilesOutput struct {
|
2017-01-05 14:03:55 +00:00
|
|
|
Message *string `json:"message" name:"message"`
|
|
|
|
Action *string `json:"action" name:"action" location:"elements"`
|
2016-12-03 09:42:26 +00:00
|
|
|
Files *RDBFile `json:"files" name:"files" location:"elements"`
|
2017-01-05 14:03:55 +00:00
|
|
|
RDBInstance *string `json:"rdb_instance" name:"rdb_instance" location:"elements"`
|
|
|
|
RetCode *int `json:"ret_code" name:"ret_code" location:"elements"`
|
2016-12-03 09:42:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Documentation URL: https://docs.qingcloud.com/api/monitor/get_rdb_monitor.html
|
|
|
|
func (s *RDBService) GetRDBMonitor(i *GetRDBMonitorInput) (*GetRDBMonitorOutput, error) {
|
|
|
|
if i == nil {
|
|
|
|
i = &GetRDBMonitorInput{}
|
|
|
|
}
|
|
|
|
o := &data.Operation{
|
|
|
|
Config: s.Config,
|
|
|
|
Properties: s.Properties,
|
|
|
|
APIName: "GetRDBMonitor",
|
|
|
|
RequestMethod: "GET",
|
|
|
|
}
|
|
|
|
|
|
|
|
x := &GetRDBMonitorOutput{}
|
|
|
|
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 GetRDBMonitorInput struct {
|
2017-01-05 14:03:55 +00:00
|
|
|
EndTime *time.Time `json:"end_time" name:"end_time" format:"ISO 8601" location:"params"` // Required
|
|
|
|
Meters []*string `json:"meters" name:"meters" location:"params"` // Required
|
|
|
|
RDBEngine *string `json:"rdb_engine" name:"rdb_engine" location:"params"` // Required
|
|
|
|
RDBInstance *string `json:"rdb_instance" name:"rdb_instance" location:"params"`
|
|
|
|
Resource *string `json:"resource" name:"resource" location:"params"` // Required
|
|
|
|
Role *string `json:"role" name:"role" location:"params"` // Required
|
|
|
|
StartTime *time.Time `json:"start_time" name:"start_time" format:"ISO 8601" location:"params"` // Required
|
2016-12-03 09:42:26 +00:00
|
|
|
// Step's available values: 5m, 15m, 2h, 1d
|
2017-01-05 14:03:55 +00:00
|
|
|
Step *string `json:"step" name:"step" location:"params"` // Required
|
2016-12-03 09:42:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (v *GetRDBMonitorInput) Validate() error {
|
|
|
|
|
|
|
|
if len(v.Meters) == 0 {
|
2017-01-05 14:03:55 +00:00
|
|
|
return errors.ParameterRequiredError{
|
2016-12-03 09:42:26 +00:00
|
|
|
ParameterName: "Meters",
|
|
|
|
ParentName: "GetRDBMonitorInput",
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-01-05 14:03:55 +00:00
|
|
|
if v.RDBEngine == nil {
|
|
|
|
return errors.ParameterRequiredError{
|
2016-12-03 09:42:26 +00:00
|
|
|
ParameterName: "RDBEngine",
|
|
|
|
ParentName: "GetRDBMonitorInput",
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-01-05 14:03:55 +00:00
|
|
|
if v.Resource == nil {
|
|
|
|
return errors.ParameterRequiredError{
|
2016-12-03 09:42:26 +00:00
|
|
|
ParameterName: "Resource",
|
|
|
|
ParentName: "GetRDBMonitorInput",
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-01-05 14:03:55 +00:00
|
|
|
if v.Role == nil {
|
|
|
|
return errors.ParameterRequiredError{
|
2016-12-03 09:42:26 +00:00
|
|
|
ParameterName: "Role",
|
|
|
|
ParentName: "GetRDBMonitorInput",
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-01-05 14:03:55 +00:00
|
|
|
if v.Step == nil {
|
|
|
|
return errors.ParameterRequiredError{
|
2016-12-03 09:42:26 +00:00
|
|
|
ParameterName: "Step",
|
|
|
|
ParentName: "GetRDBMonitorInput",
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-01-05 14:03:55 +00:00
|
|
|
if v.Step != nil {
|
2016-12-03 09:42:26 +00:00
|
|
|
stepValidValues := []string{"5m", "15m", "2h", "1d"}
|
2017-01-05 14:03:55 +00:00
|
|
|
stepParameterValue := fmt.Sprint(*v.Step)
|
2016-12-03 09:42:26 +00:00
|
|
|
|
|
|
|
stepIsValid := false
|
|
|
|
for _, value := range stepValidValues {
|
|
|
|
if value == stepParameterValue {
|
|
|
|
stepIsValid = true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if !stepIsValid {
|
2017-01-05 14:03:55 +00:00
|
|
|
return errors.ParameterValueNotAllowedError{
|
2016-12-03 09:42:26 +00:00
|
|
|
ParameterName: "Step",
|
|
|
|
ParameterValue: stepParameterValue,
|
|
|
|
AllowedValues: stepValidValues,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
type GetRDBMonitorOutput struct {
|
2017-01-05 14:03:55 +00:00
|
|
|
Message *string `json:"message" name:"message"`
|
|
|
|
Action *string `json:"action" name:"action" location:"elements"`
|
2016-12-03 09:42:26 +00:00
|
|
|
MeterSet []*Meter `json:"meter_set" name:"meter_set" location:"elements"`
|
2017-01-05 14:03:55 +00:00
|
|
|
ResourceID *string `json:"resource_id" name:"resource_id" location:"elements"`
|
|
|
|
RetCode *int `json:"ret_code" name:"ret_code" location:"elements"`
|
2016-12-03 09:42:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Documentation URL: https://docs.qingcloud.com/api/rdb/modify_rdb_parameters.html
|
|
|
|
func (s *RDBService) ModifyRDBParameters(i *ModifyRDBParametersInput) (*ModifyRDBParametersOutput, error) {
|
|
|
|
if i == nil {
|
|
|
|
i = &ModifyRDBParametersInput{}
|
|
|
|
}
|
|
|
|
o := &data.Operation{
|
|
|
|
Config: s.Config,
|
|
|
|
Properties: s.Properties,
|
|
|
|
APIName: "ModifyRDBParameters",
|
|
|
|
RequestMethod: "GET",
|
|
|
|
}
|
|
|
|
|
|
|
|
x := &ModifyRDBParametersOutput{}
|
|
|
|
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 ModifyRDBParametersInput struct {
|
|
|
|
Parameters []*RDBParameters `json:"parameters" name:"parameters" location:"params"`
|
2017-01-05 14:03:55 +00:00
|
|
|
RDB *string `json:"rdb" name:"rdb" location:"params"` // Required
|
2016-12-03 09:42:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (v *ModifyRDBParametersInput) Validate() error {
|
|
|
|
|
|
|
|
if len(v.Parameters) > 0 {
|
|
|
|
for _, property := range v.Parameters {
|
|
|
|
if err := property.Validate(); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-01-05 14:03:55 +00:00
|
|
|
if v.RDB == nil {
|
|
|
|
return errors.ParameterRequiredError{
|
2016-12-03 09:42:26 +00:00
|
|
|
ParameterName: "RDB",
|
|
|
|
ParentName: "ModifyRDBParametersInput",
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
type ModifyRDBParametersOutput struct {
|
2017-01-05 14:03:55 +00:00
|
|
|
Message *string `json:"message" name:"message"`
|
|
|
|
Action *string `json:"action" name:"action" location:"elements"`
|
|
|
|
RDB *string `json:"rdb" name:"rdb" location:"elements"`
|
|
|
|
RetCode *int `json:"ret_code" name:"ret_code" location:"elements"`
|
2016-12-03 09:42:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Documentation URL: https://docs.qingcloud.com/api/rdb/rdbs_join_vxnet.html
|
|
|
|
func (s *RDBService) RDBsJoinVxNet(i *RDBsJoinVxNetInput) (*RDBsJoinVxNetOutput, error) {
|
|
|
|
if i == nil {
|
|
|
|
i = &RDBsJoinVxNetInput{}
|
|
|
|
}
|
|
|
|
o := &data.Operation{
|
|
|
|
Config: s.Config,
|
|
|
|
Properties: s.Properties,
|
|
|
|
APIName: "RDBsJoinVxnet",
|
|
|
|
RequestMethod: "GET",
|
|
|
|
}
|
|
|
|
|
|
|
|
x := &RDBsJoinVxNetOutput{}
|
|
|
|
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 RDBsJoinVxNetInput struct {
|
2017-01-05 14:03:55 +00:00
|
|
|
RDBs []*string `json:"rdbs" name:"rdbs" location:"params"` // Required
|
|
|
|
VxNet *string `json:"vxnet" name:"vxnet" location:"params"` // Required
|
2016-12-03 09:42:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (v *RDBsJoinVxNetInput) Validate() error {
|
|
|
|
|
|
|
|
if len(v.RDBs) == 0 {
|
2017-01-05 14:03:55 +00:00
|
|
|
return errors.ParameterRequiredError{
|
2016-12-03 09:42:26 +00:00
|
|
|
ParameterName: "RDBs",
|
|
|
|
ParentName: "RDBsJoinVxNetInput",
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-01-05 14:03:55 +00:00
|
|
|
if v.VxNet == nil {
|
|
|
|
return errors.ParameterRequiredError{
|
2016-12-03 09:42:26 +00:00
|
|
|
ParameterName: "VxNet",
|
|
|
|
ParentName: "RDBsJoinVxNetInput",
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
type RDBsJoinVxNetOutput struct {
|
2017-01-05 14:03:55 +00:00
|
|
|
Message *string `json:"message" name:"message"`
|
|
|
|
Action *string `json:"action" name:"action" location:"elements"`
|
|
|
|
JobID *string `json:"job_id" name:"job_id" location:"elements"`
|
|
|
|
RDBs []*string `json:"rdbs" name:"rdbs" location:"elements"`
|
|
|
|
RetCode *int `json:"ret_code" name:"ret_code" location:"elements"`
|
|
|
|
VxNet *string `json:"vxnet" name:"vxnet" location:"elements"`
|
2016-12-03 09:42:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Documentation URL: https://docs.qingcloud.com/api/rdb/rdbs_leave_vxnet.html
|
|
|
|
func (s *RDBService) RDBsLeaveVxNet(i *RDBsLeaveVxNetInput) (*RDBsLeaveVxNetOutput, error) {
|
|
|
|
if i == nil {
|
|
|
|
i = &RDBsLeaveVxNetInput{}
|
|
|
|
}
|
|
|
|
o := &data.Operation{
|
|
|
|
Config: s.Config,
|
|
|
|
Properties: s.Properties,
|
|
|
|
APIName: "RDBsLeaveVxnet",
|
|
|
|
RequestMethod: "GET",
|
|
|
|
}
|
|
|
|
|
|
|
|
x := &RDBsLeaveVxNetOutput{}
|
|
|
|
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 RDBsLeaveVxNetInput struct {
|
2017-01-05 14:03:55 +00:00
|
|
|
RDBs []*string `json:"rdbs" name:"rdbs" location:"params"` // Required
|
|
|
|
VxNet *string `json:"vxnet" name:"vxnet" location:"params"` // Required
|
2016-12-03 09:42:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (v *RDBsLeaveVxNetInput) Validate() error {
|
|
|
|
|
|
|
|
if len(v.RDBs) == 0 {
|
2017-01-05 14:03:55 +00:00
|
|
|
return errors.ParameterRequiredError{
|
2016-12-03 09:42:26 +00:00
|
|
|
ParameterName: "RDBs",
|
|
|
|
ParentName: "RDBsLeaveVxNetInput",
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-01-05 14:03:55 +00:00
|
|
|
if v.VxNet == nil {
|
|
|
|
return errors.ParameterRequiredError{
|
2016-12-03 09:42:26 +00:00
|
|
|
ParameterName: "VxNet",
|
|
|
|
ParentName: "RDBsLeaveVxNetInput",
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
type RDBsLeaveVxNetOutput struct {
|
2017-01-05 14:03:55 +00:00
|
|
|
Message *string `json:"message" name:"message"`
|
|
|
|
Action *string `json:"action" name:"action" location:"elements"`
|
|
|
|
JobID *string `json:"job_id" name:"job_id" location:"elements"`
|
|
|
|
RetCode *int `json:"ret_code" name:"ret_code" location:"elements"`
|
2016-12-03 09:42:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Documentation URL: https://docs.qingcloud.com/api/rdb/resize_rdbs.html
|
|
|
|
func (s *RDBService) ResizeRDBs(i *ResizeRDBsInput) (*ResizeRDBsOutput, error) {
|
|
|
|
if i == nil {
|
|
|
|
i = &ResizeRDBsInput{}
|
|
|
|
}
|
|
|
|
o := &data.Operation{
|
|
|
|
Config: s.Config,
|
|
|
|
Properties: s.Properties,
|
|
|
|
APIName: "ResizeRDBs",
|
|
|
|
RequestMethod: "GET",
|
|
|
|
}
|
|
|
|
|
|
|
|
x := &ResizeRDBsOutput{}
|
|
|
|
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 ResizeRDBsInput struct {
|
|
|
|
|
|
|
|
// RDBType's available values: 1, 2, 4, 8, 16, 32
|
2017-01-05 14:03:55 +00:00
|
|
|
RDBType *int `json:"rdb_type" name:"rdb_type" location:"params"`
|
|
|
|
RDBs []*string `json:"rdbs" name:"rdbs" location:"params"` // Required
|
|
|
|
StorageSize *int `json:"storage_size" name:"storage_size" location:"params"`
|
2016-12-03 09:42:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (v *ResizeRDBsInput) Validate() error {
|
|
|
|
|
2017-01-05 14:03:55 +00:00
|
|
|
if v.RDBType != nil {
|
2016-12-03 09:42:26 +00:00
|
|
|
rdbTypeValidValues := []string{"1", "2", "4", "8", "16", "32"}
|
2017-01-05 14:03:55 +00:00
|
|
|
rdbTypeParameterValue := fmt.Sprint(*v.RDBType)
|
2016-12-03 09:42:26 +00:00
|
|
|
|
|
|
|
rdbTypeIsValid := false
|
|
|
|
for _, value := range rdbTypeValidValues {
|
|
|
|
if value == rdbTypeParameterValue {
|
|
|
|
rdbTypeIsValid = true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if !rdbTypeIsValid {
|
2017-01-05 14:03:55 +00:00
|
|
|
return errors.ParameterValueNotAllowedError{
|
2016-12-03 09:42:26 +00:00
|
|
|
ParameterName: "RDBType",
|
|
|
|
ParameterValue: rdbTypeParameterValue,
|
|
|
|
AllowedValues: rdbTypeValidValues,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if len(v.RDBs) == 0 {
|
2017-01-05 14:03:55 +00:00
|
|
|
return errors.ParameterRequiredError{
|
2016-12-03 09:42:26 +00:00
|
|
|
ParameterName: "RDBs",
|
|
|
|
ParentName: "ResizeRDBsInput",
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
type ResizeRDBsOutput struct {
|
2017-01-05 14:03:55 +00:00
|
|
|
Message *string `json:"message" name:"message"`
|
|
|
|
Action *string `json:"action" name:"action" location:"elements"`
|
|
|
|
JobID *string `json:"job_id" name:"job_id" location:"elements"`
|
|
|
|
RDBs []*string `json:"rdbs" name:"rdbs" location:"elements"`
|
|
|
|
RetCode *int `json:"ret_code" name:"ret_code" location:"elements"`
|
2016-12-03 09:42:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Documentation URL: https://docs.qingcloud.com/api/rdb/start_rdbs.html
|
|
|
|
func (s *RDBService) StartRDBs(i *StartRDBsInput) (*StartRDBsOutput, error) {
|
|
|
|
if i == nil {
|
|
|
|
i = &StartRDBsInput{}
|
|
|
|
}
|
|
|
|
o := &data.Operation{
|
|
|
|
Config: s.Config,
|
|
|
|
Properties: s.Properties,
|
|
|
|
APIName: "StartRDBs",
|
|
|
|
RequestMethod: "GET",
|
|
|
|
}
|
|
|
|
|
|
|
|
x := &StartRDBsOutput{}
|
|
|
|
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 StartRDBsInput struct {
|
2017-01-05 14:03:55 +00:00
|
|
|
RDBs []*string `json:"rdbs" name:"rdbs" location:"params"` // Required
|
2016-12-03 09:42:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (v *StartRDBsInput) Validate() error {
|
|
|
|
|
|
|
|
if len(v.RDBs) == 0 {
|
2017-01-05 14:03:55 +00:00
|
|
|
return errors.ParameterRequiredError{
|
2016-12-03 09:42:26 +00:00
|
|
|
ParameterName: "RDBs",
|
|
|
|
ParentName: "StartRDBsInput",
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
type StartRDBsOutput struct {
|
2017-01-05 14:03:55 +00:00
|
|
|
Message *string `json:"message" name:"message"`
|
|
|
|
Action *string `json:"action" name:"action" location:"elements"`
|
|
|
|
JobID *string `json:"job_id" name:"job_id" location:"elements"`
|
|
|
|
RDBs []*string `json:"rdbs" name:"rdbs" location:"elements"`
|
|
|
|
RetCode *int `json:"ret_code" name:"ret_code" location:"elements"`
|
2016-12-03 09:42:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Documentation URL: https://docs.qingcloud.com/api/rdb/stop_rdbs.html
|
|
|
|
func (s *RDBService) StopRDBs(i *StopRDBsInput) (*StopRDBsOutput, error) {
|
|
|
|
if i == nil {
|
|
|
|
i = &StopRDBsInput{}
|
|
|
|
}
|
|
|
|
o := &data.Operation{
|
|
|
|
Config: s.Config,
|
|
|
|
Properties: s.Properties,
|
|
|
|
APIName: "StopRDBs",
|
|
|
|
RequestMethod: "GET",
|
|
|
|
}
|
|
|
|
|
|
|
|
x := &StopRDBsOutput{}
|
|
|
|
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 StopRDBsInput struct {
|
2017-01-05 14:03:55 +00:00
|
|
|
RDBs []*string `json:"rdbs" name:"rdbs" location:"params"` // Required
|
2016-12-03 09:42:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (v *StopRDBsInput) Validate() error {
|
|
|
|
|
|
|
|
if len(v.RDBs) == 0 {
|
2017-01-05 14:03:55 +00:00
|
|
|
return errors.ParameterRequiredError{
|
2016-12-03 09:42:26 +00:00
|
|
|
ParameterName: "RDBs",
|
|
|
|
ParentName: "StopRDBsInput",
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
type StopRDBsOutput struct {
|
2017-01-05 14:03:55 +00:00
|
|
|
Message *string `json:"message" name:"message"`
|
|
|
|
Action *string `json:"action" name:"action" location:"elements"`
|
|
|
|
JobID *string `json:"job_id" name:"job_id" location:"elements"`
|
|
|
|
RDBs []*string `json:"rdbs" name:"rdbs" location:"elements"`
|
|
|
|
RetCode *int `json:"ret_code" name:"ret_code" location:"elements"`
|
2016-12-03 09:42:26 +00:00
|
|
|
}
|