-
Notifications
You must be signed in to change notification settings - Fork 4
/
organizations.clj
588 lines (513 loc) · 17.9 KB
/
organizations.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
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
(ns happygapi.logging.organizations
"Stackdriver Logging API: organizations.
Writes log entries and manages your Stackdriver 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 <a href=https://cloud.google.com/logging/docs>Stackdriver Logging documentation</a>.
See: https://cloud.google.com/logging/docs/api/reference/rest/v2/organizations"
(:require [cheshire.core :as json]
[clj-http.client :as http]
[happy.util :as util]))
(defn getCmekSettings$
"https://cloud.google.com/logging/docs/api/reference/rest/v2/organizations/getCmekSettings
Required parameters: name
Optional parameters: none
Gets the Logs Router CMEK settings for the given resource.Note: CMEK for the Logs Router can currently only be configured for GCP organizations. Once configured, it applies to all projects and folders in the GCP organization.See Enabling CMEK for Logs Router for more information."
{: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 args]
{:pre [(util/has-keys? args #{:name})]}
(util/get-response
(http/get
(util/get-url
"https://logging.googleapis.com/"
"v2/{+name}/cmekSettings"
#{:name}
args)
(merge-with
merge
{:throw-exceptions false,
:query-params args,
:accept :json,
:as :json}
auth))))
(defn updateCmekSettings$
"https://cloud.google.com/logging/docs/api/reference/rest/v2/organizations/updateCmekSettings
Required parameters: name
Optional parameters: updateMask
Body:
{:kmsKeyName string, :name string, :serviceAccountId string}
Updates the Logs Router CMEK settings for the given resource.Note: CMEK for the Logs Router can currently only be configured for GCP organizations. Once configured, it applies to all projects and folders in the GCP organization.UpdateCmekSettings will fail if 1) kms_key_name is invalid, or 2) the associated service account does not have the required roles/cloudkms.cryptoKeyEncrypterDecrypter role assigned for the key, or 3) access to the key is disabled.See Enabling CMEK for Logs Router for more information."
{:scopes ["https://www.googleapis.com/auth/cloud-platform"
"https://www.googleapis.com/auth/logging.admin"]}
[auth args body]
{:pre [(util/has-keys? args #{:name})]}
(util/get-response
(http/patch
(util/get-url
"https://logging.googleapis.com/"
"v2/{+name}/cmekSettings"
#{:name}
args)
(merge-with
merge
{:content-type :json,
:body (json/generate-string body),
:throw-exceptions false,
:query-params args,
:accept :json,
:as :json}
auth))))
(defn exclusions-delete$
"https://cloud.google.com/logging/docs/api/reference/rest/v2/organizations/exclusions/delete
Required parameters: name
Optional parameters: none
Deletes an exclusion."
{:scopes ["https://www.googleapis.com/auth/cloud-platform"
"https://www.googleapis.com/auth/logging.admin"]}
[auth args]
{:pre [(util/has-keys? args #{:name})]}
(util/get-response
(http/delete
(util/get-url
"https://logging.googleapis.com/"
"v2/{+name}"
#{:name}
args)
(merge-with
merge
{:throw-exceptions false,
:query-params args,
:accept :json,
:as :json}
auth))))
(defn exclusions-list$
"https://cloud.google.com/logging/docs/api/reference/rest/v2/organizations/exclusions/list
Required parameters: parent
Optional parameters: pageToken, pageSize
Lists all the exclusions in a parent resource."
{: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 args]
{:pre [(util/has-keys? args #{:parent})]}
(util/get-response
(http/get
(util/get-url
"https://logging.googleapis.com/"
"v2/{+parent}/exclusions"
#{:parent}
args)
(merge-with
merge
{:throw-exceptions false,
:query-params args,
:accept :json,
:as :json}
auth))))
(defn exclusions-get$
"https://cloud.google.com/logging/docs/api/reference/rest/v2/organizations/exclusions/get
Required parameters: name
Optional parameters: none
Gets the description of an exclusion."
{: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 args]
{:pre [(util/has-keys? args #{:name})]}
(util/get-response
(http/get
(util/get-url
"https://logging.googleapis.com/"
"v2/{+name}"
#{:name}
args)
(merge-with
merge
{:throw-exceptions false,
:query-params args,
:accept :json,
:as :json}
auth))))
(defn exclusions-patch$
"https://cloud.google.com/logging/docs/api/reference/rest/v2/organizations/exclusions/patch
Required parameters: name
Optional parameters: updateMask
Body:
{:disabled boolean,
:createTime string,
:updateTime string,
:name string,
:filter string,
:description string}
Changes one or more properties of an existing exclusion."
{:scopes ["https://www.googleapis.com/auth/cloud-platform"
"https://www.googleapis.com/auth/logging.admin"]}
[auth args body]
{:pre [(util/has-keys? args #{:name})]}
(util/get-response
(http/patch
(util/get-url
"https://logging.googleapis.com/"
"v2/{+name}"
#{:name}
args)
(merge-with
merge
{:content-type :json,
:body (json/generate-string body),
:throw-exceptions false,
:query-params args,
:accept :json,
:as :json}
auth))))
(defn exclusions-create$
"https://cloud.google.com/logging/docs/api/reference/rest/v2/organizations/exclusions/create
Required parameters: parent
Optional parameters: none
Body:
{:disabled boolean,
:createTime string,
:updateTime string,
:name string,
:filter string,
:description string}
Creates a new exclusion in a specified parent resource. Only log entries belonging to that resource can be excluded. You can have up to 10 exclusions in a resource."
{:scopes ["https://www.googleapis.com/auth/cloud-platform"
"https://www.googleapis.com/auth/logging.admin"]}
[auth args body]
{:pre [(util/has-keys? args #{:parent})]}
(util/get-response
(http/post
(util/get-url
"https://logging.googleapis.com/"
"v2/{+parent}/exclusions"
#{:parent}
args)
(merge-with
merge
{:content-type :json,
:body (json/generate-string body),
:throw-exceptions false,
:query-params args,
:accept :json,
:as :json}
auth))))
(defn locations-buckets-list$
"https://cloud.google.com/logging/docs/api/reference/rest/v2/organizations/locations/buckets/list
Required parameters: parent
Optional parameters: pageToken, pageSize
Lists buckets (Beta)."
{: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 args]
{:pre [(util/has-keys? args #{:parent})]}
(util/get-response
(http/get
(util/get-url
"https://logging.googleapis.com/"
"v2/{+parent}/buckets"
#{:parent}
args)
(merge-with
merge
{:throw-exceptions false,
:query-params args,
:accept :json,
:as :json}
auth))))
(defn locations-buckets-get$
"https://cloud.google.com/logging/docs/api/reference/rest/v2/organizations/locations/buckets/get
Required parameters: name
Optional parameters: none
Gets a bucket (Beta)."
{: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 args]
{:pre [(util/has-keys? args #{:name})]}
(util/get-response
(http/get
(util/get-url
"https://logging.googleapis.com/"
"v2/{+name}"
#{:name}
args)
(merge-with
merge
{:throw-exceptions false,
:query-params args,
:accept :json,
:as :json}
auth))))
(defn locations-buckets-patch$
"https://cloud.google.com/logging/docs/api/reference/rest/v2/organizations/locations/buckets/patch
Required parameters: name
Optional parameters: updateMask
Body:
{:createTime string,
:updateTime string,
:name string,
:retentionDays integer,
:lifecycleState string,
:description string}
Updates a bucket. This method replaces the following fields in the existing bucket with values from the new bucket: retention_periodIf the retention period is decreased and the bucket is locked, FAILED_PRECONDITION will be returned.If the bucket has a LifecycleState of DELETE_REQUESTED, FAILED_PRECONDITION will be returned.A buckets region may not be modified after it is created. This method is in Beta."
{:scopes ["https://www.googleapis.com/auth/cloud-platform"
"https://www.googleapis.com/auth/logging.admin"]}
[auth args body]
{:pre [(util/has-keys? args #{:name})]}
(util/get-response
(http/patch
(util/get-url
"https://logging.googleapis.com/"
"v2/{+name}"
#{:name}
args)
(merge-with
merge
{:content-type :json,
:body (json/generate-string body),
:throw-exceptions false,
:query-params args,
:accept :json,
:as :json}
auth))))
(defn sinks-create$
"https://cloud.google.com/logging/docs/api/reference/rest/v2/organizations/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 args body]
{:pre [(util/has-keys? args #{:parent})]}
(util/get-response
(http/post
(util/get-url
"https://logging.googleapis.com/"
"v2/{+parent}/sinks"
#{:parent}
args)
(merge-with
merge
{:content-type :json,
:body (json/generate-string body),
:throw-exceptions false,
:query-params args,
:accept :json,
:as :json}
auth))))
(defn sinks-get$
"https://cloud.google.com/logging/docs/api/reference/rest/v2/organizations/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 args]
{:pre [(util/has-keys? args #{:sinkName})]}
(util/get-response
(http/get
(util/get-url
"https://logging.googleapis.com/"
"v2/{+sinkName}"
#{:sinkName}
args)
(merge-with
merge
{:throw-exceptions false,
:query-params args,
:accept :json,
:as :json}
auth))))
(defn sinks-patch$
"https://cloud.google.com/logging/docs/api/reference/rest/v2/organizations/sinks/patch
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 args body]
{:pre [(util/has-keys? args #{:sinkName})]}
(util/get-response
(http/patch
(util/get-url
"https://logging.googleapis.com/"
"v2/{+sinkName}"
#{:sinkName}
args)
(merge-with
merge
{:content-type :json,
:body (json/generate-string body),
:throw-exceptions false,
:query-params args,
:accept :json,
:as :json}
auth))))
(defn sinks-update$
"https://cloud.google.com/logging/docs/api/reference/rest/v2/organizations/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 args body]
{:pre [(util/has-keys? args #{:sinkName})]}
(util/get-response
(http/put
(util/get-url
"https://logging.googleapis.com/"
"v2/{+sinkName}"
#{:sinkName}
args)
(merge-with
merge
{:content-type :json,
:body (json/generate-string body),
:throw-exceptions false,
:query-params args,
:accept :json,
:as :json}
auth))))
(defn sinks-delete$
"https://cloud.google.com/logging/docs/api/reference/rest/v2/organizations/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 args]
{:pre [(util/has-keys? args #{:sinkName})]}
(util/get-response
(http/delete
(util/get-url
"https://logging.googleapis.com/"
"v2/{+sinkName}"
#{:sinkName}
args)
(merge-with
merge
{:throw-exceptions false,
:query-params args,
:accept :json,
:as :json}
auth))))
(defn sinks-list$
"https://cloud.google.com/logging/docs/api/reference/rest/v2/organizations/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 args]
{:pre [(util/has-keys? args #{:parent})]}
(util/get-response
(http/get
(util/get-url
"https://logging.googleapis.com/"
"v2/{+parent}/sinks"
#{:parent}
args)
(merge-with
merge
{:throw-exceptions false,
:query-params args,
:accept :json,
:as :json}
auth))))
(defn logs-delete$
"https://cloud.google.com/logging/docs/api/reference/rest/v2/organizations/logs/delete
Required parameters: logName
Optional parameters: none
Deletes all the log entries in a log. The log reappears if it receives new entries. Log entries written shortly before the delete operation might not be deleted. Entries received after the delete operation with a timestamp before the operation will be deleted."
{:scopes ["https://www.googleapis.com/auth/cloud-platform"
"https://www.googleapis.com/auth/logging.admin"]}
[auth args]
{:pre [(util/has-keys? args #{:logName})]}
(util/get-response
(http/delete
(util/get-url
"https://logging.googleapis.com/"
"v2/{+logName}"
#{:logName}
args)
(merge-with
merge
{:throw-exceptions false,
:query-params args,
:accept :json,
:as :json}
auth))))
(defn logs-list$
"https://cloud.google.com/logging/docs/api/reference/rest/v2/organizations/logs/list
Required parameters: parent
Optional parameters: pageToken, pageSize
Lists the logs in projects, organizations, folders, or billing accounts. Only logs that have entries are listed."
{: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 args]
{:pre [(util/has-keys? args #{:parent})]}
(util/get-response
(http/get
(util/get-url
"https://logging.googleapis.com/"
"v2/{+parent}/logs"
#{:parent}
args)
(merge-with
merge
{:throw-exceptions false,
:query-params args,
:accept :json,
:as :json}
auth))))