use of com.google.cloud.iam.credentials.v1.GenerateAccessTokenResponse in project gapic-generator-java by googleapis.
the class AsyncGenerateAccessToken method asyncGenerateAccessToken.
public static void asyncGenerateAccessToken() throws Exception {
// It may require modifications to work in your environment.
try (IamCredentialsClient iamCredentialsClient = IamCredentialsClient.create()) {
GenerateAccessTokenRequest request = GenerateAccessTokenRequest.newBuilder().setName(ServiceAccountName.of("[PROJECT]", "[SERVICE_ACCOUNT]").toString()).addAllDelegates(new ArrayList<String>()).addAllScope(new ArrayList<String>()).setLifetime(Duration.newBuilder().build()).build();
ApiFuture<GenerateAccessTokenResponse> future = iamCredentialsClient.generateAccessTokenCallable().futureCall(request);
// Do something.
GenerateAccessTokenResponse response = future.get();
}
}
use of com.google.cloud.iam.credentials.v1.GenerateAccessTokenResponse in project gapic-generator-java by googleapis.
the class SyncGenerateAccessTokenServiceaccountnameListstringListstringDuration method syncGenerateAccessTokenServiceaccountnameListstringListstringDuration.
public static void syncGenerateAccessTokenServiceaccountnameListstringListstringDuration() throws Exception {
// It may require modifications to work in your environment.
try (IamCredentialsClient iamCredentialsClient = IamCredentialsClient.create()) {
ServiceAccountName name = ServiceAccountName.of("[PROJECT]", "[SERVICE_ACCOUNT]");
List<String> delegates = new ArrayList<>();
List<String> scope = new ArrayList<>();
Duration lifetime = Duration.newBuilder().build();
GenerateAccessTokenResponse response = iamCredentialsClient.generateAccessToken(name, delegates, scope, lifetime);
}
}
use of com.google.cloud.iam.credentials.v1.GenerateAccessTokenResponse in project gapic-generator-java by googleapis.
the class SyncGenerateAccessTokenStringListstringListstringDuration method syncGenerateAccessTokenStringListstringListstringDuration.
public static void syncGenerateAccessTokenStringListstringListstringDuration() 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<>();
List<String> scope = new ArrayList<>();
Duration lifetime = Duration.newBuilder().build();
GenerateAccessTokenResponse response = iamCredentialsClient.generateAccessToken(name, delegates, scope, lifetime);
}
}
Aggregations