Search in sources :

Example 1 with CreateServiceAccountKeyRequest

use of com.google.api.services.iam.v1.model.CreateServiceAccountKeyRequest in project google-cloud-intellij by GoogleCloudPlatform.

the class CloudApiManager method createServiceAccountKey.

/**
 * Using the supplied {@link ServiceAccount}, this creates and returns a new {@link
 * ServiceAccountKey}.
 */
private static ServiceAccountKey createServiceAccountKey(CredentialedUser user, ServiceAccount serviceAccount) throws IOException {
    Iam iam = GoogleApiClientFactory.getInstance().getIamClient(user.getCredential());
    CreateServiceAccountKeyRequest keyRequest = new CreateServiceAccountKeyRequest();
    return iam.projects().serviceAccounts().keys().create(serviceAccount.getName(), keyRequest).execute();
}
Also used : Iam(com.google.api.services.iam.v1.Iam) CreateServiceAccountKeyRequest(com.google.api.services.iam.v1.model.CreateServiceAccountKeyRequest)

Aggregations

Iam (com.google.api.services.iam.v1.Iam)1 CreateServiceAccountKeyRequest (com.google.api.services.iam.v1.model.CreateServiceAccountKeyRequest)1