Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(110)

Side by Side Diff: generated/googleapis/lib/cloudbilling/v1.dart

Issue 1296863002: Api-roll 22: 2015-08-17 (Closed) Base URL: git@github.com:dart-lang/googleapis.git@master
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // This is a generated file (see the discoveryapis_generator project).
2
3 library googleapis.cloudbilling.v1;
4
5 import 'dart:core' as core;
6 import 'dart:async' as async;
7 import 'dart:convert' as convert;
8
9 import 'package:_discoveryapis_commons/_discoveryapis_commons.dart' as commons;
10 import 'package:http/http.dart' as http;
11
12 export 'package:_discoveryapis_commons/_discoveryapis_commons.dart' show
13 ApiRequestError, DetailedApiRequestError;
14
15 const core.String USER_AGENT = 'dart-api-client cloudbilling/v1';
16
17 class CloudbillingApi {
18 /** View and manage your data across Google Cloud Platform services */
19 static const CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platf orm";
20
21
22 final commons.ApiRequester _requester;
23
24 BillingAccountsResourceApi get billingAccounts => new BillingAccountsResourceA pi(_requester);
25 ProjectsResourceApi get projects => new ProjectsResourceApi(_requester);
26
27 CloudbillingApi(http.Client client, {core.String rootUrl: "https://cloudbillin g.googleapis.com/", core.String servicePath: ""}) :
28 _requester = new commons.ApiRequester(client, rootUrl, servicePath, USER_A GENT);
29 }
30
31
32 class BillingAccountsResourceApi {
33 final commons.ApiRequester _requester;
34
35 BillingAccountsProjectsResourceApi get projects => new BillingAccountsProjects ResourceApi(_requester);
36
37 BillingAccountsResourceApi(commons.ApiRequester client) :
38 _requester = client;
39
40 /**
41 * Gets information about a billing account. The current authenticated user
42 * must be an [owner of the billing
43 * account](https://support.google.com/cloud/answer/4430947).
44 *
45 * Request parameters:
46 *
47 * [name] - The resource name of the billing account to retrieve. For example,
48 * `billingAccounts/012345-567890-ABCDEF`.
49 * Value must have pattern "^billingAccounts/[^/]*$".
50 *
51 * Completes with a [BillingAccount].
52 *
53 * Completes with a [commons.ApiRequestError] if the API endpoint returned an
54 * error.
55 *
56 * If the used [http.Client] completes with an error when making a REST call,
57 * this method will complete with the same error.
58 */
59 async.Future<BillingAccount> get(core.String name) {
60 var _url = null;
61 var _queryParams = new core.Map();
62 var _uploadMedia = null;
63 var _uploadOptions = null;
64 var _downloadOptions = commons.DownloadOptions.Metadata;
65 var _body = null;
66
67 if (name == null) {
68 throw new core.ArgumentError("Parameter name is required.");
69 }
70
71 _url = 'v1/' + commons.Escaper.ecapeVariableReserved('$name');
72
73 var _response = _requester.request(_url,
74 "GET",
75 body: _body,
76 queryParams: _queryParams,
77 uploadOptions: _uploadOptions,
78 uploadMedia: _uploadMedia,
79 downloadOptions: _downloadOptions);
80 return _response.then((data) => new BillingAccount.fromJson(data));
81 }
82
83 /**
84 * Lists the billing accounts that the current authenticated user
85 * [owns](https://support.google.com/cloud/answer/4430947).
86 *
87 * Request parameters:
88 *
89 * [pageSize] - Requested page size. The maximum page size is 100; this is
90 * also the default.
91 *
92 * [pageToken] - A token identifying a page of results to return. This should
93 * be a `next_page_token` value returned from a previous `ListBillingAccounts`
94 * call. If unspecified, the first page of results is returned.
95 *
96 * Completes with a [ListBillingAccountsResponse].
97 *
98 * Completes with a [commons.ApiRequestError] if the API endpoint returned an
99 * error.
100 *
101 * If the used [http.Client] completes with an error when making a REST call,
102 * this method will complete with the same error.
103 */
104 async.Future<ListBillingAccountsResponse> list({core.int pageSize, core.String pageToken}) {
105 var _url = null;
106 var _queryParams = new core.Map();
107 var _uploadMedia = null;
108 var _uploadOptions = null;
109 var _downloadOptions = commons.DownloadOptions.Metadata;
110 var _body = null;
111
112 if (pageSize != null) {
113 _queryParams["pageSize"] = ["${pageSize}"];
114 }
115 if (pageToken != null) {
116 _queryParams["pageToken"] = [pageToken];
117 }
118
119 _url = 'v1/billingAccounts';
120
121 var _response = _requester.request(_url,
122 "GET",
123 body: _body,
124 queryParams: _queryParams,
125 uploadOptions: _uploadOptions,
126 uploadMedia: _uploadMedia,
127 downloadOptions: _downloadOptions);
128 return _response.then((data) => new ListBillingAccountsResponse.fromJson(dat a));
129 }
130
131 }
132
133
134 class BillingAccountsProjectsResourceApi {
135 final commons.ApiRequester _requester;
136
137 BillingAccountsProjectsResourceApi(commons.ApiRequester client) :
138 _requester = client;
139
140 /**
141 * Lists the projects associated with a billing account. The current
142 * authenticated user must be an [owner of the billing
143 * account](https://support.google.com/cloud/answer/4430947).
144 *
145 * Request parameters:
146 *
147 * [name] - The resource name of the billing account associated with the
148 * projects that you want to list. For example,
149 * `billingAccounts/012345-567890-ABCDEF`.
150 * Value must have pattern "^billingAccounts/[^/]*$".
151 *
152 * [pageSize] - Requested page size. The maximum page size is 100; this is
153 * also the default.
154 *
155 * [pageToken] - A token identifying a page of results to be returned. This
156 * should be a `next_page_token` value returned from a previous
157 * `ListProjectBillingInfo` call. If unspecified, the first page of results is
158 * returned.
159 *
160 * Completes with a [ListProjectBillingInfoResponse].
161 *
162 * Completes with a [commons.ApiRequestError] if the API endpoint returned an
163 * error.
164 *
165 * If the used [http.Client] completes with an error when making a REST call,
166 * this method will complete with the same error.
167 */
168 async.Future<ListProjectBillingInfoResponse> list(core.String name, {core.int pageSize, core.String pageToken}) {
169 var _url = null;
170 var _queryParams = new core.Map();
171 var _uploadMedia = null;
172 var _uploadOptions = null;
173 var _downloadOptions = commons.DownloadOptions.Metadata;
174 var _body = null;
175
176 if (name == null) {
177 throw new core.ArgumentError("Parameter name is required.");
178 }
179 if (pageSize != null) {
180 _queryParams["pageSize"] = ["${pageSize}"];
181 }
182 if (pageToken != null) {
183 _queryParams["pageToken"] = [pageToken];
184 }
185
186 _url = 'v1/' + commons.Escaper.ecapeVariableReserved('$name') + '/projects';
187
188 var _response = _requester.request(_url,
189 "GET",
190 body: _body,
191 queryParams: _queryParams,
192 uploadOptions: _uploadOptions,
193 uploadMedia: _uploadMedia,
194 downloadOptions: _downloadOptions);
195 return _response.then((data) => new ListProjectBillingInfoResponse.fromJson( data));
196 }
197
198 }
199
200
201 class ProjectsResourceApi {
202 final commons.ApiRequester _requester;
203
204 ProjectsResourceApi(commons.ApiRequester client) :
205 _requester = client;
206
207 /**
208 * Gets the billing information for a project. The current authenticated user
209 * must have [permission to view the
210 * project](https://cloud.google.com/docs/permissions-overview#h.bgs0oxofvnoo
211 * ).
212 *
213 * Request parameters:
214 *
215 * [name] - The resource name of the project for which billing information is
216 * retrieved. For example, `projects/tokyo-rain-123`.
217 * Value must have pattern "^projects/[^/]*$".
218 *
219 * Completes with a [ProjectBillingInfo].
220 *
221 * Completes with a [commons.ApiRequestError] if the API endpoint returned an
222 * error.
223 *
224 * If the used [http.Client] completes with an error when making a REST call,
225 * this method will complete with the same error.
226 */
227 async.Future<ProjectBillingInfo> getBillingInfo(core.String name) {
228 var _url = null;
229 var _queryParams = new core.Map();
230 var _uploadMedia = null;
231 var _uploadOptions = null;
232 var _downloadOptions = commons.DownloadOptions.Metadata;
233 var _body = null;
234
235 if (name == null) {
236 throw new core.ArgumentError("Parameter name is required.");
237 }
238
239 _url = 'v1/' + commons.Escaper.ecapeVariableReserved('$name') + '/billingInf o';
240
241 var _response = _requester.request(_url,
242 "GET",
243 body: _body,
244 queryParams: _queryParams,
245 uploadOptions: _uploadOptions,
246 uploadMedia: _uploadMedia,
247 downloadOptions: _downloadOptions);
248 return _response.then((data) => new ProjectBillingInfo.fromJson(data));
249 }
250
251 /**
252 * Sets or updates the billing account associated with a project. You specify
253 * the new billing account by setting the `billing_account_name` in the
254 * `ProjectBillingInfo` resource to the resource name of a billing account.
255 * Associating a project with an open billing account enables billing on the
256 * project and allows charges for resource usage. If the project already had a
257 * billing account, this method changes the billing account used for resource
258 * usage charges. *Note:* Incurred charges that have not yet been reported in
259 * the transaction history of the Google Developers Console may be billed to
260 * the new billing account, even if the charge occurred before the new billing
261 * account was assigned to the project. The current authenticated user must
262 * have ownership privileges for both the
263 * [project](https://cloud.google.com/docs/permissions-overview#h.bgs0oxofvnoo
264 * ) and the [billing
265 * account](https://support.google.com/cloud/answer/4430947). You can disable
266 * billing on the project by setting the `billing_account_name` field to
267 * empty. This action disassociates the current billing account from the
268 * project. Any billable activity of your in-use services will stop, and your
269 * application could stop functioning as expected. Any unbilled charges to
270 * date will be billed to the previously associated account. The current
271 * authenticated user must be either an owner of the project or an owner of
272 * the billing account for the project. Note that associating a project with a
273 * *closed* billing account will have much the same effect as disabling
274 * billing on the project: any paid resources used by the project will be shut
275 * down. Thus, unless you wish to disable billing, you should always call this
276 * method with the name of an *open* billing account.
277 *
278 * [request] - The metadata request object.
279 *
280 * Request parameters:
281 *
282 * [name] - The resource name of the project associated with the billing
283 * information that you want to update. For example,
284 * `projects/tokyo-rain-123`.
285 * Value must have pattern "^projects/[^/]*$".
286 *
287 * Completes with a [ProjectBillingInfo].
288 *
289 * Completes with a [commons.ApiRequestError] if the API endpoint returned an
290 * error.
291 *
292 * If the used [http.Client] completes with an error when making a REST call,
293 * this method will complete with the same error.
294 */
295 async.Future<ProjectBillingInfo> updateBillingInfo(ProjectBillingInfo request, core.String name) {
296 var _url = null;
297 var _queryParams = new core.Map();
298 var _uploadMedia = null;
299 var _uploadOptions = null;
300 var _downloadOptions = commons.DownloadOptions.Metadata;
301 var _body = null;
302
303 if (request != null) {
304 _body = convert.JSON.encode((request).toJson());
305 }
306 if (name == null) {
307 throw new core.ArgumentError("Parameter name is required.");
308 }
309
310 _url = 'v1/' + commons.Escaper.ecapeVariableReserved('$name') + '/billingInf o';
311
312 var _response = _requester.request(_url,
313 "PUT",
314 body: _body,
315 queryParams: _queryParams,
316 uploadOptions: _uploadOptions,
317 uploadMedia: _uploadMedia,
318 downloadOptions: _downloadOptions);
319 return _response.then((data) => new ProjectBillingInfo.fromJson(data));
320 }
321
322 }
323
324
325
326 /**
327 * A billing account in [Google Developers
328 * Console](https://console.developers.google.com/). You can assign a billing
329 * account to one or more projects.
330 */
331 class BillingAccount {
332 /**
333 * The display name given to the billing account, such as `My Billing
334 * Account`. This name is displayed in the Google Developers Console.
335 */
336 core.String displayName;
337 /**
338 * The resource name of the billing account. The resource name has the form
339 * `billingAccounts/{billing_account_id}`. For example,
340 * `billingAccounts/012345-567890-ABCDEF` would be the resource name for
341 * billing account `012345-567890-ABCDEF`.
342 */
343 core.String name;
344 /**
345 * True if the billing account is open, and will therefore be charged for any
346 * usage on associated projects. False if the billing account is closed, and
347 * therefore projects associated with it will be unable to use paid services.
348 */
349 core.bool open;
350
351 BillingAccount();
352
353 BillingAccount.fromJson(core.Map _json) {
354 if (_json.containsKey("displayName")) {
355 displayName = _json["displayName"];
356 }
357 if (_json.containsKey("name")) {
358 name = _json["name"];
359 }
360 if (_json.containsKey("open")) {
361 open = _json["open"];
362 }
363 }
364
365 core.Map toJson() {
366 var _json = new core.Map();
367 if (displayName != null) {
368 _json["displayName"] = displayName;
369 }
370 if (name != null) {
371 _json["name"] = name;
372 }
373 if (open != null) {
374 _json["open"] = open;
375 }
376 return _json;
377 }
378 }
379
380 /** Response message for `ListBillingAccounts`. */
381 class ListBillingAccountsResponse {
382 /** A list of billing accounts. */
383 core.List<BillingAccount> billingAccounts;
384 /**
385 * A token to retrieve the next page of results. To retrieve the next page,
386 * call `ListBillingAccounts` again with the `page_token` field set to this
387 * value. This field is empty if there are no more results to retrieve.
388 */
389 core.String nextPageToken;
390
391 ListBillingAccountsResponse();
392
393 ListBillingAccountsResponse.fromJson(core.Map _json) {
394 if (_json.containsKey("billingAccounts")) {
395 billingAccounts = _json["billingAccounts"].map((value) => new BillingAccou nt.fromJson(value)).toList();
396 }
397 if (_json.containsKey("nextPageToken")) {
398 nextPageToken = _json["nextPageToken"];
399 }
400 }
401
402 core.Map toJson() {
403 var _json = new core.Map();
404 if (billingAccounts != null) {
405 _json["billingAccounts"] = billingAccounts.map((value) => (value).toJson() ).toList();
406 }
407 if (nextPageToken != null) {
408 _json["nextPageToken"] = nextPageToken;
409 }
410 return _json;
411 }
412 }
413
414 /** Request message for `ListProjectBillingInfoResponse`. */
415 class ListProjectBillingInfoResponse {
416 /**
417 * A token to retrieve the next page of results. To retrieve the next page,
418 * call `ListProjectBillingInfo` again with the `page_token` field set to this
419 * value. This field is empty if there are no more results to retrieve.
420 */
421 core.String nextPageToken;
422 /**
423 * A list of `ProjectBillingInfo` resources representing the projects
424 * associated with the billing account.
425 */
426 core.List<ProjectBillingInfo> projectBillingInfo;
427
428 ListProjectBillingInfoResponse();
429
430 ListProjectBillingInfoResponse.fromJson(core.Map _json) {
431 if (_json.containsKey("nextPageToken")) {
432 nextPageToken = _json["nextPageToken"];
433 }
434 if (_json.containsKey("projectBillingInfo")) {
435 projectBillingInfo = _json["projectBillingInfo"].map((value) => new Projec tBillingInfo.fromJson(value)).toList();
436 }
437 }
438
439 core.Map toJson() {
440 var _json = new core.Map();
441 if (nextPageToken != null) {
442 _json["nextPageToken"] = nextPageToken;
443 }
444 if (projectBillingInfo != null) {
445 _json["projectBillingInfo"] = projectBillingInfo.map((value) => (value).to Json()).toList();
446 }
447 return _json;
448 }
449 }
450
451 /**
452 * Encapsulation of billing information for a Developers Console project. A
453 * project has at most one associated billing account at a time (but a billing
454 * account can be assigned to multiple projects).
455 */
456 class ProjectBillingInfo {
457 /**
458 * The resource name of the billing account associated with the project, if
459 * any. For example, `billingAccounts/012345-567890-ABCDEF`.
460 */
461 core.String billingAccountName;
462 /**
463 * True if the project is associated with an open billing account, to which
464 * usage on the project is charged. False if the project is associated with a
465 * closed billing account, or no billing account at all, and therefore cannot
466 * use paid services. This field is read-only.
467 */
468 core.bool billingEnabled;
469 /**
470 * The resource name for the `ProjectBillingInfo`; has the form
471 * `projects/{project_id}/billingInfo`. For example, the resource name for the
472 * billing information for project `tokyo-rain-123` would be
473 * `projects/tokyo-rain-123/billingInfo`. This field is read-only.
474 */
475 core.String name;
476 /**
477 * The ID of the project that this `ProjectBillingInfo` represents, such as
478 * `tokyo-rain-123`. This is a convenience field so that you don't need to
479 * parse the `name` field to obtain a project ID. This field is read-only.
480 */
481 core.String projectId;
482
483 ProjectBillingInfo();
484
485 ProjectBillingInfo.fromJson(core.Map _json) {
486 if (_json.containsKey("billingAccountName")) {
487 billingAccountName = _json["billingAccountName"];
488 }
489 if (_json.containsKey("billingEnabled")) {
490 billingEnabled = _json["billingEnabled"];
491 }
492 if (_json.containsKey("name")) {
493 name = _json["name"];
494 }
495 if (_json.containsKey("projectId")) {
496 projectId = _json["projectId"];
497 }
498 }
499
500 core.Map toJson() {
501 var _json = new core.Map();
502 if (billingAccountName != null) {
503 _json["billingAccountName"] = billingAccountName;
504 }
505 if (billingEnabled != null) {
506 _json["billingEnabled"] = billingEnabled;
507 }
508 if (name != null) {
509 _json["name"] = name;
510 }
511 if (projectId != null) {
512 _json["projectId"] = projectId;
513 }
514 return _json;
515 }
516 }
OLDNEW
« no previous file with comments | « generated/googleapis/lib/bigquery/v2.dart ('k') | generated/googleapis/lib/clouddebugger/v2.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698