Skip to content

Commit

Permalink
Add User and OrganizationMembers Resources
Browse files Browse the repository at this point in the history
  • Loading branch information
glrf committed Jan 14, 2022
1 parent b45baaa commit cbcb703
Show file tree
Hide file tree
Showing 5 changed files with 441 additions and 0 deletions.
43 changes: 43 additions & 0 deletions apis/v1/organizationmembers_type.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package v1

import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

// +kubebuilder:object:root=true
// +kubebuilder:subresource:status

// OrganizationMembers is the collection of members of an organization
type OrganizationMembers struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

Spec OrganizationMembersSpec `json:"spec,omitempty"`
Status OrganizationMembersStatus `json:"status,omitempty"`
}

type OrganizationMembersSpec struct {
UserRefs []UserRef `json:"userRefs,omitempty"`
}
type OrganizationMembersStatus struct {
UserRefs []UserRef `json:"resolvedUserRefs,omitempty"`
}

type UserRef struct {
ID string `json:"id,omitempty"`
Username string `json:"username,omitempty"`
}

// +kubebuilder:object:root=true

// OrganizationMembersList contains a list of OrganizationMembers resources
type OrganizationMembersList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`

Items []OrganizationMembers `json:"items"`
}

func init() {
SchemeBuilder.Register(&OrganizationMembers{}, &OrganizationMembersList{})
}
44 changes: 44 additions & 0 deletions apis/v1/user_types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package v1

import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

// +kubebuilder:object:root=true
// +kubebuilder:resource:scope=Cluster
// +kubebuilder:subresource:status

// User is a representation of a APPUiO Cloud user
type User struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

Spec UserSpec `json:"spec,omitempty"`
Status UserStatus `json:"status,omitempty"`
}
type UserSpec struct {
Preferences UserPreferences `json:"Preferences,omitempty"`
}
type UserPreferences struct {
DefaultOrganizationRef string `json:"defaultOrganizationRef,omitempty"`
}
type UserStatus struct {
DefaultOrganizationRef string `json:"defaultOrganization,omitempty"`
DisplayName string `json:"displayName,omitempty"`
Username string `json:"username,omitempty"`
Email string `json:"email,omitempty"`
}

// +kubebuilder:object:root=true

// UserList contains a list of Users.
type UserList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`

Items []User `json:"items"`
}

func init() {
SchemeBuilder.Register(&User{}, &UserList{})
}
219 changes: 219 additions & 0 deletions apis/v1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@

---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.7.0
creationTimestamp: null
name: organizationmembers.appuio.io
spec:
group: appuio.io
names:
kind: OrganizationMembers
listKind: OrganizationMembersList
plural: organizationmembers
singular: organizationmembers
scope: Namespaced
versions:
- name: v1
schema:
openAPIV3Schema:
description: OrganizationMembers is the collection of members of an organization
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
type: string
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
metadata:
type: object
spec:
properties:
userRefs:
items:
properties:
id:
type: string
username:
type: string
type: object
type: array
type: object
status:
properties:
resolvedUserRefs:
items:
properties:
id:
type: string
username:
type: string
type: object
type: array
type: object
type: object
served: true
storage: true
subresources:
status: {}
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []
Loading

0 comments on commit cbcb703

Please sign in to comment.