iam_policy.proto 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. // Copyright 2019 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. //
  15. syntax = "proto3";
  16. package google.iam.v1;
  17. import "google/iam/v1/options.proto";
  18. import "google/iam/v1/policy.proto";
  19. import "google/api/annotations.proto";
  20. import "google/api/client.proto";
  21. import "google/api/field_behavior.proto";
  22. import "google/api/resource.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. // Manages Identity and Access Management (IAM) policies.
  33. //
  34. // Any implementation of an API that offers access control features
  35. // implements the google.iam.v1.IAMPolicy interface.
  36. //
  37. // ## Data model
  38. //
  39. // Access control is applied when a principal (user or service account), takes
  40. // some action on a resource exposed by a service. Resources, identified by
  41. // URI-like names, are the unit of access control specification. Service
  42. // implementations can choose the granularity of access control and the
  43. // supported permissions for their resources.
  44. // For example one database service may allow access control to be
  45. // specified only at the Table level, whereas another might allow access control
  46. // to also be specified at the Column level.
  47. //
  48. // ## Policy Structure
  49. //
  50. // See google.iam.v1.Policy
  51. //
  52. // This is intentionally not a CRUD style API because access control policies
  53. // are created and deleted implicitly with the resources to which they are
  54. // attached.
  55. service IAMPolicy {
  56. option (google.api.default_host) = "iam-meta-api.googleapis.com";
  57. // Sets the access control policy on the specified resource. Replaces any
  58. // existing policy.
  59. rpc SetIamPolicy(SetIamPolicyRequest) returns (Policy) {
  60. option (google.api.http) = {
  61. post: "/v1/{resource=**}:setIamPolicy"
  62. body: "*"
  63. };
  64. }
  65. // Gets the access control policy for a resource.
  66. // Returns an empty policy if the resource exists and does not have a policy
  67. // set.
  68. rpc GetIamPolicy(GetIamPolicyRequest) returns (Policy) {
  69. option (google.api.http) = {
  70. post: "/v1/{resource=**}:getIamPolicy"
  71. body: "*"
  72. };
  73. }
  74. // Returns permissions that a caller has on the specified resource.
  75. // If the resource does not exist, this will return an empty set of
  76. // permissions, not a NOT_FOUND error.
  77. //
  78. // Note: This operation is designed to be used for building permission-aware
  79. // UIs and command-line tools, not for authorization checking. This operation
  80. // may "fail open" without warning.
  81. rpc TestIamPermissions(TestIamPermissionsRequest) returns (TestIamPermissionsResponse) {
  82. option (google.api.http) = {
  83. post: "/v1/{resource=**}:testIamPermissions"
  84. body: "*"
  85. };
  86. }
  87. }
  88. // Request message for `SetIamPolicy` method.
  89. message SetIamPolicyRequest {
  90. // REQUIRED: The resource for which the policy is being specified.
  91. // See the operation documentation for the appropriate value for this field.
  92. string resource = 1 [
  93. (google.api.field_behavior) = REQUIRED,
  94. (google.api.resource_reference).type = "*"];
  95. // REQUIRED: The complete policy to be applied to the `resource`. The size of
  96. // the policy is limited to a few 10s of KB. An empty policy is a
  97. // valid policy but certain Cloud Platform services (such as Projects)
  98. // might reject them.
  99. Policy policy = 2 [(google.api.field_behavior) = REQUIRED];
  100. }
  101. // Request message for `GetIamPolicy` method.
  102. message GetIamPolicyRequest {
  103. // REQUIRED: The resource for which the policy is being requested.
  104. // See the operation documentation for the appropriate value for this field.
  105. string resource = 1 [
  106. (google.api.field_behavior) = REQUIRED,
  107. (google.api.resource_reference).type = "*"];
  108. // OPTIONAL: A `GetPolicyOptions` object for specifying options to
  109. // `GetIamPolicy`. This field is only used by Cloud IAM.
  110. GetPolicyOptions options = 2;
  111. }
  112. // Request message for `TestIamPermissions` method.
  113. message TestIamPermissionsRequest {
  114. // REQUIRED: The resource for which the policy detail is being requested.
  115. // See the operation documentation for the appropriate value for this field.
  116. string resource = 1[
  117. (google.api.field_behavior) = REQUIRED,
  118. (google.api.resource_reference).type = "*"];
  119. // The set of permissions to check for the `resource`. Permissions with
  120. // wildcards (such as '*' or 'storage.*') are not allowed. For more
  121. // information see
  122. // [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions).
  123. repeated string permissions = 2 [(google.api.field_behavior) = REQUIRED];
  124. }
  125. // Response message for `TestIamPermissions` method.
  126. message TestIamPermissionsResponse {
  127. // A subset of `TestPermissionsRequest.permissions` that the caller is
  128. // allowed.
  129. repeated string permissions = 1;
  130. }