-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Allow passing path to keyfile to use for credentials #2143
Description
@garrettjonesgoogle
Hi,
I was informed to create a ticket for Java from an existing ticket which was for Ruby:
googleapis/gapic-generator#1324
Currently I am trying to create a custom metric in Java but was not able to find out how to create the MetricServiceClient object from the json keyfile.
If you can provide me a Java example of doing it, that'd ok for now....many thanks
Dewei
Below is my code:
Line 1
CredentialsProvider credentialsProvider = FixedCredentialsProvider.create( ServiceAccountCredentials.fromStream(new FileInputStream(gcpJsonKeyFilePath)));
Line 2
final MetricServiceClient client = MetricServiceClient.create((MetricServiceSettings) MetricServiceSettings.newBuilder().setCredentialsProvider(credentialsProvider).build());
Here is the error message:
Exception in thread "main" java.lang.IllegalStateException: Missing required properties: totalTimeout initialRetryDelay retryDelayMultiplier maxRetryDelay initialRpcTimeout rpcTimeoutMultiplier maxRpcTimeout