google-cloud-lib/src/main/java/com/streamsets/pipeline/stage/lib/GoogleCloudCredentialsConfig.java
public Optional<CredentialsProvider> getCredentialsProvider(Stage.Context context, List<Stage.ConfigIssue> issues) {
    CredentialsProvider provider = null;

    if (credentialsProvider.equals(CredentialsProviderType.DEFAULT_PROVIDER)) {
      return Optional.of(SubscriptionAdminSettings.defaultCredentialsProviderBuilder().build());
    } else if (credentialsProvider.equals(CredentialsProviderType.JSON_PROVIDER)) {
      Credentials credentials = getCredentials(context, issues);
      provider = new FixedCredentialsProvider() {
        @Nullable
        @Override
        public Credentials getCredentials() {
          return credentials;
        }
      };
    }

    return Optional.ofNullable(provider);
  }
public Optional<CredentialsProvider> getCredentialsProvider(Stage.Context context, List<Stage.ConfigIssue> issues) {
    CredentialsProvider provider = null;

    if (credentialsProvider.equals(CredentialsProviderType.DEFAULT_PROVIDER)) {
      return Optional.of(SubscriptionAdminSettings.defaultCredentialsProviderBuilder().build());
    } else if (credentialsProvider.equals(CredentialsProviderType.JSON_PROVIDER)) {
      Credentials credentials = getCredentials(context, issues);
      provider = new FixedCredentialsProvider() {
        @Nullable
        @Override
        public Credentials getCredentials() {
          return credentials;
        }
      };
    }

    return Optional.ofNullable(provider);
  }
Tries to create a {@link CredentialsProvider} for the appropriate type of credentials supplied.

@param context stage context used for creating config issues
@param issues list of issues to append to
@return Optional containing a credentials provider if it was successfully created.