| 1 |
package ros |
| 2 |
|
| 3 |
import ( |
| 4 |
"fmt" |
| 5 |
"net/http" |
| 6 |
|
| 7 |
"github.com/denverdino/aliyungo/common" |
| 8 |
"github.com/denverdino/aliyungo/util" |
| 9 |
) |
| 10 |
|
| 11 |
|
| 12 |
type DescribeEventsRequest struct { |
| 13 |
ResourceStatus string |
| 14 |
ResourceName string |
| 15 |
ResourceType string |
| 16 |
PageNumber int |
| 17 |
PageSize int |
| 18 |
} |
| 19 |
|
| 20 |
type Event struct { |
| 21 |
ResourceStatus string |
| 22 |
ResourceName string |
| 23 |
StatusReason string |
| 24 |
Id string |
| 25 |
ResourceId string |
| 26 |
ResourceType string |
| 27 |
ResourcePhysicalId string |
| 28 |
Time string |
| 29 |
} |
| 30 |
|
| 31 |
type DescribeEventsResponse struct { |
| 32 |
common.Response |
| 33 |
TotalCount int |
| 34 |
PageNumber int |
| 35 |
PageSize int |
| 36 |
Events []Event |
| 37 |
} |
| 38 |
|
| 39 |
func (client *Client) DescribeEvents(stackId, stackName string, args *DescribeEventsRequest) (*DescribeEventsResponse, error) { |
| 40 |
response := &DescribeEventsResponse{} |
| 41 |
query := util.ConvertToQueryValues(args) |
| 42 |
err := client.Invoke("", http.MethodGet, fmt.Sprintf("/stacks/%s/%s/events", stackName, stackId), query, nil, response) |
| 43 |
if err != nil { |
| 44 |
return nil, err |
| 45 |
} |
| 46 |
|
| 47 |
return response, nil |
| 48 |
} |
| 49 |
|
| 50 |
|
| 51 |
type Region struct { |
| 52 |
LocalName string |
| 53 |
RegionId string |
| 54 |
} |
| 55 |
|
| 56 |
type DescribeRegionsResponse struct { |
| 57 |
common.Response |
| 58 |
Regions []Region |
| 59 |
} |
| 60 |
|
| 61 |
func (client *Client) DescribeRegions() (*DescribeRegionsResponse, error) { |
| 62 |
response := &DescribeRegionsResponse{} |
| 63 |
err := client.Invoke("", http.MethodGet, "/regions", nil, nil, response) |
| 64 |
if err != nil { |
| 65 |
return nil, err |
| 66 |
} |
| 67 |
|
| 68 |
return response, nil |
| 69 |
} |