Debian Codegraph @

pkg/authorization/authorizer/rule.go

raw
1 /*
2 Copyright 2017 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 package authorizer
18
19 type ResourceRuleInfo interface {
20 // GetVerbs returns a list of kubernetes resource API verbs.
21 GetVerbs() []string
22 // GetAPIGroups return the names of the APIGroup that contains the resources.
23 GetAPIGroups() []string
24 // GetResources return a list of resources the rule applies to.
25 GetResources() []string
26 // GetResourceNames return a white list of names that the rule applies to.
27 GetResourceNames() []string
28 }
29
30 // DefaultResourceRuleInfo holds information that describes a rule for the resource
31 type DefaultResourceRuleInfo struct {
32 Verbs []string
33 APIGroups []string
34 Resources []string
35 ResourceNames []string
36 }
37
38 func (i *DefaultResourceRuleInfo) GetVerbs() []string {
39 return i.Verbs
40 }
41
42 func (i *DefaultResourceRuleInfo) GetAPIGroups() []string {
43 return i.APIGroups
44 }
45
46 func (i *DefaultResourceRuleInfo) GetResources() []string {
47 return i.Resources
48 }
49
50 func (i *DefaultResourceRuleInfo) GetResourceNames() []string {
51 return i.ResourceNames
52 }
53
54 type NonResourceRuleInfo interface {
55 // GetVerbs returns a list of kubernetes resource API verbs.
56 GetVerbs() []string
57 // GetNonResourceURLs return a set of partial urls that a user should have access to.
58 GetNonResourceURLs() []string
59 }
60
61 // DefaultNonResourceRuleInfo holds information that describes a rule for the non-resource
62 type DefaultNonResourceRuleInfo struct {
63 Verbs []string
64 NonResourceURLs []string
65 }
66
67 func (i *DefaultNonResourceRuleInfo) GetVerbs() []string {
68 return i.Verbs
69 }
70
71 func (i *DefaultNonResourceRuleInfo) GetNonResourceURLs() []string {
72 return i.NonResourceURLs
73 }