github.com/codeready-toolchain/api@v0.0.0-20240507023248-73662d6db2c5/api/v1alpha1/spacebinding_types.go (about)

     1  package v1alpha1
     2  
     3  import (
     4  	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
     5  )
     6  
     7  const (
     8  	// SpaceBindingSpaceLabelKey is used to label the SpaceBinding with the name of the Space it is bound to
     9  	SpaceBindingSpaceLabelKey = SpaceLabelKey
    10  
    11  	// SpaceBindingMasterUserRecordLabelKey is used to label the SpaceBinding with the name of the MasterUserRecord it belongs to
    12  	SpaceBindingMasterUserRecordLabelKey = LabelKeyPrefix + "masteruserrecord"
    13  )
    14  
    15  // SpaceBindingSpec defines the desired state of SpaceBinding
    16  // +k8s:openapi-gen=true
    17  type SpaceBindingSpec struct {
    18  
    19  	// The MasterUserRecord is a name of the MasterUserRecord this SpaceBinding belongs to.
    20  	MasterUserRecord string `json:"masterUserRecord"`
    21  
    22  	// The Space is a name of the Space this SpaceBinding is bound to.
    23  	Space string `json:"space"`
    24  
    25  	// The SpaceRole is a name of the SpaceRole that is granted to the user for the Space. For example: admin, view, ...
    26  	SpaceRole string `json:"spaceRole"`
    27  }
    28  
    29  // SpaceBindingStatus defines the observed state of SpaceBinding
    30  // +k8s:openapi-gen=true
    31  type SpaceBindingStatus struct {
    32  }
    33  
    34  // +kubebuilder:object:root=true
    35  // +kubebuilder:subresource:status
    36  // SpaceBinding is the Schema for the spacebindings API which defines relationship between Spaces and MasterUserRecords
    37  // +k8s:openapi-gen=true
    38  // +kubebuilder:resource:scope=Namespaced
    39  // +kubebuilder:printcolumn:name="MUR",type="string",JSONPath=`.spec.masterUserRecord`
    40  // +kubebuilder:printcolumn:name="Space",type="string",JSONPath=`.spec.space`
    41  // +kubebuilder:printcolumn:name="SpaceRole",type="string",JSONPath=`.spec.spaceRole`
    42  // +kubebuilder:validation:XPreserveUnknownFields
    43  // +operator-sdk:gen-csv:customresourcedefinitions.displayName="SpaceBinding"
    44  type SpaceBinding struct {
    45  	metav1.TypeMeta   `json:",inline"`
    46  	metav1.ObjectMeta `json:"metadata,omitempty"`
    47  
    48  	Spec   SpaceBindingSpec   `json:"spec,omitempty"`
    49  	Status SpaceBindingStatus `json:"status,omitempty"`
    50  }
    51  
    52  //+kubebuilder:object:root=true
    53  
    54  // SpaceBindingList contains a list of SpaceBinding
    55  // +k8s:openapi-gen=true
    56  type SpaceBindingList struct {
    57  	metav1.TypeMeta `json:",inline"`
    58  	metav1.ListMeta `json:"metadata,omitempty"`
    59  	Items           []SpaceBinding `json:"items"`
    60  }
    61  
    62  func init() {
    63  	SchemeBuilder.Register(&SpaceBinding{}, &SpaceBindingList{})
    64  }