/** * {@link Beta} <br/> * Returns the ID of the private key to use with the service account flow or {@code null} if * not using the service account flow. */ @Beta public final String getServiceAccountPrivateKeyId() { return serviceAccountPrivateKeyId; }
/** * Mock for ClientAuthentication. */ @Beta private static class MockClientAuthentication implements HttpExecuteInterceptor { @Override public void intercept(HttpRequest request) throws IOException { // pass } } }
/** * {@link Beta} <br/> * Returns the ID token. */ @Beta public final String getIdToken() { return idToken; }
/** * {@link Beta} <br/> * Returns the id of the private key to use with the service account flow or {@code null} * for none. */ @Beta public final String getServiceAccountPrivateKeyId() { return serviceAccountPrivateKeyId; }
/** * {@link Beta} <br/> * Sets the id of the private key to use with the service account flow or {@code null} for * none. * * <p> * Overriding is only supported for the purpose of calling the super implementation and changing * the return type, but nothing else. * </p> */ @Beta public Builder setServiceAccountPrivateKeyId(String serviceAccountPrivateKeyId) { this.serviceAccountPrivateKeyId = serviceAccountPrivateKeyId; return this; }
/** * {@link Beta} <br/> * Standard resource states used by notifications. * * @author Yaniv Inbar * @since 1.16 */ @Beta public final class ResourceStates { /** Notification that the subscription is alive (comes with no payload). */ public static final String SYNC = "SYNC"; /** Resource exists, for example on a create or update. */ public static final String EXISTS = "EXISTS"; /** Resource does not exist, for example on a delete. */ public static final String NOT_EXISTS = "NOT_EXISTS"; private ResourceStates() { } }
/** Adds a backoff and retry response and exception handlers to the {@code HttpRequest}. */ @Beta public static class RetryRequestInitializer implements HttpRequestInitializer { private final RetryPolicy retryPolicy; /** * Create an instance of {@link RetryRequestInitializer} based on specified {@link RetryPolicy}. * * @param retryPolicy to setup exponential back off and automatic retries. */ public RetryRequestInitializer(RetryPolicy retryPolicy) { this.retryPolicy = retryPolicy; } /** Initialize {@link HttpRequest} to setup exponential back off and automatic retries. */ @Override public void initialize(HttpRequest request) throws IOException { BackOff backOff = new ExponentialBackOff(); request.setUnsuccessfulResponseHandler(new LoggingResponseHandler(retryPolicy, backOff)); request.setIOExceptionHandler(new LoggingIOExceptionHandler(backOff)); } }
/** * {@link Beta} <br/> * Indicates whether the credential requires scopes to be specified by calling createScoped * before use. */ @Beta public boolean createScopedRequired() { if (serviceAccountPrivateKey == null) { return false; } return (serviceAccountScopes == null || serviceAccountScopes.isEmpty()); }
@Beta public class MockUnparsedNotificationCallback implements UnparsedNotificationCallback {
/** * {@link Beta} <br/> * Wraps a {@link GoogleAuthException} into an {@link IOException} so it can be caught directly. * * <p> * Use {@link #getCause()} to get the wrapped {@link GoogleAuthException}. * </p> * * @since 1.12 * @author Yaniv Inbar */ @Beta public class GoogleAuthIOException extends IOException { private static final long serialVersionUID = 1L; /** * @param wrapped wrapped {@link GoogleAuthException} * @since 1.21.0 */ public GoogleAuthIOException(GoogleAuthException wrapped) { initCause(Preconditions.checkNotNull(wrapped)); } @Override public GoogleAuthException getCause() { return (GoogleAuthException) super.getCause(); } }
/** A wrapper for {@code HttpBackOffIOExceptionHandler} that logs the calls. */ @Beta private static class LoggingIOExceptionHandler implements HttpIOExceptionHandler { private final Logger logger = Logger.getLogger(LoggingIOExceptionHandler.class.getName()); private final HttpIOExceptionHandler delegate; public LoggingIOExceptionHandler(BackOff backOff) { delegate = new HttpBackOffIOExceptionHandler(backOff); } @Override public boolean handleIOException(HttpRequest request, boolean supportsRetry) throws IOException { String event = logger.isLoggable(INFO) ? String.format("IOException for %s", request.getUrl().buildRelativeUrl()) : null; if (supportsRetry) { logger.log(FINE, "Handling {0}", event); boolean retry = delegate.handleIOException(request, supportsRetry); logger.log(retry ? INFO : WARNING, retry ? "Retrying {0}" : "Not retrying {0}", event); return retry; } else { logger.log(WARNING, "Unable to retry {0}", event); return false; } } }
@Beta public static final String DEFAULT_PUBLIC_CERTS_ENCODED_URL = "https://www.googleapis.com/oauth2/v1/certs";
@Beta class RequestHandler implements HttpExecuteInterceptor, HttpUnsuccessfulResponseHandler {
@Beta private static class LoggingResponseHandler implements HttpUnsuccessfulResponseHandler { private final Logger logger = Logger.getLogger(LoggingResponseHandler.class.getName());
@Beta public class MockGoogleJsonClientRequest<T> extends AbstractGoogleJsonClientRequest<T> {
@Beta public final class Utils {
@Beta public class MockGoogleClientRequest<T> extends AbstractGoogleClientRequest<T> {
@Beta public final class WebhookHeaders {
@Beta public class MockGoogleProtoClientRequest<T> extends AbstractGoogleProtoClientRequest<T> {
@Beta public class ProtoObjectParser implements ObjectParser {