Documentation ¶
Overview ¶
Package service defines Service object definitions.
Index ¶
- type Metadata
- type Service
- func (s Service) GetKind() manifest.Kind
- func (s Service) GetManifestSource() string
- func (s Service) GetName() string
- func (s Service) GetOrganization() string
- func (s Service) GetProject() string
- func (s Service) GetValidator() govy.Validator[Service]
- func (s Service) GetVersion() manifest.Version
- func (s Service) SetManifestSource(src string) manifest.Object
- func (s Service) SetOrganization(org string) manifest.Object
- func (s Service) SetProject(project string) manifest.Object
- func (s Service) Validate() error
- type Spec
- type Status
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Metadata ¶
type Metadata struct { Name string `json:"name"` DisplayName string `json:"displayName,omitempty"` Project string `json:"project,omitempty"` Labels v1alpha.Labels `json:"labels,omitempty"` Annotations v1alpha.MetadataAnnotations `json:"annotations,omitempty"` }
Metadata provides identity information for Service.
type Service ¶
type Service 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"` }
Service in Nobl9 is a high-level grouping of service level objectives (SLOs). A service can represent a logical service endpoint like an API, a database, an application, or anything else you care about setting an SLO for. Every SLO in Nobl9 is tied to a service, and service can have one or more SLOs.
Example ¶
package main import ( "context" "log" "github.com/nobl9/nobl9-go/internal/examples" "github.com/nobl9/nobl9-go/manifest" "github.com/nobl9/nobl9-go/manifest/v1alpha" "github.com/nobl9/nobl9-go/manifest/v1alpha/service" ) func main() { // Create the object: myService := service.New( service.Metadata{ Name: "my-service", DisplayName: "My Service", Project: "default", Labels: v1alpha.Labels{ "team": []string{"green", "orange"}, "region": []string{"eu-central-1"}, }, }, service.Spec{ Description: "Example service", }, ) // Verify the object: if err := myService.Validate(); err != nil { log.Fatalf("service validation failed, err: %v", err) } // Apply the object: client := examples.GetOfflineEchoClient() if err := client.Objects().V1().Apply(context.Background(), []manifest.Object{myService}); err != nil { log.Fatalf("failed to apply service, err: %v", err) } }
Output: apiVersion: n9/v1alpha kind: Service metadata: name: my-service displayName: My Service project: default labels: region: - eu-central-1 team: - green - orange spec: description: Example service
func (Service) GetManifestSource ¶
func (Service) GetOrganization ¶
func (Service) GetProject ¶
func (Service) GetValidator ¶ added in v0.82.0
func (Service) GetVersion ¶
Click to show internal directories.
Click to hide internal directories.