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

     1  package v1alpha1
     2  
     3  import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
     4  
     5  const (
     6  	// SocialEventReady means the event has been setup successfully and passes validation requirements
     7  	SocialEventReady ConditionType = "Ready"
     8  
     9  	// Status condition reasons
    10  	SocialEventInvalidUserTierReason      = "InvalidUserTier"
    11  	SocialEventUnableToGetUserTierReason  = "UnableToGetUserTier"
    12  	SocialEventInvalidSpaceTierReason     = "InvalidSpaceTier"
    13  	SocialEventUnableToGetSpaceTierReason = "UnableToGetSpaceTier"
    14  
    15  	// SocialEventUserSignupLabelKey the key of the label set on the UserSignups who registered with an activation code.
    16  	// The label value is the name of the SocialEvent resource
    17  	SocialEventUserSignupLabelKey = LabelKeyPrefix + "social-event"
    18  )
    19  
    20  // SocialEventSpec defines the parameters for a Social event, such as a training session or workshop. Users
    21  // may register for the event by using the event's unique activation code
    22  //
    23  // +k8s:openapi-gen=true
    24  type SocialEventSpec struct {
    25  	// Important: Run "operator-sdk generate k8s" to regenerate code after modifying this file
    26  	// Add custom validation using kubebuilder tags: https://book.kubebuilder.io/beyond_basics/generating_crd.html
    27  
    28  	// The timestamp from which users may register via this event's activation code
    29  	StartTime metav1.Time `json:"startTime"`
    30  
    31  	// The timestamp after which users may no longer register via this event's activation code
    32  	EndTime metav1.Time `json:"endTime"`
    33  
    34  	// An optional description that may be provided describing the purpose of the event
    35  	// +optional
    36  	Description string `json:"description,omitempty"`
    37  
    38  	// The maximum number of attendees
    39  	MaxAttendees int `json:"maxAttendees"`
    40  
    41  	// The tier to assign to users registering for the event.
    42  	// This must be the valid name of an nstemplatetier resource.
    43  	UserTier string `json:"userTier"`
    44  
    45  	// The tier to assign to spaces created for users who registered for the event.
    46  	// This must be the valid name of an nstemplatetier resource.
    47  	SpaceTier string `json:"spaceTier"`
    48  
    49  	// If true, best effort is made to provision all attendees of the event on the same cluster
    50  	// +optional
    51  	PreferSameCluster bool `json:"preferSameCluster,omitempty"`
    52  
    53  	// If true, the user will also be required to complete standard phone verification
    54  	// +optional
    55  	VerificationRequired bool `json:"verificationRequired,omitempty"`
    56  }
    57  
    58  // SocialEventStatus defines the observed state of SocialEvent
    59  // +k8s:openapi-gen=true
    60  type SocialEventStatus struct {
    61  	// Important: Run "operator-sdk generate k8s" to regenerate code after modifying this file
    62  	// Add custom validation using kubebuilder tags: https://book.kubebuilder.io/beyond_basics/generating_crd.html
    63  
    64  	// Conditions is an array of current SocialEventStatus conditions
    65  	// Supported condition types:
    66  	// Ready
    67  	// +optional
    68  	// +patchMergeKey=type
    69  	// +patchStrategy=merge
    70  	// +listType=map
    71  	// +listMapKey=type
    72  	Conditions []Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type"`
    73  
    74  	ActivationCount int `json:"activationCount"`
    75  }
    76  
    77  //+kubebuilder:object:root=true
    78  //+kubebuilder:subresource:status
    79  
    80  // SocialEvent registers a social event in Dev Sandbox
    81  // +k8s:openapi-gen=true
    82  // +kubebuilder:subresource:status
    83  // +kubebuilder:resource:scope=Namespaced
    84  // +kubebuilder:printcolumn:name="StartTime",type="string",JSONPath=`.spec.startTime`
    85  // +kubebuilder:printcolumn:name="EndTime",type="string",JSONPath=`.spec.endTime`
    86  // +kubebuilder:printcolumn:name="Description",type="string",JSONPath=`.spec.description`
    87  // +kubebuilder:printcolumn:name="MaxAttendees",type="string",JSONPath=`.spec.maxAttendees`
    88  // +kubebuilder:printcolumn:name="CurrentAttendees",type="string",JSONPath=`.status.activationCount`
    89  // +kubebuilder:validation:XPreserveUnknownFields
    90  // +operator-sdk:gen-csv:customresourcedefinitions.displayName="Toolchain Event"
    91  type SocialEvent struct {
    92  	metav1.TypeMeta   `json:",inline"`
    93  	metav1.ObjectMeta `json:"metadata,omitempty"`
    94  
    95  	Spec   SocialEventSpec   `json:"spec,omitempty"`
    96  	Status SocialEventStatus `json:"status,omitempty"`
    97  }
    98  
    99  //+kubebuilder:object:root=true
   100  
   101  // SocialEventList contains a list of SocialEvent
   102  type SocialEventList struct {
   103  	metav1.TypeMeta `json:",inline"`
   104  	metav1.ListMeta `json:"metadata,omitempty"`
   105  	Items           []SocialEvent `json:"items"`
   106  }
   107  
   108  func init() {
   109  	SchemeBuilder.Register(&SocialEvent{}, &SocialEventList{})
   110  }