use of com.google.cloud.iam.credentials.v1.IamCredentialsClient in project gapic-generator-java by googleapis.
the class AsyncGenerateIdToken method asyncGenerateIdToken.
public static void asyncGenerateIdToken() throws Exception {
// It may require modifications to work in your environment.
try (IamCredentialsClient iamCredentialsClient = IamCredentialsClient.create()) {
GenerateIdTokenRequest request = GenerateIdTokenRequest.newBuilder().setName(ServiceAccountName.of("[PROJECT]", "[SERVICE_ACCOUNT]").toString()).addAllDelegates(new ArrayList<String>()).setAudience("audience975628804").setIncludeEmail(true).build();
ApiFuture<GenerateIdTokenResponse> future = iamCredentialsClient.generateIdTokenCallable().futureCall(request);
// Do something.
GenerateIdTokenResponse response = future.get();
}
}
use of com.google.cloud.iam.credentials.v1.IamCredentialsClient in project gapic-generator-java by googleapis.
the class SyncGenerateIdTokenStringListstringStringBoolean method syncGenerateIdTokenStringListstringStringBoolean.
public static void syncGenerateIdTokenStringListstringStringBoolean() throws Exception {
// It may require modifications to work in your environment.
try (IamCredentialsClient iamCredentialsClient = IamCredentialsClient.create()) {
String name = ServiceAccountName.of("[PROJECT]", "[SERVICE_ACCOUNT]").toString();
List<String> delegates = new ArrayList<>();
String audience = "audience975628804";
boolean includeEmail = true;
GenerateIdTokenResponse response = iamCredentialsClient.generateIdToken(name, delegates, audience, includeEmail);
}
}
use of com.google.cloud.iam.credentials.v1.IamCredentialsClient in project gapic-generator-java by googleapis.
the class SyncSignBlob method syncSignBlob.
public static void syncSignBlob() throws Exception {
// It may require modifications to work in your environment.
try (IamCredentialsClient iamCredentialsClient = IamCredentialsClient.create()) {
SignBlobRequest request = SignBlobRequest.newBuilder().setName(ServiceAccountName.of("[PROJECT]", "[SERVICE_ACCOUNT]").toString()).addAllDelegates(new ArrayList<String>()).setPayload(ByteString.EMPTY).build();
SignBlobResponse response = iamCredentialsClient.signBlob(request);
}
}
use of com.google.cloud.iam.credentials.v1.IamCredentialsClient in project gapic-generator-java by googleapis.
the class AsyncSignJwt method asyncSignJwt.
public static void asyncSignJwt() throws Exception {
// It may require modifications to work in your environment.
try (IamCredentialsClient iamCredentialsClient = IamCredentialsClient.create()) {
SignJwtRequest request = SignJwtRequest.newBuilder().setName(ServiceAccountName.of("[PROJECT]", "[SERVICE_ACCOUNT]").toString()).addAllDelegates(new ArrayList<String>()).setPayload("payload-786701938").build();
ApiFuture<SignJwtResponse> future = iamCredentialsClient.signJwtCallable().futureCall(request);
// Do something.
SignJwtResponse response = future.get();
}
}
use of com.google.cloud.iam.credentials.v1.IamCredentialsClient in project gapic-generator-java by googleapis.
the class SyncCreateSetCredentialsProvider method syncCreateSetCredentialsProvider.
public static void syncCreateSetCredentialsProvider() throws Exception {
// This snippet has been automatically generated for illustrative purposes only.
// It may require modifications to work in your environment.
IamCredentialsSettings iamCredentialsSettings = IamCredentialsSettings.newBuilder().setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)).build();
IamCredentialsClient iamCredentialsClient = IamCredentialsClient.create(iamCredentialsSettings);
}
Aggregations