1"""Generated client library for iam version v1.""" 2# NOTE: This file is autogenerated and should not be edited by hand. 3from apitools.base.py import base_api 4from samples.iam_sample.iam_v1 import iam_v1_messages as messages 5 6 7class IamV1(base_api.BaseApiClient): 8 """Generated client library for service iam version v1.""" 9 10 MESSAGES_MODULE = messages 11 BASE_URL = u'https://iam.googleapis.com/' 12 MTLS_BASE_URL = u'' 13 14 _PACKAGE = u'iam' 15 _SCOPES = [u'https://www.googleapis.com/auth/cloud-platform'] 16 _VERSION = u'v1' 17 _CLIENT_ID = '1042881264118.apps.googleusercontent.com' 18 _CLIENT_SECRET = 'x_Tw5K8nnjoRAqULM9PFAC2b' 19 _USER_AGENT = 'x_Tw5K8nnjoRAqULM9PFAC2b' 20 _CLIENT_CLASS_NAME = u'IamV1' 21 _URL_VERSION = u'v1' 22 _API_KEY = None 23 24 def __init__(self, url='', credentials=None, 25 get_credentials=True, http=None, model=None, 26 log_request=False, log_response=False, 27 credentials_args=None, default_global_params=None, 28 additional_http_headers=None, response_encoding=None): 29 """Create a new iam handle.""" 30 url = url or self.BASE_URL 31 super(IamV1, self).__init__( 32 url, credentials=credentials, 33 get_credentials=get_credentials, http=http, model=model, 34 log_request=log_request, log_response=log_response, 35 credentials_args=credentials_args, 36 default_global_params=default_global_params, 37 additional_http_headers=additional_http_headers, 38 response_encoding=response_encoding) 39 self.iamPolicies = self.IamPoliciesService(self) 40 self.projects_serviceAccounts_keys = self.ProjectsServiceAccountsKeysService(self) 41 self.projects_serviceAccounts = self.ProjectsServiceAccountsService(self) 42 self.projects = self.ProjectsService(self) 43 self.roles = self.RolesService(self) 44 45 class IamPoliciesService(base_api.BaseApiService): 46 """Service class for the iamPolicies resource.""" 47 48 _NAME = u'iamPolicies' 49 50 def __init__(self, client): 51 super(IamV1.IamPoliciesService, self).__init__(client) 52 self._upload_configs = { 53 } 54 55 def GetPolicyDetails(self, request, global_params=None): 56 r"""Returns the current IAM policy and the policies on the inherited resources. 57that the user has access to. 58 59 Args: 60 request: (GetPolicyDetailsRequest) input message 61 global_params: (StandardQueryParameters, default: None) global arguments 62 Returns: 63 (GetPolicyDetailsResponse) The response message. 64 """ 65 config = self.GetMethodConfig('GetPolicyDetails') 66 return self._RunMethod( 67 config, request, global_params=global_params) 68 69 GetPolicyDetails.method_config = lambda: base_api.ApiMethodInfo( 70 http_method=u'POST', 71 method_id=u'iam.iamPolicies.getPolicyDetails', 72 ordered_params=[], 73 path_params=[], 74 query_params=[], 75 relative_path=u'v1/iamPolicies:getPolicyDetails', 76 request_field='<request>', 77 request_type_name=u'GetPolicyDetailsRequest', 78 response_type_name=u'GetPolicyDetailsResponse', 79 supports_download=False, 80 ) 81 82 class ProjectsServiceAccountsKeysService(base_api.BaseApiService): 83 """Service class for the projects_serviceAccounts_keys resource.""" 84 85 _NAME = u'projects_serviceAccounts_keys' 86 87 def __init__(self, client): 88 super(IamV1.ProjectsServiceAccountsKeysService, self).__init__(client) 89 self._upload_configs = { 90 } 91 92 def Create(self, request, global_params=None): 93 r"""Creates a ServiceAccountKey. 94and returns it. 95 96 Args: 97 request: (IamProjectsServiceAccountsKeysCreateRequest) input message 98 global_params: (StandardQueryParameters, default: None) global arguments 99 Returns: 100 (ServiceAccountKey) The response message. 101 """ 102 config = self.GetMethodConfig('Create') 103 return self._RunMethod( 104 config, request, global_params=global_params) 105 106 Create.method_config = lambda: base_api.ApiMethodInfo( 107 flat_path=u'v1/projects/{projectsId}/serviceAccounts/{serviceAccountsId}/keys', 108 http_method=u'POST', 109 method_id=u'iam.projects.serviceAccounts.keys.create', 110 ordered_params=[u'name'], 111 path_params=[u'name'], 112 query_params=[], 113 relative_path=u'v1/{+name}/keys', 114 request_field=u'createServiceAccountKeyRequest', 115 request_type_name=u'IamProjectsServiceAccountsKeysCreateRequest', 116 response_type_name=u'ServiceAccountKey', 117 supports_download=False, 118 ) 119 120 def Delete(self, request, global_params=None): 121 r"""Deletes a ServiceAccountKey. 122 123 Args: 124 request: (IamProjectsServiceAccountsKeysDeleteRequest) input message 125 global_params: (StandardQueryParameters, default: None) global arguments 126 Returns: 127 (Empty) The response message. 128 """ 129 config = self.GetMethodConfig('Delete') 130 return self._RunMethod( 131 config, request, global_params=global_params) 132 133 Delete.method_config = lambda: base_api.ApiMethodInfo( 134 flat_path=u'v1/projects/{projectsId}/serviceAccounts/{serviceAccountsId}/keys/{keysId}', 135 http_method=u'DELETE', 136 method_id=u'iam.projects.serviceAccounts.keys.delete', 137 ordered_params=[u'name'], 138 path_params=[u'name'], 139 query_params=[], 140 relative_path=u'v1/{+name}', 141 request_field='', 142 request_type_name=u'IamProjectsServiceAccountsKeysDeleteRequest', 143 response_type_name=u'Empty', 144 supports_download=False, 145 ) 146 147 def Get(self, request, global_params=None): 148 r"""Gets the ServiceAccountKey. 149by key id. 150 151 Args: 152 request: (IamProjectsServiceAccountsKeysGetRequest) input message 153 global_params: (StandardQueryParameters, default: None) global arguments 154 Returns: 155 (ServiceAccountKey) The response message. 156 """ 157 config = self.GetMethodConfig('Get') 158 return self._RunMethod( 159 config, request, global_params=global_params) 160 161 Get.method_config = lambda: base_api.ApiMethodInfo( 162 flat_path=u'v1/projects/{projectsId}/serviceAccounts/{serviceAccountsId}/keys/{keysId}', 163 http_method=u'GET', 164 method_id=u'iam.projects.serviceAccounts.keys.get', 165 ordered_params=[u'name'], 166 path_params=[u'name'], 167 query_params=[u'publicKeyType'], 168 relative_path=u'v1/{+name}', 169 request_field='', 170 request_type_name=u'IamProjectsServiceAccountsKeysGetRequest', 171 response_type_name=u'ServiceAccountKey', 172 supports_download=False, 173 ) 174 175 def List(self, request, global_params=None): 176 r"""Lists ServiceAccountKeys. 177 178 Args: 179 request: (IamProjectsServiceAccountsKeysListRequest) input message 180 global_params: (StandardQueryParameters, default: None) global arguments 181 Returns: 182 (ListServiceAccountKeysResponse) The response message. 183 """ 184 config = self.GetMethodConfig('List') 185 return self._RunMethod( 186 config, request, global_params=global_params) 187 188 List.method_config = lambda: base_api.ApiMethodInfo( 189 flat_path=u'v1/projects/{projectsId}/serviceAccounts/{serviceAccountsId}/keys', 190 http_method=u'GET', 191 method_id=u'iam.projects.serviceAccounts.keys.list', 192 ordered_params=[u'name'], 193 path_params=[u'name'], 194 query_params=[u'keyTypes'], 195 relative_path=u'v1/{+name}/keys', 196 request_field='', 197 request_type_name=u'IamProjectsServiceAccountsKeysListRequest', 198 response_type_name=u'ListServiceAccountKeysResponse', 199 supports_download=False, 200 ) 201 202 class ProjectsServiceAccountsService(base_api.BaseApiService): 203 """Service class for the projects_serviceAccounts resource.""" 204 205 _NAME = u'projects_serviceAccounts' 206 207 def __init__(self, client): 208 super(IamV1.ProjectsServiceAccountsService, self).__init__(client) 209 self._upload_configs = { 210 } 211 212 def Create(self, request, global_params=None): 213 r"""Creates a ServiceAccount. 214and returns it. 215 216 Args: 217 request: (IamProjectsServiceAccountsCreateRequest) input message 218 global_params: (StandardQueryParameters, default: None) global arguments 219 Returns: 220 (ServiceAccount) The response message. 221 """ 222 config = self.GetMethodConfig('Create') 223 return self._RunMethod( 224 config, request, global_params=global_params) 225 226 Create.method_config = lambda: base_api.ApiMethodInfo( 227 flat_path=u'v1/projects/{projectsId}/serviceAccounts', 228 http_method=u'POST', 229 method_id=u'iam.projects.serviceAccounts.create', 230 ordered_params=[u'name'], 231 path_params=[u'name'], 232 query_params=[], 233 relative_path=u'v1/{+name}/serviceAccounts', 234 request_field=u'createServiceAccountRequest', 235 request_type_name=u'IamProjectsServiceAccountsCreateRequest', 236 response_type_name=u'ServiceAccount', 237 supports_download=False, 238 ) 239 240 def Delete(self, request, global_params=None): 241 r"""Deletes a ServiceAccount. 242 243 Args: 244 request: (IamProjectsServiceAccountsDeleteRequest) input message 245 global_params: (StandardQueryParameters, default: None) global arguments 246 Returns: 247 (Empty) The response message. 248 """ 249 config = self.GetMethodConfig('Delete') 250 return self._RunMethod( 251 config, request, global_params=global_params) 252 253 Delete.method_config = lambda: base_api.ApiMethodInfo( 254 flat_path=u'v1/projects/{projectsId}/serviceAccounts/{serviceAccountsId}', 255 http_method=u'DELETE', 256 method_id=u'iam.projects.serviceAccounts.delete', 257 ordered_params=[u'name'], 258 path_params=[u'name'], 259 query_params=[], 260 relative_path=u'v1/{+name}', 261 request_field='', 262 request_type_name=u'IamProjectsServiceAccountsDeleteRequest', 263 response_type_name=u'Empty', 264 supports_download=False, 265 ) 266 267 def Get(self, request, global_params=None): 268 r"""Gets a ServiceAccount. 269 270 Args: 271 request: (IamProjectsServiceAccountsGetRequest) input message 272 global_params: (StandardQueryParameters, default: None) global arguments 273 Returns: 274 (ServiceAccount) The response message. 275 """ 276 config = self.GetMethodConfig('Get') 277 return self._RunMethod( 278 config, request, global_params=global_params) 279 280 Get.method_config = lambda: base_api.ApiMethodInfo( 281 flat_path=u'v1/projects/{projectsId}/serviceAccounts/{serviceAccountsId}', 282 http_method=u'GET', 283 method_id=u'iam.projects.serviceAccounts.get', 284 ordered_params=[u'name'], 285 path_params=[u'name'], 286 query_params=[], 287 relative_path=u'v1/{+name}', 288 request_field='', 289 request_type_name=u'IamProjectsServiceAccountsGetRequest', 290 response_type_name=u'ServiceAccount', 291 supports_download=False, 292 ) 293 294 def GetIamPolicy(self, request, global_params=None): 295 r"""Returns the IAM access control policy for specified IAM resource. 296 297 Args: 298 request: (IamProjectsServiceAccountsGetIamPolicyRequest) input message 299 global_params: (StandardQueryParameters, default: None) global arguments 300 Returns: 301 (Policy) The response message. 302 """ 303 config = self.GetMethodConfig('GetIamPolicy') 304 return self._RunMethod( 305 config, request, global_params=global_params) 306 307 GetIamPolicy.method_config = lambda: base_api.ApiMethodInfo( 308 flat_path=u'v1/projects/{projectsId}/serviceAccounts/{serviceAccountsId}:getIamPolicy', 309 http_method=u'POST', 310 method_id=u'iam.projects.serviceAccounts.getIamPolicy', 311 ordered_params=[u'resource'], 312 path_params=[u'resource'], 313 query_params=[], 314 relative_path=u'v1/{+resource}:getIamPolicy', 315 request_field='', 316 request_type_name=u'IamProjectsServiceAccountsGetIamPolicyRequest', 317 response_type_name=u'Policy', 318 supports_download=False, 319 ) 320 321 def List(self, request, global_params=None): 322 r"""Lists ServiceAccounts for a project. 323 324 Args: 325 request: (IamProjectsServiceAccountsListRequest) input message 326 global_params: (StandardQueryParameters, default: None) global arguments 327 Returns: 328 (ListServiceAccountsResponse) The response message. 329 """ 330 config = self.GetMethodConfig('List') 331 return self._RunMethod( 332 config, request, global_params=global_params) 333 334 List.method_config = lambda: base_api.ApiMethodInfo( 335 flat_path=u'v1/projects/{projectsId}/serviceAccounts', 336 http_method=u'GET', 337 method_id=u'iam.projects.serviceAccounts.list', 338 ordered_params=[u'name'], 339 path_params=[u'name'], 340 query_params=[u'pageSize', u'pageToken', u'removeDeletedServiceAccounts'], 341 relative_path=u'v1/{+name}/serviceAccounts', 342 request_field='', 343 request_type_name=u'IamProjectsServiceAccountsListRequest', 344 response_type_name=u'ListServiceAccountsResponse', 345 supports_download=False, 346 ) 347 348 def SetIamPolicy(self, request, global_params=None): 349 r"""Sets the IAM access control policy for the specified IAM resource. 350 351 Args: 352 request: (IamProjectsServiceAccountsSetIamPolicyRequest) input message 353 global_params: (StandardQueryParameters, default: None) global arguments 354 Returns: 355 (Policy) The response message. 356 """ 357 config = self.GetMethodConfig('SetIamPolicy') 358 return self._RunMethod( 359 config, request, global_params=global_params) 360 361 SetIamPolicy.method_config = lambda: base_api.ApiMethodInfo( 362 flat_path=u'v1/projects/{projectsId}/serviceAccounts/{serviceAccountsId}:setIamPolicy', 363 http_method=u'POST', 364 method_id=u'iam.projects.serviceAccounts.setIamPolicy', 365 ordered_params=[u'resource'], 366 path_params=[u'resource'], 367 query_params=[], 368 relative_path=u'v1/{+resource}:setIamPolicy', 369 request_field=u'setIamPolicyRequest', 370 request_type_name=u'IamProjectsServiceAccountsSetIamPolicyRequest', 371 response_type_name=u'Policy', 372 supports_download=False, 373 ) 374 375 def SignBlob(self, request, global_params=None): 376 r"""Signs a blob using a service account's system-managed private key. 377 378 Args: 379 request: (IamProjectsServiceAccountsSignBlobRequest) input message 380 global_params: (StandardQueryParameters, default: None) global arguments 381 Returns: 382 (SignBlobResponse) The response message. 383 """ 384 config = self.GetMethodConfig('SignBlob') 385 return self._RunMethod( 386 config, request, global_params=global_params) 387 388 SignBlob.method_config = lambda: base_api.ApiMethodInfo( 389 flat_path=u'v1/projects/{projectsId}/serviceAccounts/{serviceAccountsId}:signBlob', 390 http_method=u'POST', 391 method_id=u'iam.projects.serviceAccounts.signBlob', 392 ordered_params=[u'name'], 393 path_params=[u'name'], 394 query_params=[], 395 relative_path=u'v1/{+name}:signBlob', 396 request_field=u'signBlobRequest', 397 request_type_name=u'IamProjectsServiceAccountsSignBlobRequest', 398 response_type_name=u'SignBlobResponse', 399 supports_download=False, 400 ) 401 402 def SignJwt(self, request, global_params=None): 403 r"""Signs a JWT using a service account's system-managed private key. 404 405If no `exp` (expiry) time is contained in the claims, we will 406provide an expiry of one hour in the future. If an expiry 407of more than one hour in the future is requested, the request 408will fail. 409 410 Args: 411 request: (IamProjectsServiceAccountsSignJwtRequest) input message 412 global_params: (StandardQueryParameters, default: None) global arguments 413 Returns: 414 (SignJwtResponse) The response message. 415 """ 416 config = self.GetMethodConfig('SignJwt') 417 return self._RunMethod( 418 config, request, global_params=global_params) 419 420 SignJwt.method_config = lambda: base_api.ApiMethodInfo( 421 flat_path=u'v1/projects/{projectsId}/serviceAccounts/{serviceAccountsId}:signJwt', 422 http_method=u'POST', 423 method_id=u'iam.projects.serviceAccounts.signJwt', 424 ordered_params=[u'name'], 425 path_params=[u'name'], 426 query_params=[], 427 relative_path=u'v1/{+name}:signJwt', 428 request_field=u'signJwtRequest', 429 request_type_name=u'IamProjectsServiceAccountsSignJwtRequest', 430 response_type_name=u'SignJwtResponse', 431 supports_download=False, 432 ) 433 434 def TestIamPermissions(self, request, global_params=None): 435 r"""Tests the specified permissions against the IAM access control policy. 436for the specified IAM resource. 437 438 Args: 439 request: (IamProjectsServiceAccountsTestIamPermissionsRequest) input message 440 global_params: (StandardQueryParameters, default: None) global arguments 441 Returns: 442 (TestIamPermissionsResponse) The response message. 443 """ 444 config = self.GetMethodConfig('TestIamPermissions') 445 return self._RunMethod( 446 config, request, global_params=global_params) 447 448 TestIamPermissions.method_config = lambda: base_api.ApiMethodInfo( 449 flat_path=u'v1/projects/{projectsId}/serviceAccounts/{serviceAccountsId}:testIamPermissions', 450 http_method=u'POST', 451 method_id=u'iam.projects.serviceAccounts.testIamPermissions', 452 ordered_params=[u'resource'], 453 path_params=[u'resource'], 454 query_params=[], 455 relative_path=u'v1/{+resource}:testIamPermissions', 456 request_field=u'testIamPermissionsRequest', 457 request_type_name=u'IamProjectsServiceAccountsTestIamPermissionsRequest', 458 response_type_name=u'TestIamPermissionsResponse', 459 supports_download=False, 460 ) 461 462 def Update(self, request, global_params=None): 463 r"""Updates a ServiceAccount. 464 465Currently, only the following fields are updatable: 466`display_name` . 467The `etag` is mandatory. 468 469 Args: 470 request: (ServiceAccount) input message 471 global_params: (StandardQueryParameters, default: None) global arguments 472 Returns: 473 (ServiceAccount) The response message. 474 """ 475 config = self.GetMethodConfig('Update') 476 return self._RunMethod( 477 config, request, global_params=global_params) 478 479 Update.method_config = lambda: base_api.ApiMethodInfo( 480 flat_path=u'v1/projects/{projectsId}/serviceAccounts/{serviceAccountsId}', 481 http_method=u'PUT', 482 method_id=u'iam.projects.serviceAccounts.update', 483 ordered_params=[u'name'], 484 path_params=[u'name'], 485 query_params=[], 486 relative_path=u'v1/{+name}', 487 request_field='<request>', 488 request_type_name=u'ServiceAccount', 489 response_type_name=u'ServiceAccount', 490 supports_download=False, 491 ) 492 493 class ProjectsService(base_api.BaseApiService): 494 """Service class for the projects resource.""" 495 496 _NAME = u'projects' 497 498 def __init__(self, client): 499 super(IamV1.ProjectsService, self).__init__(client) 500 self._upload_configs = { 501 } 502 503 class RolesService(base_api.BaseApiService): 504 """Service class for the roles resource.""" 505 506 _NAME = u'roles' 507 508 def __init__(self, client): 509 super(IamV1.RolesService, self).__init__(client) 510 self._upload_configs = { 511 } 512 513 def QueryGrantableRoles(self, request, global_params=None): 514 r"""Queries roles that can be granted on a particular resource. 515 516 Args: 517 request: (QueryGrantableRolesRequest) input message 518 global_params: (StandardQueryParameters, default: None) global arguments 519 Returns: 520 (QueryGrantableRolesResponse) The response message. 521 """ 522 config = self.GetMethodConfig('QueryGrantableRoles') 523 return self._RunMethod( 524 config, request, global_params=global_params) 525 526 QueryGrantableRoles.method_config = lambda: base_api.ApiMethodInfo( 527 http_method=u'POST', 528 method_id=u'iam.roles.queryGrantableRoles', 529 ordered_params=[], 530 path_params=[], 531 query_params=[], 532 relative_path=u'v1/roles:queryGrantableRoles', 533 request_field='<request>', 534 request_type_name=u'QueryGrantableRolesRequest', 535 response_type_name=u'QueryGrantableRolesResponse', 536 supports_download=False, 537 ) 538