/
sinks.clj
180 lines (156 loc) · 5.46 KB
/
sinks.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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
(ns happygapi.logging.sinks
"Cloud Logging API: sinks.
Writes log entries and manages your Cloud Logging configuration. The table entries below are presented in alphabetical order, not in order of common use. For explanations of the concepts found in the table entries, read the documentation at https://cloud.google.com/logging/docs.
See: https://cloud.google.com/logging/docs/api/reference/rest/v2/sinks"
(:require [cheshire.core :as json]
[clj-http.client :as http]
[happy.util :as util]))
(defn delete$
"https://cloud.google.com/logging/docs/api/reference/rest/v2/sinks/delete
Required parameters: sinkName
Optional parameters: none
Deletes a sink. If the sink has a unique writer_identity, then that service account is also deleted."
{:scopes ["https://www.googleapis.com/auth/cloud-platform"
"https://www.googleapis.com/auth/logging.admin"]}
[auth parameters]
{:pre [(util/has-keys? parameters #{:sinkName})]}
(util/get-response
(http/delete
(util/get-url
"https://logging.googleapis.com/"
"v2/{+sinkName}"
#{:sinkName}
parameters)
(merge-with
merge
{:throw-exceptions false,
:query-params parameters,
:accept :json,
:as :json}
auth))))
(defn list$
"https://cloud.google.com/logging/docs/api/reference/rest/v2/sinks/list
Required parameters: parent
Optional parameters: pageToken, pageSize
Lists sinks."
{:scopes ["https://www.googleapis.com/auth/cloud-platform"
"https://www.googleapis.com/auth/cloud-platform.read-only"
"https://www.googleapis.com/auth/logging.admin"
"https://www.googleapis.com/auth/logging.read"]}
[auth parameters]
{:pre [(util/has-keys? parameters #{:parent})]}
(util/get-response
(http/get
(util/get-url
"https://logging.googleapis.com/"
"v2/{+parent}/sinks"
#{:parent}
parameters)
(merge-with
merge
{:throw-exceptions false,
:query-params parameters,
:accept :json,
:as :json}
auth))))
(defn get$
"https://cloud.google.com/logging/docs/api/reference/rest/v2/sinks/get
Required parameters: sinkName
Optional parameters: none
Gets a sink."
{:scopes ["https://www.googleapis.com/auth/cloud-platform"
"https://www.googleapis.com/auth/cloud-platform.read-only"
"https://www.googleapis.com/auth/logging.admin"
"https://www.googleapis.com/auth/logging.read"]}
[auth parameters]
{:pre [(util/has-keys? parameters #{:sinkName})]}
(util/get-response
(http/get
(util/get-url
"https://logging.googleapis.com/"
"v2/{+sinkName}"
#{:sinkName}
parameters)
(merge-with
merge
{:throw-exceptions false,
:query-params parameters,
:accept :json,
:as :json}
auth))))
(defn update$
"https://cloud.google.com/logging/docs/api/reference/rest/v2/sinks/update
Required parameters: sinkName
Optional parameters: uniqueWriterIdentity, updateMask
Body:
{:description string,
:bigqueryOptions {:usesTimestampColumnPartitioning boolean,
:usePartitionedTables boolean},
:includeChildren boolean,
:disabled boolean,
:name string,
:createTime string,
:updateTime string,
:filter string,
:outputVersionFormat string,
:destination string,
:writerIdentity string}
Updates a sink. This method replaces the following fields in the existing sink with values from the new sink: destination, and filter.The updated sink might also have a new writer_identity; see the unique_writer_identity field."
{:scopes ["https://www.googleapis.com/auth/cloud-platform"
"https://www.googleapis.com/auth/logging.admin"]}
[auth parameters body]
{:pre [(util/has-keys? parameters #{:sinkName})]}
(util/get-response
(http/put
(util/get-url
"https://logging.googleapis.com/"
"v2/{+sinkName}"
#{:sinkName}
parameters)
(merge-with
merge
{:content-type :json,
:body (json/generate-string body),
:throw-exceptions false,
:query-params parameters,
:accept :json,
:as :json}
auth))))
(defn create$
"https://cloud.google.com/logging/docs/api/reference/rest/v2/sinks/create
Required parameters: parent
Optional parameters: uniqueWriterIdentity
Body:
{:description string,
:bigqueryOptions {:usesTimestampColumnPartitioning boolean,
:usePartitionedTables boolean},
:includeChildren boolean,
:disabled boolean,
:name string,
:createTime string,
:updateTime string,
:filter string,
:outputVersionFormat string,
:destination string,
:writerIdentity string}
Creates a sink that exports specified log entries to a destination. The export of newly-ingested log entries begins immediately, unless the sink's writer_identity is not permitted to write to the destination. A sink can export log entries only from the resource owning the sink."
{:scopes ["https://www.googleapis.com/auth/cloud-platform"
"https://www.googleapis.com/auth/logging.admin"]}
[auth parameters body]
{:pre [(util/has-keys? parameters #{:parent})]}
(util/get-response
(http/post
(util/get-url
"https://logging.googleapis.com/"
"v2/{+parent}/sinks"
#{:parent}
parameters)
(merge-with
merge
{:content-type :json,
:body (json/generate-string body),
:throw-exceptions false,
:query-params parameters,
:accept :json,
:as :json}
auth))))