Class Controller2Client

  • All Implemented Interfaces:
    com.google.api.gax.core.BackgroundResource, AutoCloseable

    @Generated("by gapic-generator-java")
    public class Controller2Client
    extends Object
    implements com.google.api.gax.core.BackgroundResource
    Service Description: The Controller service provides the API for orchestrating a collection of debugger agents to perform debugging tasks. These agents are each attached to a process of an application which may include one or more replicas.

    The debugger agents register with the Controller to identify the application being debugged, the Debuggee. All agents that register with the same data, represent the same Debuggee, and are assigned the same `debuggee_id`.

    The debugger agents call the Controller to retrieve the list of active Breakpoints. Agents with the same `debuggee_id` get the same breakpoints list. An agent that can fulfill the breakpoint request updates the Controller with the breakpoint result. The controller selects the first result received and discards the rest of the results. Agents that poll again for active breakpoints will no longer have the completed breakpoint in the list and should remove that breakpoint from their attached process.

    The Controller service does not provide a way to retrieve the results of a completed breakpoint. This functionality is available using the Debugger service.

    This class provides the ability to make remote calls to the backing service through method calls that map to API methods. Sample code to get started:

    
     // This snippet has been automatically generated and should be regarded as a code template only.
     // It will require modifications to work:
     // - It may require correct/in-range values for request initialization.
     // - It may require specifying regional endpoints when creating the service client as shown in
     // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
     try (Controller2Client controller2Client = Controller2Client.create()) {
       Debuggee debuggee = Debuggee.newBuilder().build();
       RegisterDebuggeeResponse response = controller2Client.registerDebuggee(debuggee);
     }
     

    Note: close() needs to be called on the Controller2Client object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().

    The surface of this class includes several types of Java methods for each of the API's methods:

    1. A "flattened" method. With this type of method, the fields of the request type have been converted into function parameters. It may be the case that not all fields are available as parameters, and not every API method will have a flattened method entry point.
    2. A "request object" method. This type of method only takes one parameter, a request object, which must be constructed before the call. Not every API method will have a request object method.
    3. A "callable" method. This type of method takes no parameters and returns an immutable API callable object, which can be used to initiate calls to the service.

    See the individual methods for example code.

    Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parse method to extract the individual identifiers contained within names that are returned.

    This class can be customized by passing in a custom instance of Controller2Settings to create(). For example:

    To customize credentials:

    
     // This snippet has been automatically generated and should be regarded as a code template only.
     // It will require modifications to work:
     // - It may require correct/in-range values for request initialization.
     // - It may require specifying regional endpoints when creating the service client as shown in
     // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
     Controller2Settings controller2Settings =
         Controller2Settings.newBuilder()
             .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
             .build();
     Controller2Client controller2Client = Controller2Client.create(controller2Settings);
     

    To customize the endpoint:

    
     // This snippet has been automatically generated and should be regarded as a code template only.
     // It will require modifications to work:
     // - It may require correct/in-range values for request initialization.
     // - It may require specifying regional endpoints when creating the service client as shown in
     // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
     Controller2Settings controller2Settings =
         Controller2Settings.newBuilder().setEndpoint(myEndpoint).build();
     Controller2Client controller2Client = Controller2Client.create(controller2Settings);
     

    To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over the wire:

    
     // This snippet has been automatically generated and should be regarded as a code template only.
     // It will require modifications to work:
     // - It may require correct/in-range values for request initialization.
     // - It may require specifying regional endpoints when creating the service client as shown in
     // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
     Controller2Settings controller2Settings = Controller2Settings.newHttpJsonBuilder().build();
     Controller2Client controller2Client = Controller2Client.create(controller2Settings);
     

    Please refer to the GitHub repository's samples for more quickstart code snippets.

    • Constructor Detail

      • Controller2Client

        protected Controller2Client​(Controller2Settings settings)
                             throws IOException
        Constructs an instance of Controller2Client, using the given settings. This is protected so that it is easy to make a subclass, but otherwise, the static factory methods should be preferred.
        Throws:
        IOException
    • Method Detail

      • create

        public static final Controller2Client create​(Controller2Settings settings)
                                              throws IOException
        Constructs an instance of Controller2Client, using the given settings. The channels are created based on the settings passed in, or defaults for any settings that are not set.
        Throws:
        IOException
      • create

        public static final Controller2Client create​(Controller2Stub stub)
        Constructs an instance of Controller2Client, using the given stub for making calls. This is for advanced usage - prefer using create(Controller2Settings).
      • registerDebuggee

        public final RegisterDebuggeeResponse registerDebuggee​(Debuggee debuggee)
        Registers the debuggee with the controller service.

        All agents attached to the same application must call this method with exactly the same request content to get back the same stable `debuggee_id`. Agents should call this method again whenever `google.rpc.Code.NOT_FOUND` is returned from any controller method.

        This protocol allows the controller service to disable debuggees, recover from data loss, or change the `debuggee_id` format. Agents must handle `debuggee_id` value changing upon re-registration.

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (Controller2Client controller2Client = Controller2Client.create()) {
           Debuggee debuggee = Debuggee.newBuilder().build();
           RegisterDebuggeeResponse response = controller2Client.registerDebuggee(debuggee);
         }
         
        Parameters:
        debuggee - Required. Debuggee information to register. The fields `project`, `uniquifier`, `description` and `agent_version` of the debuggee must be set.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • registerDebuggee

        public final RegisterDebuggeeResponse registerDebuggee​(RegisterDebuggeeRequest request)
        Registers the debuggee with the controller service.

        All agents attached to the same application must call this method with exactly the same request content to get back the same stable `debuggee_id`. Agents should call this method again whenever `google.rpc.Code.NOT_FOUND` is returned from any controller method.

        This protocol allows the controller service to disable debuggees, recover from data loss, or change the `debuggee_id` format. Agents must handle `debuggee_id` value changing upon re-registration.

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (Controller2Client controller2Client = Controller2Client.create()) {
           RegisterDebuggeeRequest request =
               RegisterDebuggeeRequest.newBuilder().setDebuggee(Debuggee.newBuilder().build()).build();
           RegisterDebuggeeResponse response = controller2Client.registerDebuggee(request);
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • registerDebuggeeCallable

        public final com.google.api.gax.rpc.UnaryCallable<RegisterDebuggeeRequest,​RegisterDebuggeeResponse> registerDebuggeeCallable()
        Registers the debuggee with the controller service.

        All agents attached to the same application must call this method with exactly the same request content to get back the same stable `debuggee_id`. Agents should call this method again whenever `google.rpc.Code.NOT_FOUND` is returned from any controller method.

        This protocol allows the controller service to disable debuggees, recover from data loss, or change the `debuggee_id` format. Agents must handle `debuggee_id` value changing upon re-registration.

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (Controller2Client controller2Client = Controller2Client.create()) {
           RegisterDebuggeeRequest request =
               RegisterDebuggeeRequest.newBuilder().setDebuggee(Debuggee.newBuilder().build()).build();
           ApiFuture<RegisterDebuggeeResponse> future =
               controller2Client.registerDebuggeeCallable().futureCall(request);
           // Do something.
           RegisterDebuggeeResponse response = future.get();
         }
         
      • listActiveBreakpoints

        public final ListActiveBreakpointsResponse listActiveBreakpoints​(String debuggeeId)
        Returns the list of all active breakpoints for the debuggee.

        The breakpoint specification (`location`, `condition`, and `expressions` fields) is semantically immutable, although the field values may change. For example, an agent may update the location line number to reflect the actual line where the breakpoint was set, but this doesn't change the breakpoint semantics.

        This means that an agent does not need to check if a breakpoint has changed when it encounters the same breakpoint on a successive call. Moreover, an agent should remember the breakpoints that are completed until the controller removes them from the active list to avoid setting those breakpoints again.

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (Controller2Client controller2Client = Controller2Client.create()) {
           String debuggeeId = "debuggeeId-1833285553";
           ListActiveBreakpointsResponse response = controller2Client.listActiveBreakpoints(debuggeeId);
         }
         
        Parameters:
        debuggeeId - Required. Identifies the debuggee.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • listActiveBreakpoints

        public final ListActiveBreakpointsResponse listActiveBreakpoints​(ListActiveBreakpointsRequest request)
        Returns the list of all active breakpoints for the debuggee.

        The breakpoint specification (`location`, `condition`, and `expressions` fields) is semantically immutable, although the field values may change. For example, an agent may update the location line number to reflect the actual line where the breakpoint was set, but this doesn't change the breakpoint semantics.

        This means that an agent does not need to check if a breakpoint has changed when it encounters the same breakpoint on a successive call. Moreover, an agent should remember the breakpoints that are completed until the controller removes them from the active list to avoid setting those breakpoints again.

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (Controller2Client controller2Client = Controller2Client.create()) {
           ListActiveBreakpointsRequest request =
               ListActiveBreakpointsRequest.newBuilder()
                   .setDebuggeeId("debuggeeId-1833285553")
                   .setWaitToken("waitToken-984229500")
                   .setSuccessOnTimeout(true)
                   .build();
           ListActiveBreakpointsResponse response = controller2Client.listActiveBreakpoints(request);
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • listActiveBreakpointsCallable

        public final com.google.api.gax.rpc.UnaryCallable<ListActiveBreakpointsRequest,​ListActiveBreakpointsResponse> listActiveBreakpointsCallable()
        Returns the list of all active breakpoints for the debuggee.

        The breakpoint specification (`location`, `condition`, and `expressions` fields) is semantically immutable, although the field values may change. For example, an agent may update the location line number to reflect the actual line where the breakpoint was set, but this doesn't change the breakpoint semantics.

        This means that an agent does not need to check if a breakpoint has changed when it encounters the same breakpoint on a successive call. Moreover, an agent should remember the breakpoints that are completed until the controller removes them from the active list to avoid setting those breakpoints again.

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (Controller2Client controller2Client = Controller2Client.create()) {
           ListActiveBreakpointsRequest request =
               ListActiveBreakpointsRequest.newBuilder()
                   .setDebuggeeId("debuggeeId-1833285553")
                   .setWaitToken("waitToken-984229500")
                   .setSuccessOnTimeout(true)
                   .build();
           ApiFuture<ListActiveBreakpointsResponse> future =
               controller2Client.listActiveBreakpointsCallable().futureCall(request);
           // Do something.
           ListActiveBreakpointsResponse response = future.get();
         }
         
      • updateActiveBreakpoint

        public final UpdateActiveBreakpointResponse updateActiveBreakpoint​(String debuggeeId,
                                                                           Breakpoint breakpoint)
        Updates the breakpoint state or mutable fields. The entire Breakpoint message must be sent back to the controller service.

        Updates to active breakpoint fields are only allowed if the new value does not change the breakpoint specification. Updates to the `location`, `condition` and `expressions` fields should not alter the breakpoint semantics. These may only make changes such as canonicalizing a value or snapping the location to the correct line of code.

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (Controller2Client controller2Client = Controller2Client.create()) {
           String debuggeeId = "debuggeeId-1833285553";
           Breakpoint breakpoint = Breakpoint.newBuilder().build();
           UpdateActiveBreakpointResponse response =
               controller2Client.updateActiveBreakpoint(debuggeeId, breakpoint);
         }
         
        Parameters:
        debuggeeId - Required. Identifies the debuggee being debugged.
        breakpoint - Required. Updated breakpoint information. The field `id` must be set. The agent must echo all Breakpoint specification fields in the update.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • updateActiveBreakpoint

        public final UpdateActiveBreakpointResponse updateActiveBreakpoint​(UpdateActiveBreakpointRequest request)
        Updates the breakpoint state or mutable fields. The entire Breakpoint message must be sent back to the controller service.

        Updates to active breakpoint fields are only allowed if the new value does not change the breakpoint specification. Updates to the `location`, `condition` and `expressions` fields should not alter the breakpoint semantics. These may only make changes such as canonicalizing a value or snapping the location to the correct line of code.

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (Controller2Client controller2Client = Controller2Client.create()) {
           UpdateActiveBreakpointRequest request =
               UpdateActiveBreakpointRequest.newBuilder()
                   .setDebuggeeId("debuggeeId-1833285553")
                   .setBreakpoint(Breakpoint.newBuilder().build())
                   .build();
           UpdateActiveBreakpointResponse response = controller2Client.updateActiveBreakpoint(request);
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • updateActiveBreakpointCallable

        public final com.google.api.gax.rpc.UnaryCallable<UpdateActiveBreakpointRequest,​UpdateActiveBreakpointResponse> updateActiveBreakpointCallable()
        Updates the breakpoint state or mutable fields. The entire Breakpoint message must be sent back to the controller service.

        Updates to active breakpoint fields are only allowed if the new value does not change the breakpoint specification. Updates to the `location`, `condition` and `expressions` fields should not alter the breakpoint semantics. These may only make changes such as canonicalizing a value or snapping the location to the correct line of code.

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (Controller2Client controller2Client = Controller2Client.create()) {
           UpdateActiveBreakpointRequest request =
               UpdateActiveBreakpointRequest.newBuilder()
                   .setDebuggeeId("debuggeeId-1833285553")
                   .setBreakpoint(Breakpoint.newBuilder().build())
                   .build();
           ApiFuture<UpdateActiveBreakpointResponse> future =
               controller2Client.updateActiveBreakpointCallable().futureCall(request);
           // Do something.
           UpdateActiveBreakpointResponse response = future.get();
         }
         
      • shutdown

        public void shutdown()
        Specified by:
        shutdown in interface com.google.api.gax.core.BackgroundResource
      • isShutdown

        public boolean isShutdown()
        Specified by:
        isShutdown in interface com.google.api.gax.core.BackgroundResource
      • isTerminated

        public boolean isTerminated()
        Specified by:
        isTerminated in interface com.google.api.gax.core.BackgroundResource
      • shutdownNow

        public void shutdownNow()
        Specified by:
        shutdownNow in interface com.google.api.gax.core.BackgroundResource