webconsole.go 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. // Copyright 2019 Yunion
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. package sender
  15. import (
  16. "context"
  17. "yunion.io/x/cloudmux/pkg/cloudprovider"
  18. api "yunion.io/x/onecloud/pkg/apis/notify"
  19. "yunion.io/x/onecloud/pkg/notify/models"
  20. )
  21. type SWebconsoleSender struct {
  22. config map[string]api.SNotifyConfigContent
  23. }
  24. func (self *SWebconsoleSender) GetSenderType() string {
  25. return api.WEBCONSOLE
  26. }
  27. func (self *SWebconsoleSender) Send(ctx context.Context, args api.SendParams) error {
  28. return nil
  29. }
  30. func (websender *SWebconsoleSender) ValidateConfig(ctx context.Context, config api.NotifyConfig) (string, error) {
  31. return "", cloudprovider.ErrNotImplemented
  32. }
  33. func (websender *SWebconsoleSender) UpdateConfig(config api.NotifyConfig) error {
  34. return cloudprovider.ErrNotImplemented
  35. }
  36. func (websender *SWebconsoleSender) AddConfig(config api.NotifyConfig) error {
  37. return cloudprovider.ErrNotImplemented
  38. }
  39. func (websender *SWebconsoleSender) DeleteConfig(config api.NotifyConfig) error {
  40. return cloudprovider.ErrNotImplemented
  41. }
  42. func (websender *SWebconsoleSender) ContactByMobile(ctx context.Context, mobile, domainId string) (string, error) {
  43. return "", cloudprovider.ErrNotImplemented
  44. }
  45. func (websender *SWebconsoleSender) IsPersonal() bool {
  46. return true
  47. }
  48. func (websender *SWebconsoleSender) IsRobot() bool {
  49. return true
  50. }
  51. func (websender *SWebconsoleSender) IsValid() bool {
  52. return len(websender.config) > 0
  53. }
  54. func (websender *SWebconsoleSender) IsPullType() bool {
  55. return true
  56. }
  57. func (websender *SWebconsoleSender) IsSystemConfigContactType() bool {
  58. return true
  59. }
  60. func (websender *SWebconsoleSender) GetAccessToken(ctx context.Context, key string) error {
  61. return nil
  62. }
  63. func (websender *SWebconsoleSender) RegisterConfig(config models.SConfig) {
  64. }
  65. func init() {
  66. models.Register(&SWebconsoleSender{
  67. config: map[string]api.SNotifyConfigContent{},
  68. })
  69. }