| 1 |
// Copyright 2016 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 |
|
| 15 |
syntax = "proto3"; |
| 16 |
|
| 17 |
package google.iam.v1; |
| 18 |
|
| 19 |
import "google/api/annotations.proto"; |
| 20 |
import "google/iam/v1/policy.proto"; |
| 21 |
|
| 22 |
option cc_enable_arenas = true; |
| 23 |
option csharp_namespace = "Google.Cloud.Iam.V1"; |
| 24 |
option go_package = "google.golang.org/genproto/googleapis/iam/v1;iam"; |
| 25 |
option java_multiple_files = true; |
| 26 |
option java_outer_classname = "IamPolicyProto"; |
| 27 |
option java_package = "com.google.iam.v1"; |
| 28 |
|
| 29 |
|
| 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 |
// Sets the access control policy on the specified resource. Replaces any |
| 57 |
// existing policy. |
| 58 |
rpc SetIamPolicy(SetIamPolicyRequest) returns (Policy) { |
| 59 |
option (google.api.http) = { post: "/v1/{resource=**}:setIamPolicy" body: "*" }; |
| 60 |
} |
| 61 |
|
| 62 |
// Gets the access control policy for a resource. |
| 63 |
// Returns an empty policy if the resource exists and does not have a policy |
| 64 |
// set. |
| 65 |
rpc GetIamPolicy(GetIamPolicyRequest) returns (Policy) { |
| 66 |
option (google.api.http) = { post: "/v1/{resource=**}:getIamPolicy" body: "*" }; |
| 67 |
} |
| 68 |
|
| 69 |
// Returns permissions that a caller has on the specified resource. |
| 70 |
// If the resource does not exist, this will return an empty set of |
| 71 |
// permissions, not a NOT_FOUND error. |
| 72 |
rpc TestIamPermissions(TestIamPermissionsRequest) returns (TestIamPermissionsResponse) { |
| 73 |
option (google.api.http) = { post: "/v1/{resource=**}:testIamPermissions" body: "*" }; |
| 74 |
} |
| 75 |
} |
| 76 |
|
| 77 |
// Request message for `SetIamPolicy` method. |
| 78 |
message SetIamPolicyRequest { |
| 79 |
// REQUIRED: The resource for which the policy is being specified. |
| 80 |
// `resource` is usually specified as a path. For example, a Project |
| 81 |
// resource is specified as `projects/{project}`. |
| 82 |
string resource = 1; |
| 83 |
|
| 84 |
// REQUIRED: The complete policy to be applied to the `resource`. The size of |
| 85 |
// the policy is limited to a few 10s of KB. An empty policy is a |
| 86 |
// valid policy but certain Cloud Platform services (such as Projects) |
| 87 |
// might reject them. |
| 88 |
Policy policy = 2; |
| 89 |
} |
| 90 |
|
| 91 |
// Request message for `GetIamPolicy` method. |
| 92 |
message GetIamPolicyRequest { |
| 93 |
// REQUIRED: The resource for which the policy is being requested. |
| 94 |
// `resource` is usually specified as a path. For example, a Project |
| 95 |
// resource is specified as `projects/{project}`. |
| 96 |
string resource = 1; |
| 97 |
} |
| 98 |
|
| 99 |
// Request message for `TestIamPermissions` method. |
| 100 |
message TestIamPermissionsRequest { |
| 101 |
// REQUIRED: The resource for which the policy detail is being requested. |
| 102 |
// `resource` is usually specified as a path. For example, a Project |
| 103 |
// resource is specified as `projects/{project}`. |
| 104 |
string resource = 1; |
| 105 |
|
| 106 |
// The set of permissions to check for the `resource`. Permissions with |
| 107 |
// wildcards (such as '*' or 'storage.*') are not allowed. For more |
| 108 |
// information see |
| 109 |
// [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). |
| 110 |
repeated string permissions = 2; |
| 111 |
} |
| 112 |
|
| 113 |
// Response message for `TestIamPermissions` method. |
| 114 |
message TestIamPermissionsResponse { |
| 115 |
// A subset of `TestPermissionsRequest.permissions` that the caller is |
| 116 |
// allowed. |
| 117 |
repeated string permissions = 1; |
| 118 |
} |