DescribeKeypairs.go 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  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. vm "github.com/jdcloud-api/jdcloud-sdk-go/services/vm/models"
  20. common "github.com/jdcloud-api/jdcloud-sdk-go/services/common/models"
  21. )
  22. type DescribeKeypairsRequest struct {
  23. core.JDCloudRequest
  24. /* 地域ID */
  25. RegionId string `json:"regionId"`
  26. /* 页码;默认为1 (Optional) */
  27. PageNumber *int `json:"pageNumber"`
  28. /* 分页大小;默认为20;取值范围[10, 100] (Optional) */
  29. PageSize *int `json:"pageSize"`
  30. /* keyNames - 密钥对名称,精确匹配,支持多个
  31. (Optional) */
  32. Filters []common.Filter `json:"filters"`
  33. }
  34. /*
  35. * param regionId: 地域ID (Required)
  36. *
  37. * @Deprecated, not compatible when mandatory parameters changed
  38. */
  39. func NewDescribeKeypairsRequest(
  40. regionId string,
  41. ) *DescribeKeypairsRequest {
  42. return &DescribeKeypairsRequest{
  43. JDCloudRequest: core.JDCloudRequest{
  44. URL: "/regions/{regionId}/keypairs",
  45. Method: "GET",
  46. Header: nil,
  47. Version: "v1",
  48. },
  49. RegionId: regionId,
  50. }
  51. }
  52. /*
  53. * param regionId: 地域ID (Required)
  54. * param pageNumber: 页码;默认为1 (Optional)
  55. * param pageSize: 分页大小;默认为20;取值范围[10, 100] (Optional)
  56. * param filters: keyNames - 密钥对名称,精确匹配,支持多个
  57. (Optional)
  58. */
  59. func NewDescribeKeypairsRequestWithAllParams(
  60. regionId string,
  61. pageNumber *int,
  62. pageSize *int,
  63. filters []common.Filter,
  64. ) *DescribeKeypairsRequest {
  65. return &DescribeKeypairsRequest{
  66. JDCloudRequest: core.JDCloudRequest{
  67. URL: "/regions/{regionId}/keypairs",
  68. Method: "GET",
  69. Header: nil,
  70. Version: "v1",
  71. },
  72. RegionId: regionId,
  73. PageNumber: pageNumber,
  74. PageSize: pageSize,
  75. Filters: filters,
  76. }
  77. }
  78. /* This constructor has better compatible ability when API parameters changed */
  79. func NewDescribeKeypairsRequestWithoutParam() *DescribeKeypairsRequest {
  80. return &DescribeKeypairsRequest{
  81. JDCloudRequest: core.JDCloudRequest{
  82. URL: "/regions/{regionId}/keypairs",
  83. Method: "GET",
  84. Header: nil,
  85. Version: "v1",
  86. },
  87. }
  88. }
  89. /* param regionId: 地域ID(Required) */
  90. func (r *DescribeKeypairsRequest) SetRegionId(regionId string) {
  91. r.RegionId = regionId
  92. }
  93. /* param pageNumber: 页码;默认为1(Optional) */
  94. func (r *DescribeKeypairsRequest) SetPageNumber(pageNumber int) {
  95. r.PageNumber = &pageNumber
  96. }
  97. /* param pageSize: 分页大小;默认为20;取值范围[10, 100](Optional) */
  98. func (r *DescribeKeypairsRequest) SetPageSize(pageSize int) {
  99. r.PageSize = &pageSize
  100. }
  101. /* param filters: keyNames - 密钥对名称,精确匹配,支持多个
  102. (Optional) */
  103. func (r *DescribeKeypairsRequest) SetFilters(filters []common.Filter) {
  104. r.Filters = filters
  105. }
  106. // GetRegionId returns path parameter 'regionId' if exist,
  107. // otherwise return empty string
  108. func (r DescribeKeypairsRequest) GetRegionId() string {
  109. return r.RegionId
  110. }
  111. type DescribeKeypairsResponse struct {
  112. RequestID string `json:"requestId"`
  113. Error core.ErrorResponse `json:"error"`
  114. Result DescribeKeypairsResult `json:"result"`
  115. }
  116. type DescribeKeypairsResult struct {
  117. Keypairs []vm.Keypair `json:"keypairs"`
  118. TotalCount int `json:"totalCount"`
  119. }