Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Delete ¶
func Delete(client *golangsdk.ServiceClient, opts DeleteOpts) (err error)
Types ¶
type CreateOpts ¶
type CreateOpts struct {
DomainId string `json:"_" required:"true"`
// Notification rule name, which is mandatory.
// The value can contain only digits, letters, underscores (_), and hyphens (-),
// and cannot start or end with special characters such as underscores.
// The value can contain 1 to 100 characters and cannot be changed after being created.
Name string `json:"name" required:"true"`
// Notification method.
Methods []string `json:"type,omitempty"`
// Template description, which is mandatory.
// The value can contain only digits, letters, and underscores (_), and cannot start or end with an underscore.
// The value can contain 0 to 1,024 characters.
Description string `json:"desc,omitempty"`
// Template source. Currently, this parameter must be set to LTS. Otherwise, the template cannot be filtered.
Source string `json:"source" required:"true"`
// Language type, for example, en-us.
Language string `json:"locale" required:"true"`
// Template body is an array.
Templates []Templates `json:"templates" required:"true"`
}
type DeleteOpts ¶
type MessageTemplateCreateResponse ¶
type MessageTemplateCreateResponse struct {
// Notification rule name.
Name string `json:"name"`
// Notification method.
Type []string `json:"type"`
// Template description.
Description string `json:"desc"`
// Template source.
Source string `json:"source"`
// Language.
Language string `json:"locale"`
// Template body, which is an array.
Templates []TemplateResponse `json:"templates"`
}
func Create ¶
func Create(client *golangsdk.ServiceClient, opts CreateOpts) (*MessageTemplateCreateResponse, error)
func Update ¶
func Update(client *golangsdk.ServiceClient, opts CreateOpts) (*MessageTemplateCreateResponse, error)
type MessageTemplateResponse ¶
type MessageTemplateResponse struct {
// Notification rule name.
Name string `json:"name"`
// Notification method.
Type []string `json:"type"`
// Template description.
Description string `json:"desc"`
// Template source.
Source string `json:"source"`
// Language.
Language string `json:"locale"`
// Template body, which is an array.
Templates []TemplateResponse `json:"templates"`
// Creation time (timestamp in milliseconds).
CreatedAt int64 `json:"create_time"`
// Update time (timestamp in milliseconds).
UpdatedAt int64 `json:"modify_time"`
// Project ID
ProjectId string `json:"project_id"`
}
func Get ¶
func Get(client *golangsdk.ServiceClient, domainId string, name string) (*MessageTemplateResponse, error)
func List ¶
func List(client *golangsdk.ServiceClient, domainId string) ([]MessageTemplateResponse, error)
type PreviewOpts ¶
type PreviewOpts struct {
DomainId string `json:"_" required:"true"`
// Email template content.
Template string `json:"templates" required:"true"`
// Language type, for example, en-us.
Language string `json:"locale" required:"true"`
// Source. The value can only be LTS.
Source string `json:"source" required:"true"`
// The content of this field is rendered to be used as the title of the message template.
Subject string `json:"subject,omitempty"`
}
type PreviewResponse ¶
type PreviewResponse struct {
// The value is an HTML text and needs to be parsed before being displayed.
Template string `json:"template"`
// The title displayed after the field is parsed. It is displayed at the top of the returned HTML text.
Subject string `json:"subject"`
}
func Preview ¶
func Preview(client *golangsdk.ServiceClient, opts PreviewOpts) (*PreviewResponse, error)
type TemplateResponse ¶
type TemplateResponse struct {
// Template subtype, for example, sms or email.
Type string `json:"sub_type"`
// Sub-template body. A variable following a dollar symbol ($) can only be one of the following variables.
// The supported variables vary according to alarm types (keyword or SQL).
Content string `json:"content"`
// Email subject. This parameter is valid only when sub_type is set to email.
Topic string `json:"topic"`
}
type Templates ¶
type Templates struct {
// Template subtype, for example, sms or email.
Type string `json:"sub_type" required:"true"`
// Sub-template body. A variable following a dollar symbol ($) can only be one of the following variables.
// The supported variables vary according to alarm types.
// Currently, the variables supported for keyword alarms are as follows:
//
// Severity: ${event_severity};
// Occurred: ${starts_at};
// Alarm source: $event.metadata.resource_provider;
// Resource type: $event.metadata.resource_type;
// Resource ID: ${resources};
// Statistical type: by keyword;
// Expression: $event.annotations.condition_expression;
// Current value: $event.annotations.current_value;
// Statistical period: $event.annotations.frequency;
// Query time: $event.annotations.results[0].time;
// Query log: $event.annotations.results[0].raw_results;
Content string `json:"content" required:"true"`
// Email subject. This parameter is valid only when sub_type is set to email.
Topic string `json:"topic,omitempty"`
}
Click to show internal directories.
Click to hide internal directories.