generated.proto 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299
  1. /*
  2. Copyright The Kubernetes Authors.
  3. Licensed under the Apache License, Version 2.0 (the "License");
  4. you may not use this file except in compliance with the License.
  5. You may obtain a copy of the License at
  6. http://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. */
  13. // This file was autogenerated by go-to-protobuf. Do not edit it manually!
  14. syntax = "proto2";
  15. package k8s.io.api.authorization.v1beta1;
  16. import "k8s.io/api/authorization/v1/generated.proto";
  17. import "k8s.io/apimachinery/pkg/apis/meta/v1/generated.proto";
  18. import "k8s.io/apimachinery/pkg/runtime/generated.proto";
  19. import "k8s.io/apimachinery/pkg/runtime/schema/generated.proto";
  20. // Package-wide variables from generator "generated".
  21. option go_package = "k8s.io/api/authorization/v1beta1";
  22. // ExtraValue masks the value so protobuf can generate
  23. // +protobuf.nullable=true
  24. // +protobuf.options.(gogoproto.goproto_stringer)=false
  25. message ExtraValue {
  26. // items, if empty, will result in an empty slice
  27. repeated string items = 1;
  28. }
  29. // LocalSubjectAccessReview checks whether or not a user or group can perform an action in a given namespace.
  30. // Having a namespace scoped resource makes it much easier to grant namespace scoped policy that includes permissions
  31. // checking.
  32. message LocalSubjectAccessReview {
  33. // Standard list metadata.
  34. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
  35. // +optional
  36. optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1;
  37. // Spec holds information about the request being evaluated. spec.namespace must be equal to the namespace
  38. // you made the request against. If empty, it is defaulted.
  39. optional SubjectAccessReviewSpec spec = 2;
  40. // Status is filled in by the server and indicates whether the request is allowed or not
  41. // +optional
  42. optional SubjectAccessReviewStatus status = 3;
  43. }
  44. // NonResourceAttributes includes the authorization attributes available for non-resource requests to the Authorizer interface
  45. message NonResourceAttributes {
  46. // Path is the URL path of the request
  47. // +optional
  48. optional string path = 1;
  49. // Verb is the standard HTTP verb
  50. // +optional
  51. optional string verb = 2;
  52. }
  53. // NonResourceRule holds information that describes a rule for the non-resource
  54. message NonResourceRule {
  55. // Verb is a list of kubernetes non-resource API verbs, like: get, post, put, delete, patch, head, options. "*" means all.
  56. // +listType=atomic
  57. repeated string verbs = 1;
  58. // NonResourceURLs is a set of partial urls that a user should have access to. *s are allowed, but only as the full,
  59. // final step in the path. "*" means all.
  60. // +optional
  61. // +listType=atomic
  62. repeated string nonResourceURLs = 2;
  63. }
  64. // ResourceAttributes includes the authorization attributes available for resource requests to the Authorizer interface
  65. message ResourceAttributes {
  66. // Namespace is the namespace of the action being requested. Currently, there is no distinction between no namespace and all namespaces
  67. // "" (empty) is defaulted for LocalSubjectAccessReviews
  68. // "" (empty) is empty for cluster-scoped resources
  69. // "" (empty) means "all" for namespace scoped resources from a SubjectAccessReview or SelfSubjectAccessReview
  70. // +optional
  71. optional string namespace = 1;
  72. // Verb is a kubernetes resource API verb, like: get, list, watch, create, update, delete, proxy. "*" means all.
  73. // +optional
  74. optional string verb = 2;
  75. // Group is the API Group of the Resource. "*" means all.
  76. // +optional
  77. optional string group = 3;
  78. // Version is the API Version of the Resource. "*" means all.
  79. // +optional
  80. optional string version = 4;
  81. // Resource is one of the existing resource types. "*" means all.
  82. // +optional
  83. optional string resource = 5;
  84. // Subresource is one of the existing resource types. "" means none.
  85. // +optional
  86. optional string subresource = 6;
  87. // Name is the name of the resource being requested for a "get" or deleted for a "delete". "" (empty) means all.
  88. // +optional
  89. optional string name = 7;
  90. // fieldSelector describes the limitation on access based on field. It can only limit access, not broaden it.
  91. // +optional
  92. optional .k8s.io.api.authorization.v1.FieldSelectorAttributes fieldSelector = 8;
  93. // labelSelector describes the limitation on access based on labels. It can only limit access, not broaden it.
  94. // +optional
  95. optional .k8s.io.api.authorization.v1.LabelSelectorAttributes labelSelector = 9;
  96. }
  97. // ResourceRule is the list of actions the subject is allowed to perform on resources. The list ordering isn't significant,
  98. // may contain duplicates, and possibly be incomplete.
  99. message ResourceRule {
  100. // Verb is a list of kubernetes resource API verbs, like: get, list, watch, create, update, delete, proxy. "*" means all.
  101. // +listType=atomic
  102. repeated string verbs = 1;
  103. // APIGroups is the name of the APIGroup that contains the resources. If multiple API groups are specified, any action requested against one of
  104. // the enumerated resources in any API group will be allowed. "*" means all.
  105. // +optional
  106. // +listType=atomic
  107. repeated string apiGroups = 2;
  108. // Resources is a list of resources this rule applies to. "*" means all in the specified apiGroups.
  109. // "*/foo" represents the subresource 'foo' for all resources in the specified apiGroups.
  110. // +optional
  111. // +listType=atomic
  112. repeated string resources = 3;
  113. // ResourceNames is an optional white list of names that the rule applies to. An empty set means that everything is allowed. "*" means all.
  114. // +optional
  115. // +listType=atomic
  116. repeated string resourceNames = 4;
  117. }
  118. // SelfSubjectAccessReview checks whether or the current user can perform an action. Not filling in a
  119. // spec.namespace means "in all namespaces". Self is a special case, because users should always be able
  120. // to check whether they can perform an action
  121. message SelfSubjectAccessReview {
  122. // Standard list metadata.
  123. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
  124. // +optional
  125. optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1;
  126. // Spec holds information about the request being evaluated. user and groups must be empty
  127. optional SelfSubjectAccessReviewSpec spec = 2;
  128. // Status is filled in by the server and indicates whether the request is allowed or not
  129. // +optional
  130. optional SubjectAccessReviewStatus status = 3;
  131. }
  132. // SelfSubjectAccessReviewSpec is a description of the access request. Exactly one of ResourceAuthorizationAttributes
  133. // and NonResourceAuthorizationAttributes must be set
  134. message SelfSubjectAccessReviewSpec {
  135. // ResourceAuthorizationAttributes describes information for a resource access request
  136. // +optional
  137. optional ResourceAttributes resourceAttributes = 1;
  138. // NonResourceAttributes describes information for a non-resource access request
  139. // +optional
  140. optional NonResourceAttributes nonResourceAttributes = 2;
  141. }
  142. // SelfSubjectRulesReview enumerates the set of actions the current user can perform within a namespace.
  143. // The returned list of actions may be incomplete depending on the server's authorization mode,
  144. // and any errors experienced during the evaluation. SelfSubjectRulesReview should be used by UIs to show/hide actions,
  145. // or to quickly let an end user reason about their permissions. It should NOT Be used by external systems to
  146. // drive authorization decisions as this raises confused deputy, cache lifetime/revocation, and correctness concerns.
  147. // SubjectAccessReview, and LocalAccessReview are the correct way to defer authorization decisions to the API server.
  148. message SelfSubjectRulesReview {
  149. // Standard list metadata.
  150. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
  151. // +optional
  152. optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1;
  153. // Spec holds information about the request being evaluated.
  154. optional SelfSubjectRulesReviewSpec spec = 2;
  155. // Status is filled in by the server and indicates the set of actions a user can perform.
  156. // +optional
  157. optional SubjectRulesReviewStatus status = 3;
  158. }
  159. // SelfSubjectRulesReviewSpec defines the specification for SelfSubjectRulesReview.
  160. message SelfSubjectRulesReviewSpec {
  161. // Namespace to evaluate rules for. Required.
  162. optional string namespace = 1;
  163. }
  164. // SubjectAccessReview checks whether or not a user or group can perform an action.
  165. message SubjectAccessReview {
  166. // Standard list metadata.
  167. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
  168. // +optional
  169. optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1;
  170. // Spec holds information about the request being evaluated
  171. optional SubjectAccessReviewSpec spec = 2;
  172. // Status is filled in by the server and indicates whether the request is allowed or not
  173. // +optional
  174. optional SubjectAccessReviewStatus status = 3;
  175. }
  176. // SubjectAccessReviewSpec is a description of the access request. Exactly one of ResourceAuthorizationAttributes
  177. // and NonResourceAuthorizationAttributes must be set
  178. message SubjectAccessReviewSpec {
  179. // ResourceAuthorizationAttributes describes information for a resource access request
  180. // +optional
  181. optional ResourceAttributes resourceAttributes = 1;
  182. // NonResourceAttributes describes information for a non-resource access request
  183. // +optional
  184. optional NonResourceAttributes nonResourceAttributes = 2;
  185. // User is the user you're testing for.
  186. // If you specify "User" but not "Group", then is it interpreted as "What if User were not a member of any groups
  187. // +optional
  188. optional string user = 3;
  189. // Groups is the groups you're testing for.
  190. // +optional
  191. // +listType=atomic
  192. repeated string group = 4;
  193. // Extra corresponds to the user.Info.GetExtra() method from the authenticator. Since that is input to the authorizer
  194. // it needs a reflection here.
  195. // +optional
  196. map<string, ExtraValue> extra = 5;
  197. // UID information about the requesting user.
  198. // +optional
  199. optional string uid = 6;
  200. }
  201. // SubjectAccessReviewStatus
  202. message SubjectAccessReviewStatus {
  203. // Allowed is required. True if the action would be allowed, false otherwise.
  204. optional bool allowed = 1;
  205. // Denied is optional. True if the action would be denied, otherwise
  206. // false. If both allowed is false and denied is false, then the
  207. // authorizer has no opinion on whether to authorize the action. Denied
  208. // may not be true if Allowed is true.
  209. // +optional
  210. optional bool denied = 4;
  211. // Reason is optional. It indicates why a request was allowed or denied.
  212. // +optional
  213. optional string reason = 2;
  214. // EvaluationError is an indication that some error occurred during the authorization check.
  215. // It is entirely possible to get an error and be able to continue determine authorization status in spite of it.
  216. // For instance, RBAC can be missing a role, but enough roles are still present and bound to reason about the request.
  217. // +optional
  218. optional string evaluationError = 3;
  219. }
  220. // SubjectRulesReviewStatus contains the result of a rules check. This check can be incomplete depending on
  221. // the set of authorizers the server is configured with and any errors experienced during evaluation.
  222. // Because authorization rules are additive, if a rule appears in a list it's safe to assume the subject has that permission,
  223. // even if that list is incomplete.
  224. message SubjectRulesReviewStatus {
  225. // ResourceRules is the list of actions the subject is allowed to perform on resources.
  226. // The list ordering isn't significant, may contain duplicates, and possibly be incomplete.
  227. // +listType=atomic
  228. repeated ResourceRule resourceRules = 1;
  229. // NonResourceRules is the list of actions the subject is allowed to perform on non-resources.
  230. // The list ordering isn't significant, may contain duplicates, and possibly be incomplete.
  231. // +listType=atomic
  232. repeated NonResourceRule nonResourceRules = 2;
  233. // Incomplete is true when the rules returned by this call are incomplete. This is most commonly
  234. // encountered when an authorizer, such as an external authorizer, doesn't support rules evaluation.
  235. optional bool incomplete = 3;
  236. // EvaluationError can appear in combination with Rules. It indicates an error occurred during
  237. // rule evaluation, such as an authorizer that doesn't support rule evaluation, and that
  238. // ResourceRules and/or NonResourceRules may be incomplete.
  239. // +optional
  240. optional string evaluationError = 4;
  241. }