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
|
# File 'lib/vkit/cli/commands/request_command.rb', line 11
def call(aql_str, options)
with_auth do
user = credential_store.user
org = user["organization_slug"]
aql =
if aql_str&.strip&.length&.positive?
JSON.parse(aql_str)
else
JSON.parse(STDIN.read)
end
response = authenticated_client.post(
"/api/v1/orgs/#{org}/requests",
body: {
aql: aql,
options: {
environment: options[:env],
requester_region: options[:requester_region],
dataset_region: options[:dataset_region],
requester_clearance: options[:requester_clearance],
datasource: options[:datasource]
}.compact
}
)
handle_result(response, options)
end
rescue JSON::ParserError
raise "Invalid JSON AQL"
end
|