/// <summary> /// Lists ServiceAccountKeys. /// Documentation https://developers.google.com/iam/v1/reference/keys/list /// Generation Note: This does not always build corectly. Google needs to standardise things I need to figuer out which ones are wrong. /// </summary> /// <param name="service">Authenticated iam service.</param> /// <param name="name">The resource name of the service account in the following format: `projects/{project}/serviceAccounts/{account}`. Using `-` as a wildcard for the project, will infer the project from the account. The `account` value can be the `email` address or the `unique_id` of the service account.</param> /// <param name="optional">Optional paramaters.</param> /// <returns>ListServiceAccountKeysResponseResponse</returns> public static ListServiceAccountKeysResponse List(iamService service, string name, KeysListOptionalParms optional = null) { try { // Initial validation. if (service == null) { throw new ArgumentNullException("service"); } if (name == null) { throw new ArgumentNullException(name); } // Building the initial request. var request = service.Keys.List(name); // Applying optional parameters to the request. request = (KeysResource.ListRequest)SampleHelpers.ApplyOptionalParms(request, optional); // Requesting data. return(request.Execute()); } catch (Exception ex) { throw new Exception("Request Keys.List failed.", ex); } }
/// <summary> /// Creates a ServiceAccountKey and returns it. /// Documentation https://developers.google.com/iam/v1/reference/keys/create /// Generation Note: This does not always build corectly. Google needs to standardise things I need to figuer out which ones are wrong. /// </summary> /// <param name="service">Authenticated iam service.</param> /// <param name="name">The resource name of the service account in the following format: `projects/{project}/serviceAccounts/{account}`. Using `-` as a wildcard for the project will infer the project from the account. The `account` value can be the `email` address or the `unique_id` of the service account.</param> /// <param name="body">A valid iam v1 body.</param> /// <returns>ServiceAccountKeyResponse</returns> public static ServiceAccountKey Create(iamService service, string name, CreateServiceAccountKeyRequest body) { try { // Initial validation. if (service == null) { throw new ArgumentNullException("service"); } if (body == null) { throw new ArgumentNullException("body"); } if (name == null) { throw new ArgumentNullException(name); } // Make the request. return(service.Keys.Create(body, name).Execute()); } catch (Exception ex) { throw new Exception("Request Keys.Create failed.", ex); } }
/// <summary> /// Queries roles that can be granted on a particular resource. A role is grantable if it can be used as the role in a binding for a policy for that resource. /// Documentation https://developers.google.com/iam/v1/reference/roles/queryGrantableRoles /// Generation Note: This does not always build corectly. Google needs to standardise things I need to figuer out which ones are wrong. /// </summary> /// <param name="service">Authenticated iam service.</param> /// <param name="body">A valid iam v1 body.</param> /// <returns>QueryGrantableRolesResponseResponse</returns> public static QueryGrantableRolesResponse QueryGrantableRoles(iamService service, QueryGrantableRolesRequest body) { try { // Initial validation. if (service == null) { throw new ArgumentNullException("service"); } if (body == null) { throw new ArgumentNullException("body"); } // Make the request. return(service.Roles.QueryGrantableRoles(body).Execute()); } catch (Exception ex) { throw new Exception("Request Roles.QueryGrantableRoles failed.", ex); } }
/// <summary> /// Deletes a ServiceAccountKey. /// Documentation https://developers.google.com/iam/v1/reference/keys/delete /// Generation Note: This does not always build corectly. Google needs to standardise things I need to figuer out which ones are wrong. /// </summary> /// <param name="service">Authenticated iam service.</param> /// <param name="name">The resource name of the service account key in the following format: `projects/{project}/serviceAccounts/{account}/keys/{key}`. Using `-` as a wildcard for the project will infer the project from the account. The `account` value can be the `email` address or the `unique_id` of the service account.</param> /// <returns>EmptyResponse</returns> public static Empty Delete(iamService service, string name) { try { // Initial validation. if (service == null) { throw new ArgumentNullException("service"); } if (name == null) { throw new ArgumentNullException(name); } // Make the request. return(service.Keys.Delete(name).Execute()); } catch (Exception ex) { throw new Exception("Request Keys.Delete failed.", ex); } }