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