Skip to content

Commit

Permalink
Merge pull request #150 from yunify/add-action-DescribeNotificationLists
Browse files Browse the repository at this point in the history
add-action-DescribeNotificationLists
  • Loading branch information
Bobby authored Mar 11, 2020
2 parents bdce532 + 59d6682 commit 03efdbb
Show file tree
Hide file tree
Showing 2 changed files with 105 additions and 0 deletions.
59 changes: 59 additions & 0 deletions service/notification.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{}
Expand Down
46 changes: 46 additions & 0 deletions service/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Expand Down

0 comments on commit 03efdbb

Please sign in to comment.