describe_container_group_metric.go 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  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 []DescribeContainerGroupMetricRecord0 `json:"Records" xml:"Records"`
  89. }
  90. type DescribeContainerGroupMetricRecord0 struct {
  91. Timestamp string `json:"Timestamp" xml:"Timestamp"`
  92. Containers []DescribeContainerGroupMetricContainer1 `json:"Containers" xml:"Containers"`
  93. CPU DescribeContainerGroupMetricCPU1 `json:"CPU" xml:"CPU"`
  94. Memory DescribeContainerGroupMetricMemory1 `json:"Memory" xml:"Memory"`
  95. Network DescribeContainerGroupMetricNetwork1 `json:"Network" xml:"Network"`
  96. }
  97. type DescribeContainerGroupMetricContainer1 struct {
  98. Name string `json:"Name" xml:"Name"`
  99. CPU DescribeContainerGroupMetricCPU2 `json:"CPU" xml:"CPU"`
  100. Memory DescribeContainerGroupMetricMemory2 `json:"Memory" xml:"Memory"`
  101. }
  102. type DescribeContainerGroupMetricCPU2 struct {
  103. UsageNanoCores int64 `json:"UsageNanoCores" xml:"UsageNanoCores"`
  104. UsageCoreNanoSeconds int64 `json:"UsageCoreNanoSeconds" xml:"UsageCoreNanoSeconds"`
  105. Load int64 `json:"Load" xml:"Load"`
  106. Limit int64 `json:"Limit" xml:"Limit"`
  107. }
  108. type DescribeContainerGroupMetricMemory2 struct {
  109. AvailableBytes int64 `json:"AvailableBytes" xml:"AvailableBytes"`
  110. UsageBytes int64 `json:"UsageBytes" xml:"UsageBytes"`
  111. Cache int64 `json:"Cache" xml:"Cache"`
  112. WorkingSet int64 `json:"WorkingSet" xml:"WorkingSet"`
  113. Rss int64 `json:"Rss" xml:"Rss"`
  114. }
  115. type DescribeContainerGroupMetricCPU1 struct {
  116. UsageNanoCores int64 `json:"UsageNanoCores" xml:"UsageNanoCores"`
  117. UsageCoreNanoSeconds int64 `json:"UsageCoreNanoSeconds" xml:"UsageCoreNanoSeconds"`
  118. Load int64 `json:"Load" xml:"Load"`
  119. Limit int64 `json:"Limit" xml:"Limit"`
  120. }
  121. type DescribeContainerGroupMetricMemory1 struct {
  122. AvailableBytes int64 `json:"AvailableBytes" xml:"AvailableBytes"`
  123. UsageBytes int64 `json:"UsageBytes" xml:"UsageBytes"`
  124. Cache int64 `json:"Cache" xml:"Cache"`
  125. WorkingSet int64 `json:"WorkingSet" xml:"WorkingSet"`
  126. Rss int64 `json:"Rss" xml:"Rss"`
  127. }
  128. type DescribeContainerGroupMetricNetwork1 struct {
  129. Interfaces []DescribeContainerGroupMetricInterface2 `json:"Interfaces" xml:"Interfaces"`
  130. }
  131. type DescribeContainerGroupMetricInterface2 struct {
  132. TxBytes int64 `json:"TxBytes" xml:"TxBytes"`
  133. RxBytes int64 `json:"RxBytes" xml:"RxBytes"`
  134. TxErrors int64 `json:"TxErrors" xml:"TxErrors"`
  135. RxErrors int64 `json:"RxErrors" xml:"RxErrors"`
  136. Name string `json:"Name" xml:"Name"`
  137. }
  138. // CreateDescribeContainerGroupMetricRequest creates a request to invoke DescribeContainerGroupMetric API
  139. func CreateDescribeContainerGroupMetricRequest() (request *DescribeContainerGroupMetricRequest) {
  140. request = &DescribeContainerGroupMetricRequest{
  141. RpcRequest: &requests.RpcRequest{},
  142. }
  143. request.InitWithApiInfo("Eci", "2018-08-08", "DescribeContainerGroupMetric", "eci", "openAPI")
  144. return
  145. }
  146. // CreateDescribeContainerGroupMetricResponse creates a response to parse from DescribeContainerGroupMetric response
  147. func CreateDescribeContainerGroupMetricResponse() (response *DescribeContainerGroupMetricResponse) {
  148. response = &DescribeContainerGroupMetricResponse{
  149. BaseResponse: &responses.BaseResponse{},
  150. }
  151. return
  152. }