...

Source file src/github.com/redhat-developer/odo/pkg/project/types.go

Documentation: github.com/redhat-developer/odo/pkg/project

     1  package project
     2  
     3  import (
     4  	"github.com/redhat-developer/odo/pkg/machineoutput"
     5  	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
     6  )
     7  
     8  const ProjectKind = "Project"
     9  
    10  type Project struct {
    11  	metav1.TypeMeta   `json:",inline"`
    12  	metav1.ObjectMeta `json:"metadata,omitempty"`
    13  	Status            Status `json:"status,omitempty"`
    14  }
    15  
    16  type Status struct {
    17  	Active bool `json:"active"`
    18  }
    19  
    20  // NewProject creates and returns a new project instance
    21  func NewProject(projectName string, isActive bool) Project {
    22  	return Project{
    23  		TypeMeta: metav1.TypeMeta{
    24  			Kind:       ProjectKind,
    25  			APIVersion: machineoutput.APIVersion,
    26  		},
    27  		ObjectMeta: metav1.ObjectMeta{
    28  			Name: projectName,
    29  		},
    30  		Status: Status{
    31  			Active: isActive,
    32  		},
    33  	}
    34  }
    35  
    36  type ProjectList struct {
    37  	metav1.TypeMeta `json:",inline"`
    38  	metav1.ListMeta `json:"metadata,omitempty"`
    39  	Items           []Project `json:"items"`
    40  }
    41  
    42  // NewProjectList returns an instance of a list containing the `items` projects
    43  func NewProjectList(items []Project) ProjectList {
    44  	return ProjectList{
    45  		TypeMeta: metav1.TypeMeta{
    46  			Kind:       machineoutput.ListKind,
    47  			APIVersion: machineoutput.APIVersion,
    48  		},
    49  		Items: items,
    50  	}
    51  }
    52  

View as plain text