xref: /aosp_15_r20/external/googleapis/google/devtools/clouddebugger/v2/controller.proto (revision d5c09012810ac0c9f33fe448fb6da8260d444cc9)
1*d5c09012SAndroid Build Coastguard Worker// Copyright 2019 Google LLC.
2*d5c09012SAndroid Build Coastguard Worker//
3*d5c09012SAndroid Build Coastguard Worker// Licensed under the Apache License, Version 2.0 (the "License");
4*d5c09012SAndroid Build Coastguard Worker// you may not use this file except in compliance with the License.
5*d5c09012SAndroid Build Coastguard Worker// You may obtain a copy of the License at
6*d5c09012SAndroid Build Coastguard Worker//
7*d5c09012SAndroid Build Coastguard Worker//     http://www.apache.org/licenses/LICENSE-2.0
8*d5c09012SAndroid Build Coastguard Worker//
9*d5c09012SAndroid Build Coastguard Worker// Unless required by applicable law or agreed to in writing, software
10*d5c09012SAndroid Build Coastguard Worker// distributed under the License is distributed on an "AS IS" BASIS,
11*d5c09012SAndroid Build Coastguard Worker// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12*d5c09012SAndroid Build Coastguard Worker// See the License for the specific language governing permissions and
13*d5c09012SAndroid Build Coastguard Worker// limitations under the License.
14*d5c09012SAndroid Build Coastguard Worker//
15*d5c09012SAndroid Build Coastguard Worker
16*d5c09012SAndroid Build Coastguard Workersyntax = "proto3";
17*d5c09012SAndroid Build Coastguard Worker
18*d5c09012SAndroid Build Coastguard Workerpackage google.devtools.clouddebugger.v2;
19*d5c09012SAndroid Build Coastguard Worker
20*d5c09012SAndroid Build Coastguard Workerimport "google/api/annotations.proto";
21*d5c09012SAndroid Build Coastguard Workerimport "google/api/client.proto";
22*d5c09012SAndroid Build Coastguard Workerimport "google/api/field_behavior.proto";
23*d5c09012SAndroid Build Coastguard Workerimport "google/devtools/clouddebugger/v2/data.proto";
24*d5c09012SAndroid Build Coastguard Worker
25*d5c09012SAndroid Build Coastguard Workeroption csharp_namespace = "Google.Cloud.Debugger.V2";
26*d5c09012SAndroid Build Coastguard Workeroption go_package = "cloud.google.com/go/debugger/apiv2/debuggerpb;debuggerpb";
27*d5c09012SAndroid Build Coastguard Workeroption java_multiple_files = true;
28*d5c09012SAndroid Build Coastguard Workeroption java_outer_classname = "ControllerProto";
29*d5c09012SAndroid Build Coastguard Workeroption java_package = "com.google.devtools.clouddebugger.v2";
30*d5c09012SAndroid Build Coastguard Workeroption php_namespace = "Google\\Cloud\\Debugger\\V2";
31*d5c09012SAndroid Build Coastguard Workeroption ruby_package = "Google::Cloud::Debugger::V2";
32*d5c09012SAndroid Build Coastguard Worker
33*d5c09012SAndroid Build Coastguard Worker// The Controller service provides the API for orchestrating a collection of
34*d5c09012SAndroid Build Coastguard Worker// debugger agents to perform debugging tasks. These agents are each attached
35*d5c09012SAndroid Build Coastguard Worker// to a process of an application which may include one or more replicas.
36*d5c09012SAndroid Build Coastguard Worker//
37*d5c09012SAndroid Build Coastguard Worker// The debugger agents register with the Controller to identify the application
38*d5c09012SAndroid Build Coastguard Worker// being debugged, the Debuggee. All agents that register with the same data,
39*d5c09012SAndroid Build Coastguard Worker// represent the same Debuggee, and are assigned the same `debuggee_id`.
40*d5c09012SAndroid Build Coastguard Worker//
41*d5c09012SAndroid Build Coastguard Worker// The debugger agents call the Controller to retrieve  the list of active
42*d5c09012SAndroid Build Coastguard Worker// Breakpoints. Agents with the same `debuggee_id` get the same breakpoints
43*d5c09012SAndroid Build Coastguard Worker// list. An agent that can fulfill the breakpoint request updates the
44*d5c09012SAndroid Build Coastguard Worker// Controller with the breakpoint result. The controller selects the first
45*d5c09012SAndroid Build Coastguard Worker// result received and discards the rest of the results.
46*d5c09012SAndroid Build Coastguard Worker// Agents that poll again for active breakpoints will no longer have
47*d5c09012SAndroid Build Coastguard Worker// the completed breakpoint in the list and should remove that breakpoint from
48*d5c09012SAndroid Build Coastguard Worker// their attached process.
49*d5c09012SAndroid Build Coastguard Worker//
50*d5c09012SAndroid Build Coastguard Worker// The Controller service does not provide a way to retrieve the results of
51*d5c09012SAndroid Build Coastguard Worker// a completed breakpoint. This functionality is available using the Debugger
52*d5c09012SAndroid Build Coastguard Worker// service.
53*d5c09012SAndroid Build Coastguard Workerservice Controller2 {
54*d5c09012SAndroid Build Coastguard Worker  option (google.api.default_host) = "clouddebugger.googleapis.com";
55*d5c09012SAndroid Build Coastguard Worker  option (google.api.oauth_scopes) =
56*d5c09012SAndroid Build Coastguard Worker      "https://www.googleapis.com/auth/cloud-platform,"
57*d5c09012SAndroid Build Coastguard Worker      "https://www.googleapis.com/auth/cloud_debugger";
58*d5c09012SAndroid Build Coastguard Worker
59*d5c09012SAndroid Build Coastguard Worker  // Registers the debuggee with the controller service.
60*d5c09012SAndroid Build Coastguard Worker  //
61*d5c09012SAndroid Build Coastguard Worker  // All agents attached to the same application must call this method with
62*d5c09012SAndroid Build Coastguard Worker  // exactly the same request content to get back the same stable `debuggee_id`.
63*d5c09012SAndroid Build Coastguard Worker  // Agents should call this method again whenever `google.rpc.Code.NOT_FOUND`
64*d5c09012SAndroid Build Coastguard Worker  // is returned from any controller method.
65*d5c09012SAndroid Build Coastguard Worker  //
66*d5c09012SAndroid Build Coastguard Worker  // This protocol allows the controller service to disable debuggees, recover
67*d5c09012SAndroid Build Coastguard Worker  // from data loss, or change the `debuggee_id` format. Agents must handle
68*d5c09012SAndroid Build Coastguard Worker  // `debuggee_id` value changing upon re-registration.
69*d5c09012SAndroid Build Coastguard Worker  rpc RegisterDebuggee(RegisterDebuggeeRequest) returns (RegisterDebuggeeResponse) {
70*d5c09012SAndroid Build Coastguard Worker    option (google.api.http) = {
71*d5c09012SAndroid Build Coastguard Worker      post: "/v2/controller/debuggees/register"
72*d5c09012SAndroid Build Coastguard Worker      body: "*"
73*d5c09012SAndroid Build Coastguard Worker    };
74*d5c09012SAndroid Build Coastguard Worker    option (google.api.method_signature) = "debuggee";
75*d5c09012SAndroid Build Coastguard Worker  }
76*d5c09012SAndroid Build Coastguard Worker
77*d5c09012SAndroid Build Coastguard Worker  // Returns the list of all active breakpoints for the debuggee.
78*d5c09012SAndroid Build Coastguard Worker  //
79*d5c09012SAndroid Build Coastguard Worker  // The breakpoint specification (`location`, `condition`, and `expressions`
80*d5c09012SAndroid Build Coastguard Worker  // fields) is semantically immutable, although the field values may
81*d5c09012SAndroid Build Coastguard Worker  // change. For example, an agent may update the location line number
82*d5c09012SAndroid Build Coastguard Worker  // to reflect the actual line where the breakpoint was set, but this
83*d5c09012SAndroid Build Coastguard Worker  // doesn't change the breakpoint semantics.
84*d5c09012SAndroid Build Coastguard Worker  //
85*d5c09012SAndroid Build Coastguard Worker  // This means that an agent does not need to check if a breakpoint has changed
86*d5c09012SAndroid Build Coastguard Worker  // when it encounters the same breakpoint on a successive call.
87*d5c09012SAndroid Build Coastguard Worker  // Moreover, an agent should remember the breakpoints that are completed
88*d5c09012SAndroid Build Coastguard Worker  // until the controller removes them from the active list to avoid
89*d5c09012SAndroid Build Coastguard Worker  // setting those breakpoints again.
90*d5c09012SAndroid Build Coastguard Worker  rpc ListActiveBreakpoints(ListActiveBreakpointsRequest) returns (ListActiveBreakpointsResponse) {
91*d5c09012SAndroid Build Coastguard Worker    option (google.api.http) = {
92*d5c09012SAndroid Build Coastguard Worker      get: "/v2/controller/debuggees/{debuggee_id}/breakpoints"
93*d5c09012SAndroid Build Coastguard Worker    };
94*d5c09012SAndroid Build Coastguard Worker    option (google.api.method_signature) = "debuggee_id";
95*d5c09012SAndroid Build Coastguard Worker  }
96*d5c09012SAndroid Build Coastguard Worker
97*d5c09012SAndroid Build Coastguard Worker  // Updates the breakpoint state or mutable fields.
98*d5c09012SAndroid Build Coastguard Worker  // The entire Breakpoint message must be sent back to the controller service.
99*d5c09012SAndroid Build Coastguard Worker  //
100*d5c09012SAndroid Build Coastguard Worker  // Updates to active breakpoint fields are only allowed if the new value
101*d5c09012SAndroid Build Coastguard Worker  // does not change the breakpoint specification. Updates to the `location`,
102*d5c09012SAndroid Build Coastguard Worker  // `condition` and `expressions` fields should not alter the breakpoint
103*d5c09012SAndroid Build Coastguard Worker  // semantics. These may only make changes such as canonicalizing a value
104*d5c09012SAndroid Build Coastguard Worker  // or snapping the location to the correct line of code.
105*d5c09012SAndroid Build Coastguard Worker  rpc UpdateActiveBreakpoint(UpdateActiveBreakpointRequest) returns (UpdateActiveBreakpointResponse) {
106*d5c09012SAndroid Build Coastguard Worker    option (google.api.http) = {
107*d5c09012SAndroid Build Coastguard Worker      put: "/v2/controller/debuggees/{debuggee_id}/breakpoints/{breakpoint.id}"
108*d5c09012SAndroid Build Coastguard Worker      body: "*"
109*d5c09012SAndroid Build Coastguard Worker    };
110*d5c09012SAndroid Build Coastguard Worker    option (google.api.method_signature) = "debuggee_id,breakpoint";
111*d5c09012SAndroid Build Coastguard Worker  }
112*d5c09012SAndroid Build Coastguard Worker}
113*d5c09012SAndroid Build Coastguard Worker
114*d5c09012SAndroid Build Coastguard Worker// Request to register a debuggee.
115*d5c09012SAndroid Build Coastguard Workermessage RegisterDebuggeeRequest {
116*d5c09012SAndroid Build Coastguard Worker  // Required. Debuggee information to register.
117*d5c09012SAndroid Build Coastguard Worker  // The fields `project`, `uniquifier`, `description` and `agent_version`
118*d5c09012SAndroid Build Coastguard Worker  // of the debuggee must be set.
119*d5c09012SAndroid Build Coastguard Worker  Debuggee debuggee = 1 [(google.api.field_behavior) = REQUIRED];
120*d5c09012SAndroid Build Coastguard Worker}
121*d5c09012SAndroid Build Coastguard Worker
122*d5c09012SAndroid Build Coastguard Worker// Response for registering a debuggee.
123*d5c09012SAndroid Build Coastguard Workermessage RegisterDebuggeeResponse {
124*d5c09012SAndroid Build Coastguard Worker  // Debuggee resource.
125*d5c09012SAndroid Build Coastguard Worker  // The field `id` is guaranteed to be set (in addition to the echoed fields).
126*d5c09012SAndroid Build Coastguard Worker  // If the field `is_disabled` is set to `true`, the agent should disable
127*d5c09012SAndroid Build Coastguard Worker  // itself by removing all breakpoints and detaching from the application.
128*d5c09012SAndroid Build Coastguard Worker  // It should however continue to poll `RegisterDebuggee` until reenabled.
129*d5c09012SAndroid Build Coastguard Worker  Debuggee debuggee = 1;
130*d5c09012SAndroid Build Coastguard Worker}
131*d5c09012SAndroid Build Coastguard Worker
132*d5c09012SAndroid Build Coastguard Worker// Request to list active breakpoints.
133*d5c09012SAndroid Build Coastguard Workermessage ListActiveBreakpointsRequest {
134*d5c09012SAndroid Build Coastguard Worker  // Required. Identifies the debuggee.
135*d5c09012SAndroid Build Coastguard Worker  string debuggee_id = 1 [(google.api.field_behavior) = REQUIRED];
136*d5c09012SAndroid Build Coastguard Worker
137*d5c09012SAndroid Build Coastguard Worker  // A token that, if specified, blocks the method call until the list
138*d5c09012SAndroid Build Coastguard Worker  // of active breakpoints has changed, or a server-selected timeout has
139*d5c09012SAndroid Build Coastguard Worker  // expired. The value should be set from the `next_wait_token` field in
140*d5c09012SAndroid Build Coastguard Worker  // the last response. The initial value should be set to `"init"`.
141*d5c09012SAndroid Build Coastguard Worker  string wait_token = 2;
142*d5c09012SAndroid Build Coastguard Worker
143*d5c09012SAndroid Build Coastguard Worker  // If set to `true` (recommended), returns `google.rpc.Code.OK` status and
144*d5c09012SAndroid Build Coastguard Worker  // sets the `wait_expired` response field to `true` when the server-selected
145*d5c09012SAndroid Build Coastguard Worker  // timeout has expired.
146*d5c09012SAndroid Build Coastguard Worker  //
147*d5c09012SAndroid Build Coastguard Worker  // If set to `false` (deprecated), returns `google.rpc.Code.ABORTED` status
148*d5c09012SAndroid Build Coastguard Worker  // when the server-selected timeout has expired.
149*d5c09012SAndroid Build Coastguard Worker  bool success_on_timeout = 3;
150*d5c09012SAndroid Build Coastguard Worker}
151*d5c09012SAndroid Build Coastguard Worker
152*d5c09012SAndroid Build Coastguard Worker// Response for listing active breakpoints.
153*d5c09012SAndroid Build Coastguard Workermessage ListActiveBreakpointsResponse {
154*d5c09012SAndroid Build Coastguard Worker  // List of all active breakpoints.
155*d5c09012SAndroid Build Coastguard Worker  // The fields `id` and `location` are guaranteed to be set on each breakpoint.
156*d5c09012SAndroid Build Coastguard Worker  repeated Breakpoint breakpoints = 1;
157*d5c09012SAndroid Build Coastguard Worker
158*d5c09012SAndroid Build Coastguard Worker  // A token that can be used in the next method call to block until
159*d5c09012SAndroid Build Coastguard Worker  // the list of breakpoints changes.
160*d5c09012SAndroid Build Coastguard Worker  string next_wait_token = 2;
161*d5c09012SAndroid Build Coastguard Worker
162*d5c09012SAndroid Build Coastguard Worker  // If set to `true`, indicates that there is no change to the
163*d5c09012SAndroid Build Coastguard Worker  // list of active breakpoints and the server-selected timeout has expired.
164*d5c09012SAndroid Build Coastguard Worker  // The `breakpoints` field would be empty and should be ignored.
165*d5c09012SAndroid Build Coastguard Worker  bool wait_expired = 3;
166*d5c09012SAndroid Build Coastguard Worker}
167*d5c09012SAndroid Build Coastguard Worker
168*d5c09012SAndroid Build Coastguard Worker// Request to update an active breakpoint.
169*d5c09012SAndroid Build Coastguard Workermessage UpdateActiveBreakpointRequest {
170*d5c09012SAndroid Build Coastguard Worker  // Required. Identifies the debuggee being debugged.
171*d5c09012SAndroid Build Coastguard Worker  string debuggee_id = 1 [(google.api.field_behavior) = REQUIRED];
172*d5c09012SAndroid Build Coastguard Worker
173*d5c09012SAndroid Build Coastguard Worker  // Required. Updated breakpoint information.
174*d5c09012SAndroid Build Coastguard Worker  // The field `id` must be set.
175*d5c09012SAndroid Build Coastguard Worker  // The agent must echo all Breakpoint specification fields in the update.
176*d5c09012SAndroid Build Coastguard Worker  Breakpoint breakpoint = 2 [(google.api.field_behavior) = REQUIRED];
177*d5c09012SAndroid Build Coastguard Worker}
178*d5c09012SAndroid Build Coastguard Worker
179*d5c09012SAndroid Build Coastguard Worker// Response for updating an active breakpoint.
180*d5c09012SAndroid Build Coastguard Worker// The message is defined to allow future extensions.
181*d5c09012SAndroid Build Coastguard Workermessage UpdateActiveBreakpointResponse {
182*d5c09012SAndroid Build Coastguard Worker
183*d5c09012SAndroid Build Coastguard Worker}
184