Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.
 
 
 

3621 rinda
140 KiB

  1. // Package servicecontrol provides access to the Service Control API.
  2. //
  3. // See https://cloud.google.com/service-control/
  4. //
  5. // Usage example:
  6. //
  7. // import "google.golang.org/api/servicecontrol/v1"
  8. // ...
  9. // servicecontrolService, err := servicecontrol.New(oauthHttpClient)
  10. package servicecontrol // import "google.golang.org/api/servicecontrol/v1"
  11. import (
  12. "bytes"
  13. "encoding/json"
  14. "errors"
  15. "fmt"
  16. context "golang.org/x/net/context"
  17. ctxhttp "golang.org/x/net/context/ctxhttp"
  18. gensupport "google.golang.org/api/gensupport"
  19. googleapi "google.golang.org/api/googleapi"
  20. "io"
  21. "net/http"
  22. "net/url"
  23. "strconv"
  24. "strings"
  25. )
  26. // Always reference these packages, just in case the auto-generated code
  27. // below doesn't.
  28. var _ = bytes.NewBuffer
  29. var _ = strconv.Itoa
  30. var _ = fmt.Sprintf
  31. var _ = json.NewDecoder
  32. var _ = io.Copy
  33. var _ = url.Parse
  34. var _ = gensupport.MarshalJSON
  35. var _ = googleapi.Version
  36. var _ = errors.New
  37. var _ = strings.Replace
  38. var _ = context.Canceled
  39. var _ = ctxhttp.Do
  40. const apiId = "servicecontrol:v1"
  41. const apiName = "servicecontrol"
  42. const apiVersion = "v1"
  43. const basePath = "https://servicecontrol.googleapis.com/"
  44. // OAuth2 scopes used by this API.
  45. const (
  46. // View and manage your data across Google Cloud Platform services
  47. CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platform"
  48. // Manage your Google Service Control data
  49. ServicecontrolScope = "https://www.googleapis.com/auth/servicecontrol"
  50. )
  51. func New(client *http.Client) (*Service, error) {
  52. if client == nil {
  53. return nil, errors.New("client is nil")
  54. }
  55. s := &Service{client: client, BasePath: basePath}
  56. s.Services = NewServicesService(s)
  57. return s, nil
  58. }
  59. type Service struct {
  60. client *http.Client
  61. BasePath string // API endpoint base URL
  62. UserAgent string // optional additional User-Agent fragment
  63. Services *ServicesService
  64. }
  65. func (s *Service) userAgent() string {
  66. if s.UserAgent == "" {
  67. return googleapi.UserAgent
  68. }
  69. return googleapi.UserAgent + " " + s.UserAgent
  70. }
  71. func NewServicesService(s *Service) *ServicesService {
  72. rs := &ServicesService{s: s}
  73. return rs
  74. }
  75. type ServicesService struct {
  76. s *Service
  77. }
  78. type AllocateInfo struct {
  79. // UnusedArguments: A list of label keys that were unused by the server
  80. // in processing the
  81. // request. Thus, for similar requests repeated in a certain future
  82. // time
  83. // window, the caller can choose to ignore these labels in the
  84. // requests
  85. // to achieve better client-side cache hits and quota aggregation.
  86. UnusedArguments []string `json:"unusedArguments,omitempty"`
  87. // ForceSendFields is a list of field names (e.g. "UnusedArguments") to
  88. // unconditionally include in API requests. By default, fields with
  89. // empty values are omitted from API requests. However, any non-pointer,
  90. // non-interface field appearing in ForceSendFields will be sent to the
  91. // server regardless of whether the field is empty or not. This may be
  92. // used to include empty fields in Patch requests.
  93. ForceSendFields []string `json:"-"`
  94. // NullFields is a list of field names (e.g. "UnusedArguments") to
  95. // include in API requests with the JSON null value. By default, fields
  96. // with empty values are omitted from API requests. However, any field
  97. // with an empty value appearing in NullFields will be sent to the
  98. // server as null. It is an error if a field in this list has a
  99. // non-empty value. This may be used to include null fields in Patch
  100. // requests.
  101. NullFields []string `json:"-"`
  102. }
  103. func (s *AllocateInfo) MarshalJSON() ([]byte, error) {
  104. type NoMethod AllocateInfo
  105. raw := NoMethod(*s)
  106. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  107. }
  108. // AllocateQuotaRequest: Request message for the AllocateQuota method.
  109. type AllocateQuotaRequest struct {
  110. // AllocateOperation: Operation that describes the quota allocation.
  111. AllocateOperation *QuotaOperation `json:"allocateOperation,omitempty"`
  112. // ServiceConfigId: Specifies which version of service configuration
  113. // should be used to process
  114. // the request. If unspecified or no matching version can be found, the
  115. // latest
  116. // one will be used.
  117. ServiceConfigId string `json:"serviceConfigId,omitempty"`
  118. // ForceSendFields is a list of field names (e.g. "AllocateOperation")
  119. // to unconditionally include in API requests. By default, fields with
  120. // empty values are omitted from API requests. However, any non-pointer,
  121. // non-interface field appearing in ForceSendFields will be sent to the
  122. // server regardless of whether the field is empty or not. This may be
  123. // used to include empty fields in Patch requests.
  124. ForceSendFields []string `json:"-"`
  125. // NullFields is a list of field names (e.g. "AllocateOperation") to
  126. // include in API requests with the JSON null value. By default, fields
  127. // with empty values are omitted from API requests. However, any field
  128. // with an empty value appearing in NullFields will be sent to the
  129. // server as null. It is an error if a field in this list has a
  130. // non-empty value. This may be used to include null fields in Patch
  131. // requests.
  132. NullFields []string `json:"-"`
  133. }
  134. func (s *AllocateQuotaRequest) MarshalJSON() ([]byte, error) {
  135. type NoMethod AllocateQuotaRequest
  136. raw := NoMethod(*s)
  137. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  138. }
  139. // AllocateQuotaResponse: Response message for the AllocateQuota method.
  140. type AllocateQuotaResponse struct {
  141. // AllocateErrors: Indicates the decision of the allocate.
  142. AllocateErrors []*QuotaError `json:"allocateErrors,omitempty"`
  143. // AllocateInfo: WARNING: DO NOT use this field until this warning
  144. // message is removed.
  145. AllocateInfo *AllocateInfo `json:"allocateInfo,omitempty"`
  146. // OperationId: The same operation_id value used in the
  147. // AllocateQuotaRequest. Used for
  148. // logging and diagnostics purposes.
  149. OperationId string `json:"operationId,omitempty"`
  150. // QuotaMetrics: Quota metrics to indicate the result of allocation.
  151. // Depending on the
  152. // request, one or more of the following metrics will be included:
  153. //
  154. // 1. Per quota group or per quota metric incremental usage will be
  155. // specified
  156. // using the following delta metric :
  157. // "serviceruntime.googleapis.com/api/consumer/quota_used_count"
  158. //
  159. // 2. The quota limit reached condition will be specified using the
  160. // following
  161. // boolean metric :
  162. // "serviceruntime.googleapis.com/quota/exceeded"
  163. QuotaMetrics []*MetricValueSet `json:"quotaMetrics,omitempty"`
  164. // ServiceConfigId: ID of the actual config used to process the request.
  165. ServiceConfigId string `json:"serviceConfigId,omitempty"`
  166. // ServerResponse contains the HTTP response code and headers from the
  167. // server.
  168. googleapi.ServerResponse `json:"-"`
  169. // ForceSendFields is a list of field names (e.g. "AllocateErrors") to
  170. // unconditionally include in API requests. By default, fields with
  171. // empty values are omitted from API requests. However, any non-pointer,
  172. // non-interface field appearing in ForceSendFields will be sent to the
  173. // server regardless of whether the field is empty or not. This may be
  174. // used to include empty fields in Patch requests.
  175. ForceSendFields []string `json:"-"`
  176. // NullFields is a list of field names (e.g. "AllocateErrors") to
  177. // include in API requests with the JSON null value. By default, fields
  178. // with empty values are omitted from API requests. However, any field
  179. // with an empty value appearing in NullFields will be sent to the
  180. // server as null. It is an error if a field in this list has a
  181. // non-empty value. This may be used to include null fields in Patch
  182. // requests.
  183. NullFields []string `json:"-"`
  184. }
  185. func (s *AllocateQuotaResponse) MarshalJSON() ([]byte, error) {
  186. type NoMethod AllocateQuotaResponse
  187. raw := NoMethod(*s)
  188. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  189. }
  190. // AuditLog: Common audit log format for Google Cloud Platform API
  191. // operations.
  192. //
  193. //
  194. type AuditLog struct {
  195. // AuthenticationInfo: Authentication information.
  196. AuthenticationInfo *AuthenticationInfo `json:"authenticationInfo,omitempty"`
  197. // AuthorizationInfo: Authorization information. If there are
  198. // multiple
  199. // resources or permissions involved, then there is
  200. // one AuthorizationInfo element for each {resource, permission} tuple.
  201. AuthorizationInfo []*AuthorizationInfo `json:"authorizationInfo,omitempty"`
  202. // Metadata: Other service-specific data about the request, response,
  203. // and other
  204. // information associated with the current audited event.
  205. Metadata googleapi.RawMessage `json:"metadata,omitempty"`
  206. // MethodName: The name of the service method or operation.
  207. // For API calls, this should be the name of the API method.
  208. // For example,
  209. //
  210. // "google.datastore.v1.Datastore.RunQuery"
  211. // "google.logging.v1.LoggingService.DeleteLog"
  212. MethodName string `json:"methodName,omitempty"`
  213. // NumResponseItems: The number of items returned from a List or Query
  214. // API method,
  215. // if applicable.
  216. NumResponseItems int64 `json:"numResponseItems,omitempty,string"`
  217. // Request: The operation request. This may not include all request
  218. // parameters,
  219. // such as those that are too large, privacy-sensitive, or
  220. // duplicated
  221. // elsewhere in the log record.
  222. // It should never include user-generated data, such as file
  223. // contents.
  224. // When the JSON object represented here has a proto equivalent, the
  225. // proto
  226. // name will be indicated in the `@type` property.
  227. Request googleapi.RawMessage `json:"request,omitempty"`
  228. // RequestMetadata: Metadata about the operation.
  229. RequestMetadata *RequestMetadata `json:"requestMetadata,omitempty"`
  230. // ResourceLocation: The resource location information.
  231. ResourceLocation *ResourceLocation `json:"resourceLocation,omitempty"`
  232. // ResourceName: The resource or collection that is the target of the
  233. // operation.
  234. // The name is a scheme-less URI, not including the API service
  235. // name.
  236. // For example:
  237. //
  238. // "shelves/SHELF_ID/books"
  239. // "shelves/SHELF_ID/books/BOOK_ID"
  240. ResourceName string `json:"resourceName,omitempty"`
  241. // Response: The operation response. This may not include all response
  242. // elements,
  243. // such as those that are too large, privacy-sensitive, or
  244. // duplicated
  245. // elsewhere in the log record.
  246. // It should never include user-generated data, such as file
  247. // contents.
  248. // When the JSON object represented here has a proto equivalent, the
  249. // proto
  250. // name will be indicated in the `@type` property.
  251. Response googleapi.RawMessage `json:"response,omitempty"`
  252. // ServiceData: Deprecated, use `metadata` field instead.
  253. // Other service-specific data about the request, response, and
  254. // other
  255. // activities.
  256. ServiceData googleapi.RawMessage `json:"serviceData,omitempty"`
  257. // ServiceName: The name of the API service performing the operation.
  258. // For example,
  259. // "datastore.googleapis.com".
  260. ServiceName string `json:"serviceName,omitempty"`
  261. // Status: The status of the overall operation.
  262. Status *Status `json:"status,omitempty"`
  263. // ForceSendFields is a list of field names (e.g. "AuthenticationInfo")
  264. // to unconditionally include in API requests. By default, fields with
  265. // empty values are omitted from API requests. However, any non-pointer,
  266. // non-interface field appearing in ForceSendFields will be sent to the
  267. // server regardless of whether the field is empty or not. This may be
  268. // used to include empty fields in Patch requests.
  269. ForceSendFields []string `json:"-"`
  270. // NullFields is a list of field names (e.g. "AuthenticationInfo") to
  271. // include in API requests with the JSON null value. By default, fields
  272. // with empty values are omitted from API requests. However, any field
  273. // with an empty value appearing in NullFields will be sent to the
  274. // server as null. It is an error if a field in this list has a
  275. // non-empty value. This may be used to include null fields in Patch
  276. // requests.
  277. NullFields []string `json:"-"`
  278. }
  279. func (s *AuditLog) MarshalJSON() ([]byte, error) {
  280. type NoMethod AuditLog
  281. raw := NoMethod(*s)
  282. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  283. }
  284. // Auth: This message defines request authentication attributes.
  285. // Terminology is
  286. // based on the JSON Web Token (JWT) standard, but the terms
  287. // also
  288. // correlate to concepts in other standards.
  289. type Auth struct {
  290. // AccessLevels: A list of access level resource names that allow
  291. // resources to be
  292. // accessed by authenticated requester. It is part of Secure GCP
  293. // processing
  294. // for the incoming request. An access level string has the
  295. // format:
  296. // "//{api_service_name}/accessPolicies/{policy_id}/accessLevels/
  297. // {short_name}"
  298. //
  299. // Example:
  300. // "//accesscontextmanager.googleapis.com/accessP
  301. // olicies/MY_POLICY_ID/accessLevels/MY_LEVEL"
  302. AccessLevels []string `json:"accessLevels,omitempty"`
  303. // Audiences: The intended audience(s) for this authentication
  304. // information. Reflects
  305. // the audience (`aud`) claim within a JWT. The audience
  306. // value(s) depends on the `issuer`, but typically include one or more
  307. // of
  308. // the following pieces of information:
  309. //
  310. // * The services intended to receive the credential such as
  311. // ["pubsub.googleapis.com", "storage.googleapis.com"]
  312. // * A set of service-based scopes. For example,
  313. // ["https://www.googleapis.com/auth/cloud-platform"]
  314. // * The client id of an app, such as the Firebase project id for JWTs
  315. // from Firebase Auth.
  316. //
  317. // Consult the documentation for the credential issuer to determine
  318. // the
  319. // information provided.
  320. Audiences []string `json:"audiences,omitempty"`
  321. // Claims: Structured claims presented with the credential. JWTs
  322. // include
  323. // `{key: value}` pairs for standard and private claims. The
  324. // following
  325. // is a subset of the standard required and optional claims that
  326. // would
  327. // typically be presented for a Google-based JWT:
  328. //
  329. // {'iss': 'accounts.google.com',
  330. // 'sub': '113289723416554971153',
  331. // 'aud': ['123456789012', 'pubsub.googleapis.com'],
  332. // 'azp': '123456789012.apps.googleusercontent.com',
  333. // 'email': 'jsmith@example.com',
  334. // 'iat': 1353601026,
  335. // 'exp': 1353604926}
  336. //
  337. // SAML assertions are similarly specified, but with an identity
  338. // provider
  339. // dependent structure.
  340. Claims googleapi.RawMessage `json:"claims,omitempty"`
  341. // Presenter: The authorized presenter of the credential. Reflects the
  342. // optional
  343. // Authorized Presenter (`azp`) claim within a JWT or the
  344. // OAuth client id. For example, a Google Cloud Platform client id
  345. // looks
  346. // as follows: "123456789012.apps.googleusercontent.com".
  347. Presenter string `json:"presenter,omitempty"`
  348. // Principal: The authenticated principal. Reflects the issuer (`iss`)
  349. // and subject
  350. // (`sub`) claims within a JWT. The issuer and subject should be
  351. // `/`
  352. // delimited, with `/` percent-encoded within the subject fragment.
  353. // For
  354. // Google accounts, the principal format
  355. // is:
  356. // "https://accounts.google.com/{id}"
  357. Principal string `json:"principal,omitempty"`
  358. // ForceSendFields is a list of field names (e.g. "AccessLevels") to
  359. // unconditionally include in API requests. By default, fields with
  360. // empty values are omitted from API requests. However, any non-pointer,
  361. // non-interface field appearing in ForceSendFields will be sent to the
  362. // server regardless of whether the field is empty or not. This may be
  363. // used to include empty fields in Patch requests.
  364. ForceSendFields []string `json:"-"`
  365. // NullFields is a list of field names (e.g. "AccessLevels") to include
  366. // in API requests with the JSON null value. By default, fields with
  367. // empty values are omitted from API requests. However, any field with
  368. // an empty value appearing in NullFields will be sent to the server as
  369. // null. It is an error if a field in this list has a non-empty value.
  370. // This may be used to include null fields in Patch requests.
  371. NullFields []string `json:"-"`
  372. }
  373. func (s *Auth) MarshalJSON() ([]byte, error) {
  374. type NoMethod Auth
  375. raw := NoMethod(*s)
  376. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  377. }
  378. // AuthenticationInfo: Authentication information for the operation.
  379. type AuthenticationInfo struct {
  380. // AuthoritySelector: The authority selector specified by the requestor,
  381. // if any.
  382. // It is not guaranteed that the principal was allowed to use this
  383. // authority.
  384. AuthoritySelector string `json:"authoritySelector,omitempty"`
  385. // PrincipalEmail: The email address of the authenticated user (or
  386. // service account on behalf
  387. // of third party principal) making the request. For privacy reasons,
  388. // the
  389. // principal email address is redacted for all read-only operations that
  390. // fail
  391. // with a "permission denied" error.
  392. PrincipalEmail string `json:"principalEmail,omitempty"`
  393. // ThirdPartyPrincipal: The third party identification (if any) of the
  394. // authenticated user making
  395. // the request.
  396. // When the JSON object represented here has a proto equivalent, the
  397. // proto
  398. // name will be indicated in the `@type` property.
  399. ThirdPartyPrincipal googleapi.RawMessage `json:"thirdPartyPrincipal,omitempty"`
  400. // ForceSendFields is a list of field names (e.g. "AuthoritySelector")
  401. // to unconditionally include in API requests. By default, fields with
  402. // empty values are omitted from API requests. However, any non-pointer,
  403. // non-interface field appearing in ForceSendFields will be sent to the
  404. // server regardless of whether the field is empty or not. This may be
  405. // used to include empty fields in Patch requests.
  406. ForceSendFields []string `json:"-"`
  407. // NullFields is a list of field names (e.g. "AuthoritySelector") to
  408. // include in API requests with the JSON null value. By default, fields
  409. // with empty values are omitted from API requests. However, any field
  410. // with an empty value appearing in NullFields will be sent to the
  411. // server as null. It is an error if a field in this list has a
  412. // non-empty value. This may be used to include null fields in Patch
  413. // requests.
  414. NullFields []string `json:"-"`
  415. }
  416. func (s *AuthenticationInfo) MarshalJSON() ([]byte, error) {
  417. type NoMethod AuthenticationInfo
  418. raw := NoMethod(*s)
  419. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  420. }
  421. // AuthorizationInfo: Authorization information for the operation.
  422. type AuthorizationInfo struct {
  423. // Granted: Whether or not authorization for `resource` and
  424. // `permission`
  425. // was granted.
  426. Granted bool `json:"granted,omitempty"`
  427. // Permission: The required IAM permission.
  428. Permission string `json:"permission,omitempty"`
  429. // Resource: The resource being accessed, as a REST-style string. For
  430. // example:
  431. //
  432. // bigquery.googleapis.com/projects/PROJECTID/datasets/DATASETID
  433. Resource string `json:"resource,omitempty"`
  434. // ResourceAttributes: Resource attributes used in IAM condition
  435. // evaluation. This field contains
  436. // resource attributes like resource type and resource name.
  437. //
  438. // To get the whole view of the attributes used in IAM
  439. // condition evaluation, the user must also look
  440. // into
  441. // `AuditLog.request_metadata.request_attributes`.
  442. ResourceAttributes *Resource `json:"resourceAttributes,omitempty"`
  443. // ForceSendFields is a list of field names (e.g. "Granted") to
  444. // unconditionally include in API requests. By default, fields with
  445. // empty values are omitted from API requests. However, any non-pointer,
  446. // non-interface field appearing in ForceSendFields will be sent to the
  447. // server regardless of whether the field is empty or not. This may be
  448. // used to include empty fields in Patch requests.
  449. ForceSendFields []string `json:"-"`
  450. // NullFields is a list of field names (e.g. "Granted") to include in
  451. // API requests with the JSON null value. By default, fields with empty
  452. // values are omitted from API requests. However, any field with an
  453. // empty value appearing in NullFields will be sent to the server as
  454. // null. It is an error if a field in this list has a non-empty value.
  455. // This may be used to include null fields in Patch requests.
  456. NullFields []string `json:"-"`
  457. }
  458. func (s *AuthorizationInfo) MarshalJSON() ([]byte, error) {
  459. type NoMethod AuthorizationInfo
  460. raw := NoMethod(*s)
  461. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  462. }
  463. // CheckError: Defines the errors to be returned
  464. // in
  465. // google.api.servicecontrol.v1.CheckResponse.check_errors.
  466. type CheckError struct {
  467. // Code: The error code.
  468. //
  469. // Possible values:
  470. // "ERROR_CODE_UNSPECIFIED" - This is never used in `CheckResponse`.
  471. // "NOT_FOUND" - The consumer's project id, network container, or
  472. // resource container was
  473. // not found. Same as google.rpc.Code.NOT_FOUND.
  474. // "PERMISSION_DENIED" - The consumer doesn't have access to the
  475. // specified resource.
  476. // Same as google.rpc.Code.PERMISSION_DENIED.
  477. // "RESOURCE_EXHAUSTED" - Quota check failed. Same as
  478. // google.rpc.Code.RESOURCE_EXHAUSTED.
  479. // "BUDGET_EXCEEDED" - Budget check failed.
  480. // "DENIAL_OF_SERVICE_DETECTED" - The consumer's request has been
  481. // flagged as a DoS attack.
  482. // "LOAD_SHEDDING" - The consumer's request should be rejected in
  483. // order to protect the service
  484. // from being overloaded.
  485. // "ABUSER_DETECTED" - The consumer has been flagged as an abuser.
  486. // "SERVICE_NOT_ACTIVATED" - The consumer hasn't activated the
  487. // service.
  488. // "VISIBILITY_DENIED" - The consumer cannot access the service due to
  489. // visibility configuration.
  490. // "BILLING_DISABLED" - The consumer cannot access the service because
  491. // billing is disabled.
  492. // "PROJECT_DELETED" - The consumer's project has been marked as
  493. // deleted (soft deletion).
  494. // "PROJECT_INVALID" - The consumer's project number or id does not
  495. // represent a valid project.
  496. // "IP_ADDRESS_BLOCKED" - The IP address of the consumer is invalid
  497. // for the specific consumer
  498. // project.
  499. // "REFERER_BLOCKED" - The referer address of the consumer request is
  500. // invalid for the specific
  501. // consumer project.
  502. // "CLIENT_APP_BLOCKED" - The client application of the consumer
  503. // request is invalid for the
  504. // specific consumer project.
  505. // "API_TARGET_BLOCKED" - The API targeted by this request is invalid
  506. // for the specified consumer
  507. // project.
  508. // "API_KEY_INVALID" - The consumer's API key is invalid.
  509. // "API_KEY_EXPIRED" - The consumer's API Key has expired.
  510. // "API_KEY_NOT_FOUND" - The consumer's API Key was not found in
  511. // config record.
  512. // "SPATULA_HEADER_INVALID" - The consumer's spatula header is
  513. // invalid.
  514. // "LOAS_ROLE_INVALID" - The consumer's LOAS role is invalid.
  515. // "NO_LOAS_PROJECT" - The consumer's LOAS role has no associated
  516. // project.
  517. // "LOAS_PROJECT_DISABLED" - The consumer's LOAS project is not
  518. // `ACTIVE` in LoquatV2.
  519. // "SECURITY_POLICY_VIOLATED" - Request is not allowed as per security
  520. // policies defined in Org Policy.
  521. // "INVALID_CREDENTIAL" - The credential in the request can not be
  522. // verified.
  523. // "NAMESPACE_LOOKUP_UNAVAILABLE" - The backend server for looking up
  524. // project id/number is unavailable.
  525. // "SERVICE_STATUS_UNAVAILABLE" - The backend server for checking
  526. // service status is unavailable.
  527. // "BILLING_STATUS_UNAVAILABLE" - The backend server for checking
  528. // billing status is unavailable.
  529. // "QUOTA_CHECK_UNAVAILABLE" - The backend server for checking quota
  530. // limits is unavailable.
  531. // "LOAS_PROJECT_LOOKUP_UNAVAILABLE" - The Spanner for looking up LOAS
  532. // project is unavailable.
  533. // "CLOUD_RESOURCE_MANAGER_BACKEND_UNAVAILABLE" - Cloud Resource
  534. // Manager backend server is unavailable.
  535. // "SECURITY_POLICY_BACKEND_UNAVAILABLE" - Backend server for
  536. // evaluating security policy is unavailable.
  537. Code string `json:"code,omitempty"`
  538. // Detail: Free-form text providing details on the error cause of the
  539. // error.
  540. Detail string `json:"detail,omitempty"`
  541. // Subject: Subject to whom this error applies. See the specific code
  542. // enum for more
  543. // details on this field. For example:
  544. // - “project:<project-id or project-number>”
  545. // - “folder:<folder-id>”
  546. // - “organization:<organization-id>”
  547. Subject string `json:"subject,omitempty"`
  548. // ForceSendFields is a list of field names (e.g. "Code") to
  549. // unconditionally include in API requests. By default, fields with
  550. // empty values are omitted from API requests. However, any non-pointer,
  551. // non-interface field appearing in ForceSendFields will be sent to the
  552. // server regardless of whether the field is empty or not. This may be
  553. // used to include empty fields in Patch requests.
  554. ForceSendFields []string `json:"-"`
  555. // NullFields is a list of field names (e.g. "Code") to include in API
  556. // requests with the JSON null value. By default, fields with empty
  557. // values are omitted from API requests. However, any field with an
  558. // empty value appearing in NullFields will be sent to the server as
  559. // null. It is an error if a field in this list has a non-empty value.
  560. // This may be used to include null fields in Patch requests.
  561. NullFields []string `json:"-"`
  562. }
  563. func (s *CheckError) MarshalJSON() ([]byte, error) {
  564. type NoMethod CheckError
  565. raw := NoMethod(*s)
  566. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  567. }
  568. // CheckInfo: Contains additional information about the check operation.
  569. type CheckInfo struct {
  570. // ConsumerInfo: Consumer info of this check.
  571. ConsumerInfo *ConsumerInfo `json:"consumerInfo,omitempty"`
  572. // UnusedArguments: A list of fields and label keys that are ignored by
  573. // the server.
  574. // The client doesn't need to send them for following requests to
  575. // improve
  576. // performance and allow better aggregation.
  577. UnusedArguments []string `json:"unusedArguments,omitempty"`
  578. // ForceSendFields is a list of field names (e.g. "ConsumerInfo") to
  579. // unconditionally include in API requests. By default, fields with
  580. // empty values are omitted from API requests. However, any non-pointer,
  581. // non-interface field appearing in ForceSendFields will be sent to the
  582. // server regardless of whether the field is empty or not. This may be
  583. // used to include empty fields in Patch requests.
  584. ForceSendFields []string `json:"-"`
  585. // NullFields is a list of field names (e.g. "ConsumerInfo") to include
  586. // in API requests with the JSON null value. By default, fields with
  587. // empty values are omitted from API requests. However, any field with
  588. // an empty value appearing in NullFields will be sent to the server as
  589. // null. It is an error if a field in this list has a non-empty value.
  590. // This may be used to include null fields in Patch requests.
  591. NullFields []string `json:"-"`
  592. }
  593. func (s *CheckInfo) MarshalJSON() ([]byte, error) {
  594. type NoMethod CheckInfo
  595. raw := NoMethod(*s)
  596. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  597. }
  598. // CheckRequest: Request message for the Check method.
  599. type CheckRequest struct {
  600. // Operation: The operation to be checked.
  601. Operation *Operation `json:"operation,omitempty"`
  602. // RequestProjectSettings: Requests the project settings to be returned
  603. // as part of the check response.
  604. RequestProjectSettings bool `json:"requestProjectSettings,omitempty"`
  605. // ServiceConfigId: Specifies which version of service configuration
  606. // should be used to process
  607. // the request.
  608. //
  609. // If unspecified or no matching version can be found, the
  610. // latest one will be used.
  611. ServiceConfigId string `json:"serviceConfigId,omitempty"`
  612. // SkipActivationCheck: Indicates if service activation check should be
  613. // skipped for this request.
  614. // Default behavior is to perform the check and apply relevant quota.
  615. SkipActivationCheck bool `json:"skipActivationCheck,omitempty"`
  616. // ForceSendFields is a list of field names (e.g. "Operation") to
  617. // unconditionally include in API requests. By default, fields with
  618. // empty values are omitted from API requests. However, any non-pointer,
  619. // non-interface field appearing in ForceSendFields will be sent to the
  620. // server regardless of whether the field is empty or not. This may be
  621. // used to include empty fields in Patch requests.
  622. ForceSendFields []string `json:"-"`
  623. // NullFields is a list of field names (e.g. "Operation") to include in
  624. // API requests with the JSON null value. By default, fields with empty
  625. // values are omitted from API requests. However, any field with an
  626. // empty value appearing in NullFields will be sent to the server as
  627. // null. It is an error if a field in this list has a non-empty value.
  628. // This may be used to include null fields in Patch requests.
  629. NullFields []string `json:"-"`
  630. }
  631. func (s *CheckRequest) MarshalJSON() ([]byte, error) {
  632. type NoMethod CheckRequest
  633. raw := NoMethod(*s)
  634. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  635. }
  636. // CheckResponse: Response message for the Check method.
  637. type CheckResponse struct {
  638. // CheckErrors: Indicate the decision of the check.
  639. //
  640. // If no check errors are present, the service should process the
  641. // operation.
  642. // Otherwise the service should use the list of errors to determine
  643. // the
  644. // appropriate action.
  645. CheckErrors []*CheckError `json:"checkErrors,omitempty"`
  646. // CheckInfo: Feedback data returned from the server during processing a
  647. // Check request.
  648. CheckInfo *CheckInfo `json:"checkInfo,omitempty"`
  649. // OperationId: The same operation_id value used in the
  650. // CheckRequest.
  651. // Used for logging and diagnostics purposes.
  652. OperationId string `json:"operationId,omitempty"`
  653. // QuotaInfo: Quota information for the check request associated with
  654. // this response.
  655. //
  656. QuotaInfo *QuotaInfo `json:"quotaInfo,omitempty"`
  657. // ServiceConfigId: The actual config id used to process the request.
  658. ServiceConfigId string `json:"serviceConfigId,omitempty"`
  659. // ServerResponse contains the HTTP response code and headers from the
  660. // server.
  661. googleapi.ServerResponse `json:"-"`
  662. // ForceSendFields is a list of field names (e.g. "CheckErrors") to
  663. // unconditionally include in API requests. By default, fields with
  664. // empty values are omitted from API requests. However, any non-pointer,
  665. // non-interface field appearing in ForceSendFields will be sent to the
  666. // server regardless of whether the field is empty or not. This may be
  667. // used to include empty fields in Patch requests.
  668. ForceSendFields []string `json:"-"`
  669. // NullFields is a list of field names (e.g. "CheckErrors") to include
  670. // in API requests with the JSON null value. By default, fields with
  671. // empty values are omitted from API requests. However, any field with
  672. // an empty value appearing in NullFields will be sent to the server as
  673. // null. It is an error if a field in this list has a non-empty value.
  674. // This may be used to include null fields in Patch requests.
  675. NullFields []string `json:"-"`
  676. }
  677. func (s *CheckResponse) MarshalJSON() ([]byte, error) {
  678. type NoMethod CheckResponse
  679. raw := NoMethod(*s)
  680. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  681. }
  682. // ConsumerInfo: `ConsumerInfo` provides information about the consumer
  683. // project.
  684. type ConsumerInfo struct {
  685. // ProjectNumber: The Google cloud project number, e.g. 1234567890. A
  686. // value of 0 indicates
  687. // no project number is found.
  688. ProjectNumber int64 `json:"projectNumber,omitempty,string"`
  689. // ForceSendFields is a list of field names (e.g. "ProjectNumber") to
  690. // unconditionally include in API requests. By default, fields with
  691. // empty values are omitted from API requests. However, any non-pointer,
  692. // non-interface field appearing in ForceSendFields will be sent to the
  693. // server regardless of whether the field is empty or not. This may be
  694. // used to include empty fields in Patch requests.
  695. ForceSendFields []string `json:"-"`
  696. // NullFields is a list of field names (e.g. "ProjectNumber") to include
  697. // in API requests with the JSON null value. By default, fields with
  698. // empty values are omitted from API requests. However, any field with
  699. // an empty value appearing in NullFields will be sent to the server as
  700. // null. It is an error if a field in this list has a non-empty value.
  701. // This may be used to include null fields in Patch requests.
  702. NullFields []string `json:"-"`
  703. }
  704. func (s *ConsumerInfo) MarshalJSON() ([]byte, error) {
  705. type NoMethod ConsumerInfo
  706. raw := NoMethod(*s)
  707. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  708. }
  709. // Distribution: Distribution represents a frequency distribution of
  710. // double-valued sample
  711. // points. It contains the size of the population of sample points
  712. // plus
  713. // additional optional information:
  714. //
  715. // - the arithmetic mean of the samples
  716. // - the minimum and maximum of the samples
  717. // - the sum-squared-deviation of the samples, used to compute
  718. // variance
  719. // - a histogram of the values of the sample points
  720. type Distribution struct {
  721. // BucketCounts: The number of samples in each histogram bucket.
  722. // `bucket_counts` are
  723. // optional. If present, they must sum to the `count` value.
  724. //
  725. // The buckets are defined below in `bucket_option`. There are N
  726. // buckets.
  727. // `bucket_counts[0]` is the number of samples in the underflow
  728. // bucket.
  729. // `bucket_counts[1]` to `bucket_counts[N-1]` are the numbers of
  730. // samples
  731. // in each of the finite buckets. And `bucket_counts[N] is the number
  732. // of samples in the overflow bucket. See the comments of
  733. // `bucket_option`
  734. // below for more details.
  735. //
  736. // Any suffix of trailing zeros may be omitted.
  737. BucketCounts googleapi.Int64s `json:"bucketCounts,omitempty"`
  738. // Count: The total number of samples in the distribution. Must be >= 0.
  739. Count int64 `json:"count,omitempty,string"`
  740. // ExplicitBuckets: Buckets with arbitrary user-provided width.
  741. ExplicitBuckets *ExplicitBuckets `json:"explicitBuckets,omitempty"`
  742. // ExponentialBuckets: Buckets with exponentially growing width.
  743. ExponentialBuckets *ExponentialBuckets `json:"exponentialBuckets,omitempty"`
  744. // LinearBuckets: Buckets with constant width.
  745. LinearBuckets *LinearBuckets `json:"linearBuckets,omitempty"`
  746. // Maximum: The maximum of the population of values. Ignored if `count`
  747. // is zero.
  748. Maximum float64 `json:"maximum,omitempty"`
  749. // Mean: The arithmetic mean of the samples in the distribution. If
  750. // `count` is
  751. // zero then this field must be zero.
  752. Mean float64 `json:"mean,omitempty"`
  753. // Minimum: The minimum of the population of values. Ignored if `count`
  754. // is zero.
  755. Minimum float64 `json:"minimum,omitempty"`
  756. // SumOfSquaredDeviation: The sum of squared deviations from the mean:
  757. // Sum[i=1..count]((x_i - mean)^2)
  758. // where each x_i is a sample values. If `count` is zero then this
  759. // field
  760. // must be zero, otherwise validation of the request fails.
  761. SumOfSquaredDeviation float64 `json:"sumOfSquaredDeviation,omitempty"`
  762. // ForceSendFields is a list of field names (e.g. "BucketCounts") to
  763. // unconditionally include in API requests. By default, fields with
  764. // empty values are omitted from API requests. However, any non-pointer,
  765. // non-interface field appearing in ForceSendFields will be sent to the
  766. // server regardless of whether the field is empty or not. This may be
  767. // used to include empty fields in Patch requests.
  768. ForceSendFields []string `json:"-"`
  769. // NullFields is a list of field names (e.g. "BucketCounts") to include
  770. // in API requests with the JSON null value. By default, fields with
  771. // empty values are omitted from API requests. However, any field with
  772. // an empty value appearing in NullFields will be sent to the server as
  773. // null. It is an error if a field in this list has a non-empty value.
  774. // This may be used to include null fields in Patch requests.
  775. NullFields []string `json:"-"`
  776. }
  777. func (s *Distribution) MarshalJSON() ([]byte, error) {
  778. type NoMethod Distribution
  779. raw := NoMethod(*s)
  780. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  781. }
  782. func (s *Distribution) UnmarshalJSON(data []byte) error {
  783. type NoMethod Distribution
  784. var s1 struct {
  785. Maximum gensupport.JSONFloat64 `json:"maximum"`
  786. Mean gensupport.JSONFloat64 `json:"mean"`
  787. Minimum gensupport.JSONFloat64 `json:"minimum"`
  788. SumOfSquaredDeviation gensupport.JSONFloat64 `json:"sumOfSquaredDeviation"`
  789. *NoMethod
  790. }
  791. s1.NoMethod = (*NoMethod)(s)
  792. if err := json.Unmarshal(data, &s1); err != nil {
  793. return err
  794. }
  795. s.Maximum = float64(s1.Maximum)
  796. s.Mean = float64(s1.Mean)
  797. s.Minimum = float64(s1.Minimum)
  798. s.SumOfSquaredDeviation = float64(s1.SumOfSquaredDeviation)
  799. return nil
  800. }
  801. // EndReconciliationRequest: Request message for
  802. // QuotaController.EndReconciliation.
  803. type EndReconciliationRequest struct {
  804. // ReconciliationOperation: Operation that describes the quota
  805. // reconciliation.
  806. ReconciliationOperation *QuotaOperation `json:"reconciliationOperation,omitempty"`
  807. // ServiceConfigId: Specifies which version of service configuration
  808. // should be used to process
  809. // the request. If unspecified or no matching version can be found, the
  810. // latest
  811. // one will be used.
  812. ServiceConfigId string `json:"serviceConfigId,omitempty"`
  813. // ForceSendFields is a list of field names (e.g.
  814. // "ReconciliationOperation") to unconditionally include in API
  815. // requests. By default, fields with empty values are omitted from API
  816. // requests. However, any non-pointer, non-interface field appearing in
  817. // ForceSendFields will be sent to the server regardless of whether the
  818. // field is empty or not. This may be used to include empty fields in
  819. // Patch requests.
  820. ForceSendFields []string `json:"-"`
  821. // NullFields is a list of field names (e.g. "ReconciliationOperation")
  822. // to include in API requests with the JSON null value. By default,
  823. // fields with empty values are omitted from API requests. However, any
  824. // field with an empty value appearing in NullFields will be sent to the
  825. // server as null. It is an error if a field in this list has a
  826. // non-empty value. This may be used to include null fields in Patch
  827. // requests.
  828. NullFields []string `json:"-"`
  829. }
  830. func (s *EndReconciliationRequest) MarshalJSON() ([]byte, error) {
  831. type NoMethod EndReconciliationRequest
  832. raw := NoMethod(*s)
  833. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  834. }
  835. // EndReconciliationResponse: Response message for
  836. // QuotaController.EndReconciliation.
  837. type EndReconciliationResponse struct {
  838. // OperationId: The same operation_id value used in the
  839. // EndReconciliationRequest. Used for
  840. // logging and diagnostics purposes.
  841. OperationId string `json:"operationId,omitempty"`
  842. // QuotaMetrics: Metric values as tracked by One Platform before the
  843. // adjustment was made.
  844. // The following metrics will be included:
  845. //
  846. // 1. Per quota metric total usage will be specified using the following
  847. // gauge
  848. // metric:
  849. //
  850. // "serviceruntime.googleapis.com/allocation/consumer/quota_used_count"
  851. //
  852. //
  853. // 2. Value for each quota limit associated with the metrics will be
  854. // specified
  855. // using the following gauge metric:
  856. // "serviceruntime.googleapis.com/quota/limit"
  857. //
  858. // 3. Delta value of the usage after the reconciliation for limits
  859. // associated
  860. // with the metrics will be specified using the following metric:
  861. // "serviceruntime.googleapis.com/allocation/reconciliation_delta"
  862. // The delta value is defined as:
  863. // new_usage_from_client - existing_value_in_spanner.
  864. // This metric is not defined in serviceruntime.yaml or in Cloud
  865. // Monarch.
  866. // This metric is meant for callers' use only. Since this metric is
  867. // not
  868. // defined in the monitoring backend, reporting on this metric will
  869. // result in
  870. // an error.
  871. QuotaMetrics []*MetricValueSet `json:"quotaMetrics,omitempty"`
  872. // ReconciliationErrors: Indicates the decision of the reconciliation
  873. // end.
  874. ReconciliationErrors []*QuotaError `json:"reconciliationErrors,omitempty"`
  875. // ServiceConfigId: ID of the actual config used to process the request.
  876. ServiceConfigId string `json:"serviceConfigId,omitempty"`
  877. // ServerResponse contains the HTTP response code and headers from the
  878. // server.
  879. googleapi.ServerResponse `json:"-"`
  880. // ForceSendFields is a list of field names (e.g. "OperationId") to
  881. // unconditionally include in API requests. By default, fields with
  882. // empty values are omitted from API requests. However, any non-pointer,
  883. // non-interface field appearing in ForceSendFields will be sent to the
  884. // server regardless of whether the field is empty or not. This may be
  885. // used to include empty fields in Patch requests.
  886. ForceSendFields []string `json:"-"`
  887. // NullFields is a list of field names (e.g. "OperationId") to include
  888. // in API requests with the JSON null value. By default, fields with
  889. // empty values are omitted from API requests. However, any field with
  890. // an empty value appearing in NullFields will be sent to the server as
  891. // null. It is an error if a field in this list has a non-empty value.
  892. // This may be used to include null fields in Patch requests.
  893. NullFields []string `json:"-"`
  894. }
  895. func (s *EndReconciliationResponse) MarshalJSON() ([]byte, error) {
  896. type NoMethod EndReconciliationResponse
  897. raw := NoMethod(*s)
  898. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  899. }
  900. // ExplicitBuckets: Describing buckets with arbitrary user-provided
  901. // width.
  902. type ExplicitBuckets struct {
  903. // Bounds: 'bound' is a list of strictly increasing boundaries
  904. // between
  905. // buckets. Note that a list of length N-1 defines N buckets because
  906. // of fenceposting. See comments on `bucket_options` for details.
  907. //
  908. // The i'th finite bucket covers the interval
  909. // [bound[i-1], bound[i])
  910. // where i ranges from 1 to bound_size() - 1. Note that there are
  911. // no
  912. // finite buckets at all if 'bound' only contains a single element;
  913. // in
  914. // that special case the single bound defines the boundary between
  915. // the
  916. // underflow and overflow buckets.
  917. //
  918. // bucket number lower bound upper bound
  919. // i == 0 (underflow) -inf bound[i]
  920. // 0 < i < bound_size() bound[i-1] bound[i]
  921. // i == bound_size() (overflow) bound[i-1] +inf
  922. Bounds []float64 `json:"bounds,omitempty"`
  923. // ForceSendFields is a list of field names (e.g. "Bounds") to
  924. // unconditionally include in API requests. By default, fields with
  925. // empty values are omitted from API requests. However, any non-pointer,
  926. // non-interface field appearing in ForceSendFields will be sent to the
  927. // server regardless of whether the field is empty or not. This may be
  928. // used to include empty fields in Patch requests.
  929. ForceSendFields []string `json:"-"`
  930. // NullFields is a list of field names (e.g. "Bounds") to include in API
  931. // requests with the JSON null value. By default, fields with empty
  932. // values are omitted from API requests. However, any field with an
  933. // empty value appearing in NullFields will be sent to the server as
  934. // null. It is an error if a field in this list has a non-empty value.
  935. // This may be used to include null fields in Patch requests.
  936. NullFields []string `json:"-"`
  937. }
  938. func (s *ExplicitBuckets) MarshalJSON() ([]byte, error) {
  939. type NoMethod ExplicitBuckets
  940. raw := NoMethod(*s)
  941. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  942. }
  943. // ExponentialBuckets: Describing buckets with exponentially growing
  944. // width.
  945. type ExponentialBuckets struct {
  946. // GrowthFactor: The i'th exponential bucket covers the interval
  947. // [scale * growth_factor^(i-1), scale * growth_factor^i)
  948. // where i ranges from 1 to num_finite_buckets inclusive.
  949. // Must be larger than 1.0.
  950. GrowthFactor float64 `json:"growthFactor,omitempty"`
  951. // NumFiniteBuckets: The number of finite buckets. With the underflow
  952. // and overflow buckets,
  953. // the total number of buckets is `num_finite_buckets` + 2.
  954. // See comments on `bucket_options` for details.
  955. NumFiniteBuckets int64 `json:"numFiniteBuckets,omitempty"`
  956. // Scale: The i'th exponential bucket covers the interval
  957. // [scale * growth_factor^(i-1), scale * growth_factor^i)
  958. // where i ranges from 1 to num_finite_buckets inclusive.
  959. // Must be > 0.
  960. Scale float64 `json:"scale,omitempty"`
  961. // ForceSendFields is a list of field names (e.g. "GrowthFactor") to
  962. // unconditionally include in API requests. By default, fields with
  963. // empty values are omitted from API requests. However, any non-pointer,
  964. // non-interface field appearing in ForceSendFields will be sent to the
  965. // server regardless of whether the field is empty or not. This may be
  966. // used to include empty fields in Patch requests.
  967. ForceSendFields []string `json:"-"`
  968. // NullFields is a list of field names (e.g. "GrowthFactor") to include
  969. // in API requests with the JSON null value. By default, fields with
  970. // empty values are omitted from API requests. However, any field with
  971. // an empty value appearing in NullFields will be sent to the server as
  972. // null. It is an error if a field in this list has a non-empty value.
  973. // This may be used to include null fields in Patch requests.
  974. NullFields []string `json:"-"`
  975. }
  976. func (s *ExponentialBuckets) MarshalJSON() ([]byte, error) {
  977. type NoMethod ExponentialBuckets
  978. raw := NoMethod(*s)
  979. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  980. }
  981. func (s *ExponentialBuckets) UnmarshalJSON(data []byte) error {
  982. type NoMethod ExponentialBuckets
  983. var s1 struct {
  984. GrowthFactor gensupport.JSONFloat64 `json:"growthFactor"`
  985. Scale gensupport.JSONFloat64 `json:"scale"`
  986. *NoMethod
  987. }
  988. s1.NoMethod = (*NoMethod)(s)
  989. if err := json.Unmarshal(data, &s1); err != nil {
  990. return err
  991. }
  992. s.GrowthFactor = float64(s1.GrowthFactor)
  993. s.Scale = float64(s1.Scale)
  994. return nil
  995. }
  996. // LinearBuckets: Describing buckets with constant width.
  997. type LinearBuckets struct {
  998. // NumFiniteBuckets: The number of finite buckets. With the underflow
  999. // and overflow buckets,
  1000. // the total number of buckets is `num_finite_buckets` + 2.
  1001. // See comments on `bucket_options` for details.
  1002. NumFiniteBuckets int64 `json:"numFiniteBuckets,omitempty"`
  1003. // Offset: The i'th linear bucket covers the interval
  1004. // [offset + (i-1) * width, offset + i * width)
  1005. // where i ranges from 1 to num_finite_buckets, inclusive.
  1006. Offset float64 `json:"offset,omitempty"`
  1007. // Width: The i'th linear bucket covers the interval
  1008. // [offset + (i-1) * width, offset + i * width)
  1009. // where i ranges from 1 to num_finite_buckets, inclusive.
  1010. // Must be strictly positive.
  1011. Width float64 `json:"width,omitempty"`
  1012. // ForceSendFields is a list of field names (e.g. "NumFiniteBuckets") to
  1013. // unconditionally include in API requests. By default, fields with
  1014. // empty values are omitted from API requests. However, any non-pointer,
  1015. // non-interface field appearing in ForceSendFields will be sent to the
  1016. // server regardless of whether the field is empty or not. This may be
  1017. // used to include empty fields in Patch requests.
  1018. ForceSendFields []string `json:"-"`
  1019. // NullFields is a list of field names (e.g. "NumFiniteBuckets") to
  1020. // include in API requests with the JSON null value. By default, fields
  1021. // with empty values are omitted from API requests. However, any field
  1022. // with an empty value appearing in NullFields will be sent to the
  1023. // server as null. It is an error if a field in this list has a
  1024. // non-empty value. This may be used to include null fields in Patch
  1025. // requests.
  1026. NullFields []string `json:"-"`
  1027. }
  1028. func (s *LinearBuckets) MarshalJSON() ([]byte, error) {
  1029. type NoMethod LinearBuckets
  1030. raw := NoMethod(*s)
  1031. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1032. }
  1033. func (s *LinearBuckets) UnmarshalJSON(data []byte) error {
  1034. type NoMethod LinearBuckets
  1035. var s1 struct {
  1036. Offset gensupport.JSONFloat64 `json:"offset"`
  1037. Width gensupport.JSONFloat64 `json:"width"`
  1038. *NoMethod
  1039. }
  1040. s1.NoMethod = (*NoMethod)(s)
  1041. if err := json.Unmarshal(data, &s1); err != nil {
  1042. return err
  1043. }
  1044. s.Offset = float64(s1.Offset)
  1045. s.Width = float64(s1.Width)
  1046. return nil
  1047. }
  1048. // LogEntry: An individual log entry.
  1049. type LogEntry struct {
  1050. // InsertId: A unique ID for the log entry used for deduplication. If
  1051. // omitted,
  1052. // the implementation will generate one based on operation_id.
  1053. InsertId string `json:"insertId,omitempty"`
  1054. // Labels: A set of user-defined (key, value) data that provides
  1055. // additional
  1056. // information about the log entry.
  1057. Labels map[string]string `json:"labels,omitempty"`
  1058. // Name: Required. The log to which this log entry belongs. Examples:
  1059. // "syslog",
  1060. // "book_log".
  1061. Name string `json:"name,omitempty"`
  1062. // ProtoPayload: The log entry payload, represented as a protocol buffer
  1063. // that is
  1064. // expressed as a JSON object. The only accepted type currently
  1065. // is
  1066. // AuditLog.
  1067. ProtoPayload googleapi.RawMessage `json:"protoPayload,omitempty"`
  1068. // Severity: The severity of the log entry. The default value
  1069. // is
  1070. // `LogSeverity.DEFAULT`.
  1071. //
  1072. // Possible values:
  1073. // "DEFAULT" - (0) The log entry has no assigned severity level.
  1074. // "DEBUG" - (100) Debug or trace information.
  1075. // "INFO" - (200) Routine information, such as ongoing status or
  1076. // performance.
  1077. // "NOTICE" - (300) Normal but significant events, such as start up,
  1078. // shut down, or
  1079. // a configuration change.
  1080. // "WARNING" - (400) Warning events might cause problems.
  1081. // "ERROR" - (500) Error events are likely to cause problems.
  1082. // "CRITICAL" - (600) Critical events cause more severe problems or
  1083. // outages.
  1084. // "ALERT" - (700) A person must take an action immediately.
  1085. // "EMERGENCY" - (800) One or more systems are unusable.
  1086. Severity string `json:"severity,omitempty"`
  1087. // StructPayload: The log entry payload, represented as a structure
  1088. // that
  1089. // is expressed as a JSON object.
  1090. StructPayload googleapi.RawMessage `json:"structPayload,omitempty"`
  1091. // TextPayload: The log entry payload, represented as a Unicode string
  1092. // (UTF-8).
  1093. TextPayload string `json:"textPayload,omitempty"`
  1094. // Timestamp: The time the event described by the log entry occurred.
  1095. // If
  1096. // omitted, defaults to operation start time.
  1097. Timestamp string `json:"timestamp,omitempty"`
  1098. // ForceSendFields is a list of field names (e.g. "InsertId") to
  1099. // unconditionally include in API requests. By default, fields with
  1100. // empty values are omitted from API requests. However, any non-pointer,
  1101. // non-interface field appearing in ForceSendFields will be sent to the
  1102. // server regardless of whether the field is empty or not. This may be
  1103. // used to include empty fields in Patch requests.
  1104. ForceSendFields []string `json:"-"`
  1105. // NullFields is a list of field names (e.g. "InsertId") to include in
  1106. // API requests with the JSON null value. By default, fields with empty
  1107. // values are omitted from API requests. However, any field with an
  1108. // empty value appearing in NullFields will be sent to the server as
  1109. // null. It is an error if a field in this list has a non-empty value.
  1110. // This may be used to include null fields in Patch requests.
  1111. NullFields []string `json:"-"`
  1112. }
  1113. func (s *LogEntry) MarshalJSON() ([]byte, error) {
  1114. type NoMethod LogEntry
  1115. raw := NoMethod(*s)
  1116. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1117. }
  1118. // MetricValue: Represents a single metric value.
  1119. type MetricValue struct {
  1120. // BoolValue: A boolean value.
  1121. BoolValue *bool `json:"boolValue,omitempty"`
  1122. // DistributionValue: A distribution value.
  1123. DistributionValue *Distribution `json:"distributionValue,omitempty"`
  1124. // DoubleValue: A double precision floating point value.
  1125. DoubleValue *float64 `json:"doubleValue,omitempty"`
  1126. // EndTime: The end of the time period over which this metric value's
  1127. // measurement
  1128. // applies.
  1129. EndTime string `json:"endTime,omitempty"`
  1130. // Int64Value: A signed 64-bit integer value.
  1131. Int64Value *int64 `json:"int64Value,omitempty,string"`
  1132. // Labels: The labels describing the metric value.
  1133. // See comments on google.api.servicecontrol.v1.Operation.labels for
  1134. // the overriding relationship.
  1135. Labels map[string]string `json:"labels,omitempty"`
  1136. // MoneyValue: A money value.
  1137. MoneyValue *Money `json:"moneyValue,omitempty"`
  1138. // StartTime: The start of the time period over which this metric
  1139. // value's measurement
  1140. // applies. The time period has different semantics for different
  1141. // metric
  1142. // types (cumulative, delta, and gauge). See the metric
  1143. // definition
  1144. // documentation in the service configuration for details.
  1145. StartTime string `json:"startTime,omitempty"`
  1146. // StringValue: A text string value.
  1147. StringValue *string `json:"stringValue,omitempty"`
  1148. // ForceSendFields is a list of field names (e.g. "BoolValue") to
  1149. // unconditionally include in API requests. By default, fields with
  1150. // empty values are omitted from API requests. However, any non-pointer,
  1151. // non-interface field appearing in ForceSendFields will be sent to the
  1152. // server regardless of whether the field is empty or not. This may be
  1153. // used to include empty fields in Patch requests.
  1154. ForceSendFields []string `json:"-"`
  1155. // NullFields is a list of field names (e.g. "BoolValue") to include in
  1156. // API requests with the JSON null value. By default, fields with empty
  1157. // values are omitted from API requests. However, any field with an
  1158. // empty value appearing in NullFields will be sent to the server as
  1159. // null. It is an error if a field in this list has a non-empty value.
  1160. // This may be used to include null fields in Patch requests.
  1161. NullFields []string `json:"-"`
  1162. }
  1163. func (s *MetricValue) MarshalJSON() ([]byte, error) {
  1164. type NoMethod MetricValue
  1165. raw := NoMethod(*s)
  1166. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1167. }
  1168. func (s *MetricValue) UnmarshalJSON(data []byte) error {
  1169. type NoMethod MetricValue
  1170. var s1 struct {
  1171. DoubleValue *gensupport.JSONFloat64 `json:"doubleValue"`
  1172. *NoMethod
  1173. }
  1174. s1.NoMethod = (*NoMethod)(s)
  1175. if err := json.Unmarshal(data, &s1); err != nil {
  1176. return err
  1177. }
  1178. if s1.DoubleValue != nil {
  1179. s.DoubleValue = (*float64)(s1.DoubleValue)
  1180. }
  1181. return nil
  1182. }
  1183. // MetricValueSet: Represents a set of metric values in the same
  1184. // metric.
  1185. // Each metric value in the set should have a unique combination of
  1186. // start time,
  1187. // end time, and label values.
  1188. type MetricValueSet struct {
  1189. // MetricName: The metric name defined in the service configuration.
  1190. MetricName string `json:"metricName,omitempty"`
  1191. // MetricValues: The values in this metric.
  1192. MetricValues []*MetricValue `json:"metricValues,omitempty"`
  1193. // ForceSendFields is a list of field names (e.g. "MetricName") to
  1194. // unconditionally include in API requests. By default, fields with
  1195. // empty values are omitted from API requests. However, any non-pointer,
  1196. // non-interface field appearing in ForceSendFields will be sent to the
  1197. // server regardless of whether the field is empty or not. This may be
  1198. // used to include empty fields in Patch requests.
  1199. ForceSendFields []string `json:"-"`
  1200. // NullFields is a list of field names (e.g. "MetricName") to include in
  1201. // API requests with the JSON null value. By default, fields with empty
  1202. // values are omitted from API requests. However, any field with an
  1203. // empty value appearing in NullFields will be sent to the server as
  1204. // null. It is an error if a field in this list has a non-empty value.
  1205. // This may be used to include null fields in Patch requests.
  1206. NullFields []string `json:"-"`
  1207. }
  1208. func (s *MetricValueSet) MarshalJSON() ([]byte, error) {
  1209. type NoMethod MetricValueSet
  1210. raw := NoMethod(*s)
  1211. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1212. }
  1213. // Money: Represents an amount of money with its currency type.
  1214. type Money struct {
  1215. // CurrencyCode: The 3-letter currency code defined in ISO 4217.
  1216. CurrencyCode string `json:"currencyCode,omitempty"`
  1217. // Nanos: Number of nano (10^-9) units of the amount.
  1218. // The value must be between -999,999,999 and +999,999,999 inclusive.
  1219. // If `units` is positive, `nanos` must be positive or zero.
  1220. // If `units` is zero, `nanos` can be positive, zero, or negative.
  1221. // If `units` is negative, `nanos` must be negative or zero.
  1222. // For example $-1.75 is represented as `units`=-1 and
  1223. // `nanos`=-750,000,000.
  1224. Nanos int64 `json:"nanos,omitempty"`
  1225. // Units: The whole units of the amount.
  1226. // For example if `currencyCode` is "USD", then 1 unit is one US
  1227. // dollar.
  1228. Units int64 `json:"units,omitempty,string"`
  1229. // ForceSendFields is a list of field names (e.g. "CurrencyCode") to
  1230. // unconditionally include in API requests. By default, fields with
  1231. // empty values are omitted from API requests. However, any non-pointer,
  1232. // non-interface field appearing in ForceSendFields will be sent to the
  1233. // server regardless of whether the field is empty or not. This may be
  1234. // used to include empty fields in Patch requests.
  1235. ForceSendFields []string `json:"-"`
  1236. // NullFields is a list of field names (e.g. "CurrencyCode") to include
  1237. // in API requests with the JSON null value. By default, fields with
  1238. // empty values are omitted from API requests. However, any field with
  1239. // an empty value appearing in NullFields will be sent to the server as
  1240. // null. It is an error if a field in this list has a non-empty value.
  1241. // This may be used to include null fields in Patch requests.
  1242. NullFields []string `json:"-"`
  1243. }
  1244. func (s *Money) MarshalJSON() ([]byte, error) {
  1245. type NoMethod Money
  1246. raw := NoMethod(*s)
  1247. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1248. }
  1249. // Operation: Represents information regarding an operation.
  1250. type Operation struct {
  1251. // ConsumerId: Identity of the consumer who is using the service.
  1252. // This field should be filled in for the operations initiated by
  1253. // a
  1254. // consumer, but not for service-initiated operations that are
  1255. // not related to a specific consumer.
  1256. //
  1257. // This can be in one of the following formats:
  1258. // project:<project_id>,
  1259. // project_number:<project_number>,
  1260. // api_key:<api_key>.
  1261. ConsumerId string `json:"consumerId,omitempty"`
  1262. // EndTime: End time of the operation.
  1263. // Required when the operation is used in ServiceController.Report,
  1264. // but optional when the operation is used in ServiceController.Check.
  1265. EndTime string `json:"endTime,omitempty"`
  1266. // Importance: DO NOT USE. This is an experimental field.
  1267. //
  1268. // Possible values:
  1269. // "LOW" - The API implementation may cache and aggregate the
  1270. // data.
  1271. // The data may be lost when rare and unexpected system failures occur.
  1272. // "HIGH" - The API implementation doesn't cache and aggregate the
  1273. // data.
  1274. // If the method returns successfully, it's guaranteed that the data
  1275. // has
  1276. // been persisted in durable storage.
  1277. // "DEBUG" - In addition to the behavior described in HIGH, DEBUG
  1278. // enables
  1279. // additional validation logic that is only useful during the
  1280. // onboarding
  1281. // process. This is only available to Google internal services and
  1282. // the service must be whitelisted by chemist-dev@google.com in order
  1283. // to use this level.
  1284. Importance string `json:"importance,omitempty"`
  1285. // Labels: Labels describing the operation. Only the following labels
  1286. // are allowed:
  1287. //
  1288. // - Labels describing monitored resources as defined in
  1289. // the service configuration.
  1290. // - Default labels of metric values. When specified, labels defined in
  1291. // the
  1292. // metric value override these default.
  1293. // - The following labels defined by Google Cloud Platform:
  1294. // - `cloud.googleapis.com/location` describing the location where
  1295. // the
  1296. // operation happened,
  1297. // - `servicecontrol.googleapis.com/user_agent` describing the user
  1298. // agent
  1299. // of the API request,
  1300. // - `servicecontrol.googleapis.com/service_agent` describing the
  1301. // service
  1302. // used to handle the API request (e.g. ESP),
  1303. // - `servicecontrol.googleapis.com/platform` describing the
  1304. // platform
  1305. // where the API is served, such as App Engine, Compute Engine,
  1306. // or
  1307. // Kubernetes Engine.
  1308. Labels map[string]string `json:"labels,omitempty"`
  1309. // LogEntries: Represents information to be logged.
  1310. LogEntries []*LogEntry `json:"logEntries,omitempty"`
  1311. // MetricValueSets: Represents information about this operation. Each
  1312. // MetricValueSet
  1313. // corresponds to a metric defined in the service configuration.
  1314. // The data type used in the MetricValueSet must agree with
  1315. // the data type specified in the metric definition.
  1316. //
  1317. // Within a single operation, it is not allowed to have more than
  1318. // one
  1319. // MetricValue instances that have the same metric names and
  1320. // identical
  1321. // label value combinations. If a request has such duplicated
  1322. // MetricValue
  1323. // instances, the entire request is rejected with
  1324. // an invalid argument error.
  1325. MetricValueSets []*MetricValueSet `json:"metricValueSets,omitempty"`
  1326. // OperationId: Identity of the operation. This must be unique within
  1327. // the scope of the
  1328. // service that generated the operation. If the service calls
  1329. // Check() and Report() on the same operation, the two calls should
  1330. // carry
  1331. // the same id.
  1332. //
  1333. // UUID version 4 is recommended, though not required.
  1334. // In scenarios where an operation is computed from existing
  1335. // information
  1336. // and an idempotent id is desirable for deduplication purpose, UUID
  1337. // version 5
  1338. // is recommended. See RFC 4122 for details.
  1339. OperationId string `json:"operationId,omitempty"`
  1340. // OperationName: Fully qualified name of the operation. Reserved for
  1341. // future use.
  1342. OperationName string `json:"operationName,omitempty"`
  1343. // QuotaProperties: Represents the properties needed for quota check.
  1344. // Applicable only if this
  1345. // operation is for a quota check request. If this is not specified, no
  1346. // quota
  1347. // check will be performed.
  1348. QuotaProperties *QuotaProperties `json:"quotaProperties,omitempty"`
  1349. // ResourceContainer: DO NOT USE. This field is deprecated, use
  1350. // "resources" field instead.
  1351. // The resource name of the parent of a resource in the resource
  1352. // hierarchy.
  1353. //
  1354. // This can be in one of the following formats:
  1355. // - “projects/<project-id or project-number>”
  1356. // - “folders/<folder-id>”
  1357. // - “organizations/<organization-id>”
  1358. ResourceContainer string `json:"resourceContainer,omitempty"`
  1359. // Resources: The resources that are involved in the operation.
  1360. // The maximum supported number of entries in this field is 100.
  1361. Resources []*ResourceInfo `json:"resources,omitempty"`
  1362. // StartTime: Required. Start time of the operation.
  1363. StartTime string `json:"startTime,omitempty"`
  1364. // UserLabels: User defined labels for the resource that this operation
  1365. // is associated
  1366. // with. Only a combination of 1000 user labels per consumer project
  1367. // are
  1368. // allowed.
  1369. UserLabels map[string]string `json:"userLabels,omitempty"`
  1370. // ForceSendFields is a list of field names (e.g. "ConsumerId") to
  1371. // unconditionally include in API requests. By default, fields with
  1372. // empty values are omitted from API requests. However, any non-pointer,
  1373. // non-interface field appearing in ForceSendFields will be sent to the
  1374. // server regardless of whether the field is empty or not. This may be
  1375. // used to include empty fields in Patch requests.
  1376. ForceSendFields []string `json:"-"`
  1377. // NullFields is a list of field names (e.g. "ConsumerId") to include in
  1378. // API requests with the JSON null value. By default, fields with empty
  1379. // values are omitted from API requests. However, any field with an
  1380. // empty value appearing in NullFields will be sent to the server as
  1381. // null. It is an error if a field in this list has a non-empty value.
  1382. // This may be used to include null fields in Patch requests.
  1383. NullFields []string `json:"-"`
  1384. }
  1385. func (s *Operation) MarshalJSON() ([]byte, error) {
  1386. type NoMethod Operation
  1387. raw := NoMethod(*s)
  1388. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1389. }
  1390. // QuotaError: Represents error information for QuotaOperation.
  1391. type QuotaError struct {
  1392. // Code: Error code.
  1393. //
  1394. // Possible values:
  1395. // "UNSPECIFIED" - This is never used.
  1396. // "RESOURCE_EXHAUSTED" - Quota allocation failed.
  1397. // Same as google.rpc.Code.RESOURCE_EXHAUSTED.
  1398. // "OUT_OF_RANGE" - Quota release failed. This error is ONLY returned
  1399. // on a NORMAL release.
  1400. // More formally: if a user requests a release of 10 tokens, but only
  1401. // 5 tokens were previously allocated, in a BEST_EFFORT release, this
  1402. // will
  1403. // be considered a success, 5 tokens will be released, and the result
  1404. // will
  1405. // be "Ok". If this is done in NORMAL mode, no tokens will be
  1406. // released,
  1407. // and an OUT_OF_RANGE error will be returned.
  1408. // Same as google.rpc.Code.OUT_OF_RANGE.
  1409. // "BILLING_NOT_ACTIVE" - Consumer cannot access the service because
  1410. // the service requires active
  1411. // billing.
  1412. // "PROJECT_DELETED" - Consumer's project has been marked as deleted
  1413. // (soft deletion).
  1414. // "API_KEY_INVALID" - Specified API key is invalid.
  1415. // "API_KEY_EXPIRED" - Specified API Key has expired.
  1416. // "SPATULA_HEADER_INVALID" - Consumer's spatula header is invalid.
  1417. // "LOAS_ROLE_INVALID" - The consumer's LOAS role is invalid.
  1418. // "NO_LOAS_PROJECT" - The consumer's LOAS role has no associated
  1419. // project.
  1420. // "PROJECT_STATUS_UNAVAILABLE" - The backend server for looking up
  1421. // project id/number is unavailable.
  1422. // "SERVICE_STATUS_UNAVAILABLE" - The backend server for checking
  1423. // service status is unavailable.
  1424. // "BILLING_STATUS_UNAVAILABLE" - The backend server for checking
  1425. // billing status is unavailable.
  1426. // "QUOTA_SYSTEM_UNAVAILABLE" - The backend server for checking quota
  1427. // limits is unavailable.
  1428. Code string `json:"code,omitempty"`
  1429. // Description: Free-form text that provides details on the cause of the
  1430. // error.
  1431. Description string `json:"description,omitempty"`
  1432. // Subject: Subject to whom this error applies. See the specific enum
  1433. // for more details
  1434. // on this field. For example, "clientip:<ip address of client>"
  1435. // or
  1436. // "project:<Google developer project id>".
  1437. Subject string `json:"subject,omitempty"`
  1438. // ForceSendFields is a list of field names (e.g. "Code") to
  1439. // unconditionally include in API requests. By default, fields with
  1440. // empty values are omitted from API requests. However, any non-pointer,
  1441. // non-interface field appearing in ForceSendFields will be sent to the
  1442. // server regardless of whether the field is empty or not. This may be
  1443. // used to include empty fields in Patch requests.
  1444. ForceSendFields []string `json:"-"`
  1445. // NullFields is a list of field names (e.g. "Code") to include in API
  1446. // requests with the JSON null value. By default, fields with empty
  1447. // values are omitted from API requests. However, any field with an
  1448. // empty value appearing in NullFields will be sent to the server as
  1449. // null. It is an error if a field in this list has a non-empty value.
  1450. // This may be used to include null fields in Patch requests.
  1451. NullFields []string `json:"-"`
  1452. }
  1453. func (s *QuotaError) MarshalJSON() ([]byte, error) {
  1454. type NoMethod QuotaError
  1455. raw := NoMethod(*s)
  1456. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1457. }
  1458. // QuotaInfo: Contains the quota information for a quota check response.
  1459. type QuotaInfo struct {
  1460. // LimitExceeded: Quota Metrics that have exceeded quota limits.
  1461. // For QuotaGroup-based quota, this is QuotaGroup.name
  1462. // For QuotaLimit-based quota, this is QuotaLimit.name
  1463. // See: google.api.Quota
  1464. // Deprecated: Use quota_metrics to get per quota group limit exceeded
  1465. // status.
  1466. LimitExceeded []string `json:"limitExceeded,omitempty"`
  1467. // QuotaConsumed: Map of quota group name to the actual number of tokens
  1468. // consumed. If the
  1469. // quota check was not successful, then this will not be populated due
  1470. // to no
  1471. // quota consumption.
  1472. //
  1473. // We are not merging this field with 'quota_metrics' field because of
  1474. // the
  1475. // complexity of scaling in Chemist client code base. For simplicity, we
  1476. // will
  1477. // keep this field for Castor (that scales quota usage) and
  1478. // 'quota_metrics'
  1479. // for SuperQuota (that doesn't scale quota usage).
  1480. //
  1481. QuotaConsumed map[string]int64 `json:"quotaConsumed,omitempty"`
  1482. // QuotaMetrics: Quota metrics to indicate the usage. Depending on the
  1483. // check request, one or
  1484. // more of the following metrics will be included:
  1485. //
  1486. // 1. For rate quota, per quota group or per quota metric incremental
  1487. // usage
  1488. // will be specified using the following delta metric:
  1489. // "serviceruntime.googleapis.com/api/consumer/quota_used_count"
  1490. //
  1491. // 2. For allocation quota, per quota metric total usage will be
  1492. // specified
  1493. // using the following gauge metric:
  1494. //
  1495. // "serviceruntime.googleapis.com/allocation/consumer/quota_used_count"
  1496. //
  1497. //
  1498. // 3. For both rate quota and allocation quota, the quota limit
  1499. // reached
  1500. // condition will be specified using the following boolean metric:
  1501. // "serviceruntime.googleapis.com/quota/exceeded"
  1502. QuotaMetrics []*MetricValueSet `json:"quotaMetrics,omitempty"`
  1503. // ForceSendFields is a list of field names (e.g. "LimitExceeded") to
  1504. // unconditionally include in API requests. By default, fields with
  1505. // empty values are omitted from API requests. However, any non-pointer,
  1506. // non-interface field appearing in ForceSendFields will be sent to the
  1507. // server regardless of whether the field is empty or not. This may be
  1508. // used to include empty fields in Patch requests.
  1509. ForceSendFields []string `json:"-"`
  1510. // NullFields is a list of field names (e.g. "LimitExceeded") to include
  1511. // in API requests with the JSON null value. By default, fields with
  1512. // empty values are omitted from API requests. However, any field with
  1513. // an empty value appearing in NullFields will be sent to the server as
  1514. // null. It is an error if a field in this list has a non-empty value.
  1515. // This may be used to include null fields in Patch requests.
  1516. NullFields []string `json:"-"`
  1517. }
  1518. func (s *QuotaInfo) MarshalJSON() ([]byte, error) {
  1519. type NoMethod QuotaInfo
  1520. raw := NoMethod(*s)
  1521. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1522. }
  1523. // QuotaOperation: Represents information regarding a quota operation.
  1524. type QuotaOperation struct {
  1525. // ConsumerId: Identity of the consumer for whom this quota operation is
  1526. // being performed.
  1527. //
  1528. // This can be in one of the following formats:
  1529. // project:<project_id>,
  1530. // project_number:<project_number>,
  1531. // api_key:<api_key>.
  1532. ConsumerId string `json:"consumerId,omitempty"`
  1533. // Labels: Labels describing the operation.
  1534. Labels map[string]string `json:"labels,omitempty"`
  1535. // MethodName: Fully qualified name of the API method for which this
  1536. // quota operation is
  1537. // requested. This name is used for matching quota rules or metric rules
  1538. // and
  1539. // billing status rules defined in service configuration.
  1540. //
  1541. // This field should not be set if any of the following is true:
  1542. // (1) the quota operation is performed on non-API resources.
  1543. // (2) quota_metrics is set because the caller is doing quota
  1544. // override.
  1545. //
  1546. // Example of an RPC method name:
  1547. // google.example.library.v1.LibraryService.CreateShelf
  1548. MethodName string `json:"methodName,omitempty"`
  1549. // OperationId: Identity of the operation. This is expected to be unique
  1550. // within the scope
  1551. // of the service that generated the operation, and guarantees
  1552. // idempotency in
  1553. // case of retries.
  1554. //
  1555. // UUID version 4 is recommended, though not required. In scenarios
  1556. // where an
  1557. // operation is computed from existing information and an idempotent id
  1558. // is
  1559. // desirable for deduplication purpose, UUID version 5 is recommended.
  1560. // See
  1561. // RFC 4122 for details.
  1562. OperationId string `json:"operationId,omitempty"`
  1563. // QuotaMetrics: Represents information about this operation. Each
  1564. // MetricValueSet
  1565. // corresponds to a metric defined in the service configuration.
  1566. // The data type used in the MetricValueSet must agree with
  1567. // the data type specified in the metric definition.
  1568. //
  1569. // Within a single operation, it is not allowed to have more than
  1570. // one
  1571. // MetricValue instances that have the same metric names and
  1572. // identical
  1573. // label value combinations. If a request has such duplicated
  1574. // MetricValue
  1575. // instances, the entire request is rejected with
  1576. // an invalid argument error.
  1577. //
  1578. // This field is mutually exclusive with method_name.
  1579. QuotaMetrics []*MetricValueSet `json:"quotaMetrics,omitempty"`
  1580. // QuotaMode: Quota mode for this operation.
  1581. //
  1582. // Possible values:
  1583. // "UNSPECIFIED" - Guard against implicit default. Must not be used.
  1584. // "NORMAL" - For AllocateQuota request, allocates quota for the
  1585. // amount specified in
  1586. // the service configuration or specified using the quota metrics. If
  1587. // the
  1588. // amount is higher than the available quota, allocation error will
  1589. // be
  1590. // returned and no quota will be allocated.
  1591. // "BEST_EFFORT" - The operation allocates quota for the amount
  1592. // specified in the service
  1593. // configuration or specified using the quota metrics. If the amount
  1594. // is
  1595. // higher than the available quota, request does not fail but all
  1596. // available
  1597. // quota will be allocated.
  1598. // "CHECK_ONLY" - For AllocateQuota request, only checks if there is
  1599. // enough quota
  1600. // available and does not change the available quota. No lock is placed
  1601. // on
  1602. // the available quota either.
  1603. QuotaMode string `json:"quotaMode,omitempty"`
  1604. // ForceSendFields is a list of field names (e.g. "ConsumerId") to
  1605. // unconditionally include in API requests. By default, fields with
  1606. // empty values are omitted from API requests. However, any non-pointer,
  1607. // non-interface field appearing in ForceSendFields will be sent to the
  1608. // server regardless of whether the field is empty or not. This may be
  1609. // used to include empty fields in Patch requests.
  1610. ForceSendFields []string `json:"-"`
  1611. // NullFields is a list of field names (e.g. "ConsumerId") to include in
  1612. // API requests with the JSON null value. By default, fields with empty
  1613. // values are omitted from API requests. However, any field with an
  1614. // empty value appearing in NullFields will be sent to the server as
  1615. // null. It is an error if a field in this list has a non-empty value.
  1616. // This may be used to include null fields in Patch requests.
  1617. NullFields []string `json:"-"`
  1618. }
  1619. func (s *QuotaOperation) MarshalJSON() ([]byte, error) {
  1620. type NoMethod QuotaOperation
  1621. raw := NoMethod(*s)
  1622. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1623. }
  1624. // QuotaProperties: Represents the properties needed for quota
  1625. // operations.
  1626. type QuotaProperties struct {
  1627. // QuotaMode: Quota mode for this operation.
  1628. //
  1629. // Possible values:
  1630. // "ACQUIRE" - Decreases available quota by the cost specified for the
  1631. // operation.
  1632. // If cost is higher than available quota, operation fails and
  1633. // returns
  1634. // error.
  1635. // "ACQUIRE_BEST_EFFORT" - Decreases available quota by the cost
  1636. // specified for the operation.
  1637. // If cost is higher than available quota, operation does not fail
  1638. // and
  1639. // available quota goes down to zero but it returns error.
  1640. // "CHECK" - Does not change any available quota. Only checks if there
  1641. // is enough
  1642. // quota.
  1643. // No lock is placed on the checked tokens neither.
  1644. // "RELEASE" - Increases available quota by the operation cost
  1645. // specified for the
  1646. // operation.
  1647. QuotaMode string `json:"quotaMode,omitempty"`
  1648. // ForceSendFields is a list of field names (e.g. "QuotaMode") to
  1649. // unconditionally include in API requests. By default, fields with
  1650. // empty values are omitted from API requests. However, any non-pointer,
  1651. // non-interface field appearing in ForceSendFields will be sent to the
  1652. // server regardless of whether the field is empty or not. This may be
  1653. // used to include empty fields in Patch requests.
  1654. ForceSendFields []string `json:"-"`
  1655. // NullFields is a list of field names (e.g. "QuotaMode") to include in
  1656. // API requests with the JSON null value. By default, fields with empty
  1657. // values are omitted from API requests. However, any field with an
  1658. // empty value appearing in NullFields will be sent to the server as
  1659. // null. It is an error if a field in this list has a non-empty value.
  1660. // This may be used to include null fields in Patch requests.
  1661. NullFields []string `json:"-"`
  1662. }
  1663. func (s *QuotaProperties) MarshalJSON() ([]byte, error) {
  1664. type NoMethod QuotaProperties
  1665. raw := NoMethod(*s)
  1666. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1667. }
  1668. // ReleaseQuotaRequest: Request message for the ReleaseQuota method.
  1669. type ReleaseQuotaRequest struct {
  1670. // ReleaseOperation: Operation that describes the quota release.
  1671. ReleaseOperation *QuotaOperation `json:"releaseOperation,omitempty"`
  1672. // ServiceConfigId: Specifies which version of service configuration
  1673. // should be used to process
  1674. // the request. If unspecified or no matching version can be found, the
  1675. // latest
  1676. // one will be used.
  1677. ServiceConfigId string `json:"serviceConfigId,omitempty"`
  1678. // ForceSendFields is a list of field names (e.g. "ReleaseOperation") to
  1679. // unconditionally include in API requests. By default, fields with
  1680. // empty values are omitted from API requests. However, any non-pointer,
  1681. // non-interface field appearing in ForceSendFields will be sent to the
  1682. // server regardless of whether the field is empty or not. This may be
  1683. // used to include empty fields in Patch requests.
  1684. ForceSendFields []string `json:"-"`
  1685. // NullFields is a list of field names (e.g. "ReleaseOperation") to
  1686. // include in API requests with the JSON null value. By default, fields
  1687. // with empty values are omitted from API requests. However, any field
  1688. // with an empty value appearing in NullFields will be sent to the
  1689. // server as null. It is an error if a field in this list has a
  1690. // non-empty value. This may be used to include null fields in Patch
  1691. // requests.
  1692. NullFields []string `json:"-"`
  1693. }
  1694. func (s *ReleaseQuotaRequest) MarshalJSON() ([]byte, error) {
  1695. type NoMethod ReleaseQuotaRequest
  1696. raw := NoMethod(*s)
  1697. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1698. }
  1699. // ReleaseQuotaResponse: Response message for the ReleaseQuota method.
  1700. type ReleaseQuotaResponse struct {
  1701. // OperationId: The same operation_id value used in the
  1702. // ReleaseQuotaRequest. Used for
  1703. // logging and diagnostics purposes.
  1704. OperationId string `json:"operationId,omitempty"`
  1705. // QuotaMetrics: Quota metrics to indicate the result of release.
  1706. // Depending on the
  1707. // request, one or more of the following metrics will be included:
  1708. //
  1709. // 1. For rate quota, per quota group or per quota metric released
  1710. // amount
  1711. // will be specified using the following delta metric:
  1712. // "serviceruntime.googleapis.com/api/consumer/quota_refund_count"
  1713. //
  1714. // 2. For allocation quota, per quota metric total usage will be
  1715. // specified
  1716. // using the following gauge metric:
  1717. //
  1718. // "serviceruntime.googleapis.com/allocation/consumer/quota_used_count"
  1719. //
  1720. //
  1721. // 3. For allocation quota, value for each quota limit associated
  1722. // with
  1723. // the metrics will be specified using the following gauge metric:
  1724. // "serviceruntime.googleapis.com/quota/limit"
  1725. QuotaMetrics []*MetricValueSet `json:"quotaMetrics,omitempty"`
  1726. // ReleaseErrors: Indicates the decision of the release.
  1727. ReleaseErrors []*QuotaError `json:"releaseErrors,omitempty"`
  1728. // ServiceConfigId: ID of the actual config used to process the request.
  1729. ServiceConfigId string `json:"serviceConfigId,omitempty"`
  1730. // ServerResponse contains the HTTP response code and headers from the
  1731. // server.
  1732. googleapi.ServerResponse `json:"-"`
  1733. // ForceSendFields is a list of field names (e.g. "OperationId") to
  1734. // unconditionally include in API requests. By default, fields with
  1735. // empty values are omitted from API requests. However, any non-pointer,
  1736. // non-interface field appearing in ForceSendFields will be sent to the
  1737. // server regardless of whether the field is empty or not. This may be
  1738. // used to include empty fields in Patch requests.
  1739. ForceSendFields []string `json:"-"`
  1740. // NullFields is a list of field names (e.g. "OperationId") to include
  1741. // in API requests with the JSON null value. By default, fields with
  1742. // empty values are omitted from API requests. However, any field with
  1743. // an empty value appearing in NullFields will be sent to the server as
  1744. // null. It is an error if a field in this list has a non-empty value.
  1745. // This may be used to include null fields in Patch requests.
  1746. NullFields []string `json:"-"`
  1747. }
  1748. func (s *ReleaseQuotaResponse) MarshalJSON() ([]byte, error) {
  1749. type NoMethod ReleaseQuotaResponse
  1750. raw := NoMethod(*s)
  1751. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1752. }
  1753. // ReportError: Represents the processing error of one Operation in the
  1754. // request.
  1755. type ReportError struct {
  1756. // OperationId: The Operation.operation_id value from the request.
  1757. OperationId string `json:"operationId,omitempty"`
  1758. // Status: Details of the error when processing the Operation.
  1759. Status *Status `json:"status,omitempty"`
  1760. // ForceSendFields is a list of field names (e.g. "OperationId") to
  1761. // unconditionally include in API requests. By default, fields with
  1762. // empty values are omitted from API requests. However, any non-pointer,
  1763. // non-interface field appearing in ForceSendFields will be sent to the
  1764. // server regardless of whether the field is empty or not. This may be
  1765. // used to include empty fields in Patch requests.
  1766. ForceSendFields []string `json:"-"`
  1767. // NullFields is a list of field names (e.g. "OperationId") to include
  1768. // in API requests with the JSON null value. By default, fields with
  1769. // empty values are omitted from API requests. However, any field with
  1770. // an empty value appearing in NullFields will be sent to the server as
  1771. // null. It is an error if a field in this list has a non-empty value.
  1772. // This may be used to include null fields in Patch requests.
  1773. NullFields []string `json:"-"`
  1774. }
  1775. func (s *ReportError) MarshalJSON() ([]byte, error) {
  1776. type NoMethod ReportError
  1777. raw := NoMethod(*s)
  1778. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1779. }
  1780. // ReportInfo: Contains additional info about the report operation.
  1781. type ReportInfo struct {
  1782. // OperationId: The Operation.operation_id value from the request.
  1783. OperationId string `json:"operationId,omitempty"`
  1784. // QuotaInfo: Quota usage info when processing the `Operation`.
  1785. QuotaInfo *QuotaInfo `json:"quotaInfo,omitempty"`
  1786. // ForceSendFields is a list of field names (e.g. "OperationId") to
  1787. // unconditionally include in API requests. By default, fields with
  1788. // empty values are omitted from API requests. However, any non-pointer,
  1789. // non-interface field appearing in ForceSendFields will be sent to the
  1790. // server regardless of whether the field is empty or not. This may be
  1791. // used to include empty fields in Patch requests.
  1792. ForceSendFields []string `json:"-"`
  1793. // NullFields is a list of field names (e.g. "OperationId") to include
  1794. // in API requests with the JSON null value. By default, fields with
  1795. // empty values are omitted from API requests. However, any field with
  1796. // an empty value appearing in NullFields will be sent to the server as
  1797. // null. It is an error if a field in this list has a non-empty value.
  1798. // This may be used to include null fields in Patch requests.
  1799. NullFields []string `json:"-"`
  1800. }
  1801. func (s *ReportInfo) MarshalJSON() ([]byte, error) {
  1802. type NoMethod ReportInfo
  1803. raw := NoMethod(*s)
  1804. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1805. }
  1806. // ReportRequest: Request message for the Report method.
  1807. type ReportRequest struct {
  1808. // Operations: Operations to be reported.
  1809. //
  1810. // Typically the service should report one operation per
  1811. // request.
  1812. // Putting multiple operations into a single request is allowed, but
  1813. // should
  1814. // be used only when multiple operations are natually available at the
  1815. // time
  1816. // of the report.
  1817. //
  1818. // If multiple operations are in a single request, the total request
  1819. // size
  1820. // should be no larger than 1MB. See ReportResponse.report_errors
  1821. // for
  1822. // partial failure behavior.
  1823. Operations []*Operation `json:"operations,omitempty"`
  1824. // ServiceConfigId: Specifies which version of service config should be
  1825. // used to process the
  1826. // request.
  1827. //
  1828. // If unspecified or no matching version can be found, the
  1829. // latest one will be used.
  1830. ServiceConfigId string `json:"serviceConfigId,omitempty"`
  1831. // ForceSendFields is a list of field names (e.g. "Operations") to
  1832. // unconditionally include in API requests. By default, fields with
  1833. // empty values are omitted from API requests. However, any non-pointer,
  1834. // non-interface field appearing in ForceSendFields will be sent to the
  1835. // server regardless of whether the field is empty or not. This may be
  1836. // used to include empty fields in Patch requests.
  1837. ForceSendFields []string `json:"-"`
  1838. // NullFields is a list of field names (e.g. "Operations") to include in
  1839. // API requests with the JSON null value. By default, fields with empty
  1840. // values are omitted from API requests. However, any field with an
  1841. // empty value appearing in NullFields will be sent to the server as
  1842. // null. It is an error if a field in this list has a non-empty value.
  1843. // This may be used to include null fields in Patch requests.
  1844. NullFields []string `json:"-"`
  1845. }
  1846. func (s *ReportRequest) MarshalJSON() ([]byte, error) {
  1847. type NoMethod ReportRequest
  1848. raw := NoMethod(*s)
  1849. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1850. }
  1851. // ReportResponse: Response message for the Report method.
  1852. type ReportResponse struct {
  1853. // ReportErrors: Partial failures, one for each `Operation` in the
  1854. // request that failed
  1855. // processing. There are three possible combinations of the RPC
  1856. // status:
  1857. //
  1858. // 1. The combination of a successful RPC status and an empty
  1859. // `report_errors`
  1860. // list indicates a complete success where all `Operations` in the
  1861. // request are processed successfully.
  1862. // 2. The combination of a successful RPC status and a non-empty
  1863. // `report_errors` list indicates a partial success where some
  1864. // `Operations` in the request succeeded. Each
  1865. // `Operation` that failed processing has a corresponding item
  1866. // in this list.
  1867. // 3. A failed RPC status indicates a general non-deterministic
  1868. // failure.
  1869. // When this happens, it's impossible to know which of the
  1870. // 'Operations' in the request succeeded or failed.
  1871. ReportErrors []*ReportError `json:"reportErrors,omitempty"`
  1872. // ReportInfos: Quota usage for each quota release `Operation`
  1873. // request.
  1874. //
  1875. // Fully or partially failed quota release request may or may not be
  1876. // present
  1877. // in `report_quota_info`. For example, a failed quota release request
  1878. // will
  1879. // have the current quota usage info when precise quota library returns
  1880. // the
  1881. // info. A deadline exceeded quota request will not have quota usage
  1882. // info.
  1883. //
  1884. // If there is no quota release request, report_quota_info will be
  1885. // empty.
  1886. //
  1887. ReportInfos []*ReportInfo `json:"reportInfos,omitempty"`
  1888. // ServiceConfigId: The actual config id used to process the request.
  1889. ServiceConfigId string `json:"serviceConfigId,omitempty"`
  1890. // ServerResponse contains the HTTP response code and headers from the
  1891. // server.
  1892. googleapi.ServerResponse `json:"-"`
  1893. // ForceSendFields is a list of field names (e.g. "ReportErrors") to
  1894. // unconditionally include in API requests. By default, fields with
  1895. // empty values are omitted from API requests. However, any non-pointer,
  1896. // non-interface field appearing in ForceSendFields will be sent to the
  1897. // server regardless of whether the field is empty or not. This may be
  1898. // used to include empty fields in Patch requests.
  1899. ForceSendFields []string `json:"-"`
  1900. // NullFields is a list of field names (e.g. "ReportErrors") to include
  1901. // in API requests with the JSON null value. By default, fields with
  1902. // empty values are omitted from API requests. However, any field with
  1903. // an empty value appearing in NullFields will be sent to the server as
  1904. // null. It is an error if a field in this list has a non-empty value.
  1905. // This may be used to include null fields in Patch requests.
  1906. NullFields []string `json:"-"`
  1907. }
  1908. func (s *ReportResponse) MarshalJSON() ([]byte, error) {
  1909. type NoMethod ReportResponse
  1910. raw := NoMethod(*s)
  1911. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1912. }
  1913. // Request: This message defines attributes for an HTTP request. If the
  1914. // actual
  1915. // request is not an HTTP request, the runtime system should try to
  1916. // map
  1917. // the actual request to an equivalent HTTP request.
  1918. type Request struct {
  1919. // Auth: The request authentication. May be absent for unauthenticated
  1920. // requests.
  1921. // Derived from the HTTP request `Authorization` header or equivalent.
  1922. Auth *Auth `json:"auth,omitempty"`
  1923. // Fragment: The HTTP URL fragment. No URL decoding is performed.
  1924. Fragment string `json:"fragment,omitempty"`
  1925. // Headers: The HTTP request headers. If multiple headers share the same
  1926. // key, they
  1927. // must be merged according to the HTTP spec. All header keys must
  1928. // be
  1929. // lowercased, because HTTP header keys are case-insensitive.
  1930. Headers map[string]string `json:"headers,omitempty"`
  1931. // Host: The HTTP request `Host` header value.
  1932. Host string `json:"host,omitempty"`
  1933. // Id: The unique ID for a request, which can be propagated to
  1934. // downstream
  1935. // systems. The ID should have low probability of collision
  1936. // within a single day for a specific service.
  1937. Id string `json:"id,omitempty"`
  1938. // Method: The HTTP request method, such as `GET`, `POST`.
  1939. Method string `json:"method,omitempty"`
  1940. // Path: The HTTP URL path.
  1941. Path string `json:"path,omitempty"`
  1942. // Protocol: The network protocol used with the request, such as
  1943. // "http/1.1",
  1944. // "spdy/3", "h2", "h2c", "webrtc", "tcp", "udp", "quic".
  1945. // See
  1946. // https://www.iana.org/assignments/tls-extensiontype-values/tls-exte
  1947. // nsiontype-values.xhtml#alpn-protocol-ids
  1948. // for details.
  1949. Protocol string `json:"protocol,omitempty"`
  1950. // Query: The HTTP URL query in the format of
  1951. // `name1=value`&name2=value2`, as it
  1952. // appears in the first line of the HTTP request. No decoding is
  1953. // performed.
  1954. Query string `json:"query,omitempty"`
  1955. // Reason: A special parameter for request reason. It is used by
  1956. // security systems
  1957. // to associate auditing information with a request.
  1958. Reason string `json:"reason,omitempty"`
  1959. // Scheme: The HTTP URL scheme, such as `http` and `https`.
  1960. Scheme string `json:"scheme,omitempty"`
  1961. // Size: The HTTP request size in bytes. If unknown, it must be -1.
  1962. Size int64 `json:"size,omitempty,string"`
  1963. // Time: The timestamp when the `destination` service receives the first
  1964. // byte of
  1965. // the request.
  1966. Time string `json:"time,omitempty"`
  1967. // ForceSendFields is a list of field names (e.g. "Auth") to
  1968. // unconditionally include in API requests. By default, fields with
  1969. // empty values are omitted from API requests. However, any non-pointer,
  1970. // non-interface field appearing in ForceSendFields will be sent to the
  1971. // server regardless of whether the field is empty or not. This may be
  1972. // used to include empty fields in Patch requests.
  1973. ForceSendFields []string `json:"-"`
  1974. // NullFields is a list of field names (e.g. "Auth") to include in API
  1975. // requests with the JSON null value. By default, fields with empty
  1976. // values are omitted from API requests. However, any field with an
  1977. // empty value appearing in NullFields will be sent to the server as
  1978. // null. It is an error if a field in this list has a non-empty value.
  1979. // This may be used to include null fields in Patch requests.
  1980. NullFields []string `json:"-"`
  1981. }
  1982. func (s *Request) MarshalJSON() ([]byte, error) {
  1983. type NoMethod Request
  1984. raw := NoMethod(*s)
  1985. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1986. }
  1987. // RequestMetadata: Metadata about the request.
  1988. type RequestMetadata struct {
  1989. // CallerIp: The IP address of the caller.
  1990. // For caller from internet, this will be public IPv4 or IPv6
  1991. // address.
  1992. // For caller from a Compute Engine VM with external IP address,
  1993. // this
  1994. // will be the VM's external IP address. For caller from a
  1995. // Compute
  1996. // Engine VM without external IP address, if the VM is in the
  1997. // same
  1998. // organization (or project) as the accessed resource, `caller_ip`
  1999. // will
  2000. // be the VM's internal IPv4 address, otherwise the `caller_ip` will
  2001. // be
  2002. // redacted to "gce-internal-ip".
  2003. // See https://cloud.google.com/compute/docs/vpc/ for more information.
  2004. CallerIp string `json:"callerIp,omitempty"`
  2005. // CallerNetwork: The network of the caller.
  2006. // Set only if the network host project is part of the same GCP
  2007. // organization
  2008. // (or project) as the accessed resource.
  2009. // See https://cloud.google.com/compute/docs/vpc/ for more
  2010. // information.
  2011. // This is a scheme-less URI full resource name. For example:
  2012. //
  2013. //
  2014. // "//compute.googleapis.com/projects/PROJECT_ID/global/networks/NETWORK_
  2015. // ID"
  2016. CallerNetwork string `json:"callerNetwork,omitempty"`
  2017. // CallerSuppliedUserAgent: The user agent of the caller.
  2018. // This information is not authenticated and should be treated
  2019. // accordingly.
  2020. // For example:
  2021. //
  2022. // + `google-api-python-client/1.4.0`:
  2023. // The request was made by the Google API client for Python.
  2024. // + `Cloud SDK Command Line Tool apitools-client/1.0 gcloud/0.9.62`:
  2025. // The request was made by the Google Cloud SDK CLI (gcloud).
  2026. // + `AppEngine-Google; (+http://code.google.com/appengine; appid:
  2027. // s~my-project`:
  2028. // The request was made from the `my-project` App Engine app.
  2029. // NOLINT
  2030. CallerSuppliedUserAgent string `json:"callerSuppliedUserAgent,omitempty"`
  2031. // RequestAttributes: Request attributes used in IAM condition
  2032. // evaluation. This field contains
  2033. // request attributes like request time and access levels associated
  2034. // with
  2035. // the request.
  2036. //
  2037. // To get the whole view of the attributes used in IAM
  2038. // condition evaluation, the user must also look
  2039. // into
  2040. // `AuditLog.authentication_info.resource_attributes`.
  2041. RequestAttributes *Request `json:"requestAttributes,omitempty"`
  2042. // ForceSendFields is a list of field names (e.g. "CallerIp") to
  2043. // unconditionally include in API requests. By default, fields with
  2044. // empty values are omitted from API requests. However, any non-pointer,
  2045. // non-interface field appearing in ForceSendFields will be sent to the
  2046. // server regardless of whether the field is empty or not. This may be
  2047. // used to include empty fields in Patch requests.
  2048. ForceSendFields []string `json:"-"`
  2049. // NullFields is a list of field names (e.g. "CallerIp") to include in
  2050. // API requests with the JSON null value. By default, fields with empty
  2051. // values are omitted from API requests. However, any field with an
  2052. // empty value appearing in NullFields will be sent to the server as
  2053. // null. It is an error if a field in this list has a non-empty value.
  2054. // This may be used to include null fields in Patch requests.
  2055. NullFields []string `json:"-"`
  2056. }
  2057. func (s *RequestMetadata) MarshalJSON() ([]byte, error) {
  2058. type NoMethod RequestMetadata
  2059. raw := NoMethod(*s)
  2060. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2061. }
  2062. // Resource: This message defines core attributes for a resource. A
  2063. // resource is an
  2064. // addressable (named) entity provided by the destination service.
  2065. // For
  2066. // example, a file stored on a network storage service.
  2067. type Resource struct {
  2068. // Labels: The labels or tags on the resource, such as AWS resource tags
  2069. // and
  2070. // Kubernetes resource labels.
  2071. Labels map[string]string `json:"labels,omitempty"`
  2072. // Name: The stable identifier (name) of a resource on the `service`. A
  2073. // resource
  2074. // can be logically identified as
  2075. // "//{resource.service}/{resource.name}".
  2076. // The differences between a resource name and a URI are:
  2077. //
  2078. // * Resource name is a logical identifier, independent of network
  2079. // protocol and API version. For example,
  2080. // `//pubsub.googleapis.com/projects/123/topics/news-feed`.
  2081. // * URI often includes protocol and version information, so it can
  2082. // be used directly by applications. For example,
  2083. //
  2084. // `https://pubsub.googleapis.com/v1/projects/123/topics/news-feed`.
  2085. //
  2086. // See
  2087. // https://cloud.google.com/apis/design/resource_names for details.
  2088. Name string `json:"name,omitempty"`
  2089. // Service: The name of the service that this resource belongs to, such
  2090. // as
  2091. // `pubsub.googleapis.com`. The service may be different from the
  2092. // DNS
  2093. // hostname that actually serves the request.
  2094. Service string `json:"service,omitempty"`
  2095. // Type: The type of the resource. The scheme is platform-specific
  2096. // because
  2097. // different platforms define their resources differently.
  2098. Type string `json:"type,omitempty"`
  2099. // ForceSendFields is a list of field names (e.g. "Labels") to
  2100. // unconditionally include in API requests. By default, fields with
  2101. // empty values are omitted from API requests. However, any non-pointer,
  2102. // non-interface field appearing in ForceSendFields will be sent to the
  2103. // server regardless of whether the field is empty or not. This may be
  2104. // used to include empty fields in Patch requests.
  2105. ForceSendFields []string `json:"-"`
  2106. // NullFields is a list of field names (e.g. "Labels") to include in API
  2107. // requests with the JSON null value. By default, fields with empty
  2108. // values are omitted from API requests. However, any field with an
  2109. // empty value appearing in NullFields will be sent to the server as
  2110. // null. It is an error if a field in this list has a non-empty value.
  2111. // This may be used to include null fields in Patch requests.
  2112. NullFields []string `json:"-"`
  2113. }
  2114. func (s *Resource) MarshalJSON() ([]byte, error) {
  2115. type NoMethod Resource
  2116. raw := NoMethod(*s)
  2117. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2118. }
  2119. // ResourceInfo: Describes a resource associated with this operation.
  2120. type ResourceInfo struct {
  2121. // ResourceContainer: The identifier of the parent of this resource
  2122. // instance.
  2123. // Must be in one of the following formats:
  2124. // - “projects/<project-id or project-number>”
  2125. // - “folders/<folder-id>”
  2126. // - “organizations/<organization-id>”
  2127. ResourceContainer string `json:"resourceContainer,omitempty"`
  2128. // ResourceName: Name of the resource. This is used for auditing
  2129. // purposes.
  2130. ResourceName string `json:"resourceName,omitempty"`
  2131. // ForceSendFields is a list of field names (e.g. "ResourceContainer")
  2132. // to unconditionally include in API requests. By default, fields with
  2133. // empty values are omitted from API requests. However, any non-pointer,
  2134. // non-interface field appearing in ForceSendFields will be sent to the
  2135. // server regardless of whether the field is empty or not. This may be
  2136. // used to include empty fields in Patch requests.
  2137. ForceSendFields []string `json:"-"`
  2138. // NullFields is a list of field names (e.g. "ResourceContainer") to
  2139. // include in API requests with the JSON null value. By default, fields
  2140. // with empty values are omitted from API requests. However, any field
  2141. // with an empty value appearing in NullFields will be sent to the
  2142. // server as null. It is an error if a field in this list has a
  2143. // non-empty value. This may be used to include null fields in Patch
  2144. // requests.
  2145. NullFields []string `json:"-"`
  2146. }
  2147. func (s *ResourceInfo) MarshalJSON() ([]byte, error) {
  2148. type NoMethod ResourceInfo
  2149. raw := NoMethod(*s)
  2150. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2151. }
  2152. // ResourceLocation: Location information about a resource.
  2153. type ResourceLocation struct {
  2154. // CurrentLocations: The locations of a resource after the execution of
  2155. // the operation.
  2156. // For example:
  2157. //
  2158. // "europe-west1-a"
  2159. // "us-east1"
  2160. // "nam3"
  2161. CurrentLocations []string `json:"currentLocations,omitempty"`
  2162. // ForceSendFields is a list of field names (e.g. "CurrentLocations") to
  2163. // unconditionally include in API requests. By default, fields with
  2164. // empty values are omitted from API requests. However, any non-pointer,
  2165. // non-interface field appearing in ForceSendFields will be sent to the
  2166. // server regardless of whether the field is empty or not. This may be
  2167. // used to include empty fields in Patch requests.
  2168. ForceSendFields []string `json:"-"`
  2169. // NullFields is a list of field names (e.g. "CurrentLocations") to
  2170. // include in API requests with the JSON null value. By default, fields
  2171. // with empty values are omitted from API requests. However, any field
  2172. // with an empty value appearing in NullFields will be sent to the
  2173. // server as null. It is an error if a field in this list has a
  2174. // non-empty value. This may be used to include null fields in Patch
  2175. // requests.
  2176. NullFields []string `json:"-"`
  2177. }
  2178. func (s *ResourceLocation) MarshalJSON() ([]byte, error) {
  2179. type NoMethod ResourceLocation
  2180. raw := NoMethod(*s)
  2181. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2182. }
  2183. // StartReconciliationRequest: Request message for
  2184. // QuotaController.StartReconciliation.
  2185. type StartReconciliationRequest struct {
  2186. // ReconciliationOperation: Operation that describes the quota
  2187. // reconciliation.
  2188. ReconciliationOperation *QuotaOperation `json:"reconciliationOperation,omitempty"`
  2189. // ServiceConfigId: Specifies which version of service configuration
  2190. // should be used to process
  2191. // the request. If unspecified or no matching version can be found, the
  2192. // latest
  2193. // one will be used.
  2194. ServiceConfigId string `json:"serviceConfigId,omitempty"`
  2195. // ForceSendFields is a list of field names (e.g.
  2196. // "ReconciliationOperation") to unconditionally include in API
  2197. // requests. By default, fields with empty values are omitted from API
  2198. // requests. However, any non-pointer, non-interface field appearing in
  2199. // ForceSendFields will be sent to the server regardless of whether the
  2200. // field is empty or not. This may be used to include empty fields in
  2201. // Patch requests.
  2202. ForceSendFields []string `json:"-"`
  2203. // NullFields is a list of field names (e.g. "ReconciliationOperation")
  2204. // to include in API requests with the JSON null value. By default,
  2205. // fields with empty values are omitted from API requests. However, any
  2206. // field with an empty value appearing in NullFields will be sent to the
  2207. // server as null. It is an error if a field in this list has a
  2208. // non-empty value. This may be used to include null fields in Patch
  2209. // requests.
  2210. NullFields []string `json:"-"`
  2211. }
  2212. func (s *StartReconciliationRequest) MarshalJSON() ([]byte, error) {
  2213. type NoMethod StartReconciliationRequest
  2214. raw := NoMethod(*s)
  2215. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2216. }
  2217. // StartReconciliationResponse: Response message for
  2218. // QuotaController.StartReconciliation.
  2219. type StartReconciliationResponse struct {
  2220. // OperationId: The same operation_id value used in the
  2221. // StartReconciliationRequest. Used
  2222. // for logging and diagnostics purposes.
  2223. OperationId string `json:"operationId,omitempty"`
  2224. // QuotaMetrics: Metric values as tracked by One Platform before the
  2225. // start of
  2226. // reconciliation. The following metrics will be included:
  2227. //
  2228. // 1. Per quota metric total usage will be specified using the following
  2229. // gauge
  2230. // metric:
  2231. //
  2232. // "serviceruntime.googleapis.com/allocation/consumer/quota_used_count"
  2233. //
  2234. //
  2235. // 2. Value for each quota limit associated with the metrics will be
  2236. // specified
  2237. // using the following gauge metric:
  2238. // "serviceruntime.googleapis.com/quota/limit"
  2239. QuotaMetrics []*MetricValueSet `json:"quotaMetrics,omitempty"`
  2240. // ReconciliationErrors: Indicates the decision of the reconciliation
  2241. // start.
  2242. ReconciliationErrors []*QuotaError `json:"reconciliationErrors,omitempty"`
  2243. // ServiceConfigId: ID of the actual config used to process the request.
  2244. ServiceConfigId string `json:"serviceConfigId,omitempty"`
  2245. // ServerResponse contains the HTTP response code and headers from the
  2246. // server.
  2247. googleapi.ServerResponse `json:"-"`
  2248. // ForceSendFields is a list of field names (e.g. "OperationId") to
  2249. // unconditionally include in API requests. By default, fields with
  2250. // empty values are omitted from API requests. However, any non-pointer,
  2251. // non-interface field appearing in ForceSendFields will be sent to the
  2252. // server regardless of whether the field is empty or not. This may be
  2253. // used to include empty fields in Patch requests.
  2254. ForceSendFields []string `json:"-"`
  2255. // NullFields is a list of field names (e.g. "OperationId") to include
  2256. // in API requests with the JSON null value. By default, fields with
  2257. // empty values are omitted from API requests. However, any field with
  2258. // an empty value appearing in NullFields will be sent to the server as
  2259. // null. It is an error if a field in this list has a non-empty value.
  2260. // This may be used to include null fields in Patch requests.
  2261. NullFields []string `json:"-"`
  2262. }
  2263. func (s *StartReconciliationResponse) MarshalJSON() ([]byte, error) {
  2264. type NoMethod StartReconciliationResponse
  2265. raw := NoMethod(*s)
  2266. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2267. }
  2268. // Status: The `Status` type defines a logical error model that is
  2269. // suitable for different
  2270. // programming environments, including REST APIs and RPC APIs. It is
  2271. // used by
  2272. // [gRPC](https://github.com/grpc). The error model is designed to
  2273. // be:
  2274. //
  2275. // - Simple to use and understand for most users
  2276. // - Flexible enough to meet unexpected needs
  2277. //
  2278. // # Overview
  2279. //
  2280. // The `Status` message contains three pieces of data: error code, error
  2281. // message,
  2282. // and error details. The error code should be an enum value
  2283. // of
  2284. // google.rpc.Code, but it may accept additional error codes if needed.
  2285. // The
  2286. // error message should be a developer-facing English message that
  2287. // helps
  2288. // developers *understand* and *resolve* the error. If a localized
  2289. // user-facing
  2290. // error message is needed, put the localized message in the error
  2291. // details or
  2292. // localize it in the client. The optional error details may contain
  2293. // arbitrary
  2294. // information about the error. There is a predefined set of error
  2295. // detail types
  2296. // in the package `google.rpc` that can be used for common error
  2297. // conditions.
  2298. //
  2299. // # Language mapping
  2300. //
  2301. // The `Status` message is the logical representation of the error
  2302. // model, but it
  2303. // is not necessarily the actual wire format. When the `Status` message
  2304. // is
  2305. // exposed in different client libraries and different wire protocols,
  2306. // it can be
  2307. // mapped differently. For example, it will likely be mapped to some
  2308. // exceptions
  2309. // in Java, but more likely mapped to some error codes in C.
  2310. //
  2311. // # Other uses
  2312. //
  2313. // The error model and the `Status` message can be used in a variety
  2314. // of
  2315. // environments, either with or without APIs, to provide a
  2316. // consistent developer experience across different
  2317. // environments.
  2318. //
  2319. // Example uses of this error model include:
  2320. //
  2321. // - Partial errors. If a service needs to return partial errors to the
  2322. // client,
  2323. // it may embed the `Status` in the normal response to indicate the
  2324. // partial
  2325. // errors.
  2326. //
  2327. // - Workflow errors. A typical workflow has multiple steps. Each step
  2328. // may
  2329. // have a `Status` message for error reporting.
  2330. //
  2331. // - Batch operations. If a client uses batch request and batch
  2332. // response, the
  2333. // `Status` message should be used directly inside batch response,
  2334. // one for
  2335. // each error sub-response.
  2336. //
  2337. // - Asynchronous operations. If an API call embeds asynchronous
  2338. // operation
  2339. // results in its response, the status of those operations should
  2340. // be
  2341. // represented directly using the `Status` message.
  2342. //
  2343. // - Logging. If some API errors are stored in logs, the message
  2344. // `Status` could
  2345. // be used directly after any stripping needed for security/privacy
  2346. // reasons.
  2347. type Status struct {
  2348. // Code: The status code, which should be an enum value of
  2349. // google.rpc.Code.
  2350. Code int64 `json:"code,omitempty"`
  2351. // Details: A list of messages that carry the error details. There is a
  2352. // common set of
  2353. // message types for APIs to use.
  2354. Details []googleapi.RawMessage `json:"details,omitempty"`
  2355. // Message: A developer-facing error message, which should be in
  2356. // English. Any
  2357. // user-facing error message should be localized and sent in
  2358. // the
  2359. // google.rpc.Status.details field, or localized by the client.
  2360. Message string `json:"message,omitempty"`
  2361. // ForceSendFields is a list of field names (e.g. "Code") to
  2362. // unconditionally include in API requests. By default, fields with
  2363. // empty values are omitted from API requests. However, any non-pointer,
  2364. // non-interface field appearing in ForceSendFields will be sent to the
  2365. // server regardless of whether the field is empty or not. This may be
  2366. // used to include empty fields in Patch requests.
  2367. ForceSendFields []string `json:"-"`
  2368. // NullFields is a list of field names (e.g. "Code") to include in API
  2369. // requests with the JSON null value. By default, fields with empty
  2370. // values are omitted from API requests. However, any field with an
  2371. // empty value appearing in NullFields will be sent to the server as
  2372. // null. It is an error if a field in this list has a non-empty value.
  2373. // This may be used to include null fields in Patch requests.
  2374. NullFields []string `json:"-"`
  2375. }
  2376. func (s *Status) MarshalJSON() ([]byte, error) {
  2377. type NoMethod Status
  2378. raw := NoMethod(*s)
  2379. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2380. }
  2381. // method id "servicecontrol.services.allocateQuota":
  2382. type ServicesAllocateQuotaCall struct {
  2383. s *Service
  2384. serviceName string
  2385. allocatequotarequest *AllocateQuotaRequest
  2386. urlParams_ gensupport.URLParams
  2387. ctx_ context.Context
  2388. header_ http.Header
  2389. }
  2390. // AllocateQuota: Attempts to allocate quota for the specified consumer.
  2391. // It should be called
  2392. // before the operation is executed.
  2393. //
  2394. // This method requires the
  2395. // `servicemanagement.services.quota`
  2396. // permission on the specified service. For more information, see
  2397. // [Cloud IAM](https://cloud.google.com/iam).
  2398. //
  2399. // **NOTE:** The client **must** fail-open on server errors
  2400. // `INTERNAL`,
  2401. // `UNKNOWN`, `DEADLINE_EXCEEDED`, and `UNAVAILABLE`. To ensure
  2402. // system
  2403. // reliability, the server may inject these errors to prohibit any
  2404. // hard
  2405. // dependency on the quota functionality.
  2406. func (r *ServicesService) AllocateQuota(serviceName string, allocatequotarequest *AllocateQuotaRequest) *ServicesAllocateQuotaCall {
  2407. c := &ServicesAllocateQuotaCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2408. c.serviceName = serviceName
  2409. c.allocatequotarequest = allocatequotarequest
  2410. return c
  2411. }
  2412. // Fields allows partial responses to be retrieved. See
  2413. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2414. // for more information.
  2415. func (c *ServicesAllocateQuotaCall) Fields(s ...googleapi.Field) *ServicesAllocateQuotaCall {
  2416. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2417. return c
  2418. }
  2419. // Context sets the context to be used in this call's Do method. Any
  2420. // pending HTTP request will be aborted if the provided context is
  2421. // canceled.
  2422. func (c *ServicesAllocateQuotaCall) Context(ctx context.Context) *ServicesAllocateQuotaCall {
  2423. c.ctx_ = ctx
  2424. return c
  2425. }
  2426. // Header returns an http.Header that can be modified by the caller to
  2427. // add HTTP headers to the request.
  2428. func (c *ServicesAllocateQuotaCall) Header() http.Header {
  2429. if c.header_ == nil {
  2430. c.header_ = make(http.Header)
  2431. }
  2432. return c.header_
  2433. }
  2434. func (c *ServicesAllocateQuotaCall) doRequest(alt string) (*http.Response, error) {
  2435. reqHeaders := make(http.Header)
  2436. for k, v := range c.header_ {
  2437. reqHeaders[k] = v
  2438. }
  2439. reqHeaders.Set("User-Agent", c.s.userAgent())
  2440. var body io.Reader = nil
  2441. body, err := googleapi.WithoutDataWrapper.JSONReader(c.allocatequotarequest)
  2442. if err != nil {
  2443. return nil, err
  2444. }
  2445. reqHeaders.Set("Content-Type", "application/json")
  2446. c.urlParams_.Set("alt", alt)
  2447. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/services/{serviceName}:allocateQuota")
  2448. urls += "?" + c.urlParams_.Encode()
  2449. req, _ := http.NewRequest("POST", urls, body)
  2450. req.Header = reqHeaders
  2451. googleapi.Expand(req.URL, map[string]string{
  2452. "serviceName": c.serviceName,
  2453. })
  2454. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2455. }
  2456. // Do executes the "servicecontrol.services.allocateQuota" call.
  2457. // Exactly one of *AllocateQuotaResponse or error will be non-nil. Any
  2458. // non-2xx status code is an error. Response headers are in either
  2459. // *AllocateQuotaResponse.ServerResponse.Header or (if a response was
  2460. // returned at all) in error.(*googleapi.Error).Header. Use
  2461. // googleapi.IsNotModified to check whether the returned error was
  2462. // because http.StatusNotModified was returned.
  2463. func (c *ServicesAllocateQuotaCall) Do(opts ...googleapi.CallOption) (*AllocateQuotaResponse, error) {
  2464. gensupport.SetOptions(c.urlParams_, opts...)
  2465. res, err := c.doRequest("json")
  2466. if res != nil && res.StatusCode == http.StatusNotModified {
  2467. if res.Body != nil {
  2468. res.Body.Close()
  2469. }
  2470. return nil, &googleapi.Error{
  2471. Code: res.StatusCode,
  2472. Header: res.Header,
  2473. }
  2474. }
  2475. if err != nil {
  2476. return nil, err
  2477. }
  2478. defer googleapi.CloseBody(res)
  2479. if err := googleapi.CheckResponse(res); err != nil {
  2480. return nil, err
  2481. }
  2482. ret := &AllocateQuotaResponse{
  2483. ServerResponse: googleapi.ServerResponse{
  2484. Header: res.Header,
  2485. HTTPStatusCode: res.StatusCode,
  2486. },
  2487. }
  2488. target := &ret
  2489. if err := gensupport.DecodeResponse(target, res); err != nil {
  2490. return nil, err
  2491. }
  2492. return ret, nil
  2493. // {
  2494. // "description": "Attempts to allocate quota for the specified consumer. It should be called\nbefore the operation is executed.\n\nThis method requires the `servicemanagement.services.quota`\npermission on the specified service. For more information, see\n[Cloud IAM](https://cloud.google.com/iam).\n\n**NOTE:** The client **must** fail-open on server errors `INTERNAL`,\n`UNKNOWN`, `DEADLINE_EXCEEDED`, and `UNAVAILABLE`. To ensure system\nreliability, the server may inject these errors to prohibit any hard\ndependency on the quota functionality.",
  2495. // "flatPath": "v1/services/{serviceName}:allocateQuota",
  2496. // "httpMethod": "POST",
  2497. // "id": "servicecontrol.services.allocateQuota",
  2498. // "parameterOrder": [
  2499. // "serviceName"
  2500. // ],
  2501. // "parameters": {
  2502. // "serviceName": {
  2503. // "description": "Name of the service as specified in the service configuration. For example,\n`\"pubsub.googleapis.com\"`.\n\nSee google.api.Service for the definition of a service name.",
  2504. // "location": "path",
  2505. // "required": true,
  2506. // "type": "string"
  2507. // }
  2508. // },
  2509. // "path": "v1/services/{serviceName}:allocateQuota",
  2510. // "request": {
  2511. // "$ref": "AllocateQuotaRequest"
  2512. // },
  2513. // "response": {
  2514. // "$ref": "AllocateQuotaResponse"
  2515. // },
  2516. // "scopes": [
  2517. // "https://www.googleapis.com/auth/cloud-platform",
  2518. // "https://www.googleapis.com/auth/servicecontrol"
  2519. // ]
  2520. // }
  2521. }
  2522. // method id "servicecontrol.services.check":
  2523. type ServicesCheckCall struct {
  2524. s *Service
  2525. serviceName string
  2526. checkrequest *CheckRequest
  2527. urlParams_ gensupport.URLParams
  2528. ctx_ context.Context
  2529. header_ http.Header
  2530. }
  2531. // Check: Checks whether an operation on a service should be allowed to
  2532. // proceed
  2533. // based on the configuration of the service and related policies. It
  2534. // must be
  2535. // called before the operation is executed.
  2536. //
  2537. // If feasible, the client should cache the check results and reuse them
  2538. // for
  2539. // 60 seconds. In case of any server errors, the client should rely on
  2540. // the
  2541. // cached results for much longer time to avoid outage.
  2542. // WARNING: There is general 60s delay for the configuration and
  2543. // policy
  2544. // propagation, therefore callers MUST NOT depend on the `Check` method
  2545. // having
  2546. // the latest policy information.
  2547. //
  2548. // NOTE: the CheckRequest has the size limit of 64KB.
  2549. //
  2550. // This method requires the `servicemanagement.services.check`
  2551. // permission
  2552. // on the specified service. For more information, see
  2553. // [Cloud IAM](https://cloud.google.com/iam).
  2554. func (r *ServicesService) Check(serviceName string, checkrequest *CheckRequest) *ServicesCheckCall {
  2555. c := &ServicesCheckCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2556. c.serviceName = serviceName
  2557. c.checkrequest = checkrequest
  2558. return c
  2559. }
  2560. // Fields allows partial responses to be retrieved. See
  2561. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2562. // for more information.
  2563. func (c *ServicesCheckCall) Fields(s ...googleapi.Field) *ServicesCheckCall {
  2564. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2565. return c
  2566. }
  2567. // Context sets the context to be used in this call's Do method. Any
  2568. // pending HTTP request will be aborted if the provided context is
  2569. // canceled.
  2570. func (c *ServicesCheckCall) Context(ctx context.Context) *ServicesCheckCall {
  2571. c.ctx_ = ctx
  2572. return c
  2573. }
  2574. // Header returns an http.Header that can be modified by the caller to
  2575. // add HTTP headers to the request.
  2576. func (c *ServicesCheckCall) Header() http.Header {
  2577. if c.header_ == nil {
  2578. c.header_ = make(http.Header)
  2579. }
  2580. return c.header_
  2581. }
  2582. func (c *ServicesCheckCall) doRequest(alt string) (*http.Response, error) {
  2583. reqHeaders := make(http.Header)
  2584. for k, v := range c.header_ {
  2585. reqHeaders[k] = v
  2586. }
  2587. reqHeaders.Set("User-Agent", c.s.userAgent())
  2588. var body io.Reader = nil
  2589. body, err := googleapi.WithoutDataWrapper.JSONReader(c.checkrequest)
  2590. if err != nil {
  2591. return nil, err
  2592. }
  2593. reqHeaders.Set("Content-Type", "application/json")
  2594. c.urlParams_.Set("alt", alt)
  2595. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/services/{serviceName}:check")
  2596. urls += "?" + c.urlParams_.Encode()
  2597. req, _ := http.NewRequest("POST", urls, body)
  2598. req.Header = reqHeaders
  2599. googleapi.Expand(req.URL, map[string]string{
  2600. "serviceName": c.serviceName,
  2601. })
  2602. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2603. }
  2604. // Do executes the "servicecontrol.services.check" call.
  2605. // Exactly one of *CheckResponse or error will be non-nil. Any non-2xx
  2606. // status code is an error. Response headers are in either
  2607. // *CheckResponse.ServerResponse.Header or (if a response was returned
  2608. // at all) in error.(*googleapi.Error).Header. Use
  2609. // googleapi.IsNotModified to check whether the returned error was
  2610. // because http.StatusNotModified was returned.
  2611. func (c *ServicesCheckCall) Do(opts ...googleapi.CallOption) (*CheckResponse, error) {
  2612. gensupport.SetOptions(c.urlParams_, opts...)
  2613. res, err := c.doRequest("json")
  2614. if res != nil && res.StatusCode == http.StatusNotModified {
  2615. if res.Body != nil {
  2616. res.Body.Close()
  2617. }
  2618. return nil, &googleapi.Error{
  2619. Code: res.StatusCode,
  2620. Header: res.Header,
  2621. }
  2622. }
  2623. if err != nil {
  2624. return nil, err
  2625. }
  2626. defer googleapi.CloseBody(res)
  2627. if err := googleapi.CheckResponse(res); err != nil {
  2628. return nil, err
  2629. }
  2630. ret := &CheckResponse{
  2631. ServerResponse: googleapi.ServerResponse{
  2632. Header: res.Header,
  2633. HTTPStatusCode: res.StatusCode,
  2634. },
  2635. }
  2636. target := &ret
  2637. if err := gensupport.DecodeResponse(target, res); err != nil {
  2638. return nil, err
  2639. }
  2640. return ret, nil
  2641. // {
  2642. // "description": "Checks whether an operation on a service should be allowed to proceed\nbased on the configuration of the service and related policies. It must be\ncalled before the operation is executed.\n\nIf feasible, the client should cache the check results and reuse them for\n60 seconds. In case of any server errors, the client should rely on the\ncached results for much longer time to avoid outage.\nWARNING: There is general 60s delay for the configuration and policy\npropagation, therefore callers MUST NOT depend on the `Check` method having\nthe latest policy information.\n\nNOTE: the CheckRequest has the size limit of 64KB.\n\nThis method requires the `servicemanagement.services.check` permission\non the specified service. For more information, see\n[Cloud IAM](https://cloud.google.com/iam).",
  2643. // "flatPath": "v1/services/{serviceName}:check",
  2644. // "httpMethod": "POST",
  2645. // "id": "servicecontrol.services.check",
  2646. // "parameterOrder": [
  2647. // "serviceName"
  2648. // ],
  2649. // "parameters": {
  2650. // "serviceName": {
  2651. // "description": "The service name as specified in its service configuration. For example,\n`\"pubsub.googleapis.com\"`.\n\nSee\n[google.api.Service](https://cloud.google.com/service-management/reference/rpc/google.api#google.api.Service)\nfor the definition of a service name.",
  2652. // "location": "path",
  2653. // "required": true,
  2654. // "type": "string"
  2655. // }
  2656. // },
  2657. // "path": "v1/services/{serviceName}:check",
  2658. // "request": {
  2659. // "$ref": "CheckRequest"
  2660. // },
  2661. // "response": {
  2662. // "$ref": "CheckResponse"
  2663. // },
  2664. // "scopes": [
  2665. // "https://www.googleapis.com/auth/cloud-platform",
  2666. // "https://www.googleapis.com/auth/servicecontrol"
  2667. // ]
  2668. // }
  2669. }
  2670. // method id "servicecontrol.services.endReconciliation":
  2671. type ServicesEndReconciliationCall struct {
  2672. s *Service
  2673. serviceName string
  2674. endreconciliationrequest *EndReconciliationRequest
  2675. urlParams_ gensupport.URLParams
  2676. ctx_ context.Context
  2677. header_ http.Header
  2678. }
  2679. // EndReconciliation: Signals the quota controller that service ends the
  2680. // ongoing usage
  2681. // reconciliation.
  2682. //
  2683. // This method requires the
  2684. // `servicemanagement.services.quota`
  2685. // permission on the specified service. For more information,
  2686. // see
  2687. // [Google Cloud IAM](https://cloud.google.com/iam).
  2688. func (r *ServicesService) EndReconciliation(serviceName string, endreconciliationrequest *EndReconciliationRequest) *ServicesEndReconciliationCall {
  2689. c := &ServicesEndReconciliationCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2690. c.serviceName = serviceName
  2691. c.endreconciliationrequest = endreconciliationrequest
  2692. return c
  2693. }
  2694. // Fields allows partial responses to be retrieved. See
  2695. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2696. // for more information.
  2697. func (c *ServicesEndReconciliationCall) Fields(s ...googleapi.Field) *ServicesEndReconciliationCall {
  2698. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2699. return c
  2700. }
  2701. // Context sets the context to be used in this call's Do method. Any
  2702. // pending HTTP request will be aborted if the provided context is
  2703. // canceled.
  2704. func (c *ServicesEndReconciliationCall) Context(ctx context.Context) *ServicesEndReconciliationCall {
  2705. c.ctx_ = ctx
  2706. return c
  2707. }
  2708. // Header returns an http.Header that can be modified by the caller to
  2709. // add HTTP headers to the request.
  2710. func (c *ServicesEndReconciliationCall) Header() http.Header {
  2711. if c.header_ == nil {
  2712. c.header_ = make(http.Header)
  2713. }
  2714. return c.header_
  2715. }
  2716. func (c *ServicesEndReconciliationCall) doRequest(alt string) (*http.Response, error) {
  2717. reqHeaders := make(http.Header)
  2718. for k, v := range c.header_ {
  2719. reqHeaders[k] = v
  2720. }
  2721. reqHeaders.Set("User-Agent", c.s.userAgent())
  2722. var body io.Reader = nil
  2723. body, err := googleapi.WithoutDataWrapper.JSONReader(c.endreconciliationrequest)
  2724. if err != nil {
  2725. return nil, err
  2726. }
  2727. reqHeaders.Set("Content-Type", "application/json")
  2728. c.urlParams_.Set("alt", alt)
  2729. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/services/{serviceName}:endReconciliation")
  2730. urls += "?" + c.urlParams_.Encode()
  2731. req, _ := http.NewRequest("POST", urls, body)
  2732. req.Header = reqHeaders
  2733. googleapi.Expand(req.URL, map[string]string{
  2734. "serviceName": c.serviceName,
  2735. })
  2736. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2737. }
  2738. // Do executes the "servicecontrol.services.endReconciliation" call.
  2739. // Exactly one of *EndReconciliationResponse or error will be non-nil.
  2740. // Any non-2xx status code is an error. Response headers are in either
  2741. // *EndReconciliationResponse.ServerResponse.Header or (if a response
  2742. // was returned at all) in error.(*googleapi.Error).Header. Use
  2743. // googleapi.IsNotModified to check whether the returned error was
  2744. // because http.StatusNotModified was returned.
  2745. func (c *ServicesEndReconciliationCall) Do(opts ...googleapi.CallOption) (*EndReconciliationResponse, error) {
  2746. gensupport.SetOptions(c.urlParams_, opts...)
  2747. res, err := c.doRequest("json")
  2748. if res != nil && res.StatusCode == http.StatusNotModified {
  2749. if res.Body != nil {
  2750. res.Body.Close()
  2751. }
  2752. return nil, &googleapi.Error{
  2753. Code: res.StatusCode,
  2754. Header: res.Header,
  2755. }
  2756. }
  2757. if err != nil {
  2758. return nil, err
  2759. }
  2760. defer googleapi.CloseBody(res)
  2761. if err := googleapi.CheckResponse(res); err != nil {
  2762. return nil, err
  2763. }
  2764. ret := &EndReconciliationResponse{
  2765. ServerResponse: googleapi.ServerResponse{
  2766. Header: res.Header,
  2767. HTTPStatusCode: res.StatusCode,
  2768. },
  2769. }
  2770. target := &ret
  2771. if err := gensupport.DecodeResponse(target, res); err != nil {
  2772. return nil, err
  2773. }
  2774. return ret, nil
  2775. // {
  2776. // "description": "Signals the quota controller that service ends the ongoing usage\nreconciliation.\n\nThis method requires the `servicemanagement.services.quota`\npermission on the specified service. For more information, see\n[Google Cloud IAM](https://cloud.google.com/iam).",
  2777. // "flatPath": "v1/services/{serviceName}:endReconciliation",
  2778. // "httpMethod": "POST",
  2779. // "id": "servicecontrol.services.endReconciliation",
  2780. // "parameterOrder": [
  2781. // "serviceName"
  2782. // ],
  2783. // "parameters": {
  2784. // "serviceName": {
  2785. // "description": "Name of the service as specified in the service configuration. For example,\n`\"pubsub.googleapis.com\"`.\n\nSee google.api.Service for the definition of a service name.",
  2786. // "location": "path",
  2787. // "required": true,
  2788. // "type": "string"
  2789. // }
  2790. // },
  2791. // "path": "v1/services/{serviceName}:endReconciliation",
  2792. // "request": {
  2793. // "$ref": "EndReconciliationRequest"
  2794. // },
  2795. // "response": {
  2796. // "$ref": "EndReconciliationResponse"
  2797. // },
  2798. // "scopes": [
  2799. // "https://www.googleapis.com/auth/cloud-platform",
  2800. // "https://www.googleapis.com/auth/servicecontrol"
  2801. // ]
  2802. // }
  2803. }
  2804. // method id "servicecontrol.services.releaseQuota":
  2805. type ServicesReleaseQuotaCall struct {
  2806. s *Service
  2807. serviceName string
  2808. releasequotarequest *ReleaseQuotaRequest
  2809. urlParams_ gensupport.URLParams
  2810. ctx_ context.Context
  2811. header_ http.Header
  2812. }
  2813. // ReleaseQuota: Releases previously allocated quota done through
  2814. // AllocateQuota method.
  2815. //
  2816. // This method requires the
  2817. // `servicemanagement.services.quota`
  2818. // permission on the specified service. For more information, see
  2819. // [Cloud IAM](https://cloud.google.com/iam).
  2820. //
  2821. //
  2822. // **NOTE:** The client **must** fail-open on server errors
  2823. // `INTERNAL`,
  2824. // `UNKNOWN`, `DEADLINE_EXCEEDED`, and `UNAVAILABLE`. To ensure
  2825. // system
  2826. // reliability, the server may inject these errors to prohibit any
  2827. // hard
  2828. // dependency on the quota functionality.
  2829. func (r *ServicesService) ReleaseQuota(serviceName string, releasequotarequest *ReleaseQuotaRequest) *ServicesReleaseQuotaCall {
  2830. c := &ServicesReleaseQuotaCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2831. c.serviceName = serviceName
  2832. c.releasequotarequest = releasequotarequest
  2833. return c
  2834. }
  2835. // Fields allows partial responses to be retrieved. See
  2836. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2837. // for more information.
  2838. func (c *ServicesReleaseQuotaCall) Fields(s ...googleapi.Field) *ServicesReleaseQuotaCall {
  2839. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2840. return c
  2841. }
  2842. // Context sets the context to be used in this call's Do method. Any
  2843. // pending HTTP request will be aborted if the provided context is
  2844. // canceled.
  2845. func (c *ServicesReleaseQuotaCall) Context(ctx context.Context) *ServicesReleaseQuotaCall {
  2846. c.ctx_ = ctx
  2847. return c
  2848. }
  2849. // Header returns an http.Header that can be modified by the caller to
  2850. // add HTTP headers to the request.
  2851. func (c *ServicesReleaseQuotaCall) Header() http.Header {
  2852. if c.header_ == nil {
  2853. c.header_ = make(http.Header)
  2854. }
  2855. return c.header_
  2856. }
  2857. func (c *ServicesReleaseQuotaCall) doRequest(alt string) (*http.Response, error) {
  2858. reqHeaders := make(http.Header)
  2859. for k, v := range c.header_ {
  2860. reqHeaders[k] = v
  2861. }
  2862. reqHeaders.Set("User-Agent", c.s.userAgent())
  2863. var body io.Reader = nil
  2864. body, err := googleapi.WithoutDataWrapper.JSONReader(c.releasequotarequest)
  2865. if err != nil {
  2866. return nil, err
  2867. }
  2868. reqHeaders.Set("Content-Type", "application/json")
  2869. c.urlParams_.Set("alt", alt)
  2870. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/services/{serviceName}:releaseQuota")
  2871. urls += "?" + c.urlParams_.Encode()
  2872. req, _ := http.NewRequest("POST", urls, body)
  2873. req.Header = reqHeaders
  2874. googleapi.Expand(req.URL, map[string]string{
  2875. "serviceName": c.serviceName,
  2876. })
  2877. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2878. }
  2879. // Do executes the "servicecontrol.services.releaseQuota" call.
  2880. // Exactly one of *ReleaseQuotaResponse or error will be non-nil. Any
  2881. // non-2xx status code is an error. Response headers are in either
  2882. // *ReleaseQuotaResponse.ServerResponse.Header or (if a response was
  2883. // returned at all) in error.(*googleapi.Error).Header. Use
  2884. // googleapi.IsNotModified to check whether the returned error was
  2885. // because http.StatusNotModified was returned.
  2886. func (c *ServicesReleaseQuotaCall) Do(opts ...googleapi.CallOption) (*ReleaseQuotaResponse, error) {
  2887. gensupport.SetOptions(c.urlParams_, opts...)
  2888. res, err := c.doRequest("json")
  2889. if res != nil && res.StatusCode == http.StatusNotModified {
  2890. if res.Body != nil {
  2891. res.Body.Close()
  2892. }
  2893. return nil, &googleapi.Error{
  2894. Code: res.StatusCode,
  2895. Header: res.Header,
  2896. }
  2897. }
  2898. if err != nil {
  2899. return nil, err
  2900. }
  2901. defer googleapi.CloseBody(res)
  2902. if err := googleapi.CheckResponse(res); err != nil {
  2903. return nil, err
  2904. }
  2905. ret := &ReleaseQuotaResponse{
  2906. ServerResponse: googleapi.ServerResponse{
  2907. Header: res.Header,
  2908. HTTPStatusCode: res.StatusCode,
  2909. },
  2910. }
  2911. target := &ret
  2912. if err := gensupport.DecodeResponse(target, res); err != nil {
  2913. return nil, err
  2914. }
  2915. return ret, nil
  2916. // {
  2917. // "description": "Releases previously allocated quota done through AllocateQuota method.\n\nThis method requires the `servicemanagement.services.quota`\npermission on the specified service. For more information, see\n[Cloud IAM](https://cloud.google.com/iam).\n\n\n**NOTE:** The client **must** fail-open on server errors `INTERNAL`,\n`UNKNOWN`, `DEADLINE_EXCEEDED`, and `UNAVAILABLE`. To ensure system\nreliability, the server may inject these errors to prohibit any hard\ndependency on the quota functionality.",
  2918. // "flatPath": "v1/services/{serviceName}:releaseQuota",
  2919. // "httpMethod": "POST",
  2920. // "id": "servicecontrol.services.releaseQuota",
  2921. // "parameterOrder": [
  2922. // "serviceName"
  2923. // ],
  2924. // "parameters": {
  2925. // "serviceName": {
  2926. // "description": "Name of the service as specified in the service configuration. For example,\n`\"pubsub.googleapis.com\"`.\n\nSee google.api.Service for the definition of a service name.",
  2927. // "location": "path",
  2928. // "required": true,
  2929. // "type": "string"
  2930. // }
  2931. // },
  2932. // "path": "v1/services/{serviceName}:releaseQuota",
  2933. // "request": {
  2934. // "$ref": "ReleaseQuotaRequest"
  2935. // },
  2936. // "response": {
  2937. // "$ref": "ReleaseQuotaResponse"
  2938. // },
  2939. // "scopes": [
  2940. // "https://www.googleapis.com/auth/cloud-platform",
  2941. // "https://www.googleapis.com/auth/servicecontrol"
  2942. // ]
  2943. // }
  2944. }
  2945. // method id "servicecontrol.services.report":
  2946. type ServicesReportCall struct {
  2947. s *Service
  2948. serviceName string
  2949. reportrequest *ReportRequest
  2950. urlParams_ gensupport.URLParams
  2951. ctx_ context.Context
  2952. header_ http.Header
  2953. }
  2954. // Report: Reports operation results to Google Service Control, such as
  2955. // logs and
  2956. // metrics. It should be called after an operation is completed.
  2957. //
  2958. // If feasible, the client should aggregate reporting data for up to
  2959. // 5
  2960. // seconds to reduce API traffic. Limiting aggregation to 5 seconds is
  2961. // to
  2962. // reduce data loss during client crashes. Clients should carefully
  2963. // choose
  2964. // the aggregation time window to avoid data loss risk more than
  2965. // 0.01%
  2966. // for business and compliance reasons.
  2967. //
  2968. // NOTE: the ReportRequest has the size limit of 1MB.
  2969. //
  2970. // This method requires the `servicemanagement.services.report`
  2971. // permission
  2972. // on the specified service. For more information, see
  2973. // [Google Cloud IAM](https://cloud.google.com/iam).
  2974. func (r *ServicesService) Report(serviceName string, reportrequest *ReportRequest) *ServicesReportCall {
  2975. c := &ServicesReportCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2976. c.serviceName = serviceName
  2977. c.reportrequest = reportrequest
  2978. return c
  2979. }
  2980. // Fields allows partial responses to be retrieved. See
  2981. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2982. // for more information.
  2983. func (c *ServicesReportCall) Fields(s ...googleapi.Field) *ServicesReportCall {
  2984. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2985. return c
  2986. }
  2987. // Context sets the context to be used in this call's Do method. Any
  2988. // pending HTTP request will be aborted if the provided context is
  2989. // canceled.
  2990. func (c *ServicesReportCall) Context(ctx context.Context) *ServicesReportCall {
  2991. c.ctx_ = ctx
  2992. return c
  2993. }
  2994. // Header returns an http.Header that can be modified by the caller to
  2995. // add HTTP headers to the request.
  2996. func (c *ServicesReportCall) Header() http.Header {
  2997. if c.header_ == nil {
  2998. c.header_ = make(http.Header)
  2999. }
  3000. return c.header_
  3001. }
  3002. func (c *ServicesReportCall) doRequest(alt string) (*http.Response, error) {
  3003. reqHeaders := make(http.Header)
  3004. for k, v := range c.header_ {
  3005. reqHeaders[k] = v
  3006. }
  3007. reqHeaders.Set("User-Agent", c.s.userAgent())
  3008. var body io.Reader = nil
  3009. body, err := googleapi.WithoutDataWrapper.JSONReader(c.reportrequest)
  3010. if err != nil {
  3011. return nil, err
  3012. }
  3013. reqHeaders.Set("Content-Type", "application/json")
  3014. c.urlParams_.Set("alt", alt)
  3015. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/services/{serviceName}:report")
  3016. urls += "?" + c.urlParams_.Encode()
  3017. req, _ := http.NewRequest("POST", urls, body)
  3018. req.Header = reqHeaders
  3019. googleapi.Expand(req.URL, map[string]string{
  3020. "serviceName": c.serviceName,
  3021. })
  3022. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3023. }
  3024. // Do executes the "servicecontrol.services.report" call.
  3025. // Exactly one of *ReportResponse or error will be non-nil. Any non-2xx
  3026. // status code is an error. Response headers are in either
  3027. // *ReportResponse.ServerResponse.Header or (if a response was returned
  3028. // at all) in error.(*googleapi.Error).Header. Use
  3029. // googleapi.IsNotModified to check whether the returned error was
  3030. // because http.StatusNotModified was returned.
  3031. func (c *ServicesReportCall) Do(opts ...googleapi.CallOption) (*ReportResponse, error) {
  3032. gensupport.SetOptions(c.urlParams_, opts...)
  3033. res, err := c.doRequest("json")
  3034. if res != nil && res.StatusCode == http.StatusNotModified {
  3035. if res.Body != nil {
  3036. res.Body.Close()
  3037. }
  3038. return nil, &googleapi.Error{
  3039. Code: res.StatusCode,
  3040. Header: res.Header,
  3041. }
  3042. }
  3043. if err != nil {
  3044. return nil, err
  3045. }
  3046. defer googleapi.CloseBody(res)
  3047. if err := googleapi.CheckResponse(res); err != nil {
  3048. return nil, err
  3049. }
  3050. ret := &ReportResponse{
  3051. ServerResponse: googleapi.ServerResponse{
  3052. Header: res.Header,
  3053. HTTPStatusCode: res.StatusCode,
  3054. },
  3055. }
  3056. target := &ret
  3057. if err := gensupport.DecodeResponse(target, res); err != nil {
  3058. return nil, err
  3059. }
  3060. return ret, nil
  3061. // {
  3062. // "description": "Reports operation results to Google Service Control, such as logs and\nmetrics. It should be called after an operation is completed.\n\nIf feasible, the client should aggregate reporting data for up to 5\nseconds to reduce API traffic. Limiting aggregation to 5 seconds is to\nreduce data loss during client crashes. Clients should carefully choose\nthe aggregation time window to avoid data loss risk more than 0.01%\nfor business and compliance reasons.\n\nNOTE: the ReportRequest has the size limit of 1MB.\n\nThis method requires the `servicemanagement.services.report` permission\non the specified service. For more information, see\n[Google Cloud IAM](https://cloud.google.com/iam).",
  3063. // "flatPath": "v1/services/{serviceName}:report",
  3064. // "httpMethod": "POST",
  3065. // "id": "servicecontrol.services.report",
  3066. // "parameterOrder": [
  3067. // "serviceName"
  3068. // ],
  3069. // "parameters": {
  3070. // "serviceName": {
  3071. // "description": "The service name as specified in its service configuration. For example,\n`\"pubsub.googleapis.com\"`.\n\nSee\n[google.api.Service](https://cloud.google.com/service-management/reference/rpc/google.api#google.api.Service)\nfor the definition of a service name.",
  3072. // "location": "path",
  3073. // "required": true,
  3074. // "type": "string"
  3075. // }
  3076. // },
  3077. // "path": "v1/services/{serviceName}:report",
  3078. // "request": {
  3079. // "$ref": "ReportRequest"
  3080. // },
  3081. // "response": {
  3082. // "$ref": "ReportResponse"
  3083. // },
  3084. // "scopes": [
  3085. // "https://www.googleapis.com/auth/cloud-platform",
  3086. // "https://www.googleapis.com/auth/servicecontrol"
  3087. // ]
  3088. // }
  3089. }
  3090. // method id "servicecontrol.services.startReconciliation":
  3091. type ServicesStartReconciliationCall struct {
  3092. s *Service
  3093. serviceName string
  3094. startreconciliationrequest *StartReconciliationRequest
  3095. urlParams_ gensupport.URLParams
  3096. ctx_ context.Context
  3097. header_ http.Header
  3098. }
  3099. // StartReconciliation: Unlike rate quota, allocation quota does not get
  3100. // refilled periodically.
  3101. // So, it is possible that the quota usage as seen by the service
  3102. // differs from
  3103. // what the One Platform considers the usage is. This is expected to
  3104. // happen
  3105. // only rarely, but over time this can accumulate. Services can
  3106. // invoke
  3107. // StartReconciliation and EndReconciliation to correct this usage
  3108. // drift, as
  3109. // described below:
  3110. // 1. Service sends StartReconciliation with a timestamp in future for
  3111. // each
  3112. // metric that needs to be reconciled. The timestamp being in future
  3113. // allows
  3114. // to account for in-flight AllocateQuota and ReleaseQuota requests
  3115. // for the
  3116. // same metric.
  3117. // 2. One Platform records this timestamp and starts tracking
  3118. // subsequent
  3119. // AllocateQuota and ReleaseQuota requests until EndReconciliation
  3120. // is
  3121. // called.
  3122. // 3. At or after the time specified in the StartReconciliation,
  3123. // service
  3124. // sends EndReconciliation with the usage that needs to be reconciled
  3125. // to.
  3126. // 4. One Platform adjusts its own record of usage for that metric to
  3127. // the
  3128. // value specified in EndReconciliation by taking in to account any
  3129. // allocation or release between StartReconciliation and
  3130. // EndReconciliation.
  3131. //
  3132. // Signals the quota controller that the service wants to perform a
  3133. // usage
  3134. // reconciliation as specified in the request.
  3135. //
  3136. // This method requires the
  3137. // `servicemanagement.services.quota`
  3138. // permission on the specified service. For more information,
  3139. // see
  3140. // [Google Cloud IAM](https://cloud.google.com/iam).
  3141. func (r *ServicesService) StartReconciliation(serviceName string, startreconciliationrequest *StartReconciliationRequest) *ServicesStartReconciliationCall {
  3142. c := &ServicesStartReconciliationCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3143. c.serviceName = serviceName
  3144. c.startreconciliationrequest = startreconciliationrequest
  3145. return c
  3146. }
  3147. // Fields allows partial responses to be retrieved. See
  3148. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3149. // for more information.
  3150. func (c *ServicesStartReconciliationCall) Fields(s ...googleapi.Field) *ServicesStartReconciliationCall {
  3151. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3152. return c
  3153. }
  3154. // Context sets the context to be used in this call's Do method. Any
  3155. // pending HTTP request will be aborted if the provided context is
  3156. // canceled.
  3157. func (c *ServicesStartReconciliationCall) Context(ctx context.Context) *ServicesStartReconciliationCall {
  3158. c.ctx_ = ctx
  3159. return c
  3160. }
  3161. // Header returns an http.Header that can be modified by the caller to
  3162. // add HTTP headers to the request.
  3163. func (c *ServicesStartReconciliationCall) Header() http.Header {
  3164. if c.header_ == nil {
  3165. c.header_ = make(http.Header)
  3166. }
  3167. return c.header_
  3168. }
  3169. func (c *ServicesStartReconciliationCall) doRequest(alt string) (*http.Response, error) {
  3170. reqHeaders := make(http.Header)
  3171. for k, v := range c.header_ {
  3172. reqHeaders[k] = v
  3173. }
  3174. reqHeaders.Set("User-Agent", c.s.userAgent())
  3175. var body io.Reader = nil
  3176. body, err := googleapi.WithoutDataWrapper.JSONReader(c.startreconciliationrequest)
  3177. if err != nil {
  3178. return nil, err
  3179. }
  3180. reqHeaders.Set("Content-Type", "application/json")
  3181. c.urlParams_.Set("alt", alt)
  3182. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/services/{serviceName}:startReconciliation")
  3183. urls += "?" + c.urlParams_.Encode()
  3184. req, _ := http.NewRequest("POST", urls, body)
  3185. req.Header = reqHeaders
  3186. googleapi.Expand(req.URL, map[string]string{
  3187. "serviceName": c.serviceName,
  3188. })
  3189. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3190. }
  3191. // Do executes the "servicecontrol.services.startReconciliation" call.
  3192. // Exactly one of *StartReconciliationResponse or error will be non-nil.
  3193. // Any non-2xx status code is an error. Response headers are in either
  3194. // *StartReconciliationResponse.ServerResponse.Header or (if a response
  3195. // was returned at all) in error.(*googleapi.Error).Header. Use
  3196. // googleapi.IsNotModified to check whether the returned error was
  3197. // because http.StatusNotModified was returned.
  3198. func (c *ServicesStartReconciliationCall) Do(opts ...googleapi.CallOption) (*StartReconciliationResponse, error) {
  3199. gensupport.SetOptions(c.urlParams_, opts...)
  3200. res, err := c.doRequest("json")
  3201. if res != nil && res.StatusCode == http.StatusNotModified {
  3202. if res.Body != nil {
  3203. res.Body.Close()
  3204. }
  3205. return nil, &googleapi.Error{
  3206. Code: res.StatusCode,
  3207. Header: res.Header,
  3208. }
  3209. }
  3210. if err != nil {
  3211. return nil, err
  3212. }
  3213. defer googleapi.CloseBody(res)
  3214. if err := googleapi.CheckResponse(res); err != nil {
  3215. return nil, err
  3216. }
  3217. ret := &StartReconciliationResponse{
  3218. ServerResponse: googleapi.ServerResponse{
  3219. Header: res.Header,
  3220. HTTPStatusCode: res.StatusCode,
  3221. },
  3222. }
  3223. target := &ret
  3224. if err := gensupport.DecodeResponse(target, res); err != nil {
  3225. return nil, err
  3226. }
  3227. return ret, nil
  3228. // {
  3229. // "description": "Unlike rate quota, allocation quota does not get refilled periodically.\nSo, it is possible that the quota usage as seen by the service differs from\nwhat the One Platform considers the usage is. This is expected to happen\nonly rarely, but over time this can accumulate. Services can invoke\nStartReconciliation and EndReconciliation to correct this usage drift, as\ndescribed below:\n1. Service sends StartReconciliation with a timestamp in future for each\n metric that needs to be reconciled. The timestamp being in future allows\n to account for in-flight AllocateQuota and ReleaseQuota requests for the\n same metric.\n2. One Platform records this timestamp and starts tracking subsequent\n AllocateQuota and ReleaseQuota requests until EndReconciliation is\n called.\n3. At or after the time specified in the StartReconciliation, service\n sends EndReconciliation with the usage that needs to be reconciled to.\n4. One Platform adjusts its own record of usage for that metric to the\n value specified in EndReconciliation by taking in to account any\n allocation or release between StartReconciliation and EndReconciliation.\n\nSignals the quota controller that the service wants to perform a usage\nreconciliation as specified in the request.\n\nThis method requires the `servicemanagement.services.quota`\npermission on the specified service. For more information, see\n[Google Cloud IAM](https://cloud.google.com/iam).",
  3230. // "flatPath": "v1/services/{serviceName}:startReconciliation",
  3231. // "httpMethod": "POST",
  3232. // "id": "servicecontrol.services.startReconciliation",
  3233. // "parameterOrder": [
  3234. // "serviceName"
  3235. // ],
  3236. // "parameters": {
  3237. // "serviceName": {
  3238. // "description": "Name of the service as specified in the service configuration. For example,\n`\"pubsub.googleapis.com\"`.\n\nSee google.api.Service for the definition of a service name.",
  3239. // "location": "path",
  3240. // "required": true,
  3241. // "type": "string"
  3242. // }
  3243. // },
  3244. // "path": "v1/services/{serviceName}:startReconciliation",
  3245. // "request": {
  3246. // "$ref": "StartReconciliationRequest"
  3247. // },
  3248. // "response": {
  3249. // "$ref": "StartReconciliationResponse"
  3250. // },
  3251. // "scopes": [
  3252. // "https://www.googleapis.com/auth/cloud-platform",
  3253. // "https://www.googleapis.com/auth/servicecontrol"
  3254. // ]
  3255. // }
  3256. }