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) GetVersion() string
- 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 string `json:"name" validate:"required,objectName" example:"name"` DisplayName string `json:"displayName,omitempty" validate:"omitempty,min=0,max=63" example:"Shopping App"` Labels v1alpha.Labels `json:"labels,omitempty" validate:"omitempty,labels"` }
Metadata provides identity information for Project.
type Project ¶
type Project struct { APIVersion string `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 primitive for manifest.Object. Most objects are scoped to a certain Project.
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.ApplyObjects(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) GetVersion ¶
Click to show internal directories.
Click to hide internal directories.