Skip to content

Instantly share code, notes, and snippets.

@Miciah
Last active October 10, 2016 19:32
Show Gist options
  • Save Miciah/7ac08846f3d021bbdd8aaea98c317600 to your computer and use it in GitHub Desktop.
Save Miciah/7ac08846f3d021bbdd8aaea98c317600 to your computer and use it in GitHub Desktop.
package collaboration
const (
// CollaboratorAnnotation is the key for an annotation on Namespace that
// specifies collaborators on the namespace.
CollaboratorAnnotation = "authorization.openshift.io/collaborators"
)
// CollaboratorType is a type of collaborator on a project.
type CollaboratorType string
const (
// CollaboratorTypeUser indicates a collaborator that is a regular user.
CollaboratorTypeUser CollaboratorType = "User"
// CollaboratorTypeUser indicates a collaborator that is a regular group.
CollaboratorTypeGroup CollaboratorType = "Group"
// CollaboratorTypeUser indicates a collaborator that is a system user.
CollaboratorTypeSystemUser CollaboratorType = "SystemUser"
// CollaboratorTypeUser indicates a collaborator that is a system group.
CollaboratorTypeSystemGroup CollaboratorType = "SystemGroup"
// CollaboratorTypeServiceAccount indicates a collaborator that is a service
// account.
CollaboratorTypeServiceAccount CollaboratorType = "ServiceAccount"
)
// CollaboratorMatcher is an object that can be matched against a subject (user,
// group, or service account) to determine if that subject is a collaborator on
// the namespace to which the CollaboratorMatcher belongs. A namespace has an
// array of CollaboratorMatcher objects, stored as serialized as JSON in an
// annotation with the key CollaboratorAnnotation. If any one of those
// CollaboratorMatcher objects matches a subject, that subject is considered to
// be a collaborator on the namespace. Each CollaboratorMatcher object
// specifies a type of collaborator (CollaboratorType) and either a list of
// literal names or a label query (in which case the list must be empty).
type CollaboratorMatcher struct {
unversioned.TypeMeta `json:",inline"`
ObjectMeta `json:"metadata,omitempty"`
// Type is the type of collaborators against which this CollaboratorMatcher
// may be matched.
Type CollaboratorType `json:"type"`
// Literals is a list of names that will be compared against the name of the
// subject being matched.
Literals []string `json:"literals,omitempty"`
// Selector is a label query that will be matched against the subject being
// matched.
Selector *unversioned.LabelSelector `json:"selector,omitempty"`
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment