k8s.io/kubernetes@v1.29.3/pkg/apis/abac/v0/types.go (about)

     1  /*
     2  Copyright 2015 The Kubernetes Authors.
     3  
     4  Licensed under the Apache License, Version 2.0 (the "License");
     5  you may not use this file except in compliance with the License.
     6  You may obtain a copy of the License at
     7  
     8      http://www.apache.org/licenses/LICENSE-2.0
     9  
    10  Unless required by applicable law or agreed to in writing, software
    11  distributed under the License is distributed on an "AS IS" BASIS,
    12  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13  See the License for the specific language governing permissions and
    14  limitations under the License.
    15  */
    16  
    17  // +k8s:openapi-gen=true
    18  
    19  package v0
    20  
    21  import (
    22  	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
    23  )
    24  
    25  // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
    26  
    27  // Policy contains a single ABAC policy rule
    28  type Policy struct {
    29  	metav1.TypeMeta `json:",inline"`
    30  
    31  	// User is the username this rule applies to.
    32  	// Either user or group is required to match the request.
    33  	// "*" matches all users.
    34  	// +optional
    35  	User string `json:"user,omitempty"`
    36  
    37  	// Group is the group this rule applies to.
    38  	// Either user or group is required to match the request.
    39  	// "*" matches all groups.
    40  	// +optional
    41  	Group string `json:"group,omitempty"`
    42  
    43  	// Readonly matches readonly requests when true, and all requests when false
    44  	// +optional
    45  	Readonly bool `json:"readonly,omitempty"`
    46  
    47  	// Resource is the name of a resource
    48  	// "*" matches all resources
    49  	// +optional
    50  	Resource string `json:"resource,omitempty"`
    51  
    52  	// Namespace is the name of a namespace
    53  	// "*" matches all namespaces (including unnamespaced requests)
    54  	// +optional
    55  	Namespace string `json:"namespace,omitempty"`
    56  }