/
operations.clj
62 lines (54 loc) · 1.92 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
(ns happygapi.sql.operations
"Cloud SQL Admin API: operations.
API for Cloud SQL database instance management
See: https://developers.google.com/cloud-sql/api/reference/rest/v1beta4/operations"
(:require [cheshire.core :as json]
[clj-http.client :as http]
[happy.util :as util]))
(defn get$
"https://developers.google.com/cloud-sql/api/reference/rest/v1beta4/operations/get
Required parameters: operation, project
Optional parameters: none
Retrieves an instance operation that has been performed on an instance."
{:scopes ["https://www.googleapis.com/auth/cloud-platform"
"https://www.googleapis.com/auth/sqlservice.admin"]}
[auth parameters]
{:pre [(util/has-keys? parameters #{:operation :project})]}
(util/get-response
(http/get
(util/get-url
"https://sqladmin.googleapis.com/"
"sql/v1beta4/projects/{project}/operations/{operation}"
#{:operation :project}
parameters)
(merge-with
merge
{:throw-exceptions false,
:query-params parameters,
:accept :json,
:as :json}
auth))))
(defn list$
"https://developers.google.com/cloud-sql/api/reference/rest/v1beta4/operations/list
Required parameters: project
Optional parameters: instance, pageToken, maxResults
Lists all instance operations that have been performed on the given Cloud
SQL instance in the reverse chronological order of the start time."
{:scopes ["https://www.googleapis.com/auth/cloud-platform"
"https://www.googleapis.com/auth/sqlservice.admin"]}
[auth parameters]
{:pre [(util/has-keys? parameters #{:project})]}
(util/get-response
(http/get
(util/get-url
"https://sqladmin.googleapis.com/"
"sql/v1beta4/projects/{project}/operations"
#{:project}
parameters)
(merge-with
merge
{:throw-exceptions false,
:query-params parameters,
:accept :json,
:as :json}
auth))))