iam_policy.proto 3.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. // Copyright (c) 2015, Google Inc.
  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/iam/v1/policy.proto";
  17. option java_multiple_files = true;
  18. option java_outer_classname = "IamPolicyProto";
  19. option java_package = "com.google.iam.v1";
  20. // ## API Overview
  21. //
  22. // Any implementation of an API that offers access control features
  23. // implements the google.iam.v1.IAMPolicy interface.
  24. //
  25. // ## Data model
  26. //
  27. // Access control is applied when a principal (user or service account), takes
  28. // some action on a resource exposed by a service. Resources, identified by
  29. // URI-like names, are the unit of access control specification. Service
  30. // implementations can choose the granularity of access control and the
  31. // supported permissions for their resources.
  32. // For example one database service may allow access control to be
  33. // specified only at the Table level, whereas another might allow access control
  34. // to also be specified at the Column level.
  35. //
  36. // ## Policy Structure
  37. //
  38. // See google.iam.v1.Policy
  39. //
  40. // This is intentionally not a CRUD style API because access control policies
  41. // are created and deleted implicitly with the resources to which they are
  42. // attached.
  43. service IAMPolicy {
  44. // Sets the access control policy on the specified resource. Replaces any
  45. // existing policy.
  46. rpc SetIamPolicy(SetIamPolicyRequest) returns (Policy);
  47. // Gets the access control policy for a resource. Is empty if the
  48. // policy or the resource does not exist.
  49. rpc GetIamPolicy(GetIamPolicyRequest) returns (Policy);
  50. // Returns permissions that a caller has on the specified resource.
  51. rpc TestIamPermissions(TestIamPermissionsRequest) returns (TestIamPermissionsResponse);
  52. }
  53. // Request message for `SetIamPolicy` method.
  54. message SetIamPolicyRequest {
  55. // REQUIRED: The resource for which policy is being specified.
  56. // Resource is usually specified as a path, such as,
  57. // projects/{project}/zones/{zone}/disks/{disk}.
  58. string resource = 1;
  59. // REQUIRED: The complete policy to be applied to the 'resource'. The size of
  60. // the policy is limited to a few 10s of KB. An empty policy is in general a
  61. // valid policy but certain services (like Projects) might reject them.
  62. Policy policy = 2;
  63. }
  64. // Request message for `GetIamPolicy` method.
  65. message GetIamPolicyRequest {
  66. // REQUIRED: The resource for which policy is being requested. Resource
  67. // is usually specified as a path, such as, projects/{project}.
  68. string resource = 1;
  69. }
  70. // Request message for `TestIamPermissions` method.
  71. message TestIamPermissionsRequest {
  72. // REQUIRED: The resource for which policy detail is being requested.
  73. // Resource is usually specified as a path, such as, projects/{project}.
  74. string resource = 1;
  75. // The set of permissions to check for the 'resource'. Permissions with
  76. // wildcards (such as '*' or 'storage.*') are not allowed.
  77. repeated string permissions = 2;
  78. }
  79. // Response message for `TestIamPermissions` method.
  80. message TestIamPermissionsResponse {
  81. // A subset of `TestPermissionsRequest.permissions` that the caller is
  82. // allowed.
  83. repeated string permissions = 1;
  84. }