| OLD | NEW |
| (Empty) | |
| 1 // This is a generated file (see the discoveryapis_generator project). |
| 2 |
| 3 library googleapis.servicecontrol.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 servicecontrol/v1'; |
| 16 |
| 17 /** The Service Control API */ |
| 18 class ServicecontrolApi { |
| 19 /** View and manage your data across Google Cloud Platform services */ |
| 20 static const CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platf
orm"; |
| 21 |
| 22 /** Manage your Google Service Control data */ |
| 23 static const ServicecontrolScope = "https://www.googleapis.com/auth/servicecon
trol"; |
| 24 |
| 25 |
| 26 final commons.ApiRequester _requester; |
| 27 |
| 28 ServicesResourceApi get services => new ServicesResourceApi(_requester); |
| 29 |
| 30 ServicecontrolApi(http.Client client, {core.String rootUrl: "https://serviceco
ntrol.googleapis.com/", core.String servicePath: ""}) : |
| 31 _requester = new commons.ApiRequester(client, rootUrl, servicePath, USER_A
GENT); |
| 32 } |
| 33 |
| 34 |
| 35 class ServicesResourceApi { |
| 36 final commons.ApiRequester _requester; |
| 37 |
| 38 ServicesResourceApi(commons.ApiRequester client) : |
| 39 _requester = client; |
| 40 |
| 41 /** |
| 42 * Checks an operation with Google Service Control to decide whether |
| 43 * the given operation should proceed. It should be called before the |
| 44 * operation is executed. |
| 45 * |
| 46 * This method requires the `servicemanagement.services.check` permission |
| 47 * on the specified service. For more information, see |
| 48 * [Google Cloud IAM](https://cloud.google.com/iam). |
| 49 * |
| 50 * [request] - The metadata request object. |
| 51 * |
| 52 * Request parameters: |
| 53 * |
| 54 * [serviceName] - The service name as specified in its service configuration. |
| 55 * For example, |
| 56 * `"pubsub.googleapis.com"`. |
| 57 * |
| 58 * See google.api.Service for the definition of a service name. |
| 59 * |
| 60 * Completes with a [CheckResponse]. |
| 61 * |
| 62 * Completes with a [commons.ApiRequestError] if the API endpoint returned an |
| 63 * error. |
| 64 * |
| 65 * If the used [http.Client] completes with an error when making a REST call, |
| 66 * this method will complete with the same error. |
| 67 */ |
| 68 async.Future<CheckResponse> check(CheckRequest request, core.String serviceNam
e) { |
| 69 var _url = null; |
| 70 var _queryParams = new core.Map(); |
| 71 var _uploadMedia = null; |
| 72 var _uploadOptions = null; |
| 73 var _downloadOptions = commons.DownloadOptions.Metadata; |
| 74 var _body = null; |
| 75 |
| 76 if (request != null) { |
| 77 _body = convert.JSON.encode((request).toJson()); |
| 78 } |
| 79 if (serviceName == null) { |
| 80 throw new core.ArgumentError("Parameter serviceName is required."); |
| 81 } |
| 82 |
| 83 _url = 'v1/services/' + commons.Escaper.ecapeVariable('$serviceName') + ':ch
eck'; |
| 84 |
| 85 var _response = _requester.request(_url, |
| 86 "POST", |
| 87 body: _body, |
| 88 queryParams: _queryParams, |
| 89 uploadOptions: _uploadOptions, |
| 90 uploadMedia: _uploadMedia, |
| 91 downloadOptions: _downloadOptions); |
| 92 return _response.then((data) => new CheckResponse.fromJson(data)); |
| 93 } |
| 94 |
| 95 /** |
| 96 * Reports operations to Google Service Control. It should be called |
| 97 * after the operation is completed. |
| 98 * |
| 99 * This method requires the `servicemanagement.services.report` permission |
| 100 * on the specified service. For more information, see |
| 101 * [Google Cloud IAM](https://cloud.google.com/iam). |
| 102 * |
| 103 * [request] - The metadata request object. |
| 104 * |
| 105 * Request parameters: |
| 106 * |
| 107 * [serviceName] - The service name as specified in its service configuration. |
| 108 * For example, |
| 109 * `"pubsub.googleapis.com"`. |
| 110 * |
| 111 * See google.api.Service for the definition of a service name. |
| 112 * |
| 113 * Completes with a [ReportResponse]. |
| 114 * |
| 115 * Completes with a [commons.ApiRequestError] if the API endpoint returned an |
| 116 * error. |
| 117 * |
| 118 * If the used [http.Client] completes with an error when making a REST call, |
| 119 * this method will complete with the same error. |
| 120 */ |
| 121 async.Future<ReportResponse> report(ReportRequest request, core.String service
Name) { |
| 122 var _url = null; |
| 123 var _queryParams = new core.Map(); |
| 124 var _uploadMedia = null; |
| 125 var _uploadOptions = null; |
| 126 var _downloadOptions = commons.DownloadOptions.Metadata; |
| 127 var _body = null; |
| 128 |
| 129 if (request != null) { |
| 130 _body = convert.JSON.encode((request).toJson()); |
| 131 } |
| 132 if (serviceName == null) { |
| 133 throw new core.ArgumentError("Parameter serviceName is required."); |
| 134 } |
| 135 |
| 136 _url = 'v1/services/' + commons.Escaper.ecapeVariable('$serviceName') + ':re
port'; |
| 137 |
| 138 var _response = _requester.request(_url, |
| 139 "POST", |
| 140 body: _body, |
| 141 queryParams: _queryParams, |
| 142 uploadOptions: _uploadOptions, |
| 143 uploadMedia: _uploadMedia, |
| 144 downloadOptions: _downloadOptions); |
| 145 return _response.then((data) => new ReportResponse.fromJson(data)); |
| 146 } |
| 147 |
| 148 } |
| 149 |
| 150 |
| 151 |
| 152 /** |
| 153 * Defines the errors to be returned in |
| 154 * google.api.servicecontrol.v1.CheckResponse.check_errors. |
| 155 */ |
| 156 class CheckError { |
| 157 /** |
| 158 * The error code. |
| 159 * Possible string values are: |
| 160 * - "ERROR_CODE_UNSPECIFIED" : This is never used in `CheckResponse`. |
| 161 * - "NOT_FOUND" : The consumer's project id was not found. |
| 162 * Same as google.rpc.Code.NOT_FOUND. |
| 163 * - "PERMISSION_DENIED" : The consumer doesn't have access to the specified |
| 164 * resource. |
| 165 * Same as google.rpc.Code.PERMISSION_DENIED. |
| 166 * - "RESOURCE_EXHAUSTED" : Quota check failed. Same as |
| 167 * google.rpc.Code.RESOURCE_EXHAUSTED. |
| 168 * - "SERVICE_NOT_ACTIVATED" : The consumer hasn't activated the service. |
| 169 * - "BILLING_DISABLED" : The consumer cannot access the service because |
| 170 * billing is disabled. |
| 171 * - "PROJECT_DELETED" : The consumer's project has been marked as deleted |
| 172 * (soft deletion). |
| 173 * - "PROJECT_INVALID" : The consumer's project number or id does not |
| 174 * represent a valid project. |
| 175 * - "IP_ADDRESS_BLOCKED" : The IP address of the consumer is invalid for the |
| 176 * specific consumer |
| 177 * project. |
| 178 * - "REFERER_BLOCKED" : The referer address of the consumer request is |
| 179 * invalid for the specific |
| 180 * consumer project. |
| 181 * - "CLIENT_APP_BLOCKED" : The client application of the consumer request is |
| 182 * invalid for the |
| 183 * specific consumer project. |
| 184 * - "API_KEY_INVALID" : The consumer's API key is invalid. |
| 185 * - "API_KEY_EXPIRED" : The consumer's API Key has expired. |
| 186 * - "API_KEY_NOT_FOUND" : The consumer's API Key was not found in config |
| 187 * record. |
| 188 * - "NAMESPACE_LOOKUP_UNAVAILABLE" : The backend server for looking up |
| 189 * project id/number is unavailable. |
| 190 * - "SERVICE_STATUS_UNAVAILABLE" : The backend server for checking service |
| 191 * status is unavailable. |
| 192 * - "BILLING_STATUS_UNAVAILABLE" : The backend server for checking billing |
| 193 * status is unavailable. |
| 194 */ |
| 195 core.String code; |
| 196 /** Free-form text providing details on the error cause of the error. */ |
| 197 core.String detail; |
| 198 |
| 199 CheckError(); |
| 200 |
| 201 CheckError.fromJson(core.Map _json) { |
| 202 if (_json.containsKey("code")) { |
| 203 code = _json["code"]; |
| 204 } |
| 205 if (_json.containsKey("detail")) { |
| 206 detail = _json["detail"]; |
| 207 } |
| 208 } |
| 209 |
| 210 core.Map toJson() { |
| 211 var _json = new core.Map(); |
| 212 if (code != null) { |
| 213 _json["code"] = code; |
| 214 } |
| 215 if (detail != null) { |
| 216 _json["detail"] = detail; |
| 217 } |
| 218 return _json; |
| 219 } |
| 220 } |
| 221 |
| 222 /** Request message for the Check method. */ |
| 223 class CheckRequest { |
| 224 /** The operation to be checked. */ |
| 225 Operation operation; |
| 226 |
| 227 CheckRequest(); |
| 228 |
| 229 CheckRequest.fromJson(core.Map _json) { |
| 230 if (_json.containsKey("operation")) { |
| 231 operation = new Operation.fromJson(_json["operation"]); |
| 232 } |
| 233 } |
| 234 |
| 235 core.Map toJson() { |
| 236 var _json = new core.Map(); |
| 237 if (operation != null) { |
| 238 _json["operation"] = (operation).toJson(); |
| 239 } |
| 240 return _json; |
| 241 } |
| 242 } |
| 243 |
| 244 /** Response message for the Check method. */ |
| 245 class CheckResponse { |
| 246 /** |
| 247 * Indicate the decision of the check. |
| 248 * |
| 249 * If no check errors are present, the service should process the operation. |
| 250 * Otherwise the service should use the list of errors to determine the |
| 251 * appropriate action. |
| 252 */ |
| 253 core.List<CheckError> checkErrors; |
| 254 /** |
| 255 * The same operation_id value used in the CheckRequest. |
| 256 * Used for logging and diagnostics purposes. |
| 257 */ |
| 258 core.String operationId; |
| 259 |
| 260 CheckResponse(); |
| 261 |
| 262 CheckResponse.fromJson(core.Map _json) { |
| 263 if (_json.containsKey("checkErrors")) { |
| 264 checkErrors = _json["checkErrors"].map((value) => new CheckError.fromJson(
value)).toList(); |
| 265 } |
| 266 if (_json.containsKey("operationId")) { |
| 267 operationId = _json["operationId"]; |
| 268 } |
| 269 } |
| 270 |
| 271 core.Map toJson() { |
| 272 var _json = new core.Map(); |
| 273 if (checkErrors != null) { |
| 274 _json["checkErrors"] = checkErrors.map((value) => (value).toJson()).toList
(); |
| 275 } |
| 276 if (operationId != null) { |
| 277 _json["operationId"] = operationId; |
| 278 } |
| 279 return _json; |
| 280 } |
| 281 } |
| 282 |
| 283 /** |
| 284 * Distribution represents a frequency distribution of double-valued sample |
| 285 * points. It contains the size of the population of sample points plus |
| 286 * additional optional information: |
| 287 * |
| 288 * - the arithmetic mean of the samples |
| 289 * - the minimum and maximum of the samples |
| 290 * - the sum-squared-deviation of the samples, used to compute variance |
| 291 * - a histogram of the values of the sample points |
| 292 */ |
| 293 class Distribution { |
| 294 /** |
| 295 * The number of samples in each histogram bucket. `bucket_counts` are |
| 296 * optional. If present, they must sum to the `count` value. |
| 297 * |
| 298 * The buckets are defined below in `bucket_option`. There are N buckets. |
| 299 * `bucket_counts[0]` is the number of samples in the underflow bucket. |
| 300 * `bucket_counts[1]` to `bucket_counts[N-1]` are the numbers of samples |
| 301 * in each of the finite buckets. And `bucket_counts[N] is the number |
| 302 * of samples in the overflow bucket. See the comments of `bucket_option` |
| 303 * below for more details. |
| 304 * |
| 305 * Any suffix of trailing zeros may be omitted. |
| 306 */ |
| 307 core.List<core.String> bucketCounts; |
| 308 /** The total number of samples in the distribution. Must be >= 0. */ |
| 309 core.String count; |
| 310 /** Buckets with arbitrary user-provided width. */ |
| 311 ExplicitBuckets explicitBuckets; |
| 312 /** Buckets with exponentially growing width. */ |
| 313 ExponentialBuckets exponentialBuckets; |
| 314 /** Buckets with constant width. */ |
| 315 LinearBuckets linearBuckets; |
| 316 /** The maximum of the population of values. Ignored if `count` is zero. */ |
| 317 core.double maximum; |
| 318 /** |
| 319 * The arithmetic mean of the samples in the distribution. If `count` is |
| 320 * zero then this field must be zero. |
| 321 */ |
| 322 core.double mean; |
| 323 /** The minimum of the population of values. Ignored if `count` is zero. */ |
| 324 core.double minimum; |
| 325 /** |
| 326 * The sum of squared deviations from the mean: |
| 327 * Sum[i=1..count]((x_i - mean)^2) |
| 328 * where each x_i is a sample values. If `count` is zero then this field |
| 329 * must be zero, otherwise validation of the request fails. |
| 330 */ |
| 331 core.double sumOfSquaredDeviation; |
| 332 |
| 333 Distribution(); |
| 334 |
| 335 Distribution.fromJson(core.Map _json) { |
| 336 if (_json.containsKey("bucketCounts")) { |
| 337 bucketCounts = _json["bucketCounts"]; |
| 338 } |
| 339 if (_json.containsKey("count")) { |
| 340 count = _json["count"]; |
| 341 } |
| 342 if (_json.containsKey("explicitBuckets")) { |
| 343 explicitBuckets = new ExplicitBuckets.fromJson(_json["explicitBuckets"]); |
| 344 } |
| 345 if (_json.containsKey("exponentialBuckets")) { |
| 346 exponentialBuckets = new ExponentialBuckets.fromJson(_json["exponentialBuc
kets"]); |
| 347 } |
| 348 if (_json.containsKey("linearBuckets")) { |
| 349 linearBuckets = new LinearBuckets.fromJson(_json["linearBuckets"]); |
| 350 } |
| 351 if (_json.containsKey("maximum")) { |
| 352 maximum = _json["maximum"]; |
| 353 } |
| 354 if (_json.containsKey("mean")) { |
| 355 mean = _json["mean"]; |
| 356 } |
| 357 if (_json.containsKey("minimum")) { |
| 358 minimum = _json["minimum"]; |
| 359 } |
| 360 if (_json.containsKey("sumOfSquaredDeviation")) { |
| 361 sumOfSquaredDeviation = _json["sumOfSquaredDeviation"]; |
| 362 } |
| 363 } |
| 364 |
| 365 core.Map toJson() { |
| 366 var _json = new core.Map(); |
| 367 if (bucketCounts != null) { |
| 368 _json["bucketCounts"] = bucketCounts; |
| 369 } |
| 370 if (count != null) { |
| 371 _json["count"] = count; |
| 372 } |
| 373 if (explicitBuckets != null) { |
| 374 _json["explicitBuckets"] = (explicitBuckets).toJson(); |
| 375 } |
| 376 if (exponentialBuckets != null) { |
| 377 _json["exponentialBuckets"] = (exponentialBuckets).toJson(); |
| 378 } |
| 379 if (linearBuckets != null) { |
| 380 _json["linearBuckets"] = (linearBuckets).toJson(); |
| 381 } |
| 382 if (maximum != null) { |
| 383 _json["maximum"] = maximum; |
| 384 } |
| 385 if (mean != null) { |
| 386 _json["mean"] = mean; |
| 387 } |
| 388 if (minimum != null) { |
| 389 _json["minimum"] = minimum; |
| 390 } |
| 391 if (sumOfSquaredDeviation != null) { |
| 392 _json["sumOfSquaredDeviation"] = sumOfSquaredDeviation; |
| 393 } |
| 394 return _json; |
| 395 } |
| 396 } |
| 397 |
| 398 /** Describing buckets with arbitrary user-provided width. */ |
| 399 class ExplicitBuckets { |
| 400 /** |
| 401 * 'bound' is a list of strictly increasing boundaries between |
| 402 * buckets. Note that a list of length N-1 defines N buckets because |
| 403 * of fenceposting. See comments on `bucket_options` for details. |
| 404 * |
| 405 * The i'th finite bucket covers the interval |
| 406 * [bound[i-1], bound[i]) |
| 407 * where i ranges from 1 to bound_size() - 1. Note that there are no |
| 408 * finite buckets at all if 'bound' only contains a single element; in |
| 409 * that special case the single bound defines the boundary between the |
| 410 * underflow and overflow buckets. |
| 411 * |
| 412 * bucket number lower bound upper bound |
| 413 * i == 0 (underflow) -inf bound[i] |
| 414 * 0 < i < bound_size() bound[i-1] bound[i] |
| 415 * i == bound_size() (overflow) bound[i-1] +inf |
| 416 */ |
| 417 core.List<core.double> bounds; |
| 418 |
| 419 ExplicitBuckets(); |
| 420 |
| 421 ExplicitBuckets.fromJson(core.Map _json) { |
| 422 if (_json.containsKey("bounds")) { |
| 423 bounds = _json["bounds"]; |
| 424 } |
| 425 } |
| 426 |
| 427 core.Map toJson() { |
| 428 var _json = new core.Map(); |
| 429 if (bounds != null) { |
| 430 _json["bounds"] = bounds; |
| 431 } |
| 432 return _json; |
| 433 } |
| 434 } |
| 435 |
| 436 /** Describing buckets with exponentially growing width. */ |
| 437 class ExponentialBuckets { |
| 438 /** |
| 439 * The i'th exponential bucket covers the interval |
| 440 * [scale * growth_factor^(i-1), scale * growth_factor^i) |
| 441 * where i ranges from 1 to num_finite_buckets inclusive. |
| 442 * Must be larger than 1.0. |
| 443 */ |
| 444 core.double growthFactor; |
| 445 /** |
| 446 * The number of finite buckets. With the underflow and overflow buckets, |
| 447 * the total number of buckets is `num_finite_buckets` + 2. |
| 448 * See comments on `bucket_options` for details. |
| 449 */ |
| 450 core.int numFiniteBuckets; |
| 451 /** |
| 452 * The i'th exponential bucket covers the interval |
| 453 * [scale * growth_factor^(i-1), scale * growth_factor^i) |
| 454 * where i ranges from 1 to num_finite_buckets inclusive. |
| 455 * Must be > 0. |
| 456 */ |
| 457 core.double scale; |
| 458 |
| 459 ExponentialBuckets(); |
| 460 |
| 461 ExponentialBuckets.fromJson(core.Map _json) { |
| 462 if (_json.containsKey("growthFactor")) { |
| 463 growthFactor = _json["growthFactor"]; |
| 464 } |
| 465 if (_json.containsKey("numFiniteBuckets")) { |
| 466 numFiniteBuckets = _json["numFiniteBuckets"]; |
| 467 } |
| 468 if (_json.containsKey("scale")) { |
| 469 scale = _json["scale"]; |
| 470 } |
| 471 } |
| 472 |
| 473 core.Map toJson() { |
| 474 var _json = new core.Map(); |
| 475 if (growthFactor != null) { |
| 476 _json["growthFactor"] = growthFactor; |
| 477 } |
| 478 if (numFiniteBuckets != null) { |
| 479 _json["numFiniteBuckets"] = numFiniteBuckets; |
| 480 } |
| 481 if (scale != null) { |
| 482 _json["scale"] = scale; |
| 483 } |
| 484 return _json; |
| 485 } |
| 486 } |
| 487 |
| 488 /** Describing buckets with constant width. */ |
| 489 class LinearBuckets { |
| 490 /** |
| 491 * The number of finite buckets. With the underflow and overflow buckets, |
| 492 * the total number of buckets is `num_finite_buckets` + 2. |
| 493 * See comments on `bucket_options` for details. |
| 494 */ |
| 495 core.int numFiniteBuckets; |
| 496 /** |
| 497 * The i'th linear bucket covers the interval |
| 498 * [offset + (i-1) * width, offset + i * width) |
| 499 * where i ranges from 1 to num_finite_buckets, inclusive. |
| 500 */ |
| 501 core.double offset; |
| 502 /** |
| 503 * The i'th linear bucket covers the interval |
| 504 * [offset + (i-1) * width, offset + i * width) |
| 505 * where i ranges from 1 to num_finite_buckets, inclusive. |
| 506 * Must be strictly positive. |
| 507 */ |
| 508 core.double width; |
| 509 |
| 510 LinearBuckets(); |
| 511 |
| 512 LinearBuckets.fromJson(core.Map _json) { |
| 513 if (_json.containsKey("numFiniteBuckets")) { |
| 514 numFiniteBuckets = _json["numFiniteBuckets"]; |
| 515 } |
| 516 if (_json.containsKey("offset")) { |
| 517 offset = _json["offset"]; |
| 518 } |
| 519 if (_json.containsKey("width")) { |
| 520 width = _json["width"]; |
| 521 } |
| 522 } |
| 523 |
| 524 core.Map toJson() { |
| 525 var _json = new core.Map(); |
| 526 if (numFiniteBuckets != null) { |
| 527 _json["numFiniteBuckets"] = numFiniteBuckets; |
| 528 } |
| 529 if (offset != null) { |
| 530 _json["offset"] = offset; |
| 531 } |
| 532 if (width != null) { |
| 533 _json["width"] = width; |
| 534 } |
| 535 return _json; |
| 536 } |
| 537 } |
| 538 |
| 539 /** An individual log entry. */ |
| 540 class LogEntry { |
| 541 /** |
| 542 * A unique ID for the log entry used for deduplication. If omitted, |
| 543 * the implementation will generate one based on operation_id. |
| 544 */ |
| 545 core.String insertId; |
| 546 /** |
| 547 * A set of user-defined (key, value) data that provides additional |
| 548 * information about the log entry. |
| 549 */ |
| 550 core.Map<core.String, core.String> labels; |
| 551 /** |
| 552 * Required. The log to which this log entry belongs. Examples: `"syslog"`, |
| 553 * `"book_log"`. |
| 554 */ |
| 555 core.String name; |
| 556 /** |
| 557 * The log entry payload, represented as a protocol buffer that is |
| 558 * expressed as a JSON object. You can only pass `protoPayload` |
| 559 * values that belong to a set of approved types. |
| 560 * |
| 561 * The values for Object must be JSON objects. It can consist of `num`, |
| 562 * `String`, `bool` and `null` as well as `Map` and `List` values. |
| 563 */ |
| 564 core.Map<core.String, core.Object> protoPayload; |
| 565 /** |
| 566 * The severity of the log entry. The default value is |
| 567 * `LogSeverity.DEFAULT`. |
| 568 * Possible string values are: |
| 569 * - "DEFAULT" : The log entry has no assigned severity level. |
| 570 * - "DEBUG" : Debug or trace information. |
| 571 * - "INFO" : Routine information, such as ongoing status or performance. |
| 572 * - "NOTICE" : Normal but significant events, such as start up, shut down, or |
| 573 * configuration. |
| 574 * - "WARNING" : Warning events might cause problems. |
| 575 * - "ERROR" : Error events are likely to cause problems. |
| 576 * - "CRITICAL" : Critical events cause more severe problems or brief outages. |
| 577 * - "ALERT" : A person must take an action immediately. |
| 578 * - "EMERGENCY" : One or more systems are unusable. |
| 579 */ |
| 580 core.String severity; |
| 581 /** |
| 582 * The log entry payload, represented as a structure that |
| 583 * is expressed as a JSON object. |
| 584 * |
| 585 * The values for Object must be JSON objects. It can consist of `num`, |
| 586 * `String`, `bool` and `null` as well as `Map` and `List` values. |
| 587 */ |
| 588 core.Map<core.String, core.Object> structPayload; |
| 589 /** The log entry payload, represented as a Unicode string (UTF-8). */ |
| 590 core.String textPayload; |
| 591 /** |
| 592 * The time the event described by the log entry occurred. If |
| 593 * omitted, defaults to operation start time. |
| 594 */ |
| 595 core.String timestamp; |
| 596 |
| 597 LogEntry(); |
| 598 |
| 599 LogEntry.fromJson(core.Map _json) { |
| 600 if (_json.containsKey("insertId")) { |
| 601 insertId = _json["insertId"]; |
| 602 } |
| 603 if (_json.containsKey("labels")) { |
| 604 labels = _json["labels"]; |
| 605 } |
| 606 if (_json.containsKey("name")) { |
| 607 name = _json["name"]; |
| 608 } |
| 609 if (_json.containsKey("protoPayload")) { |
| 610 protoPayload = _json["protoPayload"]; |
| 611 } |
| 612 if (_json.containsKey("severity")) { |
| 613 severity = _json["severity"]; |
| 614 } |
| 615 if (_json.containsKey("structPayload")) { |
| 616 structPayload = _json["structPayload"]; |
| 617 } |
| 618 if (_json.containsKey("textPayload")) { |
| 619 textPayload = _json["textPayload"]; |
| 620 } |
| 621 if (_json.containsKey("timestamp")) { |
| 622 timestamp = _json["timestamp"]; |
| 623 } |
| 624 } |
| 625 |
| 626 core.Map toJson() { |
| 627 var _json = new core.Map(); |
| 628 if (insertId != null) { |
| 629 _json["insertId"] = insertId; |
| 630 } |
| 631 if (labels != null) { |
| 632 _json["labels"] = labels; |
| 633 } |
| 634 if (name != null) { |
| 635 _json["name"] = name; |
| 636 } |
| 637 if (protoPayload != null) { |
| 638 _json["protoPayload"] = protoPayload; |
| 639 } |
| 640 if (severity != null) { |
| 641 _json["severity"] = severity; |
| 642 } |
| 643 if (structPayload != null) { |
| 644 _json["structPayload"] = structPayload; |
| 645 } |
| 646 if (textPayload != null) { |
| 647 _json["textPayload"] = textPayload; |
| 648 } |
| 649 if (timestamp != null) { |
| 650 _json["timestamp"] = timestamp; |
| 651 } |
| 652 return _json; |
| 653 } |
| 654 } |
| 655 |
| 656 /** Represents a single metric value. */ |
| 657 class MetricValue { |
| 658 /** A boolean value. */ |
| 659 core.bool boolValue; |
| 660 /** A distribution value. */ |
| 661 Distribution distributionValue; |
| 662 /** A double precision floating point value. */ |
| 663 core.double doubleValue; |
| 664 /** |
| 665 * The end of the time period over which this metric value's measurement |
| 666 * applies. |
| 667 */ |
| 668 core.String endTime; |
| 669 /** A signed 64-bit integer value. */ |
| 670 core.String int64Value; |
| 671 /** |
| 672 * The labels describing the metric value. |
| 673 * See comments on google.api.servicecontrol.v1.Operation.labels for |
| 674 * the overriding relationship. |
| 675 */ |
| 676 core.Map<core.String, core.String> labels; |
| 677 /** |
| 678 * The start of the time period over which this metric value's measurement |
| 679 * applies. The time period has different semantics for different metric |
| 680 * types (cumulative, delta, and gauge). See the metric definition |
| 681 * documentation in the service configuration for details. |
| 682 */ |
| 683 core.String startTime; |
| 684 /** A text string value. */ |
| 685 core.String stringValue; |
| 686 |
| 687 MetricValue(); |
| 688 |
| 689 MetricValue.fromJson(core.Map _json) { |
| 690 if (_json.containsKey("boolValue")) { |
| 691 boolValue = _json["boolValue"]; |
| 692 } |
| 693 if (_json.containsKey("distributionValue")) { |
| 694 distributionValue = new Distribution.fromJson(_json["distributionValue"]); |
| 695 } |
| 696 if (_json.containsKey("doubleValue")) { |
| 697 doubleValue = _json["doubleValue"]; |
| 698 } |
| 699 if (_json.containsKey("endTime")) { |
| 700 endTime = _json["endTime"]; |
| 701 } |
| 702 if (_json.containsKey("int64Value")) { |
| 703 int64Value = _json["int64Value"]; |
| 704 } |
| 705 if (_json.containsKey("labels")) { |
| 706 labels = _json["labels"]; |
| 707 } |
| 708 if (_json.containsKey("startTime")) { |
| 709 startTime = _json["startTime"]; |
| 710 } |
| 711 if (_json.containsKey("stringValue")) { |
| 712 stringValue = _json["stringValue"]; |
| 713 } |
| 714 } |
| 715 |
| 716 core.Map toJson() { |
| 717 var _json = new core.Map(); |
| 718 if (boolValue != null) { |
| 719 _json["boolValue"] = boolValue; |
| 720 } |
| 721 if (distributionValue != null) { |
| 722 _json["distributionValue"] = (distributionValue).toJson(); |
| 723 } |
| 724 if (doubleValue != null) { |
| 725 _json["doubleValue"] = doubleValue; |
| 726 } |
| 727 if (endTime != null) { |
| 728 _json["endTime"] = endTime; |
| 729 } |
| 730 if (int64Value != null) { |
| 731 _json["int64Value"] = int64Value; |
| 732 } |
| 733 if (labels != null) { |
| 734 _json["labels"] = labels; |
| 735 } |
| 736 if (startTime != null) { |
| 737 _json["startTime"] = startTime; |
| 738 } |
| 739 if (stringValue != null) { |
| 740 _json["stringValue"] = stringValue; |
| 741 } |
| 742 return _json; |
| 743 } |
| 744 } |
| 745 |
| 746 /** |
| 747 * Represents a set of metric values in the same metric. |
| 748 * Each metric value in the set should have a unique combination of start time, |
| 749 * end time, and label values. |
| 750 */ |
| 751 class MetricValueSet { |
| 752 /** The metric name defined in the service configuration. */ |
| 753 core.String metricName; |
| 754 /** The values in this metric. */ |
| 755 core.List<MetricValue> metricValues; |
| 756 |
| 757 MetricValueSet(); |
| 758 |
| 759 MetricValueSet.fromJson(core.Map _json) { |
| 760 if (_json.containsKey("metricName")) { |
| 761 metricName = _json["metricName"]; |
| 762 } |
| 763 if (_json.containsKey("metricValues")) { |
| 764 metricValues = _json["metricValues"].map((value) => new MetricValue.fromJs
on(value)).toList(); |
| 765 } |
| 766 } |
| 767 |
| 768 core.Map toJson() { |
| 769 var _json = new core.Map(); |
| 770 if (metricName != null) { |
| 771 _json["metricName"] = metricName; |
| 772 } |
| 773 if (metricValues != null) { |
| 774 _json["metricValues"] = metricValues.map((value) => (value).toJson()).toLi
st(); |
| 775 } |
| 776 return _json; |
| 777 } |
| 778 } |
| 779 |
| 780 /** Represents information regarding an operation. */ |
| 781 class Operation { |
| 782 /** |
| 783 * Identity of the consumer who is using the service. |
| 784 * This field should be filled in for the operations initiated by a |
| 785 * consumer, but not for service-initiated operations that are |
| 786 * not related to a specific consumer. |
| 787 * |
| 788 * This can be in one of the following formats: |
| 789 * project:<project_id>, |
| 790 * project_number:<project_number>, |
| 791 * api_key:<api_key>. |
| 792 */ |
| 793 core.String consumerId; |
| 794 /** |
| 795 * End time of the operation. |
| 796 * Required when the operation is used in ServiceController.Report, |
| 797 * but optional when the operation is used in ServiceController.Check. |
| 798 */ |
| 799 core.String endTime; |
| 800 /** |
| 801 * The importance of the data contained in the operation. |
| 802 * Possible string values are: |
| 803 * - "LOW" : The operation doesn't contain significant monetary value or audit |
| 804 * trail. The API implementation may cache and aggregate the data. |
| 805 * There is no deduplication based on `operation_id`. The data |
| 806 * may be lost when rare and unexpected system failures occur. |
| 807 * - "HIGH" : The operation contains significant monetary value or audit |
| 808 * trail. |
| 809 * The API implementation doesn't cache and aggregate the data. |
| 810 * Deduplication based on `operation_id` is performed for monetary |
| 811 * values. If the method returns successfully, it's guaranteed that |
| 812 * the data are persisted in durable storage. |
| 813 */ |
| 814 core.String importance; |
| 815 /** |
| 816 * Labels describing the operation. Only the following labels are allowed: |
| 817 * |
| 818 * - Labels describing monitored resources as defined in |
| 819 * the service configuration. |
| 820 * - Default labels of metric values. When specified, labels defined in the |
| 821 * metric value override these default. |
| 822 * - The following labels defined by Google Cloud Platform: |
| 823 * - `cloud.googleapis.com/location` describing the location where the |
| 824 * operation happened, |
| 825 * - `servicecontrol.googleapis.com/user_agent` describing the user agent |
| 826 * of the API request, |
| 827 * - `servicecontrol.googleapis.com/service_agent` describing the service |
| 828 * used to handle the API request (e.g. ESP), |
| 829 * - `servicecontrol.googleapis.com/platform` describing the platform |
| 830 * where the API is served (e.g. GAE, GCE, GKE). |
| 831 */ |
| 832 core.Map<core.String, core.String> labels; |
| 833 /** Represents information to be logged. */ |
| 834 core.List<LogEntry> logEntries; |
| 835 /** |
| 836 * Represents information about this operation. Each MetricValueSet |
| 837 * corresponds to a metric defined in the service configuration. |
| 838 * The data type used in the MetricValueSet must agree with |
| 839 * the data type specified in the metric definition. |
| 840 * |
| 841 * Within a single operation, it is not allowed to have more than one |
| 842 * MetricValue instances that have the same metric names and identical |
| 843 * label value combinations. If a request has such duplicated MetricValue |
| 844 * instances, the entire request is rejected with |
| 845 * an invalid argument error. |
| 846 */ |
| 847 core.List<MetricValueSet> metricValueSets; |
| 848 /** |
| 849 * Identity of the operation. This must be unique within the scope of the |
| 850 * service that generated the operation. If the service calls |
| 851 * Check() and Report() on the same operation, the two calls should carry |
| 852 * the same id. |
| 853 * |
| 854 * UUID version 4 is recommended, though not required. |
| 855 * In scenarios where an operation is computed from existing information |
| 856 * and an idempotent id is desirable for deduplication purpose, UUID version 5 |
| 857 * is recommended. See RFC 4122 for details. |
| 858 */ |
| 859 core.String operationId; |
| 860 /** Fully qualified name of the operation. Reserved for future use. */ |
| 861 core.String operationName; |
| 862 /** Required. Start time of the operation. */ |
| 863 core.String startTime; |
| 864 |
| 865 Operation(); |
| 866 |
| 867 Operation.fromJson(core.Map _json) { |
| 868 if (_json.containsKey("consumerId")) { |
| 869 consumerId = _json["consumerId"]; |
| 870 } |
| 871 if (_json.containsKey("endTime")) { |
| 872 endTime = _json["endTime"]; |
| 873 } |
| 874 if (_json.containsKey("importance")) { |
| 875 importance = _json["importance"]; |
| 876 } |
| 877 if (_json.containsKey("labels")) { |
| 878 labels = _json["labels"]; |
| 879 } |
| 880 if (_json.containsKey("logEntries")) { |
| 881 logEntries = _json["logEntries"].map((value) => new LogEntry.fromJson(valu
e)).toList(); |
| 882 } |
| 883 if (_json.containsKey("metricValueSets")) { |
| 884 metricValueSets = _json["metricValueSets"].map((value) => new MetricValueS
et.fromJson(value)).toList(); |
| 885 } |
| 886 if (_json.containsKey("operationId")) { |
| 887 operationId = _json["operationId"]; |
| 888 } |
| 889 if (_json.containsKey("operationName")) { |
| 890 operationName = _json["operationName"]; |
| 891 } |
| 892 if (_json.containsKey("startTime")) { |
| 893 startTime = _json["startTime"]; |
| 894 } |
| 895 } |
| 896 |
| 897 core.Map toJson() { |
| 898 var _json = new core.Map(); |
| 899 if (consumerId != null) { |
| 900 _json["consumerId"] = consumerId; |
| 901 } |
| 902 if (endTime != null) { |
| 903 _json["endTime"] = endTime; |
| 904 } |
| 905 if (importance != null) { |
| 906 _json["importance"] = importance; |
| 907 } |
| 908 if (labels != null) { |
| 909 _json["labels"] = labels; |
| 910 } |
| 911 if (logEntries != null) { |
| 912 _json["logEntries"] = logEntries.map((value) => (value).toJson()).toList()
; |
| 913 } |
| 914 if (metricValueSets != null) { |
| 915 _json["metricValueSets"] = metricValueSets.map((value) => (value).toJson()
).toList(); |
| 916 } |
| 917 if (operationId != null) { |
| 918 _json["operationId"] = operationId; |
| 919 } |
| 920 if (operationName != null) { |
| 921 _json["operationName"] = operationName; |
| 922 } |
| 923 if (startTime != null) { |
| 924 _json["startTime"] = startTime; |
| 925 } |
| 926 return _json; |
| 927 } |
| 928 } |
| 929 |
| 930 /** Represents the processing error of one `Operation` in the request. */ |
| 931 class ReportError { |
| 932 /** The Operation.operation_id value from the request. */ |
| 933 core.String operationId; |
| 934 /** Details of the error when processing the `Operation`. */ |
| 935 Status status; |
| 936 |
| 937 ReportError(); |
| 938 |
| 939 ReportError.fromJson(core.Map _json) { |
| 940 if (_json.containsKey("operationId")) { |
| 941 operationId = _json["operationId"]; |
| 942 } |
| 943 if (_json.containsKey("status")) { |
| 944 status = new Status.fromJson(_json["status"]); |
| 945 } |
| 946 } |
| 947 |
| 948 core.Map toJson() { |
| 949 var _json = new core.Map(); |
| 950 if (operationId != null) { |
| 951 _json["operationId"] = operationId; |
| 952 } |
| 953 if (status != null) { |
| 954 _json["status"] = (status).toJson(); |
| 955 } |
| 956 return _json; |
| 957 } |
| 958 } |
| 959 |
| 960 /** Request message for the Report method. */ |
| 961 class ReportRequest { |
| 962 /** |
| 963 * Operations to be reported. |
| 964 * |
| 965 * Typically the service should report one operation per request. |
| 966 * Putting multiple operations into a single request is allowed, but should |
| 967 * be used only when multiple operations are natually available at the time |
| 968 * of the report. |
| 969 * |
| 970 * If multiple operations are in a single request, the total request size |
| 971 * should be no larger than 1MB. See ReportResponse.report_errors for |
| 972 * partial failure behavior. |
| 973 */ |
| 974 core.List<Operation> operations; |
| 975 |
| 976 ReportRequest(); |
| 977 |
| 978 ReportRequest.fromJson(core.Map _json) { |
| 979 if (_json.containsKey("operations")) { |
| 980 operations = _json["operations"].map((value) => new Operation.fromJson(val
ue)).toList(); |
| 981 } |
| 982 } |
| 983 |
| 984 core.Map toJson() { |
| 985 var _json = new core.Map(); |
| 986 if (operations != null) { |
| 987 _json["operations"] = operations.map((value) => (value).toJson()).toList()
; |
| 988 } |
| 989 return _json; |
| 990 } |
| 991 } |
| 992 |
| 993 /** Response message for the Report method. */ |
| 994 class ReportResponse { |
| 995 /** |
| 996 * Partial failures, one for each `Operation` in the request that failed |
| 997 * processing. There are three possible combinations of the RPC status: |
| 998 * |
| 999 * 1. The combination of a successful RPC status and an empty `report_errors` |
| 1000 * list indicates a complete success where all `Operations` in the |
| 1001 * request are processed successfully. |
| 1002 * 2. The combination of a successful RPC status and a non-empty |
| 1003 * `report_errors` list indicates a partial success where some |
| 1004 * `Operations` in the request succeeded. Each |
| 1005 * `Operation` that failed processing has a corresponding item |
| 1006 * in this list. |
| 1007 * 3. A failed RPC status indicates a complete failure where none of the |
| 1008 * `Operations` in the request succeeded. |
| 1009 */ |
| 1010 core.List<ReportError> reportErrors; |
| 1011 |
| 1012 ReportResponse(); |
| 1013 |
| 1014 ReportResponse.fromJson(core.Map _json) { |
| 1015 if (_json.containsKey("reportErrors")) { |
| 1016 reportErrors = _json["reportErrors"].map((value) => new ReportError.fromJs
on(value)).toList(); |
| 1017 } |
| 1018 } |
| 1019 |
| 1020 core.Map toJson() { |
| 1021 var _json = new core.Map(); |
| 1022 if (reportErrors != null) { |
| 1023 _json["reportErrors"] = reportErrors.map((value) => (value).toJson()).toLi
st(); |
| 1024 } |
| 1025 return _json; |
| 1026 } |
| 1027 } |
| 1028 |
| 1029 /** |
| 1030 * The `Status` type defines a logical error model that is suitable for |
| 1031 * different |
| 1032 * programming environments, including REST APIs and RPC APIs. It is used by |
| 1033 * [gRPC](https://github.com/grpc). The error model is designed to be: |
| 1034 * |
| 1035 * - Simple to use and understand for most users |
| 1036 * - Flexible enough to meet unexpected needs |
| 1037 * |
| 1038 * # Overview |
| 1039 * |
| 1040 * The `Status` message contains three pieces of data: error code, error |
| 1041 * message, |
| 1042 * and error details. The error code should be an enum value of |
| 1043 * google.rpc.Code, but it may accept additional error codes if needed. The |
| 1044 * error message should be a developer-facing English message that helps |
| 1045 * developers *understand* and *resolve* the error. If a localized user-facing |
| 1046 * error message is needed, put the localized message in the error details or |
| 1047 * localize it in the client. The optional error details may contain arbitrary |
| 1048 * information about the error. There is a predefined set of error detail types |
| 1049 * in the package `google.rpc` which can be used for common error conditions. |
| 1050 * |
| 1051 * # Language mapping |
| 1052 * |
| 1053 * The `Status` message is the logical representation of the error model, but it |
| 1054 * is not necessarily the actual wire format. When the `Status` message is |
| 1055 * exposed in different client libraries and different wire protocols, it can be |
| 1056 * mapped differently. For example, it will likely be mapped to some exceptions |
| 1057 * in Java, but more likely mapped to some error codes in C. |
| 1058 * |
| 1059 * # Other uses |
| 1060 * |
| 1061 * The error model and the `Status` message can be used in a variety of |
| 1062 * environments, either with or without APIs, to provide a |
| 1063 * consistent developer experience across different environments. |
| 1064 * |
| 1065 * Example uses of this error model include: |
| 1066 * |
| 1067 * - Partial errors. If a service needs to return partial errors to the client, |
| 1068 * it may embed the `Status` in the normal response to indicate the partial |
| 1069 * errors. |
| 1070 * |
| 1071 * - Workflow errors. A typical workflow has multiple steps. Each step may |
| 1072 * have a `Status` message for error reporting purpose. |
| 1073 * |
| 1074 * - Batch operations. If a client uses batch request and batch response, the |
| 1075 * `Status` message should be used directly inside batch response, one for |
| 1076 * each error sub-response. |
| 1077 * |
| 1078 * - Asynchronous operations. If an API call embeds asynchronous operation |
| 1079 * results in its response, the status of those operations should be |
| 1080 * represented directly using the `Status` message. |
| 1081 * |
| 1082 * - Logging. If some API errors are stored in logs, the message `Status` could |
| 1083 * be used directly after any stripping needed for security/privacy reasons. |
| 1084 */ |
| 1085 class Status { |
| 1086 /** The status code, which should be an enum value of google.rpc.Code. */ |
| 1087 core.int code; |
| 1088 /** |
| 1089 * A list of messages that carry the error details. There will be a |
| 1090 * common set of message types for APIs to use. |
| 1091 * |
| 1092 * The values for Object must be JSON objects. It can consist of `num`, |
| 1093 * `String`, `bool` and `null` as well as `Map` and `List` values. |
| 1094 */ |
| 1095 core.List<core.Map<core.String, core.Object>> details; |
| 1096 /** |
| 1097 * A developer-facing error message, which should be in English. Any |
| 1098 * user-facing error message should be localized and sent in the |
| 1099 * google.rpc.Status.details field, or localized by the client. |
| 1100 */ |
| 1101 core.String message; |
| 1102 |
| 1103 Status(); |
| 1104 |
| 1105 Status.fromJson(core.Map _json) { |
| 1106 if (_json.containsKey("code")) { |
| 1107 code = _json["code"]; |
| 1108 } |
| 1109 if (_json.containsKey("details")) { |
| 1110 details = _json["details"]; |
| 1111 } |
| 1112 if (_json.containsKey("message")) { |
| 1113 message = _json["message"]; |
| 1114 } |
| 1115 } |
| 1116 |
| 1117 core.Map toJson() { |
| 1118 var _json = new core.Map(); |
| 1119 if (code != null) { |
| 1120 _json["code"] = code; |
| 1121 } |
| 1122 if (details != null) { |
| 1123 _json["details"] = details; |
| 1124 } |
| 1125 if (message != null) { |
| 1126 _json["message"] = message; |
| 1127 } |
| 1128 return _json; |
| 1129 } |
| 1130 } |
| OLD | NEW |