Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // DefaultWechatConfig defines default values for wechat configurations. DefaultWechatConfig = WechatConfig{ Message: `{{ template "wechat.default.message" . }}`, ToUser: `{{ template "wechat.default.to_user" . }}`, ToParty: `{{ template "wechat.default.to_party" . }}`, ToTag: `{{ template "wechat.default.to_tag" . }}`, AgentID: `{{ template "wechat.default.agent_id" . }}`, } // DefaultDingtalkConfig ...... DefaultDingtalkConfig = DingtalkConfig{ Markdown: &DingtalkMarkdown{ Title: `{{ template "dingtalk.default.title" . }}`, Text: `{{ template "dingtalk.default.content" . }}`, }, } )
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { Global *GlobalConfig `yaml:"global,omitempty" json:"global,omitempty"` Receivers []*Receiver `yaml:"receivers,omitempty" json:"receivers,omitempty"` Templates []string `yaml:"templates" json:"templates"` S3 *S3Config `yaml:"s3" json:"s3"` // contains filtered or unexported fields }
Config 整个应用最顶层的配置文件
func (Config) GetReceiver ¶
func (*Config) UnmarshalYAML ¶
UnmarshalYAML implements the yaml.Unmarshaler interface for Config.
type DingtalkAt ¶
type DingtalkConfig ¶
type DingtalkConfig struct { HTTPConfig *commoncfg.HTTPClientConfig `yaml:"http_config,omitempty" json:"http_config,omitempty"` APISecret Secret `yaml:"api_secret,omitempty" json:"api_secret,omitempty"` APIToken Secret `yaml:"api_token,omitempty" json:"api_token,omitempty"` APIURL *URL `yaml:"api_url,omitempty" json:"api_url,omitempty"` Text *DingtalkText `yaml:"text,omitempty" json:"text,omitempty"` Markdown *DingtalkMarkdown `yaml:"markdown,omitempty" json:"markdown,omitempty"` At *DingtalkAt `yaml:"at,omitempty" json:"at,omitempty"` MessageType string `yaml:"message_type,omitempty" json:"message_type,omitempty"` }
func (*DingtalkConfig) UnmarshalYAML ¶
func (c *DingtalkConfig) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML implements the yaml.Unmarshaler interface.
type DingtalkMarkdown ¶
type DingtalkText ¶
type GlobalConfig ¶
type GlobalConfig struct { ExternalURL *URL `yaml:"external_url,omitempty" json:"external_url,omitempty"` MetricResolution int64 `yaml:"metric_resolution,omitempty" json:"metric_resolution,omitempty"` PrometheusURL *URL `yaml:"prometheus_url" json:"prometheus_url"` // 配置 prometheus 地址,方便获取监控图表数据 HTTPConfig *commoncfg.HTTPClientConfig `yaml:"http_config,omitempty" json:"http_config,omitempty"` WeChatAPIURL *URL `yaml:"wechat_api_url,omitempty" json:"wechat_api_url,omitempty"` WeChatAPISecret Secret `yaml:"wechat_api_secret,omitempty" json:"wechat_api_secret,omitempty"` WeChatAPICorpID Secret `yaml:"wechat_api_corp_id,omitempty" json:"wechat_api_corp_id,omitempty"` DingTalkAPIURL *URL `yaml:"dingtalk_api_url,omitempty" json:"dingtalk_api_url,omitempty"` DingTalkAPIToken Secret `yaml:"dingtalk_api_token,omitempty" json:"dingtalk_api_token,omitempty"` DingTalkAPISecret Secret `yaml:"dingtalk_api_secret,omitempty" json:"dingtalk_api_secret,omitempty"` }
GlobalConfig 定义全局配置参数
func (*GlobalConfig) UnmarshalYAML ¶
func (c *GlobalConfig) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML implements the yaml.Unmarshaler interface for GlobalConfig.
type HostPort ¶
HostPort represents a "host:port" network address.
func (HostPort) MarshalJSON ¶
MarshalJSON implements the json.Marshaler interface for HostPort.
func (HostPort) MarshalYAML ¶
MarshalYAML implements the yaml.Marshaler interface for HostPort.
func (*HostPort) UnmarshalJSON ¶
UnmarshalJSON implements the json.Unmarshaler interface for HostPort.
func (*HostPort) UnmarshalYAML ¶
UnmarshalYAML implements the yaml.Unmarshaler interface for HostPort.
type MatchRegexps ¶
MatchRegexps represents a map of Regexp.
func (*MatchRegexps) UnmarshalYAML ¶
func (m *MatchRegexps) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML implements the yaml.Unmarshaler interface for MatchRegexps.
type Receiver ¶
type Receiver struct { // A unique identifier for this receiver. Name string `yaml:"name" json:"name"` //EmailConfigs []*EmailConfig `yaml:"email_configs,omitempty" json:"email_configs,omitempty"` WechatConfig *WechatConfig `yaml:"wechat_config,omitempty" json:"wechat_config,omitempty"` DingtalkConfig *DingtalkConfig `yaml:"dingtalk_config,omitempty" json:"dingtalk_config,omitempty"` }
Receiver configuration provides configuration on how to contact a receiver.
func (*Receiver) UnmarshalYAML ¶
UnmarshalYAML implements the yaml.Unmarshaler interface for Receiver.
type Regexp ¶
Regexp encapsulates a regexp.Regexp and makes it YAML marshalable.
func (Regexp) MarshalJSON ¶
MarshalJSON implements the json.Marshaler interface for Regexp.
func (Regexp) MarshalYAML ¶
MarshalYAML implements the yaml.Marshaler interface for Regexp.
func (*Regexp) UnmarshalJSON ¶
UnmarshalJSON implements the json.Unmarshaler interface for Regexp
func (*Regexp) UnmarshalYAML ¶
UnmarshalYAML implements the yaml.Unmarshaler interface for Regexp.
type Secret ¶
type Secret string
Secret is a string that must not be revealed on marshaling.
func (Secret) MarshalJSON ¶
MarshalJSON implements the json.Marshaler interface for Secret.
func (Secret) MarshalYAML ¶
MarshalYAML implements the yaml.Marshaler interface for Secret.
func (*Secret) UnmarshalYAML ¶
UnmarshalYAML implements the yaml.Unmarshaler interface for Secret.
type SecretURL ¶
type SecretURL URL
SecretURL is a URL that must not be revealed on marshaling.
func (SecretURL) MarshalJSON ¶
MarshalJSON implements the json.Marshaler interface for SecretURL.
func (SecretURL) MarshalYAML ¶
MarshalYAML implements the yaml.Marshaler interface for SecretURL.
func (*SecretURL) UnmarshalJSON ¶
UnmarshalJSON implements the json.Marshaler interface for SecretURL.
func (*SecretURL) UnmarshalYAML ¶
UnmarshalYAML implements the yaml.Unmarshaler interface for SecretURL.
type URL ¶
URL is a custom type that represents an HTTP or HTTPS URL and allows validation at configuration load time.
func (URL) MarshalJSON ¶
MarshalJSON implements the json.Marshaler interface for URL.
func (URL) MarshalYAML ¶
MarshalYAML implements the yaml.Marshaler interface for URL.
func (*URL) UnmarshalJSON ¶
UnmarshalJSON implements the json.Marshaler interface for URL.
func (*URL) UnmarshalYAML ¶
UnmarshalYAML implements the yaml.Unmarshaler interface for URL.
type WechatConfig ¶
type WechatConfig struct { //NotifierConfig `yaml:",inline" json:",inline"` HTTPConfig *commoncfg.HTTPClientConfig `yaml:"http_config,omitempty" json:"http_config,omitempty"` APISecret Secret `yaml:"api_secret,omitempty" json:"api_secret,omitempty"` CorpID Secret `yaml:"corp_id,omitempty" json:"corp_id,omitempty"` Message string `yaml:"message,omitempty" json:"message,omitempty"` TemplateCard *WechatTemplateCard `yaml:"template_card,omitempty" json:"template_card,omitempty"` APIURL *URL `yaml:"api_url,omitempty" json:"api_url,omitempty"` ToUser string `yaml:"to_user,omitempty" json:"to_user,omitempty"` ToParty string `yaml:"to_party,omitempty" json:"to_party,omitempty"` ToTag string `yaml:"to_tag,omitempty" json:"to_tag,omitempty"` AgentID string `yaml:"agent_id,omitempty" json:"agent_id,omitempty"` MessageType string `yaml:"message_type,omitempty" json:"message_type,omitempty"` }
WechatConfig configures notifications via Wechat.
func (*WechatConfig) UnmarshalYAML ¶
func (c *WechatConfig) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML implements the yaml.Unmarshaler interface.