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 RouterService struct {
|
|
|
|
Config *config.Config
|
|
|
|
Properties *RouterServiceProperties
|
|
|
|
}
|
|
|
|
|
|
|
|
type RouterServiceProperties 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) Router(zone string) (*RouterService, error) {
|
|
|
|
properties := &RouterServiceProperties{
|
2017-01-05 14:03:55 +00:00
|
|
|
Zone: &zone,
|
2016-12-03 09:42:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return &RouterService{Config: s.Config, Properties: properties}, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
// Documentation URL: https://docs.qingcloud.com/api/router/add_router_static_entries.html
|
|
|
|
func (s *RouterService) AddRouterStaticEntries(i *AddRouterStaticEntriesInput) (*AddRouterStaticEntriesOutput, error) {
|
|
|
|
if i == nil {
|
|
|
|
i = &AddRouterStaticEntriesInput{}
|
|
|
|
}
|
|
|
|
o := &data.Operation{
|
|
|
|
Config: s.Config,
|
|
|
|
Properties: s.Properties,
|
|
|
|
APIName: "AddRouterStaticEntries",
|
|
|
|
RequestMethod: "GET",
|
|
|
|
}
|
|
|
|
|
|
|
|
x := &AddRouterStaticEntriesOutput{}
|
|
|
|
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 AddRouterStaticEntriesInput struct {
|
|
|
|
Entries []*RouterStaticEntry `json:"entries" name:"entries" location:"params"`
|
2017-01-05 14:03:55 +00:00
|
|
|
RouterStatic *string `json:"router_static" name:"router_static" location:"params"` // Required
|
2016-12-03 09:42:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (v *AddRouterStaticEntriesInput) Validate() error {
|
|
|
|
|
|
|
|
if len(v.Entries) > 0 {
|
|
|
|
for _, property := range v.Entries {
|
|
|
|
if err := property.Validate(); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-01-05 14:03:55 +00:00
|
|
|
if v.RouterStatic == nil {
|
|
|
|
return errors.ParameterRequiredError{
|
2016-12-03 09:42:26 +00:00
|
|
|
ParameterName: "RouterStatic",
|
|
|
|
ParentName: "AddRouterStaticEntriesInput",
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
type AddRouterStaticEntriesOutput struct {
|
2017-01-05 14:03:55 +00:00
|
|
|
Message *string `json:"message" name:"message"`
|
|
|
|
Action *string `json:"action" name:"action" location:"elements"`
|
|
|
|
RetCode *int `json:"ret_code" name:"ret_code" location:"elements"`
|
|
|
|
RouterStaticEntries []*string `json:"router_static_entries" name:"router_static_entries" location:"elements"`
|
2016-12-03 09:42:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Documentation URL: https://docs.qingcloud.com/api/router/add_router_statics.html
|
|
|
|
func (s *RouterService) AddRouterStatics(i *AddRouterStaticsInput) (*AddRouterStaticsOutput, error) {
|
|
|
|
if i == nil {
|
|
|
|
i = &AddRouterStaticsInput{}
|
|
|
|
}
|
|
|
|
o := &data.Operation{
|
|
|
|
Config: s.Config,
|
|
|
|
Properties: s.Properties,
|
|
|
|
APIName: "AddRouterStatics",
|
|
|
|
RequestMethod: "GET",
|
|
|
|
}
|
|
|
|
|
|
|
|
x := &AddRouterStaticsOutput{}
|
|
|
|
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 AddRouterStaticsInput struct {
|
2017-01-05 14:03:55 +00:00
|
|
|
Router *string `json:"router" name:"router" location:"params"` // Required
|
2016-12-03 09:42:26 +00:00
|
|
|
Statics []*RouterStatic `json:"statics" name:"statics" location:"params"` // Required
|
2017-01-05 14:03:55 +00:00
|
|
|
VxNet *string `json:"vxnet" name:"vxnet" location:"params"`
|
2016-12-03 09:42:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (v *AddRouterStaticsInput) Validate() error {
|
|
|
|
|
2017-01-05 14:03:55 +00:00
|
|
|
if v.Router == nil {
|
|
|
|
return errors.ParameterRequiredError{
|
2016-12-03 09:42:26 +00:00
|
|
|
ParameterName: "Router",
|
|
|
|
ParentName: "AddRouterStaticsInput",
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if len(v.Statics) == 0 {
|
2017-01-05 14:03:55 +00:00
|
|
|
return errors.ParameterRequiredError{
|
2016-12-03 09:42:26 +00:00
|
|
|
ParameterName: "Statics",
|
|
|
|
ParentName: "AddRouterStaticsInput",
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if len(v.Statics) > 0 {
|
|
|
|
for _, property := range v.Statics {
|
|
|
|
if err := property.Validate(); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
type AddRouterStaticsOutput struct {
|
2017-01-05 14:03:55 +00:00
|
|
|
Message *string `json:"message" name:"message"`
|
|
|
|
Action *string `json:"action" name:"action" location:"elements"`
|
|
|
|
RetCode *int `json:"ret_code" name:"ret_code" location:"elements"`
|
|
|
|
RouterStatics []*string `json:"router_statics" name:"router_statics" location:"elements"`
|
2016-12-03 09:42:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Documentation URL: https://docs.qingcloud.com/api/router/create_routers.html
|
|
|
|
func (s *RouterService) CreateRouters(i *CreateRoutersInput) (*CreateRoutersOutput, error) {
|
|
|
|
if i == nil {
|
|
|
|
i = &CreateRoutersInput{}
|
|
|
|
}
|
|
|
|
o := &data.Operation{
|
|
|
|
Config: s.Config,
|
|
|
|
Properties: s.Properties,
|
|
|
|
APIName: "CreateRouters",
|
|
|
|
RequestMethod: "GET",
|
|
|
|
}
|
|
|
|
|
|
|
|
x := &CreateRoutersOutput{}
|
|
|
|
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 CreateRoutersInput struct {
|
2017-01-05 14:03:55 +00:00
|
|
|
Count *int `json:"count" name:"count" default:"1" location:"params"`
|
|
|
|
RouterName *string `json:"router_name" name:"router_name" location:"params"`
|
2016-12-03 09:42:26 +00:00
|
|
|
// RouterType's available values: 0, 1, 2, 3
|
2017-01-05 14:03:55 +00:00
|
|
|
RouterType *int `json:"router_type" name:"router_type" default:"1" location:"params"`
|
|
|
|
SecurityGroup *string `json:"security_group" name:"security_group" location:"params"`
|
|
|
|
VpcNetwork *string `json:"vpc_network" name:"vpc_network" location:"params"`
|
2016-12-03 09:42:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (v *CreateRoutersInput) Validate() error {
|
|
|
|
|
2017-01-05 14:03:55 +00:00
|
|
|
if v.RouterType != nil {
|
2016-12-03 09:42:26 +00:00
|
|
|
routerTypeValidValues := []string{"0", "1", "2", "3"}
|
2017-01-05 14:03:55 +00:00
|
|
|
routerTypeParameterValue := fmt.Sprint(*v.RouterType)
|
2016-12-03 09:42:26 +00:00
|
|
|
|
|
|
|
routerTypeIsValid := false
|
|
|
|
for _, value := range routerTypeValidValues {
|
|
|
|
if value == routerTypeParameterValue {
|
|
|
|
routerTypeIsValid = true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if !routerTypeIsValid {
|
2017-01-05 14:03:55 +00:00
|
|
|
return errors.ParameterValueNotAllowedError{
|
2016-12-03 09:42:26 +00:00
|
|
|
ParameterName: "RouterType",
|
|
|
|
ParameterValue: routerTypeParameterValue,
|
|
|
|
AllowedValues: routerTypeValidValues,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
type CreateRoutersOutput 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"`
|
|
|
|
Routers []*string `json:"routers" name:"routers" location:"elements"`
|
2016-12-03 09:42:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Documentation URL: https://docs.qingcloud.com/api/router/delete_router_static_entries.html
|
|
|
|
func (s *RouterService) DeleteRouterStaticEntries(i *DeleteRouterStaticEntriesInput) (*DeleteRouterStaticEntriesOutput, error) {
|
|
|
|
if i == nil {
|
|
|
|
i = &DeleteRouterStaticEntriesInput{}
|
|
|
|
}
|
|
|
|
o := &data.Operation{
|
|
|
|
Config: s.Config,
|
|
|
|
Properties: s.Properties,
|
|
|
|
APIName: "DeleteRouterStaticEntries",
|
|
|
|
RequestMethod: "GET",
|
|
|
|
}
|
|
|
|
|
|
|
|
x := &DeleteRouterStaticEntriesOutput{}
|
|
|
|
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 DeleteRouterStaticEntriesInput struct {
|
2017-01-05 14:03:55 +00:00
|
|
|
RouterStaticEntries []*string `json:"router_static_entries" name:"router_static_entries" location:"params"` // Required
|
2016-12-03 09:42:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (v *DeleteRouterStaticEntriesInput) Validate() error {
|
|
|
|
|
|
|
|
if len(v.RouterStaticEntries) == 0 {
|
2017-01-05 14:03:55 +00:00
|
|
|
return errors.ParameterRequiredError{
|
2016-12-03 09:42:26 +00:00
|
|
|
ParameterName: "RouterStaticEntries",
|
|
|
|
ParentName: "DeleteRouterStaticEntriesInput",
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
type DeleteRouterStaticEntriesOutput struct {
|
2017-01-05 14:03:55 +00:00
|
|
|
Message *string `json:"message" name:"message"`
|
|
|
|
Action *string `json:"action" name:"action" location:"elements"`
|
|
|
|
RetCode *int `json:"ret_code" name:"ret_code" location:"elements"`
|
|
|
|
RouterStaticEntries []*string `json:"router_static_entries" name:"router_static_entries" location:"elements"`
|
2016-12-03 09:42:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Documentation URL: https://docs.qingcloud.com/api/router/delete_router_statics.html
|
|
|
|
func (s *RouterService) DeleteRouterStatics(i *DeleteRouterStaticsInput) (*DeleteRouterStaticsOutput, error) {
|
|
|
|
if i == nil {
|
|
|
|
i = &DeleteRouterStaticsInput{}
|
|
|
|
}
|
|
|
|
o := &data.Operation{
|
|
|
|
Config: s.Config,
|
|
|
|
Properties: s.Properties,
|
|
|
|
APIName: "DeleteRouterStatics",
|
|
|
|
RequestMethod: "GET",
|
|
|
|
}
|
|
|
|
|
|
|
|
x := &DeleteRouterStaticsOutput{}
|
|
|
|
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 DeleteRouterStaticsInput struct {
|
2017-01-05 14:03:55 +00:00
|
|
|
RouterStatics []*string `json:"router_statics" name:"router_statics" location:"params"` // Required
|
2016-12-03 09:42:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (v *DeleteRouterStaticsInput) Validate() error {
|
|
|
|
|
|
|
|
if len(v.RouterStatics) == 0 {
|
2017-01-05 14:03:55 +00:00
|
|
|
return errors.ParameterRequiredError{
|
2016-12-03 09:42:26 +00:00
|
|
|
ParameterName: "RouterStatics",
|
|
|
|
ParentName: "DeleteRouterStaticsInput",
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
type DeleteRouterStaticsOutput struct {
|
2017-01-05 14:03:55 +00:00
|
|
|
Message *string `json:"message" name:"message"`
|
|
|
|
Action *string `json:"action" name:"action" location:"elements"`
|
|
|
|
RetCode *int `json:"ret_code" name:"ret_code" location:"elements"`
|
|
|
|
RouterStatics []*string `json:"router_statics" name:"router_statics" location:"elements"`
|
2016-12-03 09:42:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Documentation URL: https://docs.qingcloud.com/api/router/delete_routers.html
|
|
|
|
func (s *RouterService) DeleteRouters(i *DeleteRoutersInput) (*DeleteRoutersOutput, error) {
|
|
|
|
if i == nil {
|
|
|
|
i = &DeleteRoutersInput{}
|
|
|
|
}
|
|
|
|
o := &data.Operation{
|
|
|
|
Config: s.Config,
|
|
|
|
Properties: s.Properties,
|
|
|
|
APIName: "DeleteRouters",
|
|
|
|
RequestMethod: "GET",
|
|
|
|
}
|
|
|
|
|
|
|
|
x := &DeleteRoutersOutput{}
|
|
|
|
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 DeleteRoutersInput struct {
|
2017-01-05 14:03:55 +00:00
|
|
|
Routers []*string `json:"routers" name:"routers" location:"params"` // Required
|
2016-12-03 09:42:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (v *DeleteRoutersInput) Validate() error {
|
|
|
|
|
|
|
|
if len(v.Routers) == 0 {
|
2017-01-05 14:03:55 +00:00
|
|
|
return errors.ParameterRequiredError{
|
2016-12-03 09:42:26 +00:00
|
|
|
ParameterName: "Routers",
|
|
|
|
ParentName: "DeleteRoutersInput",
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
type DeleteRoutersOutput 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"`
|
|
|
|
Routers []*string `json:"routers" name:"routers" location:"elements"`
|
2016-12-03 09:42:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Documentation URL: https://docs.qingcloud.com/api/router/describe_router_static_entries.html
|
|
|
|
func (s *RouterService) DescribeRouterStaticEntries(i *DescribeRouterStaticEntriesInput) (*DescribeRouterStaticEntriesOutput, error) {
|
|
|
|
if i == nil {
|
|
|
|
i = &DescribeRouterStaticEntriesInput{}
|
|
|
|
}
|
|
|
|
o := &data.Operation{
|
|
|
|
Config: s.Config,
|
|
|
|
Properties: s.Properties,
|
|
|
|
APIName: "DescribeRouterStaticEntries",
|
|
|
|
RequestMethod: "GET",
|
|
|
|
}
|
|
|
|
|
|
|
|
x := &DescribeRouterStaticEntriesOutput{}
|
|
|
|
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 DescribeRouterStaticEntriesInput 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"`
|
2018-08-16 08:13:35 +00:00
|
|
|
Owner *string `json:"owner" name:"owner" location:"params"`
|
2017-01-05 14:03:55 +00:00
|
|
|
RouterStatic *string `json:"router_static" name:"router_static" location:"params"`
|
2018-06-21 16:53:39 +00:00
|
|
|
RouterStaticEntries *string `json:"router_static_entries" name:"router_static_entries" location:"params"`
|
2016-12-03 09:42:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (v *DescribeRouterStaticEntriesInput) Validate() error {
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
type DescribeRouterStaticEntriesOutput struct {
|
2017-01-05 14:03:55 +00:00
|
|
|
Message *string `json:"message" name:"message"`
|
|
|
|
Action *string `json:"action" name:"action" location:"elements"`
|
|
|
|
RetCode *int `json:"ret_code" name:"ret_code" location:"elements"`
|
2016-12-03 09:42:26 +00:00
|
|
|
RouterStaticEntrySet []*RouterStaticEntry `json:"router_static_entry_set" name:"router_static_entry_set" location:"elements"`
|
2017-01-05 14:03:55 +00:00
|
|
|
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/router/describe_router_statics.html
|
|
|
|
func (s *RouterService) DescribeRouterStatics(i *DescribeRouterStaticsInput) (*DescribeRouterStaticsOutput, error) {
|
|
|
|
if i == nil {
|
|
|
|
i = &DescribeRouterStaticsInput{}
|
|
|
|
}
|
|
|
|
o := &data.Operation{
|
|
|
|
Config: s.Config,
|
|
|
|
Properties: s.Properties,
|
|
|
|
APIName: "DescribeRouterStatics",
|
|
|
|
RequestMethod: "GET",
|
|
|
|
}
|
|
|
|
|
|
|
|
x := &DescribeRouterStaticsOutput{}
|
|
|
|
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 DescribeRouterStaticsInput struct {
|
2017-01-05 14:03:55 +00:00
|
|
|
Limit *int `json:"limit" name:"limit" default:"20" location:"params"`
|
|
|
|
Offset *int `json:"offset" name:"offset" default:"0" location:"params"`
|
2018-08-16 08:13:35 +00:00
|
|
|
Owner *string `json:"owner" name:"owner" location:"params"`
|
2017-01-05 14:03:55 +00:00
|
|
|
Router *string `json:"router" name:"router" location:"params"` // Required
|
|
|
|
RouterStatics []*string `json:"router_statics" name:"router_statics" location:"params"`
|
2016-12-03 09:42:26 +00:00
|
|
|
// StaticType's available values: 1, 2, 3, 4, 5, 6, 7, 8
|
2017-01-05 14:03:55 +00:00
|
|
|
StaticType *int `json:"static_type" name:"static_type" location:"params"`
|
2016-12-03 09:42:26 +00:00
|
|
|
// Verbose's available values: 0, 1
|
2017-01-05 14:03:55 +00:00
|
|
|
Verbose *int `json:"verbose" name:"verbose" location:"params"`
|
|
|
|
VxNet *string `json:"vxnet" name:"vxnet" location:"params"`
|
2016-12-03 09:42:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (v *DescribeRouterStaticsInput) Validate() error {
|
|
|
|
|
2017-01-05 14:03:55 +00:00
|
|
|
if v.Router == nil {
|
|
|
|
return errors.ParameterRequiredError{
|
2016-12-03 09:42:26 +00:00
|
|
|
ParameterName: "Router",
|
|
|
|
ParentName: "DescribeRouterStaticsInput",
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-01-05 14:03:55 +00:00
|
|
|
if v.StaticType != nil {
|
2016-12-03 09:42:26 +00:00
|
|
|
staticTypeValidValues := []string{"1", "2", "3", "4", "5", "6", "7", "8"}
|
2017-01-05 14:03:55 +00:00
|
|
|
staticTypeParameterValue := fmt.Sprint(*v.StaticType)
|
2016-12-03 09:42:26 +00:00
|
|
|
|
|
|
|
staticTypeIsValid := false
|
|
|
|
for _, value := range staticTypeValidValues {
|
|
|
|
if value == staticTypeParameterValue {
|
|
|
|
staticTypeIsValid = true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if !staticTypeIsValid {
|
2017-01-05 14:03:55 +00:00
|
|
|
return errors.ParameterValueNotAllowedError{
|
2016-12-03 09:42:26 +00:00
|
|
|
ParameterName: "StaticType",
|
|
|
|
ParameterValue: staticTypeParameterValue,
|
|
|
|
AllowedValues: staticTypeValidValues,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-01-05 14:03:55 +00:00
|
|
|
if v.Verbose != nil {
|
2016-12-03 09:42:26 +00:00
|
|
|
verboseValidValues := []string{"0", "1"}
|
2017-01-05 14:03:55 +00:00
|
|
|
verboseParameterValue := fmt.Sprint(*v.Verbose)
|
2016-12-03 09:42:26 +00:00
|
|
|
|
|
|
|
verboseIsValid := false
|
|
|
|
for _, value := range verboseValidValues {
|
|
|
|
if value == verboseParameterValue {
|
|
|
|
verboseIsValid = true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if !verboseIsValid {
|
2017-01-05 14:03:55 +00:00
|
|
|
return errors.ParameterValueNotAllowedError{
|
2016-12-03 09:42:26 +00:00
|
|
|
ParameterName: "Verbose",
|
|
|
|
ParameterValue: verboseParameterValue,
|
|
|
|
AllowedValues: verboseValidValues,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
type DescribeRouterStaticsOutput struct {
|
2017-01-05 14:03:55 +00:00
|
|
|
Message *string `json:"message" name:"message"`
|
|
|
|
Action *string `json:"action" name:"action" location:"elements"`
|
|
|
|
RetCode *int `json:"ret_code" name:"ret_code" location:"elements"`
|
2016-12-03 09:42:26 +00:00
|
|
|
RouterStaticSet []*RouterStatic `json:"router_static_set" name:"router_static_set" location:"elements"`
|
2017-01-05 14:03:55 +00:00
|
|
|
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/router/describe_router_vxnets.html
|
|
|
|
func (s *RouterService) DescribeRouterVxNets(i *DescribeRouterVxNetsInput) (*DescribeRouterVxNetsOutput, error) {
|
|
|
|
if i == nil {
|
|
|
|
i = &DescribeRouterVxNetsInput{}
|
|
|
|
}
|
|
|
|
o := &data.Operation{
|
|
|
|
Config: s.Config,
|
|
|
|
Properties: s.Properties,
|
|
|
|
APIName: "DescribeRouterVxnets",
|
|
|
|
RequestMethod: "GET",
|
|
|
|
}
|
|
|
|
|
|
|
|
x := &DescribeRouterVxNetsOutput{}
|
|
|
|
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 DescribeRouterVxNetsInput struct {
|
2017-01-05 14:03:55 +00:00
|
|
|
Limit *int `json:"limit" name:"limit" default:"20" location:"params"`
|
|
|
|
Offset *int `json:"offset" name:"offset" default:"0" location:"params"`
|
|
|
|
Router *string `json:"router" name:"router" location:"params"` // Required
|
2016-12-03 09:42:26 +00:00
|
|
|
// Verbose's available values: 0, 1
|
2017-01-05 14:03:55 +00:00
|
|
|
Verbose *int `json:"verbose" name:"verbose" location:"params"`
|
|
|
|
VxNet *string `json:"vxnet" name:"vxnet" location:"params"`
|
2016-12-03 09:42:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (v *DescribeRouterVxNetsInput) Validate() error {
|
|
|
|
|
2017-01-05 14:03:55 +00:00
|
|
|
if v.Router == nil {
|
|
|
|
return errors.ParameterRequiredError{
|
2016-12-03 09:42:26 +00:00
|
|
|
ParameterName: "Router",
|
|
|
|
ParentName: "DescribeRouterVxNetsInput",
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-01-05 14:03:55 +00:00
|
|
|
if v.Verbose != nil {
|
2016-12-03 09:42:26 +00:00
|
|
|
verboseValidValues := []string{"0", "1"}
|
2017-01-05 14:03:55 +00:00
|
|
|
verboseParameterValue := fmt.Sprint(*v.Verbose)
|
2016-12-03 09:42:26 +00:00
|
|
|
|
|
|
|
verboseIsValid := false
|
|
|
|
for _, value := range verboseValidValues {
|
|
|
|
if value == verboseParameterValue {
|
|
|
|
verboseIsValid = true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if !verboseIsValid {
|
2017-01-05 14:03:55 +00:00
|
|
|
return errors.ParameterValueNotAllowedError{
|
2016-12-03 09:42:26 +00:00
|
|
|
ParameterName: "Verbose",
|
|
|
|
ParameterValue: verboseParameterValue,
|
|
|
|
AllowedValues: verboseValidValues,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
type DescribeRouterVxNetsOutput struct {
|
2017-01-05 14:03:55 +00:00
|
|
|
Message *string `json:"message" name:"message"`
|
|
|
|
Action *string `json:"action" name:"action" location:"elements"`
|
|
|
|
RetCode *int `json:"ret_code" name:"ret_code" location:"elements"`
|
2016-12-03 09:42:26 +00:00
|
|
|
RouterVxNetSet []*RouterVxNet `json:"router_vxnet_set" name:"router_vxnet_set" location:"elements"`
|
2017-01-05 14:03:55 +00:00
|
|
|
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/router/describe_routers.html
|
|
|
|
func (s *RouterService) DescribeRouters(i *DescribeRoutersInput) (*DescribeRoutersOutput, error) {
|
|
|
|
if i == nil {
|
|
|
|
i = &DescribeRoutersInput{}
|
|
|
|
}
|
|
|
|
o := &data.Operation{
|
|
|
|
Config: s.Config,
|
|
|
|
Properties: s.Properties,
|
|
|
|
APIName: "DescribeRouters",
|
|
|
|
RequestMethod: "GET",
|
|
|
|
}
|
|
|
|
|
|
|
|
x := &DescribeRoutersOutput{}
|
|
|
|
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 DescribeRoutersInput 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"`
|
2018-08-16 08:13:35 +00:00
|
|
|
Owner *string `json:"owner" name:"owner" 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
|
|
|
Routers []*string `json:"routers" name:"routers" 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"`
|
2016-12-03 09:42:26 +00:00
|
|
|
// Verbose's available values: 0, 1
|
2017-01-05 14:03:55 +00:00
|
|
|
Verbose *int `json:"verbose" name:"verbose" location:"params"`
|
|
|
|
VxNet *string `json:"vxnet" name:"vxnet" location:"params"`
|
2016-12-03 09:42:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (v *DescribeRoutersInput) Validate() error {
|
|
|
|
|
2017-01-05 14:03:55 +00:00
|
|
|
if v.Verbose != nil {
|
2016-12-03 09:42:26 +00:00
|
|
|
verboseValidValues := []string{"0", "1"}
|
2017-01-05 14:03:55 +00:00
|
|
|
verboseParameterValue := fmt.Sprint(*v.Verbose)
|
2016-12-03 09:42:26 +00:00
|
|
|
|
|
|
|
verboseIsValid := false
|
|
|
|
for _, value := range verboseValidValues {
|
|
|
|
if value == verboseParameterValue {
|
|
|
|
verboseIsValid = true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if !verboseIsValid {
|
2017-01-05 14:03:55 +00:00
|
|
|
return errors.ParameterValueNotAllowedError{
|
2016-12-03 09:42:26 +00:00
|
|
|
ParameterName: "Verbose",
|
|
|
|
ParameterValue: verboseParameterValue,
|
|
|
|
AllowedValues: verboseValidValues,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
type DescribeRoutersOutput struct {
|
2017-01-05 14:03:55 +00:00
|
|
|
Message *string `json:"message" name:"message"`
|
|
|
|
Action *string `json:"action" name:"action" location:"elements"`
|
|
|
|
RetCode *int `json:"ret_code" name:"ret_code" location:"elements"`
|
2016-12-03 09:42:26 +00:00
|
|
|
RouterSet []*Router `json:"router_set" name:"router_set" location:"elements"`
|
2017-01-05 14:03:55 +00:00
|
|
|
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/monitor/get_monitor.html
|
|
|
|
func (s *RouterService) GetRouterMonitor(i *GetRouterMonitorInput) (*GetRouterMonitorOutput, error) {
|
|
|
|
if i == nil {
|
|
|
|
i = &GetRouterMonitorInput{}
|
|
|
|
}
|
|
|
|
o := &data.Operation{
|
|
|
|
Config: s.Config,
|
|
|
|
Properties: s.Properties,
|
|
|
|
APIName: "GetMonitor",
|
|
|
|
RequestMethod: "GET",
|
|
|
|
}
|
|
|
|
|
|
|
|
x := &GetRouterMonitorOutput{}
|
|
|
|
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 GetRouterMonitorInput 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
|
|
|
|
Resource *string `json:"resource" name:"resource" 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 *GetRouterMonitorInput) 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: "GetRouterMonitorInput",
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
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: "GetRouterMonitorInput",
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
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: "GetRouterMonitorInput",
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
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 GetRouterMonitorOutput 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
|
|
|
}
|
|
|
|
|
2017-12-22 07:13:11 +00:00
|
|
|
// Documentation URL: https://docs.qingcloud.com/api/router/get_vpn_certs.html
|
2017-12-21 12:30:18 +00:00
|
|
|
func (s *RouterService) GetVPNCerts(i *GetVPNCertsInput) (*GetVPNCertsOutput, error) {
|
|
|
|
if i == nil {
|
|
|
|
i = &GetVPNCertsInput{}
|
|
|
|
}
|
|
|
|
o := &data.Operation{
|
|
|
|
Config: s.Config,
|
|
|
|
Properties: s.Properties,
|
|
|
|
APIName: "GetVPNCerts",
|
|
|
|
RequestMethod: "GET",
|
|
|
|
}
|
|
|
|
|
|
|
|
x := &GetVPNCertsOutput{}
|
|
|
|
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 GetVPNCertsInput struct {
|
2017-12-22 07:13:11 +00:00
|
|
|
|
|
|
|
// Platform's available values: windows, linux, mac
|
|
|
|
Platform *string `json:"platform" name:"platform" location:"params"`
|
|
|
|
Router *string `json:"router" name:"router" location:"params"` // Required
|
2017-12-21 12:30:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (v *GetVPNCertsInput) Validate() error {
|
|
|
|
|
2017-12-22 07:13:11 +00:00
|
|
|
if v.Platform != nil {
|
|
|
|
platformValidValues := []string{"windows", "linux", "mac"}
|
|
|
|
platformParameterValue := fmt.Sprint(*v.Platform)
|
|
|
|
|
|
|
|
platformIsValid := false
|
|
|
|
for _, value := range platformValidValues {
|
|
|
|
if value == platformParameterValue {
|
|
|
|
platformIsValid = true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if !platformIsValid {
|
|
|
|
return errors.ParameterValueNotAllowedError{
|
|
|
|
ParameterName: "Platform",
|
|
|
|
ParameterValue: platformParameterValue,
|
|
|
|
AllowedValues: platformValidValues,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-12-21 12:30:18 +00:00
|
|
|
if v.Router == nil {
|
|
|
|
return errors.ParameterRequiredError{
|
|
|
|
ParameterName: "Router",
|
|
|
|
ParentName: "GetVPNCertsInput",
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
type GetVPNCertsOutput struct {
|
2018-06-21 16:53:39 +00:00
|
|
|
Message *string `json:"message" name:"message"`
|
|
|
|
Action *string `json:"action" name:"action" location:"elements"`
|
|
|
|
CaCert *string `json:"ca_cert" name:"ca_cert" location:"elements"`
|
|
|
|
ClientCrt *string `json:"client_crt" name:"client_crt" location:"elements"`
|
|
|
|
ClientKey *string `json:"client_key" name:"client_key" location:"elements"`
|
|
|
|
LinuxConfSample *string `json:"linux_conf_sample" name:"linux_conf_sample" location:"elements"`
|
|
|
|
MacConfSample *string `json:"mac_conf_sample" name:"mac_conf_sample" location:"elements"`
|
|
|
|
// Platform's available values: linux, windows, mac
|
|
|
|
Platform *string `json:"platform" name:"platform" location:"elements"`
|
2017-12-21 12:30:18 +00:00
|
|
|
RetCode *int `json:"ret_code" name:"ret_code" location:"elements"`
|
|
|
|
RouterID *string `json:"router_id" name:"router_id" location:"elements"`
|
|
|
|
StaticKey *string `json:"static_key" name:"static_key" location:"elements"`
|
|
|
|
WindowsConfSample *string `json:"windows_conf_sample" name:"windows_conf_sample" location:"elements"`
|
|
|
|
}
|
|
|
|
|
2016-12-03 09:42:26 +00:00
|
|
|
// Documentation URL: https://docs.qingcloud.com/api/router/join_router.html
|
|
|
|
func (s *RouterService) JoinRouter(i *JoinRouterInput) (*JoinRouterOutput, error) {
|
|
|
|
if i == nil {
|
|
|
|
i = &JoinRouterInput{}
|
|
|
|
}
|
|
|
|
o := &data.Operation{
|
|
|
|
Config: s.Config,
|
|
|
|
Properties: s.Properties,
|
|
|
|
APIName: "JoinRouter",
|
|
|
|
RequestMethod: "GET",
|
|
|
|
}
|
|
|
|
|
|
|
|
x := &JoinRouterOutput{}
|
|
|
|
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 JoinRouterInput struct {
|
2017-01-05 14:03:55 +00:00
|
|
|
DYNIPEnd *string `json:"dyn_ip_end" name:"dyn_ip_end" location:"params"`
|
|
|
|
DYNIPStart *string `json:"dyn_ip_start" name:"dyn_ip_start" location:"params"`
|
2016-12-03 09:42:26 +00:00
|
|
|
// Features's available values: 1
|
2017-01-05 14:03:55 +00:00
|
|
|
Features *int `json:"features" name:"features" default:"1" location:"params"`
|
|
|
|
IPNetwork *string `json:"ip_network" name:"ip_network" location:"params"` // Required
|
|
|
|
ManagerIP *string `json:"manager_ip" name:"manager_ip" location:"params"`
|
|
|
|
Router *string `json:"router" name:"router" location:"params"` // Required
|
|
|
|
VxNet *string `json:"vxnet" name:"vxnet" location:"params"` // Required
|
2016-12-03 09:42:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (v *JoinRouterInput) Validate() error {
|
|
|
|
|
2017-01-05 14:03:55 +00:00
|
|
|
if v.Features != nil {
|
2016-12-03 09:42:26 +00:00
|
|
|
featuresValidValues := []string{"1"}
|
2017-01-05 14:03:55 +00:00
|
|
|
featuresParameterValue := fmt.Sprint(*v.Features)
|
2016-12-03 09:42:26 +00:00
|
|
|
|
|
|
|
featuresIsValid := false
|
|
|
|
for _, value := range featuresValidValues {
|
|
|
|
if value == featuresParameterValue {
|
|
|
|
featuresIsValid = true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if !featuresIsValid {
|
2017-01-05 14:03:55 +00:00
|
|
|
return errors.ParameterValueNotAllowedError{
|
2016-12-03 09:42:26 +00:00
|
|
|
ParameterName: "Features",
|
|
|
|
ParameterValue: featuresParameterValue,
|
|
|
|
AllowedValues: featuresValidValues,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-01-05 14:03:55 +00:00
|
|
|
if v.IPNetwork == nil {
|
|
|
|
return errors.ParameterRequiredError{
|
2016-12-03 09:42:26 +00:00
|
|
|
ParameterName: "IPNetwork",
|
|
|
|
ParentName: "JoinRouterInput",
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-01-05 14:03:55 +00:00
|
|
|
if v.Router == nil {
|
|
|
|
return errors.ParameterRequiredError{
|
2016-12-03 09:42:26 +00:00
|
|
|
ParameterName: "Router",
|
|
|
|
ParentName: "JoinRouterInput",
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
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: "JoinRouterInput",
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
type JoinRouterOutput 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"`
|
|
|
|
RouterID *string `json:"router_id" name:"router_id" location:"elements"`
|
|
|
|
VxNetID *string `json:"vxnet_id" name:"vxnet_id" location:"elements"`
|
2016-12-03 09:42:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Documentation URL: https://docs.qingcloud.com/api/router/leave_router.html
|
|
|
|
func (s *RouterService) LeaveRouter(i *LeaveRouterInput) (*LeaveRouterOutput, error) {
|
|
|
|
if i == nil {
|
|
|
|
i = &LeaveRouterInput{}
|
|
|
|
}
|
|
|
|
o := &data.Operation{
|
|
|
|
Config: s.Config,
|
|
|
|
Properties: s.Properties,
|
|
|
|
APIName: "LeaveRouter",
|
|
|
|
RequestMethod: "GET",
|
|
|
|
}
|
|
|
|
|
|
|
|
x := &LeaveRouterOutput{}
|
|
|
|
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 LeaveRouterInput struct {
|
2017-01-05 14:03:55 +00:00
|
|
|
Router *string `json:"router" name:"router" location:"params"` // Required
|
|
|
|
VxNets []*string `json:"vxnets" name:"vxnets" location:"params"` // Required
|
2016-12-03 09:42:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (v *LeaveRouterInput) Validate() error {
|
|
|
|
|
2017-01-05 14:03:55 +00:00
|
|
|
if v.Router == nil {
|
|
|
|
return errors.ParameterRequiredError{
|
2016-12-03 09:42:26 +00:00
|
|
|
ParameterName: "Router",
|
|
|
|
ParentName: "LeaveRouterInput",
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if len(v.VxNets) == 0 {
|
2017-01-05 14:03:55 +00:00
|
|
|
return errors.ParameterRequiredError{
|
2016-12-03 09:42:26 +00:00
|
|
|
ParameterName: "VxNets",
|
|
|
|
ParentName: "LeaveRouterInput",
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
type LeaveRouterOutput 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"`
|
|
|
|
RouterID *string `json:"router_id" name:"router_id" location:"elements"`
|
|
|
|
VxNets []*string `json:"vxnets" name:"vxnets" location:"elements"`
|
2016-12-03 09:42:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Documentation URL: https://docs.qingcloud.com/api/router/modify_router_attributes.html
|
|
|
|
func (s *RouterService) ModifyRouterAttributes(i *ModifyRouterAttributesInput) (*ModifyRouterAttributesOutput, error) {
|
|
|
|
if i == nil {
|
|
|
|
i = &ModifyRouterAttributesInput{}
|
|
|
|
}
|
|
|
|
o := &data.Operation{
|
|
|
|
Config: s.Config,
|
|
|
|
Properties: s.Properties,
|
|
|
|
APIName: "ModifyRouterAttributes",
|
|
|
|
RequestMethod: "GET",
|
|
|
|
}
|
|
|
|
|
|
|
|
x := &ModifyRouterAttributesOutput{}
|
|
|
|
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 ModifyRouterAttributesInput struct {
|
2017-01-05 14:03:55 +00:00
|
|
|
Description *string `json:"description" name:"description" location:"params"`
|
|
|
|
DYNIPEnd *string `json:"dyn_ip_end" name:"dyn_ip_end" location:"params"`
|
|
|
|
DYNIPStart *string `json:"dyn_ip_start" name:"dyn_ip_start" location:"params"`
|
|
|
|
EIP *string `json:"eip" name:"eip" location:"params"`
|
2016-12-03 09:42:26 +00:00
|
|
|
// Features's available values: 1, 2
|
2017-01-05 14:03:55 +00:00
|
|
|
Features *int `json:"features" name:"features" location:"params"`
|
|
|
|
Router *string `json:"router" name:"router" location:"params"` // Required
|
|
|
|
RouterName *string `json:"router_name" name:"router_name" location:"params"`
|
|
|
|
SecurityGroup *string `json:"security_group" name:"security_group" location:"params"`
|
|
|
|
VxNet *string `json:"vxnet" name:"vxnet" location:"params"`
|
2016-12-03 09:42:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (v *ModifyRouterAttributesInput) Validate() error {
|
|
|
|
|
2017-01-05 14:03:55 +00:00
|
|
|
if v.Features != nil {
|
2016-12-03 09:42:26 +00:00
|
|
|
featuresValidValues := []string{"1", "2"}
|
2017-01-05 14:03:55 +00:00
|
|
|
featuresParameterValue := fmt.Sprint(*v.Features)
|
2016-12-03 09:42:26 +00:00
|
|
|
|
|
|
|
featuresIsValid := false
|
|
|
|
for _, value := range featuresValidValues {
|
|
|
|
if value == featuresParameterValue {
|
|
|
|
featuresIsValid = true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if !featuresIsValid {
|
2017-01-05 14:03:55 +00:00
|
|
|
return errors.ParameterValueNotAllowedError{
|
2016-12-03 09:42:26 +00:00
|
|
|
ParameterName: "Features",
|
|
|
|
ParameterValue: featuresParameterValue,
|
|
|
|
AllowedValues: featuresValidValues,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-01-05 14:03:55 +00:00
|
|
|
if v.Router == nil {
|
|
|
|
return errors.ParameterRequiredError{
|
2016-12-03 09:42:26 +00:00
|
|
|
ParameterName: "Router",
|
|
|
|
ParentName: "ModifyRouterAttributesInput",
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
type ModifyRouterAttributesOutput struct {
|
2017-01-05 14:03:55 +00:00
|
|
|
Message *string `json:"message" name:"message"`
|
|
|
|
Action *string `json:"action" name:"action" 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/router/modify_router_static_attributes.html
|
|
|
|
func (s *RouterService) ModifyRouterStaticAttributes(i *ModifyRouterStaticAttributesInput) (*ModifyRouterStaticAttributesOutput, error) {
|
|
|
|
if i == nil {
|
|
|
|
i = &ModifyRouterStaticAttributesInput{}
|
|
|
|
}
|
|
|
|
o := &data.Operation{
|
|
|
|
Config: s.Config,
|
|
|
|
Properties: s.Properties,
|
|
|
|
APIName: "ModifyRouterStaticAttributes",
|
|
|
|
RequestMethod: "GET",
|
|
|
|
}
|
|
|
|
|
|
|
|
x := &ModifyRouterStaticAttributesOutput{}
|
|
|
|
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 ModifyRouterStaticAttributesInput struct {
|
2017-01-05 14:03:55 +00:00
|
|
|
RouterStatic *string `json:"router_static" name:"router_static" location:"params"` // Required
|
|
|
|
RouterStaticName *string `json:"router_static_name" name:"router_static_name" location:"params"`
|
|
|
|
Val1 *string `json:"val1" name:"val1" location:"params"`
|
|
|
|
Val2 *string `json:"val2" name:"val2" location:"params"`
|
|
|
|
Val3 *string `json:"val3" name:"val3" location:"params"`
|
|
|
|
Val4 *string `json:"val4" name:"val4" location:"params"`
|
|
|
|
Val5 *string `json:"val5" name:"val5" location:"params"`
|
|
|
|
Val6 *string `json:"val6" name:"val6" location:"params"`
|
2018-06-21 16:53:39 +00:00
|
|
|
Val7 *string `json:"val7" name:"val7" location:"params"`
|
|
|
|
Val8 *string `json:"val8" name:"val8" location:"params"`
|
|
|
|
Val9 *string `json:"val9" name:"val9" location:"params"`
|
2016-12-03 09:42:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (v *ModifyRouterStaticAttributesInput) Validate() error {
|
|
|
|
|
2017-01-05 14:03:55 +00:00
|
|
|
if v.RouterStatic == nil {
|
|
|
|
return errors.ParameterRequiredError{
|
2016-12-03 09:42:26 +00:00
|
|
|
ParameterName: "RouterStatic",
|
|
|
|
ParentName: "ModifyRouterStaticAttributesInput",
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
type ModifyRouterStaticAttributesOutput struct {
|
2017-01-05 14:03:55 +00:00
|
|
|
Message *string `json:"message" name:"message"`
|
|
|
|
Action *string `json:"action" name:"action" location:"elements"`
|
|
|
|
RetCode *int `json:"ret_code" name:"ret_code" location:"elements"`
|
|
|
|
RouterStaticID *string `json:"router_static_id" name:"router_static_id" location:"elements"`
|
2016-12-03 09:42:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Documentation URL: https://docs.qingcloud.com/api/router/modify_router_static_entry_attributes.html
|
|
|
|
func (s *RouterService) ModifyRouterStaticEntryAttributes(i *ModifyRouterStaticEntryAttributesInput) (*ModifyRouterStaticEntryAttributesOutput, error) {
|
|
|
|
if i == nil {
|
|
|
|
i = &ModifyRouterStaticEntryAttributesInput{}
|
|
|
|
}
|
|
|
|
o := &data.Operation{
|
|
|
|
Config: s.Config,
|
|
|
|
Properties: s.Properties,
|
|
|
|
APIName: "ModifyRouterStaticEntryAttributes",
|
|
|
|
RequestMethod: "GET",
|
|
|
|
}
|
|
|
|
|
|
|
|
x := &ModifyRouterStaticEntryAttributesOutput{}
|
|
|
|
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 ModifyRouterStaticEntryAttributesInput struct {
|
2017-01-05 14:03:55 +00:00
|
|
|
RouterStaticEntry *string `json:"router_static_entry" name:"router_static_entry" location:"params"` // Required
|
|
|
|
RouterStaticEntryName *string `json:"router_static_entry_name" name:"router_static_entry_name" location:"params"`
|
|
|
|
Val1 *string `json:"val1" name:"val1" location:"params"`
|
|
|
|
Val2 *string `json:"val2" name:"val2" location:"params"`
|
2016-12-03 09:42:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (v *ModifyRouterStaticEntryAttributesInput) Validate() error {
|
|
|
|
|
2017-01-05 14:03:55 +00:00
|
|
|
if v.RouterStaticEntry == nil {
|
|
|
|
return errors.ParameterRequiredError{
|
2016-12-03 09:42:26 +00:00
|
|
|
ParameterName: "RouterStaticEntry",
|
|
|
|
ParentName: "ModifyRouterStaticEntryAttributesInput",
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
type ModifyRouterStaticEntryAttributesOutput struct {
|
2017-01-05 14:03:55 +00:00
|
|
|
Message *string `json:"message" name:"message"`
|
|
|
|
Action *string `json:"action" name:"action" location:"elements"`
|
|
|
|
RetCode *int `json:"ret_code" name:"ret_code" location:"elements"`
|
|
|
|
RouterStaticEntry *string `json:"router_static_entry" name:"router_static_entry" location:"elements"`
|
2016-12-03 09:42:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Documentation URL: https://docs.qingcloud.com/api/router/poweroff_routers.html
|
|
|
|
func (s *RouterService) PowerOffRouters(i *PowerOffRoutersInput) (*PowerOffRoutersOutput, error) {
|
|
|
|
if i == nil {
|
|
|
|
i = &PowerOffRoutersInput{}
|
|
|
|
}
|
|
|
|
o := &data.Operation{
|
|
|
|
Config: s.Config,
|
|
|
|
Properties: s.Properties,
|
|
|
|
APIName: "PowerOffRouters",
|
|
|
|
RequestMethod: "GET",
|
|
|
|
}
|
|
|
|
|
|
|
|
x := &PowerOffRoutersOutput{}
|
|
|
|
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 PowerOffRoutersInput struct {
|
2017-01-05 14:03:55 +00:00
|
|
|
Routers []*string `json:"routers" name:"routers" location:"params"` // Required
|
2016-12-03 09:42:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (v *PowerOffRoutersInput) Validate() error {
|
|
|
|
|
|
|
|
if len(v.Routers) == 0 {
|
2017-01-05 14:03:55 +00:00
|
|
|
return errors.ParameterRequiredError{
|
2016-12-03 09:42:26 +00:00
|
|
|
ParameterName: "Routers",
|
|
|
|
ParentName: "PowerOffRoutersInput",
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
type PowerOffRoutersOutput 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/router/poweron_routers.html
|
|
|
|
func (s *RouterService) PowerOnRouters(i *PowerOnRoutersInput) (*PowerOnRoutersOutput, error) {
|
|
|
|
if i == nil {
|
|
|
|
i = &PowerOnRoutersInput{}
|
|
|
|
}
|
|
|
|
o := &data.Operation{
|
|
|
|
Config: s.Config,
|
|
|
|
Properties: s.Properties,
|
|
|
|
APIName: "PowerOnRouters",
|
|
|
|
RequestMethod: "GET",
|
|
|
|
}
|
|
|
|
|
|
|
|
x := &PowerOnRoutersOutput{}
|
|
|
|
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 PowerOnRoutersInput struct {
|
2017-01-05 14:03:55 +00:00
|
|
|
Routers []*string `json:"routers" name:"routers" location:"params"` // Required
|
2016-12-03 09:42:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (v *PowerOnRoutersInput) Validate() error {
|
|
|
|
|
|
|
|
if len(v.Routers) == 0 {
|
2017-01-05 14:03:55 +00:00
|
|
|
return errors.ParameterRequiredError{
|
2016-12-03 09:42:26 +00:00
|
|
|
ParameterName: "Routers",
|
|
|
|
ParentName: "PowerOnRoutersInput",
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
type PowerOnRoutersOutput 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/router/update_routers.html
|
|
|
|
func (s *RouterService) UpdateRouters(i *UpdateRoutersInput) (*UpdateRoutersOutput, error) {
|
|
|
|
if i == nil {
|
|
|
|
i = &UpdateRoutersInput{}
|
|
|
|
}
|
|
|
|
o := &data.Operation{
|
|
|
|
Config: s.Config,
|
|
|
|
Properties: s.Properties,
|
|
|
|
APIName: "UpdateRouters",
|
|
|
|
RequestMethod: "GET",
|
|
|
|
}
|
|
|
|
|
|
|
|
x := &UpdateRoutersOutput{}
|
|
|
|
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 UpdateRoutersInput struct {
|
2017-01-05 14:03:55 +00:00
|
|
|
Routers []*string `json:"routers" name:"routers" location:"params"` // Required
|
2016-12-03 09:42:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (v *UpdateRoutersInput) Validate() error {
|
|
|
|
|
|
|
|
if len(v.Routers) == 0 {
|
2017-01-05 14:03:55 +00:00
|
|
|
return errors.ParameterRequiredError{
|
2016-12-03 09:42:26 +00:00
|
|
|
ParameterName: "Routers",
|
|
|
|
ParentName: "UpdateRoutersInput",
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
type UpdateRoutersOutput 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
|
|
|
}
|