| 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.admin.v1; |
| 18 |
|
| 19 |
import "google/api/annotations.proto"; |
| 20 |
import "google/iam/v1/iam_policy.proto"; |
| 21 |
import "google/iam/v1/policy.proto"; |
| 22 |
import "google/protobuf/empty.proto"; |
| 23 |
import "google/protobuf/field_mask.proto"; |
| 24 |
import "google/protobuf/timestamp.proto"; |
| 25 |
|
| 26 |
option cc_enable_arenas = true; |
| 27 |
option go_package = "google.golang.org/genproto/googleapis/iam/admin/v1;admin"; |
| 28 |
option java_multiple_files = true; |
| 29 |
option java_outer_classname = "IamProto"; |
| 30 |
option java_package = "com.google.iam.admin.v1"; |
| 31 |
|
| 32 |
|
| 33 |
// Creates and manages service account objects. |
| 34 |
// |
| 35 |
// Service account is an account that belongs to your project instead |
| 36 |
// of to an individual end user. It is used to authenticate calls |
| 37 |
// to a Google API. |
| 38 |
// |
| 39 |
// To create a service account, specify the `project_id` and `account_id` |
| 40 |
// for the account. The `account_id` is unique within the project, and used |
| 41 |
// to generate the service account email address and a stable |
| 42 |
// `unique_id`. |
| 43 |
// |
| 44 |
// All other methods can identify accounts using the format |
| 45 |
// `projects/{project}/serviceAccounts/{account}`. |
| 46 |
// Using `-` as a wildcard for the project will infer the project from |
| 47 |
// the account. The `account` value can be the `email` address or the |
| 48 |
// `unique_id` of the service account. |
| 49 |
service IAM { |
| 50 |
// Lists [ServiceAccounts][google.iam.admin.v1.ServiceAccount] for a project. |
| 51 |
rpc ListServiceAccounts(ListServiceAccountsRequest) returns (ListServiceAccountsResponse) { |
| 52 |
option (google.api.http) = { get: "/v1/{name=projects/*}/serviceAccounts" }; |
| 53 |
} |
| 54 |
|
| 55 |
// Gets a [ServiceAccount][google.iam.admin.v1.ServiceAccount]. |
| 56 |
rpc GetServiceAccount(GetServiceAccountRequest) returns (ServiceAccount) { |
| 57 |
option (google.api.http) = { get: "/v1/{name=projects/*/serviceAccounts/*}" }; |
| 58 |
} |
| 59 |
|
| 60 |
// Creates a [ServiceAccount][google.iam.admin.v1.ServiceAccount] |
| 61 |
// and returns it. |
| 62 |
rpc CreateServiceAccount(CreateServiceAccountRequest) returns (ServiceAccount) { |
| 63 |
option (google.api.http) = { post: "/v1/{name=projects/*}/serviceAccounts" body: "*" }; |
| 64 |
} |
| 65 |
|
| 66 |
// Updates a [ServiceAccount][google.iam.admin.v1.ServiceAccount]. |
| 67 |
// |
| 68 |
// Currently, only the following fields are updatable: |
| 69 |
// `display_name` . |
| 70 |
// The `etag` is mandatory. |
| 71 |
rpc UpdateServiceAccount(ServiceAccount) returns (ServiceAccount) { |
| 72 |
option (google.api.http) = { put: "/v1/{name=projects/*/serviceAccounts/*}" body: "*" }; |
| 73 |
} |
| 74 |
|
| 75 |
// Deletes a [ServiceAccount][google.iam.admin.v1.ServiceAccount]. |
| 76 |
rpc DeleteServiceAccount(DeleteServiceAccountRequest) returns (google.protobuf.Empty) { |
| 77 |
option (google.api.http) = { delete: "/v1/{name=projects/*/serviceAccounts/*}" }; |
| 78 |
} |
| 79 |
|
| 80 |
// Lists [ServiceAccountKeys][google.iam.admin.v1.ServiceAccountKey]. |
| 81 |
rpc ListServiceAccountKeys(ListServiceAccountKeysRequest) returns (ListServiceAccountKeysResponse) { |
| 82 |
option (google.api.http) = { get: "/v1/{name=projects/*/serviceAccounts/*}/keys" }; |
| 83 |
} |
| 84 |
|
| 85 |
// Gets the [ServiceAccountKey][google.iam.admin.v1.ServiceAccountKey] |
| 86 |
// by key id. |
| 87 |
rpc GetServiceAccountKey(GetServiceAccountKeyRequest) returns (ServiceAccountKey) { |
| 88 |
option (google.api.http) = { get: "/v1/{name=projects/*/serviceAccounts/*/keys/*}" }; |
| 89 |
} |
| 90 |
|
| 91 |
// Creates a [ServiceAccountKey][google.iam.admin.v1.ServiceAccountKey] |
| 92 |
// and returns it. |
| 93 |
rpc CreateServiceAccountKey(CreateServiceAccountKeyRequest) returns (ServiceAccountKey) { |
| 94 |
option (google.api.http) = { post: "/v1/{name=projects/*/serviceAccounts/*}/keys" body: "*" }; |
| 95 |
} |
| 96 |
|
| 97 |
// Deletes a [ServiceAccountKey][google.iam.admin.v1.ServiceAccountKey]. |
| 98 |
rpc DeleteServiceAccountKey(DeleteServiceAccountKeyRequest) returns (google.protobuf.Empty) { |
| 99 |
option (google.api.http) = { delete: "/v1/{name=projects/*/serviceAccounts/*/keys/*}" }; |
| 100 |
} |
| 101 |
|
| 102 |
// Signs a blob using a service account's system-managed private key. |
| 103 |
rpc SignBlob(SignBlobRequest) returns (SignBlobResponse) { |
| 104 |
option (google.api.http) = { post: "/v1/{name=projects/*/serviceAccounts/*}:signBlob" body: "*" }; |
| 105 |
} |
| 106 |
|
| 107 |
// Returns the IAM access control policy for a |
| 108 |
// [ServiceAccount][google.iam.admin.v1.ServiceAccount]. |
| 109 |
rpc GetIamPolicy(google.iam.v1.GetIamPolicyRequest) returns (google.iam.v1.Policy) { |
| 110 |
option (google.api.http) = { post: "/v1/{resource=projects/*/serviceAccounts/*}:getIamPolicy" body: "" }; |
| 111 |
} |
| 112 |
|
| 113 |
// Sets the IAM access control policy for a |
| 114 |
// [ServiceAccount][google.iam.admin.v1.ServiceAccount]. |
| 115 |
rpc SetIamPolicy(google.iam.v1.SetIamPolicyRequest) returns (google.iam.v1.Policy) { |
| 116 |
option (google.api.http) = { post: "/v1/{resource=projects/*/serviceAccounts/*}:setIamPolicy" body: "*" }; |
| 117 |
} |
| 118 |
|
| 119 |
// Tests the specified permissions against the IAM access control policy |
| 120 |
// for a [ServiceAccount][google.iam.admin.v1.ServiceAccount]. |
| 121 |
rpc TestIamPermissions(google.iam.v1.TestIamPermissionsRequest) returns (google.iam.v1.TestIamPermissionsResponse) { |
| 122 |
option (google.api.http) = { post: "/v1/{resource=projects/*/serviceAccounts/*}:testIamPermissions" body: "*" }; |
| 123 |
} |
| 124 |
|
| 125 |
// Queries roles that can be granted on a particular resource. |
| 126 |
// A role is grantable if it can be used as the role in a binding for a policy |
| 127 |
// for that resource. |
| 128 |
rpc QueryGrantableRoles(QueryGrantableRolesRequest) returns (QueryGrantableRolesResponse) { |
| 129 |
option (google.api.http) = { post: "/v1/roles:queryGrantableRoles" body: "*" }; |
| 130 |
} |
| 131 |
} |
| 132 |
|
| 133 |
// A service account in the Identity and Access Management API. |
| 134 |
// |
| 135 |
// To create a service account, specify the `project_id` and the `account_id` |
| 136 |
// for the account. The `account_id` is unique within the project, and is used |
| 137 |
// to generate the service account email address and a stable |
| 138 |
// `unique_id`. |
| 139 |
// |
| 140 |
// If the account already exists, the account's resource name is returned |
| 141 |
// in util::Status's ResourceInfo.resource_name in the format of |
| 142 |
// projects/{project}/serviceAccounts/{email}. The caller can use the name in |
| 143 |
// other methods to access the account. |
| 144 |
// |
| 145 |
// All other methods can identify the service account using the format |
| 146 |
// `projects/{project}/serviceAccounts/{account}`. |
| 147 |
// Using `-` as a wildcard for the project will infer the project from |
| 148 |
// the account. The `account` value can be the `email` address or the |
| 149 |
// `unique_id` of the service account. |
| 150 |
message ServiceAccount { |
| 151 |
// The resource name of the service account in the following format: |
| 152 |
// `projects/{project}/serviceAccounts/{account}`. |
| 153 |
// |
| 154 |
// Requests using `-` as a wildcard for the project will infer the project |
| 155 |
// from the `account` and the `account` value can be the `email` address or |
| 156 |
// the `unique_id` of the service account. |
| 157 |
// |
| 158 |
// In responses the resource name will always be in the format |
| 159 |
// `projects/{project}/serviceAccounts/{email}`. |
| 160 |
string name = 1; |
| 161 |
|
| 162 |
// @OutputOnly The id of the project that owns the service account. |
| 163 |
string project_id = 2; |
| 164 |
|
| 165 |
// @OutputOnly The unique and stable id of the service account. |
| 166 |
string unique_id = 4; |
| 167 |
|
| 168 |
// @OutputOnly The email address of the service account. |
| 169 |
string email = 5; |
| 170 |
|
| 171 |
// Optional. A user-specified description of the service account. Must be |
| 172 |
// fewer than 100 UTF-8 bytes. |
| 173 |
string display_name = 6; |
| 174 |
|
| 175 |
// Used to perform a consistent read-modify-write. |
| 176 |
bytes etag = 7; |
| 177 |
|
| 178 |
// @OutputOnly. The OAuth2 client id for the service account. |
| 179 |
// This is used in conjunction with the OAuth2 clientconfig API to make |
| 180 |
// three legged OAuth2 (3LO) flows to access the data of Google users. |
| 181 |
string oauth2_client_id = 9; |
| 182 |
} |
| 183 |
|
| 184 |
// The service account create request. |
| 185 |
message CreateServiceAccountRequest { |
| 186 |
// Required. The resource name of the project associated with the service |
| 187 |
// accounts, such as `projects/my-project-123`. |
| 188 |
string name = 1; |
| 189 |
|
| 190 |
// Required. The account id that is used to generate the service account |
| 191 |
// email address and a stable unique id. It is unique within a project, |
| 192 |
// must be 6-30 characters long, and match the regular expression |
| 193 |
// `[a-z]([-a-z0-9]*[a-z0-9])` to comply with RFC1035. |
| 194 |
string account_id = 2; |
| 195 |
|
| 196 |
// The [ServiceAccount][google.iam.admin.v1.ServiceAccount] resource to create. |
| 197 |
// Currently, only the following values are user assignable: |
| 198 |
// `display_name` . |
| 199 |
ServiceAccount service_account = 3; |
| 200 |
} |
| 201 |
|
| 202 |
// The service account list request. |
| 203 |
message ListServiceAccountsRequest { |
| 204 |
// Required. The resource name of the project associated with the service |
| 205 |
// accounts, such as `projects/my-project-123`. |
| 206 |
string name = 1; |
| 207 |
|
| 208 |
// Optional limit on the number of service accounts to include in the |
| 209 |
// response. Further accounts can subsequently be obtained by including the |
| 210 |
// [ListServiceAccountsResponse.next_page_token][google.iam.admin.v1.ListServiceAccountsResponse.next_page_token] |
| 211 |
// in a subsequent request. |
| 212 |
int32 page_size = 2; |
| 213 |
|
| 214 |
// Optional pagination token returned in an earlier |
| 215 |
// [ListServiceAccountsResponse.next_page_token][google.iam.admin.v1.ListServiceAccountsResponse.next_page_token]. |
| 216 |
string page_token = 3; |
| 217 |
} |
| 218 |
|
| 219 |
// The service account list response. |
| 220 |
message ListServiceAccountsResponse { |
| 221 |
// The list of matching service accounts. |
| 222 |
repeated ServiceAccount accounts = 1; |
| 223 |
|
| 224 |
// To retrieve the next page of results, set |
| 225 |
// [ListServiceAccountsRequest.page_token][google.iam.admin.v1.ListServiceAccountsRequest.page_token] |
| 226 |
// to this value. |
| 227 |
string next_page_token = 2; |
| 228 |
} |
| 229 |
|
| 230 |
// The service account get request. |
| 231 |
message GetServiceAccountRequest { |
| 232 |
// The resource name of the service account in the following format: |
| 233 |
// `projects/{project}/serviceAccounts/{account}`. |
| 234 |
// Using `-` as a wildcard for the project will infer the project from |
| 235 |
// the account. The `account` value can be the `email` address or the |
| 236 |
// `unique_id` of the service account. |
| 237 |
string name = 1; |
| 238 |
} |
| 239 |
|
| 240 |
// The service account delete request. |
| 241 |
message DeleteServiceAccountRequest { |
| 242 |
// The resource name of the service account in the following format: |
| 243 |
// `projects/{project}/serviceAccounts/{account}`. |
| 244 |
// Using `-` as a wildcard for the project will infer the project from |
| 245 |
// the account. The `account` value can be the `email` address or the |
| 246 |
// `unique_id` of the service account. |
| 247 |
string name = 1; |
| 248 |
} |
| 249 |
|
| 250 |
// The service account keys list request. |
| 251 |
message ListServiceAccountKeysRequest { |
| 252 |
// `KeyType` filters to selectively retrieve certain varieties |
| 253 |
// of keys. |
| 254 |
enum KeyType { |
| 255 |
// Unspecified key type. The presence of this in the |
| 256 |
// message will immediately result in an error. |
| 257 |
KEY_TYPE_UNSPECIFIED = 0; |
| 258 |
|
| 259 |
// User-managed keys (managed and rotated by the user). |
| 260 |
USER_MANAGED = 1; |
| 261 |
|
| 262 |
// System-managed keys (managed and rotated by Google). |
| 263 |
SYSTEM_MANAGED = 2; |
| 264 |
} |
| 265 |
|
| 266 |
// The resource name of the service account in the following format: |
| 267 |
// `projects/{project}/serviceAccounts/{account}`. |
| 268 |
// |
| 269 |
// Using `-` as a wildcard for the project, will infer the project from |
| 270 |
// the account. The `account` value can be the `email` address or the |
| 271 |
// `unique_id` of the service account. |
| 272 |
string name = 1; |
| 273 |
|
| 274 |
// Filters the types of keys the user wants to include in the list |
| 275 |
// response. Duplicate key types are not allowed. If no key type |
| 276 |
// is provided, all keys are returned. |
| 277 |
repeated KeyType key_types = 2; |
| 278 |
} |
| 279 |
|
| 280 |
// The service account keys list response. |
| 281 |
message ListServiceAccountKeysResponse { |
| 282 |
// The public keys for the service account. |
| 283 |
repeated ServiceAccountKey keys = 1; |
| 284 |
} |
| 285 |
|
| 286 |
// The service account key get by id request. |
| 287 |
message GetServiceAccountKeyRequest { |
| 288 |
// The resource name of the service account key in the following format: |
| 289 |
// `projects/{project}/serviceAccounts/{account}/keys/{key}`. |
| 290 |
// |
| 291 |
// Using `-` as a wildcard for the project will infer the project from |
| 292 |
// the account. The `account` value can be the `email` address or the |
| 293 |
// `unique_id` of the service account. |
| 294 |
string name = 1; |
| 295 |
|
| 296 |
// The output format of the public key requested. |
| 297 |
// X509_PEM is the default output format. |
| 298 |
ServiceAccountPublicKeyType public_key_type = 2; |
| 299 |
} |
| 300 |
|
| 301 |
// Represents a service account key. |
| 302 |
// |
| 303 |
// A service account has two sets of key-pairs: user-managed, and |
| 304 |
// system-managed. |
| 305 |
// |
| 306 |
// User-managed key-pairs can be created and deleted by users. Users are |
| 307 |
// responsible for rotating these keys periodically to ensure security of |
| 308 |
// their service accounts. Users retain the private key of these key-pairs, |
| 309 |
// and Google retains ONLY the public key. |
| 310 |
// |
| 311 |
// System-managed key-pairs are managed automatically by Google, and rotated |
| 312 |
// daily without user intervention. The private key never leaves Google's |
| 313 |
// servers to maximize security. |
| 314 |
// |
| 315 |
// Public keys for all service accounts are also published at the OAuth2 |
| 316 |
// Service Account API. |
| 317 |
message ServiceAccountKey { |
| 318 |
// The resource name of the service account key in the following format |
| 319 |
// `projects/{project}/serviceAccounts/{account}/keys/{key}`. |
| 320 |
string name = 1; |
| 321 |
|
| 322 |
// The output format for the private key. |
| 323 |
// Only provided in `CreateServiceAccountKey` responses, not |
| 324 |
// in `GetServiceAccountKey` or `ListServiceAccountKey` responses. |
| 325 |
// |
| 326 |
// Google never exposes system-managed private keys, and never retains |
| 327 |
// user-managed private keys. |
| 328 |
ServiceAccountPrivateKeyType private_key_type = 2; |
| 329 |
|
| 330 |
// Specifies the algorithm (and possibly key size) for the key. |
| 331 |
ServiceAccountKeyAlgorithm key_algorithm = 8; |
| 332 |
|
| 333 |
// The private key data. Only provided in `CreateServiceAccountKey` |
| 334 |
// responses. |
| 335 |
bytes private_key_data = 3; |
| 336 |
|
| 337 |
// The public key data. Only provided in `GetServiceAccountKey` responses. |
| 338 |
bytes public_key_data = 7; |
| 339 |
|
| 340 |
// The key can be used after this timestamp. |
| 341 |
google.protobuf.Timestamp valid_after_time = 4; |
| 342 |
|
| 343 |
// The key can be used before this timestamp. |
| 344 |
google.protobuf.Timestamp valid_before_time = 5; |
| 345 |
} |
| 346 |
|
| 347 |
// The service account key create request. |
| 348 |
message CreateServiceAccountKeyRequest { |
| 349 |
// The resource name of the service account in the following format: |
| 350 |
// `projects/{project}/serviceAccounts/{account}`. |
| 351 |
// Using `-` as a wildcard for the project will infer the project from |
| 352 |
// the account. The `account` value can be the `email` address or the |
| 353 |
// `unique_id` of the service account. |
| 354 |
string name = 1; |
| 355 |
|
| 356 |
// The output format of the private key. `GOOGLE_CREDENTIALS_FILE` is the |
| 357 |
// default output format. |
| 358 |
ServiceAccountPrivateKeyType private_key_type = 2; |
| 359 |
|
| 360 |
// Which type of key and algorithm to use for the key. |
| 361 |
// The default is currently a 4K RSA key. However this may change in the |
| 362 |
// future. |
| 363 |
ServiceAccountKeyAlgorithm key_algorithm = 3; |
| 364 |
} |
| 365 |
|
| 366 |
// The service account key delete request. |
| 367 |
message DeleteServiceAccountKeyRequest { |
| 368 |
// The resource name of the service account key in the following format: |
| 369 |
// `projects/{project}/serviceAccounts/{account}/keys/{key}`. |
| 370 |
// Using `-` as a wildcard for the project will infer the project from |
| 371 |
// the account. The `account` value can be the `email` address or the |
| 372 |
// `unique_id` of the service account. |
| 373 |
string name = 1; |
| 374 |
} |
| 375 |
|
| 376 |
// The service account sign blob request. |
| 377 |
message SignBlobRequest { |
| 378 |
// The resource name of the service account in the following format: |
| 379 |
// `projects/{project}/serviceAccounts/{account}`. |
| 380 |
// Using `-` as a wildcard for the project will infer the project from |
| 381 |
// the account. The `account` value can be the `email` address or the |
| 382 |
// `unique_id` of the service account. |
| 383 |
string name = 1; |
| 384 |
|
| 385 |
// The bytes to sign. |
| 386 |
bytes bytes_to_sign = 2; |
| 387 |
} |
| 388 |
|
| 389 |
// The service account sign blob response. |
| 390 |
message SignBlobResponse { |
| 391 |
// The id of the key used to sign the blob. |
| 392 |
string key_id = 1; |
| 393 |
|
| 394 |
// The signed blob. |
| 395 |
bytes signature = 2; |
| 396 |
} |
| 397 |
|
| 398 |
// A role in the Identity and Access Management API. |
| 399 |
message Role { |
| 400 |
// The name of the role. |
| 401 |
// |
| 402 |
// When Role is used in CreateRole, the role name must not be set. |
| 403 |
// |
| 404 |
// When Role is used in output and other input such as UpdateRole, the role |
| 405 |
// name is the complete path, e.g., roles/logging.viewer for curated roles |
| 406 |
// and organizations/{organization-id}/roles/logging.viewer for custom roles. |
| 407 |
string name = 1; |
| 408 |
|
| 409 |
// Optional. A human-readable title for the role. Typically this |
| 410 |
// is limited to 100 UTF-8 bytes. |
| 411 |
string title = 2; |
| 412 |
|
| 413 |
// Optional. A human-readable description for the role. |
| 414 |
string description = 3; |
| 415 |
} |
| 416 |
|
| 417 |
// The grantable role query request. |
| 418 |
message QueryGrantableRolesRequest { |
| 419 |
// Required. The full resource name to query from the list of grantable roles. |
| 420 |
// |
| 421 |
// The name follows the Google Cloud Platform resource format. |
| 422 |
// For example, a Cloud Platform project with id `my-project` will be named |
| 423 |
// `//cloudresourcemanager.googleapis.com/projects/my-project`. |
| 424 |
string full_resource_name = 1; |
| 425 |
} |
| 426 |
|
| 427 |
// The grantable role query response. |
| 428 |
message QueryGrantableRolesResponse { |
| 429 |
// The list of matching roles. |
| 430 |
repeated Role roles = 1; |
| 431 |
} |
| 432 |
|
| 433 |
// Supported key algorithms. |
| 434 |
enum ServiceAccountKeyAlgorithm { |
| 435 |
// An unspecified key algorithm. |
| 436 |
KEY_ALG_UNSPECIFIED = 0; |
| 437 |
|
| 438 |
// 1k RSA Key. |
| 439 |
KEY_ALG_RSA_1024 = 1; |
| 440 |
|
| 441 |
// 2k RSA Key. |
| 442 |
KEY_ALG_RSA_2048 = 2; |
| 443 |
} |
| 444 |
|
| 445 |
// Supported private key output formats. |
| 446 |
enum ServiceAccountPrivateKeyType { |
| 447 |
// Unspecified. Equivalent to `TYPE_GOOGLE_CREDENTIALS_FILE`. |
| 448 |
TYPE_UNSPECIFIED = 0; |
| 449 |
|
| 450 |
// PKCS12 format. |
| 451 |
// The password for the PKCS12 file is `notasecret`. |
| 452 |
// For more information, see https://tools.ietf.org/html/rfc7292. |
| 453 |
TYPE_PKCS12_FILE = 1; |
| 454 |
|
| 455 |
// Google Credentials File format. |
| 456 |
TYPE_GOOGLE_CREDENTIALS_FILE = 2; |
| 457 |
} |
| 458 |
|
| 459 |
// Supported public key output formats. |
| 460 |
enum ServiceAccountPublicKeyType { |
| 461 |
// Unspecified. Returns nothing here. |
| 462 |
TYPE_NONE = 0; |
| 463 |
|
| 464 |
// X509 PEM format. |
| 465 |
TYPE_X509_PEM_FILE = 1; |
| 466 |
|
| 467 |
// Raw public key. |
| 468 |
TYPE_RAW_PUBLIC_KEY = 2; |
| 469 |
} |