mirror of
https://hubproxy.babadafafafafa.cn/https://github.com/yunionio/cloudpods.git
synced 2026-09-20 08:03:53 +08:00
* refactor(notify): ALL * feat(climc): Notify v2 * feat: support notify for codegen.py * delete deprecated code and Maintain SDK compatibility * Adjust the template for mail validation to support captcha * fix: The issue of notify refactoring * add copyright for notifyv2 cli * Adjust according to the advice of make check * Remove utils package in notify * fix import format * remove redundant Template module * fix validateCreate and validateUpdate of notifytemplate * fix update issues of receivers * fix: Add SetStageComplete in tasks
67 lines
2.3 KiB
Go
67 lines
2.3 KiB
Go
// 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 apis
|
|
|
|
import (
|
|
"context"
|
|
"time"
|
|
|
|
"google.golang.org/grpc"
|
|
)
|
|
|
|
type SendNotificationClient struct {
|
|
sendAgentClient
|
|
Conn *grpc.ClientConn
|
|
CallTimeout time.Duration
|
|
}
|
|
|
|
func NewSendNotificationClient(cc *grpc.ClientConn) *SendNotificationClient {
|
|
return &SendNotificationClient{
|
|
sendAgentClient: sendAgentClient{cc},
|
|
Conn: cc,
|
|
CallTimeout: 30 * time.Second,
|
|
}
|
|
}
|
|
|
|
func (c *SendNotificationClient) Send(ctx context.Context, in *SendParams, opts ...grpc.CallOption) (*Empty, error) {
|
|
ctx, cancel := context.WithTimeout(ctx, c.CallTimeout)
|
|
defer cancel()
|
|
return c.sendAgentClient.Send(ctx, in, opts...)
|
|
}
|
|
|
|
func (c *SendNotificationClient) UpdateConfig(ctx context.Context, in *UpdateConfigParams, opts ...grpc.CallOption) (*Empty, error) {
|
|
ctx, cancel := context.WithTimeout(ctx, c.CallTimeout)
|
|
defer cancel()
|
|
return c.sendAgentClient.UpdateConfig(ctx, in, opts...)
|
|
}
|
|
|
|
func (c *SendNotificationClient) ValidateConfig(ctx context.Context, in *UpdateConfigParams, opts ...grpc.CallOption) (*ValidateConfigReply, error) {
|
|
ctx, cancel := context.WithTimeout(ctx, c.CallTimeout)
|
|
defer cancel()
|
|
return c.sendAgentClient.ValidateConfig(ctx, in, opts...)
|
|
}
|
|
|
|
func (c *SendNotificationClient) UseridByMobile(ctx context.Context, in *UseridByMobileParams, opts ...grpc.CallOption) (*UseridByMobileReply, error) {
|
|
ctx, cancel := context.WithTimeout(ctx, c.CallTimeout)
|
|
defer cancel()
|
|
return c.sendAgentClient.UseridByMobile(ctx, in, opts...)
|
|
}
|
|
|
|
func (c *SendNotificationClient) BatchSend(ctx context.Context, in *BatchSendParams, opts ...grpc.CallOption) (*BatchSendReply, error) {
|
|
ctx, cancel := context.WithTimeout(ctx, c.CallTimeout)
|
|
defer cancel()
|
|
return c.sendAgentClient.BatchSend(ctx, in, opts...)
|
|
}
|