-
Notifications
You must be signed in to change notification settings - Fork 4
/
controller.clj
153 lines (132 loc) · 5.24 KB
/
controller.clj
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
(ns happygapi.clouddebugger.controller
"Cloud Debugger API: controller.
Examines the call stack and variables of a running application without stopping or slowing it down.
See: https://cloud.google.com/debuggerapi/reference/rest/v2/controller"
(:require [cheshire.core :as json]
[clj-http.client :as http]
[happy.util :as util]))
(defn debuggees-register$
"https://cloud.google.com/debuggerapi/reference/rest/v2/controller/debuggees/register
Required parameters: none
Optional parameters: none
Body:
{:debuggee {:description string,
:labels {},
:isDisabled boolean,
:agentVersion string,
:isInactive boolean,
:sourceContexts [SourceContext],
:uniquifier string,
:project string,
:status StatusMessage,
:id string,
:extSourceContexts [ExtendedSourceContext]}}
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."
{:scopes ["https://www.googleapis.com/auth/cloud-platform"
"https://www.googleapis.com/auth/cloud_debugger"]}
[auth args body]
{:pre [(util/has-keys? args #{})]}
(util/get-response
(http/post
(util/get-url
"https://clouddebugger.googleapis.com/"
"v2/controller/debuggees/register"
#{}
args)
(merge-with
merge
{:content-type :json,
:body (json/generate-string body),
:throw-exceptions false,
:query-params args,
:accept :json,
:as :json}
auth))))
(defn debuggees-breakpoints-list$
"https://cloud.google.com/debuggerapi/reference/rest/v2/controller/debuggees/breakpoints/list
Required parameters: debuggeeId
Optional parameters: waitToken, successOnTimeout
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."
{:scopes ["https://www.googleapis.com/auth/cloud-platform"
"https://www.googleapis.com/auth/cloud_debugger"]}
[auth args]
{:pre [(util/has-keys? args #{:debuggeeId})]}
(util/get-response
(http/get
(util/get-url
"https://clouddebugger.googleapis.com/"
"v2/controller/debuggees/{debuggeeId}/breakpoints"
#{:debuggeeId}
args)
(merge-with
merge
{:throw-exceptions false,
:query-params args,
:accept :json,
:as :json}
auth))))
(defn debuggees-breakpoints-update$
"https://cloud.google.com/debuggerapi/reference/rest/v2/controller/debuggees/breakpoints/update
Required parameters: debuggeeId, id
Optional parameters: none
Body:
{:breakpoint {:finalTime string,
:labels {},
:isFinalState boolean,
:stackFrames [StackFrame],
:createTime string,
:evaluatedExpressions [Variable],
:status StatusMessage,
:id string,
:condition string,
:expressions [string],
:logLevel string,
:variableTable [Variable],
:action string,
:location SourceLocation,
:logMessageFormat string,
:userEmail string}}
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."
{:scopes ["https://www.googleapis.com/auth/cloud-platform"
"https://www.googleapis.com/auth/cloud_debugger"]}
[auth args body]
{:pre [(util/has-keys? args #{:debuggeeId :id})]}
(util/get-response
(http/put
(util/get-url
"https://clouddebugger.googleapis.com/"
"v2/controller/debuggees/{debuggeeId}/breakpoints/{id}"
#{:debuggeeId :id}
args)
(merge-with
merge
{:content-type :json,
:body (json/generate-string body),
:throw-exceptions false,
:query-params args,
:accept :json,
:as :json}
auth))))