Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
 
 
 

3336 lignes
119 KiB

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