-
Notifications
You must be signed in to change notification settings - Fork 4
/
operations.clj
68 lines (61 loc) · 2.19 KB
/
operations.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
(ns happygapi.cloudfunctions.operations
"Cloud Functions API: operations.
Manages lightweight user-provided functions executed in response to events.
See: https://cloud.google.com/functionsapi/reference/rest/v1/operations"
(:require [cheshire.core :as json]
[clj-http.client :as http]
[happy.util :as util]))
(defn list$
"https://cloud.google.com/functionsapi/reference/rest/v1/operations/list
Required parameters: none
Optional parameters: filter, name, pageToken, pageSize
Lists operations that match the specified filter in the request. If the
server doesn't support this method, it returns `UNIMPLEMENTED`.
NOTE: the `name` binding allows API services to override the binding
to use different resource name schemes, such as `users/*/operations`. To
override the binding, API services can add a binding such as
`\"/v1/{name=users/*}/operations\"` to their service configuration.
For backwards compatibility, the default name includes the operations
collection id, however overriding users must ensure the name binding
is the parent resource, without the operations collection id."
{:scopes ["https://www.googleapis.com/auth/cloud-platform"]}
[auth args]
{:pre [(util/has-keys? args #{})]}
(util/get-response
(http/get
(util/get-url
"https://cloudfunctions.googleapis.com/"
"v1/operations"
#{}
args)
(merge-with
merge
{:throw-exceptions false,
:query-params args,
:accept :json,
:as :json}
auth))))
(defn get$
"https://cloud.google.com/functionsapi/reference/rest/v1/operations/get
Required parameters: name
Optional parameters: none
Gets the latest state of a long-running operation. Clients can use this
method to poll the operation result at intervals as recommended by the API
service."
{:scopes ["https://www.googleapis.com/auth/cloud-platform"]}
[auth args]
{:pre [(util/has-keys? args #{:name})]}
(util/get-response
(http/get
(util/get-url
"https://cloudfunctions.googleapis.com/"
"v1/{+name}"
#{:name}
args)
(merge-with
merge
{:throw-exceptions false,
:query-params args,
:accept :json,
:as :json}
auth))))