You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

3507 lines
124 KiB

  1. // Copyright 2019 Google LLC.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. // Code generated file. DO NOT EDIT.
  5. // Package cloudbilling provides access to the Cloud Billing API.
  6. //
  7. // For product documentation, see: https://cloud.google.com/billing/
  8. //
  9. // Creating a client
  10. //
  11. // Usage example:
  12. //
  13. // import "google.golang.org/api/cloudbilling/v1"
  14. // ...
  15. // ctx := context.Background()
  16. // cloudbillingService, err := cloudbilling.NewService(ctx)
  17. //
  18. // In this example, Google Application Default Credentials are used for authentication.
  19. //
  20. // For information on how to create and obtain Application Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials.
  21. //
  22. // Other authentication options
  23. //
  24. // To use an API key for authentication (note: some APIs do not support API keys), use option.WithAPIKey:
  25. //
  26. // cloudbillingService, err := cloudbilling.NewService(ctx, option.WithAPIKey("AIza..."))
  27. //
  28. // To use an OAuth token (e.g., a user token obtained via a three-legged OAuth flow), use option.WithTokenSource:
  29. //
  30. // config := &oauth2.Config{...}
  31. // // ...
  32. // token, err := config.Exchange(ctx, ...)
  33. // cloudbillingService, err := cloudbilling.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token)))
  34. //
  35. // See https://godoc.org/google.golang.org/api/option/ for details on options.
  36. package cloudbilling // import "google.golang.org/api/cloudbilling/v1"
  37. import (
  38. "bytes"
  39. "context"
  40. "encoding/json"
  41. "errors"
  42. "fmt"
  43. "io"
  44. "net/http"
  45. "net/url"
  46. "strconv"
  47. "strings"
  48. gensupport "google.golang.org/api/gensupport"
  49. googleapi "google.golang.org/api/googleapi"
  50. option "google.golang.org/api/option"
  51. htransport "google.golang.org/api/transport/http"
  52. )
  53. // Always reference these packages, just in case the auto-generated code
  54. // below doesn't.
  55. var _ = bytes.NewBuffer
  56. var _ = strconv.Itoa
  57. var _ = fmt.Sprintf
  58. var _ = json.NewDecoder
  59. var _ = io.Copy
  60. var _ = url.Parse
  61. var _ = gensupport.MarshalJSON
  62. var _ = googleapi.Version
  63. var _ = errors.New
  64. var _ = strings.Replace
  65. var _ = context.Canceled
  66. const apiId = "cloudbilling:v1"
  67. const apiName = "cloudbilling"
  68. const apiVersion = "v1"
  69. const basePath = "https://cloudbilling.googleapis.com/"
  70. // OAuth2 scopes used by this API.
  71. const (
  72. // View and manage your data across Google Cloud Platform services
  73. CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platform"
  74. )
  75. // NewService creates a new APIService.
  76. func NewService(ctx context.Context, opts ...option.ClientOption) (*APIService, error) {
  77. scopesOption := option.WithScopes(
  78. "https://www.googleapis.com/auth/cloud-platform",
  79. )
  80. // NOTE: prepend, so we don't override user-specified scopes.
  81. opts = append([]option.ClientOption{scopesOption}, opts...)
  82. client, endpoint, err := htransport.NewClient(ctx, opts...)
  83. if err != nil {
  84. return nil, err
  85. }
  86. s, err := New(client)
  87. if err != nil {
  88. return nil, err
  89. }
  90. if endpoint != "" {
  91. s.BasePath = endpoint
  92. }
  93. return s, nil
  94. }
  95. // New creates a new APIService. It uses the provided http.Client for requests.
  96. //
  97. // Deprecated: please use NewService instead.
  98. // To provide a custom HTTP client, use option.WithHTTPClient.
  99. // If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead.
  100. func New(client *http.Client) (*APIService, error) {
  101. if client == nil {
  102. return nil, errors.New("client is nil")
  103. }
  104. s := &APIService{client: client, BasePath: basePath}
  105. s.BillingAccounts = NewBillingAccountsService(s)
  106. s.Projects = NewProjectsService(s)
  107. s.Services = NewServicesService(s)
  108. return s, nil
  109. }
  110. type APIService struct {
  111. client *http.Client
  112. BasePath string // API endpoint base URL
  113. UserAgent string // optional additional User-Agent fragment
  114. BillingAccounts *BillingAccountsService
  115. Projects *ProjectsService
  116. Services *ServicesService
  117. }
  118. func (s *APIService) userAgent() string {
  119. if s.UserAgent == "" {
  120. return googleapi.UserAgent
  121. }
  122. return googleapi.UserAgent + " " + s.UserAgent
  123. }
  124. func NewBillingAccountsService(s *APIService) *BillingAccountsService {
  125. rs := &BillingAccountsService{s: s}
  126. rs.Projects = NewBillingAccountsProjectsService(s)
  127. return rs
  128. }
  129. type BillingAccountsService struct {
  130. s *APIService
  131. Projects *BillingAccountsProjectsService
  132. }
  133. func NewBillingAccountsProjectsService(s *APIService) *BillingAccountsProjectsService {
  134. rs := &BillingAccountsProjectsService{s: s}
  135. return rs
  136. }
  137. type BillingAccountsProjectsService struct {
  138. s *APIService
  139. }
  140. func NewProjectsService(s *APIService) *ProjectsService {
  141. rs := &ProjectsService{s: s}
  142. return rs
  143. }
  144. type ProjectsService struct {
  145. s *APIService
  146. }
  147. func NewServicesService(s *APIService) *ServicesService {
  148. rs := &ServicesService{s: s}
  149. rs.Skus = NewServicesSkusService(s)
  150. return rs
  151. }
  152. type ServicesService struct {
  153. s *APIService
  154. Skus *ServicesSkusService
  155. }
  156. func NewServicesSkusService(s *APIService) *ServicesSkusService {
  157. rs := &ServicesSkusService{s: s}
  158. return rs
  159. }
  160. type ServicesSkusService struct {
  161. s *APIService
  162. }
  163. // AggregationInfo: Represents the aggregation level and interval for
  164. // pricing of a single SKU.
  165. type AggregationInfo struct {
  166. // AggregationCount: The number of intervals to aggregate over.
  167. // Example: If aggregation_level is "DAILY" and aggregation_count is
  168. // 14,
  169. // aggregation will be over 14 days.
  170. AggregationCount int64 `json:"aggregationCount,omitempty"`
  171. // Possible values:
  172. // "AGGREGATION_INTERVAL_UNSPECIFIED"
  173. // "DAILY"
  174. // "MONTHLY"
  175. AggregationInterval string `json:"aggregationInterval,omitempty"`
  176. // Possible values:
  177. // "AGGREGATION_LEVEL_UNSPECIFIED"
  178. // "ACCOUNT"
  179. // "PROJECT"
  180. AggregationLevel string `json:"aggregationLevel,omitempty"`
  181. // ForceSendFields is a list of field names (e.g. "AggregationCount") to
  182. // unconditionally include in API requests. By default, fields with
  183. // empty values are omitted from API requests. However, any non-pointer,
  184. // non-interface field appearing in ForceSendFields will be sent to the
  185. // server regardless of whether the field is empty or not. This may be
  186. // used to include empty fields in Patch requests.
  187. ForceSendFields []string `json:"-"`
  188. // NullFields is a list of field names (e.g. "AggregationCount") to
  189. // include in API requests with the JSON null value. By default, fields
  190. // with empty values are omitted from API requests. However, any field
  191. // with an empty value appearing in NullFields will be sent to the
  192. // server as null. It is an error if a field in this list has a
  193. // non-empty value. This may be used to include null fields in Patch
  194. // requests.
  195. NullFields []string `json:"-"`
  196. }
  197. func (s *AggregationInfo) MarshalJSON() ([]byte, error) {
  198. type NoMethod AggregationInfo
  199. raw := NoMethod(*s)
  200. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  201. }
  202. // AuditConfig: Specifies the audit configuration for a service.
  203. // The configuration determines which permission types are logged, and
  204. // what
  205. // identities, if any, are exempted from logging.
  206. // An AuditConfig must have one or more AuditLogConfigs.
  207. //
  208. // If there are AuditConfigs for both `allServices` and a specific
  209. // service,
  210. // the union of the two AuditConfigs is used for that service: the
  211. // log_types
  212. // specified in each AuditConfig are enabled, and the exempted_members
  213. // in each
  214. // AuditLogConfig are exempted.
  215. //
  216. // Example Policy with multiple AuditConfigs:
  217. //
  218. // {
  219. // "audit_configs": [
  220. // {
  221. // "service": "allServices"
  222. // "audit_log_configs": [
  223. // {
  224. // "log_type": "DATA_READ",
  225. // "exempted_members": [
  226. // "user:foo@gmail.com"
  227. // ]
  228. // },
  229. // {
  230. // "log_type": "DATA_WRITE",
  231. // },
  232. // {
  233. // "log_type": "ADMIN_READ",
  234. // }
  235. // ]
  236. // },
  237. // {
  238. // "service": "fooservice.googleapis.com"
  239. // "audit_log_configs": [
  240. // {
  241. // "log_type": "DATA_READ",
  242. // },
  243. // {
  244. // "log_type": "DATA_WRITE",
  245. // "exempted_members": [
  246. // "user:bar@gmail.com"
  247. // ]
  248. // }
  249. // ]
  250. // }
  251. // ]
  252. // }
  253. //
  254. // For fooservice, this policy enables DATA_READ, DATA_WRITE and
  255. // ADMIN_READ
  256. // logging. It also exempts foo@gmail.com from DATA_READ logging,
  257. // and
  258. // bar@gmail.com from DATA_WRITE logging.
  259. type AuditConfig struct {
  260. // AuditLogConfigs: The configuration for logging of each type of
  261. // permission.
  262. AuditLogConfigs []*AuditLogConfig `json:"auditLogConfigs,omitempty"`
  263. // Service: Specifies a service that will be enabled for audit
  264. // logging.
  265. // For example, `storage.googleapis.com`,
  266. // `cloudsql.googleapis.com`.
  267. // `allServices` is a special value that covers all services.
  268. Service string `json:"service,omitempty"`
  269. // ForceSendFields is a list of field names (e.g. "AuditLogConfigs") to
  270. // unconditionally include in API requests. By default, fields with
  271. // empty values are omitted from API requests. However, any non-pointer,
  272. // non-interface field appearing in ForceSendFields will be sent to the
  273. // server regardless of whether the field is empty or not. This may be
  274. // used to include empty fields in Patch requests.
  275. ForceSendFields []string `json:"-"`
  276. // NullFields is a list of field names (e.g. "AuditLogConfigs") to
  277. // include in API requests with the JSON null value. By default, fields
  278. // with empty values are omitted from API requests. However, any field
  279. // with an empty value appearing in NullFields will be sent to the
  280. // server as null. It is an error if a field in this list has a
  281. // non-empty value. This may be used to include null fields in Patch
  282. // requests.
  283. NullFields []string `json:"-"`
  284. }
  285. func (s *AuditConfig) MarshalJSON() ([]byte, error) {
  286. type NoMethod AuditConfig
  287. raw := NoMethod(*s)
  288. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  289. }
  290. // AuditLogConfig: Provides the configuration for logging a type of
  291. // permissions.
  292. // Example:
  293. //
  294. // {
  295. // "audit_log_configs": [
  296. // {
  297. // "log_type": "DATA_READ",
  298. // "exempted_members": [
  299. // "user:foo@gmail.com"
  300. // ]
  301. // },
  302. // {
  303. // "log_type": "DATA_WRITE",
  304. // }
  305. // ]
  306. // }
  307. //
  308. // This enables 'DATA_READ' and 'DATA_WRITE' logging, while
  309. // exempting
  310. // foo@gmail.com from DATA_READ logging.
  311. type AuditLogConfig struct {
  312. // ExemptedMembers: Specifies the identities that do not cause logging
  313. // for this type of
  314. // permission.
  315. // Follows the same format of Binding.members.
  316. ExemptedMembers []string `json:"exemptedMembers,omitempty"`
  317. // LogType: The log type that this config enables.
  318. //
  319. // Possible values:
  320. // "LOG_TYPE_UNSPECIFIED" - Default case. Should never be this.
  321. // "ADMIN_READ" - Admin reads. Example: CloudIAM getIamPolicy
  322. // "DATA_WRITE" - Data writes. Example: CloudSQL Users create
  323. // "DATA_READ" - Data reads. Example: CloudSQL Users list
  324. LogType string `json:"logType,omitempty"`
  325. // ForceSendFields is a list of field names (e.g. "ExemptedMembers") to
  326. // unconditionally include in API requests. By default, fields with
  327. // empty values are omitted from API requests. However, any non-pointer,
  328. // non-interface field appearing in ForceSendFields will be sent to the
  329. // server regardless of whether the field is empty or not. This may be
  330. // used to include empty fields in Patch requests.
  331. ForceSendFields []string `json:"-"`
  332. // NullFields is a list of field names (e.g. "ExemptedMembers") to
  333. // include in API requests with the JSON null value. By default, fields
  334. // with empty values are omitted from API requests. However, any field
  335. // with an empty value appearing in NullFields will be sent to the
  336. // server as null. It is an error if a field in this list has a
  337. // non-empty value. This may be used to include null fields in Patch
  338. // requests.
  339. NullFields []string `json:"-"`
  340. }
  341. func (s *AuditLogConfig) MarshalJSON() ([]byte, error) {
  342. type NoMethod AuditLogConfig
  343. raw := NoMethod(*s)
  344. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  345. }
  346. // BillingAccount: A billing account in [GCP
  347. // Console](https://console.cloud.google.com/).
  348. // You can assign a billing account to one or more projects.
  349. type BillingAccount struct {
  350. // DisplayName: The display name given to the billing account, such as
  351. // `My Billing
  352. // Account`. This name is displayed in the GCP Console.
  353. DisplayName string `json:"displayName,omitempty"`
  354. // MasterBillingAccount: If this account is
  355. // a
  356. // [subaccount](https://cloud.google.com/billing/docs/concepts), then
  357. // this
  358. // will be the resource name of the master billing account that it is
  359. // being
  360. // resold through.
  361. // Otherwise this will be empty.
  362. MasterBillingAccount string `json:"masterBillingAccount,omitempty"`
  363. // Name: The resource name of the billing account. The resource name has
  364. // the form
  365. // `billingAccounts/{billing_account_id}`. For
  366. // example,
  367. // `billingAccounts/012345-567890-ABCDEF` would be the resource name
  368. // for
  369. // billing account `012345-567890-ABCDEF`.
  370. Name string `json:"name,omitempty"`
  371. // Open: True if the billing account is open, and will therefore be
  372. // charged for any
  373. // usage on associated projects. False if the billing account is closed,
  374. // and
  375. // therefore projects associated with it will be unable to use paid
  376. // services.
  377. Open bool `json:"open,omitempty"`
  378. // ServerResponse contains the HTTP response code and headers from the
  379. // server.
  380. googleapi.ServerResponse `json:"-"`
  381. // ForceSendFields is a list of field names (e.g. "DisplayName") to
  382. // unconditionally include in API requests. By default, fields with
  383. // empty values are omitted from API requests. However, any non-pointer,
  384. // non-interface field appearing in ForceSendFields will be sent to the
  385. // server regardless of whether the field is empty or not. This may be
  386. // used to include empty fields in Patch requests.
  387. ForceSendFields []string `json:"-"`
  388. // NullFields is a list of field names (e.g. "DisplayName") to include
  389. // in API requests with the JSON null value. By default, fields with
  390. // empty values are omitted from API requests. However, any field with
  391. // an empty value appearing in NullFields will be sent to the server as
  392. // null. It is an error if a field in this list has a non-empty value.
  393. // This may be used to include null fields in Patch requests.
  394. NullFields []string `json:"-"`
  395. }
  396. func (s *BillingAccount) MarshalJSON() ([]byte, error) {
  397. type NoMethod BillingAccount
  398. raw := NoMethod(*s)
  399. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  400. }
  401. // Binding: Associates `members` with a `role`.
  402. type Binding struct {
  403. // Condition: Unimplemented. The condition that is associated with this
  404. // binding.
  405. // NOTE: an unsatisfied condition will not allow user access via
  406. // current
  407. // binding. Different bindings, including their conditions, are
  408. // examined
  409. // independently.
  410. Condition *Expr `json:"condition,omitempty"`
  411. // Members: Specifies the identities requesting access for a Cloud
  412. // Platform resource.
  413. // `members` can have the following values:
  414. //
  415. // * `allUsers`: A special identifier that represents anyone who is
  416. // on the internet; with or without a Google account.
  417. //
  418. // * `allAuthenticatedUsers`: A special identifier that represents
  419. // anyone
  420. // who is authenticated with a Google account or a service
  421. // account.
  422. //
  423. // * `user:{emailid}`: An email address that represents a specific
  424. // Google
  425. // account. For example, `alice@gmail.com` .
  426. //
  427. //
  428. // * `serviceAccount:{emailid}`: An email address that represents a
  429. // service
  430. // account. For example,
  431. // `my-other-app@appspot.gserviceaccount.com`.
  432. //
  433. // * `group:{emailid}`: An email address that represents a Google
  434. // group.
  435. // For example, `admins@example.com`.
  436. //
  437. //
  438. // * `domain:{domain}`: The G Suite domain (primary) that represents all
  439. // the
  440. // users of that domain. For example, `google.com` or
  441. // `example.com`.
  442. //
  443. //
  444. Members []string `json:"members,omitempty"`
  445. // Role: Role that is assigned to `members`.
  446. // For example, `roles/viewer`, `roles/editor`, or `roles/owner`.
  447. Role string `json:"role,omitempty"`
  448. // ForceSendFields is a list of field names (e.g. "Condition") to
  449. // unconditionally include in API requests. By default, fields with
  450. // empty values are omitted from API requests. However, any non-pointer,
  451. // non-interface field appearing in ForceSendFields will be sent to the
  452. // server regardless of whether the field is empty or not. This may be
  453. // used to include empty fields in Patch requests.
  454. ForceSendFields []string `json:"-"`
  455. // NullFields is a list of field names (e.g. "Condition") to include in
  456. // API requests with the JSON null value. By default, fields with empty
  457. // values are omitted from API requests. However, any field with an
  458. // empty value appearing in NullFields will be sent to the server as
  459. // null. It is an error if a field in this list has a non-empty value.
  460. // This may be used to include null fields in Patch requests.
  461. NullFields []string `json:"-"`
  462. }
  463. func (s *Binding) MarshalJSON() ([]byte, error) {
  464. type NoMethod Binding
  465. raw := NoMethod(*s)
  466. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  467. }
  468. // Category: Represents the category hierarchy of a SKU.
  469. type Category struct {
  470. // ResourceFamily: The type of product the SKU refers to.
  471. // Example: "Compute", "Storage", "Network", "ApplicationServices" etc.
  472. ResourceFamily string `json:"resourceFamily,omitempty"`
  473. // ResourceGroup: A group classification for related SKUs.
  474. // Example: "RAM", "GPU", "Prediction", "Ops", "GoogleEgress" etc.
  475. ResourceGroup string `json:"resourceGroup,omitempty"`
  476. // ServiceDisplayName: The display name of the service this SKU belongs
  477. // to.
  478. ServiceDisplayName string `json:"serviceDisplayName,omitempty"`
  479. // UsageType: Represents how the SKU is consumed.
  480. // Example: "OnDemand", "Preemptible", "Commit1Mo", "Commit1Yr" etc.
  481. UsageType string `json:"usageType,omitempty"`
  482. // ForceSendFields is a list of field names (e.g. "ResourceFamily") to
  483. // unconditionally include in API requests. By default, fields with
  484. // empty values are omitted from API requests. However, any non-pointer,
  485. // non-interface field appearing in ForceSendFields will be sent to the
  486. // server regardless of whether the field is empty or not. This may be
  487. // used to include empty fields in Patch requests.
  488. ForceSendFields []string `json:"-"`
  489. // NullFields is a list of field names (e.g. "ResourceFamily") to
  490. // include in API requests with the JSON null value. By default, fields
  491. // with empty values are omitted from API requests. However, any field
  492. // with an empty value appearing in NullFields will be sent to the
  493. // server as null. It is an error if a field in this list has a
  494. // non-empty value. This may be used to include null fields in Patch
  495. // requests.
  496. NullFields []string `json:"-"`
  497. }
  498. func (s *Category) MarshalJSON() ([]byte, error) {
  499. type NoMethod Category
  500. raw := NoMethod(*s)
  501. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  502. }
  503. // Expr: Represents an expression text. Example:
  504. //
  505. // title: "User account presence"
  506. // description: "Determines whether the request has a user account"
  507. // expression: "size(request.user) > 0"
  508. type Expr struct {
  509. // Description: An optional description of the expression. This is a
  510. // longer text which
  511. // describes the expression, e.g. when hovered over it in a UI.
  512. Description string `json:"description,omitempty"`
  513. // Expression: Textual representation of an expression in
  514. // Common Expression Language syntax.
  515. //
  516. // The application context of the containing message determines
  517. // which
  518. // well-known feature set of CEL is supported.
  519. Expression string `json:"expression,omitempty"`
  520. // Location: An optional string indicating the location of the
  521. // expression for error
  522. // reporting, e.g. a file name and a position in the file.
  523. Location string `json:"location,omitempty"`
  524. // Title: An optional title for the expression, i.e. a short string
  525. // describing
  526. // its purpose. This can be used e.g. in UIs which allow to enter
  527. // the
  528. // expression.
  529. Title string `json:"title,omitempty"`
  530. // ForceSendFields is a list of field names (e.g. "Description") to
  531. // unconditionally include in API requests. By default, fields with
  532. // empty values are omitted from API requests. However, any non-pointer,
  533. // non-interface field appearing in ForceSendFields will be sent to the
  534. // server regardless of whether the field is empty or not. This may be
  535. // used to include empty fields in Patch requests.
  536. ForceSendFields []string `json:"-"`
  537. // NullFields is a list of field names (e.g. "Description") to include
  538. // in API requests with the JSON null value. By default, fields with
  539. // empty values are omitted from API requests. However, any field with
  540. // an empty value appearing in NullFields will be sent to the server as
  541. // null. It is an error if a field in this list has a non-empty value.
  542. // This may be used to include null fields in Patch requests.
  543. NullFields []string `json:"-"`
  544. }
  545. func (s *Expr) MarshalJSON() ([]byte, error) {
  546. type NoMethod Expr
  547. raw := NoMethod(*s)
  548. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  549. }
  550. // ListBillingAccountsResponse: Response message for
  551. // `ListBillingAccounts`.
  552. type ListBillingAccountsResponse struct {
  553. // BillingAccounts: A list of billing accounts.
  554. BillingAccounts []*BillingAccount `json:"billingAccounts,omitempty"`
  555. // NextPageToken: A token to retrieve the next page of results. To
  556. // retrieve the next page,
  557. // call `ListBillingAccounts` again with the `page_token` field set to
  558. // this
  559. // value. This field is empty if there are no more results to retrieve.
  560. NextPageToken string `json:"nextPageToken,omitempty"`
  561. // ServerResponse contains the HTTP response code and headers from the
  562. // server.
  563. googleapi.ServerResponse `json:"-"`
  564. // ForceSendFields is a list of field names (e.g. "BillingAccounts") to
  565. // unconditionally include in API requests. By default, fields with
  566. // empty values are omitted from API requests. However, any non-pointer,
  567. // non-interface field appearing in ForceSendFields will be sent to the
  568. // server regardless of whether the field is empty or not. This may be
  569. // used to include empty fields in Patch requests.
  570. ForceSendFields []string `json:"-"`
  571. // NullFields is a list of field names (e.g. "BillingAccounts") to
  572. // include in API requests with the JSON null value. By default, fields
  573. // with empty values are omitted from API requests. However, any field
  574. // with an empty value appearing in NullFields will be sent to the
  575. // server as null. It is an error if a field in this list has a
  576. // non-empty value. This may be used to include null fields in Patch
  577. // requests.
  578. NullFields []string `json:"-"`
  579. }
  580. func (s *ListBillingAccountsResponse) MarshalJSON() ([]byte, error) {
  581. type NoMethod ListBillingAccountsResponse
  582. raw := NoMethod(*s)
  583. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  584. }
  585. // ListProjectBillingInfoResponse: Request message for
  586. // `ListProjectBillingInfoResponse`.
  587. type ListProjectBillingInfoResponse struct {
  588. // NextPageToken: A token to retrieve the next page of results. To
  589. // retrieve the next page,
  590. // call `ListProjectBillingInfo` again with the `page_token` field set
  591. // to this
  592. // value. This field is empty if there are no more results to retrieve.
  593. NextPageToken string `json:"nextPageToken,omitempty"`
  594. // ProjectBillingInfo: A list of `ProjectBillingInfo` resources
  595. // representing the projects
  596. // associated with the billing account.
  597. ProjectBillingInfo []*ProjectBillingInfo `json:"projectBillingInfo,omitempty"`
  598. // ServerResponse contains the HTTP response code and headers from the
  599. // server.
  600. googleapi.ServerResponse `json:"-"`
  601. // ForceSendFields is a list of field names (e.g. "NextPageToken") to
  602. // unconditionally include in API requests. By default, fields with
  603. // empty values are omitted from API requests. However, any non-pointer,
  604. // non-interface field appearing in ForceSendFields will be sent to the
  605. // server regardless of whether the field is empty or not. This may be
  606. // used to include empty fields in Patch requests.
  607. ForceSendFields []string `json:"-"`
  608. // NullFields is a list of field names (e.g. "NextPageToken") to include
  609. // in API requests with the JSON null value. By default, fields with
  610. // empty values are omitted from API requests. However, any field with
  611. // an empty value appearing in NullFields will be sent to the server as
  612. // null. It is an error if a field in this list has a non-empty value.
  613. // This may be used to include null fields in Patch requests.
  614. NullFields []string `json:"-"`
  615. }
  616. func (s *ListProjectBillingInfoResponse) MarshalJSON() ([]byte, error) {
  617. type NoMethod ListProjectBillingInfoResponse
  618. raw := NoMethod(*s)
  619. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  620. }
  621. // ListServicesResponse: Response message for `ListServices`.
  622. type ListServicesResponse struct {
  623. // NextPageToken: A token to retrieve the next page of results. To
  624. // retrieve the next page,
  625. // call `ListServices` again with the `page_token` field set to
  626. // this
  627. // value. This field is empty if there are no more results to retrieve.
  628. NextPageToken string `json:"nextPageToken,omitempty"`
  629. // Services: A list of services.
  630. Services []*Service `json:"services,omitempty"`
  631. // ServerResponse contains the HTTP response code and headers from the
  632. // server.
  633. googleapi.ServerResponse `json:"-"`
  634. // ForceSendFields is a list of field names (e.g. "NextPageToken") to
  635. // unconditionally include in API requests. By default, fields with
  636. // empty values are omitted from API requests. However, any non-pointer,
  637. // non-interface field appearing in ForceSendFields will be sent to the
  638. // server regardless of whether the field is empty or not. This may be
  639. // used to include empty fields in Patch requests.
  640. ForceSendFields []string `json:"-"`
  641. // NullFields is a list of field names (e.g. "NextPageToken") to include
  642. // in API requests with the JSON null value. By default, fields with
  643. // empty values are omitted from API requests. However, any field with
  644. // an empty value appearing in NullFields will be sent to the server as
  645. // null. It is an error if a field in this list has a non-empty value.
  646. // This may be used to include null fields in Patch requests.
  647. NullFields []string `json:"-"`
  648. }
  649. func (s *ListServicesResponse) MarshalJSON() ([]byte, error) {
  650. type NoMethod ListServicesResponse
  651. raw := NoMethod(*s)
  652. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  653. }
  654. // ListSkusResponse: Response message for `ListSkus`.
  655. type ListSkusResponse struct {
  656. // NextPageToken: A token to retrieve the next page of results. To
  657. // retrieve the next page,
  658. // call `ListSkus` again with the `page_token` field set to this
  659. // value. This field is empty if there are no more results to retrieve.
  660. NextPageToken string `json:"nextPageToken,omitempty"`
  661. // Skus: The list of public SKUs of the given service.
  662. Skus []*Sku `json:"skus,omitempty"`
  663. // ServerResponse contains the HTTP response code and headers from the
  664. // server.
  665. googleapi.ServerResponse `json:"-"`
  666. // ForceSendFields is a list of field names (e.g. "NextPageToken") to
  667. // unconditionally include in API requests. By default, fields with
  668. // empty values are omitted from API requests. However, any non-pointer,
  669. // non-interface field appearing in ForceSendFields will be sent to the
  670. // server regardless of whether the field is empty or not. This may be
  671. // used to include empty fields in Patch requests.
  672. ForceSendFields []string `json:"-"`
  673. // NullFields is a list of field names (e.g. "NextPageToken") to include
  674. // in API requests with the JSON null value. By default, fields with
  675. // empty values are omitted from API requests. However, any field with
  676. // an empty value appearing in NullFields will be sent to the server as
  677. // null. It is an error if a field in this list has a non-empty value.
  678. // This may be used to include null fields in Patch requests.
  679. NullFields []string `json:"-"`
  680. }
  681. func (s *ListSkusResponse) MarshalJSON() ([]byte, error) {
  682. type NoMethod ListSkusResponse
  683. raw := NoMethod(*s)
  684. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  685. }
  686. // Money: Represents an amount of money with its currency type.
  687. type Money struct {
  688. // CurrencyCode: The 3-letter currency code defined in ISO 4217.
  689. CurrencyCode string `json:"currencyCode,omitempty"`
  690. // Nanos: Number of nano (10^-9) units of the amount.
  691. // The value must be between -999,999,999 and +999,999,999 inclusive.
  692. // If `units` is positive, `nanos` must be positive or zero.
  693. // If `units` is zero, `nanos` can be positive, zero, or negative.
  694. // If `units` is negative, `nanos` must be negative or zero.
  695. // For example $-1.75 is represented as `units`=-1 and
  696. // `nanos`=-750,000,000.
  697. Nanos int64 `json:"nanos,omitempty"`
  698. // Units: The whole units of the amount.
  699. // For example if `currencyCode` is "USD", then 1 unit is one US
  700. // dollar.
  701. Units int64 `json:"units,omitempty,string"`
  702. // ForceSendFields is a list of field names (e.g. "CurrencyCode") to
  703. // unconditionally include in API requests. By default, fields with
  704. // empty values are omitted from API requests. However, any non-pointer,
  705. // non-interface field appearing in ForceSendFields will be sent to the
  706. // server regardless of whether the field is empty or not. This may be
  707. // used to include empty fields in Patch requests.
  708. ForceSendFields []string `json:"-"`
  709. // NullFields is a list of field names (e.g. "CurrencyCode") to include
  710. // in API requests with the JSON null value. By default, fields with
  711. // empty values are omitted from API requests. However, any field with
  712. // an empty value appearing in NullFields will be sent to the server as
  713. // null. It is an error if a field in this list has a non-empty value.
  714. // This may be used to include null fields in Patch requests.
  715. NullFields []string `json:"-"`
  716. }
  717. func (s *Money) MarshalJSON() ([]byte, error) {
  718. type NoMethod Money
  719. raw := NoMethod(*s)
  720. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  721. }
  722. // Policy: Defines an Identity and Access Management (IAM) policy. It is
  723. // used to
  724. // specify access control policies for Cloud Platform resources.
  725. //
  726. //
  727. // A `Policy` consists of a list of `bindings`. A `binding` binds a list
  728. // of
  729. // `members` to a `role`, where the members can be user accounts, Google
  730. // groups,
  731. // Google domains, and service accounts. A `role` is a named list of
  732. // permissions
  733. // defined by IAM.
  734. //
  735. // **JSON Example**
  736. //
  737. // {
  738. // "bindings": [
  739. // {
  740. // "role": "roles/owner",
  741. // "members": [
  742. // "user:mike@example.com",
  743. // "group:admins@example.com",
  744. // "domain:google.com",
  745. //
  746. // "serviceAccount:my-other-app@appspot.gserviceaccount.com"
  747. // ]
  748. // },
  749. // {
  750. // "role": "roles/viewer",
  751. // "members": ["user:sean@example.com"]
  752. // }
  753. // ]
  754. // }
  755. //
  756. // **YAML Example**
  757. //
  758. // bindings:
  759. // - members:
  760. // - user:mike@example.com
  761. // - group:admins@example.com
  762. // - domain:google.com
  763. // - serviceAccount:my-other-app@appspot.gserviceaccount.com
  764. // role: roles/owner
  765. // - members:
  766. // - user:sean@example.com
  767. // role: roles/viewer
  768. //
  769. //
  770. // For a description of IAM and its features, see the
  771. // [IAM developer's guide](https://cloud.google.com/iam/docs).
  772. type Policy struct {
  773. // AuditConfigs: Specifies cloud audit logging configuration for this
  774. // policy.
  775. AuditConfigs []*AuditConfig `json:"auditConfigs,omitempty"`
  776. // Bindings: Associates a list of `members` to a `role`.
  777. // `bindings` with no members will result in an error.
  778. Bindings []*Binding `json:"bindings,omitempty"`
  779. // Etag: `etag` is used for optimistic concurrency control as a way to
  780. // help
  781. // prevent simultaneous updates of a policy from overwriting each
  782. // other.
  783. // It is strongly suggested that systems make use of the `etag` in
  784. // the
  785. // read-modify-write cycle to perform policy updates in order to avoid
  786. // race
  787. // conditions: An `etag` is returned in the response to `getIamPolicy`,
  788. // and
  789. // systems are expected to put that etag in the request to
  790. // `setIamPolicy` to
  791. // ensure that their change will be applied to the same version of the
  792. // policy.
  793. //
  794. // If no `etag` is provided in the call to `setIamPolicy`, then the
  795. // existing
  796. // policy is overwritten blindly.
  797. Etag string `json:"etag,omitempty"`
  798. // Version: Deprecated.
  799. Version int64 `json:"version,omitempty"`
  800. // ServerResponse contains the HTTP response code and headers from the
  801. // server.
  802. googleapi.ServerResponse `json:"-"`
  803. // ForceSendFields is a list of field names (e.g. "AuditConfigs") to
  804. // unconditionally include in API requests. By default, fields with
  805. // empty values are omitted from API requests. However, any non-pointer,
  806. // non-interface field appearing in ForceSendFields will be sent to the
  807. // server regardless of whether the field is empty or not. This may be
  808. // used to include empty fields in Patch requests.
  809. ForceSendFields []string `json:"-"`
  810. // NullFields is a list of field names (e.g. "AuditConfigs") to include
  811. // in API requests with the JSON null value. By default, fields with
  812. // empty values are omitted from API requests. However, any field with
  813. // an empty value appearing in NullFields will be sent to the server as
  814. // null. It is an error if a field in this list has a non-empty value.
  815. // This may be used to include null fields in Patch requests.
  816. NullFields []string `json:"-"`
  817. }
  818. func (s *Policy) MarshalJSON() ([]byte, error) {
  819. type NoMethod Policy
  820. raw := NoMethod(*s)
  821. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  822. }
  823. // PricingExpression: Expresses a mathematical pricing formula. For
  824. // Example:-
  825. //
  826. // `usage_unit: GBy`
  827. // `tiered_rates:`
  828. // `[start_usage_amount: 20, unit_price: $10]`
  829. // `[start_usage_amount: 100, unit_price: $5]`
  830. //
  831. // The above expresses a pricing formula where the first 20GB is free,
  832. // the
  833. // next 80GB is priced at $10 per GB followed by $5 per GB for
  834. // additional
  835. // usage.
  836. type PricingExpression struct {
  837. // BaseUnit: The base unit for the SKU which is the unit used in usage
  838. // exports.
  839. // Example: "By"
  840. BaseUnit string `json:"baseUnit,omitempty"`
  841. // BaseUnitConversionFactor: Conversion factor for converting from price
  842. // per usage_unit to price per
  843. // base_unit, and start_usage_amount to start_usage_amount in
  844. // base_unit.
  845. // unit_price / base_unit_conversion_factor = price per
  846. // base_unit.
  847. // start_usage_amount * base_unit_conversion_factor = start_usage_amount
  848. // in
  849. // base_unit.
  850. BaseUnitConversionFactor float64 `json:"baseUnitConversionFactor,omitempty"`
  851. // BaseUnitDescription: The base unit in human readable form.
  852. // Example: "byte".
  853. BaseUnitDescription string `json:"baseUnitDescription,omitempty"`
  854. // DisplayQuantity: The recommended quantity of units for displaying
  855. // pricing info. When
  856. // displaying pricing info it is recommended to display:
  857. // (unit_price * display_quantity) per display_quantity usage_unit.
  858. // This field does not affect the pricing formula and is for display
  859. // purposes
  860. // only.
  861. // Example: If the unit_price is "0.0001 USD", the usage_unit is "GB"
  862. // and
  863. // the display_quantity is "1000" then the recommended way of displaying
  864. // the
  865. // pricing info is "0.10 USD per 1000 GB"
  866. DisplayQuantity float64 `json:"displayQuantity,omitempty"`
  867. // TieredRates: The list of tiered rates for this pricing. The total
  868. // cost is computed by
  869. // applying each of the tiered rates on usage. This repeated list is
  870. // sorted
  871. // by ascending order of start_usage_amount.
  872. TieredRates []*TierRate `json:"tieredRates,omitempty"`
  873. // UsageUnit: The short hand for unit of usage this pricing is specified
  874. // in.
  875. // Example: usage_unit of "GiBy" means that usage is specified in "Gibi
  876. // Byte".
  877. UsageUnit string `json:"usageUnit,omitempty"`
  878. // UsageUnitDescription: The unit of usage in human readable
  879. // form.
  880. // Example: "gibi byte".
  881. UsageUnitDescription string `json:"usageUnitDescription,omitempty"`
  882. // ForceSendFields is a list of field names (e.g. "BaseUnit") to
  883. // unconditionally include in API requests. By default, fields with
  884. // empty values are omitted from API requests. However, any non-pointer,
  885. // non-interface field appearing in ForceSendFields will be sent to the
  886. // server regardless of whether the field is empty or not. This may be
  887. // used to include empty fields in Patch requests.
  888. ForceSendFields []string `json:"-"`
  889. // NullFields is a list of field names (e.g. "BaseUnit") to include in
  890. // API requests with the JSON null value. By default, fields with empty
  891. // values are omitted from API requests. However, any field with an
  892. // empty value appearing in NullFields will be sent to the server as
  893. // null. It is an error if a field in this list has a non-empty value.
  894. // This may be used to include null fields in Patch requests.
  895. NullFields []string `json:"-"`
  896. }
  897. func (s *PricingExpression) MarshalJSON() ([]byte, error) {
  898. type NoMethod PricingExpression
  899. raw := NoMethod(*s)
  900. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  901. }
  902. func (s *PricingExpression) UnmarshalJSON(data []byte) error {
  903. type NoMethod PricingExpression
  904. var s1 struct {
  905. BaseUnitConversionFactor gensupport.JSONFloat64 `json:"baseUnitConversionFactor"`
  906. DisplayQuantity gensupport.JSONFloat64 `json:"displayQuantity"`
  907. *NoMethod
  908. }
  909. s1.NoMethod = (*NoMethod)(s)
  910. if err := json.Unmarshal(data, &s1); err != nil {
  911. return err
  912. }
  913. s.BaseUnitConversionFactor = float64(s1.BaseUnitConversionFactor)
  914. s.DisplayQuantity = float64(s1.DisplayQuantity)
  915. return nil
  916. }
  917. // PricingInfo: Represents the pricing information for a SKU at a single
  918. // point of time.
  919. type PricingInfo struct {
  920. // AggregationInfo: Aggregation Info. This can be left unspecified if
  921. // the pricing expression
  922. // doesn't require aggregation.
  923. AggregationInfo *AggregationInfo `json:"aggregationInfo,omitempty"`
  924. // CurrencyConversionRate: Conversion rate used for currency conversion,
  925. // from USD to the currency
  926. // specified in the request. This includes any surcharge collected for
  927. // billing
  928. // in non USD currency. If a currency is not specified in the request
  929. // this
  930. // defaults to 1.0.
  931. // Example: USD * currency_conversion_rate = JPY
  932. CurrencyConversionRate float64 `json:"currencyConversionRate,omitempty"`
  933. // EffectiveTime: The timestamp from which this pricing was effective
  934. // within the requested
  935. // time range. This is guaranteed to be greater than or equal to
  936. // the
  937. // start_time field in the request and less than the end_time field in
  938. // the
  939. // request. If a time range was not specified in the request this field
  940. // will
  941. // be equivalent to a time within the last 12 hours, indicating the
  942. // latest
  943. // pricing info.
  944. EffectiveTime string `json:"effectiveTime,omitempty"`
  945. // PricingExpression: Expresses the pricing formula. See
  946. // `PricingExpression` for an example.
  947. PricingExpression *PricingExpression `json:"pricingExpression,omitempty"`
  948. // Summary: An optional human readable summary of the pricing
  949. // information, has a
  950. // maximum length of 256 characters.
  951. Summary string `json:"summary,omitempty"`
  952. // ForceSendFields is a list of field names (e.g. "AggregationInfo") to
  953. // unconditionally include in API requests. By default, fields with
  954. // empty values are omitted from API requests. However, any non-pointer,
  955. // non-interface field appearing in ForceSendFields will be sent to the
  956. // server regardless of whether the field is empty or not. This may be
  957. // used to include empty fields in Patch requests.
  958. ForceSendFields []string `json:"-"`
  959. // NullFields is a list of field names (e.g. "AggregationInfo") to
  960. // include in API requests with the JSON null value. By default, fields
  961. // with empty values are omitted from API requests. However, any field
  962. // with an empty value appearing in NullFields will be sent to the
  963. // server as null. It is an error if a field in this list has a
  964. // non-empty value. This may be used to include null fields in Patch
  965. // requests.
  966. NullFields []string `json:"-"`
  967. }
  968. func (s *PricingInfo) MarshalJSON() ([]byte, error) {
  969. type NoMethod PricingInfo
  970. raw := NoMethod(*s)
  971. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  972. }
  973. func (s *PricingInfo) UnmarshalJSON(data []byte) error {
  974. type NoMethod PricingInfo
  975. var s1 struct {
  976. CurrencyConversionRate gensupport.JSONFloat64 `json:"currencyConversionRate"`
  977. *NoMethod
  978. }
  979. s1.NoMethod = (*NoMethod)(s)
  980. if err := json.Unmarshal(data, &s1); err != nil {
  981. return err
  982. }
  983. s.CurrencyConversionRate = float64(s1.CurrencyConversionRate)
  984. return nil
  985. }
  986. // ProjectBillingInfo: Encapsulation of billing information for a GCP
  987. // Console project. A project
  988. // has at most one associated billing account at a time (but a billing
  989. // account
  990. // can be assigned to multiple projects).
  991. type ProjectBillingInfo struct {
  992. // BillingAccountName: The resource name of the billing account
  993. // associated with the project, if
  994. // any. For example, `billingAccounts/012345-567890-ABCDEF`.
  995. BillingAccountName string `json:"billingAccountName,omitempty"`
  996. // BillingEnabled: True if the project is associated with an open
  997. // billing account, to which
  998. // usage on the project is charged. False if the project is associated
  999. // with a
  1000. // closed billing account, or no billing account at all, and therefore
  1001. // cannot
  1002. // use paid services. This field is read-only.
  1003. BillingEnabled bool `json:"billingEnabled,omitempty"`
  1004. // Name: The resource name for the `ProjectBillingInfo`; has the
  1005. // form
  1006. // `projects/{project_id}/billingInfo`. For example, the resource name
  1007. // for the
  1008. // billing information for project `tokyo-rain-123` would
  1009. // be
  1010. // `projects/tokyo-rain-123/billingInfo`. This field is read-only.
  1011. Name string `json:"name,omitempty"`
  1012. // ProjectId: The ID of the project that this `ProjectBillingInfo`
  1013. // represents, such as
  1014. // `tokyo-rain-123`. This is a convenience field so that you don't need
  1015. // to
  1016. // parse the `name` field to obtain a project ID. This field is
  1017. // read-only.
  1018. ProjectId string `json:"projectId,omitempty"`
  1019. // ServerResponse contains the HTTP response code and headers from the
  1020. // server.
  1021. googleapi.ServerResponse `json:"-"`
  1022. // ForceSendFields is a list of field names (e.g. "BillingAccountName")
  1023. // to unconditionally include in API requests. By default, fields with
  1024. // empty values are omitted from API requests. However, any non-pointer,
  1025. // non-interface field appearing in ForceSendFields will be sent to the
  1026. // server regardless of whether the field is empty or not. This may be
  1027. // used to include empty fields in Patch requests.
  1028. ForceSendFields []string `json:"-"`
  1029. // NullFields is a list of field names (e.g. "BillingAccountName") to
  1030. // include in API requests with the JSON null value. By default, fields
  1031. // with empty values are omitted from API requests. However, any field
  1032. // with an empty value appearing in NullFields will be sent to the
  1033. // server as null. It is an error if a field in this list has a
  1034. // non-empty value. This may be used to include null fields in Patch
  1035. // requests.
  1036. NullFields []string `json:"-"`
  1037. }
  1038. func (s *ProjectBillingInfo) MarshalJSON() ([]byte, error) {
  1039. type NoMethod ProjectBillingInfo
  1040. raw := NoMethod(*s)
  1041. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1042. }
  1043. // Service: Encapsulates a single service in Google Cloud Platform.
  1044. type Service struct {
  1045. // BusinessEntityName: The business under which the service is
  1046. // offered.
  1047. // Ex. "businessEntities/GCP", "businessEntities/Maps"
  1048. BusinessEntityName string `json:"businessEntityName,omitempty"`
  1049. // DisplayName: A human readable display name for this service.
  1050. DisplayName string `json:"displayName,omitempty"`
  1051. // Name: The resource name for the service.
  1052. // Example: "services/DA34-426B-A397"
  1053. Name string `json:"name,omitempty"`
  1054. // ServiceId: The identifier for the service.
  1055. // Example: "DA34-426B-A397"
  1056. ServiceId string `json:"serviceId,omitempty"`
  1057. // ForceSendFields is a list of field names (e.g. "BusinessEntityName")
  1058. // to unconditionally include in API requests. By default, fields with
  1059. // empty values are omitted from API requests. However, any non-pointer,
  1060. // non-interface field appearing in ForceSendFields will be sent to the
  1061. // server regardless of whether the field is empty or not. This may be
  1062. // used to include empty fields in Patch requests.
  1063. ForceSendFields []string `json:"-"`
  1064. // NullFields is a list of field names (e.g. "BusinessEntityName") to
  1065. // include in API requests with the JSON null value. By default, fields
  1066. // with empty values are omitted from API requests. However, any field
  1067. // with an empty value appearing in NullFields will be sent to the
  1068. // server as null. It is an error if a field in this list has a
  1069. // non-empty value. This may be used to include null fields in Patch
  1070. // requests.
  1071. NullFields []string `json:"-"`
  1072. }
  1073. func (s *Service) MarshalJSON() ([]byte, error) {
  1074. type NoMethod Service
  1075. raw := NoMethod(*s)
  1076. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1077. }
  1078. // SetIamPolicyRequest: Request message for `SetIamPolicy` method.
  1079. type SetIamPolicyRequest struct {
  1080. // Policy: REQUIRED: The complete policy to be applied to the
  1081. // `resource`. The size of
  1082. // the policy is limited to a few 10s of KB. An empty policy is a
  1083. // valid policy but certain Cloud Platform services (such as
  1084. // Projects)
  1085. // might reject them.
  1086. Policy *Policy `json:"policy,omitempty"`
  1087. // UpdateMask: OPTIONAL: A FieldMask specifying which fields of the
  1088. // policy to modify. Only
  1089. // the fields in the mask will be modified. If no mask is provided,
  1090. // the
  1091. // following default mask is used:
  1092. // paths: "bindings, etag"
  1093. // This field is only used by Cloud IAM.
  1094. UpdateMask string `json:"updateMask,omitempty"`
  1095. // ForceSendFields is a list of field names (e.g. "Policy") to
  1096. // unconditionally include in API requests. By default, fields with
  1097. // empty values are omitted from API requests. However, any non-pointer,
  1098. // non-interface field appearing in ForceSendFields will be sent to the
  1099. // server regardless of whether the field is empty or not. This may be
  1100. // used to include empty fields in Patch requests.
  1101. ForceSendFields []string `json:"-"`
  1102. // NullFields is a list of field names (e.g. "Policy") to include in API
  1103. // requests with the JSON null value. By default, fields with empty
  1104. // values are omitted from API requests. However, any field with an
  1105. // empty value appearing in NullFields will be sent to the server as
  1106. // null. It is an error if a field in this list has a non-empty value.
  1107. // This may be used to include null fields in Patch requests.
  1108. NullFields []string `json:"-"`
  1109. }
  1110. func (s *SetIamPolicyRequest) MarshalJSON() ([]byte, error) {
  1111. type NoMethod SetIamPolicyRequest
  1112. raw := NoMethod(*s)
  1113. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1114. }
  1115. // Sku: Encapsulates a single SKU in Google Cloud Platform
  1116. type Sku struct {
  1117. // Category: The category hierarchy of this SKU, purely for
  1118. // organizational purpose.
  1119. Category *Category `json:"category,omitempty"`
  1120. // Description: A human readable description of the SKU, has a maximum
  1121. // length of 256
  1122. // characters.
  1123. Description string `json:"description,omitempty"`
  1124. // Name: The resource name for the SKU.
  1125. // Example: "services/DA34-426B-A397/skus/AA95-CD31-42FE"
  1126. Name string `json:"name,omitempty"`
  1127. // PricingInfo: A timeline of pricing info for this SKU in chronological
  1128. // order.
  1129. PricingInfo []*PricingInfo `json:"pricingInfo,omitempty"`
  1130. // ServiceProviderName: Identifies the service provider.
  1131. // This is 'Google' for first party services in Google Cloud Platform.
  1132. ServiceProviderName string `json:"serviceProviderName,omitempty"`
  1133. // ServiceRegions: List of service regions this SKU is offered
  1134. // at.
  1135. // Example: "asia-east1"
  1136. // Service regions can be found at
  1137. // https://cloud.google.com/about/locations/
  1138. ServiceRegions []string `json:"serviceRegions,omitempty"`
  1139. // SkuId: The identifier for the SKU.
  1140. // Example: "AA95-CD31-42FE"
  1141. SkuId string `json:"skuId,omitempty"`
  1142. // ForceSendFields is a list of field names (e.g. "Category") to
  1143. // unconditionally include in API requests. By default, fields with
  1144. // empty values are omitted from API requests. However, any non-pointer,
  1145. // non-interface field appearing in ForceSendFields will be sent to the
  1146. // server regardless of whether the field is empty or not. This may be
  1147. // used to include empty fields in Patch requests.
  1148. ForceSendFields []string `json:"-"`
  1149. // NullFields is a list of field names (e.g. "Category") to include in
  1150. // API requests with the JSON null value. By default, fields with empty
  1151. // values are omitted from API requests. However, any field with an
  1152. // empty value appearing in NullFields will be sent to the server as
  1153. // null. It is an error if a field in this list has a non-empty value.
  1154. // This may be used to include null fields in Patch requests.
  1155. NullFields []string `json:"-"`
  1156. }
  1157. func (s *Sku) MarshalJSON() ([]byte, error) {
  1158. type NoMethod Sku
  1159. raw := NoMethod(*s)
  1160. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1161. }
  1162. // TestIamPermissionsRequest: Request message for `TestIamPermissions`
  1163. // method.
  1164. type TestIamPermissionsRequest struct {
  1165. // Permissions: The set of permissions to check for the `resource`.
  1166. // Permissions with
  1167. // wildcards (such as '*' or 'storage.*') are not allowed. For
  1168. // more
  1169. // information see
  1170. // [IAM
  1171. // Overview](https://cloud.google.com/iam/docs/overview#permissions).
  1172. Permissions []string `json:"permissions,omitempty"`
  1173. // ForceSendFields is a list of field names (e.g. "Permissions") to
  1174. // unconditionally include in API requests. By default, fields with
  1175. // empty values are omitted from API requests. However, any non-pointer,
  1176. // non-interface field appearing in ForceSendFields will be sent to the
  1177. // server regardless of whether the field is empty or not. This may be
  1178. // used to include empty fields in Patch requests.
  1179. ForceSendFields []string `json:"-"`
  1180. // NullFields is a list of field names (e.g. "Permissions") to include
  1181. // in API requests with the JSON null value. By default, fields with
  1182. // empty values are omitted from API requests. However, any field with
  1183. // an empty value appearing in NullFields will be sent to the server as
  1184. // null. It is an error if a field in this list has a non-empty value.
  1185. // This may be used to include null fields in Patch requests.
  1186. NullFields []string `json:"-"`
  1187. }
  1188. func (s *TestIamPermissionsRequest) MarshalJSON() ([]byte, error) {
  1189. type NoMethod TestIamPermissionsRequest
  1190. raw := NoMethod(*s)
  1191. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1192. }
  1193. // TestIamPermissionsResponse: Response message for `TestIamPermissions`
  1194. // method.
  1195. type TestIamPermissionsResponse struct {
  1196. // Permissions: A subset of `TestPermissionsRequest.permissions` that
  1197. // the caller is
  1198. // allowed.
  1199. Permissions []string `json:"permissions,omitempty"`
  1200. // ServerResponse contains the HTTP response code and headers from the
  1201. // server.
  1202. googleapi.ServerResponse `json:"-"`
  1203. // ForceSendFields is a list of field names (e.g. "Permissions") to
  1204. // unconditionally include in API requests. By default, fields with
  1205. // empty values are omitted from API requests. However, any non-pointer,
  1206. // non-interface field appearing in ForceSendFields will be sent to the
  1207. // server regardless of whether the field is empty or not. This may be
  1208. // used to include empty fields in Patch requests.
  1209. ForceSendFields []string `json:"-"`
  1210. // NullFields is a list of field names (e.g. "Permissions") to include
  1211. // in API requests with the JSON null value. By default, fields with
  1212. // empty values are omitted from API requests. However, any field with
  1213. // an empty value appearing in NullFields will be sent to the server as
  1214. // null. It is an error if a field in this list has a non-empty value.
  1215. // This may be used to include null fields in Patch requests.
  1216. NullFields []string `json:"-"`
  1217. }
  1218. func (s *TestIamPermissionsResponse) MarshalJSON() ([]byte, error) {
  1219. type NoMethod TestIamPermissionsResponse
  1220. raw := NoMethod(*s)
  1221. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1222. }
  1223. // TierRate: The price rate indicating starting usage and its
  1224. // corresponding price.
  1225. type TierRate struct {
  1226. // StartUsageAmount: Usage is priced at this rate only after this
  1227. // amount.
  1228. // Example: start_usage_amount of 10 indicates that the usage will be
  1229. // priced
  1230. // at the unit_price after the first 10 usage_units.
  1231. StartUsageAmount float64 `json:"startUsageAmount,omitempty"`
  1232. // UnitPrice: The price per unit of usage.
  1233. // Example: unit_price of amount $10 indicates that each unit will cost
  1234. // $10.
  1235. UnitPrice *Money `json:"unitPrice,omitempty"`
  1236. // ForceSendFields is a list of field names (e.g. "StartUsageAmount") to
  1237. // unconditionally include in API requests. By default, fields with
  1238. // empty values are omitted from API requests. However, any non-pointer,
  1239. // non-interface field appearing in ForceSendFields will be sent to the
  1240. // server regardless of whether the field is empty or not. This may be
  1241. // used to include empty fields in Patch requests.
  1242. ForceSendFields []string `json:"-"`
  1243. // NullFields is a list of field names (e.g. "StartUsageAmount") to
  1244. // include in API requests with the JSON null value. By default, fields
  1245. // with empty values are omitted from API requests. However, any field
  1246. // with an empty value appearing in NullFields will be sent to the
  1247. // server as null. It is an error if a field in this list has a
  1248. // non-empty value. This may be used to include null fields in Patch
  1249. // requests.
  1250. NullFields []string `json:"-"`
  1251. }
  1252. func (s *TierRate) MarshalJSON() ([]byte, error) {
  1253. type NoMethod TierRate
  1254. raw := NoMethod(*s)
  1255. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1256. }
  1257. func (s *TierRate) UnmarshalJSON(data []byte) error {
  1258. type NoMethod TierRate
  1259. var s1 struct {
  1260. StartUsageAmount gensupport.JSONFloat64 `json:"startUsageAmount"`
  1261. *NoMethod
  1262. }
  1263. s1.NoMethod = (*NoMethod)(s)
  1264. if err := json.Unmarshal(data, &s1); err != nil {
  1265. return err
  1266. }
  1267. s.StartUsageAmount = float64(s1.StartUsageAmount)
  1268. return nil
  1269. }
  1270. // method id "cloudbilling.billingAccounts.create":
  1271. type BillingAccountsCreateCall struct {
  1272. s *APIService
  1273. billingaccount *BillingAccount
  1274. urlParams_ gensupport.URLParams
  1275. ctx_ context.Context
  1276. header_ http.Header
  1277. }
  1278. // Create: Creates a billing account.
  1279. // This method can only be used to create
  1280. // [billing
  1281. // subaccounts](https://cloud.google.com/billing/docs/concepts)
  1282. // by GCP resellers.
  1283. // When creating a subaccount, the current authenticated user must have
  1284. // the
  1285. // `billing.accounts.update` IAM permission on the master account, which
  1286. // is
  1287. // typically given to billing
  1288. // account
  1289. // [administrators](https://cloud.google.com/billing/docs/how-to/
  1290. // billing-access).
  1291. // This method will return an error if the master account has not
  1292. // been
  1293. // provisioned as a reseller account.
  1294. func (r *BillingAccountsService) Create(billingaccount *BillingAccount) *BillingAccountsCreateCall {
  1295. c := &BillingAccountsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1296. c.billingaccount = billingaccount
  1297. return c
  1298. }
  1299. // Fields allows partial responses to be retrieved. See
  1300. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1301. // for more information.
  1302. func (c *BillingAccountsCreateCall) Fields(s ...googleapi.Field) *BillingAccountsCreateCall {
  1303. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1304. return c
  1305. }
  1306. // Context sets the context to be used in this call's Do method. Any
  1307. // pending HTTP request will be aborted if the provided context is
  1308. // canceled.
  1309. func (c *BillingAccountsCreateCall) Context(ctx context.Context) *BillingAccountsCreateCall {
  1310. c.ctx_ = ctx
  1311. return c
  1312. }
  1313. // Header returns an http.Header that can be modified by the caller to
  1314. // add HTTP headers to the request.
  1315. func (c *BillingAccountsCreateCall) Header() http.Header {
  1316. if c.header_ == nil {
  1317. c.header_ = make(http.Header)
  1318. }
  1319. return c.header_
  1320. }
  1321. func (c *BillingAccountsCreateCall) doRequest(alt string) (*http.Response, error) {
  1322. reqHeaders := make(http.Header)
  1323. for k, v := range c.header_ {
  1324. reqHeaders[k] = v
  1325. }
  1326. reqHeaders.Set("User-Agent", c.s.userAgent())
  1327. var body io.Reader = nil
  1328. body, err := googleapi.WithoutDataWrapper.JSONReader(c.billingaccount)
  1329. if err != nil {
  1330. return nil, err
  1331. }
  1332. reqHeaders.Set("Content-Type", "application/json")
  1333. c.urlParams_.Set("alt", alt)
  1334. c.urlParams_.Set("prettyPrint", "false")
  1335. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/billingAccounts")
  1336. urls += "?" + c.urlParams_.Encode()
  1337. req, err := http.NewRequest("POST", urls, body)
  1338. if err != nil {
  1339. return nil, err
  1340. }
  1341. req.Header = reqHeaders
  1342. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1343. }
  1344. // Do executes the "cloudbilling.billingAccounts.create" call.
  1345. // Exactly one of *BillingAccount or error will be non-nil. Any non-2xx
  1346. // status code is an error. Response headers are in either
  1347. // *BillingAccount.ServerResponse.Header or (if a response was returned
  1348. // at all) in error.(*googleapi.Error).Header. Use
  1349. // googleapi.IsNotModified to check whether the returned error was
  1350. // because http.StatusNotModified was returned.
  1351. func (c *BillingAccountsCreateCall) Do(opts ...googleapi.CallOption) (*BillingAccount, error) {
  1352. gensupport.SetOptions(c.urlParams_, opts...)
  1353. res, err := c.doRequest("json")
  1354. if res != nil && res.StatusCode == http.StatusNotModified {
  1355. if res.Body != nil {
  1356. res.Body.Close()
  1357. }
  1358. return nil, &googleapi.Error{
  1359. Code: res.StatusCode,
  1360. Header: res.Header,
  1361. }
  1362. }
  1363. if err != nil {
  1364. return nil, err
  1365. }
  1366. defer googleapi.CloseBody(res)
  1367. if err := googleapi.CheckResponse(res); err != nil {
  1368. return nil, err
  1369. }
  1370. ret := &BillingAccount{
  1371. ServerResponse: googleapi.ServerResponse{
  1372. Header: res.Header,
  1373. HTTPStatusCode: res.StatusCode,
  1374. },
  1375. }
  1376. target := &ret
  1377. if err := gensupport.DecodeResponse(target, res); err != nil {
  1378. return nil, err
  1379. }
  1380. return ret, nil
  1381. // {
  1382. // "description": "Creates a billing account.\nThis method can only be used to create\n[billing subaccounts](https://cloud.google.com/billing/docs/concepts)\nby GCP resellers.\nWhen creating a subaccount, the current authenticated user must have the\n`billing.accounts.update` IAM permission on the master account, which is\ntypically given to billing account\n[administrators](https://cloud.google.com/billing/docs/how-to/billing-access).\nThis method will return an error if the master account has not been\nprovisioned as a reseller account.",
  1383. // "flatPath": "v1/billingAccounts",
  1384. // "httpMethod": "POST",
  1385. // "id": "cloudbilling.billingAccounts.create",
  1386. // "parameterOrder": [],
  1387. // "parameters": {},
  1388. // "path": "v1/billingAccounts",
  1389. // "request": {
  1390. // "$ref": "BillingAccount"
  1391. // },
  1392. // "response": {
  1393. // "$ref": "BillingAccount"
  1394. // },
  1395. // "scopes": [
  1396. // "https://www.googleapis.com/auth/cloud-platform"
  1397. // ]
  1398. // }
  1399. }
  1400. // method id "cloudbilling.billingAccounts.get":
  1401. type BillingAccountsGetCall struct {
  1402. s *APIService
  1403. name string
  1404. urlParams_ gensupport.URLParams
  1405. ifNoneMatch_ string
  1406. ctx_ context.Context
  1407. header_ http.Header
  1408. }
  1409. // Get: Gets information about a billing account. The current
  1410. // authenticated user
  1411. // must be a [viewer of the
  1412. // billing
  1413. // account](https://cloud.google.com/billing/docs/how-to/billing-
  1414. // access).
  1415. func (r *BillingAccountsService) Get(name string) *BillingAccountsGetCall {
  1416. c := &BillingAccountsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1417. c.name = name
  1418. return c
  1419. }
  1420. // Fields allows partial responses to be retrieved. See
  1421. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1422. // for more information.
  1423. func (c *BillingAccountsGetCall) Fields(s ...googleapi.Field) *BillingAccountsGetCall {
  1424. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1425. return c
  1426. }
  1427. // IfNoneMatch sets the optional parameter which makes the operation
  1428. // fail if the object's ETag matches the given value. This is useful for
  1429. // getting updates only after the object has changed since the last
  1430. // request. Use googleapi.IsNotModified to check whether the response
  1431. // error from Do is the result of In-None-Match.
  1432. func (c *BillingAccountsGetCall) IfNoneMatch(entityTag string) *BillingAccountsGetCall {
  1433. c.ifNoneMatch_ = entityTag
  1434. return c
  1435. }
  1436. // Context sets the context to be used in this call's Do method. Any
  1437. // pending HTTP request will be aborted if the provided context is
  1438. // canceled.
  1439. func (c *BillingAccountsGetCall) Context(ctx context.Context) *BillingAccountsGetCall {
  1440. c.ctx_ = ctx
  1441. return c
  1442. }
  1443. // Header returns an http.Header that can be modified by the caller to
  1444. // add HTTP headers to the request.
  1445. func (c *BillingAccountsGetCall) Header() http.Header {
  1446. if c.header_ == nil {
  1447. c.header_ = make(http.Header)
  1448. }
  1449. return c.header_
  1450. }
  1451. func (c *BillingAccountsGetCall) doRequest(alt string) (*http.Response, error) {
  1452. reqHeaders := make(http.Header)
  1453. for k, v := range c.header_ {
  1454. reqHeaders[k] = v
  1455. }
  1456. reqHeaders.Set("User-Agent", c.s.userAgent())
  1457. if c.ifNoneMatch_ != "" {
  1458. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1459. }
  1460. var body io.Reader = nil
  1461. c.urlParams_.Set("alt", alt)
  1462. c.urlParams_.Set("prettyPrint", "false")
  1463. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  1464. urls += "?" + c.urlParams_.Encode()
  1465. req, err := http.NewRequest("GET", urls, body)
  1466. if err != nil {
  1467. return nil, err
  1468. }
  1469. req.Header = reqHeaders
  1470. googleapi.Expand(req.URL, map[string]string{
  1471. "name": c.name,
  1472. })
  1473. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1474. }
  1475. // Do executes the "cloudbilling.billingAccounts.get" call.
  1476. // Exactly one of *BillingAccount or error will be non-nil. Any non-2xx
  1477. // status code is an error. Response headers are in either
  1478. // *BillingAccount.ServerResponse.Header or (if a response was returned
  1479. // at all) in error.(*googleapi.Error).Header. Use
  1480. // googleapi.IsNotModified to check whether the returned error was
  1481. // because http.StatusNotModified was returned.
  1482. func (c *BillingAccountsGetCall) Do(opts ...googleapi.CallOption) (*BillingAccount, error) {
  1483. gensupport.SetOptions(c.urlParams_, opts...)
  1484. res, err := c.doRequest("json")
  1485. if res != nil && res.StatusCode == http.StatusNotModified {
  1486. if res.Body != nil {
  1487. res.Body.Close()
  1488. }
  1489. return nil, &googleapi.Error{
  1490. Code: res.StatusCode,
  1491. Header: res.Header,
  1492. }
  1493. }
  1494. if err != nil {
  1495. return nil, err
  1496. }
  1497. defer googleapi.CloseBody(res)
  1498. if err := googleapi.CheckResponse(res); err != nil {
  1499. return nil, err
  1500. }
  1501. ret := &BillingAccount{
  1502. ServerResponse: googleapi.ServerResponse{
  1503. Header: res.Header,
  1504. HTTPStatusCode: res.StatusCode,
  1505. },
  1506. }
  1507. target := &ret
  1508. if err := gensupport.DecodeResponse(target, res); err != nil {
  1509. return nil, err
  1510. }
  1511. return ret, nil
  1512. // {
  1513. // "description": "Gets information about a billing account. The current authenticated user\nmust be a [viewer of the billing\naccount](https://cloud.google.com/billing/docs/how-to/billing-access).",
  1514. // "flatPath": "v1/billingAccounts/{billingAccountsId}",
  1515. // "httpMethod": "GET",
  1516. // "id": "cloudbilling.billingAccounts.get",
  1517. // "parameterOrder": [
  1518. // "name"
  1519. // ],
  1520. // "parameters": {
  1521. // "name": {
  1522. // "description": "The resource name of the billing account to retrieve. For example,\n`billingAccounts/012345-567890-ABCDEF`.",
  1523. // "location": "path",
  1524. // "pattern": "^billingAccounts/[^/]+$",
  1525. // "required": true,
  1526. // "type": "string"
  1527. // }
  1528. // },
  1529. // "path": "v1/{+name}",
  1530. // "response": {
  1531. // "$ref": "BillingAccount"
  1532. // },
  1533. // "scopes": [
  1534. // "https://www.googleapis.com/auth/cloud-platform"
  1535. // ]
  1536. // }
  1537. }
  1538. // method id "cloudbilling.billingAccounts.getIamPolicy":
  1539. type BillingAccountsGetIamPolicyCall struct {
  1540. s *APIService
  1541. resource string
  1542. urlParams_ gensupport.URLParams
  1543. ifNoneMatch_ string
  1544. ctx_ context.Context
  1545. header_ http.Header
  1546. }
  1547. // GetIamPolicy: Gets the access control policy for a billing
  1548. // account.
  1549. // The caller must have the `billing.accounts.getIamPolicy` permission
  1550. // on the
  1551. // account, which is often given to billing
  1552. // account
  1553. // [viewers](https://cloud.google.com/billing/docs/how-to/billing
  1554. // -access).
  1555. func (r *BillingAccountsService) GetIamPolicy(resource string) *BillingAccountsGetIamPolicyCall {
  1556. c := &BillingAccountsGetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1557. c.resource = resource
  1558. return c
  1559. }
  1560. // Fields allows partial responses to be retrieved. See
  1561. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1562. // for more information.
  1563. func (c *BillingAccountsGetIamPolicyCall) Fields(s ...googleapi.Field) *BillingAccountsGetIamPolicyCall {
  1564. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1565. return c
  1566. }
  1567. // IfNoneMatch sets the optional parameter which makes the operation
  1568. // fail if the object's ETag matches the given value. This is useful for
  1569. // getting updates only after the object has changed since the last
  1570. // request. Use googleapi.IsNotModified to check whether the response
  1571. // error from Do is the result of In-None-Match.
  1572. func (c *BillingAccountsGetIamPolicyCall) IfNoneMatch(entityTag string) *BillingAccountsGetIamPolicyCall {
  1573. c.ifNoneMatch_ = entityTag
  1574. return c
  1575. }
  1576. // Context sets the context to be used in this call's Do method. Any
  1577. // pending HTTP request will be aborted if the provided context is
  1578. // canceled.
  1579. func (c *BillingAccountsGetIamPolicyCall) Context(ctx context.Context) *BillingAccountsGetIamPolicyCall {
  1580. c.ctx_ = ctx
  1581. return c
  1582. }
  1583. // Header returns an http.Header that can be modified by the caller to
  1584. // add HTTP headers to the request.
  1585. func (c *BillingAccountsGetIamPolicyCall) Header() http.Header {
  1586. if c.header_ == nil {
  1587. c.header_ = make(http.Header)
  1588. }
  1589. return c.header_
  1590. }
  1591. func (c *BillingAccountsGetIamPolicyCall) doRequest(alt string) (*http.Response, error) {
  1592. reqHeaders := make(http.Header)
  1593. for k, v := range c.header_ {
  1594. reqHeaders[k] = v
  1595. }
  1596. reqHeaders.Set("User-Agent", c.s.userAgent())
  1597. if c.ifNoneMatch_ != "" {
  1598. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1599. }
  1600. var body io.Reader = nil
  1601. c.urlParams_.Set("alt", alt)
  1602. c.urlParams_.Set("prettyPrint", "false")
  1603. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+resource}:getIamPolicy")
  1604. urls += "?" + c.urlParams_.Encode()
  1605. req, err := http.NewRequest("GET", urls, body)
  1606. if err != nil {
  1607. return nil, err
  1608. }
  1609. req.Header = reqHeaders
  1610. googleapi.Expand(req.URL, map[string]string{
  1611. "resource": c.resource,
  1612. })
  1613. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1614. }
  1615. // Do executes the "cloudbilling.billingAccounts.getIamPolicy" call.
  1616. // Exactly one of *Policy or error will be non-nil. Any non-2xx status
  1617. // code is an error. Response headers are in either
  1618. // *Policy.ServerResponse.Header or (if a response was returned at all)
  1619. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  1620. // check whether the returned error was because http.StatusNotModified
  1621. // was returned.
  1622. func (c *BillingAccountsGetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, error) {
  1623. gensupport.SetOptions(c.urlParams_, opts...)
  1624. res, err := c.doRequest("json")
  1625. if res != nil && res.StatusCode == http.StatusNotModified {
  1626. if res.Body != nil {
  1627. res.Body.Close()
  1628. }
  1629. return nil, &googleapi.Error{
  1630. Code: res.StatusCode,
  1631. Header: res.Header,
  1632. }
  1633. }
  1634. if err != nil {
  1635. return nil, err
  1636. }
  1637. defer googleapi.CloseBody(res)
  1638. if err := googleapi.CheckResponse(res); err != nil {
  1639. return nil, err
  1640. }
  1641. ret := &Policy{
  1642. ServerResponse: googleapi.ServerResponse{
  1643. Header: res.Header,
  1644. HTTPStatusCode: res.StatusCode,
  1645. },
  1646. }
  1647. target := &ret
  1648. if err := gensupport.DecodeResponse(target, res); err != nil {
  1649. return nil, err
  1650. }
  1651. return ret, nil
  1652. // {
  1653. // "description": "Gets the access control policy for a billing account.\nThe caller must have the `billing.accounts.getIamPolicy` permission on the\naccount, which is often given to billing account\n[viewers](https://cloud.google.com/billing/docs/how-to/billing-access).",
  1654. // "flatPath": "v1/billingAccounts/{billingAccountsId}:getIamPolicy",
  1655. // "httpMethod": "GET",
  1656. // "id": "cloudbilling.billingAccounts.getIamPolicy",
  1657. // "parameterOrder": [
  1658. // "resource"
  1659. // ],
  1660. // "parameters": {
  1661. // "resource": {
  1662. // "description": "REQUIRED: The resource for which the policy is being requested.\nSee the operation documentation for the appropriate value for this field.",
  1663. // "location": "path",
  1664. // "pattern": "^billingAccounts/[^/]+$",
  1665. // "required": true,
  1666. // "type": "string"
  1667. // }
  1668. // },
  1669. // "path": "v1/{+resource}:getIamPolicy",
  1670. // "response": {
  1671. // "$ref": "Policy"
  1672. // },
  1673. // "scopes": [
  1674. // "https://www.googleapis.com/auth/cloud-platform"
  1675. // ]
  1676. // }
  1677. }
  1678. // method id "cloudbilling.billingAccounts.list":
  1679. type BillingAccountsListCall struct {
  1680. s *APIService
  1681. urlParams_ gensupport.URLParams
  1682. ifNoneMatch_ string
  1683. ctx_ context.Context
  1684. header_ http.Header
  1685. }
  1686. // List: Lists the billing accounts that the current authenticated user
  1687. // has
  1688. // permission to
  1689. // [view](https://cloud.google.com/billing/docs/how-to/billing-access).
  1690. func (r *BillingAccountsService) List() *BillingAccountsListCall {
  1691. c := &BillingAccountsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1692. return c
  1693. }
  1694. // Filter sets the optional parameter "filter": Options for how to
  1695. // filter the returned billing accounts.
  1696. // Currently this only supports filtering
  1697. // for
  1698. // [subaccounts](https://cloud.google.com/billing/docs/concepts) under
  1699. // a
  1700. // single provided reseller billing account.
  1701. // (e.g.
  1702. // "master_billing_account=billingAccounts/012345-678901-ABCDEF").
  1703. // Boolea
  1704. // n algebra and other fields are not currently supported.
  1705. func (c *BillingAccountsListCall) Filter(filter string) *BillingAccountsListCall {
  1706. c.urlParams_.Set("filter", filter)
  1707. return c
  1708. }
  1709. // PageSize sets the optional parameter "pageSize": Requested page size.
  1710. // The maximum page size is 100; this is also the
  1711. // default.
  1712. func (c *BillingAccountsListCall) PageSize(pageSize int64) *BillingAccountsListCall {
  1713. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  1714. return c
  1715. }
  1716. // PageToken sets the optional parameter "pageToken": A token
  1717. // identifying a page of results to return. This should be
  1718. // a
  1719. // `next_page_token` value returned from a previous
  1720. // `ListBillingAccounts`
  1721. // call. If unspecified, the first page of results is returned.
  1722. func (c *BillingAccountsListCall) PageToken(pageToken string) *BillingAccountsListCall {
  1723. c.urlParams_.Set("pageToken", pageToken)
  1724. return c
  1725. }
  1726. // Fields allows partial responses to be retrieved. See
  1727. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1728. // for more information.
  1729. func (c *BillingAccountsListCall) Fields(s ...googleapi.Field) *BillingAccountsListCall {
  1730. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1731. return c
  1732. }
  1733. // IfNoneMatch sets the optional parameter which makes the operation
  1734. // fail if the object's ETag matches the given value. This is useful for
  1735. // getting updates only after the object has changed since the last
  1736. // request. Use googleapi.IsNotModified to check whether the response
  1737. // error from Do is the result of In-None-Match.
  1738. func (c *BillingAccountsListCall) IfNoneMatch(entityTag string) *BillingAccountsListCall {
  1739. c.ifNoneMatch_ = entityTag
  1740. return c
  1741. }
  1742. // Context sets the context to be used in this call's Do method. Any
  1743. // pending HTTP request will be aborted if the provided context is
  1744. // canceled.
  1745. func (c *BillingAccountsListCall) Context(ctx context.Context) *BillingAccountsListCall {
  1746. c.ctx_ = ctx
  1747. return c
  1748. }
  1749. // Header returns an http.Header that can be modified by the caller to
  1750. // add HTTP headers to the request.
  1751. func (c *BillingAccountsListCall) Header() http.Header {
  1752. if c.header_ == nil {
  1753. c.header_ = make(http.Header)
  1754. }
  1755. return c.header_
  1756. }
  1757. func (c *BillingAccountsListCall) doRequest(alt string) (*http.Response, error) {
  1758. reqHeaders := make(http.Header)
  1759. for k, v := range c.header_ {
  1760. reqHeaders[k] = v
  1761. }
  1762. reqHeaders.Set("User-Agent", c.s.userAgent())
  1763. if c.ifNoneMatch_ != "" {
  1764. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1765. }
  1766. var body io.Reader = nil
  1767. c.urlParams_.Set("alt", alt)
  1768. c.urlParams_.Set("prettyPrint", "false")
  1769. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/billingAccounts")
  1770. urls += "?" + c.urlParams_.Encode()
  1771. req, err := http.NewRequest("GET", urls, body)
  1772. if err != nil {
  1773. return nil, err
  1774. }
  1775. req.Header = reqHeaders
  1776. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1777. }
  1778. // Do executes the "cloudbilling.billingAccounts.list" call.
  1779. // Exactly one of *ListBillingAccountsResponse or error will be non-nil.
  1780. // Any non-2xx status code is an error. Response headers are in either
  1781. // *ListBillingAccountsResponse.ServerResponse.Header or (if a response
  1782. // was returned at all) in error.(*googleapi.Error).Header. Use
  1783. // googleapi.IsNotModified to check whether the returned error was
  1784. // because http.StatusNotModified was returned.
  1785. func (c *BillingAccountsListCall) Do(opts ...googleapi.CallOption) (*ListBillingAccountsResponse, error) {
  1786. gensupport.SetOptions(c.urlParams_, opts...)
  1787. res, err := c.doRequest("json")
  1788. if res != nil && res.StatusCode == http.StatusNotModified {
  1789. if res.Body != nil {
  1790. res.Body.Close()
  1791. }
  1792. return nil, &googleapi.Error{
  1793. Code: res.StatusCode,
  1794. Header: res.Header,
  1795. }
  1796. }
  1797. if err != nil {
  1798. return nil, err
  1799. }
  1800. defer googleapi.CloseBody(res)
  1801. if err := googleapi.CheckResponse(res); err != nil {
  1802. return nil, err
  1803. }
  1804. ret := &ListBillingAccountsResponse{
  1805. ServerResponse: googleapi.ServerResponse{
  1806. Header: res.Header,
  1807. HTTPStatusCode: res.StatusCode,
  1808. },
  1809. }
  1810. target := &ret
  1811. if err := gensupport.DecodeResponse(target, res); err != nil {
  1812. return nil, err
  1813. }
  1814. return ret, nil
  1815. // {
  1816. // "description": "Lists the billing accounts that the current authenticated user has\npermission to [view](https://cloud.google.com/billing/docs/how-to/billing-access).",
  1817. // "flatPath": "v1/billingAccounts",
  1818. // "httpMethod": "GET",
  1819. // "id": "cloudbilling.billingAccounts.list",
  1820. // "parameterOrder": [],
  1821. // "parameters": {
  1822. // "filter": {
  1823. // "description": "Options for how to filter the returned billing accounts.\nCurrently this only supports filtering for\n[subaccounts](https://cloud.google.com/billing/docs/concepts) under a\nsingle provided reseller billing account.\n(e.g. \"master_billing_account=billingAccounts/012345-678901-ABCDEF\").\nBoolean algebra and other fields are not currently supported.",
  1824. // "location": "query",
  1825. // "type": "string"
  1826. // },
  1827. // "pageSize": {
  1828. // "description": "Requested page size. The maximum page size is 100; this is also the\ndefault.",
  1829. // "format": "int32",
  1830. // "location": "query",
  1831. // "type": "integer"
  1832. // },
  1833. // "pageToken": {
  1834. // "description": "A token identifying a page of results to return. This should be a\n`next_page_token` value returned from a previous `ListBillingAccounts`\ncall. If unspecified, the first page of results is returned.",
  1835. // "location": "query",
  1836. // "type": "string"
  1837. // }
  1838. // },
  1839. // "path": "v1/billingAccounts",
  1840. // "response": {
  1841. // "$ref": "ListBillingAccountsResponse"
  1842. // },
  1843. // "scopes": [
  1844. // "https://www.googleapis.com/auth/cloud-platform"
  1845. // ]
  1846. // }
  1847. }
  1848. // Pages invokes f for each page of results.
  1849. // A non-nil error returned from f will halt the iteration.
  1850. // The provided context supersedes any context provided to the Context method.
  1851. func (c *BillingAccountsListCall) Pages(ctx context.Context, f func(*ListBillingAccountsResponse) error) error {
  1852. c.ctx_ = ctx
  1853. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  1854. for {
  1855. x, err := c.Do()
  1856. if err != nil {
  1857. return err
  1858. }
  1859. if err := f(x); err != nil {
  1860. return err
  1861. }
  1862. if x.NextPageToken == "" {
  1863. return nil
  1864. }
  1865. c.PageToken(x.NextPageToken)
  1866. }
  1867. }
  1868. // method id "cloudbilling.billingAccounts.patch":
  1869. type BillingAccountsPatchCall struct {
  1870. s *APIService
  1871. name string
  1872. billingaccount *BillingAccount
  1873. urlParams_ gensupport.URLParams
  1874. ctx_ context.Context
  1875. header_ http.Header
  1876. }
  1877. // Patch: Updates a billing account's fields.
  1878. // Currently the only field that can be edited is `display_name`.
  1879. // The current authenticated user must have the
  1880. // `billing.accounts.update`
  1881. // IAM permission, which is typically given to
  1882. // the
  1883. // [administrator](https://cloud.google.com/billing/docs/how-to/billi
  1884. // ng-access)
  1885. // of the billing account.
  1886. func (r *BillingAccountsService) Patch(name string, billingaccount *BillingAccount) *BillingAccountsPatchCall {
  1887. c := &BillingAccountsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1888. c.name = name
  1889. c.billingaccount = billingaccount
  1890. return c
  1891. }
  1892. // UpdateMask sets the optional parameter "updateMask": The update mask
  1893. // applied to the resource.
  1894. // Only "display_name" is currently supported.
  1895. func (c *BillingAccountsPatchCall) UpdateMask(updateMask string) *BillingAccountsPatchCall {
  1896. c.urlParams_.Set("updateMask", updateMask)
  1897. return c
  1898. }
  1899. // Fields allows partial responses to be retrieved. See
  1900. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1901. // for more information.
  1902. func (c *BillingAccountsPatchCall) Fields(s ...googleapi.Field) *BillingAccountsPatchCall {
  1903. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1904. return c
  1905. }
  1906. // Context sets the context to be used in this call's Do method. Any
  1907. // pending HTTP request will be aborted if the provided context is
  1908. // canceled.
  1909. func (c *BillingAccountsPatchCall) Context(ctx context.Context) *BillingAccountsPatchCall {
  1910. c.ctx_ = ctx
  1911. return c
  1912. }
  1913. // Header returns an http.Header that can be modified by the caller to
  1914. // add HTTP headers to the request.
  1915. func (c *BillingAccountsPatchCall) Header() http.Header {
  1916. if c.header_ == nil {
  1917. c.header_ = make(http.Header)
  1918. }
  1919. return c.header_
  1920. }
  1921. func (c *BillingAccountsPatchCall) doRequest(alt string) (*http.Response, error) {
  1922. reqHeaders := make(http.Header)
  1923. for k, v := range c.header_ {
  1924. reqHeaders[k] = v
  1925. }
  1926. reqHeaders.Set("User-Agent", c.s.userAgent())
  1927. var body io.Reader = nil
  1928. body, err := googleapi.WithoutDataWrapper.JSONReader(c.billingaccount)
  1929. if err != nil {
  1930. return nil, err
  1931. }
  1932. reqHeaders.Set("Content-Type", "application/json")
  1933. c.urlParams_.Set("alt", alt)
  1934. c.urlParams_.Set("prettyPrint", "false")
  1935. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  1936. urls += "?" + c.urlParams_.Encode()
  1937. req, err := http.NewRequest("PATCH", urls, body)
  1938. if err != nil {
  1939. return nil, err
  1940. }
  1941. req.Header = reqHeaders
  1942. googleapi.Expand(req.URL, map[string]string{
  1943. "name": c.name,
  1944. })
  1945. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1946. }
  1947. // Do executes the "cloudbilling.billingAccounts.patch" call.
  1948. // Exactly one of *BillingAccount or error will be non-nil. Any non-2xx
  1949. // status code is an error. Response headers are in either
  1950. // *BillingAccount.ServerResponse.Header or (if a response was returned
  1951. // at all) in error.(*googleapi.Error).Header. Use
  1952. // googleapi.IsNotModified to check whether the returned error was
  1953. // because http.StatusNotModified was returned.
  1954. func (c *BillingAccountsPatchCall) Do(opts ...googleapi.CallOption) (*BillingAccount, error) {
  1955. gensupport.SetOptions(c.urlParams_, opts...)
  1956. res, err := c.doRequest("json")
  1957. if res != nil && res.StatusCode == http.StatusNotModified {
  1958. if res.Body != nil {
  1959. res.Body.Close()
  1960. }
  1961. return nil, &googleapi.Error{
  1962. Code: res.StatusCode,
  1963. Header: res.Header,
  1964. }
  1965. }
  1966. if err != nil {
  1967. return nil, err
  1968. }
  1969. defer googleapi.CloseBody(res)
  1970. if err := googleapi.CheckResponse(res); err != nil {
  1971. return nil, err
  1972. }
  1973. ret := &BillingAccount{
  1974. ServerResponse: googleapi.ServerResponse{
  1975. Header: res.Header,
  1976. HTTPStatusCode: res.StatusCode,
  1977. },
  1978. }
  1979. target := &ret
  1980. if err := gensupport.DecodeResponse(target, res); err != nil {
  1981. return nil, err
  1982. }
  1983. return ret, nil
  1984. // {
  1985. // "description": "Updates a billing account's fields.\nCurrently the only field that can be edited is `display_name`.\nThe current authenticated user must have the `billing.accounts.update`\nIAM permission, which is typically given to the\n[administrator](https://cloud.google.com/billing/docs/how-to/billing-access)\nof the billing account.",
  1986. // "flatPath": "v1/billingAccounts/{billingAccountsId}",
  1987. // "httpMethod": "PATCH",
  1988. // "id": "cloudbilling.billingAccounts.patch",
  1989. // "parameterOrder": [
  1990. // "name"
  1991. // ],
  1992. // "parameters": {
  1993. // "name": {
  1994. // "description": "The name of the billing account resource to be updated.",
  1995. // "location": "path",
  1996. // "pattern": "^billingAccounts/[^/]+$",
  1997. // "required": true,
  1998. // "type": "string"
  1999. // },
  2000. // "updateMask": {
  2001. // "description": "The update mask applied to the resource.\nOnly \"display_name\" is currently supported.",
  2002. // "format": "google-fieldmask",
  2003. // "location": "query",
  2004. // "type": "string"
  2005. // }
  2006. // },
  2007. // "path": "v1/{+name}",
  2008. // "request": {
  2009. // "$ref": "BillingAccount"
  2010. // },
  2011. // "response": {
  2012. // "$ref": "BillingAccount"
  2013. // },
  2014. // "scopes": [
  2015. // "https://www.googleapis.com/auth/cloud-platform"
  2016. // ]
  2017. // }
  2018. }
  2019. // method id "cloudbilling.billingAccounts.setIamPolicy":
  2020. type BillingAccountsSetIamPolicyCall struct {
  2021. s *APIService
  2022. resource string
  2023. setiampolicyrequest *SetIamPolicyRequest
  2024. urlParams_ gensupport.URLParams
  2025. ctx_ context.Context
  2026. header_ http.Header
  2027. }
  2028. // SetIamPolicy: Sets the access control policy for a billing account.
  2029. // Replaces any existing
  2030. // policy.
  2031. // The caller must have the `billing.accounts.setIamPolicy` permission
  2032. // on the
  2033. // account, which is often given to billing
  2034. // account
  2035. // [administrators](https://cloud.google.com/billing/docs/how-to/
  2036. // billing-access).
  2037. func (r *BillingAccountsService) SetIamPolicy(resource string, setiampolicyrequest *SetIamPolicyRequest) *BillingAccountsSetIamPolicyCall {
  2038. c := &BillingAccountsSetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2039. c.resource = resource
  2040. c.setiampolicyrequest = setiampolicyrequest
  2041. return c
  2042. }
  2043. // Fields allows partial responses to be retrieved. See
  2044. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2045. // for more information.
  2046. func (c *BillingAccountsSetIamPolicyCall) Fields(s ...googleapi.Field) *BillingAccountsSetIamPolicyCall {
  2047. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2048. return c
  2049. }
  2050. // Context sets the context to be used in this call's Do method. Any
  2051. // pending HTTP request will be aborted if the provided context is
  2052. // canceled.
  2053. func (c *BillingAccountsSetIamPolicyCall) Context(ctx context.Context) *BillingAccountsSetIamPolicyCall {
  2054. c.ctx_ = ctx
  2055. return c
  2056. }
  2057. // Header returns an http.Header that can be modified by the caller to
  2058. // add HTTP headers to the request.
  2059. func (c *BillingAccountsSetIamPolicyCall) Header() http.Header {
  2060. if c.header_ == nil {
  2061. c.header_ = make(http.Header)
  2062. }
  2063. return c.header_
  2064. }
  2065. func (c *BillingAccountsSetIamPolicyCall) doRequest(alt string) (*http.Response, error) {
  2066. reqHeaders := make(http.Header)
  2067. for k, v := range c.header_ {
  2068. reqHeaders[k] = v
  2069. }
  2070. reqHeaders.Set("User-Agent", c.s.userAgent())
  2071. var body io.Reader = nil
  2072. body, err := googleapi.WithoutDataWrapper.JSONReader(c.setiampolicyrequest)
  2073. if err != nil {
  2074. return nil, err
  2075. }
  2076. reqHeaders.Set("Content-Type", "application/json")
  2077. c.urlParams_.Set("alt", alt)
  2078. c.urlParams_.Set("prettyPrint", "false")
  2079. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+resource}:setIamPolicy")
  2080. urls += "?" + c.urlParams_.Encode()
  2081. req, err := http.NewRequest("POST", urls, body)
  2082. if err != nil {
  2083. return nil, err
  2084. }
  2085. req.Header = reqHeaders
  2086. googleapi.Expand(req.URL, map[string]string{
  2087. "resource": c.resource,
  2088. })
  2089. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2090. }
  2091. // Do executes the "cloudbilling.billingAccounts.setIamPolicy" call.
  2092. // Exactly one of *Policy or error will be non-nil. Any non-2xx status
  2093. // code is an error. Response headers are in either
  2094. // *Policy.ServerResponse.Header or (if a response was returned at all)
  2095. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2096. // check whether the returned error was because http.StatusNotModified
  2097. // was returned.
  2098. func (c *BillingAccountsSetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, error) {
  2099. gensupport.SetOptions(c.urlParams_, opts...)
  2100. res, err := c.doRequest("json")
  2101. if res != nil && res.StatusCode == http.StatusNotModified {
  2102. if res.Body != nil {
  2103. res.Body.Close()
  2104. }
  2105. return nil, &googleapi.Error{
  2106. Code: res.StatusCode,
  2107. Header: res.Header,
  2108. }
  2109. }
  2110. if err != nil {
  2111. return nil, err
  2112. }
  2113. defer googleapi.CloseBody(res)
  2114. if err := googleapi.CheckResponse(res); err != nil {
  2115. return nil, err
  2116. }
  2117. ret := &Policy{
  2118. ServerResponse: googleapi.ServerResponse{
  2119. Header: res.Header,
  2120. HTTPStatusCode: res.StatusCode,
  2121. },
  2122. }
  2123. target := &ret
  2124. if err := gensupport.DecodeResponse(target, res); err != nil {
  2125. return nil, err
  2126. }
  2127. return ret, nil
  2128. // {
  2129. // "description": "Sets the access control policy for a billing account. Replaces any existing\npolicy.\nThe caller must have the `billing.accounts.setIamPolicy` permission on the\naccount, which is often given to billing account\n[administrators](https://cloud.google.com/billing/docs/how-to/billing-access).",
  2130. // "flatPath": "v1/billingAccounts/{billingAccountsId}:setIamPolicy",
  2131. // "httpMethod": "POST",
  2132. // "id": "cloudbilling.billingAccounts.setIamPolicy",
  2133. // "parameterOrder": [
  2134. // "resource"
  2135. // ],
  2136. // "parameters": {
  2137. // "resource": {
  2138. // "description": "REQUIRED: The resource for which the policy is being specified.\nSee the operation documentation for the appropriate value for this field.",
  2139. // "location": "path",
  2140. // "pattern": "^billingAccounts/[^/]+$",
  2141. // "required": true,
  2142. // "type": "string"
  2143. // }
  2144. // },
  2145. // "path": "v1/{+resource}:setIamPolicy",
  2146. // "request": {
  2147. // "$ref": "SetIamPolicyRequest"
  2148. // },
  2149. // "response": {
  2150. // "$ref": "Policy"
  2151. // },
  2152. // "scopes": [
  2153. // "https://www.googleapis.com/auth/cloud-platform"
  2154. // ]
  2155. // }
  2156. }
  2157. // method id "cloudbilling.billingAccounts.testIamPermissions":
  2158. type BillingAccountsTestIamPermissionsCall struct {
  2159. s *APIService
  2160. resource string
  2161. testiampermissionsrequest *TestIamPermissionsRequest
  2162. urlParams_ gensupport.URLParams
  2163. ctx_ context.Context
  2164. header_ http.Header
  2165. }
  2166. // TestIamPermissions: Tests the access control policy for a billing
  2167. // account. This method takes
  2168. // the resource and a set of permissions as input and returns the subset
  2169. // of
  2170. // the input permissions that the caller is allowed for that resource.
  2171. func (r *BillingAccountsService) TestIamPermissions(resource string, testiampermissionsrequest *TestIamPermissionsRequest) *BillingAccountsTestIamPermissionsCall {
  2172. c := &BillingAccountsTestIamPermissionsCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2173. c.resource = resource
  2174. c.testiampermissionsrequest = testiampermissionsrequest
  2175. return c
  2176. }
  2177. // Fields allows partial responses to be retrieved. See
  2178. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2179. // for more information.
  2180. func (c *BillingAccountsTestIamPermissionsCall) Fields(s ...googleapi.Field) *BillingAccountsTestIamPermissionsCall {
  2181. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2182. return c
  2183. }
  2184. // Context sets the context to be used in this call's Do method. Any
  2185. // pending HTTP request will be aborted if the provided context is
  2186. // canceled.
  2187. func (c *BillingAccountsTestIamPermissionsCall) Context(ctx context.Context) *BillingAccountsTestIamPermissionsCall {
  2188. c.ctx_ = ctx
  2189. return c
  2190. }
  2191. // Header returns an http.Header that can be modified by the caller to
  2192. // add HTTP headers to the request.
  2193. func (c *BillingAccountsTestIamPermissionsCall) Header() http.Header {
  2194. if c.header_ == nil {
  2195. c.header_ = make(http.Header)
  2196. }
  2197. return c.header_
  2198. }
  2199. func (c *BillingAccountsTestIamPermissionsCall) doRequest(alt string) (*http.Response, error) {
  2200. reqHeaders := make(http.Header)
  2201. for k, v := range c.header_ {
  2202. reqHeaders[k] = v
  2203. }
  2204. reqHeaders.Set("User-Agent", c.s.userAgent())
  2205. var body io.Reader = nil
  2206. body, err := googleapi.WithoutDataWrapper.JSONReader(c.testiampermissionsrequest)
  2207. if err != nil {
  2208. return nil, err
  2209. }
  2210. reqHeaders.Set("Content-Type", "application/json")
  2211. c.urlParams_.Set("alt", alt)
  2212. c.urlParams_.Set("prettyPrint", "false")
  2213. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+resource}:testIamPermissions")
  2214. urls += "?" + c.urlParams_.Encode()
  2215. req, err := http.NewRequest("POST", urls, body)
  2216. if err != nil {
  2217. return nil, err
  2218. }
  2219. req.Header = reqHeaders
  2220. googleapi.Expand(req.URL, map[string]string{
  2221. "resource": c.resource,
  2222. })
  2223. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2224. }
  2225. // Do executes the "cloudbilling.billingAccounts.testIamPermissions" call.
  2226. // Exactly one of *TestIamPermissionsResponse or error will be non-nil.
  2227. // Any non-2xx status code is an error. Response headers are in either
  2228. // *TestIamPermissionsResponse.ServerResponse.Header or (if a response
  2229. // was returned at all) in error.(*googleapi.Error).Header. Use
  2230. // googleapi.IsNotModified to check whether the returned error was
  2231. // because http.StatusNotModified was returned.
  2232. func (c *BillingAccountsTestIamPermissionsCall) Do(opts ...googleapi.CallOption) (*TestIamPermissionsResponse, error) {
  2233. gensupport.SetOptions(c.urlParams_, opts...)
  2234. res, err := c.doRequest("json")
  2235. if res != nil && res.StatusCode == http.StatusNotModified {
  2236. if res.Body != nil {
  2237. res.Body.Close()
  2238. }
  2239. return nil, &googleapi.Error{
  2240. Code: res.StatusCode,
  2241. Header: res.Header,
  2242. }
  2243. }
  2244. if err != nil {
  2245. return nil, err
  2246. }
  2247. defer googleapi.CloseBody(res)
  2248. if err := googleapi.CheckResponse(res); err != nil {
  2249. return nil, err
  2250. }
  2251. ret := &TestIamPermissionsResponse{
  2252. ServerResponse: googleapi.ServerResponse{
  2253. Header: res.Header,
  2254. HTTPStatusCode: res.StatusCode,
  2255. },
  2256. }
  2257. target := &ret
  2258. if err := gensupport.DecodeResponse(target, res); err != nil {
  2259. return nil, err
  2260. }
  2261. return ret, nil
  2262. // {
  2263. // "description": "Tests the access control policy for a billing account. This method takes\nthe resource and a set of permissions as input and returns the subset of\nthe input permissions that the caller is allowed for that resource.",
  2264. // "flatPath": "v1/billingAccounts/{billingAccountsId}:testIamPermissions",
  2265. // "httpMethod": "POST",
  2266. // "id": "cloudbilling.billingAccounts.testIamPermissions",
  2267. // "parameterOrder": [
  2268. // "resource"
  2269. // ],
  2270. // "parameters": {
  2271. // "resource": {
  2272. // "description": "REQUIRED: The resource for which the policy detail is being requested.\nSee the operation documentation for the appropriate value for this field.",
  2273. // "location": "path",
  2274. // "pattern": "^billingAccounts/[^/]+$",
  2275. // "required": true,
  2276. // "type": "string"
  2277. // }
  2278. // },
  2279. // "path": "v1/{+resource}:testIamPermissions",
  2280. // "request": {
  2281. // "$ref": "TestIamPermissionsRequest"
  2282. // },
  2283. // "response": {
  2284. // "$ref": "TestIamPermissionsResponse"
  2285. // },
  2286. // "scopes": [
  2287. // "https://www.googleapis.com/auth/cloud-platform"
  2288. // ]
  2289. // }
  2290. }
  2291. // method id "cloudbilling.billingAccounts.projects.list":
  2292. type BillingAccountsProjectsListCall struct {
  2293. s *APIService
  2294. name string
  2295. urlParams_ gensupport.URLParams
  2296. ifNoneMatch_ string
  2297. ctx_ context.Context
  2298. header_ http.Header
  2299. }
  2300. // List: Lists the projects associated with a billing account. The
  2301. // current
  2302. // authenticated user must have the `billing.resourceAssociations.list`
  2303. // IAM
  2304. // permission, which is often given to billing
  2305. // account
  2306. // [viewers](https://cloud.google.com/billing/docs/how-to/billing
  2307. // -access).
  2308. func (r *BillingAccountsProjectsService) List(name string) *BillingAccountsProjectsListCall {
  2309. c := &BillingAccountsProjectsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2310. c.name = name
  2311. return c
  2312. }
  2313. // PageSize sets the optional parameter "pageSize": Requested page size.
  2314. // The maximum page size is 100; this is also the
  2315. // default.
  2316. func (c *BillingAccountsProjectsListCall) PageSize(pageSize int64) *BillingAccountsProjectsListCall {
  2317. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  2318. return c
  2319. }
  2320. // PageToken sets the optional parameter "pageToken": A token
  2321. // identifying a page of results to be returned. This should be
  2322. // a
  2323. // `next_page_token` value returned from a previous
  2324. // `ListProjectBillingInfo`
  2325. // call. If unspecified, the first page of results is returned.
  2326. func (c *BillingAccountsProjectsListCall) PageToken(pageToken string) *BillingAccountsProjectsListCall {
  2327. c.urlParams_.Set("pageToken", pageToken)
  2328. return c
  2329. }
  2330. // Fields allows partial responses to be retrieved. See
  2331. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2332. // for more information.
  2333. func (c *BillingAccountsProjectsListCall) Fields(s ...googleapi.Field) *BillingAccountsProjectsListCall {
  2334. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2335. return c
  2336. }
  2337. // IfNoneMatch sets the optional parameter which makes the operation
  2338. // fail if the object's ETag matches the given value. This is useful for
  2339. // getting updates only after the object has changed since the last
  2340. // request. Use googleapi.IsNotModified to check whether the response
  2341. // error from Do is the result of In-None-Match.
  2342. func (c *BillingAccountsProjectsListCall) IfNoneMatch(entityTag string) *BillingAccountsProjectsListCall {
  2343. c.ifNoneMatch_ = entityTag
  2344. return c
  2345. }
  2346. // Context sets the context to be used in this call's Do method. Any
  2347. // pending HTTP request will be aborted if the provided context is
  2348. // canceled.
  2349. func (c *BillingAccountsProjectsListCall) Context(ctx context.Context) *BillingAccountsProjectsListCall {
  2350. c.ctx_ = ctx
  2351. return c
  2352. }
  2353. // Header returns an http.Header that can be modified by the caller to
  2354. // add HTTP headers to the request.
  2355. func (c *BillingAccountsProjectsListCall) Header() http.Header {
  2356. if c.header_ == nil {
  2357. c.header_ = make(http.Header)
  2358. }
  2359. return c.header_
  2360. }
  2361. func (c *BillingAccountsProjectsListCall) doRequest(alt string) (*http.Response, error) {
  2362. reqHeaders := make(http.Header)
  2363. for k, v := range c.header_ {
  2364. reqHeaders[k] = v
  2365. }
  2366. reqHeaders.Set("User-Agent", c.s.userAgent())
  2367. if c.ifNoneMatch_ != "" {
  2368. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2369. }
  2370. var body io.Reader = nil
  2371. c.urlParams_.Set("alt", alt)
  2372. c.urlParams_.Set("prettyPrint", "false")
  2373. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}/projects")
  2374. urls += "?" + c.urlParams_.Encode()
  2375. req, err := http.NewRequest("GET", urls, body)
  2376. if err != nil {
  2377. return nil, err
  2378. }
  2379. req.Header = reqHeaders
  2380. googleapi.Expand(req.URL, map[string]string{
  2381. "name": c.name,
  2382. })
  2383. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2384. }
  2385. // Do executes the "cloudbilling.billingAccounts.projects.list" call.
  2386. // Exactly one of *ListProjectBillingInfoResponse or error will be
  2387. // non-nil. Any non-2xx status code is an error. Response headers are in
  2388. // either *ListProjectBillingInfoResponse.ServerResponse.Header or (if a
  2389. // response was returned at all) in error.(*googleapi.Error).Header. Use
  2390. // googleapi.IsNotModified to check whether the returned error was
  2391. // because http.StatusNotModified was returned.
  2392. func (c *BillingAccountsProjectsListCall) Do(opts ...googleapi.CallOption) (*ListProjectBillingInfoResponse, error) {
  2393. gensupport.SetOptions(c.urlParams_, opts...)
  2394. res, err := c.doRequest("json")
  2395. if res != nil && res.StatusCode == http.StatusNotModified {
  2396. if res.Body != nil {
  2397. res.Body.Close()
  2398. }
  2399. return nil, &googleapi.Error{
  2400. Code: res.StatusCode,
  2401. Header: res.Header,
  2402. }
  2403. }
  2404. if err != nil {
  2405. return nil, err
  2406. }
  2407. defer googleapi.CloseBody(res)
  2408. if err := googleapi.CheckResponse(res); err != nil {
  2409. return nil, err
  2410. }
  2411. ret := &ListProjectBillingInfoResponse{
  2412. ServerResponse: googleapi.ServerResponse{
  2413. Header: res.Header,
  2414. HTTPStatusCode: res.StatusCode,
  2415. },
  2416. }
  2417. target := &ret
  2418. if err := gensupport.DecodeResponse(target, res); err != nil {
  2419. return nil, err
  2420. }
  2421. return ret, nil
  2422. // {
  2423. // "description": "Lists the projects associated with a billing account. The current\nauthenticated user must have the `billing.resourceAssociations.list` IAM\npermission, which is often given to billing account\n[viewers](https://cloud.google.com/billing/docs/how-to/billing-access).",
  2424. // "flatPath": "v1/billingAccounts/{billingAccountsId}/projects",
  2425. // "httpMethod": "GET",
  2426. // "id": "cloudbilling.billingAccounts.projects.list",
  2427. // "parameterOrder": [
  2428. // "name"
  2429. // ],
  2430. // "parameters": {
  2431. // "name": {
  2432. // "description": "The resource name of the billing account associated with the projects that\nyou want to list. For example, `billingAccounts/012345-567890-ABCDEF`.",
  2433. // "location": "path",
  2434. // "pattern": "^billingAccounts/[^/]+$",
  2435. // "required": true,
  2436. // "type": "string"
  2437. // },
  2438. // "pageSize": {
  2439. // "description": "Requested page size. The maximum page size is 100; this is also the\ndefault.",
  2440. // "format": "int32",
  2441. // "location": "query",
  2442. // "type": "integer"
  2443. // },
  2444. // "pageToken": {
  2445. // "description": "A token identifying a page of results to be returned. This should be a\n`next_page_token` value returned from a previous `ListProjectBillingInfo`\ncall. If unspecified, the first page of results is returned.",
  2446. // "location": "query",
  2447. // "type": "string"
  2448. // }
  2449. // },
  2450. // "path": "v1/{+name}/projects",
  2451. // "response": {
  2452. // "$ref": "ListProjectBillingInfoResponse"
  2453. // },
  2454. // "scopes": [
  2455. // "https://www.googleapis.com/auth/cloud-platform"
  2456. // ]
  2457. // }
  2458. }
  2459. // Pages invokes f for each page of results.
  2460. // A non-nil error returned from f will halt the iteration.
  2461. // The provided context supersedes any context provided to the Context method.
  2462. func (c *BillingAccountsProjectsListCall) Pages(ctx context.Context, f func(*ListProjectBillingInfoResponse) error) error {
  2463. c.ctx_ = ctx
  2464. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  2465. for {
  2466. x, err := c.Do()
  2467. if err != nil {
  2468. return err
  2469. }
  2470. if err := f(x); err != nil {
  2471. return err
  2472. }
  2473. if x.NextPageToken == "" {
  2474. return nil
  2475. }
  2476. c.PageToken(x.NextPageToken)
  2477. }
  2478. }
  2479. // method id "cloudbilling.projects.getBillingInfo":
  2480. type ProjectsGetBillingInfoCall struct {
  2481. s *APIService
  2482. name string
  2483. urlParams_ gensupport.URLParams
  2484. ifNoneMatch_ string
  2485. ctx_ context.Context
  2486. header_ http.Header
  2487. }
  2488. // GetBillingInfo: Gets the billing information for a project. The
  2489. // current authenticated user
  2490. // must have [permission to view
  2491. // the
  2492. // project](https://cloud.google.com/docs/permissions-overview#h.bgs0
  2493. // oxofvnoo
  2494. // ).
  2495. func (r *ProjectsService) GetBillingInfo(name string) *ProjectsGetBillingInfoCall {
  2496. c := &ProjectsGetBillingInfoCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2497. c.name = name
  2498. return c
  2499. }
  2500. // Fields allows partial responses to be retrieved. See
  2501. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2502. // for more information.
  2503. func (c *ProjectsGetBillingInfoCall) Fields(s ...googleapi.Field) *ProjectsGetBillingInfoCall {
  2504. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2505. return c
  2506. }
  2507. // IfNoneMatch sets the optional parameter which makes the operation
  2508. // fail if the object's ETag matches the given value. This is useful for
  2509. // getting updates only after the object has changed since the last
  2510. // request. Use googleapi.IsNotModified to check whether the response
  2511. // error from Do is the result of In-None-Match.
  2512. func (c *ProjectsGetBillingInfoCall) IfNoneMatch(entityTag string) *ProjectsGetBillingInfoCall {
  2513. c.ifNoneMatch_ = entityTag
  2514. return c
  2515. }
  2516. // Context sets the context to be used in this call's Do method. Any
  2517. // pending HTTP request will be aborted if the provided context is
  2518. // canceled.
  2519. func (c *ProjectsGetBillingInfoCall) Context(ctx context.Context) *ProjectsGetBillingInfoCall {
  2520. c.ctx_ = ctx
  2521. return c
  2522. }
  2523. // Header returns an http.Header that can be modified by the caller to
  2524. // add HTTP headers to the request.
  2525. func (c *ProjectsGetBillingInfoCall) Header() http.Header {
  2526. if c.header_ == nil {
  2527. c.header_ = make(http.Header)
  2528. }
  2529. return c.header_
  2530. }
  2531. func (c *ProjectsGetBillingInfoCall) doRequest(alt string) (*http.Response, error) {
  2532. reqHeaders := make(http.Header)
  2533. for k, v := range c.header_ {
  2534. reqHeaders[k] = v
  2535. }
  2536. reqHeaders.Set("User-Agent", c.s.userAgent())
  2537. if c.ifNoneMatch_ != "" {
  2538. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2539. }
  2540. var body io.Reader = nil
  2541. c.urlParams_.Set("alt", alt)
  2542. c.urlParams_.Set("prettyPrint", "false")
  2543. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}/billingInfo")
  2544. urls += "?" + c.urlParams_.Encode()
  2545. req, err := http.NewRequest("GET", urls, body)
  2546. if err != nil {
  2547. return nil, err
  2548. }
  2549. req.Header = reqHeaders
  2550. googleapi.Expand(req.URL, map[string]string{
  2551. "name": c.name,
  2552. })
  2553. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2554. }
  2555. // Do executes the "cloudbilling.projects.getBillingInfo" call.
  2556. // Exactly one of *ProjectBillingInfo or error will be non-nil. Any
  2557. // non-2xx status code is an error. Response headers are in either
  2558. // *ProjectBillingInfo.ServerResponse.Header or (if a response was
  2559. // returned at all) in error.(*googleapi.Error).Header. Use
  2560. // googleapi.IsNotModified to check whether the returned error was
  2561. // because http.StatusNotModified was returned.
  2562. func (c *ProjectsGetBillingInfoCall) Do(opts ...googleapi.CallOption) (*ProjectBillingInfo, error) {
  2563. gensupport.SetOptions(c.urlParams_, opts...)
  2564. res, err := c.doRequest("json")
  2565. if res != nil && res.StatusCode == http.StatusNotModified {
  2566. if res.Body != nil {
  2567. res.Body.Close()
  2568. }
  2569. return nil, &googleapi.Error{
  2570. Code: res.StatusCode,
  2571. Header: res.Header,
  2572. }
  2573. }
  2574. if err != nil {
  2575. return nil, err
  2576. }
  2577. defer googleapi.CloseBody(res)
  2578. if err := googleapi.CheckResponse(res); err != nil {
  2579. return nil, err
  2580. }
  2581. ret := &ProjectBillingInfo{
  2582. ServerResponse: googleapi.ServerResponse{
  2583. Header: res.Header,
  2584. HTTPStatusCode: res.StatusCode,
  2585. },
  2586. }
  2587. target := &ret
  2588. if err := gensupport.DecodeResponse(target, res); err != nil {
  2589. return nil, err
  2590. }
  2591. return ret, nil
  2592. // {
  2593. // "description": "Gets the billing information for a project. The current authenticated user\nmust have [permission to view the\nproject](https://cloud.google.com/docs/permissions-overview#h.bgs0oxofvnoo\n).",
  2594. // "flatPath": "v1/projects/{projectsId}/billingInfo",
  2595. // "httpMethod": "GET",
  2596. // "id": "cloudbilling.projects.getBillingInfo",
  2597. // "parameterOrder": [
  2598. // "name"
  2599. // ],
  2600. // "parameters": {
  2601. // "name": {
  2602. // "description": "The resource name of the project for which billing information is\nretrieved. For example, `projects/tokyo-rain-123`.",
  2603. // "location": "path",
  2604. // "pattern": "^projects/[^/]+$",
  2605. // "required": true,
  2606. // "type": "string"
  2607. // }
  2608. // },
  2609. // "path": "v1/{+name}/billingInfo",
  2610. // "response": {
  2611. // "$ref": "ProjectBillingInfo"
  2612. // },
  2613. // "scopes": [
  2614. // "https://www.googleapis.com/auth/cloud-platform"
  2615. // ]
  2616. // }
  2617. }
  2618. // method id "cloudbilling.projects.updateBillingInfo":
  2619. type ProjectsUpdateBillingInfoCall struct {
  2620. s *APIService
  2621. name string
  2622. projectbillinginfo *ProjectBillingInfo
  2623. urlParams_ gensupport.URLParams
  2624. ctx_ context.Context
  2625. header_ http.Header
  2626. }
  2627. // UpdateBillingInfo: Sets or updates the billing account associated
  2628. // with a project. You specify
  2629. // the new billing account by setting the `billing_account_name` in
  2630. // the
  2631. // `ProjectBillingInfo` resource to the resource name of a billing
  2632. // account.
  2633. // Associating a project with an open billing account enables billing on
  2634. // the
  2635. // project and allows charges for resource usage. If the project already
  2636. // had a
  2637. // billing account, this method changes the billing account used for
  2638. // resource
  2639. // usage charges.
  2640. //
  2641. // *Note:* Incurred charges that have not yet been reported in the
  2642. // transaction
  2643. // history of the GCP Console might be billed to the new
  2644. // billing
  2645. // account, even if the charge occurred before the new billing account
  2646. // was
  2647. // assigned to the project.
  2648. //
  2649. // The current authenticated user must have ownership privileges for
  2650. // both
  2651. // the
  2652. // [project](https://cloud.google.com/docs/permissions-overview#h.bgs
  2653. // 0oxofvnoo
  2654. // ) and the
  2655. // [billing
  2656. // account](https://cloud.google.com/billing/docs/how-to/billing
  2657. // -access).
  2658. //
  2659. // You can disable billing on the project by setting
  2660. // the
  2661. // `billing_account_name` field to empty. This action disassociates
  2662. // the
  2663. // current billing account from the project. Any billable activity of
  2664. // your
  2665. // in-use services will stop, and your application could stop
  2666. // functioning as
  2667. // expected. Any unbilled charges to date will be billed to the
  2668. // previously
  2669. // associated account. The current authenticated user must be either an
  2670. // owner
  2671. // of the project or an owner of the billing account for the
  2672. // project.
  2673. //
  2674. // Note that associating a project with a *closed* billing account will
  2675. // have
  2676. // much the same effect as disabling billing on the project: any
  2677. // paid
  2678. // resources used by the project will be shut down. Thus, unless you
  2679. // wish to
  2680. // disable billing, you should always call this method with the name of
  2681. // an
  2682. // *open* billing account.
  2683. func (r *ProjectsService) UpdateBillingInfo(name string, projectbillinginfo *ProjectBillingInfo) *ProjectsUpdateBillingInfoCall {
  2684. c := &ProjectsUpdateBillingInfoCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2685. c.name = name
  2686. c.projectbillinginfo = projectbillinginfo
  2687. return c
  2688. }
  2689. // Fields allows partial responses to be retrieved. See
  2690. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2691. // for more information.
  2692. func (c *ProjectsUpdateBillingInfoCall) Fields(s ...googleapi.Field) *ProjectsUpdateBillingInfoCall {
  2693. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2694. return c
  2695. }
  2696. // Context sets the context to be used in this call's Do method. Any
  2697. // pending HTTP request will be aborted if the provided context is
  2698. // canceled.
  2699. func (c *ProjectsUpdateBillingInfoCall) Context(ctx context.Context) *ProjectsUpdateBillingInfoCall {
  2700. c.ctx_ = ctx
  2701. return c
  2702. }
  2703. // Header returns an http.Header that can be modified by the caller to
  2704. // add HTTP headers to the request.
  2705. func (c *ProjectsUpdateBillingInfoCall) Header() http.Header {
  2706. if c.header_ == nil {
  2707. c.header_ = make(http.Header)
  2708. }
  2709. return c.header_
  2710. }
  2711. func (c *ProjectsUpdateBillingInfoCall) doRequest(alt string) (*http.Response, error) {
  2712. reqHeaders := make(http.Header)
  2713. for k, v := range c.header_ {
  2714. reqHeaders[k] = v
  2715. }
  2716. reqHeaders.Set("User-Agent", c.s.userAgent())
  2717. var body io.Reader = nil
  2718. body, err := googleapi.WithoutDataWrapper.JSONReader(c.projectbillinginfo)
  2719. if err != nil {
  2720. return nil, err
  2721. }
  2722. reqHeaders.Set("Content-Type", "application/json")
  2723. c.urlParams_.Set("alt", alt)
  2724. c.urlParams_.Set("prettyPrint", "false")
  2725. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}/billingInfo")
  2726. urls += "?" + c.urlParams_.Encode()
  2727. req, err := http.NewRequest("PUT", urls, body)
  2728. if err != nil {
  2729. return nil, err
  2730. }
  2731. req.Header = reqHeaders
  2732. googleapi.Expand(req.URL, map[string]string{
  2733. "name": c.name,
  2734. })
  2735. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2736. }
  2737. // Do executes the "cloudbilling.projects.updateBillingInfo" call.
  2738. // Exactly one of *ProjectBillingInfo or error will be non-nil. Any
  2739. // non-2xx status code is an error. Response headers are in either
  2740. // *ProjectBillingInfo.ServerResponse.Header or (if a response was
  2741. // returned at all) in error.(*googleapi.Error).Header. Use
  2742. // googleapi.IsNotModified to check whether the returned error was
  2743. // because http.StatusNotModified was returned.
  2744. func (c *ProjectsUpdateBillingInfoCall) Do(opts ...googleapi.CallOption) (*ProjectBillingInfo, error) {
  2745. gensupport.SetOptions(c.urlParams_, opts...)
  2746. res, err := c.doRequest("json")
  2747. if res != nil && res.StatusCode == http.StatusNotModified {
  2748. if res.Body != nil {
  2749. res.Body.Close()
  2750. }
  2751. return nil, &googleapi.Error{
  2752. Code: res.StatusCode,
  2753. Header: res.Header,
  2754. }
  2755. }
  2756. if err != nil {
  2757. return nil, err
  2758. }
  2759. defer googleapi.CloseBody(res)
  2760. if err := googleapi.CheckResponse(res); err != nil {
  2761. return nil, err
  2762. }
  2763. ret := &ProjectBillingInfo{
  2764. ServerResponse: googleapi.ServerResponse{
  2765. Header: res.Header,
  2766. HTTPStatusCode: res.StatusCode,
  2767. },
  2768. }
  2769. target := &ret
  2770. if err := gensupport.DecodeResponse(target, res); err != nil {
  2771. return nil, err
  2772. }
  2773. return ret, nil
  2774. // {
  2775. // "description": "Sets or updates the billing account associated with a project. You specify\nthe new billing account by setting the `billing_account_name` in the\n`ProjectBillingInfo` resource to the resource name of a billing account.\nAssociating a project with an open billing account enables billing on the\nproject and allows charges for resource usage. If the project already had a\nbilling account, this method changes the billing account used for resource\nusage charges.\n\n*Note:* Incurred charges that have not yet been reported in the transaction\nhistory of the GCP Console might be billed to the new billing\naccount, even if the charge occurred before the new billing account was\nassigned to the project.\n\nThe current authenticated user must have ownership privileges for both the\n[project](https://cloud.google.com/docs/permissions-overview#h.bgs0oxofvnoo\n) and the [billing\naccount](https://cloud.google.com/billing/docs/how-to/billing-access).\n\nYou can disable billing on the project by setting the\n`billing_account_name` field to empty. This action disassociates the\ncurrent billing account from the project. Any billable activity of your\nin-use services will stop, and your application could stop functioning as\nexpected. Any unbilled charges to date will be billed to the previously\nassociated account. The current authenticated user must be either an owner\nof the project or an owner of the billing account for the project.\n\nNote that associating a project with a *closed* billing account will have\nmuch the same effect as disabling billing on the project: any paid\nresources used by the project will be shut down. Thus, unless you wish to\ndisable billing, you should always call this method with the name of an\n*open* billing account.",
  2776. // "flatPath": "v1/projects/{projectsId}/billingInfo",
  2777. // "httpMethod": "PUT",
  2778. // "id": "cloudbilling.projects.updateBillingInfo",
  2779. // "parameterOrder": [
  2780. // "name"
  2781. // ],
  2782. // "parameters": {
  2783. // "name": {
  2784. // "description": "The resource name of the project associated with the billing information\nthat you want to update. For example, `projects/tokyo-rain-123`.",
  2785. // "location": "path",
  2786. // "pattern": "^projects/[^/]+$",
  2787. // "required": true,
  2788. // "type": "string"
  2789. // }
  2790. // },
  2791. // "path": "v1/{+name}/billingInfo",
  2792. // "request": {
  2793. // "$ref": "ProjectBillingInfo"
  2794. // },
  2795. // "response": {
  2796. // "$ref": "ProjectBillingInfo"
  2797. // },
  2798. // "scopes": [
  2799. // "https://www.googleapis.com/auth/cloud-platform"
  2800. // ]
  2801. // }
  2802. }
  2803. // method id "cloudbilling.services.list":
  2804. type ServicesListCall struct {
  2805. s *APIService
  2806. urlParams_ gensupport.URLParams
  2807. ifNoneMatch_ string
  2808. ctx_ context.Context
  2809. header_ http.Header
  2810. }
  2811. // List: Lists all public cloud services.
  2812. func (r *ServicesService) List() *ServicesListCall {
  2813. c := &ServicesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2814. return c
  2815. }
  2816. // PageSize sets the optional parameter "pageSize": Requested page size.
  2817. // Defaults to 5000.
  2818. func (c *ServicesListCall) PageSize(pageSize int64) *ServicesListCall {
  2819. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  2820. return c
  2821. }
  2822. // PageToken sets the optional parameter "pageToken": A token
  2823. // identifying a page of results to return. This should be
  2824. // a
  2825. // `next_page_token` value returned from a previous `ListServices`
  2826. // call. If unspecified, the first page of results is returned.
  2827. func (c *ServicesListCall) PageToken(pageToken string) *ServicesListCall {
  2828. c.urlParams_.Set("pageToken", pageToken)
  2829. return c
  2830. }
  2831. // Fields allows partial responses to be retrieved. See
  2832. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2833. // for more information.
  2834. func (c *ServicesListCall) Fields(s ...googleapi.Field) *ServicesListCall {
  2835. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2836. return c
  2837. }
  2838. // IfNoneMatch sets the optional parameter which makes the operation
  2839. // fail if the object's ETag matches the given value. This is useful for
  2840. // getting updates only after the object has changed since the last
  2841. // request. Use googleapi.IsNotModified to check whether the response
  2842. // error from Do is the result of In-None-Match.
  2843. func (c *ServicesListCall) IfNoneMatch(entityTag string) *ServicesListCall {
  2844. c.ifNoneMatch_ = entityTag
  2845. return c
  2846. }
  2847. // Context sets the context to be used in this call's Do method. Any
  2848. // pending HTTP request will be aborted if the provided context is
  2849. // canceled.
  2850. func (c *ServicesListCall) Context(ctx context.Context) *ServicesListCall {
  2851. c.ctx_ = ctx
  2852. return c
  2853. }
  2854. // Header returns an http.Header that can be modified by the caller to
  2855. // add HTTP headers to the request.
  2856. func (c *ServicesListCall) Header() http.Header {
  2857. if c.header_ == nil {
  2858. c.header_ = make(http.Header)
  2859. }
  2860. return c.header_
  2861. }
  2862. func (c *ServicesListCall) doRequest(alt string) (*http.Response, error) {
  2863. reqHeaders := make(http.Header)
  2864. for k, v := range c.header_ {
  2865. reqHeaders[k] = v
  2866. }
  2867. reqHeaders.Set("User-Agent", c.s.userAgent())
  2868. if c.ifNoneMatch_ != "" {
  2869. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2870. }
  2871. var body io.Reader = nil
  2872. c.urlParams_.Set("alt", alt)
  2873. c.urlParams_.Set("prettyPrint", "false")
  2874. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/services")
  2875. urls += "?" + c.urlParams_.Encode()
  2876. req, err := http.NewRequest("GET", urls, body)
  2877. if err != nil {
  2878. return nil, err
  2879. }
  2880. req.Header = reqHeaders
  2881. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2882. }
  2883. // Do executes the "cloudbilling.services.list" call.
  2884. // Exactly one of *ListServicesResponse or error will be non-nil. Any
  2885. // non-2xx status code is an error. Response headers are in either
  2886. // *ListServicesResponse.ServerResponse.Header or (if a response was
  2887. // returned at all) in error.(*googleapi.Error).Header. Use
  2888. // googleapi.IsNotModified to check whether the returned error was
  2889. // because http.StatusNotModified was returned.
  2890. func (c *ServicesListCall) Do(opts ...googleapi.CallOption) (*ListServicesResponse, error) {
  2891. gensupport.SetOptions(c.urlParams_, opts...)
  2892. res, err := c.doRequest("json")
  2893. if res != nil && res.StatusCode == http.StatusNotModified {
  2894. if res.Body != nil {
  2895. res.Body.Close()
  2896. }
  2897. return nil, &googleapi.Error{
  2898. Code: res.StatusCode,
  2899. Header: res.Header,
  2900. }
  2901. }
  2902. if err != nil {
  2903. return nil, err
  2904. }
  2905. defer googleapi.CloseBody(res)
  2906. if err := googleapi.CheckResponse(res); err != nil {
  2907. return nil, err
  2908. }
  2909. ret := &ListServicesResponse{
  2910. ServerResponse: googleapi.ServerResponse{
  2911. Header: res.Header,
  2912. HTTPStatusCode: res.StatusCode,
  2913. },
  2914. }
  2915. target := &ret
  2916. if err := gensupport.DecodeResponse(target, res); err != nil {
  2917. return nil, err
  2918. }
  2919. return ret, nil
  2920. // {
  2921. // "description": "Lists all public cloud services.",
  2922. // "flatPath": "v1/services",
  2923. // "httpMethod": "GET",
  2924. // "id": "cloudbilling.services.list",
  2925. // "parameterOrder": [],
  2926. // "parameters": {
  2927. // "pageSize": {
  2928. // "description": "Requested page size. Defaults to 5000.",
  2929. // "format": "int32",
  2930. // "location": "query",
  2931. // "type": "integer"
  2932. // },
  2933. // "pageToken": {
  2934. // "description": "A token identifying a page of results to return. This should be a\n`next_page_token` value returned from a previous `ListServices`\ncall. If unspecified, the first page of results is returned.",
  2935. // "location": "query",
  2936. // "type": "string"
  2937. // }
  2938. // },
  2939. // "path": "v1/services",
  2940. // "response": {
  2941. // "$ref": "ListServicesResponse"
  2942. // },
  2943. // "scopes": [
  2944. // "https://www.googleapis.com/auth/cloud-platform"
  2945. // ]
  2946. // }
  2947. }
  2948. // Pages invokes f for each page of results.
  2949. // A non-nil error returned from f will halt the iteration.
  2950. // The provided context supersedes any context provided to the Context method.
  2951. func (c *ServicesListCall) Pages(ctx context.Context, f func(*ListServicesResponse) error) error {
  2952. c.ctx_ = ctx
  2953. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  2954. for {
  2955. x, err := c.Do()
  2956. if err != nil {
  2957. return err
  2958. }
  2959. if err := f(x); err != nil {
  2960. return err
  2961. }
  2962. if x.NextPageToken == "" {
  2963. return nil
  2964. }
  2965. c.PageToken(x.NextPageToken)
  2966. }
  2967. }
  2968. // method id "cloudbilling.services.skus.list":
  2969. type ServicesSkusListCall struct {
  2970. s *APIService
  2971. parent string
  2972. urlParams_ gensupport.URLParams
  2973. ifNoneMatch_ string
  2974. ctx_ context.Context
  2975. header_ http.Header
  2976. }
  2977. // List: Lists all publicly available SKUs for a given cloud service.
  2978. func (r *ServicesSkusService) List(parent string) *ServicesSkusListCall {
  2979. c := &ServicesSkusListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2980. c.parent = parent
  2981. return c
  2982. }
  2983. // CurrencyCode sets the optional parameter "currencyCode": The ISO 4217
  2984. // currency code for the pricing info in the response proto.
  2985. // Will use the conversion rate as of start_time.
  2986. // If not specified USD will be used.
  2987. func (c *ServicesSkusListCall) CurrencyCode(currencyCode string) *ServicesSkusListCall {
  2988. c.urlParams_.Set("currencyCode", currencyCode)
  2989. return c
  2990. }
  2991. // EndTime sets the optional parameter "endTime": Optional exclusive end
  2992. // time of the time range for which the pricing
  2993. // versions will be returned. Timestamps in the future are not
  2994. // allowed.
  2995. // The time range has to be within a single calendar month
  2996. // in
  2997. // America/Los_Angeles timezone. Time range as a whole is optional. If
  2998. // not
  2999. // specified, the latest pricing will be returned (up to 12 hours old
  3000. // at
  3001. // most).
  3002. func (c *ServicesSkusListCall) EndTime(endTime string) *ServicesSkusListCall {
  3003. c.urlParams_.Set("endTime", endTime)
  3004. return c
  3005. }
  3006. // PageSize sets the optional parameter "pageSize": Requested page size.
  3007. // Defaults to 5000.
  3008. func (c *ServicesSkusListCall) PageSize(pageSize int64) *ServicesSkusListCall {
  3009. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  3010. return c
  3011. }
  3012. // PageToken sets the optional parameter "pageToken": A token
  3013. // identifying a page of results to return. This should be
  3014. // a
  3015. // `next_page_token` value returned from a previous `ListSkus`
  3016. // call. If unspecified, the first page of results is returned.
  3017. func (c *ServicesSkusListCall) PageToken(pageToken string) *ServicesSkusListCall {
  3018. c.urlParams_.Set("pageToken", pageToken)
  3019. return c
  3020. }
  3021. // StartTime sets the optional parameter "startTime": Optional inclusive
  3022. // start time of the time range for which the pricing
  3023. // versions will be returned. Timestamps in the future are not
  3024. // allowed.
  3025. // The time range has to be within a single calendar month
  3026. // in
  3027. // America/Los_Angeles timezone. Time range as a whole is optional. If
  3028. // not
  3029. // specified, the latest pricing will be returned (up to 12 hours old
  3030. // at
  3031. // most).
  3032. func (c *ServicesSkusListCall) StartTime(startTime string) *ServicesSkusListCall {
  3033. c.urlParams_.Set("startTime", startTime)
  3034. return c
  3035. }
  3036. // Fields allows partial responses to be retrieved. See
  3037. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3038. // for more information.
  3039. func (c *ServicesSkusListCall) Fields(s ...googleapi.Field) *ServicesSkusListCall {
  3040. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3041. return c
  3042. }
  3043. // IfNoneMatch sets the optional parameter which makes the operation
  3044. // fail if the object's ETag matches the given value. This is useful for
  3045. // getting updates only after the object has changed since the last
  3046. // request. Use googleapi.IsNotModified to check whether the response
  3047. // error from Do is the result of In-None-Match.
  3048. func (c *ServicesSkusListCall) IfNoneMatch(entityTag string) *ServicesSkusListCall {
  3049. c.ifNoneMatch_ = entityTag
  3050. return c
  3051. }
  3052. // Context sets the context to be used in this call's Do method. Any
  3053. // pending HTTP request will be aborted if the provided context is
  3054. // canceled.
  3055. func (c *ServicesSkusListCall) Context(ctx context.Context) *ServicesSkusListCall {
  3056. c.ctx_ = ctx
  3057. return c
  3058. }
  3059. // Header returns an http.Header that can be modified by the caller to
  3060. // add HTTP headers to the request.
  3061. func (c *ServicesSkusListCall) Header() http.Header {
  3062. if c.header_ == nil {
  3063. c.header_ = make(http.Header)
  3064. }
  3065. return c.header_
  3066. }
  3067. func (c *ServicesSkusListCall) doRequest(alt string) (*http.Response, error) {
  3068. reqHeaders := make(http.Header)
  3069. for k, v := range c.header_ {
  3070. reqHeaders[k] = v
  3071. }
  3072. reqHeaders.Set("User-Agent", c.s.userAgent())
  3073. if c.ifNoneMatch_ != "" {
  3074. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  3075. }
  3076. var body io.Reader = nil
  3077. c.urlParams_.Set("alt", alt)
  3078. c.urlParams_.Set("prettyPrint", "false")
  3079. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/skus")
  3080. urls += "?" + c.urlParams_.Encode()
  3081. req, err := http.NewRequest("GET", urls, body)
  3082. if err != nil {
  3083. return nil, err
  3084. }
  3085. req.Header = reqHeaders
  3086. googleapi.Expand(req.URL, map[string]string{
  3087. "parent": c.parent,
  3088. })
  3089. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3090. }
  3091. // Do executes the "cloudbilling.services.skus.list" call.
  3092. // Exactly one of *ListSkusResponse or error will be non-nil. Any
  3093. // non-2xx status code is an error. Response headers are in either
  3094. // *ListSkusResponse.ServerResponse.Header or (if a response was
  3095. // returned at all) in error.(*googleapi.Error).Header. Use
  3096. // googleapi.IsNotModified to check whether the returned error was
  3097. // because http.StatusNotModified was returned.
  3098. func (c *ServicesSkusListCall) Do(opts ...googleapi.CallOption) (*ListSkusResponse, error) {
  3099. gensupport.SetOptions(c.urlParams_, opts...)
  3100. res, err := c.doRequest("json")
  3101. if res != nil && res.StatusCode == http.StatusNotModified {
  3102. if res.Body != nil {
  3103. res.Body.Close()
  3104. }
  3105. return nil, &googleapi.Error{
  3106. Code: res.StatusCode,
  3107. Header: res.Header,
  3108. }
  3109. }
  3110. if err != nil {
  3111. return nil, err
  3112. }
  3113. defer googleapi.CloseBody(res)
  3114. if err := googleapi.CheckResponse(res); err != nil {
  3115. return nil, err
  3116. }
  3117. ret := &ListSkusResponse{
  3118. ServerResponse: googleapi.ServerResponse{
  3119. Header: res.Header,
  3120. HTTPStatusCode: res.StatusCode,
  3121. },
  3122. }
  3123. target := &ret
  3124. if err := gensupport.DecodeResponse(target, res); err != nil {
  3125. return nil, err
  3126. }
  3127. return ret, nil
  3128. // {
  3129. // "description": "Lists all publicly available SKUs for a given cloud service.",
  3130. // "flatPath": "v1/services/{servicesId}/skus",
  3131. // "httpMethod": "GET",
  3132. // "id": "cloudbilling.services.skus.list",
  3133. // "parameterOrder": [
  3134. // "parent"
  3135. // ],
  3136. // "parameters": {
  3137. // "currencyCode": {
  3138. // "description": "The ISO 4217 currency code for the pricing info in the response proto.\nWill use the conversion rate as of start_time.\nOptional. If not specified USD will be used.",
  3139. // "location": "query",
  3140. // "type": "string"
  3141. // },
  3142. // "endTime": {
  3143. // "description": "Optional exclusive end time of the time range for which the pricing\nversions will be returned. Timestamps in the future are not allowed.\nThe time range has to be within a single calendar month in\nAmerica/Los_Angeles timezone. Time range as a whole is optional. If not\nspecified, the latest pricing will be returned (up to 12 hours old at\nmost).",
  3144. // "format": "google-datetime",
  3145. // "location": "query",
  3146. // "type": "string"
  3147. // },
  3148. // "pageSize": {
  3149. // "description": "Requested page size. Defaults to 5000.",
  3150. // "format": "int32",
  3151. // "location": "query",
  3152. // "type": "integer"
  3153. // },
  3154. // "pageToken": {
  3155. // "description": "A token identifying a page of results to return. This should be a\n`next_page_token` value returned from a previous `ListSkus`\ncall. If unspecified, the first page of results is returned.",
  3156. // "location": "query",
  3157. // "type": "string"
  3158. // },
  3159. // "parent": {
  3160. // "description": "The name of the service.\nExample: \"services/DA34-426B-A397\"",
  3161. // "location": "path",
  3162. // "pattern": "^services/[^/]+$",
  3163. // "required": true,
  3164. // "type": "string"
  3165. // },
  3166. // "startTime": {
  3167. // "description": "Optional inclusive start time of the time range for which the pricing\nversions will be returned. Timestamps in the future are not allowed.\nThe time range has to be within a single calendar month in\nAmerica/Los_Angeles timezone. Time range as a whole is optional. If not\nspecified, the latest pricing will be returned (up to 12 hours old at\nmost).",
  3168. // "format": "google-datetime",
  3169. // "location": "query",
  3170. // "type": "string"
  3171. // }
  3172. // },
  3173. // "path": "v1/{+parent}/skus",
  3174. // "response": {
  3175. // "$ref": "ListSkusResponse"
  3176. // },
  3177. // "scopes": [
  3178. // "https://www.googleapis.com/auth/cloud-platform"
  3179. // ]
  3180. // }
  3181. }
  3182. // Pages invokes f for each page of results.
  3183. // A non-nil error returned from f will halt the iteration.
  3184. // The provided context supersedes any context provided to the Context method.
  3185. func (c *ServicesSkusListCall) Pages(ctx context.Context, f func(*ListSkusResponse) error) error {
  3186. c.ctx_ = ctx
  3187. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  3188. for {
  3189. x, err := c.Do()
  3190. if err != nil {
  3191. return err
  3192. }
  3193. if err := f(x); err != nil {
  3194. return err
  3195. }
  3196. if x.NextPageToken == "" {
  3197. return nil
  3198. }
  3199. c.PageToken(x.NextPageToken)
  3200. }
  3201. }