describe_container_group_metric.go 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. //Licensed under the Apache License, Version 2.0 (the "License");
  2. //you may not use this file except in compliance with the License.
  3. //You may obtain a copy of the License at
  4. //
  5. //http://www.apache.org/licenses/LICENSE-2.0
  6. //
  7. //Unless required by applicable law or agreed to in writing, software
  8. //distributed under the License is distributed on an "AS IS" BASIS,
  9. //WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. //See the License for the specific language governing permissions and
  11. //limitations under the License.
  12. //
  13. // Code generated by Alibaba Cloud SDK Code Generator.
  14. // Changes may cause incorrect behavior and will be lost if the code is regenerated.
  15. package eci
  16. import (
  17. "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests"
  18. "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses"
  19. )
  20. // DescribeContainerGroupMetric invokes the eci.DescribeContainerGroupMetric API synchronously
  21. // api document: https://help.aliyun.com/api/eci/describecontainergroupmetric.html
  22. func (client *Client) DescribeContainerGroupMetric(request *DescribeContainerGroupMetricRequest) (response *DescribeContainerGroupMetricResponse, err error) {
  23. response = CreateDescribeContainerGroupMetricResponse()
  24. err = client.DoAction(request, response)
  25. return
  26. }
  27. // DescribeContainerGroupMetricWithChan invokes the eci.DescribeContainerGroupMetric API asynchronously
  28. // api document: https://help.aliyun.com/api/eci/describecontainergroupmetric.html
  29. // asynchronous document: https://help.aliyun.com/document_detail/66220.html
  30. func (client *Client) DescribeContainerGroupMetricWithChan(request *DescribeContainerGroupMetricRequest) (<-chan *DescribeContainerGroupMetricResponse, <-chan error) {
  31. responseChan := make(chan *DescribeContainerGroupMetricResponse, 1)
  32. errChan := make(chan error, 1)
  33. err := client.AddAsyncTask(func() {
  34. defer close(responseChan)
  35. defer close(errChan)
  36. response, err := client.DescribeContainerGroupMetric(request)
  37. if err != nil {
  38. errChan <- err
  39. } else {
  40. responseChan <- response
  41. }
  42. })
  43. if err != nil {
  44. errChan <- err
  45. close(responseChan)
  46. close(errChan)
  47. }
  48. return responseChan, errChan
  49. }
  50. // DescribeContainerGroupMetricWithCallback invokes the eci.DescribeContainerGroupMetric API asynchronously
  51. // api document: https://help.aliyun.com/api/eci/describecontainergroupmetric.html
  52. // asynchronous document: https://help.aliyun.com/document_detail/66220.html
  53. func (client *Client) DescribeContainerGroupMetricWithCallback(request *DescribeContainerGroupMetricRequest, callback func(response *DescribeContainerGroupMetricResponse, err error)) <-chan int {
  54. result := make(chan int, 1)
  55. err := client.AddAsyncTask(func() {
  56. var response *DescribeContainerGroupMetricResponse
  57. var err error
  58. defer close(result)
  59. response, err = client.DescribeContainerGroupMetric(request)
  60. callback(response, err)
  61. result <- 1
  62. })
  63. if err != nil {
  64. defer close(result)
  65. callback(nil, err)
  66. result <- 0
  67. }
  68. return result
  69. }
  70. // DescribeContainerGroupMetricRequest is the request struct for api DescribeContainerGroupMetric
  71. type DescribeContainerGroupMetricRequest struct {
  72. *requests.RpcRequest
  73. OwnerId requests.Integer `position:"Query" name:"OwnerId"`
  74. ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"`
  75. ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"`
  76. OwnerAccount string `position:"Query" name:"OwnerAccount"`
  77. RegionId string `position:"Query" name:"RegionId"`
  78. ContainerGroupId string `position:"Query" name:"ContainerGroupId"`
  79. StartTime string `position:"Query" name:"StartTime"`
  80. EndTime string `position:"Query" name:"EndTime"`
  81. Period string `position:"Query" name:"Period"`
  82. }
  83. // DescribeContainerGroupMetricResponse is the response struct for api DescribeContainerGroupMetric
  84. type DescribeContainerGroupMetricResponse struct {
  85. *responses.BaseResponse
  86. RequestId string `json:"RequestId" xml:"RequestId"`
  87. ContainerGroupId string `json:"ContainerGroupId" xml:"ContainerGroupId"`
  88. Records []DescribeContainerGroupMetricRecords0 `json:"Records" xml:"Records"`
  89. }
  90. type DescribeContainerGroupMetricRecords0 struct {
  91. Record []DescribeContainerGroupMetricRecord1 `json:"Record" xml:"Record"`
  92. }
  93. type DescribeContainerGroupMetricRecord1 struct {
  94. Timestamp string `json:"Timestamp" xml:"Timestamp"`
  95. Containers []DescribeContainerGroupMetricContainers1 `json:"Containers" xml:"Containers"`
  96. CPU DescribeContainerGroupMetricCPU1 `json:"CPU" xml:"CPU"`
  97. Memory DescribeContainerGroupMetricMemory1 `json:"Memory" xml:"Memory"`
  98. Network DescribeContainerGroupMetricNetwork1 `json:"Network" xml:"Network"`
  99. }
  100. type DescribeContainerGroupMetricContainers1 struct {
  101. Container []DescribeContainerGroupMetricContainer2 `json:"Container" xml:"Container"`
  102. }
  103. type DescribeContainerGroupMetricContainer2 struct {
  104. Name string `json:"Name" xml:"Name"`
  105. CPU DescribeContainerGroupMetricCPU2 `json:"CPU" xml:"CPU"`
  106. Memory DescribeContainerGroupMetricMemory2 `json:"Memory" xml:"Memory"`
  107. }
  108. type DescribeContainerGroupMetricCPU2 struct {
  109. UsageNanoCores int64 `json:"UsageNanoCores" xml:"UsageNanoCores"`
  110. UsageCoreNanoSeconds int64 `json:"UsageCoreNanoSeconds" xml:"UsageCoreNanoSeconds"`
  111. Load int64 `json:"Load" xml:"Load"`
  112. Limit int64 `json:"Limit" xml:"Limit"`
  113. }
  114. type DescribeContainerGroupMetricMemory2 struct {
  115. AvailableBytes int64 `json:"AvailableBytes" xml:"AvailableBytes"`
  116. UsageBytes int64 `json:"UsageBytes" xml:"UsageBytes"`
  117. Cache int64 `json:"Cache" xml:"Cache"`
  118. WorkingSet int64 `json:"WorkingSet" xml:"WorkingSet"`
  119. Rss int64 `json:"Rss" xml:"Rss"`
  120. }
  121. type DescribeContainerGroupMetricCPU1 struct {
  122. UsageNanoCores int64 `json:"UsageNanoCores" xml:"UsageNanoCores"`
  123. UsageCoreNanoSeconds int64 `json:"UsageCoreNanoSeconds" xml:"UsageCoreNanoSeconds"`
  124. Load int64 `json:"Load" xml:"Load"`
  125. Limit int64 `json:"Limit" xml:"Limit"`
  126. }
  127. type DescribeContainerGroupMetricMemory1 struct {
  128. AvailableBytes int64 `json:"AvailableBytes" xml:"AvailableBytes"`
  129. UsageBytes int64 `json:"UsageBytes" xml:"UsageBytes"`
  130. Cache int64 `json:"Cache" xml:"Cache"`
  131. WorkingSet int64 `json:"WorkingSet" xml:"WorkingSet"`
  132. Rss int64 `json:"Rss" xml:"Rss"`
  133. }
  134. type DescribeContainerGroupMetricNetwork1 struct {
  135. Interfaces []DescribeContainerGroupMetricInterfaces2 `json:"Interfaces" xml:"Interfaces"`
  136. }
  137. type DescribeContainerGroupMetricInterfaces2 struct {
  138. Interface []DescribeContainerGroupMetricInterface3 `json:"Interface" xml:"Interface"`
  139. }
  140. type DescribeContainerGroupMetricInterface3 struct {
  141. TxBytes int64 `json:"TxBytes" xml:"TxBytes"`
  142. RxBytes int64 `json:"RxBytes" xml:"RxBytes"`
  143. TxErrors int64 `json:"TxErrors" xml:"TxErrors"`
  144. RxErrors int64 `json:"RxErrors" xml:"RxErrors"`
  145. Name string `json:"Name" xml:"Name"`
  146. }
  147. // CreateDescribeContainerGroupMetricRequest creates a request to invoke DescribeContainerGroupMetric API
  148. func CreateDescribeContainerGroupMetricRequest() (request *DescribeContainerGroupMetricRequest) {
  149. request = &DescribeContainerGroupMetricRequest{
  150. RpcRequest: &requests.RpcRequest{},
  151. }
  152. request.InitWithApiInfo("Eci", "2018-08-08", "DescribeContainerGroupMetric", "eci", "openAPI")
  153. return
  154. }
  155. // CreateDescribeContainerGroupMetricResponse creates a response to parse from DescribeContainerGroupMetric response
  156. func CreateDescribeContainerGroupMetricResponse() (response *DescribeContainerGroupMetricResponse) {
  157. response = &DescribeContainerGroupMetricResponse{
  158. BaseResponse: &responses.BaseResponse{},
  159. }
  160. return
  161. }