Documentation ¶
Overview ¶
Package annotation defines Annotation object definitions.
Index ¶
- type Annotation
- func (a Annotation) GetKind() manifest.Kind
- func (a Annotation) GetManifestSource() string
- func (a Annotation) GetName() string
- func (a Annotation) GetOrganization() string
- func (a Annotation) GetProject() string
- func (a Annotation) GetValidator() govy.Validator[Annotation]
- func (a Annotation) GetVersion() manifest.Version
- func (a Annotation) SetManifestSource(src string) manifest.Object
- func (a Annotation) SetOrganization(org string) manifest.Object
- func (a Annotation) SetProject(project string) manifest.Object
- func (a Annotation) Validate() error
- type Metadata
- type Spec
- type Status
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Annotation ¶
type Annotation 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"` }
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/annotation" ) func main() { // Create the object: myAnnotation := annotation.New( annotation.Metadata{ Name: "my-annotation", Project: "my-project", }, annotation.Spec{ Slo: "existing-slo", ObjectiveName: "existing-slo-objective-1", Description: "Example annotation", StartTime: time.Date(2023, 5, 1, 17, 10, 5, 0, time.UTC), EndTime: time.Date(2023, 5, 2, 17, 10, 5, 0, time.UTC), }, ) // Verify the object: if err := myAnnotation.Validate(); err != nil { log.Fatalf("annotation validation failed, err: %v", err) } // Apply the object: client := examples.GetOfflineEchoClient() if err := client.Objects().V1().Apply(context.Background(), []manifest.Object{myAnnotation}); err != nil { log.Fatalf("failed to apply annotation, err: %v", err) } }
Output: apiVersion: n9/v1alpha kind: Annotation metadata: name: my-annotation project: my-project spec: slo: existing-slo objectiveName: existing-slo-objective-1 description: Example annotation startTime: 2023-05-01T17:10:05Z endTime: 2023-05-02T17:10:05Z
func New ¶
func New(metadata Metadata, spec Spec) Annotation
New creates a new Annotation based on provided Metadata nad Spec.
func (Annotation) GetKind ¶
func (a Annotation) GetKind() manifest.Kind
func (Annotation) GetManifestSource ¶
func (a Annotation) GetManifestSource() string
func (Annotation) GetName ¶
func (a Annotation) GetName() string
func (Annotation) GetOrganization ¶
func (a Annotation) GetOrganization() string
func (Annotation) GetProject ¶
func (a Annotation) GetProject() string
func (Annotation) GetValidator ¶ added in v0.82.0
func (a Annotation) GetValidator() govy.Validator[Annotation]
func (Annotation) GetVersion ¶
func (a Annotation) GetVersion() manifest.Version
func (Annotation) SetManifestSource ¶
func (a Annotation) SetManifestSource(src string) manifest.Object
func (Annotation) SetOrganization ¶
func (a Annotation) SetOrganization(org string) manifest.Object
func (Annotation) SetProject ¶
func (a Annotation) SetProject(project string) manifest.Object
func (Annotation) Validate ¶
func (a Annotation) Validate() error
Click to show internal directories.
Click to hide internal directories.