-
Notifications
You must be signed in to change notification settings - Fork 4
/
billingAccounts.clj
175 lines (151 loc) · 5.44 KB
/
billingAccounts.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
(ns happygapi.billingbudgets.billingAccounts
"Cloud Billing Budget API: billingAccounts.
The Cloud Billing Budget API stores Cloud Billing budgets, which define a budget plan and the rules to execute as spend is tracked against that plan.
See: https://cloud.google.com/billing/docs/how-to/budget-api-overviewapi/reference/rest/v1beta1/billingAccounts"
(:require [cheshire.core :as json]
[clj-http.client :as http]
[happy.util :as util]))
(defn budgets-delete$
"https://cloud.google.com/billing/docs/how-to/budget-api-overviewapi/reference/rest/v1beta1/billingAccounts/budgets/delete
Required parameters: name
Optional parameters: none
Deletes a budget. Returns successfully if already deleted."
{:scopes ["https://www.googleapis.com/auth/cloud-platform"]}
[auth args]
{:pre [(util/has-keys? args #{:name})]}
(util/get-response
(http/delete
(util/get-url
"https://billingbudgets.googleapis.com/"
"v1beta1/{+name}"
#{:name}
args)
(merge-with
merge
{:throw-exceptions false,
:query-params args,
:accept :json,
:as :json}
auth))))
(defn budgets-patch$
"https://cloud.google.com/billing/docs/how-to/budget-api-overviewapi/reference/rest/v1beta1/billingAccounts/budgets/patch
Required parameters: name
Optional parameters: none
Body:
{:updateMask string,
:budget {:allUpdatesRule GoogleCloudBillingBudgetsV1beta1AllUpdatesRule,
:displayName string,
:etag string,
:thresholdRules [GoogleCloudBillingBudgetsV1beta1ThresholdRule],
:name string,
:amount GoogleCloudBillingBudgetsV1beta1BudgetAmount,
:budgetFilter GoogleCloudBillingBudgetsV1beta1Filter}}
Updates a budget and returns the updated budget.
WARNING: There are some fields exposed on the Google Cloud Console that
aren’t available on this API. Budget fields that are not exposed in
this API will not be changed by this method."
{:scopes ["https://www.googleapis.com/auth/cloud-platform"]}
[auth args body]
{:pre [(util/has-keys? args #{:name})]}
(util/get-response
(http/patch
(util/get-url
"https://billingbudgets.googleapis.com/"
"v1beta1/{+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 budgets-get$
"https://cloud.google.com/billing/docs/how-to/budget-api-overviewapi/reference/rest/v1beta1/billingAccounts/budgets/get
Required parameters: name
Optional parameters: none
Returns a budget.
WARNING: There are some fields exposed on the Google Cloud Console that
aren’t available on this API. When reading from the API, you will not
see these fields in the return value, though they may have been set
in the cloud console."
{: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://billingbudgets.googleapis.com/"
"v1beta1/{+name}"
#{:name}
args)
(merge-with
merge
{:throw-exceptions false,
:query-params args,
:accept :json,
:as :json}
auth))))
(defn budgets-list$
"https://cloud.google.com/billing/docs/how-to/budget-api-overviewapi/reference/rest/v1beta1/billingAccounts/budgets/list
Required parameters: parent
Optional parameters: pageToken, pageSize
Returns a list of budgets for a billing account.
WARNING: There are some fields exposed on the Google Cloud Console that
aren’t available on this API. When reading from the API, you will not
see these fields in the return value, though they may have been set
in the cloud console."
{:scopes ["https://www.googleapis.com/auth/cloud-platform"]}
[auth args]
{:pre [(util/has-keys? args #{:parent})]}
(util/get-response
(http/get
(util/get-url
"https://billingbudgets.googleapis.com/"
"v1beta1/{+parent}/budgets"
#{:parent}
args)
(merge-with
merge
{:throw-exceptions false,
:query-params args,
:accept :json,
:as :json}
auth))))
(defn budgets-create$
"https://cloud.google.com/billing/docs/how-to/budget-api-overviewapi/reference/rest/v1beta1/billingAccounts/budgets/create
Required parameters: parent
Optional parameters: none
Body:
{:budget {:allUpdatesRule GoogleCloudBillingBudgetsV1beta1AllUpdatesRule,
:displayName string,
:etag string,
:thresholdRules [GoogleCloudBillingBudgetsV1beta1ThresholdRule],
:name string,
:amount GoogleCloudBillingBudgetsV1beta1BudgetAmount,
:budgetFilter GoogleCloudBillingBudgetsV1beta1Filter}}
Creates a new budget. See
<a href=\"https://cloud.google.com/billing/quotas\">Quotas and limits</a>
for more information on the limits of the number of budgets you can create."
{:scopes ["https://www.googleapis.com/auth/cloud-platform"]}
[auth args body]
{:pre [(util/has-keys? args #{:parent})]}
(util/get-response
(http/post
(util/get-url
"https://billingbudgets.googleapis.com/"
"v1beta1/{+parent}/budgets"
#{:parent}
args)
(merge-with
merge
{:content-type :json,
:body (json/generate-string body),
:throw-exceptions false,
:query-params args,
:accept :json,
:as :json}
auth))))