| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138 |
- // Copyright 2019 Yunion
- //
- // Licensed under the Apache License, Version 2.0 (the "License");
- // you may not use this file except in compliance with the License.
- // You may obtain a copy of the License at
- //
- // http://www.apache.org/licenses/LICENSE-2.0
- //
- // Unless required by applicable law or agreed to in writing, software
- // distributed under the License is distributed on an "AS IS" BASIS,
- // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- // See the License for the specific language governing permissions and
- // limitations under the License.
- // Copyright 2019 Yunion
- // Licensed under the Apache License, Version 2.0 (the "License");
- // you may not use this file except in compliance with the License.
- // You may obtain a copy of the License at
- //
- // http://www.apache.org/licenses/LICENSE-2.0
- //
- // Unless required by applicable law or agreed to in writing, software
- // distributed under the License is distributed on an "AS IS" BASIS,
- // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- // See the License for the specific language governing permissions and
- // limitations under the License.
- package notify
- import (
- "yunion.io/x/jsonutils"
- "yunion.io/x/onecloud/pkg/mcclient/options"
- )
- type TopicListOptions struct {
- options.BaseListOptions
- }
- func (opts *TopicListOptions) Params() (jsonutils.JSONObject, error) {
- return options.ListStructToParams(opts)
- }
- type TopicOptions struct {
- ID string `help:"Id or Name of topic"`
- }
- func (so *TopicOptions) GetId() string {
- return so.ID
- }
- func (so *TopicOptions) Params() (jsonutils.JSONObject, error) {
- return nil, nil
- }
- type TopicUpdateOptions struct {
- ID string
- AdvanceDays []int
- Name string
- Resources []string
- Actions []string
- Results *bool
- TitleCn string
- TitleEn string
- ContentCn string
- ContentEn string
- }
- func (opts *TopicUpdateOptions) Params() (jsonutils.JSONObject, error) {
- return jsonutils.Marshal(opts), nil
- }
- func (so *TopicUpdateOptions) GetId() string {
- return so.ID
- }
- type STopicAddActionInput struct {
- ID string
- ACTION_ID string
- }
- func (opt *STopicAddActionInput) GetId() string {
- return opt.ID
- }
- func (rl *STopicAddActionInput) Params() (jsonutils.JSONObject, error) {
- return options.ListStructToParams(rl)
- }
- type STopicAddResourceInput struct {
- ID string
- RESOURCE_ID string
- }
- func (opt *STopicAddResourceInput) GetId() string {
- return opt.ID
- }
- func (rl *STopicAddResourceInput) Params() (jsonutils.JSONObject, error) {
- return options.ListStructToParams(rl)
- }
- type TopicCreateOptions struct {
- NAME string
- Enabled bool
- Type string `choices:"resource|automated_process|security"`
- Results bool
- TitleCn string
- TitleEn string
- ContentCn string
- ContentEn string
- GroupKeys []string
- AdvanceDays []int
- Actions []string
- Resources []string
- }
- func (rl *TopicCreateOptions) Params() (jsonutils.JSONObject, error) {
- return jsonutils.Marshal(rl), nil
- }
- type TopicAddActionInput struct {
- TopicOptions
- Actions []string `json:"actions"`
- }
- func (rl *TopicAddActionInput) Params() (jsonutils.JSONObject, error) {
- return jsonutils.Marshal(rl), nil
- }
- type TopicAddResourcesInput struct {
- TopicOptions
- Resources []string `json:"resources"`
- }
- func (rl *TopicAddResourcesInput) Params() (jsonutils.JSONObject, error) {
- return jsonutils.Marshal(rl), nil
- }
|