losant_rest 1.16.6 → 1.17.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/docs/_schemas.md +2916 -598
- data/docs/applicationApiTokens.md +1 -1
- data/docs/events.md +1 -1
- data/docs/notebook.md +1 -1
- data/docs/resourceJob.md +263 -0
- data/docs/resourceJobs.md +93 -0
- data/lib/losant_rest/application_api_tokens.rb +1 -1
- data/lib/losant_rest/client.rb +10 -2
- data/lib/losant_rest/events.rb +1 -1
- data/lib/losant_rest/notebook.rb +1 -1
- data/lib/losant_rest/resource_job.rb +326 -0
- data/lib/losant_rest/resource_jobs.rb +138 -0
- data/lib/losant_rest/version.rb +1 -1
- data/lib/losant_rest.rb +2 -0
- data/schemas/apiTokenPost.json +10 -0
- data/schemas/applicationCreationByTemplateResult.json +1 -9
- data/schemas/applicationExportPost.json +4 -0
- data/schemas/applicationTemplate.json +3 -0
- data/schemas/applicationTemplates.json +3 -0
- data/schemas/auditLog.json +2 -1
- data/schemas/auditLogFilter.json +2 -1
- data/schemas/auditLogs.json +2 -1
- data/schemas/dataTableRowInsertResult.json +2 -1
- data/schemas/eventPlusNewCount.json +161 -0
- data/schemas/experienceLinkedResources.json +33 -6
- data/schemas/flow.json +8 -2
- data/schemas/flowPatch.json +8 -2
- data/schemas/flowPost.json +8 -2
- data/schemas/flowVersion.json +25 -4
- data/schemas/flowVersionPost.json +8 -2
- data/schemas/flowVersions.json +25 -4
- data/schemas/flows.json +8 -2
- data/schemas/flowsImportPost.json +16 -4
- data/schemas/flowsImportResult.json +33 -6
- data/schemas/githubLogin.json +10 -0
- data/schemas/historicalSummaries.json +524 -1
- data/schemas/historicalSummary.json +22 -0
- data/schemas/importIntoApplicationOptions.json +6 -1
- data/schemas/importNewApplicationOptions.json +6 -1
- data/schemas/instance.json +12 -0
- data/schemas/instanceCustomNodePatch.json +8 -2
- data/schemas/instanceCustomNodePost.json +8 -2
- data/schemas/instanceOrg.json +3 -0
- data/schemas/instanceOrgPatch.json +4 -0
- data/schemas/instanceOrgPost.json +4 -0
- data/schemas/instanceOrgs.json +3 -0
- data/schemas/instanceSandbox.json +11 -0
- data/schemas/instanceSandboxes.json +433 -1
- data/schemas/instances.json +217 -1
- data/schemas/me.json +11 -0
- data/schemas/notebookExecutionLogs.json +3 -1
- data/schemas/org.json +11 -0
- data/schemas/orgs.json +11 -0
- data/schemas/payloadStats.json +8 -0
- data/schemas/resourceJob.json +86 -0
- data/schemas/resourceJobExecutionLogs.json +127 -0
- data/schemas/resourceJobExecutionOptions.json +11 -0
- data/schemas/resourceJobPatch.json +55 -0
- data/schemas/resourceJobPost.json +66 -0
- data/schemas/resourceJobs.json +131 -0
- data/schemas/samlResponse.json +10 -0
- data/schemas/userCredentials.json +10 -0
- data/schemas/userPost.json +10 -0
- data/schemas/validateContextError.json +4 -0
- data/schemas/validationErrors.json +1 -9
- metadata +13 -2
@@ -0,0 +1,326 @@
|
|
1
|
+
# The MIT License (MIT)
|
2
|
+
#
|
3
|
+
# Copyright (c) 2022 Losant IoT, Inc.
|
4
|
+
#
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
# of this software and associated documentation files (the "Software"), to deal
|
7
|
+
# in the Software without restriction, including without limitation the rights
|
8
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
# copies of the Software, and to permit persons to whom the Software is
|
10
|
+
# furnished to do so, subject to the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be included in all
|
13
|
+
# copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
# SOFTWARE.
|
22
|
+
|
23
|
+
require "json"
|
24
|
+
|
25
|
+
module LosantRest
|
26
|
+
|
27
|
+
# Class containing all the actions for the Resource Job Resource
|
28
|
+
class ResourceJob
|
29
|
+
|
30
|
+
def initialize(client)
|
31
|
+
@client = client
|
32
|
+
end
|
33
|
+
|
34
|
+
# Marks a specific resource job execution for cancellation
|
35
|
+
#
|
36
|
+
# Authentication:
|
37
|
+
# The client must be configured with a valid api
|
38
|
+
# access token to call this action. The token
|
39
|
+
# must include at least one of the following scopes:
|
40
|
+
# all.Application, all.Organization, all.User, resourceJob.*, or resourceJob.cancelExecution.
|
41
|
+
#
|
42
|
+
# Parameters:
|
43
|
+
# * {string} applicationId - ID associated with the application
|
44
|
+
# * {string} resourceJobId - ID associated with the resource job
|
45
|
+
# * {undefined} executionId - The ID of the execution to cancel
|
46
|
+
# * {string} losantdomain - Domain scope of request (rarely needed)
|
47
|
+
# * {boolean} _actions - Return resource actions in response
|
48
|
+
# * {boolean} _links - Return resource link in response
|
49
|
+
# * {boolean} _embedded - Return embedded resources in response
|
50
|
+
#
|
51
|
+
# Responses:
|
52
|
+
# * 200 - If the execution was successfully marked for cancellation (https://api.losant.com/#/definitions/success)
|
53
|
+
#
|
54
|
+
# Errors:
|
55
|
+
# * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
|
56
|
+
# * 404 - Error if execution was not found (https://api.losant.com/#/definitions/error)
|
57
|
+
def cancel_execution(params = {})
|
58
|
+
params = Utils.symbolize_hash_keys(params)
|
59
|
+
query_params = { _actions: false, _links: true, _embedded: true }
|
60
|
+
headers = {}
|
61
|
+
body = nil
|
62
|
+
|
63
|
+
raise ArgumentError.new("applicationId is required") unless params.has_key?(:applicationId)
|
64
|
+
raise ArgumentError.new("resourceJobId is required") unless params.has_key?(:resourceJobId)
|
65
|
+
raise ArgumentError.new("executionId is required") unless params.has_key?(:executionId)
|
66
|
+
|
67
|
+
query_params[:executionId] = params[:executionId] if params.has_key?(:executionId)
|
68
|
+
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
69
|
+
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
70
|
+
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
71
|
+
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
72
|
+
|
73
|
+
path = "/applications/#{params[:applicationId]}/resource-jobs/#{params[:resourceJobId]}/cancelExecution"
|
74
|
+
|
75
|
+
@client.request(
|
76
|
+
method: :post,
|
77
|
+
path: path,
|
78
|
+
query: query_params,
|
79
|
+
headers: headers,
|
80
|
+
body: body)
|
81
|
+
end
|
82
|
+
|
83
|
+
# Deletes a resource job
|
84
|
+
#
|
85
|
+
# Authentication:
|
86
|
+
# The client must be configured with a valid api
|
87
|
+
# access token to call this action. The token
|
88
|
+
# must include at least one of the following scopes:
|
89
|
+
# all.Application, all.Organization, all.User, resourceJob.*, or resourceJob.delete.
|
90
|
+
#
|
91
|
+
# Parameters:
|
92
|
+
# * {string} applicationId - ID associated with the application
|
93
|
+
# * {string} resourceJobId - ID associated with the resource job
|
94
|
+
# * {string} includeWorkflows - If the workflows that trigger from this resource job should also be deleted.
|
95
|
+
# * {string} losantdomain - Domain scope of request (rarely needed)
|
96
|
+
# * {boolean} _actions - Return resource actions in response
|
97
|
+
# * {boolean} _links - Return resource link in response
|
98
|
+
# * {boolean} _embedded - Return embedded resources in response
|
99
|
+
#
|
100
|
+
# Responses:
|
101
|
+
# * 200 - If resource job was successfully deleted (https://api.losant.com/#/definitions/success)
|
102
|
+
#
|
103
|
+
# Errors:
|
104
|
+
# * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
|
105
|
+
# * 404 - Error if resource job was not found (https://api.losant.com/#/definitions/error)
|
106
|
+
def delete(params = {})
|
107
|
+
params = Utils.symbolize_hash_keys(params)
|
108
|
+
query_params = { _actions: false, _links: true, _embedded: true }
|
109
|
+
headers = {}
|
110
|
+
body = nil
|
111
|
+
|
112
|
+
raise ArgumentError.new("applicationId is required") unless params.has_key?(:applicationId)
|
113
|
+
raise ArgumentError.new("resourceJobId is required") unless params.has_key?(:resourceJobId)
|
114
|
+
|
115
|
+
query_params[:includeWorkflows] = params[:includeWorkflows] if params.has_key?(:includeWorkflows)
|
116
|
+
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
117
|
+
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
118
|
+
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
119
|
+
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
120
|
+
|
121
|
+
path = "/applications/#{params[:applicationId]}/resource-jobs/#{params[:resourceJobId]}"
|
122
|
+
|
123
|
+
@client.request(
|
124
|
+
method: :delete,
|
125
|
+
path: path,
|
126
|
+
query: query_params,
|
127
|
+
headers: headers,
|
128
|
+
body: body)
|
129
|
+
end
|
130
|
+
|
131
|
+
# Queues the execution of a resource job
|
132
|
+
#
|
133
|
+
# Authentication:
|
134
|
+
# The client must be configured with a valid api
|
135
|
+
# access token to call this action. The token
|
136
|
+
# must include at least one of the following scopes:
|
137
|
+
# all.Application, all.Organization, all.User, resourceJob.*, or resourceJob.execute.
|
138
|
+
#
|
139
|
+
# Parameters:
|
140
|
+
# * {string} applicationId - ID associated with the application
|
141
|
+
# * {string} resourceJobId - ID associated with the resource job
|
142
|
+
# * {hash} executionOptions - The options for the execution (https://api.losant.com/#/definitions/resourceJobExecutionOptions)
|
143
|
+
# * {string} losantdomain - Domain scope of request (rarely needed)
|
144
|
+
# * {boolean} _actions - Return resource actions in response
|
145
|
+
# * {boolean} _links - Return resource link in response
|
146
|
+
# * {boolean} _embedded - Return embedded resources in response
|
147
|
+
#
|
148
|
+
# Responses:
|
149
|
+
# * 200 - If the job was successfully queued (https://api.losant.com/#/definitions/successWithExecutionId)
|
150
|
+
#
|
151
|
+
# Errors:
|
152
|
+
# * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
|
153
|
+
# * 404 - Error if resource job was not found (https://api.losant.com/#/definitions/error)
|
154
|
+
def execute(params = {})
|
155
|
+
params = Utils.symbolize_hash_keys(params)
|
156
|
+
query_params = { _actions: false, _links: true, _embedded: true }
|
157
|
+
headers = {}
|
158
|
+
body = nil
|
159
|
+
|
160
|
+
raise ArgumentError.new("applicationId is required") unless params.has_key?(:applicationId)
|
161
|
+
raise ArgumentError.new("resourceJobId is required") unless params.has_key?(:resourceJobId)
|
162
|
+
raise ArgumentError.new("executionOptions is required") unless params.has_key?(:executionOptions)
|
163
|
+
|
164
|
+
body = params[:executionOptions] if params.has_key?(:executionOptions)
|
165
|
+
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
166
|
+
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
167
|
+
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
168
|
+
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
169
|
+
|
170
|
+
path = "/applications/#{params[:applicationId]}/resource-jobs/#{params[:resourceJobId]}/execute"
|
171
|
+
|
172
|
+
@client.request(
|
173
|
+
method: :post,
|
174
|
+
path: path,
|
175
|
+
query: query_params,
|
176
|
+
headers: headers,
|
177
|
+
body: body)
|
178
|
+
end
|
179
|
+
|
180
|
+
# Returns a resource job
|
181
|
+
#
|
182
|
+
# Authentication:
|
183
|
+
# The client must be configured with a valid api
|
184
|
+
# access token to call this action. The token
|
185
|
+
# must include at least one of the following scopes:
|
186
|
+
# all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, resourceJob.*, or resourceJob.get.
|
187
|
+
#
|
188
|
+
# Parameters:
|
189
|
+
# * {string} applicationId - ID associated with the application
|
190
|
+
# * {string} resourceJobId - ID associated with the resource job
|
191
|
+
# * {string} losantdomain - Domain scope of request (rarely needed)
|
192
|
+
# * {boolean} _actions - Return resource actions in response
|
193
|
+
# * {boolean} _links - Return resource link in response
|
194
|
+
# * {boolean} _embedded - Return embedded resources in response
|
195
|
+
#
|
196
|
+
# Responses:
|
197
|
+
# * 200 - A single resource job (https://api.losant.com/#/definitions/resourceJob)
|
198
|
+
#
|
199
|
+
# Errors:
|
200
|
+
# * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
|
201
|
+
# * 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
|
202
|
+
def get(params = {})
|
203
|
+
params = Utils.symbolize_hash_keys(params)
|
204
|
+
query_params = { _actions: false, _links: true, _embedded: true }
|
205
|
+
headers = {}
|
206
|
+
body = nil
|
207
|
+
|
208
|
+
raise ArgumentError.new("applicationId is required") unless params.has_key?(:applicationId)
|
209
|
+
raise ArgumentError.new("resourceJobId is required") unless params.has_key?(:resourceJobId)
|
210
|
+
|
211
|
+
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
212
|
+
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
213
|
+
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
214
|
+
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
215
|
+
|
216
|
+
path = "/applications/#{params[:applicationId]}/resource-jobs/#{params[:resourceJobId]}"
|
217
|
+
|
218
|
+
@client.request(
|
219
|
+
method: :get,
|
220
|
+
path: path,
|
221
|
+
query: query_params,
|
222
|
+
headers: headers,
|
223
|
+
body: body)
|
224
|
+
end
|
225
|
+
|
226
|
+
# Retrieves information on resource job executions
|
227
|
+
#
|
228
|
+
# Authentication:
|
229
|
+
# The client must be configured with a valid api
|
230
|
+
# access token to call this action. The token
|
231
|
+
# must include at least one of the following scopes:
|
232
|
+
# all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, resourceJob.*, or resourceJob.logs.
|
233
|
+
#
|
234
|
+
# Parameters:
|
235
|
+
# * {string} applicationId - ID associated with the application
|
236
|
+
# * {string} resourceJobId - ID associated with the resource job
|
237
|
+
# * {string} limit - Max log entries to return (ordered by time descending)
|
238
|
+
# * {string} since - Look for log entries since this time (ms since epoch)
|
239
|
+
# * {string} losantdomain - Domain scope of request (rarely needed)
|
240
|
+
# * {boolean} _actions - Return resource actions in response
|
241
|
+
# * {boolean} _links - Return resource link in response
|
242
|
+
# * {boolean} _embedded - Return embedded resources in response
|
243
|
+
#
|
244
|
+
# Responses:
|
245
|
+
# * 200 - Resource job execution information (https://api.losant.com/#/definitions/resourceJobExecutionLogs)
|
246
|
+
#
|
247
|
+
# Errors:
|
248
|
+
# * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
|
249
|
+
# * 404 - Error if resource job was not found (https://api.losant.com/#/definitions/error)
|
250
|
+
def logs(params = {})
|
251
|
+
params = Utils.symbolize_hash_keys(params)
|
252
|
+
query_params = { _actions: false, _links: true, _embedded: true }
|
253
|
+
headers = {}
|
254
|
+
body = nil
|
255
|
+
|
256
|
+
raise ArgumentError.new("applicationId is required") unless params.has_key?(:applicationId)
|
257
|
+
raise ArgumentError.new("resourceJobId is required") unless params.has_key?(:resourceJobId)
|
258
|
+
|
259
|
+
query_params[:limit] = params[:limit] if params.has_key?(:limit)
|
260
|
+
query_params[:since] = params[:since] if params.has_key?(:since)
|
261
|
+
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
262
|
+
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
263
|
+
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
264
|
+
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
265
|
+
|
266
|
+
path = "/applications/#{params[:applicationId]}/resource-jobs/#{params[:resourceJobId]}/logs"
|
267
|
+
|
268
|
+
@client.request(
|
269
|
+
method: :get,
|
270
|
+
path: path,
|
271
|
+
query: query_params,
|
272
|
+
headers: headers,
|
273
|
+
body: body)
|
274
|
+
end
|
275
|
+
|
276
|
+
# Update a resource job
|
277
|
+
#
|
278
|
+
# Authentication:
|
279
|
+
# The client must be configured with a valid api
|
280
|
+
# access token to call this action. The token
|
281
|
+
# must include at least one of the following scopes:
|
282
|
+
# all.Application, all.Organization, all.User, resourceJob.*, or resourceJob.patch.
|
283
|
+
#
|
284
|
+
# Parameters:
|
285
|
+
# * {string} applicationId - ID associated with the application
|
286
|
+
# * {string} resourceJobId - ID associated with the resource job
|
287
|
+
# * {hash} resourceJob - The new resource job configuration (https://api.losant.com/#/definitions/resourceJobPatch)
|
288
|
+
# * {string} losantdomain - Domain scope of request (rarely needed)
|
289
|
+
# * {boolean} _actions - Return resource actions in response
|
290
|
+
# * {boolean} _links - Return resource link in response
|
291
|
+
# * {boolean} _embedded - Return embedded resources in response
|
292
|
+
#
|
293
|
+
# Responses:
|
294
|
+
# * 201 - Successfully updated resource job (https://api.losant.com/#/definitions/resourceJob)
|
295
|
+
#
|
296
|
+
# Errors:
|
297
|
+
# * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
|
298
|
+
# * 404 - Error if resource job was not found (https://api.losant.com/#/definitions/error)
|
299
|
+
def patch(params = {})
|
300
|
+
params = Utils.symbolize_hash_keys(params)
|
301
|
+
query_params = { _actions: false, _links: true, _embedded: true }
|
302
|
+
headers = {}
|
303
|
+
body = nil
|
304
|
+
|
305
|
+
raise ArgumentError.new("applicationId is required") unless params.has_key?(:applicationId)
|
306
|
+
raise ArgumentError.new("resourceJobId is required") unless params.has_key?(:resourceJobId)
|
307
|
+
raise ArgumentError.new("resourceJob is required") unless params.has_key?(:resourceJob)
|
308
|
+
|
309
|
+
body = params[:resourceJob] if params.has_key?(:resourceJob)
|
310
|
+
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
311
|
+
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
312
|
+
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
313
|
+
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
314
|
+
|
315
|
+
path = "/applications/#{params[:applicationId]}/resource-jobs/#{params[:resourceJobId]}"
|
316
|
+
|
317
|
+
@client.request(
|
318
|
+
method: :patch,
|
319
|
+
path: path,
|
320
|
+
query: query_params,
|
321
|
+
headers: headers,
|
322
|
+
body: body)
|
323
|
+
end
|
324
|
+
|
325
|
+
end
|
326
|
+
end
|
@@ -0,0 +1,138 @@
|
|
1
|
+
# The MIT License (MIT)
|
2
|
+
#
|
3
|
+
# Copyright (c) 2022 Losant IoT, Inc.
|
4
|
+
#
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
# of this software and associated documentation files (the "Software"), to deal
|
7
|
+
# in the Software without restriction, including without limitation the rights
|
8
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
# copies of the Software, and to permit persons to whom the Software is
|
10
|
+
# furnished to do so, subject to the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be included in all
|
13
|
+
# copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
# SOFTWARE.
|
22
|
+
|
23
|
+
require "json"
|
24
|
+
|
25
|
+
module LosantRest
|
26
|
+
|
27
|
+
# Class containing all the actions for the Resource Jobs Resource
|
28
|
+
class ResourceJobs
|
29
|
+
|
30
|
+
def initialize(client)
|
31
|
+
@client = client
|
32
|
+
end
|
33
|
+
|
34
|
+
# Returns the resource jobs for an application
|
35
|
+
#
|
36
|
+
# Authentication:
|
37
|
+
# The client must be configured with a valid api
|
38
|
+
# access token to call this action. The token
|
39
|
+
# must include at least one of the following scopes:
|
40
|
+
# all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, resourceJobs.*, or resourceJobs.get.
|
41
|
+
#
|
42
|
+
# Parameters:
|
43
|
+
# * {string} applicationId - ID associated with the application
|
44
|
+
# * {string} sortField - Field to sort the results by. Accepted values are: name, id, creationDate, lastUpdated, lastExecutionRequested, resourceType
|
45
|
+
# * {string} sortDirection - Direction to sort the results by. Accepted values are: asc, desc
|
46
|
+
# * {string} page - Which page of results to return
|
47
|
+
# * {string} perPage - How many items to return per page
|
48
|
+
# * {string} filterField - Field to filter the results by. Blank or not provided means no filtering. Accepted values are: name, resourceType
|
49
|
+
# * {string} filter - Filter to apply against the filtered field. Supports globbing. Blank or not provided means no filtering.
|
50
|
+
# * {string} losantdomain - Domain scope of request (rarely needed)
|
51
|
+
# * {boolean} _actions - Return resource actions in response
|
52
|
+
# * {boolean} _links - Return resource link in response
|
53
|
+
# * {boolean} _embedded - Return embedded resources in response
|
54
|
+
#
|
55
|
+
# Responses:
|
56
|
+
# * 200 - Collection of resource jobs (https://api.losant.com/#/definitions/resourceJobs)
|
57
|
+
#
|
58
|
+
# Errors:
|
59
|
+
# * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
|
60
|
+
# * 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
|
61
|
+
def get(params = {})
|
62
|
+
params = Utils.symbolize_hash_keys(params)
|
63
|
+
query_params = { _actions: false, _links: true, _embedded: true }
|
64
|
+
headers = {}
|
65
|
+
body = nil
|
66
|
+
|
67
|
+
raise ArgumentError.new("applicationId is required") unless params.has_key?(:applicationId)
|
68
|
+
|
69
|
+
query_params[:sortField] = params[:sortField] if params.has_key?(:sortField)
|
70
|
+
query_params[:sortDirection] = params[:sortDirection] if params.has_key?(:sortDirection)
|
71
|
+
query_params[:page] = params[:page] if params.has_key?(:page)
|
72
|
+
query_params[:perPage] = params[:perPage] if params.has_key?(:perPage)
|
73
|
+
query_params[:filterField] = params[:filterField] if params.has_key?(:filterField)
|
74
|
+
query_params[:filter] = params[:filter] if params.has_key?(:filter)
|
75
|
+
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
76
|
+
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
77
|
+
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
78
|
+
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
79
|
+
|
80
|
+
path = "/applications/#{params[:applicationId]}/resource-jobs"
|
81
|
+
|
82
|
+
@client.request(
|
83
|
+
method: :get,
|
84
|
+
path: path,
|
85
|
+
query: query_params,
|
86
|
+
headers: headers,
|
87
|
+
body: body)
|
88
|
+
end
|
89
|
+
|
90
|
+
# Create a new resource job for an application
|
91
|
+
#
|
92
|
+
# Authentication:
|
93
|
+
# The client must be configured with a valid api
|
94
|
+
# access token to call this action. The token
|
95
|
+
# must include at least one of the following scopes:
|
96
|
+
# all.Application, all.Organization, all.User, resourceJobs.*, or resourceJobs.post.
|
97
|
+
#
|
98
|
+
# Parameters:
|
99
|
+
# * {string} applicationId - ID associated with the application
|
100
|
+
# * {hash} resourceJob - New resource job information (https://api.losant.com/#/definitions/resourceJobPost)
|
101
|
+
# * {string} losantdomain - Domain scope of request (rarely needed)
|
102
|
+
# * {boolean} _actions - Return resource actions in response
|
103
|
+
# * {boolean} _links - Return resource link in response
|
104
|
+
# * {boolean} _embedded - Return embedded resources in response
|
105
|
+
#
|
106
|
+
# Responses:
|
107
|
+
# * 201 - Successfully created resource job (https://api.losant.com/#/definitions/resourceJob)
|
108
|
+
#
|
109
|
+
# Errors:
|
110
|
+
# * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
|
111
|
+
# * 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
|
112
|
+
def post(params = {})
|
113
|
+
params = Utils.symbolize_hash_keys(params)
|
114
|
+
query_params = { _actions: false, _links: true, _embedded: true }
|
115
|
+
headers = {}
|
116
|
+
body = nil
|
117
|
+
|
118
|
+
raise ArgumentError.new("applicationId is required") unless params.has_key?(:applicationId)
|
119
|
+
raise ArgumentError.new("resourceJob is required") unless params.has_key?(:resourceJob)
|
120
|
+
|
121
|
+
body = params[:resourceJob] if params.has_key?(:resourceJob)
|
122
|
+
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
123
|
+
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
124
|
+
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
125
|
+
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
126
|
+
|
127
|
+
path = "/applications/#{params[:applicationId]}/resource-jobs"
|
128
|
+
|
129
|
+
@client.request(
|
130
|
+
method: :post,
|
131
|
+
path: path,
|
132
|
+
query: query_params,
|
133
|
+
headers: headers,
|
134
|
+
body: body)
|
135
|
+
end
|
136
|
+
|
137
|
+
end
|
138
|
+
end
|
data/lib/losant_rest/version.rb
CHANGED
data/lib/losant_rest.rb
CHANGED
@@ -102,6 +102,8 @@ require_relative "losant_rest/notebooks"
|
|
102
102
|
require_relative "losant_rest/org"
|
103
103
|
require_relative "losant_rest/org_invites"
|
104
104
|
require_relative "losant_rest/orgs"
|
105
|
+
require_relative "losant_rest/resource_job"
|
106
|
+
require_relative "losant_rest/resource_jobs"
|
105
107
|
require_relative "losant_rest/user_api_token"
|
106
108
|
require_relative "losant_rest/user_api_tokens"
|
107
109
|
require_relative "losant_rest/webhook"
|
data/schemas/apiTokenPost.json
CHANGED
@@ -79,6 +79,8 @@
|
|
79
79
|
"flows.*",
|
80
80
|
"flowVersion.*",
|
81
81
|
"flowVersions.*",
|
82
|
+
"resourceJobs.*",
|
83
|
+
"resourceJob.*",
|
82
84
|
"notebook.*",
|
83
85
|
"notebooks.*",
|
84
86
|
"webhook.*",
|
@@ -291,6 +293,14 @@
|
|
291
293
|
"notebook.upload",
|
292
294
|
"notebooks.get",
|
293
295
|
"notebooks.post",
|
296
|
+
"resourceJob.get",
|
297
|
+
"resourceJob.logs",
|
298
|
+
"resourceJob.patch",
|
299
|
+
"resourceJob.delete",
|
300
|
+
"resourceJob.execute",
|
301
|
+
"resourceJob.cancelExecution",
|
302
|
+
"resourceJobs.get",
|
303
|
+
"resourceJobs.post",
|
294
304
|
"webhook.delete",
|
295
305
|
"webhook.get",
|
296
306
|
"webhook.patch",
|
data/schemas/auditLog.json
CHANGED
data/schemas/auditLogFilter.json
CHANGED
data/schemas/auditLogs.json
CHANGED