Merge pull request #150 from yunify/add-action-DescribeNotificationLists

add-action-DescribeNotificationLists
This commit is contained in:
Bobby 2020-03-11 10:02:42 +08:00 committed by GitHub
commit 03efdbb11f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 105 additions and 0 deletions

View File

@ -47,6 +47,65 @@ func (s *QingCloudService) Notification(zone string) (*NotificationService, erro
return &NotificationService{Config: s.Config, Properties: properties}, nil
}
func (s *NotificationService) DescribeNotificationLists(i *DescribeNotificationListsInput) (*DescribeNotificationListsOutput, error) {
if i == nil {
i = &DescribeNotificationListsInput{}
}
o := &data.Operation{
Config: s.Config,
Properties: s.Properties,
APIName: "DescribeNotificationLists",
RequestMethod: "GET",
}
x := &DescribeNotificationListsOutput{}
r, err := request.New(o, i, x)
if err != nil {
return nil, err
}
err = r.Send()
if err != nil {
return nil, err
}
return x, err
}
type DescribeNotificationListsInput struct {
Limit *int `json:"limit" name:"limit" default:"10" location:"params"`
NotificationLists []*string `json:"notification_lists" name:"notification_lists" location:"params"` // Required
Offset *int `json:"offset" name:"offset" default:"0" location:"params"`
Owner *string `json:"owner" name:"owner" location:"params"` // Required
}
func (v *DescribeNotificationListsInput) Validate() error {
if len(v.NotificationLists) == 0 {
return errors.ParameterRequiredError{
ParameterName: "NotificationLists",
ParentName: "DescribeNotificationListsInput",
}
}
if v.Owner == nil {
return errors.ParameterRequiredError{
ParameterName: "Owner",
ParentName: "DescribeNotificationListsInput",
}
}
return nil
}
type DescribeNotificationListsOutput struct {
Message *string `json:"message" name:"message"`
Action *string `json:"action" name:"action" location:"elements"`
NotificationListSet []*NotificationList `json:"notification_list_set" name:"notification_list_set" location:"elements"`
RetCode *int `json:"ret_code" name:"ret_code" location:"elements"`
TotalCount *int `json:"total_count" name:"total_count" location:"elements"`
}
func (s *NotificationService) SendAlarmNotification(i *SendAlarmNotificationInput) (*SendAlarmNotificationOutput, error) {
if i == nil {
i = &SendAlarmNotificationInput{}

View File

@ -1863,6 +1863,52 @@ func (v *NotificationData) Validate() error {
return nil
}
type NotificationList struct {
ConsoleID *string `json:"console_id" name:"console_id"`
CreateTime *string `json:"create_time" name:"create_time"`
IsMine *string `json:"is_mine" name:"is_mine"`
Items []*NotificationListItem `json:"items" name:"items"`
NotificationListID *string `json:"notification_list_id" name:"notification_list_id"`
NotificationListName *string `json:"notification_list_name" name:"notification_list_name"`
Owner *string `json:"owner" name:"owner"`
RootUserID *string `json:"root_user_id" name:"root_user_id"`
Shared *string `json:"shared" name:"shared"`
Visibility *string `json:"visibility" name:"visibility"`
}
func (v *NotificationList) Validate() error {
if len(v.Items) > 0 {
for _, property := range v.Items {
if err := property.Validate(); err != nil {
return err
}
}
}
return nil
}
type NotificationListItem struct {
ConsoleID *string `json:"console_id" name:"console_id"`
Content *string `json:"content" name:"content"`
CreateTime *string `json:"create_time" name:"create_time"`
NotificationItemID *string `json:"notification_item_id" name:"notification_item_id"`
NotificationItemType *string `json:"notification_item_type" name:"notification_item_type"`
Owner *string `json:"owner" name:"owner"`
Remarks *string `json:"remarks" name:"remarks"`
RootUserID *string `json:"root_user_id" name:"root_user_id"`
ValidStatus *int `json:"valid_status" name:"valid_status"`
VerificationCode *string `json:"verification_code" name:"verification_code"`
Verified *int `json:"verified" name:"verified"`
VerifyTime *string `json:"verify_time" name:"verify_time"`
}
func (v *NotificationListItem) Validate() error {
return nil
}
type Project struct {
ConsoleID *string `json:"console_id" name:"console_id"`
CreateTime *string `json:"create_time" name:"create_time"`