Documentation ¶
Overview ¶
Package project defines Project object definitions.
Index ¶
- type Metadata
- type Project
- func (p Project) GetKind() manifest.Kind
- func (p Project) GetManifestSource() string
- func (p Project) GetName() string
- func (p Project) GetOrganization() string
- func (p Project) GetValidator() govy.Validator[Project]
- func (p Project) GetVersion() manifest.Version
- func (p Project) SetManifestSource(src string) manifest.Object
- func (p Project) SetOrganization(org string) manifest.Object
- func (p Project) Validate() error
- type Spec
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Metadata ¶
type Metadata struct { // Name is used to uniquely identify the Project. Name string `json:"name"` // DisplayName allows defining a more human-readable name for the Project. DisplayName string `json:"displayName,omitempty"` Labels v1alpha.Labels `json:"labels,omitempty"` Annotations v1alpha.MetadataAnnotations `json:"annotations,omitempty"` }
Metadata provides identity information for Project.
type Project ¶
type Project struct { APIVersion manifest.Version `json:"apiVersion"` Kind manifest.Kind `json:"kind"` Metadata Metadata `json:"metadata"` Spec Spec `json:"spec"` Organization string `json:"organization,omitempty"` ManifestSource string `json:"manifestSrc,omitempty"` }
Project is the primary grouping of resources in Nobl9. Most objects are scoped to a certain Project. For more details, see projects in the Nobl9 platform.
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/project" ) func main() { // Create the object: myProject := project.New( project.Metadata{ Name: "my-project", DisplayName: "My Project", Labels: v1alpha.Labels{ "team": []string{"green", "orange"}, "region": []string{"eu-central-1"}, }, }, project.Spec{ Description: "Example project", }, ) // Verify the object: if err := myProject.Validate(); err != nil { log.Fatalf("project validation failed, err: %v", err) } // Apply the object: client := examples.GetOfflineEchoClient() if err := client.Objects().V1().Apply(context.Background(), []manifest.Object{myProject}); err != nil { log.Fatalf("failed to apply project, err: %v", err) } }
Output: apiVersion: n9/v1alpha kind: Project metadata: name: my-project displayName: My Project labels: region: - eu-central-1 team: - green - orange spec: description: Example project
func (Project) GetManifestSource ¶
func (Project) GetOrganization ¶
func (Project) GetValidator ¶ added in v0.82.0
func (Project) GetVersion ¶
type Spec ¶
type Spec struct { CreatedAt string `json:"createdAt,omitempty"` CreatedBy string `json:"createdBy,omitempty"` // Description allows for a more detailed description of the Project. Description string `json:"description" validate:"description" example:"Bleeding edge web app"` }
Spec holds detailed specification of the Project.
Click to show internal directories.
Click to hide internal directories.