generated.proto 12 KB

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