iam_policy.proto 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. // Copyright 2022 Google LLC
  2. //
  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. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. syntax = "proto3";
  15. package google.iam.v1;
  16. import "google/api/annotations.proto";
  17. import "google/api/client.proto";
  18. import "google/api/field_behavior.proto";
  19. import "google/api/resource.proto";
  20. import "google/iam/v1/options.proto";
  21. import "google/iam/v1/policy.proto";
  22. import "google/protobuf/field_mask.proto";
  23. option cc_enable_arenas = true;
  24. option csharp_namespace = "Google.Cloud.Iam.V1";
  25. option go_package = "google.golang.org/genproto/googleapis/iam/v1;iam";
  26. option java_multiple_files = true;
  27. option java_outer_classname = "IamPolicyProto";
  28. option java_package = "com.google.iam.v1";
  29. option php_namespace = "Google\\Cloud\\Iam\\V1";
  30. // API Overview
  31. //
  32. //
  33. // Manages Identity and Access Management (IAM) policies.
  34. //
  35. // Any implementation of an API that offers access control features
  36. // implements the google.iam.v1.IAMPolicy interface.
  37. //
  38. // ## Data model
  39. //
  40. // Access control is applied when a principal (user or service account), takes
  41. // some action on a resource exposed by a service. Resources, identified by
  42. // URI-like names, are the unit of access control specification. Service
  43. // implementations can choose the granularity of access control and the
  44. // supported permissions for their resources.
  45. // For example one database service may allow access control to be
  46. // specified only at the Table level, whereas another might allow access control
  47. // to also be specified at the Column level.
  48. //
  49. // ## Policy Structure
  50. //
  51. // See google.iam.v1.Policy
  52. //
  53. // This is intentionally not a CRUD style API because access control policies
  54. // are created and deleted implicitly with the resources to which they are
  55. // attached.
  56. service IAMPolicy {
  57. option (google.api.default_host) = "iam-meta-api.googleapis.com";
  58. // Sets the access control policy on the specified resource. Replaces any
  59. // existing policy.
  60. //
  61. // Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
  62. rpc SetIamPolicy(SetIamPolicyRequest) returns (Policy) {
  63. option (google.api.http) = {
  64. post: "/v1/{resource=**}:setIamPolicy"
  65. body: "*"
  66. };
  67. }
  68. // Gets the access control policy for a resource.
  69. // Returns an empty policy if the resource exists and does not have a policy
  70. // set.
  71. rpc GetIamPolicy(GetIamPolicyRequest) returns (Policy) {
  72. option (google.api.http) = {
  73. post: "/v1/{resource=**}:getIamPolicy"
  74. body: "*"
  75. };
  76. }
  77. // Returns permissions that a caller has on the specified resource.
  78. // If the resource does not exist, this will return an empty set of
  79. // permissions, not a `NOT_FOUND` error.
  80. //
  81. // Note: This operation is designed to be used for building permission-aware
  82. // UIs and command-line tools, not for authorization checking. This operation
  83. // may "fail open" without warning.
  84. rpc TestIamPermissions(TestIamPermissionsRequest) returns (TestIamPermissionsResponse) {
  85. option (google.api.http) = {
  86. post: "/v1/{resource=**}:testIamPermissions"
  87. body: "*"
  88. };
  89. }
  90. }
  91. // Request message for `SetIamPolicy` method.
  92. message SetIamPolicyRequest {
  93. // REQUIRED: The resource for which the policy is being specified.
  94. // See the operation documentation for the appropriate value for this field.
  95. string resource = 1 [
  96. (google.api.field_behavior) = REQUIRED,
  97. (google.api.resource_reference).type = "*"];
  98. // REQUIRED: The complete policy to be applied to the `resource`. The size of
  99. // the policy is limited to a few 10s of KB. An empty policy is a
  100. // valid policy but certain Cloud Platform services (such as Projects)
  101. // might reject them.
  102. Policy policy = 2 [(google.api.field_behavior) = REQUIRED];
  103. // OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only
  104. // the fields in the mask will be modified. If no mask is provided, the
  105. // following default mask is used:
  106. //
  107. // `paths: "bindings, etag"`
  108. google.protobuf.FieldMask update_mask = 3;
  109. }
  110. // Request message for `GetIamPolicy` method.
  111. message GetIamPolicyRequest {
  112. // REQUIRED: The resource for which the policy is being requested.
  113. // See the operation documentation for the appropriate value for this field.
  114. string resource = 1 [
  115. (google.api.field_behavior) = REQUIRED,
  116. (google.api.resource_reference).type = "*"];
  117. // OPTIONAL: A `GetPolicyOptions` object for specifying options to
  118. // `GetIamPolicy`.
  119. GetPolicyOptions options = 2;
  120. }
  121. // Request message for `TestIamPermissions` method.
  122. message TestIamPermissionsRequest {
  123. // REQUIRED: The resource for which the policy detail is being requested.
  124. // See the operation documentation for the appropriate value for this field.
  125. string resource = 1[
  126. (google.api.field_behavior) = REQUIRED,
  127. (google.api.resource_reference).type = "*"];
  128. // The set of permissions to check for the `resource`. Permissions with
  129. // wildcards (such as '*' or 'storage.*') are not allowed. For more
  130. // information see
  131. // [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions).
  132. repeated string permissions = 2 [(google.api.field_behavior) = REQUIRED];
  133. }
  134. // Response message for `TestIamPermissions` method.
  135. message TestIamPermissionsResponse {
  136. // A subset of `TestPermissionsRequest.permissions` that the caller is
  137. // allowed.
  138. repeated string permissions = 1;
  139. }