-
Notifications
You must be signed in to change notification settings - Fork 4
/
entries.clj
102 lines (90 loc) · 3.48 KB
/
entries.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
(ns happygapi.logging.entries
"Stackdriver Logging API: entries.
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/entries"
(:require [cheshire.core :as json]
[clj-http.client :as http]
[happy.util :as util]))
(defn list$
"https://cloud.google.com/logging/docs/api/reference/rest/v2/entries/list
Required parameters: none
Optional parameters: none
Body:
{:orderBy string,
:resourceNames [string],
:projectIds [string],
:filter string,
:pageToken string,
:pageSize integer}
Lists log entries. Use this method to retrieve log entries that originated from a project/folder/organization/billing account. For ways to export log entries, see Exporting Logs."
{: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 body]
{:pre [(util/has-keys? args #{})]}
(util/get-response
(http/post
(util/get-url
"https://logging.googleapis.com/"
"v2/entries:list"
#{}
args)
(merge-with
merge
{:content-type :json,
:body (json/generate-string body),
:throw-exceptions false,
:query-params args,
:accept :json,
:as :json}
auth))))
(defn write$
"https://cloud.google.com/logging/docs/api/reference/rest/v2/entries/write
Required parameters: none
Optional parameters: none
Body:
{:logName string,
:entries [{:traceSampled boolean,
:jsonPayload {},
:labels {},
:spanId string,
:receiveTimestamp string,
:trace string,
:operation LogEntryOperation,
:logName string,
:textPayload string,
:sourceLocation LogEntrySourceLocation,
:resource MonitoredResource,
:severity string,
:insertId string,
:httpRequest HttpRequest,
:protoPayload {},
:timestamp string,
:metadata MonitoredResourceMetadata}],
:partialSuccess boolean,
:dryRun boolean,
:labels {},
:resource {:type string, :labels {}}}
Writes log entries to Logging. This API method is the only way to send log entries to Logging. This method is used, directly or indirectly, by the Logging agent (fluentd) and all logging libraries configured to use Logging. A single request may contain log entries for a maximum of 1000 different resources (projects, organizations, billing accounts or folders)"
{:scopes ["https://www.googleapis.com/auth/cloud-platform"
"https://www.googleapis.com/auth/logging.admin"
"https://www.googleapis.com/auth/logging.write"]}
[auth args body]
{:pre [(util/has-keys? args #{})]}
(util/get-response
(http/post
(util/get-url
"https://logging.googleapis.com/"
"v2/entries:write"
#{}
args)
(merge-with
merge
{:content-type :json,
:body (json/generate-string body),
:throw-exceptions false,
:query-params args,
:accept :json,
:as :json}
auth))))