1 package v1 2 3 import ( 4 "fmt" 5 6 corev1 "k8s.io/api/core/v1" 7 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" 8 ) 9 10 // +genclient 11 // +genclient:nonNamespaced 12 // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 13 14 // Upon log in, every user of the system receives a User and Identity resource. Administrators 15 // may directly manipulate the attributes of the users for their own tracking, or set groups 16 // via the API. The user name is unique and is chosen based on the value provided by the 17 // identity provider - if a user already exists with the incoming name, the user name may have 18 // a number appended to it depending on the configuration of the system. 19 // 20 // Compatibility level 1: Stable within a major release for a minimum of 12 months or 3 minor releases (whichever is longer). 21 // +openshift:compatibility-gen:level=1 22 type User struct { 23 metav1.TypeMeta `json:",inline"` 24 25 // metadata is the standard object's metadata. 26 // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata 27 metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` 28 29 // FullName is the full name of user 30 FullName string `json:"fullName,omitempty" protobuf:"bytes,2,opt,name=fullName"` 31 32 // Identities are the identities associated with this user 33 // +optional 34 Identities []string `json:"identities,omitempty" protobuf:"bytes,3,rep,name=identities"` 35 36 // Groups specifies group names this user is a member of. 37 // This field is deprecated and will be removed in a future release. 38 // Instead, create a Group object containing the name of this User. 39 Groups []string `json:"groups" protobuf:"bytes,4,rep,name=groups"` 40 } 41 42 // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 43 44 // UserList is a collection of Users 45 // 46 // Compatibility level 1: Stable within a major release for a minimum of 12 months or 3 minor releases (whichever is longer). 47 // +openshift:compatibility-gen:level=1 48 type UserList struct { 49 metav1.TypeMeta `json:",inline"` 50 51 // metadata is the standard list's metadata. 52 // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata 53 metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` 54 55 // Items is the list of users 56 Items []User `json:"items" protobuf:"bytes,2,rep,name=items"` 57 } 58 59 // +genclient 60 // +genclient:nonNamespaced 61 // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 62 63 // Identity records a successful authentication of a user with an identity provider. The 64 // information about the source of authentication is stored on the identity, and the identity 65 // is then associated with a single user object. Multiple identities can reference a single 66 // user. Information retrieved from the authentication provider is stored in the extra field 67 // using a schema determined by the provider. 68 // 69 // Compatibility level 1: Stable within a major release for a minimum of 12 months or 3 minor releases (whichever is longer). 70 // +openshift:compatibility-gen:level=1 71 type Identity struct { 72 metav1.TypeMeta `json:",inline"` 73 74 // metadata is the standard object's metadata. 75 // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata 76 metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` 77 78 // ProviderName is the source of identity information 79 ProviderName string `json:"providerName" protobuf:"bytes,2,opt,name=providerName"` 80 81 // ProviderUserName uniquely represents this identity in the scope of the provider 82 ProviderUserName string `json:"providerUserName" protobuf:"bytes,3,opt,name=providerUserName"` 83 84 // User is a reference to the user this identity is associated with 85 // Both Name and UID must be set 86 User corev1.ObjectReference `json:"user" protobuf:"bytes,4,opt,name=user"` 87 88 // Extra holds extra information about this identity 89 Extra map[string]string `json:"extra,omitempty" protobuf:"bytes,5,rep,name=extra"` 90 } 91 92 // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 93 94 // IdentityList is a collection of Identities 95 // 96 // Compatibility level 1: Stable within a major release for a minimum of 12 months or 3 minor releases (whichever is longer). 97 // +openshift:compatibility-gen:level=1 98 type IdentityList struct { 99 metav1.TypeMeta `json:",inline"` 100 101 // metadata is the standard list's metadata. 102 // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata 103 metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` 104 105 // Items is the list of identities 106 Items []Identity `json:"items" protobuf:"bytes,2,rep,name=items"` 107 } 108 109 // +genclient 110 // +genclient:nonNamespaced 111 // +genclient:onlyVerbs=get,create,update,delete 112 // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 113 114 // UserIdentityMapping maps a user to an identity 115 // 116 // Compatibility level 1: Stable within a major release for a minimum of 12 months or 3 minor releases (whichever is longer). 117 // +openshift:compatibility-gen:level=1 118 type UserIdentityMapping struct { 119 metav1.TypeMeta `json:",inline"` 120 121 // metadata is the standard object's metadata. 122 // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata 123 metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` 124 125 // Identity is a reference to an identity 126 Identity corev1.ObjectReference `json:"identity,omitempty" protobuf:"bytes,2,opt,name=identity"` 127 // User is a reference to a user 128 User corev1.ObjectReference `json:"user,omitempty" protobuf:"bytes,3,opt,name=user"` 129 } 130 131 // OptionalNames is an array that may also be left nil to distinguish between set and unset. 132 // +protobuf.nullable=true 133 // +protobuf.options.(gogoproto.goproto_stringer)=false 134 type OptionalNames []string 135 136 func (t OptionalNames) String() string { 137 return fmt.Sprintf("%v", []string(t)) 138 } 139 140 // +genclient 141 // +genclient:nonNamespaced 142 // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 143 144 // Group represents a referenceable set of Users 145 // 146 // Compatibility level 1: Stable within a major release for a minimum of 12 months or 3 minor releases (whichever is longer). 147 // +openshift:compatibility-gen:level=1 148 type Group struct { 149 metav1.TypeMeta `json:",inline"` 150 151 // metadata is the standard object's metadata. 152 // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata 153 metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` 154 155 // Users is the list of users in this group. 156 Users OptionalNames `json:"users" protobuf:"bytes,2,rep,name=users"` 157 } 158 159 // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 160 161 // GroupList is a collection of Groups 162 // 163 // Compatibility level 1: Stable within a major release for a minimum of 12 months or 3 minor releases (whichever is longer). 164 // +openshift:compatibility-gen:level=1 165 type GroupList struct { 166 metav1.TypeMeta `json:",inline"` 167 168 // metadata is the standard list's metadata. 169 // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata 170 metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` 171 172 // Items is the list of groups 173 Items []Group `json:"items" protobuf:"bytes,2,rep,name=items"` 174 } 175