generated.proto 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. /*
  2. Copyright 2017 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.kubernetes.pkg.apis.authorization.v1;
  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. import "k8s.io/apimachinery/pkg/util/intstr/generated.proto";
  20. import "k8s.io/apiserver/pkg/apis/example/v1/generated.proto";
  21. import "k8s.io/kubernetes/pkg/api/v1/generated.proto";
  22. // Package-wide variables from generator "generated".
  23. option go_package = "v1";
  24. // ExtraValue masks the value so protobuf can generate
  25. // +protobuf.nullable=true
  26. // +protobuf.options.(gogoproto.goproto_stringer)=false
  27. message ExtraValue {
  28. // items, if empty, will result in an empty slice
  29. repeated string items = 1;
  30. }
  31. // LocalSubjectAccessReview checks whether or not a user or group can perform an action in a given namespace.
  32. // Having a namespace scoped resource makes it much easier to grant namespace scoped policy that includes permissions
  33. // checking.
  34. message LocalSubjectAccessReview {
  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. // ResourceAttributes includes the authorization attributes available for resource requests to the Authorizer interface
  54. message ResourceAttributes {
  55. // Namespace is the namespace of the action being requested. Currently, there is no distinction between no namespace and all namespaces
  56. // "" (empty) is defaulted for LocalSubjectAccessReviews
  57. // "" (empty) is empty for cluster-scoped resources
  58. // "" (empty) means "all" for namespace scoped resources from a SubjectAccessReview or SelfSubjectAccessReview
  59. // +optional
  60. optional string namespace = 1;
  61. // Verb is a kubernetes resource API verb, like: get, list, watch, create, update, delete, proxy. "*" means all.
  62. // +optional
  63. optional string verb = 2;
  64. // Group is the API Group of the Resource. "*" means all.
  65. // +optional
  66. optional string group = 3;
  67. // Version is the API Version of the Resource. "*" means all.
  68. // +optional
  69. optional string version = 4;
  70. // Resource is one of the existing resource types. "*" means all.
  71. // +optional
  72. optional string resource = 5;
  73. // Subresource is one of the existing resource types. "" means none.
  74. // +optional
  75. optional string subresource = 6;
  76. // Name is the name of the resource being requested for a "get" or deleted for a "delete". "" (empty) means all.
  77. // +optional
  78. optional string name = 7;
  79. }
  80. // SelfSubjectAccessReview checks whether or the current user can perform an action. Not filling in a
  81. // spec.namespace means "in all namespaces". Self is a special case, because users should always be able
  82. // to check whether they can perform an action
  83. message SelfSubjectAccessReview {
  84. // +optional
  85. optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1;
  86. // Spec holds information about the request being evaluated. user and groups must be empty
  87. optional SelfSubjectAccessReviewSpec spec = 2;
  88. // Status is filled in by the server and indicates whether the request is allowed or not
  89. // +optional
  90. optional SubjectAccessReviewStatus status = 3;
  91. }
  92. // SelfSubjectAccessReviewSpec is a description of the access request. Exactly one of ResourceAuthorizationAttributes
  93. // and NonResourceAuthorizationAttributes must be set
  94. message SelfSubjectAccessReviewSpec {
  95. // ResourceAuthorizationAttributes describes information for a resource access request
  96. // +optional
  97. optional ResourceAttributes resourceAttributes = 1;
  98. // NonResourceAttributes describes information for a non-resource access request
  99. // +optional
  100. optional NonResourceAttributes nonResourceAttributes = 2;
  101. }
  102. // SubjectAccessReview checks whether or not a user or group can perform an action.
  103. message SubjectAccessReview {
  104. // +optional
  105. optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1;
  106. // Spec holds information about the request being evaluated
  107. optional SubjectAccessReviewSpec spec = 2;
  108. // Status is filled in by the server and indicates whether the request is allowed or not
  109. // +optional
  110. optional SubjectAccessReviewStatus status = 3;
  111. }
  112. // SubjectAccessReviewSpec is a description of the access request. Exactly one of ResourceAuthorizationAttributes
  113. // and NonResourceAuthorizationAttributes must be set
  114. message SubjectAccessReviewSpec {
  115. // ResourceAuthorizationAttributes describes information for a resource access request
  116. // +optional
  117. optional ResourceAttributes resourceAttributes = 1;
  118. // NonResourceAttributes describes information for a non-resource access request
  119. // +optional
  120. optional NonResourceAttributes nonResourceAttributes = 2;
  121. // User is the user you're testing for.
  122. // If you specify "User" but not "Groups", then is it interpreted as "What if User were not a member of any groups
  123. // +optional
  124. optional string verb = 3;
  125. // Groups is the groups you're testing for.
  126. // +optional
  127. repeated string groups = 4;
  128. // Extra corresponds to the user.Info.GetExtra() method from the authenticator. Since that is input to the authorizer
  129. // it needs a reflection here.
  130. // +optional
  131. map<string, ExtraValue> extra = 5;
  132. }
  133. // SubjectAccessReviewStatus
  134. message SubjectAccessReviewStatus {
  135. // Allowed is required. True if the action would be allowed, false otherwise.
  136. optional bool allowed = 1;
  137. // Reason is optional. It indicates why a request was allowed or denied.
  138. // +optional
  139. optional string reason = 2;
  140. // EvaluationError is an indication that some error occurred during the authorization check.
  141. // It is entirely possible to get an error and be able to continue determine authorization status in spite of it.
  142. // For instance, RBAC can be missing a role, but enough roles are still present and bound to reason about the request.
  143. // +optional
  144. optional string evaluationError = 3;
  145. }