describe_alarm_history.go 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. package cms
  2. //Licensed under the Apache License, Version 2.0 (the "License");
  3. //you may not use this file except in compliance with the License.
  4. //You may obtain a copy of the License at
  5. //
  6. //http://www.apache.org/licenses/LICENSE-2.0
  7. //
  8. //Unless required by applicable law or agreed to in writing, software
  9. //distributed under the License is distributed on an "AS IS" BASIS,
  10. //WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  11. //See the License for the specific language governing permissions and
  12. //limitations under the License.
  13. //
  14. // Code generated by Alibaba Cloud SDK Code Generator.
  15. // Changes may cause incorrect behavior and will be lost if the code is regenerated.
  16. import (
  17. "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests"
  18. "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses"
  19. )
  20. func (client *Client) DescribeAlarmHistory(request *DescribeAlarmHistoryRequest) (response *DescribeAlarmHistoryResponse, err error) {
  21. response = CreateDescribeAlarmHistoryResponse()
  22. err = client.DoAction(request, response)
  23. return
  24. }
  25. func (client *Client) DescribeAlarmHistoryWithChan(request *DescribeAlarmHistoryRequest) (<-chan *DescribeAlarmHistoryResponse, <-chan error) {
  26. responseChan := make(chan *DescribeAlarmHistoryResponse, 1)
  27. errChan := make(chan error, 1)
  28. err := client.AddAsyncTask(func() {
  29. defer close(responseChan)
  30. defer close(errChan)
  31. response, err := client.DescribeAlarmHistory(request)
  32. responseChan <- response
  33. errChan <- err
  34. })
  35. if err != nil {
  36. errChan <- err
  37. close(responseChan)
  38. close(errChan)
  39. }
  40. return responseChan, errChan
  41. }
  42. func (client *Client) DescribeAlarmHistoryWithCallback(request *DescribeAlarmHistoryRequest, callback func(response *DescribeAlarmHistoryResponse, err error)) <-chan int {
  43. result := make(chan int, 1)
  44. err := client.AddAsyncTask(func() {
  45. var response *DescribeAlarmHistoryResponse
  46. var err error
  47. defer close(result)
  48. response, err = client.DescribeAlarmHistory(request)
  49. callback(response, err)
  50. result <- 1
  51. })
  52. if err != nil {
  53. defer close(result)
  54. callback(nil, err)
  55. result <- 0
  56. }
  57. return result
  58. }
  59. type DescribeAlarmHistoryRequest struct {
  60. *requests.RpcRequest
  61. EndTime string `position:"Query" name:"EndTime"`
  62. PageSize requests.Integer `position:"Query" name:"PageSize"`
  63. StartTime string `position:"Query" name:"StartTime"`
  64. Status string `position:"Query" name:"Status"`
  65. RuleName string `position:"Query" name:"RuleName"`
  66. State string `position:"Query" name:"State"`
  67. Namespace string `position:"Query" name:"Namespace"`
  68. MetricName string `position:"Query" name:"MetricName"`
  69. AlertName string `position:"Query" name:"AlertName"`
  70. Page requests.Integer `position:"Query" name:"Page"`
  71. Ascending requests.Boolean `position:"Query" name:"Ascending"`
  72. GroupId string `position:"Query" name:"GroupId"`
  73. OnlyCount requests.Boolean `position:"Query" name:"OnlyCount"`
  74. }
  75. type DescribeAlarmHistoryResponse struct {
  76. *responses.BaseResponse
  77. Success bool `json:"Success" xml:"Success"`
  78. Code string `json:"Code" xml:"Code"`
  79. Message string `json:"Message" xml:"Message"`
  80. Total string `json:"Total" xml:"Total"`
  81. RequestId string `json:"RequestId" xml:"RequestId"`
  82. AlarmHistoryList struct {
  83. AlarmHistory []struct {
  84. Id string `json:"Id" xml:"Id"`
  85. AlertName string `json:"AlertName" xml:"AlertName"`
  86. GroupId string `json:"GroupId" xml:"GroupId"`
  87. Namespace string `json:"Namespace" xml:"Namespace"`
  88. MetricName string `json:"MetricName" xml:"MetricName"`
  89. Dimensions string `json:"Dimensions" xml:"Dimensions"`
  90. Expression string `json:"Expression" xml:"Expression"`
  91. EvaluationCount int `json:"EvaluationCount" xml:"EvaluationCount"`
  92. Value string `json:"Value" xml:"Value"`
  93. AlertTime int `json:"AlertTime" xml:"AlertTime"`
  94. LastTime int `json:"LastTime" xml:"LastTime"`
  95. Level string `json:"Level" xml:"Level"`
  96. PreLevel string `json:"PreLevel" xml:"PreLevel"`
  97. RuleName string `json:"ruleName" xml:"ruleName"`
  98. State string `json:"State" xml:"State"`
  99. Status int `json:"Status" xml:"Status"`
  100. UserId string `json:"UserId" xml:"UserId"`
  101. Webhooks string `json:"Webhooks" xml:"Webhooks"`
  102. ContactGroups struct {
  103. ContactGroup []string `json:"ContactGroup" xml:"ContactGroup"`
  104. } `json:"ContactGroups" xml:"ContactGroups"`
  105. Contacts struct {
  106. Contact []string `json:"Contact" xml:"Contact"`
  107. } `json:"Contacts" xml:"Contacts"`
  108. ContactALIIMs struct {
  109. ContactALIIM []string `json:"ContactALIIM" xml:"ContactALIIM"`
  110. } `json:"ContactALIIMs" xml:"ContactALIIMs"`
  111. ContactSmses struct {
  112. ContactSms []string `json:"ContactSms" xml:"ContactSms"`
  113. } `json:"ContactSmses" xml:"ContactSmses"`
  114. ContactMails struct {
  115. ContactMail []string `json:"ContactMail" xml:"ContactMail"`
  116. } `json:"ContactMails" xml:"ContactMails"`
  117. } `json:"AlarmHistory" xml:"AlarmHistory"`
  118. } `json:"AlarmHistoryList" xml:"AlarmHistoryList"`
  119. }
  120. func CreateDescribeAlarmHistoryRequest() (request *DescribeAlarmHistoryRequest) {
  121. request = &DescribeAlarmHistoryRequest{
  122. RpcRequest: &requests.RpcRequest{},
  123. }
  124. request.InitWithApiInfo("Cms", "2017-03-01", "DescribeAlarmHistory", "", "")
  125. return
  126. }
  127. func CreateDescribeAlarmHistoryResponse() (response *DescribeAlarmHistoryResponse) {
  128. response = &DescribeAlarmHistoryResponse{
  129. BaseResponse: &responses.BaseResponse{},
  130. }
  131. return
  132. }