CreateVpc.go 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. // Copyright 2018 JDCLOUD.COM
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. //
  15. // NOTE: This class is auto generated by the jdcloud code generator program.
  16. package apis
  17. import (
  18. "github.com/jdcloud-api/jdcloud-sdk-go/core"
  19. )
  20. type CreateVpcRequest struct {
  21. core.JDCloudRequest
  22. /* Region ID */
  23. RegionId string `json:"regionId"`
  24. /* 私有网络名称,只允许输入中文、数字、大小写字母、英文下划线“_”及中划线“-”,不允许为空且不超过32字符。 */
  25. VpcName string `json:"vpcName"`
  26. /* 如果为空,则不限制网段,如果不为空,10.0.0.0/8、172.16.0.0/12和192.168.0.0/16及它们包含的子网,且子网掩码长度为16-28之间 (Optional) */
  27. AddressPrefix *string `json:"addressPrefix"`
  28. /* vpc描述,允许输入UTF-8编码下的全部字符,不超过256字符。 (Optional) */
  29. Description *string `json:"description"`
  30. }
  31. /*
  32. * param regionId: Region ID (Required)
  33. * param vpcName: 私有网络名称,只允许输入中文、数字、大小写字母、英文下划线“_”及中划线“-”,不允许为空且不超过32字符。 (Required)
  34. *
  35. * @Deprecated, not compatible when mandatory parameters changed
  36. */
  37. func NewCreateVpcRequest(
  38. regionId string,
  39. vpcName string,
  40. ) *CreateVpcRequest {
  41. return &CreateVpcRequest{
  42. JDCloudRequest: core.JDCloudRequest{
  43. URL: "/regions/{regionId}/vpcs/",
  44. Method: "POST",
  45. Header: nil,
  46. Version: "v1",
  47. },
  48. RegionId: regionId,
  49. VpcName: vpcName,
  50. }
  51. }
  52. /*
  53. * param regionId: Region ID (Required)
  54. * param vpcName: 私有网络名称,只允许输入中文、数字、大小写字母、英文下划线“_”及中划线“-”,不允许为空且不超过32字符。 (Required)
  55. * param addressPrefix: 如果为空,则不限制网段,如果不为空,10.0.0.0/8、172.16.0.0/12和192.168.0.0/16及它们包含的子网,且子网掩码长度为16-28之间 (Optional)
  56. * param description: vpc描述,允许输入UTF-8编码下的全部字符,不超过256字符。 (Optional)
  57. */
  58. func NewCreateVpcRequestWithAllParams(
  59. regionId string,
  60. vpcName string,
  61. addressPrefix *string,
  62. description *string,
  63. ) *CreateVpcRequest {
  64. return &CreateVpcRequest{
  65. JDCloudRequest: core.JDCloudRequest{
  66. URL: "/regions/{regionId}/vpcs/",
  67. Method: "POST",
  68. Header: nil,
  69. Version: "v1",
  70. },
  71. RegionId: regionId,
  72. VpcName: vpcName,
  73. AddressPrefix: addressPrefix,
  74. Description: description,
  75. }
  76. }
  77. /* This constructor has better compatible ability when API parameters changed */
  78. func NewCreateVpcRequestWithoutParam() *CreateVpcRequest {
  79. return &CreateVpcRequest{
  80. JDCloudRequest: core.JDCloudRequest{
  81. URL: "/regions/{regionId}/vpcs/",
  82. Method: "POST",
  83. Header: nil,
  84. Version: "v1",
  85. },
  86. }
  87. }
  88. /* param regionId: Region ID(Required) */
  89. func (r *CreateVpcRequest) SetRegionId(regionId string) {
  90. r.RegionId = regionId
  91. }
  92. /* param vpcName: 私有网络名称,只允许输入中文、数字、大小写字母、英文下划线“_”及中划线“-”,不允许为空且不超过32字符。(Required) */
  93. func (r *CreateVpcRequest) SetVpcName(vpcName string) {
  94. r.VpcName = vpcName
  95. }
  96. /* param addressPrefix: 如果为空,则不限制网段,如果不为空,10.0.0.0/8、172.16.0.0/12和192.168.0.0/16及它们包含的子网,且子网掩码长度为16-28之间(Optional) */
  97. func (r *CreateVpcRequest) SetAddressPrefix(addressPrefix string) {
  98. r.AddressPrefix = &addressPrefix
  99. }
  100. /* param description: vpc描述,允许输入UTF-8编码下的全部字符,不超过256字符。(Optional) */
  101. func (r *CreateVpcRequest) SetDescription(description string) {
  102. r.Description = &description
  103. }
  104. // GetRegionId returns path parameter 'regionId' if exist,
  105. // otherwise return empty string
  106. func (r CreateVpcRequest) GetRegionId() string {
  107. return r.RegionId
  108. }
  109. type CreateVpcResponse struct {
  110. RequestID string `json:"requestId"`
  111. Error core.ErrorResponse `json:"error"`
  112. Result CreateVpcResult `json:"result"`
  113. }
  114. type CreateVpcResult struct {
  115. VpcId string `json:"vpcId"`
  116. }