Class RemoteApiOptions


  • public class RemoteApiOptions
    extends Object
    A mutable object containing settings for installing the remote API.

    Example for connecting to a development app server:

     RemoteApiOptions options = new RemoteApiOptions()
         .server("localhost", 8888),
         .useDevelopmentServerCredential();
     

    Example for connecting to a deployed app:

     RemoteApiOptions options = new RemoteApiOptions()
         .server("myappid.appspot.com", 443),
         .useApplicationDefaultCredential();
     

    The options should be passed to RemoteApiInstaller.install(com.google.appengine.tools.remoteapi.RemoteApiOptions).

    • Constructor Detail

      • RemoteApiOptions

        public RemoteApiOptions()
    • Method Detail

      • server

        public RemoteApiOptions server​(String newHostname,
                                       int newPort)
        Sets the host and port port where we will connect.
      • reuseCredentials

        public RemoteApiOptions reuseCredentials​(String newUserEmail,
                                                 String serializedCredentials)
        Reuses credentials from another AppEngineClient. Credentials can only be reused from a client with the same hostname and user. Overrides any previously-provided credentials.
        Parameters:
        newUserEmail - the email address of the user we want to log in as.
        serializedCredentials - a string returned by calling RemoteApiClient.serializeCredentials() on the previous client
      • useApplicationDefaultCredential

        public RemoteApiOptions useApplicationDefaultCredential()
        Use a Google Application Default credential for authentication. Overrides any previously-provided credentials.
        Returns:
        this RemoteApiOptions instance.
        See Also:
        Application Default Credentials
      • useServiceAccountCredential

        public RemoteApiOptions useServiceAccountCredential​(String serviceAccountId,
                                                            String p12PrivateKeyFile)
        Use a service account credential. Overrides any previously-provided credentials.
        Parameters:
        serviceAccountId - service account ID (typically an e-mail address)
        p12PrivateKeyFile - p12 file containing a private key to use with the service account
        Returns:
        this RemoteApiOptions instance
      • useServiceAccountCredential

        public RemoteApiOptions useServiceAccountCredential​(String serviceAccountId,
                                                            PrivateKey privateKey)
        Use a service account credential. Overrides any previously-provided credentials.
        Parameters:
        serviceAccountId - service account ID (typically an e-mail address)
        privateKey - private key to use with the service account
        Returns:
        this RemoteApiOptions instance
      • useAccessToken

        public RemoteApiOptions useAccessToken​(String accessToken)
        Use an access token credential. Overrides any previously-provided credentials.
        Parameters:
        accessToken - the access token (generally from Credential.getAccessToken())
        Returns:
        this RemoteApiOptions instance
      • useDevelopmentServerCredential

        public RemoteApiOptions useDevelopmentServerCredential()
        Use credentials appropriate for talking to the Development Server. Overrides any previously-provided credentials.
        Returns:
        this RemoteApiOptions instance
      • remoteApiPath

        public RemoteApiOptions remoteApiPath​(String newPath)
        Sets the path used to access the remote API. If not set, the default is /remote_api.
      • maxConcurrentRequests

        public RemoteApiOptions maxConcurrentRequests​(int newValue)
        This parameter controls the maximum number of async API requests that will be in flight at once. Each concurrent request will likely be handled by a separate instance of your App. Having more instances increases throughput but may result in errors due to exceeding quota. Defaults to 5.
      • datastoreQueryFetchSize

        public RemoteApiOptions datastoreQueryFetchSize​(int newValue)
        When executing a datastore query, this is the number of results to fetch per HTTP request. Increasing this value will reduce the number of round trips when running large queries, but too high a value can be wasteful when not all results are needed. Defaults to 500.

        (This value can be overridden by the code using the datastore API.)

      • maxHttpResponseSize

        public RemoteApiOptions maxHttpResponseSize​(int newValue)
        When making a remote call, this is the maximum size of the HTTP response. The default is 33M. Normally there's no reason to change this. This setting has no effect when running in an App Engine container.
      • getHostname

        public String getHostname()
      • getPort

        public int getPort()
      • getUserEmail

        public String getUserEmail()
      • getPassword

        public String getPassword()
      • getCredentialsToReuse

        public String getCredentialsToReuse()
      • getRemoteApiPath

        public String getRemoteApiPath()
      • getMaxConcurrentRequests

        public int getMaxConcurrentRequests()
      • getDatastoreQueryFetchSize

        public int getDatastoreQueryFetchSize()
      • getMaxHttpResponseSize

        public int getMaxHttpResponseSize()