Documentation ¶
Overview ¶
Package alertsilence defines AlertSilence object definitions.
Index ¶
- type AlertPolicySource
- type AlertSilence
- func (a AlertSilence) GetKind() manifest.Kind
- func (a AlertSilence) GetManifestSource() string
- func (a AlertSilence) GetName() string
- func (a AlertSilence) GetOrganization() string
- func (a AlertSilence) GetProject() string
- func (a AlertSilence) GetValidator() govy.Validator[AlertSilence]
- func (a AlertSilence) GetVersion() manifest.Version
- func (a AlertSilence) SetManifestSource(src string) manifest.Object
- func (a AlertSilence) SetOrganization(org string) manifest.Object
- func (a AlertSilence) SetProject(project string) manifest.Object
- func (a AlertSilence) Validate() error
- type Metadata
- type Period
- type Spec
- type Status
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AlertPolicySource ¶
type AlertPolicySource struct { Name string `json:"name"` Project string `json:"project,omitempty"` }
AlertPolicySource represents AlertPolicy attached to the SLO.
type AlertSilence ¶
type AlertSilence struct { APIVersion manifest.Version `json:"apiVersion"` Kind manifest.Kind `json:"kind"` Metadata Metadata `json:"metadata"` Spec Spec `json:"spec"` Status *Status `json:"status,omitempty"` Organization string `json:"organization,omitempty"` ManifestSource string `json:"manifestSrc,omitempty"` }
AlertSilence represents alerts silencing configuration for given SLO and AlertPolicy.
Example ¶
package main import ( "context" "log" "time" "github.com/nobl9/nobl9-go/internal/examples" "github.com/nobl9/nobl9-go/manifest" "github.com/nobl9/nobl9-go/manifest/v1alpha/alertsilence" ) func main() { startTime := time.Date(2023, 5, 1, 17, 10, 5, 0, time.UTC) // Create the object: myAlertSilence := alertsilence.New( alertsilence.Metadata{ Name: "my-alert-silence", Project: "default", }, alertsilence.Spec{ Description: "Example alert silence", SLO: "my-slo", AlertPolicy: alertsilence.AlertPolicySource{ Name: "my-alert-policy", Project: "default", }, Period: alertsilence.Period{ Duration: "10m", StartTime: &startTime, }, }, ) // Verify the object: if err := myAlertSilence.Validate(); err != nil { log.Fatalf("alert silence validation failed, err: %v", err) } // Apply the object: client := examples.GetOfflineEchoClient() if err := client.Objects().V1().Apply(context.Background(), []manifest.Object{myAlertSilence}); err != nil { log.Fatalf("failed to apply alert silence, err: %v", err) } }
Output: apiVersion: n9/v1alpha kind: AlertSilence metadata: name: my-alert-silence project: default spec: description: Example alert silence slo: my-slo alertPolicy: name: my-alert-policy project: default period: startTime: 2023-05-01T17:10:05Z duration: 10m
func New ¶
func New(metadata Metadata, spec Spec) AlertSilence
New creates a new AlertSilence based on provided Metadata nad Spec.
func (AlertSilence) GetKind ¶
func (a AlertSilence) GetKind() manifest.Kind
func (AlertSilence) GetManifestSource ¶
func (a AlertSilence) GetManifestSource() string
func (AlertSilence) GetName ¶
func (a AlertSilence) GetName() string
func (AlertSilence) GetOrganization ¶
func (a AlertSilence) GetOrganization() string
func (AlertSilence) GetProject ¶
func (a AlertSilence) GetProject() string
func (AlertSilence) GetValidator ¶ added in v0.82.0
func (a AlertSilence) GetValidator() govy.Validator[AlertSilence]
func (AlertSilence) GetVersion ¶
func (a AlertSilence) GetVersion() manifest.Version
func (AlertSilence) SetManifestSource ¶
func (a AlertSilence) SetManifestSource(src string) manifest.Object
func (AlertSilence) SetOrganization ¶
func (a AlertSilence) SetOrganization(org string) manifest.Object
func (AlertSilence) SetProject ¶
func (a AlertSilence) SetProject(project string) manifest.Object
func (AlertSilence) Validate ¶
func (a AlertSilence) Validate() error
type Metadata ¶
Metadata defines only basic metadata fields - name and project which uniquely identifies object on project level.
type Period ¶
type Period struct { StartTime *time.Time `json:"startTime,omitempty"` EndTime *time.Time `json:"endTime,omitempty"` Duration string `json:"duration,omitempty"` }
Period represents time range configuration for AlertSilence.
Click to show internal directories.
Click to hide internal directories.