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

7295 lines
273 KiB

  1. // Package bigquery provides access to the BigQuery API.
  2. //
  3. // See https://cloud.google.com/bigquery/
  4. //
  5. // Usage example:
  6. //
  7. // import "google.golang.org/api/bigquery/v2"
  8. // ...
  9. // bigqueryService, err := bigquery.New(oauthHttpClient)
  10. package bigquery // import "google.golang.org/api/bigquery/v2"
  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 = "bigquery:v2"
  41. const apiName = "bigquery"
  42. const apiVersion = "v2"
  43. const basePath = "https://www.googleapis.com/bigquery/v2/"
  44. // OAuth2 scopes used by this API.
  45. const (
  46. // View and manage your data in Google BigQuery
  47. BigqueryScope = "https://www.googleapis.com/auth/bigquery"
  48. // Insert data into Google BigQuery
  49. BigqueryInsertdataScope = "https://www.googleapis.com/auth/bigquery.insertdata"
  50. // View and manage your data across Google Cloud Platform services
  51. CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platform"
  52. // View your data across Google Cloud Platform services
  53. CloudPlatformReadOnlyScope = "https://www.googleapis.com/auth/cloud-platform.read-only"
  54. // Manage your data and permissions in Google Cloud Storage
  55. DevstorageFullControlScope = "https://www.googleapis.com/auth/devstorage.full_control"
  56. // View your data in Google Cloud Storage
  57. DevstorageReadOnlyScope = "https://www.googleapis.com/auth/devstorage.read_only"
  58. // Manage your data in Google Cloud Storage
  59. DevstorageReadWriteScope = "https://www.googleapis.com/auth/devstorage.read_write"
  60. )
  61. func New(client *http.Client) (*Service, error) {
  62. if client == nil {
  63. return nil, errors.New("client is nil")
  64. }
  65. s := &Service{client: client, BasePath: basePath}
  66. s.Datasets = NewDatasetsService(s)
  67. s.Jobs = NewJobsService(s)
  68. s.Projects = NewProjectsService(s)
  69. s.Tabledata = NewTabledataService(s)
  70. s.Tables = NewTablesService(s)
  71. return s, nil
  72. }
  73. type Service struct {
  74. client *http.Client
  75. BasePath string // API endpoint base URL
  76. UserAgent string // optional additional User-Agent fragment
  77. Datasets *DatasetsService
  78. Jobs *JobsService
  79. Projects *ProjectsService
  80. Tabledata *TabledataService
  81. Tables *TablesService
  82. }
  83. func (s *Service) userAgent() string {
  84. if s.UserAgent == "" {
  85. return googleapi.UserAgent
  86. }
  87. return googleapi.UserAgent + " " + s.UserAgent
  88. }
  89. func NewDatasetsService(s *Service) *DatasetsService {
  90. rs := &DatasetsService{s: s}
  91. return rs
  92. }
  93. type DatasetsService struct {
  94. s *Service
  95. }
  96. func NewJobsService(s *Service) *JobsService {
  97. rs := &JobsService{s: s}
  98. return rs
  99. }
  100. type JobsService struct {
  101. s *Service
  102. }
  103. func NewProjectsService(s *Service) *ProjectsService {
  104. rs := &ProjectsService{s: s}
  105. return rs
  106. }
  107. type ProjectsService struct {
  108. s *Service
  109. }
  110. func NewTabledataService(s *Service) *TabledataService {
  111. rs := &TabledataService{s: s}
  112. return rs
  113. }
  114. type TabledataService struct {
  115. s *Service
  116. }
  117. func NewTablesService(s *Service) *TablesService {
  118. rs := &TablesService{s: s}
  119. return rs
  120. }
  121. type TablesService struct {
  122. s *Service
  123. }
  124. type BigtableColumn struct {
  125. // Encoding: [Optional] The encoding of the values when the type is not
  126. // STRING. Acceptable encoding values are: TEXT - indicates values are
  127. // alphanumeric text strings. BINARY - indicates values are encoded
  128. // using HBase Bytes.toBytes family of functions. 'encoding' can also be
  129. // set at the column family level. However, the setting at this level
  130. // takes precedence if 'encoding' is set at both levels.
  131. Encoding string `json:"encoding,omitempty"`
  132. // FieldName: [Optional] If the qualifier is not a valid BigQuery field
  133. // identifier i.e. does not match [a-zA-Z][a-zA-Z0-9_]*, a valid
  134. // identifier must be provided as the column field name and is used as
  135. // field name in queries.
  136. FieldName string `json:"fieldName,omitempty"`
  137. // OnlyReadLatest: [Optional] If this is set, only the latest version of
  138. // value in this column are exposed. 'onlyReadLatest' can also be set at
  139. // the column family level. However, the setting at this level takes
  140. // precedence if 'onlyReadLatest' is set at both levels.
  141. OnlyReadLatest bool `json:"onlyReadLatest,omitempty"`
  142. // QualifierEncoded: [Required] Qualifier of the column. Columns in the
  143. // parent column family that has this exact qualifier are exposed as .
  144. // field. If the qualifier is valid UTF-8 string, it can be specified in
  145. // the qualifier_string field. Otherwise, a base-64 encoded value must
  146. // be set to qualifier_encoded. The column field name is the same as the
  147. // column qualifier. However, if the qualifier is not a valid BigQuery
  148. // field identifier i.e. does not match [a-zA-Z][a-zA-Z0-9_]*, a valid
  149. // identifier must be provided as field_name.
  150. QualifierEncoded string `json:"qualifierEncoded,omitempty"`
  151. QualifierString string `json:"qualifierString,omitempty"`
  152. // Type: [Optional] The type to convert the value in cells of this
  153. // column. The values are expected to be encoded using HBase
  154. // Bytes.toBytes function when using the BINARY encoding value.
  155. // Following BigQuery types are allowed (case-sensitive) - BYTES STRING
  156. // INTEGER FLOAT BOOLEAN Default type is BYTES. 'type' can also be set
  157. // at the column family level. However, the setting at this level takes
  158. // precedence if 'type' is set at both levels.
  159. Type string `json:"type,omitempty"`
  160. // ForceSendFields is a list of field names (e.g. "Encoding") to
  161. // unconditionally include in API requests. By default, fields with
  162. // empty values are omitted from API requests. However, any non-pointer,
  163. // non-interface field appearing in ForceSendFields will be sent to the
  164. // server regardless of whether the field is empty or not. This may be
  165. // used to include empty fields in Patch requests.
  166. ForceSendFields []string `json:"-"`
  167. // NullFields is a list of field names (e.g. "Encoding") to include in
  168. // API requests with the JSON null value. By default, fields with empty
  169. // values are omitted from API requests. However, any field with an
  170. // empty value appearing in NullFields will be sent to the server as
  171. // null. It is an error if a field in this list has a non-empty value.
  172. // This may be used to include null fields in Patch requests.
  173. NullFields []string `json:"-"`
  174. }
  175. func (s *BigtableColumn) MarshalJSON() ([]byte, error) {
  176. type NoMethod BigtableColumn
  177. raw := NoMethod(*s)
  178. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  179. }
  180. type BigtableColumnFamily struct {
  181. // Columns: [Optional] Lists of columns that should be exposed as
  182. // individual fields as opposed to a list of (column name, value) pairs.
  183. // All columns whose qualifier matches a qualifier in this list can be
  184. // accessed as .. Other columns can be accessed as a list through
  185. // .Column field.
  186. Columns []*BigtableColumn `json:"columns,omitempty"`
  187. // Encoding: [Optional] The encoding of the values when the type is not
  188. // STRING. Acceptable encoding values are: TEXT - indicates values are
  189. // alphanumeric text strings. BINARY - indicates values are encoded
  190. // using HBase Bytes.toBytes family of functions. This can be overridden
  191. // for a specific column by listing that column in 'columns' and
  192. // specifying an encoding for it.
  193. Encoding string `json:"encoding,omitempty"`
  194. // FamilyId: Identifier of the column family.
  195. FamilyId string `json:"familyId,omitempty"`
  196. // OnlyReadLatest: [Optional] If this is set only the latest version of
  197. // value are exposed for all columns in this column family. This can be
  198. // overridden for a specific column by listing that column in 'columns'
  199. // and specifying a different setting for that column.
  200. OnlyReadLatest bool `json:"onlyReadLatest,omitempty"`
  201. // Type: [Optional] The type to convert the value in cells of this
  202. // column family. The values are expected to be encoded using HBase
  203. // Bytes.toBytes function when using the BINARY encoding value.
  204. // Following BigQuery types are allowed (case-sensitive) - BYTES STRING
  205. // INTEGER FLOAT BOOLEAN Default type is BYTES. This can be overridden
  206. // for a specific column by listing that column in 'columns' and
  207. // specifying a type for it.
  208. Type string `json:"type,omitempty"`
  209. // ForceSendFields is a list of field names (e.g. "Columns") to
  210. // unconditionally include in API requests. By default, fields with
  211. // empty values are omitted from API requests. However, any non-pointer,
  212. // non-interface field appearing in ForceSendFields will be sent to the
  213. // server regardless of whether the field is empty or not. This may be
  214. // used to include empty fields in Patch requests.
  215. ForceSendFields []string `json:"-"`
  216. // NullFields is a list of field names (e.g. "Columns") to include in
  217. // API requests with the JSON null value. By default, fields with empty
  218. // values are omitted from API requests. However, any field with an
  219. // empty value appearing in NullFields will be sent to the server as
  220. // null. It is an error if a field in this list has a non-empty value.
  221. // This may be used to include null fields in Patch requests.
  222. NullFields []string `json:"-"`
  223. }
  224. func (s *BigtableColumnFamily) MarshalJSON() ([]byte, error) {
  225. type NoMethod BigtableColumnFamily
  226. raw := NoMethod(*s)
  227. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  228. }
  229. type BigtableOptions struct {
  230. // ColumnFamilies: [Optional] List of column families to expose in the
  231. // table schema along with their types. This list restricts the column
  232. // families that can be referenced in queries and specifies their value
  233. // types. You can use this list to do type conversions - see the 'type'
  234. // field for more details. If you leave this list empty, all column
  235. // families are present in the table schema and their values are read as
  236. // BYTES. During a query only the column families referenced in that
  237. // query are read from Bigtable.
  238. ColumnFamilies []*BigtableColumnFamily `json:"columnFamilies,omitempty"`
  239. // IgnoreUnspecifiedColumnFamilies: [Optional] If field is true, then
  240. // the column families that are not specified in columnFamilies list are
  241. // not exposed in the table schema. Otherwise, they are read with BYTES
  242. // type values. The default value is false.
  243. IgnoreUnspecifiedColumnFamilies bool `json:"ignoreUnspecifiedColumnFamilies,omitempty"`
  244. // ReadRowkeyAsString: [Optional] If field is true, then the rowkey
  245. // column families will be read and converted to string. Otherwise they
  246. // are read with BYTES type values and users need to manually cast them
  247. // with CAST if necessary. The default value is false.
  248. ReadRowkeyAsString bool `json:"readRowkeyAsString,omitempty"`
  249. // ForceSendFields is a list of field names (e.g. "ColumnFamilies") to
  250. // unconditionally include in API requests. By default, fields with
  251. // empty values are omitted from API requests. However, any non-pointer,
  252. // non-interface field appearing in ForceSendFields will be sent to the
  253. // server regardless of whether the field is empty or not. This may be
  254. // used to include empty fields in Patch requests.
  255. ForceSendFields []string `json:"-"`
  256. // NullFields is a list of field names (e.g. "ColumnFamilies") to
  257. // include in API requests with the JSON null value. By default, fields
  258. // with empty values are omitted from API requests. However, any field
  259. // with an empty value appearing in NullFields will be sent to the
  260. // server as null. It is an error if a field in this list has a
  261. // non-empty value. This may be used to include null fields in Patch
  262. // requests.
  263. NullFields []string `json:"-"`
  264. }
  265. func (s *BigtableOptions) MarshalJSON() ([]byte, error) {
  266. type NoMethod BigtableOptions
  267. raw := NoMethod(*s)
  268. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  269. }
  270. type Clustering struct {
  271. // Fields: [Repeated] One or more fields on which data should be
  272. // clustered. Only top-level, non-repeated, simple-type fields are
  273. // supported. The order of the fields will determine how clusters will
  274. // be generated, so it is important.
  275. Fields []string `json:"fields,omitempty"`
  276. // ForceSendFields is a list of field names (e.g. "Fields") to
  277. // unconditionally include in API requests. By default, fields with
  278. // empty values are omitted from API requests. However, any non-pointer,
  279. // non-interface field appearing in ForceSendFields will be sent to the
  280. // server regardless of whether the field is empty or not. This may be
  281. // used to include empty fields in Patch requests.
  282. ForceSendFields []string `json:"-"`
  283. // NullFields is a list of field names (e.g. "Fields") to include in API
  284. // requests with the JSON null value. By default, fields with empty
  285. // values are omitted from API requests. However, any field with an
  286. // empty value appearing in NullFields will be sent to the server as
  287. // null. It is an error if a field in this list has a non-empty value.
  288. // This may be used to include null fields in Patch requests.
  289. NullFields []string `json:"-"`
  290. }
  291. func (s *Clustering) MarshalJSON() ([]byte, error) {
  292. type NoMethod Clustering
  293. raw := NoMethod(*s)
  294. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  295. }
  296. type CsvOptions struct {
  297. // AllowJaggedRows: [Optional] Indicates if BigQuery should accept rows
  298. // that are missing trailing optional columns. If true, BigQuery treats
  299. // missing trailing columns as null values. If false, records with
  300. // missing trailing columns are treated as bad records, and if there are
  301. // too many bad records, an invalid error is returned in the job result.
  302. // The default value is false.
  303. AllowJaggedRows bool `json:"allowJaggedRows,omitempty"`
  304. // AllowQuotedNewlines: [Optional] Indicates if BigQuery should allow
  305. // quoted data sections that contain newline characters in a CSV file.
  306. // The default value is false.
  307. AllowQuotedNewlines bool `json:"allowQuotedNewlines,omitempty"`
  308. // Encoding: [Optional] The character encoding of the data. The
  309. // supported values are UTF-8 or ISO-8859-1. The default value is UTF-8.
  310. // BigQuery decodes the data after the raw, binary data has been split
  311. // using the values of the quote and fieldDelimiter properties.
  312. Encoding string `json:"encoding,omitempty"`
  313. // FieldDelimiter: [Optional] The separator for fields in a CSV file.
  314. // BigQuery converts the string to ISO-8859-1 encoding, and then uses
  315. // the first byte of the encoded string to split the data in its raw,
  316. // binary state. BigQuery also supports the escape sequence "\t" to
  317. // specify a tab separator. The default value is a comma (',').
  318. FieldDelimiter string `json:"fieldDelimiter,omitempty"`
  319. // Quote: [Optional] The value that is used to quote data sections in a
  320. // CSV file. BigQuery converts the string to ISO-8859-1 encoding, and
  321. // then uses the first byte of the encoded string to split the data in
  322. // its raw, binary state. The default value is a double-quote ('"'). If
  323. // your data does not contain quoted sections, set the property value to
  324. // an empty string. If your data contains quoted newline characters, you
  325. // must also set the allowQuotedNewlines property to true.
  326. //
  327. // Default: "
  328. Quote *string `json:"quote,omitempty"`
  329. // SkipLeadingRows: [Optional] The number of rows at the top of a CSV
  330. // file that BigQuery will skip when reading the data. The default value
  331. // is 0. This property is useful if you have header rows in the file
  332. // that should be skipped.
  333. SkipLeadingRows int64 `json:"skipLeadingRows,omitempty,string"`
  334. // ForceSendFields is a list of field names (e.g. "AllowJaggedRows") to
  335. // unconditionally include in API requests. By default, fields with
  336. // empty values are omitted from API requests. However, any non-pointer,
  337. // non-interface field appearing in ForceSendFields will be sent to the
  338. // server regardless of whether the field is empty or not. This may be
  339. // used to include empty fields in Patch requests.
  340. ForceSendFields []string `json:"-"`
  341. // NullFields is a list of field names (e.g. "AllowJaggedRows") to
  342. // include in API requests with the JSON null value. By default, fields
  343. // with empty values are omitted from API requests. However, any field
  344. // with an empty value appearing in NullFields will be sent to the
  345. // server as null. It is an error if a field in this list has a
  346. // non-empty value. This may be used to include null fields in Patch
  347. // requests.
  348. NullFields []string `json:"-"`
  349. }
  350. func (s *CsvOptions) MarshalJSON() ([]byte, error) {
  351. type NoMethod CsvOptions
  352. raw := NoMethod(*s)
  353. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  354. }
  355. type Dataset struct {
  356. // Access: [Optional] An array of objects that define dataset access for
  357. // one or more entities. You can set this property when inserting or
  358. // updating a dataset in order to control who is allowed to access the
  359. // data. If unspecified at dataset creation time, BigQuery adds default
  360. // dataset access for the following entities: access.specialGroup:
  361. // projectReaders; access.role: READER; access.specialGroup:
  362. // projectWriters; access.role: WRITER; access.specialGroup:
  363. // projectOwners; access.role: OWNER; access.userByEmail: [dataset
  364. // creator email]; access.role: OWNER;
  365. Access []*DatasetAccess `json:"access,omitempty"`
  366. // CreationTime: [Output-only] The time when this dataset was created,
  367. // in milliseconds since the epoch.
  368. CreationTime int64 `json:"creationTime,omitempty,string"`
  369. // DatasetReference: [Required] A reference that identifies the dataset.
  370. DatasetReference *DatasetReference `json:"datasetReference,omitempty"`
  371. // DefaultTableExpirationMs: [Optional] The default lifetime of all
  372. // tables in the dataset, in milliseconds. The minimum value is 3600000
  373. // milliseconds (one hour). Once this property is set, all newly-created
  374. // tables in the dataset will have an expirationTime property set to the
  375. // creation time plus the value in this property, and changing the value
  376. // will only affect new tables, not existing ones. When the
  377. // expirationTime for a given table is reached, that table will be
  378. // deleted automatically. If a table's expirationTime is modified or
  379. // removed before the table expires, or if you provide an explicit
  380. // expirationTime when creating a table, that value takes precedence
  381. // over the default expiration time indicated by this property.
  382. DefaultTableExpirationMs int64 `json:"defaultTableExpirationMs,omitempty,string"`
  383. // Description: [Optional] A user-friendly description of the dataset.
  384. Description string `json:"description,omitempty"`
  385. // Etag: [Output-only] A hash of the resource.
  386. Etag string `json:"etag,omitempty"`
  387. // FriendlyName: [Optional] A descriptive name for the dataset.
  388. FriendlyName string `json:"friendlyName,omitempty"`
  389. // Id: [Output-only] The fully-qualified unique name of the dataset in
  390. // the format projectId:datasetId. The dataset name without the project
  391. // name is given in the datasetId field. When creating a new dataset,
  392. // leave this field blank, and instead specify the datasetId field.
  393. Id string `json:"id,omitempty"`
  394. // Kind: [Output-only] The resource type.
  395. Kind string `json:"kind,omitempty"`
  396. // Labels: The labels associated with this dataset. You can use these to
  397. // organize and group your datasets. You can set this property when
  398. // inserting or updating a dataset. See Labeling Datasets for more
  399. // information.
  400. Labels map[string]string `json:"labels,omitempty"`
  401. // LastModifiedTime: [Output-only] The date when this dataset or any of
  402. // its tables was last modified, in milliseconds since the epoch.
  403. LastModifiedTime int64 `json:"lastModifiedTime,omitempty,string"`
  404. // Location: The geographic location where the dataset should reside.
  405. // The default value is US. See details at
  406. // https://cloud.google.com/bigquery/docs/dataset-locations.
  407. Location string `json:"location,omitempty"`
  408. // SelfLink: [Output-only] A URL that can be used to access the resource
  409. // again. You can use this URL in Get or Update requests to the
  410. // resource.
  411. SelfLink string `json:"selfLink,omitempty"`
  412. // ServerResponse contains the HTTP response code and headers from the
  413. // server.
  414. googleapi.ServerResponse `json:"-"`
  415. // ForceSendFields is a list of field names (e.g. "Access") to
  416. // unconditionally include in API requests. By default, fields with
  417. // empty values are omitted from API requests. However, any non-pointer,
  418. // non-interface field appearing in ForceSendFields will be sent to the
  419. // server regardless of whether the field is empty or not. This may be
  420. // used to include empty fields in Patch requests.
  421. ForceSendFields []string `json:"-"`
  422. // NullFields is a list of field names (e.g. "Access") to include in API
  423. // requests with the JSON null value. By default, fields with empty
  424. // values are omitted from API requests. However, any field with an
  425. // empty value appearing in NullFields will be sent to the server as
  426. // null. It is an error if a field in this list has a non-empty value.
  427. // This may be used to include null fields in Patch requests.
  428. NullFields []string `json:"-"`
  429. }
  430. func (s *Dataset) MarshalJSON() ([]byte, error) {
  431. type NoMethod Dataset
  432. raw := NoMethod(*s)
  433. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  434. }
  435. type DatasetAccess struct {
  436. // Domain: [Pick one] A domain to grant access to. Any users signed in
  437. // with the domain specified will be granted the specified access.
  438. // Example: "example.com".
  439. Domain string `json:"domain,omitempty"`
  440. // GroupByEmail: [Pick one] An email address of a Google Group to grant
  441. // access to.
  442. GroupByEmail string `json:"groupByEmail,omitempty"`
  443. // Role: [Required] Describes the rights granted to the user specified
  444. // by the other member of the access object. The following string values
  445. // are supported: READER, WRITER, OWNER.
  446. Role string `json:"role,omitempty"`
  447. // SpecialGroup: [Pick one] A special group to grant access to. Possible
  448. // values include: projectOwners: Owners of the enclosing project.
  449. // projectReaders: Readers of the enclosing project. projectWriters:
  450. // Writers of the enclosing project. allAuthenticatedUsers: All
  451. // authenticated BigQuery users.
  452. SpecialGroup string `json:"specialGroup,omitempty"`
  453. // UserByEmail: [Pick one] An email address of a user to grant access
  454. // to. For example: fred@example.com.
  455. UserByEmail string `json:"userByEmail,omitempty"`
  456. // View: [Pick one] A view from a different dataset to grant access to.
  457. // Queries executed against that view will have read access to tables in
  458. // this dataset. The role field is not required when this field is set.
  459. // If that view is updated by any user, access to the view needs to be
  460. // granted again via an update operation.
  461. View *TableReference `json:"view,omitempty"`
  462. // ForceSendFields is a list of field names (e.g. "Domain") to
  463. // unconditionally include in API requests. By default, fields with
  464. // empty values are omitted from API requests. However, any non-pointer,
  465. // non-interface field appearing in ForceSendFields will be sent to the
  466. // server regardless of whether the field is empty or not. This may be
  467. // used to include empty fields in Patch requests.
  468. ForceSendFields []string `json:"-"`
  469. // NullFields is a list of field names (e.g. "Domain") to include in API
  470. // requests with the JSON null value. By default, fields with empty
  471. // values are omitted from API requests. However, any field with an
  472. // empty value appearing in NullFields will be sent to the server as
  473. // null. It is an error if a field in this list has a non-empty value.
  474. // This may be used to include null fields in Patch requests.
  475. NullFields []string `json:"-"`
  476. }
  477. func (s *DatasetAccess) MarshalJSON() ([]byte, error) {
  478. type NoMethod DatasetAccess
  479. raw := NoMethod(*s)
  480. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  481. }
  482. type DatasetList struct {
  483. // Datasets: An array of the dataset resources in the project. Each
  484. // resource contains basic information. For full information about a
  485. // particular dataset resource, use the Datasets: get method. This
  486. // property is omitted when there are no datasets in the project.
  487. Datasets []*DatasetListDatasets `json:"datasets,omitempty"`
  488. // Etag: A hash value of the results page. You can use this property to
  489. // determine if the page has changed since the last request.
  490. Etag string `json:"etag,omitempty"`
  491. // Kind: The list type. This property always returns the value
  492. // "bigquery#datasetList".
  493. Kind string `json:"kind,omitempty"`
  494. // NextPageToken: A token that can be used to request the next results
  495. // page. This property is omitted on the final results page.
  496. NextPageToken string `json:"nextPageToken,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. "Datasets") 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. "Datasets") to include in
  508. // API requests with the JSON null value. By default, fields with empty
  509. // values are omitted from API requests. However, any field with an
  510. // 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 *DatasetList) MarshalJSON() ([]byte, error) {
  516. type NoMethod DatasetList
  517. raw := NoMethod(*s)
  518. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  519. }
  520. type DatasetListDatasets struct {
  521. // DatasetReference: The dataset reference. Use this property to access
  522. // specific parts of the dataset's ID, such as project ID or dataset ID.
  523. DatasetReference *DatasetReference `json:"datasetReference,omitempty"`
  524. // FriendlyName: A descriptive name for the dataset, if one exists.
  525. FriendlyName string `json:"friendlyName,omitempty"`
  526. // Id: The fully-qualified, unique, opaque ID of the dataset.
  527. Id string `json:"id,omitempty"`
  528. // Kind: The resource type. This property always returns the value
  529. // "bigquery#dataset".
  530. Kind string `json:"kind,omitempty"`
  531. // Labels: The labels associated with this dataset. You can use these to
  532. // organize and group your datasets.
  533. Labels map[string]string `json:"labels,omitempty"`
  534. // Location: [Experimental] The geographic location where the data
  535. // resides.
  536. Location string `json:"location,omitempty"`
  537. // ForceSendFields is a list of field names (e.g. "DatasetReference") to
  538. // unconditionally include in API requests. By default, fields with
  539. // empty values are omitted from API requests. However, any non-pointer,
  540. // non-interface field appearing in ForceSendFields will be sent to the
  541. // server regardless of whether the field is empty or not. This may be
  542. // used to include empty fields in Patch requests.
  543. ForceSendFields []string `json:"-"`
  544. // NullFields is a list of field names (e.g. "DatasetReference") to
  545. // include in API requests with the JSON null value. By default, fields
  546. // with empty values are omitted from API requests. However, any field
  547. // with an empty value appearing in NullFields will be sent to the
  548. // server as null. It is an error if a field in this list has a
  549. // non-empty value. This may be used to include null fields in Patch
  550. // requests.
  551. NullFields []string `json:"-"`
  552. }
  553. func (s *DatasetListDatasets) MarshalJSON() ([]byte, error) {
  554. type NoMethod DatasetListDatasets
  555. raw := NoMethod(*s)
  556. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  557. }
  558. type DatasetReference struct {
  559. // DatasetId: [Required] A unique ID for this dataset, without the
  560. // project name. The ID must contain only letters (a-z, A-Z), numbers
  561. // (0-9), or underscores (_). The maximum length is 1,024 characters.
  562. DatasetId string `json:"datasetId,omitempty"`
  563. // ProjectId: [Optional] The ID of the project containing this dataset.
  564. ProjectId string `json:"projectId,omitempty"`
  565. // ForceSendFields is a list of field names (e.g. "DatasetId") 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. "DatasetId") to include in
  573. // API requests with the JSON null value. By default, fields with empty
  574. // values are omitted from API requests. However, any field with an
  575. // 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 *DatasetReference) MarshalJSON() ([]byte, error) {
  581. type NoMethod DatasetReference
  582. raw := NoMethod(*s)
  583. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  584. }
  585. type DestinationTableProperties struct {
  586. // Description: [Optional] The description for the destination table.
  587. // This will only be used if the destination table is newly created. If
  588. // the table already exists and a value different than the current
  589. // description is provided, the job will fail.
  590. Description string `json:"description,omitempty"`
  591. // FriendlyName: [Optional] The friendly name for the destination table.
  592. // This will only be used if the destination table is newly created. If
  593. // the table already exists and a value different than the current
  594. // friendly name is provided, the job will fail.
  595. FriendlyName string `json:"friendlyName,omitempty"`
  596. // ForceSendFields is a list of field names (e.g. "Description") to
  597. // unconditionally include in API requests. By default, fields with
  598. // empty values are omitted from API requests. However, any non-pointer,
  599. // non-interface field appearing in ForceSendFields will be sent to the
  600. // server regardless of whether the field is empty or not. This may be
  601. // used to include empty fields in Patch requests.
  602. ForceSendFields []string `json:"-"`
  603. // NullFields is a list of field names (e.g. "Description") to include
  604. // in API requests with the JSON null value. By default, fields with
  605. // empty values are omitted from API requests. However, any field with
  606. // an empty value appearing in NullFields will be sent to the server as
  607. // null. It is an error if a field in this list has a non-empty value.
  608. // This may be used to include null fields in Patch requests.
  609. NullFields []string `json:"-"`
  610. }
  611. func (s *DestinationTableProperties) MarshalJSON() ([]byte, error) {
  612. type NoMethod DestinationTableProperties
  613. raw := NoMethod(*s)
  614. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  615. }
  616. type EncryptionConfiguration struct {
  617. // KmsKeyName: [Optional] Describes the Cloud KMS encryption key that
  618. // will be used to protect destination BigQuery table. The BigQuery
  619. // Service Account associated with your project requires access to this
  620. // encryption key.
  621. KmsKeyName string `json:"kmsKeyName,omitempty"`
  622. // ForceSendFields is a list of field names (e.g. "KmsKeyName") to
  623. // unconditionally include in API requests. By default, fields with
  624. // empty values are omitted from API requests. However, any non-pointer,
  625. // non-interface field appearing in ForceSendFields will be sent to the
  626. // server regardless of whether the field is empty or not. This may be
  627. // used to include empty fields in Patch requests.
  628. ForceSendFields []string `json:"-"`
  629. // NullFields is a list of field names (e.g. "KmsKeyName") to include in
  630. // API requests with the JSON null value. By default, fields with empty
  631. // values are omitted from API requests. However, any field with an
  632. // empty value appearing in NullFields will be sent to the server as
  633. // null. It is an error if a field in this list has a non-empty value.
  634. // This may be used to include null fields in Patch requests.
  635. NullFields []string `json:"-"`
  636. }
  637. func (s *EncryptionConfiguration) MarshalJSON() ([]byte, error) {
  638. type NoMethod EncryptionConfiguration
  639. raw := NoMethod(*s)
  640. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  641. }
  642. type ErrorProto struct {
  643. // DebugInfo: Debugging information. This property is internal to Google
  644. // and should not be used.
  645. DebugInfo string `json:"debugInfo,omitempty"`
  646. // Location: Specifies where the error occurred, if present.
  647. Location string `json:"location,omitempty"`
  648. // Message: A human-readable description of the error.
  649. Message string `json:"message,omitempty"`
  650. // Reason: A short error code that summarizes the error.
  651. Reason string `json:"reason,omitempty"`
  652. // ForceSendFields is a list of field names (e.g. "DebugInfo") to
  653. // unconditionally include in API requests. By default, fields with
  654. // empty values are omitted from API requests. However, any non-pointer,
  655. // non-interface field appearing in ForceSendFields will be sent to the
  656. // server regardless of whether the field is empty or not. This may be
  657. // used to include empty fields in Patch requests.
  658. ForceSendFields []string `json:"-"`
  659. // NullFields is a list of field names (e.g. "DebugInfo") to include in
  660. // API requests with the JSON null value. By default, fields with empty
  661. // values are omitted from API requests. However, any field with an
  662. // empty value appearing in NullFields will be sent to the server as
  663. // null. It is an error if a field in this list has a non-empty value.
  664. // This may be used to include null fields in Patch requests.
  665. NullFields []string `json:"-"`
  666. }
  667. func (s *ErrorProto) MarshalJSON() ([]byte, error) {
  668. type NoMethod ErrorProto
  669. raw := NoMethod(*s)
  670. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  671. }
  672. type ExplainQueryStage struct {
  673. // CompletedParallelInputs: Number of parallel input segments completed.
  674. CompletedParallelInputs int64 `json:"completedParallelInputs,omitempty,string"`
  675. // ComputeMsAvg: Milliseconds the average shard spent on CPU-bound
  676. // tasks.
  677. ComputeMsAvg int64 `json:"computeMsAvg,omitempty,string"`
  678. // ComputeMsMax: Milliseconds the slowest shard spent on CPU-bound
  679. // tasks.
  680. ComputeMsMax int64 `json:"computeMsMax,omitempty,string"`
  681. // ComputeRatioAvg: Relative amount of time the average shard spent on
  682. // CPU-bound tasks.
  683. ComputeRatioAvg float64 `json:"computeRatioAvg,omitempty"`
  684. // ComputeRatioMax: Relative amount of time the slowest shard spent on
  685. // CPU-bound tasks.
  686. ComputeRatioMax float64 `json:"computeRatioMax,omitempty"`
  687. // EndMs: Stage end time represented as milliseconds since epoch.
  688. EndMs int64 `json:"endMs,omitempty,string"`
  689. // Id: Unique ID for stage within plan.
  690. Id int64 `json:"id,omitempty,string"`
  691. // InputStages: IDs for stages that are inputs to this stage.
  692. InputStages googleapi.Int64s `json:"inputStages,omitempty"`
  693. // Name: Human-readable name for stage.
  694. Name string `json:"name,omitempty"`
  695. // ParallelInputs: Number of parallel input segments to be processed.
  696. ParallelInputs int64 `json:"parallelInputs,omitempty,string"`
  697. // ReadMsAvg: Milliseconds the average shard spent reading input.
  698. ReadMsAvg int64 `json:"readMsAvg,omitempty,string"`
  699. // ReadMsMax: Milliseconds the slowest shard spent reading input.
  700. ReadMsMax int64 `json:"readMsMax,omitempty,string"`
  701. // ReadRatioAvg: Relative amount of time the average shard spent reading
  702. // input.
  703. ReadRatioAvg float64 `json:"readRatioAvg,omitempty"`
  704. // ReadRatioMax: Relative amount of time the slowest shard spent reading
  705. // input.
  706. ReadRatioMax float64 `json:"readRatioMax,omitempty"`
  707. // RecordsRead: Number of records read into the stage.
  708. RecordsRead int64 `json:"recordsRead,omitempty,string"`
  709. // RecordsWritten: Number of records written by the stage.
  710. RecordsWritten int64 `json:"recordsWritten,omitempty,string"`
  711. // ShuffleOutputBytes: Total number of bytes written to shuffle.
  712. ShuffleOutputBytes int64 `json:"shuffleOutputBytes,omitempty,string"`
  713. // ShuffleOutputBytesSpilled: Total number of bytes written to shuffle
  714. // and spilled to disk.
  715. ShuffleOutputBytesSpilled int64 `json:"shuffleOutputBytesSpilled,omitempty,string"`
  716. // StartMs: Stage start time represented as milliseconds since epoch.
  717. StartMs int64 `json:"startMs,omitempty,string"`
  718. // Status: Current status for the stage.
  719. Status string `json:"status,omitempty"`
  720. // Steps: List of operations within the stage in dependency order
  721. // (approximately chronological).
  722. Steps []*ExplainQueryStep `json:"steps,omitempty"`
  723. // WaitMsAvg: Milliseconds the average shard spent waiting to be
  724. // scheduled.
  725. WaitMsAvg int64 `json:"waitMsAvg,omitempty,string"`
  726. // WaitMsMax: Milliseconds the slowest shard spent waiting to be
  727. // scheduled.
  728. WaitMsMax int64 `json:"waitMsMax,omitempty,string"`
  729. // WaitRatioAvg: Relative amount of time the average shard spent waiting
  730. // to be scheduled.
  731. WaitRatioAvg float64 `json:"waitRatioAvg,omitempty"`
  732. // WaitRatioMax: Relative amount of time the slowest shard spent waiting
  733. // to be scheduled.
  734. WaitRatioMax float64 `json:"waitRatioMax,omitempty"`
  735. // WriteMsAvg: Milliseconds the average shard spent on writing output.
  736. WriteMsAvg int64 `json:"writeMsAvg,omitempty,string"`
  737. // WriteMsMax: Milliseconds the slowest shard spent on writing output.
  738. WriteMsMax int64 `json:"writeMsMax,omitempty,string"`
  739. // WriteRatioAvg: Relative amount of time the average shard spent on
  740. // writing output.
  741. WriteRatioAvg float64 `json:"writeRatioAvg,omitempty"`
  742. // WriteRatioMax: Relative amount of time the slowest shard spent on
  743. // writing output.
  744. WriteRatioMax float64 `json:"writeRatioMax,omitempty"`
  745. // ForceSendFields is a list of field names (e.g.
  746. // "CompletedParallelInputs") to unconditionally include in API
  747. // requests. By default, fields with empty values are omitted from API
  748. // requests. However, any non-pointer, non-interface field appearing in
  749. // ForceSendFields will be sent to the server regardless of whether the
  750. // field is empty or not. This may be used to include empty fields in
  751. // Patch requests.
  752. ForceSendFields []string `json:"-"`
  753. // NullFields is a list of field names (e.g. "CompletedParallelInputs")
  754. // to include in API requests with the JSON null value. By default,
  755. // fields with empty values are omitted from API requests. However, any
  756. // field with an empty value appearing in NullFields will be sent to the
  757. // server as null. It is an error if a field in this list has a
  758. // non-empty value. This may be used to include null fields in Patch
  759. // requests.
  760. NullFields []string `json:"-"`
  761. }
  762. func (s *ExplainQueryStage) MarshalJSON() ([]byte, error) {
  763. type NoMethod ExplainQueryStage
  764. raw := NoMethod(*s)
  765. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  766. }
  767. func (s *ExplainQueryStage) UnmarshalJSON(data []byte) error {
  768. type NoMethod ExplainQueryStage
  769. var s1 struct {
  770. ComputeRatioAvg gensupport.JSONFloat64 `json:"computeRatioAvg"`
  771. ComputeRatioMax gensupport.JSONFloat64 `json:"computeRatioMax"`
  772. ReadRatioAvg gensupport.JSONFloat64 `json:"readRatioAvg"`
  773. ReadRatioMax gensupport.JSONFloat64 `json:"readRatioMax"`
  774. WaitRatioAvg gensupport.JSONFloat64 `json:"waitRatioAvg"`
  775. WaitRatioMax gensupport.JSONFloat64 `json:"waitRatioMax"`
  776. WriteRatioAvg gensupport.JSONFloat64 `json:"writeRatioAvg"`
  777. WriteRatioMax gensupport.JSONFloat64 `json:"writeRatioMax"`
  778. *NoMethod
  779. }
  780. s1.NoMethod = (*NoMethod)(s)
  781. if err := json.Unmarshal(data, &s1); err != nil {
  782. return err
  783. }
  784. s.ComputeRatioAvg = float64(s1.ComputeRatioAvg)
  785. s.ComputeRatioMax = float64(s1.ComputeRatioMax)
  786. s.ReadRatioAvg = float64(s1.ReadRatioAvg)
  787. s.ReadRatioMax = float64(s1.ReadRatioMax)
  788. s.WaitRatioAvg = float64(s1.WaitRatioAvg)
  789. s.WaitRatioMax = float64(s1.WaitRatioMax)
  790. s.WriteRatioAvg = float64(s1.WriteRatioAvg)
  791. s.WriteRatioMax = float64(s1.WriteRatioMax)
  792. return nil
  793. }
  794. type ExplainQueryStep struct {
  795. // Kind: Machine-readable operation type.
  796. Kind string `json:"kind,omitempty"`
  797. // Substeps: Human-readable stage descriptions.
  798. Substeps []string `json:"substeps,omitempty"`
  799. // ForceSendFields is a list of field names (e.g. "Kind") to
  800. // unconditionally include in API requests. By default, fields with
  801. // empty values are omitted from API requests. However, any non-pointer,
  802. // non-interface field appearing in ForceSendFields will be sent to the
  803. // server regardless of whether the field is empty or not. This may be
  804. // used to include empty fields in Patch requests.
  805. ForceSendFields []string `json:"-"`
  806. // NullFields is a list of field names (e.g. "Kind") to include in API
  807. // requests with the JSON null value. By default, fields with empty
  808. // values are omitted from API requests. However, any field with an
  809. // empty value appearing in NullFields will be sent to the server as
  810. // null. It is an error if a field in this list has a non-empty value.
  811. // This may be used to include null fields in Patch requests.
  812. NullFields []string `json:"-"`
  813. }
  814. func (s *ExplainQueryStep) MarshalJSON() ([]byte, error) {
  815. type NoMethod ExplainQueryStep
  816. raw := NoMethod(*s)
  817. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  818. }
  819. type ExternalDataConfiguration struct {
  820. // Autodetect: Try to detect schema and format options automatically.
  821. // Any option specified explicitly will be honored.
  822. Autodetect bool `json:"autodetect,omitempty"`
  823. // BigtableOptions: [Optional] Additional options if sourceFormat is set
  824. // to BIGTABLE.
  825. BigtableOptions *BigtableOptions `json:"bigtableOptions,omitempty"`
  826. // Compression: [Optional] The compression type of the data source.
  827. // Possible values include GZIP and NONE. The default value is NONE.
  828. // This setting is ignored for Google Cloud Bigtable, Google Cloud
  829. // Datastore backups and Avro formats.
  830. Compression string `json:"compression,omitempty"`
  831. // CsvOptions: Additional properties to set if sourceFormat is set to
  832. // CSV.
  833. CsvOptions *CsvOptions `json:"csvOptions,omitempty"`
  834. // GoogleSheetsOptions: [Optional] Additional options if sourceFormat is
  835. // set to GOOGLE_SHEETS.
  836. GoogleSheetsOptions *GoogleSheetsOptions `json:"googleSheetsOptions,omitempty"`
  837. // IgnoreUnknownValues: [Optional] Indicates if BigQuery should allow
  838. // extra values that are not represented in the table schema. If true,
  839. // the extra values are ignored. If false, records with extra columns
  840. // are treated as bad records, and if there are too many bad records, an
  841. // invalid error is returned in the job result. The default value is
  842. // false. The sourceFormat property determines what BigQuery treats as
  843. // an extra value: CSV: Trailing columns JSON: Named values that don't
  844. // match any column names Google Cloud Bigtable: This setting is
  845. // ignored. Google Cloud Datastore backups: This setting is ignored.
  846. // Avro: This setting is ignored.
  847. IgnoreUnknownValues bool `json:"ignoreUnknownValues,omitempty"`
  848. // MaxBadRecords: [Optional] The maximum number of bad records that
  849. // BigQuery can ignore when reading data. If the number of bad records
  850. // exceeds this value, an invalid error is returned in the job result.
  851. // The default value is 0, which requires that all records are valid.
  852. // This setting is ignored for Google Cloud Bigtable, Google Cloud
  853. // Datastore backups and Avro formats.
  854. MaxBadRecords int64 `json:"maxBadRecords,omitempty"`
  855. // Schema: [Optional] The schema for the data. Schema is required for
  856. // CSV and JSON formats. Schema is disallowed for Google Cloud Bigtable,
  857. // Cloud Datastore backups, and Avro formats.
  858. Schema *TableSchema `json:"schema,omitempty"`
  859. // SourceFormat: [Required] The data format. For CSV files, specify
  860. // "CSV". For Google sheets, specify "GOOGLE_SHEETS". For
  861. // newline-delimited JSON, specify "NEWLINE_DELIMITED_JSON". For Avro
  862. // files, specify "AVRO". For Google Cloud Datastore backups, specify
  863. // "DATASTORE_BACKUP". [Beta] For Google Cloud Bigtable, specify
  864. // "BIGTABLE".
  865. SourceFormat string `json:"sourceFormat,omitempty"`
  866. // SourceUris: [Required] The fully-qualified URIs that point to your
  867. // data in Google Cloud. For Google Cloud Storage URIs: Each URI can
  868. // contain one '*' wildcard character and it must come after the
  869. // 'bucket' name. Size limits related to load jobs apply to external
  870. // data sources. For Google Cloud Bigtable URIs: Exactly one URI can be
  871. // specified and it has be a fully specified and valid HTTPS URL for a
  872. // Google Cloud Bigtable table. For Google Cloud Datastore backups,
  873. // exactly one URI can be specified. Also, the '*' wildcard character is
  874. // not allowed.
  875. SourceUris []string `json:"sourceUris,omitempty"`
  876. // ForceSendFields is a list of field names (e.g. "Autodetect") to
  877. // unconditionally include in API requests. By default, fields with
  878. // empty values are omitted from API requests. However, any non-pointer,
  879. // non-interface field appearing in ForceSendFields will be sent to the
  880. // server regardless of whether the field is empty or not. This may be
  881. // used to include empty fields in Patch requests.
  882. ForceSendFields []string `json:"-"`
  883. // NullFields is a list of field names (e.g. "Autodetect") to include in
  884. // API requests with the JSON null value. By default, fields with empty
  885. // values are omitted from API requests. However, any field with an
  886. // empty value appearing in NullFields will be sent to the server as
  887. // null. It is an error if a field in this list has a non-empty value.
  888. // This may be used to include null fields in Patch requests.
  889. NullFields []string `json:"-"`
  890. }
  891. func (s *ExternalDataConfiguration) MarshalJSON() ([]byte, error) {
  892. type NoMethod ExternalDataConfiguration
  893. raw := NoMethod(*s)
  894. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  895. }
  896. type GetQueryResultsResponse struct {
  897. // CacheHit: Whether the query result was fetched from the query cache.
  898. CacheHit bool `json:"cacheHit,omitempty"`
  899. // Errors: [Output-only] The first errors or warnings encountered during
  900. // the running of the job. The final message includes the number of
  901. // errors that caused the process to stop. Errors here do not
  902. // necessarily mean that the job has completed or was unsuccessful.
  903. Errors []*ErrorProto `json:"errors,omitempty"`
  904. // Etag: A hash of this response.
  905. Etag string `json:"etag,omitempty"`
  906. // JobComplete: Whether the query has completed or not. If rows or
  907. // totalRows are present, this will always be true. If this is false,
  908. // totalRows will not be available.
  909. JobComplete bool `json:"jobComplete,omitempty"`
  910. // JobReference: Reference to the BigQuery Job that was created to run
  911. // the query. This field will be present even if the original request
  912. // timed out, in which case GetQueryResults can be used to read the
  913. // results once the query has completed. Since this API only returns the
  914. // first page of results, subsequent pages can be fetched via the same
  915. // mechanism (GetQueryResults).
  916. JobReference *JobReference `json:"jobReference,omitempty"`
  917. // Kind: The resource type of the response.
  918. Kind string `json:"kind,omitempty"`
  919. // NumDmlAffectedRows: [Output-only] The number of rows affected by a
  920. // DML statement. Present only for DML statements INSERT, UPDATE or
  921. // DELETE.
  922. NumDmlAffectedRows int64 `json:"numDmlAffectedRows,omitempty,string"`
  923. // PageToken: A token used for paging results.
  924. PageToken string `json:"pageToken,omitempty"`
  925. // Rows: An object with as many results as can be contained within the
  926. // maximum permitted reply size. To get any additional rows, you can
  927. // call GetQueryResults and specify the jobReference returned above.
  928. // Present only when the query completes successfully.
  929. Rows []*TableRow `json:"rows,omitempty"`
  930. // Schema: The schema of the results. Present only when the query
  931. // completes successfully.
  932. Schema *TableSchema `json:"schema,omitempty"`
  933. // TotalBytesProcessed: The total number of bytes processed for this
  934. // query.
  935. TotalBytesProcessed int64 `json:"totalBytesProcessed,omitempty,string"`
  936. // TotalRows: The total number of rows in the complete query result set,
  937. // which can be more than the number of rows in this single page of
  938. // results. Present only when the query completes successfully.
  939. TotalRows uint64 `json:"totalRows,omitempty,string"`
  940. // ServerResponse contains the HTTP response code and headers from the
  941. // server.
  942. googleapi.ServerResponse `json:"-"`
  943. // ForceSendFields is a list of field names (e.g. "CacheHit") to
  944. // unconditionally include in API requests. By default, fields with
  945. // empty values are omitted from API requests. However, any non-pointer,
  946. // non-interface field appearing in ForceSendFields will be sent to the
  947. // server regardless of whether the field is empty or not. This may be
  948. // used to include empty fields in Patch requests.
  949. ForceSendFields []string `json:"-"`
  950. // NullFields is a list of field names (e.g. "CacheHit") to include in
  951. // API requests with the JSON null value. By default, fields with empty
  952. // values are omitted from API requests. However, any field with an
  953. // empty value appearing in NullFields will be sent to the server as
  954. // null. It is an error if a field in this list has a non-empty value.
  955. // This may be used to include null fields in Patch requests.
  956. NullFields []string `json:"-"`
  957. }
  958. func (s *GetQueryResultsResponse) MarshalJSON() ([]byte, error) {
  959. type NoMethod GetQueryResultsResponse
  960. raw := NoMethod(*s)
  961. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  962. }
  963. type GetServiceAccountResponse struct {
  964. // Email: The service account email address.
  965. Email string `json:"email,omitempty"`
  966. // Kind: The resource type of the response.
  967. Kind string `json:"kind,omitempty"`
  968. // ServerResponse contains the HTTP response code and headers from the
  969. // server.
  970. googleapi.ServerResponse `json:"-"`
  971. // ForceSendFields is a list of field names (e.g. "Email") to
  972. // unconditionally include in API requests. By default, fields with
  973. // empty values are omitted from API requests. However, any non-pointer,
  974. // non-interface field appearing in ForceSendFields will be sent to the
  975. // server regardless of whether the field is empty or not. This may be
  976. // used to include empty fields in Patch requests.
  977. ForceSendFields []string `json:"-"`
  978. // NullFields is a list of field names (e.g. "Email") to include in API
  979. // requests with the JSON null value. By default, fields with empty
  980. // values are omitted from API requests. However, any field with an
  981. // empty value appearing in NullFields will be sent to the server as
  982. // null. It is an error if a field in this list has a non-empty value.
  983. // This may be used to include null fields in Patch requests.
  984. NullFields []string `json:"-"`
  985. }
  986. func (s *GetServiceAccountResponse) MarshalJSON() ([]byte, error) {
  987. type NoMethod GetServiceAccountResponse
  988. raw := NoMethod(*s)
  989. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  990. }
  991. type GoogleSheetsOptions struct {
  992. // Range: [Experimental] [Optional] Range of a sheet to query from. Only
  993. // used when non-empty. Typical format: !:
  994. Range string `json:"range,omitempty"`
  995. // SkipLeadingRows: [Optional] The number of rows at the top of a sheet
  996. // that BigQuery will skip when reading the data. The default value is
  997. // 0. This property is useful if you have header rows that should be
  998. // skipped. When autodetect is on, behavior is the following: *
  999. // skipLeadingRows unspecified - Autodetect tries to detect headers in
  1000. // the first row. If they are not detected, the row is read as data.
  1001. // Otherwise data is read starting from the second row. *
  1002. // skipLeadingRows is 0 - Instructs autodetect that there are no headers
  1003. // and data should be read starting from the first row. *
  1004. // skipLeadingRows = N > 0 - Autodetect skips N-1 rows and tries to
  1005. // detect headers in row N. If headers are not detected, row N is just
  1006. // skipped. Otherwise row N is used to extract column names for the
  1007. // detected schema.
  1008. SkipLeadingRows int64 `json:"skipLeadingRows,omitempty,string"`
  1009. // ForceSendFields is a list of field names (e.g. "Range") to
  1010. // unconditionally include in API requests. By default, fields with
  1011. // empty values are omitted from API requests. However, any non-pointer,
  1012. // non-interface field appearing in ForceSendFields will be sent to the
  1013. // server regardless of whether the field is empty or not. This may be
  1014. // used to include empty fields in Patch requests.
  1015. ForceSendFields []string `json:"-"`
  1016. // NullFields is a list of field names (e.g. "Range") to include in API
  1017. // requests with the JSON null value. By default, fields with empty
  1018. // values are omitted from API requests. However, any field with an
  1019. // empty value appearing in NullFields will be sent to the server as
  1020. // null. It is an error if a field in this list has a non-empty value.
  1021. // This may be used to include null fields in Patch requests.
  1022. NullFields []string `json:"-"`
  1023. }
  1024. func (s *GoogleSheetsOptions) MarshalJSON() ([]byte, error) {
  1025. type NoMethod GoogleSheetsOptions
  1026. raw := NoMethod(*s)
  1027. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1028. }
  1029. type Job struct {
  1030. // Configuration: [Required] Describes the job configuration.
  1031. Configuration *JobConfiguration `json:"configuration,omitempty"`
  1032. // Etag: [Output-only] A hash of this resource.
  1033. Etag string `json:"etag,omitempty"`
  1034. // Id: [Output-only] Opaque ID field of the job
  1035. Id string `json:"id,omitempty"`
  1036. // JobReference: [Optional] Reference describing the unique-per-user
  1037. // name of the job.
  1038. JobReference *JobReference `json:"jobReference,omitempty"`
  1039. // Kind: [Output-only] The type of the resource.
  1040. Kind string `json:"kind,omitempty"`
  1041. // SelfLink: [Output-only] A URL that can be used to access this
  1042. // resource again.
  1043. SelfLink string `json:"selfLink,omitempty"`
  1044. // Statistics: [Output-only] Information about the job, including
  1045. // starting time and ending time of the job.
  1046. Statistics *JobStatistics `json:"statistics,omitempty"`
  1047. // Status: [Output-only] The status of this job. Examine this value when
  1048. // polling an asynchronous job to see if the job is complete.
  1049. Status *JobStatus `json:"status,omitempty"`
  1050. // UserEmail: [Output-only] Email address of the user who ran the job.
  1051. UserEmail string `json:"user_email,omitempty"`
  1052. // ServerResponse contains the HTTP response code and headers from the
  1053. // server.
  1054. googleapi.ServerResponse `json:"-"`
  1055. // ForceSendFields is a list of field names (e.g. "Configuration") to
  1056. // unconditionally include in API requests. By default, fields with
  1057. // empty values are omitted from API requests. However, any non-pointer,
  1058. // non-interface field appearing in ForceSendFields will be sent to the
  1059. // server regardless of whether the field is empty or not. This may be
  1060. // used to include empty fields in Patch requests.
  1061. ForceSendFields []string `json:"-"`
  1062. // NullFields is a list of field names (e.g. "Configuration") to include
  1063. // in API requests with the JSON null value. By default, fields with
  1064. // empty values are omitted from API requests. However, any field with
  1065. // an empty value appearing in NullFields will be sent to the server as
  1066. // null. It is an error if a field in this list has a non-empty value.
  1067. // This may be used to include null fields in Patch requests.
  1068. NullFields []string `json:"-"`
  1069. }
  1070. func (s *Job) MarshalJSON() ([]byte, error) {
  1071. type NoMethod Job
  1072. raw := NoMethod(*s)
  1073. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1074. }
  1075. type JobCancelResponse struct {
  1076. // Job: The final state of the job.
  1077. Job *Job `json:"job,omitempty"`
  1078. // Kind: The resource type of the response.
  1079. Kind string `json:"kind,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. "Job") 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. "Job") to include in API
  1091. // requests with the JSON null value. By default, fields with empty
  1092. // values are omitted from API requests. However, any field with an
  1093. // 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 *JobCancelResponse) MarshalJSON() ([]byte, error) {
  1099. type NoMethod JobCancelResponse
  1100. raw := NoMethod(*s)
  1101. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1102. }
  1103. type JobConfiguration struct {
  1104. // Copy: [Pick one] Copies a table.
  1105. Copy *JobConfigurationTableCopy `json:"copy,omitempty"`
  1106. // DryRun: [Optional] If set, don't actually run this job. A valid query
  1107. // will return a mostly empty response with some processing statistics,
  1108. // while an invalid query will return the same error it would if it
  1109. // wasn't a dry run. Behavior of non-query jobs is undefined.
  1110. DryRun bool `json:"dryRun,omitempty"`
  1111. // Extract: [Pick one] Configures an extract job.
  1112. Extract *JobConfigurationExtract `json:"extract,omitempty"`
  1113. // JobTimeoutMs: [Optional] Job timeout in milliseconds. If this time
  1114. // limit is exceeded, BigQuery may attempt to terminate the job.
  1115. JobTimeoutMs int64 `json:"jobTimeoutMs,omitempty,string"`
  1116. // Labels: The labels associated with this job. You can use these to
  1117. // organize and group your jobs. Label keys and values can be no longer
  1118. // than 63 characters, can only contain lowercase letters, numeric
  1119. // characters, underscores and dashes. International characters are
  1120. // allowed. Label values are optional. Label keys must start with a
  1121. // letter and each label in the list must have a different key.
  1122. Labels map[string]string `json:"labels,omitempty"`
  1123. // Load: [Pick one] Configures a load job.
  1124. Load *JobConfigurationLoad `json:"load,omitempty"`
  1125. // Query: [Pick one] Configures a query job.
  1126. Query *JobConfigurationQuery `json:"query,omitempty"`
  1127. // ForceSendFields is a list of field names (e.g. "Copy") to
  1128. // unconditionally include in API requests. By default, fields with
  1129. // empty values are omitted from API requests. However, any non-pointer,
  1130. // non-interface field appearing in ForceSendFields will be sent to the
  1131. // server regardless of whether the field is empty or not. This may be
  1132. // used to include empty fields in Patch requests.
  1133. ForceSendFields []string `json:"-"`
  1134. // NullFields is a list of field names (e.g. "Copy") to include in API
  1135. // requests with the JSON null value. By default, fields with empty
  1136. // values are omitted from API requests. However, any field with an
  1137. // empty value appearing in NullFields will be sent to the server as
  1138. // null. It is an error if a field in this list has a non-empty value.
  1139. // This may be used to include null fields in Patch requests.
  1140. NullFields []string `json:"-"`
  1141. }
  1142. func (s *JobConfiguration) MarshalJSON() ([]byte, error) {
  1143. type NoMethod JobConfiguration
  1144. raw := NoMethod(*s)
  1145. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1146. }
  1147. type JobConfigurationExtract struct {
  1148. // Compression: [Optional] The compression type to use for exported
  1149. // files. Possible values include GZIP, DEFLATE, SNAPPY, and NONE. The
  1150. // default value is NONE. DEFLATE and SNAPPY are only supported for
  1151. // Avro.
  1152. Compression string `json:"compression,omitempty"`
  1153. // DestinationFormat: [Optional] The exported file format. Possible
  1154. // values include CSV, NEWLINE_DELIMITED_JSON and AVRO. The default
  1155. // value is CSV. Tables with nested or repeated fields cannot be
  1156. // exported as CSV.
  1157. DestinationFormat string `json:"destinationFormat,omitempty"`
  1158. // DestinationUri: [Pick one] DEPRECATED: Use destinationUris instead,
  1159. // passing only one URI as necessary. The fully-qualified Google Cloud
  1160. // Storage URI where the extracted table should be written.
  1161. DestinationUri string `json:"destinationUri,omitempty"`
  1162. // DestinationUris: [Pick one] A list of fully-qualified Google Cloud
  1163. // Storage URIs where the extracted table should be written.
  1164. DestinationUris []string `json:"destinationUris,omitempty"`
  1165. // FieldDelimiter: [Optional] Delimiter to use between fields in the
  1166. // exported data. Default is ','
  1167. FieldDelimiter string `json:"fieldDelimiter,omitempty"`
  1168. // PrintHeader: [Optional] Whether to print out a header row in the
  1169. // results. Default is true.
  1170. //
  1171. // Default: true
  1172. PrintHeader *bool `json:"printHeader,omitempty"`
  1173. // SourceTable: [Required] A reference to the table being exported.
  1174. SourceTable *TableReference `json:"sourceTable,omitempty"`
  1175. // ForceSendFields is a list of field names (e.g. "Compression") to
  1176. // unconditionally include in API requests. By default, fields with
  1177. // empty values are omitted from API requests. However, any non-pointer,
  1178. // non-interface field appearing in ForceSendFields will be sent to the
  1179. // server regardless of whether the field is empty or not. This may be
  1180. // used to include empty fields in Patch requests.
  1181. ForceSendFields []string `json:"-"`
  1182. // NullFields is a list of field names (e.g. "Compression") to include
  1183. // in API requests with the JSON null value. By default, fields with
  1184. // empty values are omitted from API requests. However, any field with
  1185. // an empty value appearing in NullFields will be sent to the server as
  1186. // null. It is an error if a field in this list has a non-empty value.
  1187. // This may be used to include null fields in Patch requests.
  1188. NullFields []string `json:"-"`
  1189. }
  1190. func (s *JobConfigurationExtract) MarshalJSON() ([]byte, error) {
  1191. type NoMethod JobConfigurationExtract
  1192. raw := NoMethod(*s)
  1193. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1194. }
  1195. type JobConfigurationLoad struct {
  1196. // AllowJaggedRows: [Optional] Accept rows that are missing trailing
  1197. // optional columns. The missing values are treated as nulls. If false,
  1198. // records with missing trailing columns are treated as bad records, and
  1199. // if there are too many bad records, an invalid error is returned in
  1200. // the job result. The default value is false. Only applicable to CSV,
  1201. // ignored for other formats.
  1202. AllowJaggedRows bool `json:"allowJaggedRows,omitempty"`
  1203. // AllowQuotedNewlines: Indicates if BigQuery should allow quoted data
  1204. // sections that contain newline characters in a CSV file. The default
  1205. // value is false.
  1206. AllowQuotedNewlines bool `json:"allowQuotedNewlines,omitempty"`
  1207. // Autodetect: [Optional] Indicates if we should automatically infer the
  1208. // options and schema for CSV and JSON sources.
  1209. Autodetect bool `json:"autodetect,omitempty"`
  1210. // Clustering: [Experimental] Clustering specification for the
  1211. // destination table. Must be specified with time-based partitioning,
  1212. // data in the table will be first partitioned and subsequently
  1213. // clustered.
  1214. Clustering *Clustering `json:"clustering,omitempty"`
  1215. // CreateDisposition: [Optional] Specifies whether the job is allowed to
  1216. // create new tables. The following values are supported:
  1217. // CREATE_IF_NEEDED: If the table does not exist, BigQuery creates the
  1218. // table. CREATE_NEVER: The table must already exist. If it does not, a
  1219. // 'notFound' error is returned in the job result. The default value is
  1220. // CREATE_IF_NEEDED. Creation, truncation and append actions occur as
  1221. // one atomic update upon job completion.
  1222. CreateDisposition string `json:"createDisposition,omitempty"`
  1223. // DestinationEncryptionConfiguration: Custom encryption configuration
  1224. // (e.g., Cloud KMS keys).
  1225. DestinationEncryptionConfiguration *EncryptionConfiguration `json:"destinationEncryptionConfiguration,omitempty"`
  1226. // DestinationTable: [Required] The destination table to load the data
  1227. // into.
  1228. DestinationTable *TableReference `json:"destinationTable,omitempty"`
  1229. // DestinationTableProperties: [Experimental] [Optional] Properties with
  1230. // which to create the destination table if it is new.
  1231. DestinationTableProperties *DestinationTableProperties `json:"destinationTableProperties,omitempty"`
  1232. // Encoding: [Optional] The character encoding of the data. The
  1233. // supported values are UTF-8 or ISO-8859-1. The default value is UTF-8.
  1234. // BigQuery decodes the data after the raw, binary data has been split
  1235. // using the values of the quote and fieldDelimiter properties.
  1236. Encoding string `json:"encoding,omitempty"`
  1237. // FieldDelimiter: [Optional] The separator for fields in a CSV file.
  1238. // The separator can be any ISO-8859-1 single-byte character. To use a
  1239. // character in the range 128-255, you must encode the character as
  1240. // UTF8. BigQuery converts the string to ISO-8859-1 encoding, and then
  1241. // uses the first byte of the encoded string to split the data in its
  1242. // raw, binary state. BigQuery also supports the escape sequence "\t" to
  1243. // specify a tab separator. The default value is a comma (',').
  1244. FieldDelimiter string `json:"fieldDelimiter,omitempty"`
  1245. // IgnoreUnknownValues: [Optional] Indicates if BigQuery should allow
  1246. // extra values that are not represented in the table schema. If true,
  1247. // the extra values are ignored. If false, records with extra columns
  1248. // are treated as bad records, and if there are too many bad records, an
  1249. // invalid error is returned in the job result. The default value is
  1250. // false. The sourceFormat property determines what BigQuery treats as
  1251. // an extra value: CSV: Trailing columns JSON: Named values that don't
  1252. // match any column names
  1253. IgnoreUnknownValues bool `json:"ignoreUnknownValues,omitempty"`
  1254. // MaxBadRecords: [Optional] The maximum number of bad records that
  1255. // BigQuery can ignore when running the job. If the number of bad
  1256. // records exceeds this value, an invalid error is returned in the job
  1257. // result. The default value is 0, which requires that all records are
  1258. // valid.
  1259. MaxBadRecords int64 `json:"maxBadRecords,omitempty"`
  1260. // NullMarker: [Optional] Specifies a string that represents a null
  1261. // value in a CSV file. For example, if you specify "\N", BigQuery
  1262. // interprets "\N" as a null value when loading a CSV file. The default
  1263. // value is the empty string. If you set this property to a custom
  1264. // value, BigQuery throws an error if an empty string is present for all
  1265. // data types except for STRING and BYTE. For STRING and BYTE columns,
  1266. // BigQuery interprets the empty string as an empty value.
  1267. NullMarker string `json:"nullMarker,omitempty"`
  1268. // ProjectionFields: If sourceFormat is set to "DATASTORE_BACKUP",
  1269. // indicates which entity properties to load into BigQuery from a Cloud
  1270. // Datastore backup. Property names are case sensitive and must be
  1271. // top-level properties. If no properties are specified, BigQuery loads
  1272. // all properties. If any named property isn't found in the Cloud
  1273. // Datastore backup, an invalid error is returned in the job result.
  1274. ProjectionFields []string `json:"projectionFields,omitempty"`
  1275. // Quote: [Optional] The value that is used to quote data sections in a
  1276. // CSV file. BigQuery converts the string to ISO-8859-1 encoding, and
  1277. // then uses the first byte of the encoded string to split the data in
  1278. // its raw, binary state. The default value is a double-quote ('"'). If
  1279. // your data does not contain quoted sections, set the property value to
  1280. // an empty string. If your data contains quoted newline characters, you
  1281. // must also set the allowQuotedNewlines property to true.
  1282. //
  1283. // Default: "
  1284. Quote *string `json:"quote,omitempty"`
  1285. // Schema: [Optional] The schema for the destination table. The schema
  1286. // can be omitted if the destination table already exists, or if you're
  1287. // loading data from Google Cloud Datastore.
  1288. Schema *TableSchema `json:"schema,omitempty"`
  1289. // SchemaInline: [Deprecated] The inline schema. For CSV schemas,
  1290. // specify as "Field1:Type1[,Field2:Type2]*". For example, "foo:STRING,
  1291. // bar:INTEGER, baz:FLOAT".
  1292. SchemaInline string `json:"schemaInline,omitempty"`
  1293. // SchemaInlineFormat: [Deprecated] The format of the schemaInline
  1294. // property.
  1295. SchemaInlineFormat string `json:"schemaInlineFormat,omitempty"`
  1296. // SchemaUpdateOptions: Allows the schema of the destination table to be
  1297. // updated as a side effect of the load job if a schema is autodetected
  1298. // or supplied in the job configuration. Schema update options are
  1299. // supported in two cases: when writeDisposition is WRITE_APPEND; when
  1300. // writeDisposition is WRITE_TRUNCATE and the destination table is a
  1301. // partition of a table, specified by partition decorators. For normal
  1302. // tables, WRITE_TRUNCATE will always overwrite the schema. One or more
  1303. // of the following values are specified: ALLOW_FIELD_ADDITION: allow
  1304. // adding a nullable field to the schema. ALLOW_FIELD_RELAXATION: allow
  1305. // relaxing a required field in the original schema to nullable.
  1306. SchemaUpdateOptions []string `json:"schemaUpdateOptions,omitempty"`
  1307. // SkipLeadingRows: [Optional] The number of rows at the top of a CSV
  1308. // file that BigQuery will skip when loading the data. The default value
  1309. // is 0. This property is useful if you have header rows in the file
  1310. // that should be skipped.
  1311. SkipLeadingRows int64 `json:"skipLeadingRows,omitempty"`
  1312. // SourceFormat: [Optional] The format of the data files. For CSV files,
  1313. // specify "CSV". For datastore backups, specify "DATASTORE_BACKUP". For
  1314. // newline-delimited JSON, specify "NEWLINE_DELIMITED_JSON". For Avro,
  1315. // specify "AVRO". For parquet, specify "PARQUET". For orc, specify
  1316. // "ORC". The default value is CSV.
  1317. SourceFormat string `json:"sourceFormat,omitempty"`
  1318. // SourceUris: [Required] The fully-qualified URIs that point to your
  1319. // data in Google Cloud. For Google Cloud Storage URIs: Each URI can
  1320. // contain one '*' wildcard character and it must come after the
  1321. // 'bucket' name. Size limits related to load jobs apply to external
  1322. // data sources. For Google Cloud Bigtable URIs: Exactly one URI can be
  1323. // specified and it has be a fully specified and valid HTTPS URL for a
  1324. // Google Cloud Bigtable table. For Google Cloud Datastore backups:
  1325. // Exactly one URI can be specified. Also, the '*' wildcard character is
  1326. // not allowed.
  1327. SourceUris []string `json:"sourceUris,omitempty"`
  1328. // TimePartitioning: Time-based partitioning specification for the
  1329. // destination table.
  1330. TimePartitioning *TimePartitioning `json:"timePartitioning,omitempty"`
  1331. // WriteDisposition: [Optional] Specifies the action that occurs if the
  1332. // destination table already exists. The following values are supported:
  1333. // WRITE_TRUNCATE: If the table already exists, BigQuery overwrites the
  1334. // table data. WRITE_APPEND: If the table already exists, BigQuery
  1335. // appends the data to the table. WRITE_EMPTY: If the table already
  1336. // exists and contains data, a 'duplicate' error is returned in the job
  1337. // result. The default value is WRITE_APPEND. Each action is atomic and
  1338. // only occurs if BigQuery is able to complete the job successfully.
  1339. // Creation, truncation and append actions occur as one atomic update
  1340. // upon job completion.
  1341. WriteDisposition string `json:"writeDisposition,omitempty"`
  1342. // ForceSendFields is a list of field names (e.g. "AllowJaggedRows") to
  1343. // unconditionally include in API requests. By default, fields with
  1344. // empty values are omitted from API requests. However, any non-pointer,
  1345. // non-interface field appearing in ForceSendFields will be sent to the
  1346. // server regardless of whether the field is empty or not. This may be
  1347. // used to include empty fields in Patch requests.
  1348. ForceSendFields []string `json:"-"`
  1349. // NullFields is a list of field names (e.g. "AllowJaggedRows") to
  1350. // include in API requests with the JSON null value. By default, fields
  1351. // with empty values are omitted from API requests. However, any field
  1352. // with an empty value appearing in NullFields will be sent to the
  1353. // server as null. It is an error if a field in this list has a
  1354. // non-empty value. This may be used to include null fields in Patch
  1355. // requests.
  1356. NullFields []string `json:"-"`
  1357. }
  1358. func (s *JobConfigurationLoad) MarshalJSON() ([]byte, error) {
  1359. type NoMethod JobConfigurationLoad
  1360. raw := NoMethod(*s)
  1361. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1362. }
  1363. type JobConfigurationQuery struct {
  1364. // AllowLargeResults: [Optional] If true and query uses legacy SQL
  1365. // dialect, allows the query to produce arbitrarily large result tables
  1366. // at a slight cost in performance. Requires destinationTable to be set.
  1367. // For standard SQL queries, this flag is ignored and large results are
  1368. // always allowed. However, you must still set destinationTable when
  1369. // result size exceeds the allowed maximum response size.
  1370. AllowLargeResults bool `json:"allowLargeResults,omitempty"`
  1371. // Clustering: [Experimental] Clustering specification for the
  1372. // destination table. Must be specified with time-based partitioning,
  1373. // data in the table will be first partitioned and subsequently
  1374. // clustered.
  1375. Clustering *Clustering `json:"clustering,omitempty"`
  1376. // CreateDisposition: [Optional] Specifies whether the job is allowed to
  1377. // create new tables. The following values are supported:
  1378. // CREATE_IF_NEEDED: If the table does not exist, BigQuery creates the
  1379. // table. CREATE_NEVER: The table must already exist. If it does not, a
  1380. // 'notFound' error is returned in the job result. The default value is
  1381. // CREATE_IF_NEEDED. Creation, truncation and append actions occur as
  1382. // one atomic update upon job completion.
  1383. CreateDisposition string `json:"createDisposition,omitempty"`
  1384. // DefaultDataset: [Optional] Specifies the default dataset to use for
  1385. // unqualified table names in the query.
  1386. DefaultDataset *DatasetReference `json:"defaultDataset,omitempty"`
  1387. // DestinationEncryptionConfiguration: Custom encryption configuration
  1388. // (e.g., Cloud KMS keys).
  1389. DestinationEncryptionConfiguration *EncryptionConfiguration `json:"destinationEncryptionConfiguration,omitempty"`
  1390. // DestinationTable: [Optional] Describes the table where the query
  1391. // results should be stored. If not present, a new table will be created
  1392. // to store the results. This property must be set for large results
  1393. // that exceed the maximum response size.
  1394. DestinationTable *TableReference `json:"destinationTable,omitempty"`
  1395. // FlattenResults: [Optional] If true and query uses legacy SQL dialect,
  1396. // flattens all nested and repeated fields in the query results.
  1397. // allowLargeResults must be true if this is set to false. For standard
  1398. // SQL queries, this flag is ignored and results are never flattened.
  1399. //
  1400. // Default: true
  1401. FlattenResults *bool `json:"flattenResults,omitempty"`
  1402. // MaximumBillingTier: [Optional] Limits the billing tier for this job.
  1403. // Queries that have resource usage beyond this tier will fail (without
  1404. // incurring a charge). If unspecified, this will be set to your project
  1405. // default.
  1406. //
  1407. // Default: 1
  1408. MaximumBillingTier *int64 `json:"maximumBillingTier,omitempty"`
  1409. // MaximumBytesBilled: [Optional] Limits the bytes billed for this job.
  1410. // Queries that will have bytes billed beyond this limit will fail
  1411. // (without incurring a charge). If unspecified, this will be set to
  1412. // your project default.
  1413. MaximumBytesBilled int64 `json:"maximumBytesBilled,omitempty,string"`
  1414. // ParameterMode: Standard SQL only. Set to POSITIONAL to use positional
  1415. // (?) query parameters or to NAMED to use named (@myparam) query
  1416. // parameters in this query.
  1417. ParameterMode string `json:"parameterMode,omitempty"`
  1418. // PreserveNulls: [Deprecated] This property is deprecated.
  1419. PreserveNulls bool `json:"preserveNulls,omitempty"`
  1420. // Priority: [Optional] Specifies a priority for the query. Possible
  1421. // values include INTERACTIVE and BATCH. The default value is
  1422. // INTERACTIVE.
  1423. Priority string `json:"priority,omitempty"`
  1424. // Query: [Required] SQL query text to execute. The useLegacySql field
  1425. // can be used to indicate whether the query uses legacy SQL or standard
  1426. // SQL.
  1427. Query string `json:"query,omitempty"`
  1428. // QueryParameters: Query parameters for standard SQL queries.
  1429. QueryParameters []*QueryParameter `json:"queryParameters,omitempty"`
  1430. // SchemaUpdateOptions: Allows the schema of the destination table to be
  1431. // updated as a side effect of the query job. Schema update options are
  1432. // supported in two cases: when writeDisposition is WRITE_APPEND; when
  1433. // writeDisposition is WRITE_TRUNCATE and the destination table is a
  1434. // partition of a table, specified by partition decorators. For normal
  1435. // tables, WRITE_TRUNCATE will always overwrite the schema. One or more
  1436. // of the following values are specified: ALLOW_FIELD_ADDITION: allow
  1437. // adding a nullable field to the schema. ALLOW_FIELD_RELAXATION: allow
  1438. // relaxing a required field in the original schema to nullable.
  1439. SchemaUpdateOptions []string `json:"schemaUpdateOptions,omitempty"`
  1440. // TableDefinitions: [Optional] If querying an external data source
  1441. // outside of BigQuery, describes the data format, location and other
  1442. // properties of the data source. By defining these properties, the data
  1443. // source can then be queried as if it were a standard BigQuery table.
  1444. TableDefinitions map[string]ExternalDataConfiguration `json:"tableDefinitions,omitempty"`
  1445. // TimePartitioning: Time-based partitioning specification for the
  1446. // destination table.
  1447. TimePartitioning *TimePartitioning `json:"timePartitioning,omitempty"`
  1448. // UseLegacySql: Specifies whether to use BigQuery's legacy SQL dialect
  1449. // for this query. The default value is true. If set to false, the query
  1450. // will use BigQuery's standard SQL:
  1451. // https://cloud.google.com/bigquery/sql-reference/ When useLegacySql is
  1452. // set to false, the value of flattenResults is ignored; query will be
  1453. // run as if flattenResults is false.
  1454. //
  1455. // Default: true
  1456. UseLegacySql *bool `json:"useLegacySql,omitempty"`
  1457. // UseQueryCache: [Optional] Whether to look for the result in the query
  1458. // cache. The query cache is a best-effort cache that will be flushed
  1459. // whenever tables in the query are modified. Moreover, the query cache
  1460. // is only available when a query does not have a destination table
  1461. // specified. The default value is true.
  1462. //
  1463. // Default: true
  1464. UseQueryCache *bool `json:"useQueryCache,omitempty"`
  1465. // UserDefinedFunctionResources: Describes user-defined function
  1466. // resources used in the query.
  1467. UserDefinedFunctionResources []*UserDefinedFunctionResource `json:"userDefinedFunctionResources,omitempty"`
  1468. // WriteDisposition: [Optional] Specifies the action that occurs if the
  1469. // destination table already exists. The following values are supported:
  1470. // WRITE_TRUNCATE: If the table already exists, BigQuery overwrites the
  1471. // table data and uses the schema from the query result. WRITE_APPEND:
  1472. // If the table already exists, BigQuery appends the data to the table.
  1473. // WRITE_EMPTY: If the table already exists and contains data, a
  1474. // 'duplicate' error is returned in the job result. The default value is
  1475. // WRITE_EMPTY. Each action is atomic and only occurs if BigQuery is
  1476. // able to complete the job successfully. Creation, truncation and
  1477. // append actions occur as one atomic update upon job completion.
  1478. WriteDisposition string `json:"writeDisposition,omitempty"`
  1479. // ForceSendFields is a list of field names (e.g. "AllowLargeResults")
  1480. // to unconditionally include in API requests. By default, fields with
  1481. // empty values are omitted from API requests. However, any non-pointer,
  1482. // non-interface field appearing in ForceSendFields will be sent to the
  1483. // server regardless of whether the field is empty or not. This may be
  1484. // used to include empty fields in Patch requests.
  1485. ForceSendFields []string `json:"-"`
  1486. // NullFields is a list of field names (e.g. "AllowLargeResults") to
  1487. // include in API requests with the JSON null value. By default, fields
  1488. // with empty values are omitted from API requests. However, any field
  1489. // with an empty value appearing in NullFields will be sent to the
  1490. // server as null. It is an error if a field in this list has a
  1491. // non-empty value. This may be used to include null fields in Patch
  1492. // requests.
  1493. NullFields []string `json:"-"`
  1494. }
  1495. func (s *JobConfigurationQuery) MarshalJSON() ([]byte, error) {
  1496. type NoMethod JobConfigurationQuery
  1497. raw := NoMethod(*s)
  1498. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1499. }
  1500. type JobConfigurationTableCopy struct {
  1501. // CreateDisposition: [Optional] Specifies whether the job is allowed to
  1502. // create new tables. The following values are supported:
  1503. // CREATE_IF_NEEDED: If the table does not exist, BigQuery creates the
  1504. // table. CREATE_NEVER: The table must already exist. If it does not, a
  1505. // 'notFound' error is returned in the job result. The default value is
  1506. // CREATE_IF_NEEDED. Creation, truncation and append actions occur as
  1507. // one atomic update upon job completion.
  1508. CreateDisposition string `json:"createDisposition,omitempty"`
  1509. // DestinationEncryptionConfiguration: Custom encryption configuration
  1510. // (e.g., Cloud KMS keys).
  1511. DestinationEncryptionConfiguration *EncryptionConfiguration `json:"destinationEncryptionConfiguration,omitempty"`
  1512. // DestinationTable: [Required] The destination table
  1513. DestinationTable *TableReference `json:"destinationTable,omitempty"`
  1514. // SourceTable: [Pick one] Source table to copy.
  1515. SourceTable *TableReference `json:"sourceTable,omitempty"`
  1516. // SourceTables: [Pick one] Source tables to copy.
  1517. SourceTables []*TableReference `json:"sourceTables,omitempty"`
  1518. // WriteDisposition: [Optional] Specifies the action that occurs if the
  1519. // destination table already exists. The following values are supported:
  1520. // WRITE_TRUNCATE: If the table already exists, BigQuery overwrites the
  1521. // table data. WRITE_APPEND: If the table already exists, BigQuery
  1522. // appends the data to the table. WRITE_EMPTY: If the table already
  1523. // exists and contains data, a 'duplicate' error is returned in the job
  1524. // result. The default value is WRITE_EMPTY. Each action is atomic and
  1525. // only occurs if BigQuery is able to complete the job successfully.
  1526. // Creation, truncation and append actions occur as one atomic update
  1527. // upon job completion.
  1528. WriteDisposition string `json:"writeDisposition,omitempty"`
  1529. // ForceSendFields is a list of field names (e.g. "CreateDisposition")
  1530. // to unconditionally include in API requests. By default, fields with
  1531. // empty values are omitted from API requests. However, any non-pointer,
  1532. // non-interface field appearing in ForceSendFields will be sent to the
  1533. // server regardless of whether the field is empty or not. This may be
  1534. // used to include empty fields in Patch requests.
  1535. ForceSendFields []string `json:"-"`
  1536. // NullFields is a list of field names (e.g. "CreateDisposition") to
  1537. // include in API requests with the JSON null value. By default, fields
  1538. // with empty values are omitted from API requests. However, any field
  1539. // with an empty value appearing in NullFields will be sent to the
  1540. // server as null. It is an error if a field in this list has a
  1541. // non-empty value. This may be used to include null fields in Patch
  1542. // requests.
  1543. NullFields []string `json:"-"`
  1544. }
  1545. func (s *JobConfigurationTableCopy) MarshalJSON() ([]byte, error) {
  1546. type NoMethod JobConfigurationTableCopy
  1547. raw := NoMethod(*s)
  1548. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1549. }
  1550. type JobList struct {
  1551. // Etag: A hash of this page of results.
  1552. Etag string `json:"etag,omitempty"`
  1553. // Jobs: List of jobs that were requested.
  1554. Jobs []*JobListJobs `json:"jobs,omitempty"`
  1555. // Kind: The resource type of the response.
  1556. Kind string `json:"kind,omitempty"`
  1557. // NextPageToken: A token to request the next page of results.
  1558. NextPageToken string `json:"nextPageToken,omitempty"`
  1559. // ServerResponse contains the HTTP response code and headers from the
  1560. // server.
  1561. googleapi.ServerResponse `json:"-"`
  1562. // ForceSendFields is a list of field names (e.g. "Etag") to
  1563. // unconditionally include in API requests. By default, fields with
  1564. // empty values are omitted from API requests. However, any non-pointer,
  1565. // non-interface field appearing in ForceSendFields will be sent to the
  1566. // server regardless of whether the field is empty or not. This may be
  1567. // used to include empty fields in Patch requests.
  1568. ForceSendFields []string `json:"-"`
  1569. // NullFields is a list of field names (e.g. "Etag") to include in API
  1570. // requests with the JSON null value. By default, fields with empty
  1571. // values are omitted from API requests. However, any field with an
  1572. // empty value appearing in NullFields will be sent to the server as
  1573. // null. It is an error if a field in this list has a non-empty value.
  1574. // This may be used to include null fields in Patch requests.
  1575. NullFields []string `json:"-"`
  1576. }
  1577. func (s *JobList) MarshalJSON() ([]byte, error) {
  1578. type NoMethod JobList
  1579. raw := NoMethod(*s)
  1580. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1581. }
  1582. type JobListJobs struct {
  1583. // Configuration: [Full-projection-only] Specifies the job
  1584. // configuration.
  1585. Configuration *JobConfiguration `json:"configuration,omitempty"`
  1586. // ErrorResult: A result object that will be present only if the job has
  1587. // failed.
  1588. ErrorResult *ErrorProto `json:"errorResult,omitempty"`
  1589. // Id: Unique opaque ID of the job.
  1590. Id string `json:"id,omitempty"`
  1591. // JobReference: Job reference uniquely identifying the job.
  1592. JobReference *JobReference `json:"jobReference,omitempty"`
  1593. // Kind: The resource type.
  1594. Kind string `json:"kind,omitempty"`
  1595. // State: Running state of the job. When the state is DONE, errorResult
  1596. // can be checked to determine whether the job succeeded or failed.
  1597. State string `json:"state,omitempty"`
  1598. // Statistics: [Output-only] Information about the job, including
  1599. // starting time and ending time of the job.
  1600. Statistics *JobStatistics `json:"statistics,omitempty"`
  1601. // Status: [Full-projection-only] Describes the state of the job.
  1602. Status *JobStatus `json:"status,omitempty"`
  1603. // UserEmail: [Full-projection-only] Email address of the user who ran
  1604. // the job.
  1605. UserEmail string `json:"user_email,omitempty"`
  1606. // ForceSendFields is a list of field names (e.g. "Configuration") to
  1607. // unconditionally include in API requests. By default, fields with
  1608. // empty values are omitted from API requests. However, any non-pointer,
  1609. // non-interface field appearing in ForceSendFields will be sent to the
  1610. // server regardless of whether the field is empty or not. This may be
  1611. // used to include empty fields in Patch requests.
  1612. ForceSendFields []string `json:"-"`
  1613. // NullFields is a list of field names (e.g. "Configuration") to include
  1614. // in API requests with the JSON null value. By default, fields with
  1615. // empty values are omitted from API requests. However, any field with
  1616. // an empty value appearing in NullFields will be sent to the server as
  1617. // null. It is an error if a field in this list has a non-empty value.
  1618. // This may be used to include null fields in Patch requests.
  1619. NullFields []string `json:"-"`
  1620. }
  1621. func (s *JobListJobs) MarshalJSON() ([]byte, error) {
  1622. type NoMethod JobListJobs
  1623. raw := NoMethod(*s)
  1624. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1625. }
  1626. type JobReference struct {
  1627. // JobId: [Required] The ID of the job. The ID must contain only letters
  1628. // (a-z, A-Z), numbers (0-9), underscores (_), or dashes (-). The
  1629. // maximum length is 1,024 characters.
  1630. JobId string `json:"jobId,omitempty"`
  1631. // Location: [Experimental] The geographic location of the job. Required
  1632. // except for US and EU. See details at
  1633. // https://cloud.google.com/bigquery/docs/dataset-locations#specifying_your_location.
  1634. Location string `json:"location,omitempty"`
  1635. // ProjectId: [Required] The ID of the project containing this job.
  1636. ProjectId string `json:"projectId,omitempty"`
  1637. // ForceSendFields is a list of field names (e.g. "JobId") to
  1638. // unconditionally include in API requests. By default, fields with
  1639. // empty values are omitted from API requests. However, any non-pointer,
  1640. // non-interface field appearing in ForceSendFields will be sent to the
  1641. // server regardless of whether the field is empty or not. This may be
  1642. // used to include empty fields in Patch requests.
  1643. ForceSendFields []string `json:"-"`
  1644. // NullFields is a list of field names (e.g. "JobId") to include in API
  1645. // requests with the JSON null value. By default, fields with empty
  1646. // values are omitted from API requests. However, any field with an
  1647. // empty value appearing in NullFields will be sent to the server as
  1648. // null. It is an error if a field in this list has a non-empty value.
  1649. // This may be used to include null fields in Patch requests.
  1650. NullFields []string `json:"-"`
  1651. }
  1652. func (s *JobReference) MarshalJSON() ([]byte, error) {
  1653. type NoMethod JobReference
  1654. raw := NoMethod(*s)
  1655. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1656. }
  1657. type JobStatistics struct {
  1658. // CompletionRatio: [Experimental] [Output-only] Job progress (0.0 ->
  1659. // 1.0) for LOAD and EXTRACT jobs.
  1660. CompletionRatio float64 `json:"completionRatio,omitempty"`
  1661. // CreationTime: [Output-only] Creation time of this job, in
  1662. // milliseconds since the epoch. This field will be present on all jobs.
  1663. CreationTime int64 `json:"creationTime,omitempty,string"`
  1664. // EndTime: [Output-only] End time of this job, in milliseconds since
  1665. // the epoch. This field will be present whenever a job is in the DONE
  1666. // state.
  1667. EndTime int64 `json:"endTime,omitempty,string"`
  1668. // Extract: [Output-only] Statistics for an extract job.
  1669. Extract *JobStatistics4 `json:"extract,omitempty"`
  1670. // Load: [Output-only] Statistics for a load job.
  1671. Load *JobStatistics3 `json:"load,omitempty"`
  1672. // Query: [Output-only] Statistics for a query job.
  1673. Query *JobStatistics2 `json:"query,omitempty"`
  1674. // StartTime: [Output-only] Start time of this job, in milliseconds
  1675. // since the epoch. This field will be present when the job transitions
  1676. // from the PENDING state to either RUNNING or DONE.
  1677. StartTime int64 `json:"startTime,omitempty,string"`
  1678. // TotalBytesProcessed: [Output-only] [Deprecated] Use the bytes
  1679. // processed in the query statistics instead.
  1680. TotalBytesProcessed int64 `json:"totalBytesProcessed,omitempty,string"`
  1681. // ForceSendFields is a list of field names (e.g. "CompletionRatio") to
  1682. // unconditionally include in API requests. By default, fields with
  1683. // empty values are omitted from API requests. However, any non-pointer,
  1684. // non-interface field appearing in ForceSendFields will be sent to the
  1685. // server regardless of whether the field is empty or not. This may be
  1686. // used to include empty fields in Patch requests.
  1687. ForceSendFields []string `json:"-"`
  1688. // NullFields is a list of field names (e.g. "CompletionRatio") to
  1689. // include in API requests with the JSON null value. By default, fields
  1690. // with empty values are omitted from API requests. However, any field
  1691. // with an empty value appearing in NullFields will be sent to the
  1692. // server as null. It is an error if a field in this list has a
  1693. // non-empty value. This may be used to include null fields in Patch
  1694. // requests.
  1695. NullFields []string `json:"-"`
  1696. }
  1697. func (s *JobStatistics) MarshalJSON() ([]byte, error) {
  1698. type NoMethod JobStatistics
  1699. raw := NoMethod(*s)
  1700. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1701. }
  1702. func (s *JobStatistics) UnmarshalJSON(data []byte) error {
  1703. type NoMethod JobStatistics
  1704. var s1 struct {
  1705. CompletionRatio gensupport.JSONFloat64 `json:"completionRatio"`
  1706. *NoMethod
  1707. }
  1708. s1.NoMethod = (*NoMethod)(s)
  1709. if err := json.Unmarshal(data, &s1); err != nil {
  1710. return err
  1711. }
  1712. s.CompletionRatio = float64(s1.CompletionRatio)
  1713. return nil
  1714. }
  1715. type JobStatistics2 struct {
  1716. // BillingTier: [Output-only] Billing tier for the job.
  1717. BillingTier int64 `json:"billingTier,omitempty"`
  1718. // CacheHit: [Output-only] Whether the query result was fetched from the
  1719. // query cache.
  1720. CacheHit bool `json:"cacheHit,omitempty"`
  1721. // DdlOperationPerformed: [Output-only, Experimental] The DDL operation
  1722. // performed, possibly dependent on the pre-existence of the DDL target.
  1723. // Possible values (new values might be added in the future): "CREATE":
  1724. // The query created the DDL target. "SKIP": No-op. Example cases: the
  1725. // query is CREATE TABLE IF NOT EXISTS while the table already exists,
  1726. // or the query is DROP TABLE IF EXISTS while the table does not exist.
  1727. // "REPLACE": The query replaced the DDL target. Example case: the query
  1728. // is CREATE OR REPLACE TABLE, and the table already exists. "DROP": The
  1729. // query deleted the DDL target.
  1730. DdlOperationPerformed string `json:"ddlOperationPerformed,omitempty"`
  1731. // DdlTargetTable: [Output-only, Experimental] The DDL target table.
  1732. // Present only for CREATE/DROP TABLE/VIEW queries.
  1733. DdlTargetTable *TableReference `json:"ddlTargetTable,omitempty"`
  1734. // EstimatedBytesProcessed: [Output-only] The original estimate of bytes
  1735. // processed for the job.
  1736. EstimatedBytesProcessed int64 `json:"estimatedBytesProcessed,omitempty,string"`
  1737. // NumDmlAffectedRows: [Output-only] The number of rows affected by a
  1738. // DML statement. Present only for DML statements INSERT, UPDATE or
  1739. // DELETE.
  1740. NumDmlAffectedRows int64 `json:"numDmlAffectedRows,omitempty,string"`
  1741. // QueryPlan: [Output-only] Describes execution plan for the query.
  1742. QueryPlan []*ExplainQueryStage `json:"queryPlan,omitempty"`
  1743. // ReferencedTables: [Output-only] Referenced tables for the job.
  1744. // Queries that reference more than 50 tables will not have a complete
  1745. // list.
  1746. ReferencedTables []*TableReference `json:"referencedTables,omitempty"`
  1747. // ReservationUsage: [Output-only] Job resource usage breakdown by
  1748. // reservation.
  1749. ReservationUsage []*JobStatistics2ReservationUsage `json:"reservationUsage,omitempty"`
  1750. // Schema: [Output-only] The schema of the results. Present only for
  1751. // successful dry run of non-legacy SQL queries.
  1752. Schema *TableSchema `json:"schema,omitempty"`
  1753. // StatementType: [Output-only, Experimental] The type of query
  1754. // statement, if valid. Possible values (new values might be added in
  1755. // the future): "SELECT": SELECT query. "INSERT": INSERT query; see
  1756. // https://cloud.google.com/bigquery/docs/reference/standard-sql/data-manipulation-language "UPDATE": UPDATE query; see https://cloud.google.com/bigquery/docs/reference/standard-sql/data-manipulation-language "DELETE": DELETE query; see https://cloud.google.com/bigquery/docs/reference/standard-sql/data-manipulation-language "MERGE": MERGE query; see https://cloud.google.com/bigquery/docs/reference/standard-sql/data-manipulation-language "CREATE_TABLE": CREATE [OR REPLACE] TABLE without AS SELECT. "CREATE_TABLE_AS_SELECT": CREATE [OR REPLACE] TABLE ... AS SELECT ... "DROP_TABLE": DROP TABLE query. "CREATE_VIEW": CREATE [OR REPLACE] VIEW ... AS SELECT ... "DROP_VIEW": DROP VIEW
  1757. // query.
  1758. StatementType string `json:"statementType,omitempty"`
  1759. // Timeline: [Output-only] [Experimental] Describes a timeline of job
  1760. // execution.
  1761. Timeline []*QueryTimelineSample `json:"timeline,omitempty"`
  1762. // TotalBytesBilled: [Output-only] Total bytes billed for the job.
  1763. TotalBytesBilled int64 `json:"totalBytesBilled,omitempty,string"`
  1764. // TotalBytesProcessed: [Output-only] Total bytes processed for the job.
  1765. TotalBytesProcessed int64 `json:"totalBytesProcessed,omitempty,string"`
  1766. // TotalPartitionsProcessed: [Output-only] Total number of partitions
  1767. // processed from all partitioned tables referenced in the job.
  1768. TotalPartitionsProcessed int64 `json:"totalPartitionsProcessed,omitempty,string"`
  1769. // TotalSlotMs: [Output-only] Slot-milliseconds for the job.
  1770. TotalSlotMs int64 `json:"totalSlotMs,omitempty,string"`
  1771. // UndeclaredQueryParameters: [Output-only, Experimental] Standard SQL
  1772. // only: list of undeclared query parameters detected during a dry run
  1773. // validation.
  1774. UndeclaredQueryParameters []*QueryParameter `json:"undeclaredQueryParameters,omitempty"`
  1775. // ForceSendFields is a list of field names (e.g. "BillingTier") to
  1776. // unconditionally include in API requests. By default, fields with
  1777. // empty values are omitted from API requests. However, any non-pointer,
  1778. // non-interface field appearing in ForceSendFields will be sent to the
  1779. // server regardless of whether the field is empty or not. This may be
  1780. // used to include empty fields in Patch requests.
  1781. ForceSendFields []string `json:"-"`
  1782. // NullFields is a list of field names (e.g. "BillingTier") to include
  1783. // in API requests with the JSON null value. By default, fields with
  1784. // empty values are omitted from API requests. However, any field with
  1785. // an empty value appearing in NullFields will be sent to the server as
  1786. // null. It is an error if a field in this list has a non-empty value.
  1787. // This may be used to include null fields in Patch requests.
  1788. NullFields []string `json:"-"`
  1789. }
  1790. func (s *JobStatistics2) MarshalJSON() ([]byte, error) {
  1791. type NoMethod JobStatistics2
  1792. raw := NoMethod(*s)
  1793. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1794. }
  1795. type JobStatistics2ReservationUsage struct {
  1796. // Name: [Output-only] Reservation name or "unreserved" for on-demand
  1797. // resources usage.
  1798. Name string `json:"name,omitempty"`
  1799. // SlotMs: [Output-only] Slot-milliseconds the job spent in the given
  1800. // reservation.
  1801. SlotMs int64 `json:"slotMs,omitempty,string"`
  1802. // ForceSendFields is a list of field names (e.g. "Name") to
  1803. // unconditionally include in API requests. By default, fields with
  1804. // empty values are omitted from API requests. However, any non-pointer,
  1805. // non-interface field appearing in ForceSendFields will be sent to the
  1806. // server regardless of whether the field is empty or not. This may be
  1807. // used to include empty fields in Patch requests.
  1808. ForceSendFields []string `json:"-"`
  1809. // NullFields is a list of field names (e.g. "Name") to include in API
  1810. // requests with the JSON null value. By default, fields with empty
  1811. // values are omitted from API requests. However, any field with an
  1812. // empty value appearing in NullFields will be sent to the server as
  1813. // null. It is an error if a field in this list has a non-empty value.
  1814. // This may be used to include null fields in Patch requests.
  1815. NullFields []string `json:"-"`
  1816. }
  1817. func (s *JobStatistics2ReservationUsage) MarshalJSON() ([]byte, error) {
  1818. type NoMethod JobStatistics2ReservationUsage
  1819. raw := NoMethod(*s)
  1820. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1821. }
  1822. type JobStatistics3 struct {
  1823. // BadRecords: [Output-only] The number of bad records encountered. Note
  1824. // that if the job has failed because of more bad records encountered
  1825. // than the maximum allowed in the load job configuration, then this
  1826. // number can be less than the total number of bad records present in
  1827. // the input data.
  1828. BadRecords int64 `json:"badRecords,omitempty,string"`
  1829. // InputFileBytes: [Output-only] Number of bytes of source data in a
  1830. // load job.
  1831. InputFileBytes int64 `json:"inputFileBytes,omitempty,string"`
  1832. // InputFiles: [Output-only] Number of source files in a load job.
  1833. InputFiles int64 `json:"inputFiles,omitempty,string"`
  1834. // OutputBytes: [Output-only] Size of the loaded data in bytes. Note
  1835. // that while a load job is in the running state, this value may change.
  1836. OutputBytes int64 `json:"outputBytes,omitempty,string"`
  1837. // OutputRows: [Output-only] Number of rows imported in a load job. Note
  1838. // that while an import job is in the running state, this value may
  1839. // change.
  1840. OutputRows int64 `json:"outputRows,omitempty,string"`
  1841. // ForceSendFields is a list of field names (e.g. "BadRecords") to
  1842. // unconditionally include in API requests. By default, fields with
  1843. // empty values are omitted from API requests. However, any non-pointer,
  1844. // non-interface field appearing in ForceSendFields will be sent to the
  1845. // server regardless of whether the field is empty or not. This may be
  1846. // used to include empty fields in Patch requests.
  1847. ForceSendFields []string `json:"-"`
  1848. // NullFields is a list of field names (e.g. "BadRecords") to include in
  1849. // API requests with the JSON null value. By default, fields with empty
  1850. // values are omitted from API requests. However, any field with an
  1851. // empty value appearing in NullFields will be sent to the server as
  1852. // null. It is an error if a field in this list has a non-empty value.
  1853. // This may be used to include null fields in Patch requests.
  1854. NullFields []string `json:"-"`
  1855. }
  1856. func (s *JobStatistics3) MarshalJSON() ([]byte, error) {
  1857. type NoMethod JobStatistics3
  1858. raw := NoMethod(*s)
  1859. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1860. }
  1861. type JobStatistics4 struct {
  1862. // DestinationUriFileCounts: [Output-only] Number of files per
  1863. // destination URI or URI pattern specified in the extract
  1864. // configuration. These values will be in the same order as the URIs
  1865. // specified in the 'destinationUris' field.
  1866. DestinationUriFileCounts googleapi.Int64s `json:"destinationUriFileCounts,omitempty"`
  1867. // ForceSendFields is a list of field names (e.g.
  1868. // "DestinationUriFileCounts") to unconditionally include in API
  1869. // requests. By default, fields with empty values are omitted from API
  1870. // requests. However, any non-pointer, non-interface field appearing in
  1871. // ForceSendFields will be sent to the server regardless of whether the
  1872. // field is empty or not. This may be used to include empty fields in
  1873. // Patch requests.
  1874. ForceSendFields []string `json:"-"`
  1875. // NullFields is a list of field names (e.g. "DestinationUriFileCounts")
  1876. // to include in API requests with the JSON null value. By default,
  1877. // fields with empty values are omitted from API requests. However, any
  1878. // field with an empty value appearing in NullFields will be sent to the
  1879. // server as null. It is an error if a field in this list has a
  1880. // non-empty value. This may be used to include null fields in Patch
  1881. // requests.
  1882. NullFields []string `json:"-"`
  1883. }
  1884. func (s *JobStatistics4) MarshalJSON() ([]byte, error) {
  1885. type NoMethod JobStatistics4
  1886. raw := NoMethod(*s)
  1887. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1888. }
  1889. type JobStatus struct {
  1890. // ErrorResult: [Output-only] Final error result of the job. If present,
  1891. // indicates that the job has completed and was unsuccessful.
  1892. ErrorResult *ErrorProto `json:"errorResult,omitempty"`
  1893. // Errors: [Output-only] The first errors encountered during the running
  1894. // of the job. The final message includes the number of errors that
  1895. // caused the process to stop. Errors here do not necessarily mean that
  1896. // the job has completed or was unsuccessful.
  1897. Errors []*ErrorProto `json:"errors,omitempty"`
  1898. // State: [Output-only] Running state of the job.
  1899. State string `json:"state,omitempty"`
  1900. // ForceSendFields is a list of field names (e.g. "ErrorResult") to
  1901. // unconditionally include in API requests. By default, fields with
  1902. // empty values are omitted from API requests. However, any non-pointer,
  1903. // non-interface field appearing in ForceSendFields will be sent to the
  1904. // server regardless of whether the field is empty or not. This may be
  1905. // used to include empty fields in Patch requests.
  1906. ForceSendFields []string `json:"-"`
  1907. // NullFields is a list of field names (e.g. "ErrorResult") to include
  1908. // in API requests with the JSON null value. By default, fields with
  1909. // empty values are omitted from API requests. However, any field with
  1910. // an empty value appearing in NullFields will be sent to the server as
  1911. // null. It is an error if a field in this list has a non-empty value.
  1912. // This may be used to include null fields in Patch requests.
  1913. NullFields []string `json:"-"`
  1914. }
  1915. func (s *JobStatus) MarshalJSON() ([]byte, error) {
  1916. type NoMethod JobStatus
  1917. raw := NoMethod(*s)
  1918. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1919. }
  1920. type JsonValue interface{}
  1921. type ProjectList struct {
  1922. // Etag: A hash of the page of results
  1923. Etag string `json:"etag,omitempty"`
  1924. // Kind: The type of list.
  1925. Kind string `json:"kind,omitempty"`
  1926. // NextPageToken: A token to request the next page of results.
  1927. NextPageToken string `json:"nextPageToken,omitempty"`
  1928. // Projects: Projects to which you have at least READ access.
  1929. Projects []*ProjectListProjects `json:"projects,omitempty"`
  1930. // TotalItems: The total number of projects in the list.
  1931. TotalItems int64 `json:"totalItems,omitempty"`
  1932. // ServerResponse contains the HTTP response code and headers from the
  1933. // server.
  1934. googleapi.ServerResponse `json:"-"`
  1935. // ForceSendFields is a list of field names (e.g. "Etag") to
  1936. // unconditionally include in API requests. By default, fields with
  1937. // empty values are omitted from API requests. However, any non-pointer,
  1938. // non-interface field appearing in ForceSendFields will be sent to the
  1939. // server regardless of whether the field is empty or not. This may be
  1940. // used to include empty fields in Patch requests.
  1941. ForceSendFields []string `json:"-"`
  1942. // NullFields is a list of field names (e.g. "Etag") to include in API
  1943. // requests with the JSON null value. By default, fields with empty
  1944. // values are omitted from API requests. However, any field with an
  1945. // empty value appearing in NullFields will be sent to the server as
  1946. // null. It is an error if a field in this list has a non-empty value.
  1947. // This may be used to include null fields in Patch requests.
  1948. NullFields []string `json:"-"`
  1949. }
  1950. func (s *ProjectList) MarshalJSON() ([]byte, error) {
  1951. type NoMethod ProjectList
  1952. raw := NoMethod(*s)
  1953. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1954. }
  1955. type ProjectListProjects struct {
  1956. // FriendlyName: A descriptive name for this project.
  1957. FriendlyName string `json:"friendlyName,omitempty"`
  1958. // Id: An opaque ID of this project.
  1959. Id string `json:"id,omitempty"`
  1960. // Kind: The resource type.
  1961. Kind string `json:"kind,omitempty"`
  1962. // NumericId: The numeric ID of this project.
  1963. NumericId uint64 `json:"numericId,omitempty,string"`
  1964. // ProjectReference: A unique reference to this project.
  1965. ProjectReference *ProjectReference `json:"projectReference,omitempty"`
  1966. // ForceSendFields is a list of field names (e.g. "FriendlyName") to
  1967. // unconditionally include in API requests. By default, fields with
  1968. // empty values are omitted from API requests. However, any non-pointer,
  1969. // non-interface field appearing in ForceSendFields will be sent to the
  1970. // server regardless of whether the field is empty or not. This may be
  1971. // used to include empty fields in Patch requests.
  1972. ForceSendFields []string `json:"-"`
  1973. // NullFields is a list of field names (e.g. "FriendlyName") to include
  1974. // in API requests with the JSON null value. By default, fields with
  1975. // empty values are omitted from API requests. However, any field with
  1976. // an empty value appearing in NullFields will be sent to the server as
  1977. // null. It is an error if a field in this list has a non-empty value.
  1978. // This may be used to include null fields in Patch requests.
  1979. NullFields []string `json:"-"`
  1980. }
  1981. func (s *ProjectListProjects) MarshalJSON() ([]byte, error) {
  1982. type NoMethod ProjectListProjects
  1983. raw := NoMethod(*s)
  1984. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1985. }
  1986. type ProjectReference struct {
  1987. // ProjectId: [Required] ID of the project. Can be either the numeric ID
  1988. // or the assigned ID of the project.
  1989. ProjectId string `json:"projectId,omitempty"`
  1990. // ForceSendFields is a list of field names (e.g. "ProjectId") to
  1991. // unconditionally include in API requests. By default, fields with
  1992. // empty values are omitted from API requests. However, any non-pointer,
  1993. // non-interface field appearing in ForceSendFields will be sent to the
  1994. // server regardless of whether the field is empty or not. This may be
  1995. // used to include empty fields in Patch requests.
  1996. ForceSendFields []string `json:"-"`
  1997. // NullFields is a list of field names (e.g. "ProjectId") to include in
  1998. // API requests with the JSON null value. By default, fields with empty
  1999. // values are omitted from API requests. However, any field with an
  2000. // empty value appearing in NullFields will be sent to the server as
  2001. // null. It is an error if a field in this list has a non-empty value.
  2002. // This may be used to include null fields in Patch requests.
  2003. NullFields []string `json:"-"`
  2004. }
  2005. func (s *ProjectReference) MarshalJSON() ([]byte, error) {
  2006. type NoMethod ProjectReference
  2007. raw := NoMethod(*s)
  2008. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2009. }
  2010. type QueryParameter struct {
  2011. // Name: [Optional] If unset, this is a positional parameter. Otherwise,
  2012. // should be unique within a query.
  2013. Name string `json:"name,omitempty"`
  2014. // ParameterType: [Required] The type of this parameter.
  2015. ParameterType *QueryParameterType `json:"parameterType,omitempty"`
  2016. // ParameterValue: [Required] The value of this parameter.
  2017. ParameterValue *QueryParameterValue `json:"parameterValue,omitempty"`
  2018. // ForceSendFields is a list of field names (e.g. "Name") to
  2019. // unconditionally include in API requests. By default, fields with
  2020. // empty values are omitted from API requests. However, any non-pointer,
  2021. // non-interface field appearing in ForceSendFields will be sent to the
  2022. // server regardless of whether the field is empty or not. This may be
  2023. // used to include empty fields in Patch requests.
  2024. ForceSendFields []string `json:"-"`
  2025. // NullFields is a list of field names (e.g. "Name") to include in API
  2026. // requests with the JSON null value. By default, fields with empty
  2027. // values are omitted from API requests. However, any field with an
  2028. // empty value appearing in NullFields will be sent to the server as
  2029. // null. It is an error if a field in this list has a non-empty value.
  2030. // This may be used to include null fields in Patch requests.
  2031. NullFields []string `json:"-"`
  2032. }
  2033. func (s *QueryParameter) MarshalJSON() ([]byte, error) {
  2034. type NoMethod QueryParameter
  2035. raw := NoMethod(*s)
  2036. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2037. }
  2038. type QueryParameterType struct {
  2039. // ArrayType: [Optional] The type of the array's elements, if this is an
  2040. // array.
  2041. ArrayType *QueryParameterType `json:"arrayType,omitempty"`
  2042. // StructTypes: [Optional] The types of the fields of this struct, in
  2043. // order, if this is a struct.
  2044. StructTypes []*QueryParameterTypeStructTypes `json:"structTypes,omitempty"`
  2045. // Type: [Required] The top level type of this field.
  2046. Type string `json:"type,omitempty"`
  2047. // ForceSendFields is a list of field names (e.g. "ArrayType") to
  2048. // unconditionally include in API requests. By default, fields with
  2049. // empty values are omitted from API requests. However, any non-pointer,
  2050. // non-interface field appearing in ForceSendFields will be sent to the
  2051. // server regardless of whether the field is empty or not. This may be
  2052. // used to include empty fields in Patch requests.
  2053. ForceSendFields []string `json:"-"`
  2054. // NullFields is a list of field names (e.g. "ArrayType") to include in
  2055. // API requests with the JSON null value. By default, fields with empty
  2056. // values are omitted from API requests. However, any field with an
  2057. // empty value appearing in NullFields will be sent to the server as
  2058. // null. It is an error if a field in this list has a non-empty value.
  2059. // This may be used to include null fields in Patch requests.
  2060. NullFields []string `json:"-"`
  2061. }
  2062. func (s *QueryParameterType) MarshalJSON() ([]byte, error) {
  2063. type NoMethod QueryParameterType
  2064. raw := NoMethod(*s)
  2065. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2066. }
  2067. type QueryParameterTypeStructTypes struct {
  2068. // Description: [Optional] Human-oriented description of the field.
  2069. Description string `json:"description,omitempty"`
  2070. // Name: [Optional] The name of this field.
  2071. Name string `json:"name,omitempty"`
  2072. // Type: [Required] The type of this field.
  2073. Type *QueryParameterType `json:"type,omitempty"`
  2074. // ForceSendFields is a list of field names (e.g. "Description") to
  2075. // unconditionally include in API requests. By default, fields with
  2076. // empty values are omitted from API requests. However, any non-pointer,
  2077. // non-interface field appearing in ForceSendFields will be sent to the
  2078. // server regardless of whether the field is empty or not. This may be
  2079. // used to include empty fields in Patch requests.
  2080. ForceSendFields []string `json:"-"`
  2081. // NullFields is a list of field names (e.g. "Description") to include
  2082. // in API requests with the JSON null value. By default, fields with
  2083. // empty values are omitted from API requests. However, any field with
  2084. // an empty value appearing in NullFields will be sent to the server as
  2085. // null. It is an error if a field in this list has a non-empty value.
  2086. // This may be used to include null fields in Patch requests.
  2087. NullFields []string `json:"-"`
  2088. }
  2089. func (s *QueryParameterTypeStructTypes) MarshalJSON() ([]byte, error) {
  2090. type NoMethod QueryParameterTypeStructTypes
  2091. raw := NoMethod(*s)
  2092. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2093. }
  2094. type QueryParameterValue struct {
  2095. // ArrayValues: [Optional] The array values, if this is an array type.
  2096. ArrayValues []*QueryParameterValue `json:"arrayValues,omitempty"`
  2097. // StructValues: [Optional] The struct field values, in order of the
  2098. // struct type's declaration.
  2099. StructValues map[string]QueryParameterValue `json:"structValues,omitempty"`
  2100. // Value: [Optional] The value of this value, if a simple scalar type.
  2101. Value string `json:"value,omitempty"`
  2102. // ForceSendFields is a list of field names (e.g. "ArrayValues") to
  2103. // unconditionally include in API requests. By default, fields with
  2104. // empty values are omitted from API requests. However, any non-pointer,
  2105. // non-interface field appearing in ForceSendFields will be sent to the
  2106. // server regardless of whether the field is empty or not. This may be
  2107. // used to include empty fields in Patch requests.
  2108. ForceSendFields []string `json:"-"`
  2109. // NullFields is a list of field names (e.g. "ArrayValues") to include
  2110. // in API requests with the JSON null value. By default, fields with
  2111. // empty values are omitted from API requests. However, any field with
  2112. // an empty value appearing in NullFields will be sent to the server as
  2113. // null. It is an error if a field in this list has a non-empty value.
  2114. // This may be used to include null fields in Patch requests.
  2115. NullFields []string `json:"-"`
  2116. }
  2117. func (s *QueryParameterValue) MarshalJSON() ([]byte, error) {
  2118. type NoMethod QueryParameterValue
  2119. raw := NoMethod(*s)
  2120. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2121. }
  2122. type QueryRequest struct {
  2123. // DefaultDataset: [Optional] Specifies the default datasetId and
  2124. // projectId to assume for any unqualified table names in the query. If
  2125. // not set, all table names in the query string must be qualified in the
  2126. // format 'datasetId.tableId'.
  2127. DefaultDataset *DatasetReference `json:"defaultDataset,omitempty"`
  2128. // DryRun: [Optional] If set to true, BigQuery doesn't run the job.
  2129. // Instead, if the query is valid, BigQuery returns statistics about the
  2130. // job such as how many bytes would be processed. If the query is
  2131. // invalid, an error returns. The default value is false.
  2132. DryRun bool `json:"dryRun,omitempty"`
  2133. // Kind: The resource type of the request.
  2134. Kind string `json:"kind,omitempty"`
  2135. // Location: [Experimental] The geographic location where the job should
  2136. // run. Required except for US and EU.
  2137. Location string `json:"location,omitempty"`
  2138. // MaxResults: [Optional] The maximum number of rows of data to return
  2139. // per page of results. Setting this flag to a small value such as 1000
  2140. // and then paging through results might improve reliability when the
  2141. // query result set is large. In addition to this limit, responses are
  2142. // also limited to 10 MB. By default, there is no maximum row count, and
  2143. // only the byte limit applies.
  2144. MaxResults int64 `json:"maxResults,omitempty"`
  2145. // ParameterMode: Standard SQL only. Set to POSITIONAL to use positional
  2146. // (?) query parameters or to NAMED to use named (@myparam) query
  2147. // parameters in this query.
  2148. ParameterMode string `json:"parameterMode,omitempty"`
  2149. // PreserveNulls: [Deprecated] This property is deprecated.
  2150. PreserveNulls bool `json:"preserveNulls,omitempty"`
  2151. // Query: [Required] A query string, following the BigQuery query
  2152. // syntax, of the query to execute. Example: "SELECT count(f1) FROM
  2153. // [myProjectId:myDatasetId.myTableId]".
  2154. Query string `json:"query,omitempty"`
  2155. // QueryParameters: Query parameters for Standard SQL queries.
  2156. QueryParameters []*QueryParameter `json:"queryParameters,omitempty"`
  2157. // TimeoutMs: [Optional] How long to wait for the query to complete, in
  2158. // milliseconds, before the request times out and returns. Note that
  2159. // this is only a timeout for the request, not the query. If the query
  2160. // takes longer to run than the timeout value, the call returns without
  2161. // any results and with the 'jobComplete' flag set to false. You can
  2162. // call GetQueryResults() to wait for the query to complete and read the
  2163. // results. The default value is 10000 milliseconds (10 seconds).
  2164. TimeoutMs int64 `json:"timeoutMs,omitempty"`
  2165. // UseLegacySql: Specifies whether to use BigQuery's legacy SQL dialect
  2166. // for this query. The default value is true. If set to false, the query
  2167. // will use BigQuery's standard SQL:
  2168. // https://cloud.google.com/bigquery/sql-reference/ When useLegacySql is
  2169. // set to false, the value of flattenResults is ignored; query will be
  2170. // run as if flattenResults is false.
  2171. //
  2172. // Default: true
  2173. UseLegacySql *bool `json:"useLegacySql,omitempty"`
  2174. // UseQueryCache: [Optional] Whether to look for the result in the query
  2175. // cache. The query cache is a best-effort cache that will be flushed
  2176. // whenever tables in the query are modified. The default value is true.
  2177. //
  2178. // Default: true
  2179. UseQueryCache *bool `json:"useQueryCache,omitempty"`
  2180. // ForceSendFields is a list of field names (e.g. "DefaultDataset") to
  2181. // unconditionally include in API requests. By default, fields with
  2182. // empty values are omitted from API requests. However, any non-pointer,
  2183. // non-interface field appearing in ForceSendFields will be sent to the
  2184. // server regardless of whether the field is empty or not. This may be
  2185. // used to include empty fields in Patch requests.
  2186. ForceSendFields []string `json:"-"`
  2187. // NullFields is a list of field names (e.g. "DefaultDataset") to
  2188. // include in API requests with the JSON null value. By default, fields
  2189. // with empty values are omitted from API requests. However, any field
  2190. // with an empty value appearing in NullFields will be sent to the
  2191. // server as null. It is an error if a field in this list has a
  2192. // non-empty value. This may be used to include null fields in Patch
  2193. // requests.
  2194. NullFields []string `json:"-"`
  2195. }
  2196. func (s *QueryRequest) MarshalJSON() ([]byte, error) {
  2197. type NoMethod QueryRequest
  2198. raw := NoMethod(*s)
  2199. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2200. }
  2201. type QueryResponse struct {
  2202. // CacheHit: Whether the query result was fetched from the query cache.
  2203. CacheHit bool `json:"cacheHit,omitempty"`
  2204. // Errors: [Output-only] The first errors or warnings encountered during
  2205. // the running of the job. The final message includes the number of
  2206. // errors that caused the process to stop. Errors here do not
  2207. // necessarily mean that the job has completed or was unsuccessful.
  2208. Errors []*ErrorProto `json:"errors,omitempty"`
  2209. // JobComplete: Whether the query has completed or not. If rows or
  2210. // totalRows are present, this will always be true. If this is false,
  2211. // totalRows will not be available.
  2212. JobComplete bool `json:"jobComplete,omitempty"`
  2213. // JobReference: Reference to the Job that was created to run the query.
  2214. // This field will be present even if the original request timed out, in
  2215. // which case GetQueryResults can be used to read the results once the
  2216. // query has completed. Since this API only returns the first page of
  2217. // results, subsequent pages can be fetched via the same mechanism
  2218. // (GetQueryResults).
  2219. JobReference *JobReference `json:"jobReference,omitempty"`
  2220. // Kind: The resource type.
  2221. Kind string `json:"kind,omitempty"`
  2222. // NumDmlAffectedRows: [Output-only] The number of rows affected by a
  2223. // DML statement. Present only for DML statements INSERT, UPDATE or
  2224. // DELETE.
  2225. NumDmlAffectedRows int64 `json:"numDmlAffectedRows,omitempty,string"`
  2226. // PageToken: A token used for paging results.
  2227. PageToken string `json:"pageToken,omitempty"`
  2228. // Rows: An object with as many results as can be contained within the
  2229. // maximum permitted reply size. To get any additional rows, you can
  2230. // call GetQueryResults and specify the jobReference returned above.
  2231. Rows []*TableRow `json:"rows,omitempty"`
  2232. // Schema: The schema of the results. Present only when the query
  2233. // completes successfully.
  2234. Schema *TableSchema `json:"schema,omitempty"`
  2235. // TotalBytesProcessed: The total number of bytes processed for this
  2236. // query. If this query was a dry run, this is the number of bytes that
  2237. // would be processed if the query were run.
  2238. TotalBytesProcessed int64 `json:"totalBytesProcessed,omitempty,string"`
  2239. // TotalRows: The total number of rows in the complete query result set,
  2240. // which can be more than the number of rows in this single page of
  2241. // results.
  2242. TotalRows uint64 `json:"totalRows,omitempty,string"`
  2243. // ServerResponse contains the HTTP response code and headers from the
  2244. // server.
  2245. googleapi.ServerResponse `json:"-"`
  2246. // ForceSendFields is a list of field names (e.g. "CacheHit") to
  2247. // unconditionally include in API requests. By default, fields with
  2248. // empty values are omitted from API requests. However, any non-pointer,
  2249. // non-interface field appearing in ForceSendFields will be sent to the
  2250. // server regardless of whether the field is empty or not. This may be
  2251. // used to include empty fields in Patch requests.
  2252. ForceSendFields []string `json:"-"`
  2253. // NullFields is a list of field names (e.g. "CacheHit") to include in
  2254. // API requests with the JSON null value. By default, fields with empty
  2255. // values are omitted from API requests. However, any field with an
  2256. // empty value appearing in NullFields will be sent to the server as
  2257. // null. It is an error if a field in this list has a non-empty value.
  2258. // This may be used to include null fields in Patch requests.
  2259. NullFields []string `json:"-"`
  2260. }
  2261. func (s *QueryResponse) MarshalJSON() ([]byte, error) {
  2262. type NoMethod QueryResponse
  2263. raw := NoMethod(*s)
  2264. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2265. }
  2266. type QueryTimelineSample struct {
  2267. // ActiveUnits: Total number of units currently being processed by
  2268. // workers. This does not correspond directly to slot usage. This is the
  2269. // largest value observed since the last sample.
  2270. ActiveUnits int64 `json:"activeUnits,omitempty,string"`
  2271. // CompletedUnits: Total parallel units of work completed by this query.
  2272. CompletedUnits int64 `json:"completedUnits,omitempty,string"`
  2273. // ElapsedMs: Milliseconds elapsed since the start of query execution.
  2274. ElapsedMs int64 `json:"elapsedMs,omitempty,string"`
  2275. // PendingUnits: Total parallel units of work remaining for the active
  2276. // stages.
  2277. PendingUnits int64 `json:"pendingUnits,omitempty,string"`
  2278. // TotalSlotMs: Cumulative slot-ms consumed by the query.
  2279. TotalSlotMs int64 `json:"totalSlotMs,omitempty,string"`
  2280. // ForceSendFields is a list of field names (e.g. "ActiveUnits") to
  2281. // unconditionally include in API requests. By default, fields with
  2282. // empty values are omitted from API requests. However, any non-pointer,
  2283. // non-interface field appearing in ForceSendFields will be sent to the
  2284. // server regardless of whether the field is empty or not. This may be
  2285. // used to include empty fields in Patch requests.
  2286. ForceSendFields []string `json:"-"`
  2287. // NullFields is a list of field names (e.g. "ActiveUnits") to include
  2288. // in API requests with the JSON null value. By default, fields with
  2289. // empty values are omitted from API requests. However, any field with
  2290. // an empty value appearing in NullFields will be sent to the server as
  2291. // null. It is an error if a field in this list has a non-empty value.
  2292. // This may be used to include null fields in Patch requests.
  2293. NullFields []string `json:"-"`
  2294. }
  2295. func (s *QueryTimelineSample) MarshalJSON() ([]byte, error) {
  2296. type NoMethod QueryTimelineSample
  2297. raw := NoMethod(*s)
  2298. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2299. }
  2300. type Streamingbuffer struct {
  2301. // EstimatedBytes: [Output-only] A lower-bound estimate of the number of
  2302. // bytes currently in the streaming buffer.
  2303. EstimatedBytes uint64 `json:"estimatedBytes,omitempty,string"`
  2304. // EstimatedRows: [Output-only] A lower-bound estimate of the number of
  2305. // rows currently in the streaming buffer.
  2306. EstimatedRows uint64 `json:"estimatedRows,omitempty,string"`
  2307. // OldestEntryTime: [Output-only] Contains the timestamp of the oldest
  2308. // entry in the streaming buffer, in milliseconds since the epoch, if
  2309. // the streaming buffer is available.
  2310. OldestEntryTime uint64 `json:"oldestEntryTime,omitempty,string"`
  2311. // ForceSendFields is a list of field names (e.g. "EstimatedBytes") to
  2312. // unconditionally include in API requests. By default, fields with
  2313. // empty values are omitted from API requests. However, any non-pointer,
  2314. // non-interface field appearing in ForceSendFields will be sent to the
  2315. // server regardless of whether the field is empty or not. This may be
  2316. // used to include empty fields in Patch requests.
  2317. ForceSendFields []string `json:"-"`
  2318. // NullFields is a list of field names (e.g. "EstimatedBytes") to
  2319. // include in API requests with the JSON null value. By default, fields
  2320. // with empty values are omitted from API requests. However, any field
  2321. // with an empty value appearing in NullFields will be sent to the
  2322. // server as null. It is an error if a field in this list has a
  2323. // non-empty value. This may be used to include null fields in Patch
  2324. // requests.
  2325. NullFields []string `json:"-"`
  2326. }
  2327. func (s *Streamingbuffer) MarshalJSON() ([]byte, error) {
  2328. type NoMethod Streamingbuffer
  2329. raw := NoMethod(*s)
  2330. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2331. }
  2332. type Table struct {
  2333. // Clustering: [Experimental] Clustering specification for the table.
  2334. // Must be specified with time-based partitioning, data in the table
  2335. // will be first partitioned and subsequently clustered.
  2336. Clustering *Clustering `json:"clustering,omitempty"`
  2337. // CreationTime: [Output-only] The time when this table was created, in
  2338. // milliseconds since the epoch.
  2339. CreationTime int64 `json:"creationTime,omitempty,string"`
  2340. // Description: [Optional] A user-friendly description of this table.
  2341. Description string `json:"description,omitempty"`
  2342. // EncryptionConfiguration: Custom encryption configuration (e.g., Cloud
  2343. // KMS keys).
  2344. EncryptionConfiguration *EncryptionConfiguration `json:"encryptionConfiguration,omitempty"`
  2345. // Etag: [Output-only] A hash of this resource.
  2346. Etag string `json:"etag,omitempty"`
  2347. // ExpirationTime: [Optional] The time when this table expires, in
  2348. // milliseconds since the epoch. If not present, the table will persist
  2349. // indefinitely. Expired tables will be deleted and their storage
  2350. // reclaimed. The defaultTableExpirationMs property of the encapsulating
  2351. // dataset can be used to set a default expirationTime on newly created
  2352. // tables.
  2353. ExpirationTime int64 `json:"expirationTime,omitempty,string"`
  2354. // ExternalDataConfiguration: [Optional] Describes the data format,
  2355. // location, and other properties of a table stored outside of BigQuery.
  2356. // By defining these properties, the data source can then be queried as
  2357. // if it were a standard BigQuery table.
  2358. ExternalDataConfiguration *ExternalDataConfiguration `json:"externalDataConfiguration,omitempty"`
  2359. // FriendlyName: [Optional] A descriptive name for this table.
  2360. FriendlyName string `json:"friendlyName,omitempty"`
  2361. // Id: [Output-only] An opaque ID uniquely identifying the table.
  2362. Id string `json:"id,omitempty"`
  2363. // Kind: [Output-only] The type of the resource.
  2364. Kind string `json:"kind,omitempty"`
  2365. // Labels: The labels associated with this table. You can use these to
  2366. // organize and group your tables. Label keys and values can be no
  2367. // longer than 63 characters, can only contain lowercase letters,
  2368. // numeric characters, underscores and dashes. International characters
  2369. // are allowed. Label values are optional. Label keys must start with a
  2370. // letter and each label in the list must have a different key.
  2371. Labels map[string]string `json:"labels,omitempty"`
  2372. // LastModifiedTime: [Output-only] The time when this table was last
  2373. // modified, in milliseconds since the epoch.
  2374. LastModifiedTime uint64 `json:"lastModifiedTime,omitempty,string"`
  2375. // Location: [Output-only] The geographic location where the table
  2376. // resides. This value is inherited from the dataset.
  2377. Location string `json:"location,omitempty"`
  2378. // NumBytes: [Output-only] The size of this table in bytes, excluding
  2379. // any data in the streaming buffer.
  2380. NumBytes int64 `json:"numBytes,omitempty,string"`
  2381. // NumLongTermBytes: [Output-only] The number of bytes in the table that
  2382. // are considered "long-term storage".
  2383. NumLongTermBytes int64 `json:"numLongTermBytes,omitempty,string"`
  2384. // NumRows: [Output-only] The number of rows of data in this table,
  2385. // excluding any data in the streaming buffer.
  2386. NumRows uint64 `json:"numRows,omitempty,string"`
  2387. // Schema: [Optional] Describes the schema of this table.
  2388. Schema *TableSchema `json:"schema,omitempty"`
  2389. // SelfLink: [Output-only] A URL that can be used to access this
  2390. // resource again.
  2391. SelfLink string `json:"selfLink,omitempty"`
  2392. // StreamingBuffer: [Output-only] Contains information regarding this
  2393. // table's streaming buffer, if one is present. This field will be
  2394. // absent if the table is not being streamed to or if there is no data
  2395. // in the streaming buffer.
  2396. StreamingBuffer *Streamingbuffer `json:"streamingBuffer,omitempty"`
  2397. // TableReference: [Required] Reference describing the ID of this table.
  2398. TableReference *TableReference `json:"tableReference,omitempty"`
  2399. // TimePartitioning: Time-based partitioning specification for this
  2400. // table.
  2401. TimePartitioning *TimePartitioning `json:"timePartitioning,omitempty"`
  2402. // Type: [Output-only] Describes the table type. The following values
  2403. // are supported: TABLE: A normal BigQuery table. VIEW: A virtual table
  2404. // defined by a SQL query. EXTERNAL: A table that references data stored
  2405. // in an external storage system, such as Google Cloud Storage. The
  2406. // default value is TABLE.
  2407. Type string `json:"type,omitempty"`
  2408. // View: [Optional] The view definition.
  2409. View *ViewDefinition `json:"view,omitempty"`
  2410. // ServerResponse contains the HTTP response code and headers from the
  2411. // server.
  2412. googleapi.ServerResponse `json:"-"`
  2413. // ForceSendFields is a list of field names (e.g. "Clustering") to
  2414. // unconditionally include in API requests. By default, fields with
  2415. // empty values are omitted from API requests. However, any non-pointer,
  2416. // non-interface field appearing in ForceSendFields will be sent to the
  2417. // server regardless of whether the field is empty or not. This may be
  2418. // used to include empty fields in Patch requests.
  2419. ForceSendFields []string `json:"-"`
  2420. // NullFields is a list of field names (e.g. "Clustering") to include in
  2421. // API requests with the JSON null value. By default, fields with empty
  2422. // values are omitted from API requests. However, any field with an
  2423. // empty value appearing in NullFields will be sent to the server as
  2424. // null. It is an error if a field in this list has a non-empty value.
  2425. // This may be used to include null fields in Patch requests.
  2426. NullFields []string `json:"-"`
  2427. }
  2428. func (s *Table) MarshalJSON() ([]byte, error) {
  2429. type NoMethod Table
  2430. raw := NoMethod(*s)
  2431. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2432. }
  2433. type TableCell struct {
  2434. V interface{} `json:"v,omitempty"`
  2435. // ForceSendFields is a list of field names (e.g. "V") to
  2436. // unconditionally include in API requests. By default, fields with
  2437. // empty values are omitted from API requests. However, any non-pointer,
  2438. // non-interface field appearing in ForceSendFields will be sent to the
  2439. // server regardless of whether the field is empty or not. This may be
  2440. // used to include empty fields in Patch requests.
  2441. ForceSendFields []string `json:"-"`
  2442. // NullFields is a list of field names (e.g. "V") to include in API
  2443. // requests with the JSON null value. By default, fields with empty
  2444. // values are omitted from API requests. However, any field with an
  2445. // empty value appearing in NullFields will be sent to the server as
  2446. // null. It is an error if a field in this list has a non-empty value.
  2447. // This may be used to include null fields in Patch requests.
  2448. NullFields []string `json:"-"`
  2449. }
  2450. func (s *TableCell) MarshalJSON() ([]byte, error) {
  2451. type NoMethod TableCell
  2452. raw := NoMethod(*s)
  2453. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2454. }
  2455. type TableDataInsertAllRequest struct {
  2456. // IgnoreUnknownValues: [Optional] Accept rows that contain values that
  2457. // do not match the schema. The unknown values are ignored. Default is
  2458. // false, which treats unknown values as errors.
  2459. IgnoreUnknownValues bool `json:"ignoreUnknownValues,omitempty"`
  2460. // Kind: The resource type of the response.
  2461. Kind string `json:"kind,omitempty"`
  2462. // Rows: The rows to insert.
  2463. Rows []*TableDataInsertAllRequestRows `json:"rows,omitempty"`
  2464. // SkipInvalidRows: [Optional] Insert all valid rows of a request, even
  2465. // if invalid rows exist. The default value is false, which causes the
  2466. // entire request to fail if any invalid rows exist.
  2467. SkipInvalidRows bool `json:"skipInvalidRows,omitempty"`
  2468. // TemplateSuffix: [Experimental] If specified, treats the destination
  2469. // table as a base template, and inserts the rows into an instance table
  2470. // named "{destination}{templateSuffix}". BigQuery will manage creation
  2471. // of the instance table, using the schema of the base template table.
  2472. // See
  2473. // https://cloud.google.com/bigquery/streaming-data-into-bigquery#template-tables for considerations when working with templates
  2474. // tables.
  2475. TemplateSuffix string `json:"templateSuffix,omitempty"`
  2476. // ForceSendFields is a list of field names (e.g. "IgnoreUnknownValues")
  2477. // to unconditionally include in API requests. By default, fields with
  2478. // empty values are omitted from API requests. However, any non-pointer,
  2479. // non-interface field appearing in ForceSendFields will be sent to the
  2480. // server regardless of whether the field is empty or not. This may be
  2481. // used to include empty fields in Patch requests.
  2482. ForceSendFields []string `json:"-"`
  2483. // NullFields is a list of field names (e.g. "IgnoreUnknownValues") to
  2484. // include in API requests with the JSON null value. By default, fields
  2485. // with empty values are omitted from API requests. However, any field
  2486. // with an empty value appearing in NullFields will be sent to the
  2487. // server as null. It is an error if a field in this list has a
  2488. // non-empty value. This may be used to include null fields in Patch
  2489. // requests.
  2490. NullFields []string `json:"-"`
  2491. }
  2492. func (s *TableDataInsertAllRequest) MarshalJSON() ([]byte, error) {
  2493. type NoMethod TableDataInsertAllRequest
  2494. raw := NoMethod(*s)
  2495. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2496. }
  2497. type TableDataInsertAllRequestRows struct {
  2498. // InsertId: [Optional] A unique ID for each row. BigQuery uses this
  2499. // property to detect duplicate insertion requests on a best-effort
  2500. // basis.
  2501. InsertId string `json:"insertId,omitempty"`
  2502. // Json: [Required] A JSON object that contains a row of data. The
  2503. // object's properties and values must match the destination table's
  2504. // schema.
  2505. Json map[string]JsonValue `json:"json,omitempty"`
  2506. // ForceSendFields is a list of field names (e.g. "InsertId") to
  2507. // unconditionally include in API requests. By default, fields with
  2508. // empty values are omitted from API requests. However, any non-pointer,
  2509. // non-interface field appearing in ForceSendFields will be sent to the
  2510. // server regardless of whether the field is empty or not. This may be
  2511. // used to include empty fields in Patch requests.
  2512. ForceSendFields []string `json:"-"`
  2513. // NullFields is a list of field names (e.g. "InsertId") to include in
  2514. // API requests with the JSON null value. By default, fields with empty
  2515. // values are omitted from API requests. However, any field with an
  2516. // empty value appearing in NullFields will be sent to the server as
  2517. // null. It is an error if a field in this list has a non-empty value.
  2518. // This may be used to include null fields in Patch requests.
  2519. NullFields []string `json:"-"`
  2520. }
  2521. func (s *TableDataInsertAllRequestRows) MarshalJSON() ([]byte, error) {
  2522. type NoMethod TableDataInsertAllRequestRows
  2523. raw := NoMethod(*s)
  2524. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2525. }
  2526. type TableDataInsertAllResponse struct {
  2527. // InsertErrors: An array of errors for rows that were not inserted.
  2528. InsertErrors []*TableDataInsertAllResponseInsertErrors `json:"insertErrors,omitempty"`
  2529. // Kind: The resource type of the response.
  2530. Kind string `json:"kind,omitempty"`
  2531. // ServerResponse contains the HTTP response code and headers from the
  2532. // server.
  2533. googleapi.ServerResponse `json:"-"`
  2534. // ForceSendFields is a list of field names (e.g. "InsertErrors") to
  2535. // unconditionally include in API requests. By default, fields with
  2536. // empty values are omitted from API requests. However, any non-pointer,
  2537. // non-interface field appearing in ForceSendFields will be sent to the
  2538. // server regardless of whether the field is empty or not. This may be
  2539. // used to include empty fields in Patch requests.
  2540. ForceSendFields []string `json:"-"`
  2541. // NullFields is a list of field names (e.g. "InsertErrors") to include
  2542. // in API requests with the JSON null value. By default, fields with
  2543. // empty values are omitted from API requests. However, any field with
  2544. // an empty value appearing in NullFields will be sent to the server as
  2545. // null. It is an error if a field in this list has a non-empty value.
  2546. // This may be used to include null fields in Patch requests.
  2547. NullFields []string `json:"-"`
  2548. }
  2549. func (s *TableDataInsertAllResponse) MarshalJSON() ([]byte, error) {
  2550. type NoMethod TableDataInsertAllResponse
  2551. raw := NoMethod(*s)
  2552. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2553. }
  2554. type TableDataInsertAllResponseInsertErrors struct {
  2555. // Errors: Error information for the row indicated by the index
  2556. // property.
  2557. Errors []*ErrorProto `json:"errors,omitempty"`
  2558. // Index: The index of the row that error applies to.
  2559. Index int64 `json:"index,omitempty"`
  2560. // ForceSendFields is a list of field names (e.g. "Errors") to
  2561. // unconditionally include in API requests. By default, fields with
  2562. // empty values are omitted from API requests. However, any non-pointer,
  2563. // non-interface field appearing in ForceSendFields will be sent to the
  2564. // server regardless of whether the field is empty or not. This may be
  2565. // used to include empty fields in Patch requests.
  2566. ForceSendFields []string `json:"-"`
  2567. // NullFields is a list of field names (e.g. "Errors") to include in API
  2568. // requests with the JSON null value. By default, fields with empty
  2569. // values are omitted from API requests. However, any field with an
  2570. // empty value appearing in NullFields will be sent to the server as
  2571. // null. It is an error if a field in this list has a non-empty value.
  2572. // This may be used to include null fields in Patch requests.
  2573. NullFields []string `json:"-"`
  2574. }
  2575. func (s *TableDataInsertAllResponseInsertErrors) MarshalJSON() ([]byte, error) {
  2576. type NoMethod TableDataInsertAllResponseInsertErrors
  2577. raw := NoMethod(*s)
  2578. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2579. }
  2580. type TableDataList struct {
  2581. // Etag: A hash of this page of results.
  2582. Etag string `json:"etag,omitempty"`
  2583. // Kind: The resource type of the response.
  2584. Kind string `json:"kind,omitempty"`
  2585. // PageToken: A token used for paging results. Providing this token
  2586. // instead of the startIndex parameter can help you retrieve stable
  2587. // results when an underlying table is changing.
  2588. PageToken string `json:"pageToken,omitempty"`
  2589. // Rows: Rows of results.
  2590. Rows []*TableRow `json:"rows,omitempty"`
  2591. // TotalRows: The total number of rows in the complete table.
  2592. TotalRows int64 `json:"totalRows,omitempty,string"`
  2593. // ServerResponse contains the HTTP response code and headers from the
  2594. // server.
  2595. googleapi.ServerResponse `json:"-"`
  2596. // ForceSendFields is a list of field names (e.g. "Etag") to
  2597. // unconditionally include in API requests. By default, fields with
  2598. // empty values are omitted from API requests. However, any non-pointer,
  2599. // non-interface field appearing in ForceSendFields will be sent to the
  2600. // server regardless of whether the field is empty or not. This may be
  2601. // used to include empty fields in Patch requests.
  2602. ForceSendFields []string `json:"-"`
  2603. // NullFields is a list of field names (e.g. "Etag") to include in API
  2604. // requests with the JSON null value. By default, fields with empty
  2605. // values are omitted from API requests. However, any field with an
  2606. // empty value appearing in NullFields will be sent to the server as
  2607. // null. It is an error if a field in this list has a non-empty value.
  2608. // This may be used to include null fields in Patch requests.
  2609. NullFields []string `json:"-"`
  2610. }
  2611. func (s *TableDataList) MarshalJSON() ([]byte, error) {
  2612. type NoMethod TableDataList
  2613. raw := NoMethod(*s)
  2614. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2615. }
  2616. type TableFieldSchema struct {
  2617. // Description: [Optional] The field description. The maximum length is
  2618. // 1,024 characters.
  2619. Description string `json:"description,omitempty"`
  2620. // Fields: [Optional] Describes the nested schema fields if the type
  2621. // property is set to RECORD.
  2622. Fields []*TableFieldSchema `json:"fields,omitempty"`
  2623. // Mode: [Optional] The field mode. Possible values include NULLABLE,
  2624. // REQUIRED and REPEATED. The default value is NULLABLE.
  2625. Mode string `json:"mode,omitempty"`
  2626. // Name: [Required] The field name. The name must contain only letters
  2627. // (a-z, A-Z), numbers (0-9), or underscores (_), and must start with a
  2628. // letter or underscore. The maximum length is 128 characters.
  2629. Name string `json:"name,omitempty"`
  2630. // Type: [Required] The field data type. Possible values include STRING,
  2631. // BYTES, INTEGER, INT64 (same as INTEGER), FLOAT, FLOAT64 (same as
  2632. // FLOAT), BOOLEAN, BOOL (same as BOOLEAN), TIMESTAMP, DATE, TIME,
  2633. // DATETIME, RECORD (where RECORD indicates that the field contains a
  2634. // nested schema) or STRUCT (same as RECORD).
  2635. Type string `json:"type,omitempty"`
  2636. // ForceSendFields is a list of field names (e.g. "Description") to
  2637. // unconditionally include in API requests. By default, fields with
  2638. // empty values are omitted from API requests. However, any non-pointer,
  2639. // non-interface field appearing in ForceSendFields will be sent to the
  2640. // server regardless of whether the field is empty or not. This may be
  2641. // used to include empty fields in Patch requests.
  2642. ForceSendFields []string `json:"-"`
  2643. // NullFields is a list of field names (e.g. "Description") to include
  2644. // in API requests with the JSON null value. By default, fields with
  2645. // empty values are omitted from API requests. However, any field with
  2646. // an empty value appearing in NullFields will be sent to the server as
  2647. // null. It is an error if a field in this list has a non-empty value.
  2648. // This may be used to include null fields in Patch requests.
  2649. NullFields []string `json:"-"`
  2650. }
  2651. func (s *TableFieldSchema) MarshalJSON() ([]byte, error) {
  2652. type NoMethod TableFieldSchema
  2653. raw := NoMethod(*s)
  2654. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2655. }
  2656. type TableList struct {
  2657. // Etag: A hash of this page of results.
  2658. Etag string `json:"etag,omitempty"`
  2659. // Kind: The type of list.
  2660. Kind string `json:"kind,omitempty"`
  2661. // NextPageToken: A token to request the next page of results.
  2662. NextPageToken string `json:"nextPageToken,omitempty"`
  2663. // Tables: Tables in the requested dataset.
  2664. Tables []*TableListTables `json:"tables,omitempty"`
  2665. // TotalItems: The total number of tables in the dataset.
  2666. TotalItems int64 `json:"totalItems,omitempty"`
  2667. // ServerResponse contains the HTTP response code and headers from the
  2668. // server.
  2669. googleapi.ServerResponse `json:"-"`
  2670. // ForceSendFields is a list of field names (e.g. "Etag") to
  2671. // unconditionally include in API requests. By default, fields with
  2672. // empty values are omitted from API requests. However, any non-pointer,
  2673. // non-interface field appearing in ForceSendFields will be sent to the
  2674. // server regardless of whether the field is empty or not. This may be
  2675. // used to include empty fields in Patch requests.
  2676. ForceSendFields []string `json:"-"`
  2677. // NullFields is a list of field names (e.g. "Etag") to include in API
  2678. // requests with the JSON null value. By default, fields with empty
  2679. // values are omitted from API requests. However, any field with an
  2680. // empty value appearing in NullFields will be sent to the server as
  2681. // null. It is an error if a field in this list has a non-empty value.
  2682. // This may be used to include null fields in Patch requests.
  2683. NullFields []string `json:"-"`
  2684. }
  2685. func (s *TableList) MarshalJSON() ([]byte, error) {
  2686. type NoMethod TableList
  2687. raw := NoMethod(*s)
  2688. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2689. }
  2690. type TableListTables struct {
  2691. // Clustering: [Experimental] Clustering specification for this table,
  2692. // if configured.
  2693. Clustering *Clustering `json:"clustering,omitempty"`
  2694. // CreationTime: The time when this table was created, in milliseconds
  2695. // since the epoch.
  2696. CreationTime int64 `json:"creationTime,omitempty,string"`
  2697. // ExpirationTime: [Optional] The time when this table expires, in
  2698. // milliseconds since the epoch. If not present, the table will persist
  2699. // indefinitely. Expired tables will be deleted and their storage
  2700. // reclaimed.
  2701. ExpirationTime int64 `json:"expirationTime,omitempty,string"`
  2702. // FriendlyName: The user-friendly name for this table.
  2703. FriendlyName string `json:"friendlyName,omitempty"`
  2704. // Id: An opaque ID of the table
  2705. Id string `json:"id,omitempty"`
  2706. // Kind: The resource type.
  2707. Kind string `json:"kind,omitempty"`
  2708. // Labels: The labels associated with this table. You can use these to
  2709. // organize and group your tables.
  2710. Labels map[string]string `json:"labels,omitempty"`
  2711. // TableReference: A reference uniquely identifying the table.
  2712. TableReference *TableReference `json:"tableReference,omitempty"`
  2713. // TimePartitioning: The time-based partitioning specification for this
  2714. // table, if configured.
  2715. TimePartitioning *TimePartitioning `json:"timePartitioning,omitempty"`
  2716. // Type: The type of table. Possible values are: TABLE, VIEW.
  2717. Type string `json:"type,omitempty"`
  2718. // View: Additional details for a view.
  2719. View *TableListTablesView `json:"view,omitempty"`
  2720. // ForceSendFields is a list of field names (e.g. "Clustering") to
  2721. // unconditionally include in API requests. By default, fields with
  2722. // empty values are omitted from API requests. However, any non-pointer,
  2723. // non-interface field appearing in ForceSendFields will be sent to the
  2724. // server regardless of whether the field is empty or not. This may be
  2725. // used to include empty fields in Patch requests.
  2726. ForceSendFields []string `json:"-"`
  2727. // NullFields is a list of field names (e.g. "Clustering") to include in
  2728. // API requests with the JSON null value. By default, fields with empty
  2729. // values are omitted from API requests. However, any field with an
  2730. // empty value appearing in NullFields will be sent to the server as
  2731. // null. It is an error if a field in this list has a non-empty value.
  2732. // This may be used to include null fields in Patch requests.
  2733. NullFields []string `json:"-"`
  2734. }
  2735. func (s *TableListTables) MarshalJSON() ([]byte, error) {
  2736. type NoMethod TableListTables
  2737. raw := NoMethod(*s)
  2738. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2739. }
  2740. // TableListTablesView: Additional details for a view.
  2741. type TableListTablesView struct {
  2742. // UseLegacySql: True if view is defined in legacy SQL dialect, false if
  2743. // in standard SQL.
  2744. UseLegacySql bool `json:"useLegacySql,omitempty"`
  2745. // ForceSendFields is a list of field names (e.g. "UseLegacySql") to
  2746. // unconditionally include in API requests. By default, fields with
  2747. // empty values are omitted from API requests. However, any non-pointer,
  2748. // non-interface field appearing in ForceSendFields will be sent to the
  2749. // server regardless of whether the field is empty or not. This may be
  2750. // used to include empty fields in Patch requests.
  2751. ForceSendFields []string `json:"-"`
  2752. // NullFields is a list of field names (e.g. "UseLegacySql") to include
  2753. // in API requests with the JSON null value. By default, fields with
  2754. // empty values are omitted from API requests. However, any field with
  2755. // an empty value appearing in NullFields will be sent to the server as
  2756. // null. It is an error if a field in this list has a non-empty value.
  2757. // This may be used to include null fields in Patch requests.
  2758. NullFields []string `json:"-"`
  2759. }
  2760. func (s *TableListTablesView) MarshalJSON() ([]byte, error) {
  2761. type NoMethod TableListTablesView
  2762. raw := NoMethod(*s)
  2763. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2764. }
  2765. type TableReference struct {
  2766. // DatasetId: [Required] The ID of the dataset containing this table.
  2767. DatasetId string `json:"datasetId,omitempty"`
  2768. // ProjectId: [Required] The ID of the project containing this table.
  2769. ProjectId string `json:"projectId,omitempty"`
  2770. // TableId: [Required] The ID of the table. The ID must contain only
  2771. // letters (a-z, A-Z), numbers (0-9), or underscores (_). The maximum
  2772. // length is 1,024 characters.
  2773. TableId string `json:"tableId,omitempty"`
  2774. // ForceSendFields is a list of field names (e.g. "DatasetId") to
  2775. // unconditionally include in API requests. By default, fields with
  2776. // empty values are omitted from API requests. However, any non-pointer,
  2777. // non-interface field appearing in ForceSendFields will be sent to the
  2778. // server regardless of whether the field is empty or not. This may be
  2779. // used to include empty fields in Patch requests.
  2780. ForceSendFields []string `json:"-"`
  2781. // NullFields is a list of field names (e.g. "DatasetId") to include in
  2782. // API requests with the JSON null value. By default, fields with empty
  2783. // values are omitted from API requests. However, any field with an
  2784. // empty value appearing in NullFields will be sent to the server as
  2785. // null. It is an error if a field in this list has a non-empty value.
  2786. // This may be used to include null fields in Patch requests.
  2787. NullFields []string `json:"-"`
  2788. }
  2789. func (s *TableReference) MarshalJSON() ([]byte, error) {
  2790. type NoMethod TableReference
  2791. raw := NoMethod(*s)
  2792. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2793. }
  2794. type TableRow struct {
  2795. // F: Represents a single row in the result set, consisting of one or
  2796. // more fields.
  2797. F []*TableCell `json:"f,omitempty"`
  2798. // ForceSendFields is a list of field names (e.g. "F") to
  2799. // unconditionally include in API requests. By default, fields with
  2800. // empty values are omitted from API requests. However, any non-pointer,
  2801. // non-interface field appearing in ForceSendFields will be sent to the
  2802. // server regardless of whether the field is empty or not. This may be
  2803. // used to include empty fields in Patch requests.
  2804. ForceSendFields []string `json:"-"`
  2805. // NullFields is a list of field names (e.g. "F") to include in API
  2806. // requests with the JSON null value. By default, fields with empty
  2807. // values are omitted from API requests. However, any field with an
  2808. // empty value appearing in NullFields will be sent to the server as
  2809. // null. It is an error if a field in this list has a non-empty value.
  2810. // This may be used to include null fields in Patch requests.
  2811. NullFields []string `json:"-"`
  2812. }
  2813. func (s *TableRow) MarshalJSON() ([]byte, error) {
  2814. type NoMethod TableRow
  2815. raw := NoMethod(*s)
  2816. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2817. }
  2818. type TableSchema struct {
  2819. // Fields: Describes the fields in a table.
  2820. Fields []*TableFieldSchema `json:"fields,omitempty"`
  2821. // ForceSendFields is a list of field names (e.g. "Fields") to
  2822. // unconditionally include in API requests. By default, fields with
  2823. // empty values are omitted from API requests. However, any non-pointer,
  2824. // non-interface field appearing in ForceSendFields will be sent to the
  2825. // server regardless of whether the field is empty or not. This may be
  2826. // used to include empty fields in Patch requests.
  2827. ForceSendFields []string `json:"-"`
  2828. // NullFields is a list of field names (e.g. "Fields") to include in API
  2829. // requests with the JSON null value. By default, fields with empty
  2830. // values are omitted from API requests. However, any field with an
  2831. // empty value appearing in NullFields will be sent to the server as
  2832. // null. It is an error if a field in this list has a non-empty value.
  2833. // This may be used to include null fields in Patch requests.
  2834. NullFields []string `json:"-"`
  2835. }
  2836. func (s *TableSchema) MarshalJSON() ([]byte, error) {
  2837. type NoMethod TableSchema
  2838. raw := NoMethod(*s)
  2839. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2840. }
  2841. type TimePartitioning struct {
  2842. // ExpirationMs: [Optional] Number of milliseconds for which to keep the
  2843. // storage for partitions in the table. The storage in a partition will
  2844. // have an expiration time of its partition time plus this value.
  2845. ExpirationMs int64 `json:"expirationMs,omitempty,string"`
  2846. // Field: [Experimental] [Optional] If not set, the table is partitioned
  2847. // by pseudo column, referenced via either '_PARTITIONTIME' as TIMESTAMP
  2848. // type, or '_PARTITIONDATE' as DATE type. If field is specified, the
  2849. // table is instead partitioned by this field. The field must be a
  2850. // top-level TIMESTAMP or DATE field. Its mode must be NULLABLE or
  2851. // REQUIRED.
  2852. Field string `json:"field,omitempty"`
  2853. // RequirePartitionFilter: [Experimental] [Optional] If set to true,
  2854. // queries over this table require a partition filter that can be used
  2855. // for partition elimination to be specified.
  2856. RequirePartitionFilter bool `json:"requirePartitionFilter,omitempty"`
  2857. // Type: [Required] The only type supported is DAY, which will generate
  2858. // one partition per day.
  2859. Type string `json:"type,omitempty"`
  2860. // ForceSendFields is a list of field names (e.g. "ExpirationMs") to
  2861. // unconditionally include in API requests. By default, fields with
  2862. // empty values are omitted from API requests. However, any non-pointer,
  2863. // non-interface field appearing in ForceSendFields will be sent to the
  2864. // server regardless of whether the field is empty or not. This may be
  2865. // used to include empty fields in Patch requests.
  2866. ForceSendFields []string `json:"-"`
  2867. // NullFields is a list of field names (e.g. "ExpirationMs") to include
  2868. // in API requests with the JSON null value. By default, fields with
  2869. // empty values are omitted from API requests. However, any field with
  2870. // an empty value appearing in NullFields will be sent to the server as
  2871. // null. It is an error if a field in this list has a non-empty value.
  2872. // This may be used to include null fields in Patch requests.
  2873. NullFields []string `json:"-"`
  2874. }
  2875. func (s *TimePartitioning) MarshalJSON() ([]byte, error) {
  2876. type NoMethod TimePartitioning
  2877. raw := NoMethod(*s)
  2878. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2879. }
  2880. type UserDefinedFunctionResource struct {
  2881. // InlineCode: [Pick one] An inline resource that contains code for a
  2882. // user-defined function (UDF). Providing a inline code resource is
  2883. // equivalent to providing a URI for a file containing the same code.
  2884. InlineCode string `json:"inlineCode,omitempty"`
  2885. // ResourceUri: [Pick one] A code resource to load from a Google Cloud
  2886. // Storage URI (gs://bucket/path).
  2887. ResourceUri string `json:"resourceUri,omitempty"`
  2888. // ForceSendFields is a list of field names (e.g. "InlineCode") to
  2889. // unconditionally include in API requests. By default, fields with
  2890. // empty values are omitted from API requests. However, any non-pointer,
  2891. // non-interface field appearing in ForceSendFields will be sent to the
  2892. // server regardless of whether the field is empty or not. This may be
  2893. // used to include empty fields in Patch requests.
  2894. ForceSendFields []string `json:"-"`
  2895. // NullFields is a list of field names (e.g. "InlineCode") to include in
  2896. // API requests with the JSON null value. By default, fields with empty
  2897. // values are omitted from API requests. However, any field with an
  2898. // empty value appearing in NullFields will be sent to the server as
  2899. // null. It is an error if a field in this list has a non-empty value.
  2900. // This may be used to include null fields in Patch requests.
  2901. NullFields []string `json:"-"`
  2902. }
  2903. func (s *UserDefinedFunctionResource) MarshalJSON() ([]byte, error) {
  2904. type NoMethod UserDefinedFunctionResource
  2905. raw := NoMethod(*s)
  2906. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2907. }
  2908. type ViewDefinition struct {
  2909. // Query: [Required] A query that BigQuery executes when the view is
  2910. // referenced.
  2911. Query string `json:"query,omitempty"`
  2912. // UseLegacySql: Specifies whether to use BigQuery's legacy SQL for this
  2913. // view. The default value is true. If set to false, the view will use
  2914. // BigQuery's standard SQL:
  2915. // https://cloud.google.com/bigquery/sql-reference/ Queries and views
  2916. // that reference this view must use the same flag value.
  2917. UseLegacySql bool `json:"useLegacySql,omitempty"`
  2918. // UserDefinedFunctionResources: Describes user-defined function
  2919. // resources used in the query.
  2920. UserDefinedFunctionResources []*UserDefinedFunctionResource `json:"userDefinedFunctionResources,omitempty"`
  2921. // ForceSendFields is a list of field names (e.g. "Query") to
  2922. // unconditionally include in API requests. By default, fields with
  2923. // empty values are omitted from API requests. However, any non-pointer,
  2924. // non-interface field appearing in ForceSendFields will be sent to the
  2925. // server regardless of whether the field is empty or not. This may be
  2926. // used to include empty fields in Patch requests.
  2927. ForceSendFields []string `json:"-"`
  2928. // NullFields is a list of field names (e.g. "Query") to include in API
  2929. // requests with the JSON null value. By default, fields with empty
  2930. // values are omitted from API requests. However, any field with an
  2931. // empty value appearing in NullFields will be sent to the server as
  2932. // null. It is an error if a field in this list has a non-empty value.
  2933. // This may be used to include null fields in Patch requests.
  2934. NullFields []string `json:"-"`
  2935. }
  2936. func (s *ViewDefinition) MarshalJSON() ([]byte, error) {
  2937. type NoMethod ViewDefinition
  2938. raw := NoMethod(*s)
  2939. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2940. }
  2941. // method id "bigquery.datasets.delete":
  2942. type DatasetsDeleteCall struct {
  2943. s *Service
  2944. projectId string
  2945. datasetId string
  2946. urlParams_ gensupport.URLParams
  2947. ctx_ context.Context
  2948. header_ http.Header
  2949. }
  2950. // Delete: Deletes the dataset specified by the datasetId value. Before
  2951. // you can delete a dataset, you must delete all its tables, either
  2952. // manually or by specifying deleteContents. Immediately after deletion,
  2953. // you can create another dataset with the same name.
  2954. func (r *DatasetsService) Delete(projectId string, datasetId string) *DatasetsDeleteCall {
  2955. c := &DatasetsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2956. c.projectId = projectId
  2957. c.datasetId = datasetId
  2958. return c
  2959. }
  2960. // DeleteContents sets the optional parameter "deleteContents": If True,
  2961. // delete all the tables in the dataset. If False and the dataset
  2962. // contains tables, the request will fail. Default is False
  2963. func (c *DatasetsDeleteCall) DeleteContents(deleteContents bool) *DatasetsDeleteCall {
  2964. c.urlParams_.Set("deleteContents", fmt.Sprint(deleteContents))
  2965. return c
  2966. }
  2967. // Fields allows partial responses to be retrieved. See
  2968. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2969. // for more information.
  2970. func (c *DatasetsDeleteCall) Fields(s ...googleapi.Field) *DatasetsDeleteCall {
  2971. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2972. return c
  2973. }
  2974. // Context sets the context to be used in this call's Do method. Any
  2975. // pending HTTP request will be aborted if the provided context is
  2976. // canceled.
  2977. func (c *DatasetsDeleteCall) Context(ctx context.Context) *DatasetsDeleteCall {
  2978. c.ctx_ = ctx
  2979. return c
  2980. }
  2981. // Header returns an http.Header that can be modified by the caller to
  2982. // add HTTP headers to the request.
  2983. func (c *DatasetsDeleteCall) Header() http.Header {
  2984. if c.header_ == nil {
  2985. c.header_ = make(http.Header)
  2986. }
  2987. return c.header_
  2988. }
  2989. func (c *DatasetsDeleteCall) doRequest(alt string) (*http.Response, error) {
  2990. reqHeaders := make(http.Header)
  2991. for k, v := range c.header_ {
  2992. reqHeaders[k] = v
  2993. }
  2994. reqHeaders.Set("User-Agent", c.s.userAgent())
  2995. var body io.Reader = nil
  2996. c.urlParams_.Set("alt", alt)
  2997. urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{projectId}/datasets/{datasetId}")
  2998. urls += "?" + c.urlParams_.Encode()
  2999. req, _ := http.NewRequest("DELETE", urls, body)
  3000. req.Header = reqHeaders
  3001. googleapi.Expand(req.URL, map[string]string{
  3002. "projectId": c.projectId,
  3003. "datasetId": c.datasetId,
  3004. })
  3005. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3006. }
  3007. // Do executes the "bigquery.datasets.delete" call.
  3008. func (c *DatasetsDeleteCall) Do(opts ...googleapi.CallOption) error {
  3009. gensupport.SetOptions(c.urlParams_, opts...)
  3010. res, err := c.doRequest("json")
  3011. if err != nil {
  3012. return err
  3013. }
  3014. defer googleapi.CloseBody(res)
  3015. if err := googleapi.CheckResponse(res); err != nil {
  3016. return err
  3017. }
  3018. return nil
  3019. // {
  3020. // "description": "Deletes the dataset specified by the datasetId value. Before you can delete a dataset, you must delete all its tables, either manually or by specifying deleteContents. Immediately after deletion, you can create another dataset with the same name.",
  3021. // "httpMethod": "DELETE",
  3022. // "id": "bigquery.datasets.delete",
  3023. // "parameterOrder": [
  3024. // "projectId",
  3025. // "datasetId"
  3026. // ],
  3027. // "parameters": {
  3028. // "datasetId": {
  3029. // "description": "Dataset ID of dataset being deleted",
  3030. // "location": "path",
  3031. // "required": true,
  3032. // "type": "string"
  3033. // },
  3034. // "deleteContents": {
  3035. // "description": "If True, delete all the tables in the dataset. If False and the dataset contains tables, the request will fail. Default is False",
  3036. // "location": "query",
  3037. // "type": "boolean"
  3038. // },
  3039. // "projectId": {
  3040. // "description": "Project ID of the dataset being deleted",
  3041. // "location": "path",
  3042. // "required": true,
  3043. // "type": "string"
  3044. // }
  3045. // },
  3046. // "path": "projects/{projectId}/datasets/{datasetId}",
  3047. // "scopes": [
  3048. // "https://www.googleapis.com/auth/bigquery",
  3049. // "https://www.googleapis.com/auth/cloud-platform"
  3050. // ]
  3051. // }
  3052. }
  3053. // method id "bigquery.datasets.get":
  3054. type DatasetsGetCall struct {
  3055. s *Service
  3056. projectId string
  3057. datasetId string
  3058. urlParams_ gensupport.URLParams
  3059. ifNoneMatch_ string
  3060. ctx_ context.Context
  3061. header_ http.Header
  3062. }
  3063. // Get: Returns the dataset specified by datasetID.
  3064. func (r *DatasetsService) Get(projectId string, datasetId string) *DatasetsGetCall {
  3065. c := &DatasetsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3066. c.projectId = projectId
  3067. c.datasetId = datasetId
  3068. return c
  3069. }
  3070. // Fields allows partial responses to be retrieved. See
  3071. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3072. // for more information.
  3073. func (c *DatasetsGetCall) Fields(s ...googleapi.Field) *DatasetsGetCall {
  3074. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3075. return c
  3076. }
  3077. // IfNoneMatch sets the optional parameter which makes the operation
  3078. // fail if the object's ETag matches the given value. This is useful for
  3079. // getting updates only after the object has changed since the last
  3080. // request. Use googleapi.IsNotModified to check whether the response
  3081. // error from Do is the result of In-None-Match.
  3082. func (c *DatasetsGetCall) IfNoneMatch(entityTag string) *DatasetsGetCall {
  3083. c.ifNoneMatch_ = entityTag
  3084. return c
  3085. }
  3086. // Context sets the context to be used in this call's Do method. Any
  3087. // pending HTTP request will be aborted if the provided context is
  3088. // canceled.
  3089. func (c *DatasetsGetCall) Context(ctx context.Context) *DatasetsGetCall {
  3090. c.ctx_ = ctx
  3091. return c
  3092. }
  3093. // Header returns an http.Header that can be modified by the caller to
  3094. // add HTTP headers to the request.
  3095. func (c *DatasetsGetCall) Header() http.Header {
  3096. if c.header_ == nil {
  3097. c.header_ = make(http.Header)
  3098. }
  3099. return c.header_
  3100. }
  3101. func (c *DatasetsGetCall) doRequest(alt string) (*http.Response, error) {
  3102. reqHeaders := make(http.Header)
  3103. for k, v := range c.header_ {
  3104. reqHeaders[k] = v
  3105. }
  3106. reqHeaders.Set("User-Agent", c.s.userAgent())
  3107. if c.ifNoneMatch_ != "" {
  3108. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  3109. }
  3110. var body io.Reader = nil
  3111. c.urlParams_.Set("alt", alt)
  3112. urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{projectId}/datasets/{datasetId}")
  3113. urls += "?" + c.urlParams_.Encode()
  3114. req, _ := http.NewRequest("GET", urls, body)
  3115. req.Header = reqHeaders
  3116. googleapi.Expand(req.URL, map[string]string{
  3117. "projectId": c.projectId,
  3118. "datasetId": c.datasetId,
  3119. })
  3120. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3121. }
  3122. // Do executes the "bigquery.datasets.get" call.
  3123. // Exactly one of *Dataset or error will be non-nil. Any non-2xx status
  3124. // code is an error. Response headers are in either
  3125. // *Dataset.ServerResponse.Header or (if a response was returned at all)
  3126. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  3127. // check whether the returned error was because http.StatusNotModified
  3128. // was returned.
  3129. func (c *DatasetsGetCall) Do(opts ...googleapi.CallOption) (*Dataset, error) {
  3130. gensupport.SetOptions(c.urlParams_, opts...)
  3131. res, err := c.doRequest("json")
  3132. if res != nil && res.StatusCode == http.StatusNotModified {
  3133. if res.Body != nil {
  3134. res.Body.Close()
  3135. }
  3136. return nil, &googleapi.Error{
  3137. Code: res.StatusCode,
  3138. Header: res.Header,
  3139. }
  3140. }
  3141. if err != nil {
  3142. return nil, err
  3143. }
  3144. defer googleapi.CloseBody(res)
  3145. if err := googleapi.CheckResponse(res); err != nil {
  3146. return nil, err
  3147. }
  3148. ret := &Dataset{
  3149. ServerResponse: googleapi.ServerResponse{
  3150. Header: res.Header,
  3151. HTTPStatusCode: res.StatusCode,
  3152. },
  3153. }
  3154. target := &ret
  3155. if err := gensupport.DecodeResponse(target, res); err != nil {
  3156. return nil, err
  3157. }
  3158. return ret, nil
  3159. // {
  3160. // "description": "Returns the dataset specified by datasetID.",
  3161. // "httpMethod": "GET",
  3162. // "id": "bigquery.datasets.get",
  3163. // "parameterOrder": [
  3164. // "projectId",
  3165. // "datasetId"
  3166. // ],
  3167. // "parameters": {
  3168. // "datasetId": {
  3169. // "description": "Dataset ID of the requested dataset",
  3170. // "location": "path",
  3171. // "required": true,
  3172. // "type": "string"
  3173. // },
  3174. // "projectId": {
  3175. // "description": "Project ID of the requested dataset",
  3176. // "location": "path",
  3177. // "required": true,
  3178. // "type": "string"
  3179. // }
  3180. // },
  3181. // "path": "projects/{projectId}/datasets/{datasetId}",
  3182. // "response": {
  3183. // "$ref": "Dataset"
  3184. // },
  3185. // "scopes": [
  3186. // "https://www.googleapis.com/auth/bigquery",
  3187. // "https://www.googleapis.com/auth/cloud-platform",
  3188. // "https://www.googleapis.com/auth/cloud-platform.read-only"
  3189. // ]
  3190. // }
  3191. }
  3192. // method id "bigquery.datasets.insert":
  3193. type DatasetsInsertCall struct {
  3194. s *Service
  3195. projectId string
  3196. dataset *Dataset
  3197. urlParams_ gensupport.URLParams
  3198. ctx_ context.Context
  3199. header_ http.Header
  3200. }
  3201. // Insert: Creates a new empty dataset.
  3202. func (r *DatasetsService) Insert(projectId string, dataset *Dataset) *DatasetsInsertCall {
  3203. c := &DatasetsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3204. c.projectId = projectId
  3205. c.dataset = dataset
  3206. return c
  3207. }
  3208. // Fields allows partial responses to be retrieved. See
  3209. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3210. // for more information.
  3211. func (c *DatasetsInsertCall) Fields(s ...googleapi.Field) *DatasetsInsertCall {
  3212. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3213. return c
  3214. }
  3215. // Context sets the context to be used in this call's Do method. Any
  3216. // pending HTTP request will be aborted if the provided context is
  3217. // canceled.
  3218. func (c *DatasetsInsertCall) Context(ctx context.Context) *DatasetsInsertCall {
  3219. c.ctx_ = ctx
  3220. return c
  3221. }
  3222. // Header returns an http.Header that can be modified by the caller to
  3223. // add HTTP headers to the request.
  3224. func (c *DatasetsInsertCall) Header() http.Header {
  3225. if c.header_ == nil {
  3226. c.header_ = make(http.Header)
  3227. }
  3228. return c.header_
  3229. }
  3230. func (c *DatasetsInsertCall) doRequest(alt string) (*http.Response, error) {
  3231. reqHeaders := make(http.Header)
  3232. for k, v := range c.header_ {
  3233. reqHeaders[k] = v
  3234. }
  3235. reqHeaders.Set("User-Agent", c.s.userAgent())
  3236. var body io.Reader = nil
  3237. body, err := googleapi.WithoutDataWrapper.JSONReader(c.dataset)
  3238. if err != nil {
  3239. return nil, err
  3240. }
  3241. reqHeaders.Set("Content-Type", "application/json")
  3242. c.urlParams_.Set("alt", alt)
  3243. urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{projectId}/datasets")
  3244. urls += "?" + c.urlParams_.Encode()
  3245. req, _ := http.NewRequest("POST", urls, body)
  3246. req.Header = reqHeaders
  3247. googleapi.Expand(req.URL, map[string]string{
  3248. "projectId": c.projectId,
  3249. })
  3250. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3251. }
  3252. // Do executes the "bigquery.datasets.insert" call.
  3253. // Exactly one of *Dataset or error will be non-nil. Any non-2xx status
  3254. // code is an error. Response headers are in either
  3255. // *Dataset.ServerResponse.Header or (if a response was returned at all)
  3256. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  3257. // check whether the returned error was because http.StatusNotModified
  3258. // was returned.
  3259. func (c *DatasetsInsertCall) Do(opts ...googleapi.CallOption) (*Dataset, error) {
  3260. gensupport.SetOptions(c.urlParams_, opts...)
  3261. res, err := c.doRequest("json")
  3262. if res != nil && res.StatusCode == http.StatusNotModified {
  3263. if res.Body != nil {
  3264. res.Body.Close()
  3265. }
  3266. return nil, &googleapi.Error{
  3267. Code: res.StatusCode,
  3268. Header: res.Header,
  3269. }
  3270. }
  3271. if err != nil {
  3272. return nil, err
  3273. }
  3274. defer googleapi.CloseBody(res)
  3275. if err := googleapi.CheckResponse(res); err != nil {
  3276. return nil, err
  3277. }
  3278. ret := &Dataset{
  3279. ServerResponse: googleapi.ServerResponse{
  3280. Header: res.Header,
  3281. HTTPStatusCode: res.StatusCode,
  3282. },
  3283. }
  3284. target := &ret
  3285. if err := gensupport.DecodeResponse(target, res); err != nil {
  3286. return nil, err
  3287. }
  3288. return ret, nil
  3289. // {
  3290. // "description": "Creates a new empty dataset.",
  3291. // "httpMethod": "POST",
  3292. // "id": "bigquery.datasets.insert",
  3293. // "parameterOrder": [
  3294. // "projectId"
  3295. // ],
  3296. // "parameters": {
  3297. // "projectId": {
  3298. // "description": "Project ID of the new dataset",
  3299. // "location": "path",
  3300. // "required": true,
  3301. // "type": "string"
  3302. // }
  3303. // },
  3304. // "path": "projects/{projectId}/datasets",
  3305. // "request": {
  3306. // "$ref": "Dataset"
  3307. // },
  3308. // "response": {
  3309. // "$ref": "Dataset"
  3310. // },
  3311. // "scopes": [
  3312. // "https://www.googleapis.com/auth/bigquery",
  3313. // "https://www.googleapis.com/auth/cloud-platform"
  3314. // ]
  3315. // }
  3316. }
  3317. // method id "bigquery.datasets.list":
  3318. type DatasetsListCall struct {
  3319. s *Service
  3320. projectId string
  3321. urlParams_ gensupport.URLParams
  3322. ifNoneMatch_ string
  3323. ctx_ context.Context
  3324. header_ http.Header
  3325. }
  3326. // List: Lists all datasets in the specified project to which you have
  3327. // been granted the READER dataset role.
  3328. func (r *DatasetsService) List(projectId string) *DatasetsListCall {
  3329. c := &DatasetsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3330. c.projectId = projectId
  3331. return c
  3332. }
  3333. // All sets the optional parameter "all": Whether to list all datasets,
  3334. // including hidden ones
  3335. func (c *DatasetsListCall) All(all bool) *DatasetsListCall {
  3336. c.urlParams_.Set("all", fmt.Sprint(all))
  3337. return c
  3338. }
  3339. // Filter sets the optional parameter "filter": An expression for
  3340. // filtering the results of the request by label. The syntax is
  3341. // "labels.<name>[:<value>]". Multiple filters can be ANDed together by
  3342. // connecting with a space. Example: "labels.department:receiving
  3343. // labels.active". See Filtering datasets using labels for details.
  3344. func (c *DatasetsListCall) Filter(filter string) *DatasetsListCall {
  3345. c.urlParams_.Set("filter", filter)
  3346. return c
  3347. }
  3348. // MaxResults sets the optional parameter "maxResults": The maximum
  3349. // number of results to return
  3350. func (c *DatasetsListCall) MaxResults(maxResults int64) *DatasetsListCall {
  3351. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  3352. return c
  3353. }
  3354. // PageToken sets the optional parameter "pageToken": Page token,
  3355. // returned by a previous call, to request the next page of results
  3356. func (c *DatasetsListCall) PageToken(pageToken string) *DatasetsListCall {
  3357. c.urlParams_.Set("pageToken", pageToken)
  3358. return c
  3359. }
  3360. // Fields allows partial responses to be retrieved. See
  3361. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3362. // for more information.
  3363. func (c *DatasetsListCall) Fields(s ...googleapi.Field) *DatasetsListCall {
  3364. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3365. return c
  3366. }
  3367. // IfNoneMatch sets the optional parameter which makes the operation
  3368. // fail if the object's ETag matches the given value. This is useful for
  3369. // getting updates only after the object has changed since the last
  3370. // request. Use googleapi.IsNotModified to check whether the response
  3371. // error from Do is the result of In-None-Match.
  3372. func (c *DatasetsListCall) IfNoneMatch(entityTag string) *DatasetsListCall {
  3373. c.ifNoneMatch_ = entityTag
  3374. return c
  3375. }
  3376. // Context sets the context to be used in this call's Do method. Any
  3377. // pending HTTP request will be aborted if the provided context is
  3378. // canceled.
  3379. func (c *DatasetsListCall) Context(ctx context.Context) *DatasetsListCall {
  3380. c.ctx_ = ctx
  3381. return c
  3382. }
  3383. // Header returns an http.Header that can be modified by the caller to
  3384. // add HTTP headers to the request.
  3385. func (c *DatasetsListCall) Header() http.Header {
  3386. if c.header_ == nil {
  3387. c.header_ = make(http.Header)
  3388. }
  3389. return c.header_
  3390. }
  3391. func (c *DatasetsListCall) doRequest(alt string) (*http.Response, error) {
  3392. reqHeaders := make(http.Header)
  3393. for k, v := range c.header_ {
  3394. reqHeaders[k] = v
  3395. }
  3396. reqHeaders.Set("User-Agent", c.s.userAgent())
  3397. if c.ifNoneMatch_ != "" {
  3398. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  3399. }
  3400. var body io.Reader = nil
  3401. c.urlParams_.Set("alt", alt)
  3402. urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{projectId}/datasets")
  3403. urls += "?" + c.urlParams_.Encode()
  3404. req, _ := http.NewRequest("GET", urls, body)
  3405. req.Header = reqHeaders
  3406. googleapi.Expand(req.URL, map[string]string{
  3407. "projectId": c.projectId,
  3408. })
  3409. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3410. }
  3411. // Do executes the "bigquery.datasets.list" call.
  3412. // Exactly one of *DatasetList or error will be non-nil. Any non-2xx
  3413. // status code is an error. Response headers are in either
  3414. // *DatasetList.ServerResponse.Header or (if a response was returned at
  3415. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  3416. // to check whether the returned error was because
  3417. // http.StatusNotModified was returned.
  3418. func (c *DatasetsListCall) Do(opts ...googleapi.CallOption) (*DatasetList, error) {
  3419. gensupport.SetOptions(c.urlParams_, opts...)
  3420. res, err := c.doRequest("json")
  3421. if res != nil && res.StatusCode == http.StatusNotModified {
  3422. if res.Body != nil {
  3423. res.Body.Close()
  3424. }
  3425. return nil, &googleapi.Error{
  3426. Code: res.StatusCode,
  3427. Header: res.Header,
  3428. }
  3429. }
  3430. if err != nil {
  3431. return nil, err
  3432. }
  3433. defer googleapi.CloseBody(res)
  3434. if err := googleapi.CheckResponse(res); err != nil {
  3435. return nil, err
  3436. }
  3437. ret := &DatasetList{
  3438. ServerResponse: googleapi.ServerResponse{
  3439. Header: res.Header,
  3440. HTTPStatusCode: res.StatusCode,
  3441. },
  3442. }
  3443. target := &ret
  3444. if err := gensupport.DecodeResponse(target, res); err != nil {
  3445. return nil, err
  3446. }
  3447. return ret, nil
  3448. // {
  3449. // "description": "Lists all datasets in the specified project to which you have been granted the READER dataset role.",
  3450. // "httpMethod": "GET",
  3451. // "id": "bigquery.datasets.list",
  3452. // "parameterOrder": [
  3453. // "projectId"
  3454. // ],
  3455. // "parameters": {
  3456. // "all": {
  3457. // "description": "Whether to list all datasets, including hidden ones",
  3458. // "location": "query",
  3459. // "type": "boolean"
  3460. // },
  3461. // "filter": {
  3462. // "description": "An expression for filtering the results of the request by label. The syntax is \"labels.\u003cname\u003e[:\u003cvalue\u003e]\". Multiple filters can be ANDed together by connecting with a space. Example: \"labels.department:receiving labels.active\". See Filtering datasets using labels for details.",
  3463. // "location": "query",
  3464. // "type": "string"
  3465. // },
  3466. // "maxResults": {
  3467. // "description": "The maximum number of results to return",
  3468. // "format": "uint32",
  3469. // "location": "query",
  3470. // "type": "integer"
  3471. // },
  3472. // "pageToken": {
  3473. // "description": "Page token, returned by a previous call, to request the next page of results",
  3474. // "location": "query",
  3475. // "type": "string"
  3476. // },
  3477. // "projectId": {
  3478. // "description": "Project ID of the datasets to be listed",
  3479. // "location": "path",
  3480. // "required": true,
  3481. // "type": "string"
  3482. // }
  3483. // },
  3484. // "path": "projects/{projectId}/datasets",
  3485. // "response": {
  3486. // "$ref": "DatasetList"
  3487. // },
  3488. // "scopes": [
  3489. // "https://www.googleapis.com/auth/bigquery",
  3490. // "https://www.googleapis.com/auth/cloud-platform",
  3491. // "https://www.googleapis.com/auth/cloud-platform.read-only"
  3492. // ]
  3493. // }
  3494. }
  3495. // Pages invokes f for each page of results.
  3496. // A non-nil error returned from f will halt the iteration.
  3497. // The provided context supersedes any context provided to the Context method.
  3498. func (c *DatasetsListCall) Pages(ctx context.Context, f func(*DatasetList) error) error {
  3499. c.ctx_ = ctx
  3500. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  3501. for {
  3502. x, err := c.Do()
  3503. if err != nil {
  3504. return err
  3505. }
  3506. if err := f(x); err != nil {
  3507. return err
  3508. }
  3509. if x.NextPageToken == "" {
  3510. return nil
  3511. }
  3512. c.PageToken(x.NextPageToken)
  3513. }
  3514. }
  3515. // method id "bigquery.datasets.patch":
  3516. type DatasetsPatchCall struct {
  3517. s *Service
  3518. projectId string
  3519. datasetId string
  3520. dataset *Dataset
  3521. urlParams_ gensupport.URLParams
  3522. ctx_ context.Context
  3523. header_ http.Header
  3524. }
  3525. // Patch: Updates information in an existing dataset. The update method
  3526. // replaces the entire dataset resource, whereas the patch method only
  3527. // replaces fields that are provided in the submitted dataset resource.
  3528. // This method supports patch semantics.
  3529. func (r *DatasetsService) Patch(projectId string, datasetId string, dataset *Dataset) *DatasetsPatchCall {
  3530. c := &DatasetsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3531. c.projectId = projectId
  3532. c.datasetId = datasetId
  3533. c.dataset = dataset
  3534. return c
  3535. }
  3536. // Fields allows partial responses to be retrieved. See
  3537. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3538. // for more information.
  3539. func (c *DatasetsPatchCall) Fields(s ...googleapi.Field) *DatasetsPatchCall {
  3540. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3541. return c
  3542. }
  3543. // Context sets the context to be used in this call's Do method. Any
  3544. // pending HTTP request will be aborted if the provided context is
  3545. // canceled.
  3546. func (c *DatasetsPatchCall) Context(ctx context.Context) *DatasetsPatchCall {
  3547. c.ctx_ = ctx
  3548. return c
  3549. }
  3550. // Header returns an http.Header that can be modified by the caller to
  3551. // add HTTP headers to the request.
  3552. func (c *DatasetsPatchCall) Header() http.Header {
  3553. if c.header_ == nil {
  3554. c.header_ = make(http.Header)
  3555. }
  3556. return c.header_
  3557. }
  3558. func (c *DatasetsPatchCall) doRequest(alt string) (*http.Response, error) {
  3559. reqHeaders := make(http.Header)
  3560. for k, v := range c.header_ {
  3561. reqHeaders[k] = v
  3562. }
  3563. reqHeaders.Set("User-Agent", c.s.userAgent())
  3564. var body io.Reader = nil
  3565. body, err := googleapi.WithoutDataWrapper.JSONReader(c.dataset)
  3566. if err != nil {
  3567. return nil, err
  3568. }
  3569. reqHeaders.Set("Content-Type", "application/json")
  3570. c.urlParams_.Set("alt", alt)
  3571. urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{projectId}/datasets/{datasetId}")
  3572. urls += "?" + c.urlParams_.Encode()
  3573. req, _ := http.NewRequest("PATCH", urls, body)
  3574. req.Header = reqHeaders
  3575. googleapi.Expand(req.URL, map[string]string{
  3576. "projectId": c.projectId,
  3577. "datasetId": c.datasetId,
  3578. })
  3579. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3580. }
  3581. // Do executes the "bigquery.datasets.patch" call.
  3582. // Exactly one of *Dataset or error will be non-nil. Any non-2xx status
  3583. // code is an error. Response headers are in either
  3584. // *Dataset.ServerResponse.Header or (if a response was returned at all)
  3585. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  3586. // check whether the returned error was because http.StatusNotModified
  3587. // was returned.
  3588. func (c *DatasetsPatchCall) Do(opts ...googleapi.CallOption) (*Dataset, error) {
  3589. gensupport.SetOptions(c.urlParams_, opts...)
  3590. res, err := c.doRequest("json")
  3591. if res != nil && res.StatusCode == http.StatusNotModified {
  3592. if res.Body != nil {
  3593. res.Body.Close()
  3594. }
  3595. return nil, &googleapi.Error{
  3596. Code: res.StatusCode,
  3597. Header: res.Header,
  3598. }
  3599. }
  3600. if err != nil {
  3601. return nil, err
  3602. }
  3603. defer googleapi.CloseBody(res)
  3604. if err := googleapi.CheckResponse(res); err != nil {
  3605. return nil, err
  3606. }
  3607. ret := &Dataset{
  3608. ServerResponse: googleapi.ServerResponse{
  3609. Header: res.Header,
  3610. HTTPStatusCode: res.StatusCode,
  3611. },
  3612. }
  3613. target := &ret
  3614. if err := gensupport.DecodeResponse(target, res); err != nil {
  3615. return nil, err
  3616. }
  3617. return ret, nil
  3618. // {
  3619. // "description": "Updates information in an existing dataset. The update method replaces the entire dataset resource, whereas the patch method only replaces fields that are provided in the submitted dataset resource. This method supports patch semantics.",
  3620. // "httpMethod": "PATCH",
  3621. // "id": "bigquery.datasets.patch",
  3622. // "parameterOrder": [
  3623. // "projectId",
  3624. // "datasetId"
  3625. // ],
  3626. // "parameters": {
  3627. // "datasetId": {
  3628. // "description": "Dataset ID of the dataset being updated",
  3629. // "location": "path",
  3630. // "required": true,
  3631. // "type": "string"
  3632. // },
  3633. // "projectId": {
  3634. // "description": "Project ID of the dataset being updated",
  3635. // "location": "path",
  3636. // "required": true,
  3637. // "type": "string"
  3638. // }
  3639. // },
  3640. // "path": "projects/{projectId}/datasets/{datasetId}",
  3641. // "request": {
  3642. // "$ref": "Dataset"
  3643. // },
  3644. // "response": {
  3645. // "$ref": "Dataset"
  3646. // },
  3647. // "scopes": [
  3648. // "https://www.googleapis.com/auth/bigquery",
  3649. // "https://www.googleapis.com/auth/cloud-platform"
  3650. // ]
  3651. // }
  3652. }
  3653. // method id "bigquery.datasets.update":
  3654. type DatasetsUpdateCall struct {
  3655. s *Service
  3656. projectId string
  3657. datasetId string
  3658. dataset *Dataset
  3659. urlParams_ gensupport.URLParams
  3660. ctx_ context.Context
  3661. header_ http.Header
  3662. }
  3663. // Update: Updates information in an existing dataset. The update method
  3664. // replaces the entire dataset resource, whereas the patch method only
  3665. // replaces fields that are provided in the submitted dataset resource.
  3666. func (r *DatasetsService) Update(projectId string, datasetId string, dataset *Dataset) *DatasetsUpdateCall {
  3667. c := &DatasetsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3668. c.projectId = projectId
  3669. c.datasetId = datasetId
  3670. c.dataset = dataset
  3671. return c
  3672. }
  3673. // Fields allows partial responses to be retrieved. See
  3674. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3675. // for more information.
  3676. func (c *DatasetsUpdateCall) Fields(s ...googleapi.Field) *DatasetsUpdateCall {
  3677. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3678. return c
  3679. }
  3680. // Context sets the context to be used in this call's Do method. Any
  3681. // pending HTTP request will be aborted if the provided context is
  3682. // canceled.
  3683. func (c *DatasetsUpdateCall) Context(ctx context.Context) *DatasetsUpdateCall {
  3684. c.ctx_ = ctx
  3685. return c
  3686. }
  3687. // Header returns an http.Header that can be modified by the caller to
  3688. // add HTTP headers to the request.
  3689. func (c *DatasetsUpdateCall) Header() http.Header {
  3690. if c.header_ == nil {
  3691. c.header_ = make(http.Header)
  3692. }
  3693. return c.header_
  3694. }
  3695. func (c *DatasetsUpdateCall) doRequest(alt string) (*http.Response, error) {
  3696. reqHeaders := make(http.Header)
  3697. for k, v := range c.header_ {
  3698. reqHeaders[k] = v
  3699. }
  3700. reqHeaders.Set("User-Agent", c.s.userAgent())
  3701. var body io.Reader = nil
  3702. body, err := googleapi.WithoutDataWrapper.JSONReader(c.dataset)
  3703. if err != nil {
  3704. return nil, err
  3705. }
  3706. reqHeaders.Set("Content-Type", "application/json")
  3707. c.urlParams_.Set("alt", alt)
  3708. urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{projectId}/datasets/{datasetId}")
  3709. urls += "?" + c.urlParams_.Encode()
  3710. req, _ := http.NewRequest("PUT", urls, body)
  3711. req.Header = reqHeaders
  3712. googleapi.Expand(req.URL, map[string]string{
  3713. "projectId": c.projectId,
  3714. "datasetId": c.datasetId,
  3715. })
  3716. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3717. }
  3718. // Do executes the "bigquery.datasets.update" call.
  3719. // Exactly one of *Dataset or error will be non-nil. Any non-2xx status
  3720. // code is an error. Response headers are in either
  3721. // *Dataset.ServerResponse.Header or (if a response was returned at all)
  3722. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  3723. // check whether the returned error was because http.StatusNotModified
  3724. // was returned.
  3725. func (c *DatasetsUpdateCall) Do(opts ...googleapi.CallOption) (*Dataset, error) {
  3726. gensupport.SetOptions(c.urlParams_, opts...)
  3727. res, err := c.doRequest("json")
  3728. if res != nil && res.StatusCode == http.StatusNotModified {
  3729. if res.Body != nil {
  3730. res.Body.Close()
  3731. }
  3732. return nil, &googleapi.Error{
  3733. Code: res.StatusCode,
  3734. Header: res.Header,
  3735. }
  3736. }
  3737. if err != nil {
  3738. return nil, err
  3739. }
  3740. defer googleapi.CloseBody(res)
  3741. if err := googleapi.CheckResponse(res); err != nil {
  3742. return nil, err
  3743. }
  3744. ret := &Dataset{
  3745. ServerResponse: googleapi.ServerResponse{
  3746. Header: res.Header,
  3747. HTTPStatusCode: res.StatusCode,
  3748. },
  3749. }
  3750. target := &ret
  3751. if err := gensupport.DecodeResponse(target, res); err != nil {
  3752. return nil, err
  3753. }
  3754. return ret, nil
  3755. // {
  3756. // "description": "Updates information in an existing dataset. The update method replaces the entire dataset resource, whereas the patch method only replaces fields that are provided in the submitted dataset resource.",
  3757. // "httpMethod": "PUT",
  3758. // "id": "bigquery.datasets.update",
  3759. // "parameterOrder": [
  3760. // "projectId",
  3761. // "datasetId"
  3762. // ],
  3763. // "parameters": {
  3764. // "datasetId": {
  3765. // "description": "Dataset ID of the dataset being updated",
  3766. // "location": "path",
  3767. // "required": true,
  3768. // "type": "string"
  3769. // },
  3770. // "projectId": {
  3771. // "description": "Project ID of the dataset being updated",
  3772. // "location": "path",
  3773. // "required": true,
  3774. // "type": "string"
  3775. // }
  3776. // },
  3777. // "path": "projects/{projectId}/datasets/{datasetId}",
  3778. // "request": {
  3779. // "$ref": "Dataset"
  3780. // },
  3781. // "response": {
  3782. // "$ref": "Dataset"
  3783. // },
  3784. // "scopes": [
  3785. // "https://www.googleapis.com/auth/bigquery",
  3786. // "https://www.googleapis.com/auth/cloud-platform"
  3787. // ]
  3788. // }
  3789. }
  3790. // method id "bigquery.jobs.cancel":
  3791. type JobsCancelCall struct {
  3792. s *Service
  3793. projectId string
  3794. jobId string
  3795. urlParams_ gensupport.URLParams
  3796. ctx_ context.Context
  3797. header_ http.Header
  3798. }
  3799. // Cancel: Requests that a job be cancelled. This call will return
  3800. // immediately, and the client will need to poll for the job status to
  3801. // see if the cancel completed successfully. Cancelled jobs may still
  3802. // incur costs.
  3803. func (r *JobsService) Cancel(projectId string, jobId string) *JobsCancelCall {
  3804. c := &JobsCancelCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3805. c.projectId = projectId
  3806. c.jobId = jobId
  3807. return c
  3808. }
  3809. // Location sets the optional parameter "location": [Experimental] The
  3810. // geographic location of the job. Required except for US and EU. See
  3811. // details at
  3812. // https://cloud.google.com/bigquery/docs/dataset-locations#specifying_your_location.
  3813. func (c *JobsCancelCall) Location(location string) *JobsCancelCall {
  3814. c.urlParams_.Set("location", location)
  3815. return c
  3816. }
  3817. // Fields allows partial responses to be retrieved. See
  3818. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3819. // for more information.
  3820. func (c *JobsCancelCall) Fields(s ...googleapi.Field) *JobsCancelCall {
  3821. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3822. return c
  3823. }
  3824. // Context sets the context to be used in this call's Do method. Any
  3825. // pending HTTP request will be aborted if the provided context is
  3826. // canceled.
  3827. func (c *JobsCancelCall) Context(ctx context.Context) *JobsCancelCall {
  3828. c.ctx_ = ctx
  3829. return c
  3830. }
  3831. // Header returns an http.Header that can be modified by the caller to
  3832. // add HTTP headers to the request.
  3833. func (c *JobsCancelCall) Header() http.Header {
  3834. if c.header_ == nil {
  3835. c.header_ = make(http.Header)
  3836. }
  3837. return c.header_
  3838. }
  3839. func (c *JobsCancelCall) doRequest(alt string) (*http.Response, error) {
  3840. reqHeaders := make(http.Header)
  3841. for k, v := range c.header_ {
  3842. reqHeaders[k] = v
  3843. }
  3844. reqHeaders.Set("User-Agent", c.s.userAgent())
  3845. var body io.Reader = nil
  3846. c.urlParams_.Set("alt", alt)
  3847. urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{projectId}/jobs/{jobId}/cancel")
  3848. urls += "?" + c.urlParams_.Encode()
  3849. req, _ := http.NewRequest("POST", urls, body)
  3850. req.Header = reqHeaders
  3851. googleapi.Expand(req.URL, map[string]string{
  3852. "projectId": c.projectId,
  3853. "jobId": c.jobId,
  3854. })
  3855. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3856. }
  3857. // Do executes the "bigquery.jobs.cancel" call.
  3858. // Exactly one of *JobCancelResponse or error will be non-nil. Any
  3859. // non-2xx status code is an error. Response headers are in either
  3860. // *JobCancelResponse.ServerResponse.Header or (if a response was
  3861. // returned at all) in error.(*googleapi.Error).Header. Use
  3862. // googleapi.IsNotModified to check whether the returned error was
  3863. // because http.StatusNotModified was returned.
  3864. func (c *JobsCancelCall) Do(opts ...googleapi.CallOption) (*JobCancelResponse, error) {
  3865. gensupport.SetOptions(c.urlParams_, opts...)
  3866. res, err := c.doRequest("json")
  3867. if res != nil && res.StatusCode == http.StatusNotModified {
  3868. if res.Body != nil {
  3869. res.Body.Close()
  3870. }
  3871. return nil, &googleapi.Error{
  3872. Code: res.StatusCode,
  3873. Header: res.Header,
  3874. }
  3875. }
  3876. if err != nil {
  3877. return nil, err
  3878. }
  3879. defer googleapi.CloseBody(res)
  3880. if err := googleapi.CheckResponse(res); err != nil {
  3881. return nil, err
  3882. }
  3883. ret := &JobCancelResponse{
  3884. ServerResponse: googleapi.ServerResponse{
  3885. Header: res.Header,
  3886. HTTPStatusCode: res.StatusCode,
  3887. },
  3888. }
  3889. target := &ret
  3890. if err := gensupport.DecodeResponse(target, res); err != nil {
  3891. return nil, err
  3892. }
  3893. return ret, nil
  3894. // {
  3895. // "description": "Requests that a job be cancelled. This call will return immediately, and the client will need to poll for the job status to see if the cancel completed successfully. Cancelled jobs may still incur costs.",
  3896. // "httpMethod": "POST",
  3897. // "id": "bigquery.jobs.cancel",
  3898. // "parameterOrder": [
  3899. // "projectId",
  3900. // "jobId"
  3901. // ],
  3902. // "parameters": {
  3903. // "jobId": {
  3904. // "description": "[Required] Job ID of the job to cancel",
  3905. // "location": "path",
  3906. // "required": true,
  3907. // "type": "string"
  3908. // },
  3909. // "location": {
  3910. // "description": "[Experimental] The geographic location of the job. Required except for US and EU. See details at https://cloud.google.com/bigquery/docs/dataset-locations#specifying_your_location.",
  3911. // "location": "query",
  3912. // "type": "string"
  3913. // },
  3914. // "projectId": {
  3915. // "description": "[Required] Project ID of the job to cancel",
  3916. // "location": "path",
  3917. // "required": true,
  3918. // "type": "string"
  3919. // }
  3920. // },
  3921. // "path": "projects/{projectId}/jobs/{jobId}/cancel",
  3922. // "response": {
  3923. // "$ref": "JobCancelResponse"
  3924. // },
  3925. // "scopes": [
  3926. // "https://www.googleapis.com/auth/bigquery",
  3927. // "https://www.googleapis.com/auth/cloud-platform"
  3928. // ]
  3929. // }
  3930. }
  3931. // method id "bigquery.jobs.get":
  3932. type JobsGetCall struct {
  3933. s *Service
  3934. projectId string
  3935. jobId string
  3936. urlParams_ gensupport.URLParams
  3937. ifNoneMatch_ string
  3938. ctx_ context.Context
  3939. header_ http.Header
  3940. }
  3941. // Get: Returns information about a specific job. Job information is
  3942. // available for a six month period after creation. Requires that you're
  3943. // the person who ran the job, or have the Is Owner project role.
  3944. func (r *JobsService) Get(projectId string, jobId string) *JobsGetCall {
  3945. c := &JobsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3946. c.projectId = projectId
  3947. c.jobId = jobId
  3948. return c
  3949. }
  3950. // Location sets the optional parameter "location": [Experimental] The
  3951. // geographic location of the job. Required except for US and EU. See
  3952. // details at
  3953. // https://cloud.google.com/bigquery/docs/dataset-locations#specifying_your_location.
  3954. func (c *JobsGetCall) Location(location string) *JobsGetCall {
  3955. c.urlParams_.Set("location", location)
  3956. return c
  3957. }
  3958. // Fields allows partial responses to be retrieved. See
  3959. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3960. // for more information.
  3961. func (c *JobsGetCall) Fields(s ...googleapi.Field) *JobsGetCall {
  3962. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3963. return c
  3964. }
  3965. // IfNoneMatch sets the optional parameter which makes the operation
  3966. // fail if the object's ETag matches the given value. This is useful for
  3967. // getting updates only after the object has changed since the last
  3968. // request. Use googleapi.IsNotModified to check whether the response
  3969. // error from Do is the result of In-None-Match.
  3970. func (c *JobsGetCall) IfNoneMatch(entityTag string) *JobsGetCall {
  3971. c.ifNoneMatch_ = entityTag
  3972. return c
  3973. }
  3974. // Context sets the context to be used in this call's Do method. Any
  3975. // pending HTTP request will be aborted if the provided context is
  3976. // canceled.
  3977. func (c *JobsGetCall) Context(ctx context.Context) *JobsGetCall {
  3978. c.ctx_ = ctx
  3979. return c
  3980. }
  3981. // Header returns an http.Header that can be modified by the caller to
  3982. // add HTTP headers to the request.
  3983. func (c *JobsGetCall) Header() http.Header {
  3984. if c.header_ == nil {
  3985. c.header_ = make(http.Header)
  3986. }
  3987. return c.header_
  3988. }
  3989. func (c *JobsGetCall) doRequest(alt string) (*http.Response, error) {
  3990. reqHeaders := make(http.Header)
  3991. for k, v := range c.header_ {
  3992. reqHeaders[k] = v
  3993. }
  3994. reqHeaders.Set("User-Agent", c.s.userAgent())
  3995. if c.ifNoneMatch_ != "" {
  3996. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  3997. }
  3998. var body io.Reader = nil
  3999. c.urlParams_.Set("alt", alt)
  4000. urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{projectId}/jobs/{jobId}")
  4001. urls += "?" + c.urlParams_.Encode()
  4002. req, _ := http.NewRequest("GET", urls, body)
  4003. req.Header = reqHeaders
  4004. googleapi.Expand(req.URL, map[string]string{
  4005. "projectId": c.projectId,
  4006. "jobId": c.jobId,
  4007. })
  4008. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4009. }
  4010. // Do executes the "bigquery.jobs.get" call.
  4011. // Exactly one of *Job or error will be non-nil. Any non-2xx status code
  4012. // is an error. Response headers are in either
  4013. // *Job.ServerResponse.Header or (if a response was returned at all) in
  4014. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  4015. // whether the returned error was because http.StatusNotModified was
  4016. // returned.
  4017. func (c *JobsGetCall) Do(opts ...googleapi.CallOption) (*Job, error) {
  4018. gensupport.SetOptions(c.urlParams_, opts...)
  4019. res, err := c.doRequest("json")
  4020. if res != nil && res.StatusCode == http.StatusNotModified {
  4021. if res.Body != nil {
  4022. res.Body.Close()
  4023. }
  4024. return nil, &googleapi.Error{
  4025. Code: res.StatusCode,
  4026. Header: res.Header,
  4027. }
  4028. }
  4029. if err != nil {
  4030. return nil, err
  4031. }
  4032. defer googleapi.CloseBody(res)
  4033. if err := googleapi.CheckResponse(res); err != nil {
  4034. return nil, err
  4035. }
  4036. ret := &Job{
  4037. ServerResponse: googleapi.ServerResponse{
  4038. Header: res.Header,
  4039. HTTPStatusCode: res.StatusCode,
  4040. },
  4041. }
  4042. target := &ret
  4043. if err := gensupport.DecodeResponse(target, res); err != nil {
  4044. return nil, err
  4045. }
  4046. return ret, nil
  4047. // {
  4048. // "description": "Returns information about a specific job. Job information is available for a six month period after creation. Requires that you're the person who ran the job, or have the Is Owner project role.",
  4049. // "httpMethod": "GET",
  4050. // "id": "bigquery.jobs.get",
  4051. // "parameterOrder": [
  4052. // "projectId",
  4053. // "jobId"
  4054. // ],
  4055. // "parameters": {
  4056. // "jobId": {
  4057. // "description": "[Required] Job ID of the requested job",
  4058. // "location": "path",
  4059. // "required": true,
  4060. // "type": "string"
  4061. // },
  4062. // "location": {
  4063. // "description": "[Experimental] The geographic location of the job. Required except for US and EU. See details at https://cloud.google.com/bigquery/docs/dataset-locations#specifying_your_location.",
  4064. // "location": "query",
  4065. // "type": "string"
  4066. // },
  4067. // "projectId": {
  4068. // "description": "[Required] Project ID of the requested job",
  4069. // "location": "path",
  4070. // "required": true,
  4071. // "type": "string"
  4072. // }
  4073. // },
  4074. // "path": "projects/{projectId}/jobs/{jobId}",
  4075. // "response": {
  4076. // "$ref": "Job"
  4077. // },
  4078. // "scopes": [
  4079. // "https://www.googleapis.com/auth/bigquery",
  4080. // "https://www.googleapis.com/auth/cloud-platform",
  4081. // "https://www.googleapis.com/auth/cloud-platform.read-only"
  4082. // ]
  4083. // }
  4084. }
  4085. // method id "bigquery.jobs.getQueryResults":
  4086. type JobsGetQueryResultsCall struct {
  4087. s *Service
  4088. projectId string
  4089. jobId string
  4090. urlParams_ gensupport.URLParams
  4091. ifNoneMatch_ string
  4092. ctx_ context.Context
  4093. header_ http.Header
  4094. }
  4095. // GetQueryResults: Retrieves the results of a query job.
  4096. func (r *JobsService) GetQueryResults(projectId string, jobId string) *JobsGetQueryResultsCall {
  4097. c := &JobsGetQueryResultsCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4098. c.projectId = projectId
  4099. c.jobId = jobId
  4100. return c
  4101. }
  4102. // Location sets the optional parameter "location": [Experimental] The
  4103. // geographic location where the job should run. Required except for US
  4104. // and EU. See details at
  4105. // https://cloud.google.com/bigquery/docs/dataset-locations#specifying_your_location.
  4106. func (c *JobsGetQueryResultsCall) Location(location string) *JobsGetQueryResultsCall {
  4107. c.urlParams_.Set("location", location)
  4108. return c
  4109. }
  4110. // MaxResults sets the optional parameter "maxResults": Maximum number
  4111. // of results to read
  4112. func (c *JobsGetQueryResultsCall) MaxResults(maxResults int64) *JobsGetQueryResultsCall {
  4113. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  4114. return c
  4115. }
  4116. // PageToken sets the optional parameter "pageToken": Page token,
  4117. // returned by a previous call, to request the next page of results
  4118. func (c *JobsGetQueryResultsCall) PageToken(pageToken string) *JobsGetQueryResultsCall {
  4119. c.urlParams_.Set("pageToken", pageToken)
  4120. return c
  4121. }
  4122. // StartIndex sets the optional parameter "startIndex": Zero-based index
  4123. // of the starting row
  4124. func (c *JobsGetQueryResultsCall) StartIndex(startIndex uint64) *JobsGetQueryResultsCall {
  4125. c.urlParams_.Set("startIndex", fmt.Sprint(startIndex))
  4126. return c
  4127. }
  4128. // TimeoutMs sets the optional parameter "timeoutMs": How long to wait
  4129. // for the query to complete, in milliseconds, before returning. Default
  4130. // is 10 seconds. If the timeout passes before the job completes, the
  4131. // 'jobComplete' field in the response will be false
  4132. func (c *JobsGetQueryResultsCall) TimeoutMs(timeoutMs int64) *JobsGetQueryResultsCall {
  4133. c.urlParams_.Set("timeoutMs", fmt.Sprint(timeoutMs))
  4134. return c
  4135. }
  4136. // Fields allows partial responses to be retrieved. See
  4137. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4138. // for more information.
  4139. func (c *JobsGetQueryResultsCall) Fields(s ...googleapi.Field) *JobsGetQueryResultsCall {
  4140. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4141. return c
  4142. }
  4143. // IfNoneMatch sets the optional parameter which makes the operation
  4144. // fail if the object's ETag matches the given value. This is useful for
  4145. // getting updates only after the object has changed since the last
  4146. // request. Use googleapi.IsNotModified to check whether the response
  4147. // error from Do is the result of In-None-Match.
  4148. func (c *JobsGetQueryResultsCall) IfNoneMatch(entityTag string) *JobsGetQueryResultsCall {
  4149. c.ifNoneMatch_ = entityTag
  4150. return c
  4151. }
  4152. // Context sets the context to be used in this call's Do method. Any
  4153. // pending HTTP request will be aborted if the provided context is
  4154. // canceled.
  4155. func (c *JobsGetQueryResultsCall) Context(ctx context.Context) *JobsGetQueryResultsCall {
  4156. c.ctx_ = ctx
  4157. return c
  4158. }
  4159. // Header returns an http.Header that can be modified by the caller to
  4160. // add HTTP headers to the request.
  4161. func (c *JobsGetQueryResultsCall) Header() http.Header {
  4162. if c.header_ == nil {
  4163. c.header_ = make(http.Header)
  4164. }
  4165. return c.header_
  4166. }
  4167. func (c *JobsGetQueryResultsCall) doRequest(alt string) (*http.Response, error) {
  4168. reqHeaders := make(http.Header)
  4169. for k, v := range c.header_ {
  4170. reqHeaders[k] = v
  4171. }
  4172. reqHeaders.Set("User-Agent", c.s.userAgent())
  4173. if c.ifNoneMatch_ != "" {
  4174. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  4175. }
  4176. var body io.Reader = nil
  4177. c.urlParams_.Set("alt", alt)
  4178. urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{projectId}/queries/{jobId}")
  4179. urls += "?" + c.urlParams_.Encode()
  4180. req, _ := http.NewRequest("GET", urls, body)
  4181. req.Header = reqHeaders
  4182. googleapi.Expand(req.URL, map[string]string{
  4183. "projectId": c.projectId,
  4184. "jobId": c.jobId,
  4185. })
  4186. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4187. }
  4188. // Do executes the "bigquery.jobs.getQueryResults" call.
  4189. // Exactly one of *GetQueryResultsResponse or error will be non-nil. Any
  4190. // non-2xx status code is an error. Response headers are in either
  4191. // *GetQueryResultsResponse.ServerResponse.Header or (if a response was
  4192. // returned at all) in error.(*googleapi.Error).Header. Use
  4193. // googleapi.IsNotModified to check whether the returned error was
  4194. // because http.StatusNotModified was returned.
  4195. func (c *JobsGetQueryResultsCall) Do(opts ...googleapi.CallOption) (*GetQueryResultsResponse, error) {
  4196. gensupport.SetOptions(c.urlParams_, opts...)
  4197. res, err := c.doRequest("json")
  4198. if res != nil && res.StatusCode == http.StatusNotModified {
  4199. if res.Body != nil {
  4200. res.Body.Close()
  4201. }
  4202. return nil, &googleapi.Error{
  4203. Code: res.StatusCode,
  4204. Header: res.Header,
  4205. }
  4206. }
  4207. if err != nil {
  4208. return nil, err
  4209. }
  4210. defer googleapi.CloseBody(res)
  4211. if err := googleapi.CheckResponse(res); err != nil {
  4212. return nil, err
  4213. }
  4214. ret := &GetQueryResultsResponse{
  4215. ServerResponse: googleapi.ServerResponse{
  4216. Header: res.Header,
  4217. HTTPStatusCode: res.StatusCode,
  4218. },
  4219. }
  4220. target := &ret
  4221. if err := gensupport.DecodeResponse(target, res); err != nil {
  4222. return nil, err
  4223. }
  4224. return ret, nil
  4225. // {
  4226. // "description": "Retrieves the results of a query job.",
  4227. // "httpMethod": "GET",
  4228. // "id": "bigquery.jobs.getQueryResults",
  4229. // "parameterOrder": [
  4230. // "projectId",
  4231. // "jobId"
  4232. // ],
  4233. // "parameters": {
  4234. // "jobId": {
  4235. // "description": "[Required] Job ID of the query job",
  4236. // "location": "path",
  4237. // "required": true,
  4238. // "type": "string"
  4239. // },
  4240. // "location": {
  4241. // "description": "[Experimental] The geographic location where the job should run. Required except for US and EU. See details at https://cloud.google.com/bigquery/docs/dataset-locations#specifying_your_location.",
  4242. // "location": "query",
  4243. // "type": "string"
  4244. // },
  4245. // "maxResults": {
  4246. // "description": "Maximum number of results to read",
  4247. // "format": "uint32",
  4248. // "location": "query",
  4249. // "type": "integer"
  4250. // },
  4251. // "pageToken": {
  4252. // "description": "Page token, returned by a previous call, to request the next page of results",
  4253. // "location": "query",
  4254. // "type": "string"
  4255. // },
  4256. // "projectId": {
  4257. // "description": "[Required] Project ID of the query job",
  4258. // "location": "path",
  4259. // "required": true,
  4260. // "type": "string"
  4261. // },
  4262. // "startIndex": {
  4263. // "description": "Zero-based index of the starting row",
  4264. // "format": "uint64",
  4265. // "location": "query",
  4266. // "type": "string"
  4267. // },
  4268. // "timeoutMs": {
  4269. // "description": "How long to wait for the query to complete, in milliseconds, before returning. Default is 10 seconds. If the timeout passes before the job completes, the 'jobComplete' field in the response will be false",
  4270. // "format": "uint32",
  4271. // "location": "query",
  4272. // "type": "integer"
  4273. // }
  4274. // },
  4275. // "path": "projects/{projectId}/queries/{jobId}",
  4276. // "response": {
  4277. // "$ref": "GetQueryResultsResponse"
  4278. // },
  4279. // "scopes": [
  4280. // "https://www.googleapis.com/auth/bigquery",
  4281. // "https://www.googleapis.com/auth/cloud-platform",
  4282. // "https://www.googleapis.com/auth/cloud-platform.read-only"
  4283. // ]
  4284. // }
  4285. }
  4286. // Pages invokes f for each page of results.
  4287. // A non-nil error returned from f will halt the iteration.
  4288. // The provided context supersedes any context provided to the Context method.
  4289. func (c *JobsGetQueryResultsCall) Pages(ctx context.Context, f func(*GetQueryResultsResponse) error) error {
  4290. c.ctx_ = ctx
  4291. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  4292. for {
  4293. x, err := c.Do()
  4294. if err != nil {
  4295. return err
  4296. }
  4297. if err := f(x); err != nil {
  4298. return err
  4299. }
  4300. if x.PageToken == "" {
  4301. return nil
  4302. }
  4303. c.PageToken(x.PageToken)
  4304. }
  4305. }
  4306. // method id "bigquery.jobs.insert":
  4307. type JobsInsertCall struct {
  4308. s *Service
  4309. projectId string
  4310. job *Job
  4311. urlParams_ gensupport.URLParams
  4312. mediaInfo_ *gensupport.MediaInfo
  4313. ctx_ context.Context
  4314. header_ http.Header
  4315. }
  4316. // Insert: Starts a new asynchronous job. Requires the Can View project
  4317. // role.
  4318. func (r *JobsService) Insert(projectId string, job *Job) *JobsInsertCall {
  4319. c := &JobsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4320. c.projectId = projectId
  4321. c.job = job
  4322. return c
  4323. }
  4324. // Media specifies the media to upload in one or more chunks. The chunk
  4325. // size may be controlled by supplying a MediaOption generated by
  4326. // googleapi.ChunkSize. The chunk size defaults to
  4327. // googleapi.DefaultUploadChunkSize.The Content-Type header used in the
  4328. // upload request will be determined by sniffing the contents of r,
  4329. // unless a MediaOption generated by googleapi.ContentType is
  4330. // supplied.
  4331. // At most one of Media and ResumableMedia may be set.
  4332. func (c *JobsInsertCall) Media(r io.Reader, options ...googleapi.MediaOption) *JobsInsertCall {
  4333. c.mediaInfo_ = gensupport.NewInfoFromMedia(r, options)
  4334. return c
  4335. }
  4336. // ResumableMedia specifies the media to upload in chunks and can be
  4337. // canceled with ctx.
  4338. //
  4339. // Deprecated: use Media instead.
  4340. //
  4341. // At most one of Media and ResumableMedia may be set. mediaType
  4342. // identifies the MIME media type of the upload, such as "image/png". If
  4343. // mediaType is "", it will be auto-detected. The provided ctx will
  4344. // supersede any context previously provided to the Context method.
  4345. func (c *JobsInsertCall) ResumableMedia(ctx context.Context, r io.ReaderAt, size int64, mediaType string) *JobsInsertCall {
  4346. c.ctx_ = ctx
  4347. c.mediaInfo_ = gensupport.NewInfoFromResumableMedia(r, size, mediaType)
  4348. return c
  4349. }
  4350. // ProgressUpdater provides a callback function that will be called
  4351. // after every chunk. It should be a low-latency function in order to
  4352. // not slow down the upload operation. This should only be called when
  4353. // using ResumableMedia (as opposed to Media).
  4354. func (c *JobsInsertCall) ProgressUpdater(pu googleapi.ProgressUpdater) *JobsInsertCall {
  4355. c.mediaInfo_.SetProgressUpdater(pu)
  4356. return c
  4357. }
  4358. // Fields allows partial responses to be retrieved. See
  4359. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4360. // for more information.
  4361. func (c *JobsInsertCall) Fields(s ...googleapi.Field) *JobsInsertCall {
  4362. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4363. return c
  4364. }
  4365. // Context sets the context to be used in this call's Do method. Any
  4366. // pending HTTP request will be aborted if the provided context is
  4367. // canceled.
  4368. // This context will supersede any context previously provided to the
  4369. // ResumableMedia method.
  4370. func (c *JobsInsertCall) Context(ctx context.Context) *JobsInsertCall {
  4371. c.ctx_ = ctx
  4372. return c
  4373. }
  4374. // Header returns an http.Header that can be modified by the caller to
  4375. // add HTTP headers to the request.
  4376. func (c *JobsInsertCall) Header() http.Header {
  4377. if c.header_ == nil {
  4378. c.header_ = make(http.Header)
  4379. }
  4380. return c.header_
  4381. }
  4382. func (c *JobsInsertCall) doRequest(alt string) (*http.Response, error) {
  4383. reqHeaders := make(http.Header)
  4384. for k, v := range c.header_ {
  4385. reqHeaders[k] = v
  4386. }
  4387. reqHeaders.Set("User-Agent", c.s.userAgent())
  4388. var body io.Reader = nil
  4389. body, err := googleapi.WithoutDataWrapper.JSONReader(c.job)
  4390. if err != nil {
  4391. return nil, err
  4392. }
  4393. reqHeaders.Set("Content-Type", "application/json")
  4394. c.urlParams_.Set("alt", alt)
  4395. urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{projectId}/jobs")
  4396. if c.mediaInfo_ != nil {
  4397. urls = strings.Replace(urls, "https://www.googleapis.com/", "https://www.googleapis.com/upload/", 1)
  4398. c.urlParams_.Set("uploadType", c.mediaInfo_.UploadType())
  4399. }
  4400. if body == nil {
  4401. body = new(bytes.Buffer)
  4402. reqHeaders.Set("Content-Type", "application/json")
  4403. }
  4404. body, getBody, cleanup := c.mediaInfo_.UploadRequest(reqHeaders, body)
  4405. defer cleanup()
  4406. urls += "?" + c.urlParams_.Encode()
  4407. req, _ := http.NewRequest("POST", urls, body)
  4408. req.Header = reqHeaders
  4409. gensupport.SetGetBody(req, getBody)
  4410. googleapi.Expand(req.URL, map[string]string{
  4411. "projectId": c.projectId,
  4412. })
  4413. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4414. }
  4415. // Do executes the "bigquery.jobs.insert" call.
  4416. // Exactly one of *Job or error will be non-nil. Any non-2xx status code
  4417. // is an error. Response headers are in either
  4418. // *Job.ServerResponse.Header or (if a response was returned at all) in
  4419. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  4420. // whether the returned error was because http.StatusNotModified was
  4421. // returned.
  4422. func (c *JobsInsertCall) Do(opts ...googleapi.CallOption) (*Job, error) {
  4423. gensupport.SetOptions(c.urlParams_, opts...)
  4424. res, err := c.doRequest("json")
  4425. if res != nil && res.StatusCode == http.StatusNotModified {
  4426. if res.Body != nil {
  4427. res.Body.Close()
  4428. }
  4429. return nil, &googleapi.Error{
  4430. Code: res.StatusCode,
  4431. Header: res.Header,
  4432. }
  4433. }
  4434. if err != nil {
  4435. return nil, err
  4436. }
  4437. defer googleapi.CloseBody(res)
  4438. if err := googleapi.CheckResponse(res); err != nil {
  4439. return nil, err
  4440. }
  4441. rx := c.mediaInfo_.ResumableUpload(res.Header.Get("Location"))
  4442. if rx != nil {
  4443. rx.Client = c.s.client
  4444. rx.UserAgent = c.s.userAgent()
  4445. ctx := c.ctx_
  4446. if ctx == nil {
  4447. ctx = context.TODO()
  4448. }
  4449. res, err = rx.Upload(ctx)
  4450. if err != nil {
  4451. return nil, err
  4452. }
  4453. defer res.Body.Close()
  4454. if err := googleapi.CheckResponse(res); err != nil {
  4455. return nil, err
  4456. }
  4457. }
  4458. ret := &Job{
  4459. ServerResponse: googleapi.ServerResponse{
  4460. Header: res.Header,
  4461. HTTPStatusCode: res.StatusCode,
  4462. },
  4463. }
  4464. target := &ret
  4465. if err := gensupport.DecodeResponse(target, res); err != nil {
  4466. return nil, err
  4467. }
  4468. return ret, nil
  4469. // {
  4470. // "description": "Starts a new asynchronous job. Requires the Can View project role.",
  4471. // "httpMethod": "POST",
  4472. // "id": "bigquery.jobs.insert",
  4473. // "mediaUpload": {
  4474. // "accept": [
  4475. // "*/*"
  4476. // ],
  4477. // "protocols": {
  4478. // "resumable": {
  4479. // "multipart": true,
  4480. // "path": "/resumable/upload/bigquery/v2/projects/{projectId}/jobs"
  4481. // },
  4482. // "simple": {
  4483. // "multipart": true,
  4484. // "path": "/upload/bigquery/v2/projects/{projectId}/jobs"
  4485. // }
  4486. // }
  4487. // },
  4488. // "parameterOrder": [
  4489. // "projectId"
  4490. // ],
  4491. // "parameters": {
  4492. // "projectId": {
  4493. // "description": "Project ID of the project that will be billed for the job",
  4494. // "location": "path",
  4495. // "required": true,
  4496. // "type": "string"
  4497. // }
  4498. // },
  4499. // "path": "projects/{projectId}/jobs",
  4500. // "request": {
  4501. // "$ref": "Job"
  4502. // },
  4503. // "response": {
  4504. // "$ref": "Job"
  4505. // },
  4506. // "scopes": [
  4507. // "https://www.googleapis.com/auth/bigquery",
  4508. // "https://www.googleapis.com/auth/cloud-platform",
  4509. // "https://www.googleapis.com/auth/devstorage.full_control",
  4510. // "https://www.googleapis.com/auth/devstorage.read_only",
  4511. // "https://www.googleapis.com/auth/devstorage.read_write"
  4512. // ],
  4513. // "supportsMediaUpload": true
  4514. // }
  4515. }
  4516. // method id "bigquery.jobs.list":
  4517. type JobsListCall struct {
  4518. s *Service
  4519. projectId string
  4520. urlParams_ gensupport.URLParams
  4521. ifNoneMatch_ string
  4522. ctx_ context.Context
  4523. header_ http.Header
  4524. }
  4525. // List: Lists all jobs that you started in the specified project. Job
  4526. // information is available for a six month period after creation. The
  4527. // job list is sorted in reverse chronological order, by job creation
  4528. // time. Requires the Can View project role, or the Is Owner project
  4529. // role if you set the allUsers property.
  4530. func (r *JobsService) List(projectId string) *JobsListCall {
  4531. c := &JobsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4532. c.projectId = projectId
  4533. return c
  4534. }
  4535. // AllUsers sets the optional parameter "allUsers": Whether to display
  4536. // jobs owned by all users in the project. Default false
  4537. func (c *JobsListCall) AllUsers(allUsers bool) *JobsListCall {
  4538. c.urlParams_.Set("allUsers", fmt.Sprint(allUsers))
  4539. return c
  4540. }
  4541. // MaxCreationTime sets the optional parameter "maxCreationTime": Max
  4542. // value for job creation time, in milliseconds since the POSIX epoch.
  4543. // If set, only jobs created before or at this timestamp are returned
  4544. func (c *JobsListCall) MaxCreationTime(maxCreationTime uint64) *JobsListCall {
  4545. c.urlParams_.Set("maxCreationTime", fmt.Sprint(maxCreationTime))
  4546. return c
  4547. }
  4548. // MaxResults sets the optional parameter "maxResults": Maximum number
  4549. // of results to return
  4550. func (c *JobsListCall) MaxResults(maxResults int64) *JobsListCall {
  4551. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  4552. return c
  4553. }
  4554. // MinCreationTime sets the optional parameter "minCreationTime": Min
  4555. // value for job creation time, in milliseconds since the POSIX epoch.
  4556. // If set, only jobs created after or at this timestamp are returned
  4557. func (c *JobsListCall) MinCreationTime(minCreationTime uint64) *JobsListCall {
  4558. c.urlParams_.Set("minCreationTime", fmt.Sprint(minCreationTime))
  4559. return c
  4560. }
  4561. // PageToken sets the optional parameter "pageToken": Page token,
  4562. // returned by a previous call, to request the next page of results
  4563. func (c *JobsListCall) PageToken(pageToken string) *JobsListCall {
  4564. c.urlParams_.Set("pageToken", pageToken)
  4565. return c
  4566. }
  4567. // Projection sets the optional parameter "projection": Restrict
  4568. // information returned to a set of selected fields
  4569. //
  4570. // Possible values:
  4571. // "full" - Includes all job data
  4572. // "minimal" - Does not include the job configuration
  4573. func (c *JobsListCall) Projection(projection string) *JobsListCall {
  4574. c.urlParams_.Set("projection", projection)
  4575. return c
  4576. }
  4577. // StateFilter sets the optional parameter "stateFilter": Filter for job
  4578. // state
  4579. //
  4580. // Possible values:
  4581. // "done" - Finished jobs
  4582. // "pending" - Pending jobs
  4583. // "running" - Running jobs
  4584. func (c *JobsListCall) StateFilter(stateFilter ...string) *JobsListCall {
  4585. c.urlParams_.SetMulti("stateFilter", append([]string{}, stateFilter...))
  4586. return c
  4587. }
  4588. // Fields allows partial responses to be retrieved. See
  4589. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4590. // for more information.
  4591. func (c *JobsListCall) Fields(s ...googleapi.Field) *JobsListCall {
  4592. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4593. return c
  4594. }
  4595. // IfNoneMatch sets the optional parameter which makes the operation
  4596. // fail if the object's ETag matches the given value. This is useful for
  4597. // getting updates only after the object has changed since the last
  4598. // request. Use googleapi.IsNotModified to check whether the response
  4599. // error from Do is the result of In-None-Match.
  4600. func (c *JobsListCall) IfNoneMatch(entityTag string) *JobsListCall {
  4601. c.ifNoneMatch_ = entityTag
  4602. return c
  4603. }
  4604. // Context sets the context to be used in this call's Do method. Any
  4605. // pending HTTP request will be aborted if the provided context is
  4606. // canceled.
  4607. func (c *JobsListCall) Context(ctx context.Context) *JobsListCall {
  4608. c.ctx_ = ctx
  4609. return c
  4610. }
  4611. // Header returns an http.Header that can be modified by the caller to
  4612. // add HTTP headers to the request.
  4613. func (c *JobsListCall) Header() http.Header {
  4614. if c.header_ == nil {
  4615. c.header_ = make(http.Header)
  4616. }
  4617. return c.header_
  4618. }
  4619. func (c *JobsListCall) doRequest(alt string) (*http.Response, error) {
  4620. reqHeaders := make(http.Header)
  4621. for k, v := range c.header_ {
  4622. reqHeaders[k] = v
  4623. }
  4624. reqHeaders.Set("User-Agent", c.s.userAgent())
  4625. if c.ifNoneMatch_ != "" {
  4626. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  4627. }
  4628. var body io.Reader = nil
  4629. c.urlParams_.Set("alt", alt)
  4630. urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{projectId}/jobs")
  4631. urls += "?" + c.urlParams_.Encode()
  4632. req, _ := http.NewRequest("GET", urls, body)
  4633. req.Header = reqHeaders
  4634. googleapi.Expand(req.URL, map[string]string{
  4635. "projectId": c.projectId,
  4636. })
  4637. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4638. }
  4639. // Do executes the "bigquery.jobs.list" call.
  4640. // Exactly one of *JobList or error will be non-nil. Any non-2xx status
  4641. // code is an error. Response headers are in either
  4642. // *JobList.ServerResponse.Header or (if a response was returned at all)
  4643. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  4644. // check whether the returned error was because http.StatusNotModified
  4645. // was returned.
  4646. func (c *JobsListCall) Do(opts ...googleapi.CallOption) (*JobList, error) {
  4647. gensupport.SetOptions(c.urlParams_, opts...)
  4648. res, err := c.doRequest("json")
  4649. if res != nil && res.StatusCode == http.StatusNotModified {
  4650. if res.Body != nil {
  4651. res.Body.Close()
  4652. }
  4653. return nil, &googleapi.Error{
  4654. Code: res.StatusCode,
  4655. Header: res.Header,
  4656. }
  4657. }
  4658. if err != nil {
  4659. return nil, err
  4660. }
  4661. defer googleapi.CloseBody(res)
  4662. if err := googleapi.CheckResponse(res); err != nil {
  4663. return nil, err
  4664. }
  4665. ret := &JobList{
  4666. ServerResponse: googleapi.ServerResponse{
  4667. Header: res.Header,
  4668. HTTPStatusCode: res.StatusCode,
  4669. },
  4670. }
  4671. target := &ret
  4672. if err := gensupport.DecodeResponse(target, res); err != nil {
  4673. return nil, err
  4674. }
  4675. return ret, nil
  4676. // {
  4677. // "description": "Lists all jobs that you started in the specified project. Job information is available for a six month period after creation. The job list is sorted in reverse chronological order, by job creation time. Requires the Can View project role, or the Is Owner project role if you set the allUsers property.",
  4678. // "httpMethod": "GET",
  4679. // "id": "bigquery.jobs.list",
  4680. // "parameterOrder": [
  4681. // "projectId"
  4682. // ],
  4683. // "parameters": {
  4684. // "allUsers": {
  4685. // "description": "Whether to display jobs owned by all users in the project. Default false",
  4686. // "location": "query",
  4687. // "type": "boolean"
  4688. // },
  4689. // "maxCreationTime": {
  4690. // "description": "Max value for job creation time, in milliseconds since the POSIX epoch. If set, only jobs created before or at this timestamp are returned",
  4691. // "format": "uint64",
  4692. // "location": "query",
  4693. // "type": "string"
  4694. // },
  4695. // "maxResults": {
  4696. // "description": "Maximum number of results to return",
  4697. // "format": "uint32",
  4698. // "location": "query",
  4699. // "type": "integer"
  4700. // },
  4701. // "minCreationTime": {
  4702. // "description": "Min value for job creation time, in milliseconds since the POSIX epoch. If set, only jobs created after or at this timestamp are returned",
  4703. // "format": "uint64",
  4704. // "location": "query",
  4705. // "type": "string"
  4706. // },
  4707. // "pageToken": {
  4708. // "description": "Page token, returned by a previous call, to request the next page of results",
  4709. // "location": "query",
  4710. // "type": "string"
  4711. // },
  4712. // "projectId": {
  4713. // "description": "Project ID of the jobs to list",
  4714. // "location": "path",
  4715. // "required": true,
  4716. // "type": "string"
  4717. // },
  4718. // "projection": {
  4719. // "description": "Restrict information returned to a set of selected fields",
  4720. // "enum": [
  4721. // "full",
  4722. // "minimal"
  4723. // ],
  4724. // "enumDescriptions": [
  4725. // "Includes all job data",
  4726. // "Does not include the job configuration"
  4727. // ],
  4728. // "location": "query",
  4729. // "type": "string"
  4730. // },
  4731. // "stateFilter": {
  4732. // "description": "Filter for job state",
  4733. // "enum": [
  4734. // "done",
  4735. // "pending",
  4736. // "running"
  4737. // ],
  4738. // "enumDescriptions": [
  4739. // "Finished jobs",
  4740. // "Pending jobs",
  4741. // "Running jobs"
  4742. // ],
  4743. // "location": "query",
  4744. // "repeated": true,
  4745. // "type": "string"
  4746. // }
  4747. // },
  4748. // "path": "projects/{projectId}/jobs",
  4749. // "response": {
  4750. // "$ref": "JobList"
  4751. // },
  4752. // "scopes": [
  4753. // "https://www.googleapis.com/auth/bigquery",
  4754. // "https://www.googleapis.com/auth/cloud-platform",
  4755. // "https://www.googleapis.com/auth/cloud-platform.read-only"
  4756. // ]
  4757. // }
  4758. }
  4759. // Pages invokes f for each page of results.
  4760. // A non-nil error returned from f will halt the iteration.
  4761. // The provided context supersedes any context provided to the Context method.
  4762. func (c *JobsListCall) Pages(ctx context.Context, f func(*JobList) error) error {
  4763. c.ctx_ = ctx
  4764. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  4765. for {
  4766. x, err := c.Do()
  4767. if err != nil {
  4768. return err
  4769. }
  4770. if err := f(x); err != nil {
  4771. return err
  4772. }
  4773. if x.NextPageToken == "" {
  4774. return nil
  4775. }
  4776. c.PageToken(x.NextPageToken)
  4777. }
  4778. }
  4779. // method id "bigquery.jobs.query":
  4780. type JobsQueryCall struct {
  4781. s *Service
  4782. projectId string
  4783. queryrequest *QueryRequest
  4784. urlParams_ gensupport.URLParams
  4785. ctx_ context.Context
  4786. header_ http.Header
  4787. }
  4788. // Query: Runs a BigQuery SQL query synchronously and returns query
  4789. // results if the query completes within a specified timeout.
  4790. func (r *JobsService) Query(projectId string, queryrequest *QueryRequest) *JobsQueryCall {
  4791. c := &JobsQueryCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4792. c.projectId = projectId
  4793. c.queryrequest = queryrequest
  4794. return c
  4795. }
  4796. // Fields allows partial responses to be retrieved. See
  4797. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4798. // for more information.
  4799. func (c *JobsQueryCall) Fields(s ...googleapi.Field) *JobsQueryCall {
  4800. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4801. return c
  4802. }
  4803. // Context sets the context to be used in this call's Do method. Any
  4804. // pending HTTP request will be aborted if the provided context is
  4805. // canceled.
  4806. func (c *JobsQueryCall) Context(ctx context.Context) *JobsQueryCall {
  4807. c.ctx_ = ctx
  4808. return c
  4809. }
  4810. // Header returns an http.Header that can be modified by the caller to
  4811. // add HTTP headers to the request.
  4812. func (c *JobsQueryCall) Header() http.Header {
  4813. if c.header_ == nil {
  4814. c.header_ = make(http.Header)
  4815. }
  4816. return c.header_
  4817. }
  4818. func (c *JobsQueryCall) doRequest(alt string) (*http.Response, error) {
  4819. reqHeaders := make(http.Header)
  4820. for k, v := range c.header_ {
  4821. reqHeaders[k] = v
  4822. }
  4823. reqHeaders.Set("User-Agent", c.s.userAgent())
  4824. var body io.Reader = nil
  4825. body, err := googleapi.WithoutDataWrapper.JSONReader(c.queryrequest)
  4826. if err != nil {
  4827. return nil, err
  4828. }
  4829. reqHeaders.Set("Content-Type", "application/json")
  4830. c.urlParams_.Set("alt", alt)
  4831. urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{projectId}/queries")
  4832. urls += "?" + c.urlParams_.Encode()
  4833. req, _ := http.NewRequest("POST", urls, body)
  4834. req.Header = reqHeaders
  4835. googleapi.Expand(req.URL, map[string]string{
  4836. "projectId": c.projectId,
  4837. })
  4838. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4839. }
  4840. // Do executes the "bigquery.jobs.query" call.
  4841. // Exactly one of *QueryResponse or error will be non-nil. Any non-2xx
  4842. // status code is an error. Response headers are in either
  4843. // *QueryResponse.ServerResponse.Header or (if a response was returned
  4844. // at all) in error.(*googleapi.Error).Header. Use
  4845. // googleapi.IsNotModified to check whether the returned error was
  4846. // because http.StatusNotModified was returned.
  4847. func (c *JobsQueryCall) Do(opts ...googleapi.CallOption) (*QueryResponse, error) {
  4848. gensupport.SetOptions(c.urlParams_, opts...)
  4849. res, err := c.doRequest("json")
  4850. if res != nil && res.StatusCode == http.StatusNotModified {
  4851. if res.Body != nil {
  4852. res.Body.Close()
  4853. }
  4854. return nil, &googleapi.Error{
  4855. Code: res.StatusCode,
  4856. Header: res.Header,
  4857. }
  4858. }
  4859. if err != nil {
  4860. return nil, err
  4861. }
  4862. defer googleapi.CloseBody(res)
  4863. if err := googleapi.CheckResponse(res); err != nil {
  4864. return nil, err
  4865. }
  4866. ret := &QueryResponse{
  4867. ServerResponse: googleapi.ServerResponse{
  4868. Header: res.Header,
  4869. HTTPStatusCode: res.StatusCode,
  4870. },
  4871. }
  4872. target := &ret
  4873. if err := gensupport.DecodeResponse(target, res); err != nil {
  4874. return nil, err
  4875. }
  4876. return ret, nil
  4877. // {
  4878. // "description": "Runs a BigQuery SQL query synchronously and returns query results if the query completes within a specified timeout.",
  4879. // "httpMethod": "POST",
  4880. // "id": "bigquery.jobs.query",
  4881. // "parameterOrder": [
  4882. // "projectId"
  4883. // ],
  4884. // "parameters": {
  4885. // "projectId": {
  4886. // "description": "Project ID of the project billed for the query",
  4887. // "location": "path",
  4888. // "required": true,
  4889. // "type": "string"
  4890. // }
  4891. // },
  4892. // "path": "projects/{projectId}/queries",
  4893. // "request": {
  4894. // "$ref": "QueryRequest"
  4895. // },
  4896. // "response": {
  4897. // "$ref": "QueryResponse"
  4898. // },
  4899. // "scopes": [
  4900. // "https://www.googleapis.com/auth/bigquery",
  4901. // "https://www.googleapis.com/auth/cloud-platform",
  4902. // "https://www.googleapis.com/auth/cloud-platform.read-only"
  4903. // ]
  4904. // }
  4905. }
  4906. // method id "bigquery.projects.getServiceAccount":
  4907. type ProjectsGetServiceAccountCall struct {
  4908. s *Service
  4909. projectId string
  4910. urlParams_ gensupport.URLParams
  4911. ifNoneMatch_ string
  4912. ctx_ context.Context
  4913. header_ http.Header
  4914. }
  4915. // GetServiceAccount: Returns the email address of the service account
  4916. // for your project used for interactions with Google Cloud KMS.
  4917. func (r *ProjectsService) GetServiceAccount(projectId string) *ProjectsGetServiceAccountCall {
  4918. c := &ProjectsGetServiceAccountCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4919. c.projectId = projectId
  4920. return c
  4921. }
  4922. // Fields allows partial responses to be retrieved. See
  4923. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4924. // for more information.
  4925. func (c *ProjectsGetServiceAccountCall) Fields(s ...googleapi.Field) *ProjectsGetServiceAccountCall {
  4926. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4927. return c
  4928. }
  4929. // IfNoneMatch sets the optional parameter which makes the operation
  4930. // fail if the object's ETag matches the given value. This is useful for
  4931. // getting updates only after the object has changed since the last
  4932. // request. Use googleapi.IsNotModified to check whether the response
  4933. // error from Do is the result of In-None-Match.
  4934. func (c *ProjectsGetServiceAccountCall) IfNoneMatch(entityTag string) *ProjectsGetServiceAccountCall {
  4935. c.ifNoneMatch_ = entityTag
  4936. return c
  4937. }
  4938. // Context sets the context to be used in this call's Do method. Any
  4939. // pending HTTP request will be aborted if the provided context is
  4940. // canceled.
  4941. func (c *ProjectsGetServiceAccountCall) Context(ctx context.Context) *ProjectsGetServiceAccountCall {
  4942. c.ctx_ = ctx
  4943. return c
  4944. }
  4945. // Header returns an http.Header that can be modified by the caller to
  4946. // add HTTP headers to the request.
  4947. func (c *ProjectsGetServiceAccountCall) Header() http.Header {
  4948. if c.header_ == nil {
  4949. c.header_ = make(http.Header)
  4950. }
  4951. return c.header_
  4952. }
  4953. func (c *ProjectsGetServiceAccountCall) doRequest(alt string) (*http.Response, error) {
  4954. reqHeaders := make(http.Header)
  4955. for k, v := range c.header_ {
  4956. reqHeaders[k] = v
  4957. }
  4958. reqHeaders.Set("User-Agent", c.s.userAgent())
  4959. if c.ifNoneMatch_ != "" {
  4960. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  4961. }
  4962. var body io.Reader = nil
  4963. c.urlParams_.Set("alt", alt)
  4964. urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{projectId}/serviceAccount")
  4965. urls += "?" + c.urlParams_.Encode()
  4966. req, _ := http.NewRequest("GET", urls, body)
  4967. req.Header = reqHeaders
  4968. googleapi.Expand(req.URL, map[string]string{
  4969. "projectId": c.projectId,
  4970. })
  4971. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4972. }
  4973. // Do executes the "bigquery.projects.getServiceAccount" call.
  4974. // Exactly one of *GetServiceAccountResponse or error will be non-nil.
  4975. // Any non-2xx status code is an error. Response headers are in either
  4976. // *GetServiceAccountResponse.ServerResponse.Header or (if a response
  4977. // was returned at all) in error.(*googleapi.Error).Header. Use
  4978. // googleapi.IsNotModified to check whether the returned error was
  4979. // because http.StatusNotModified was returned.
  4980. func (c *ProjectsGetServiceAccountCall) Do(opts ...googleapi.CallOption) (*GetServiceAccountResponse, error) {
  4981. gensupport.SetOptions(c.urlParams_, opts...)
  4982. res, err := c.doRequest("json")
  4983. if res != nil && res.StatusCode == http.StatusNotModified {
  4984. if res.Body != nil {
  4985. res.Body.Close()
  4986. }
  4987. return nil, &googleapi.Error{
  4988. Code: res.StatusCode,
  4989. Header: res.Header,
  4990. }
  4991. }
  4992. if err != nil {
  4993. return nil, err
  4994. }
  4995. defer googleapi.CloseBody(res)
  4996. if err := googleapi.CheckResponse(res); err != nil {
  4997. return nil, err
  4998. }
  4999. ret := &GetServiceAccountResponse{
  5000. ServerResponse: googleapi.ServerResponse{
  5001. Header: res.Header,
  5002. HTTPStatusCode: res.StatusCode,
  5003. },
  5004. }
  5005. target := &ret
  5006. if err := gensupport.DecodeResponse(target, res); err != nil {
  5007. return nil, err
  5008. }
  5009. return ret, nil
  5010. // {
  5011. // "description": "Returns the email address of the service account for your project used for interactions with Google Cloud KMS.",
  5012. // "httpMethod": "GET",
  5013. // "id": "bigquery.projects.getServiceAccount",
  5014. // "parameterOrder": [
  5015. // "projectId"
  5016. // ],
  5017. // "parameters": {
  5018. // "projectId": {
  5019. // "description": "Project ID for which the service account is requested.",
  5020. // "location": "path",
  5021. // "required": true,
  5022. // "type": "string"
  5023. // }
  5024. // },
  5025. // "path": "projects/{projectId}/serviceAccount",
  5026. // "response": {
  5027. // "$ref": "GetServiceAccountResponse"
  5028. // },
  5029. // "scopes": [
  5030. // "https://www.googleapis.com/auth/bigquery",
  5031. // "https://www.googleapis.com/auth/cloud-platform",
  5032. // "https://www.googleapis.com/auth/cloud-platform.read-only"
  5033. // ]
  5034. // }
  5035. }
  5036. // method id "bigquery.projects.list":
  5037. type ProjectsListCall struct {
  5038. s *Service
  5039. urlParams_ gensupport.URLParams
  5040. ifNoneMatch_ string
  5041. ctx_ context.Context
  5042. header_ http.Header
  5043. }
  5044. // List: Lists all projects to which you have been granted any project
  5045. // role.
  5046. func (r *ProjectsService) List() *ProjectsListCall {
  5047. c := &ProjectsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5048. return c
  5049. }
  5050. // MaxResults sets the optional parameter "maxResults": Maximum number
  5051. // of results to return
  5052. func (c *ProjectsListCall) MaxResults(maxResults int64) *ProjectsListCall {
  5053. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  5054. return c
  5055. }
  5056. // PageToken sets the optional parameter "pageToken": Page token,
  5057. // returned by a previous call, to request the next page of results
  5058. func (c *ProjectsListCall) PageToken(pageToken string) *ProjectsListCall {
  5059. c.urlParams_.Set("pageToken", pageToken)
  5060. return c
  5061. }
  5062. // Fields allows partial responses to be retrieved. See
  5063. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5064. // for more information.
  5065. func (c *ProjectsListCall) Fields(s ...googleapi.Field) *ProjectsListCall {
  5066. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5067. return c
  5068. }
  5069. // IfNoneMatch sets the optional parameter which makes the operation
  5070. // fail if the object's ETag matches the given value. This is useful for
  5071. // getting updates only after the object has changed since the last
  5072. // request. Use googleapi.IsNotModified to check whether the response
  5073. // error from Do is the result of In-None-Match.
  5074. func (c *ProjectsListCall) IfNoneMatch(entityTag string) *ProjectsListCall {
  5075. c.ifNoneMatch_ = entityTag
  5076. return c
  5077. }
  5078. // Context sets the context to be used in this call's Do method. Any
  5079. // pending HTTP request will be aborted if the provided context is
  5080. // canceled.
  5081. func (c *ProjectsListCall) Context(ctx context.Context) *ProjectsListCall {
  5082. c.ctx_ = ctx
  5083. return c
  5084. }
  5085. // Header returns an http.Header that can be modified by the caller to
  5086. // add HTTP headers to the request.
  5087. func (c *ProjectsListCall) Header() http.Header {
  5088. if c.header_ == nil {
  5089. c.header_ = make(http.Header)
  5090. }
  5091. return c.header_
  5092. }
  5093. func (c *ProjectsListCall) doRequest(alt string) (*http.Response, error) {
  5094. reqHeaders := make(http.Header)
  5095. for k, v := range c.header_ {
  5096. reqHeaders[k] = v
  5097. }
  5098. reqHeaders.Set("User-Agent", c.s.userAgent())
  5099. if c.ifNoneMatch_ != "" {
  5100. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  5101. }
  5102. var body io.Reader = nil
  5103. c.urlParams_.Set("alt", alt)
  5104. urls := googleapi.ResolveRelative(c.s.BasePath, "projects")
  5105. urls += "?" + c.urlParams_.Encode()
  5106. req, _ := http.NewRequest("GET", urls, body)
  5107. req.Header = reqHeaders
  5108. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5109. }
  5110. // Do executes the "bigquery.projects.list" call.
  5111. // Exactly one of *ProjectList or error will be non-nil. Any non-2xx
  5112. // status code is an error. Response headers are in either
  5113. // *ProjectList.ServerResponse.Header or (if a response was returned at
  5114. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  5115. // to check whether the returned error was because
  5116. // http.StatusNotModified was returned.
  5117. func (c *ProjectsListCall) Do(opts ...googleapi.CallOption) (*ProjectList, error) {
  5118. gensupport.SetOptions(c.urlParams_, opts...)
  5119. res, err := c.doRequest("json")
  5120. if res != nil && res.StatusCode == http.StatusNotModified {
  5121. if res.Body != nil {
  5122. res.Body.Close()
  5123. }
  5124. return nil, &googleapi.Error{
  5125. Code: res.StatusCode,
  5126. Header: res.Header,
  5127. }
  5128. }
  5129. if err != nil {
  5130. return nil, err
  5131. }
  5132. defer googleapi.CloseBody(res)
  5133. if err := googleapi.CheckResponse(res); err != nil {
  5134. return nil, err
  5135. }
  5136. ret := &ProjectList{
  5137. ServerResponse: googleapi.ServerResponse{
  5138. Header: res.Header,
  5139. HTTPStatusCode: res.StatusCode,
  5140. },
  5141. }
  5142. target := &ret
  5143. if err := gensupport.DecodeResponse(target, res); err != nil {
  5144. return nil, err
  5145. }
  5146. return ret, nil
  5147. // {
  5148. // "description": "Lists all projects to which you have been granted any project role.",
  5149. // "httpMethod": "GET",
  5150. // "id": "bigquery.projects.list",
  5151. // "parameters": {
  5152. // "maxResults": {
  5153. // "description": "Maximum number of results to return",
  5154. // "format": "uint32",
  5155. // "location": "query",
  5156. // "type": "integer"
  5157. // },
  5158. // "pageToken": {
  5159. // "description": "Page token, returned by a previous call, to request the next page of results",
  5160. // "location": "query",
  5161. // "type": "string"
  5162. // }
  5163. // },
  5164. // "path": "projects",
  5165. // "response": {
  5166. // "$ref": "ProjectList"
  5167. // },
  5168. // "scopes": [
  5169. // "https://www.googleapis.com/auth/bigquery",
  5170. // "https://www.googleapis.com/auth/cloud-platform",
  5171. // "https://www.googleapis.com/auth/cloud-platform.read-only"
  5172. // ]
  5173. // }
  5174. }
  5175. // Pages invokes f for each page of results.
  5176. // A non-nil error returned from f will halt the iteration.
  5177. // The provided context supersedes any context provided to the Context method.
  5178. func (c *ProjectsListCall) Pages(ctx context.Context, f func(*ProjectList) error) error {
  5179. c.ctx_ = ctx
  5180. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  5181. for {
  5182. x, err := c.Do()
  5183. if err != nil {
  5184. return err
  5185. }
  5186. if err := f(x); err != nil {
  5187. return err
  5188. }
  5189. if x.NextPageToken == "" {
  5190. return nil
  5191. }
  5192. c.PageToken(x.NextPageToken)
  5193. }
  5194. }
  5195. // method id "bigquery.tabledata.insertAll":
  5196. type TabledataInsertAllCall struct {
  5197. s *Service
  5198. projectId string
  5199. datasetId string
  5200. tableId string
  5201. tabledatainsertallrequest *TableDataInsertAllRequest
  5202. urlParams_ gensupport.URLParams
  5203. ctx_ context.Context
  5204. header_ http.Header
  5205. }
  5206. // InsertAll: Streams data into BigQuery one record at a time without
  5207. // needing to run a load job. Requires the WRITER dataset role.
  5208. func (r *TabledataService) InsertAll(projectId string, datasetId string, tableId string, tabledatainsertallrequest *TableDataInsertAllRequest) *TabledataInsertAllCall {
  5209. c := &TabledataInsertAllCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5210. c.projectId = projectId
  5211. c.datasetId = datasetId
  5212. c.tableId = tableId
  5213. c.tabledatainsertallrequest = tabledatainsertallrequest
  5214. return c
  5215. }
  5216. // Fields allows partial responses to be retrieved. See
  5217. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5218. // for more information.
  5219. func (c *TabledataInsertAllCall) Fields(s ...googleapi.Field) *TabledataInsertAllCall {
  5220. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5221. return c
  5222. }
  5223. // Context sets the context to be used in this call's Do method. Any
  5224. // pending HTTP request will be aborted if the provided context is
  5225. // canceled.
  5226. func (c *TabledataInsertAllCall) Context(ctx context.Context) *TabledataInsertAllCall {
  5227. c.ctx_ = ctx
  5228. return c
  5229. }
  5230. // Header returns an http.Header that can be modified by the caller to
  5231. // add HTTP headers to the request.
  5232. func (c *TabledataInsertAllCall) Header() http.Header {
  5233. if c.header_ == nil {
  5234. c.header_ = make(http.Header)
  5235. }
  5236. return c.header_
  5237. }
  5238. func (c *TabledataInsertAllCall) doRequest(alt string) (*http.Response, error) {
  5239. reqHeaders := make(http.Header)
  5240. for k, v := range c.header_ {
  5241. reqHeaders[k] = v
  5242. }
  5243. reqHeaders.Set("User-Agent", c.s.userAgent())
  5244. var body io.Reader = nil
  5245. body, err := googleapi.WithoutDataWrapper.JSONReader(c.tabledatainsertallrequest)
  5246. if err != nil {
  5247. return nil, err
  5248. }
  5249. reqHeaders.Set("Content-Type", "application/json")
  5250. c.urlParams_.Set("alt", alt)
  5251. urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{projectId}/datasets/{datasetId}/tables/{tableId}/insertAll")
  5252. urls += "?" + c.urlParams_.Encode()
  5253. req, _ := http.NewRequest("POST", urls, body)
  5254. req.Header = reqHeaders
  5255. googleapi.Expand(req.URL, map[string]string{
  5256. "projectId": c.projectId,
  5257. "datasetId": c.datasetId,
  5258. "tableId": c.tableId,
  5259. })
  5260. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5261. }
  5262. // Do executes the "bigquery.tabledata.insertAll" call.
  5263. // Exactly one of *TableDataInsertAllResponse or error will be non-nil.
  5264. // Any non-2xx status code is an error. Response headers are in either
  5265. // *TableDataInsertAllResponse.ServerResponse.Header or (if a response
  5266. // was returned at all) in error.(*googleapi.Error).Header. Use
  5267. // googleapi.IsNotModified to check whether the returned error was
  5268. // because http.StatusNotModified was returned.
  5269. func (c *TabledataInsertAllCall) Do(opts ...googleapi.CallOption) (*TableDataInsertAllResponse, error) {
  5270. gensupport.SetOptions(c.urlParams_, opts...)
  5271. res, err := c.doRequest("json")
  5272. if res != nil && res.StatusCode == http.StatusNotModified {
  5273. if res.Body != nil {
  5274. res.Body.Close()
  5275. }
  5276. return nil, &googleapi.Error{
  5277. Code: res.StatusCode,
  5278. Header: res.Header,
  5279. }
  5280. }
  5281. if err != nil {
  5282. return nil, err
  5283. }
  5284. defer googleapi.CloseBody(res)
  5285. if err := googleapi.CheckResponse(res); err != nil {
  5286. return nil, err
  5287. }
  5288. ret := &TableDataInsertAllResponse{
  5289. ServerResponse: googleapi.ServerResponse{
  5290. Header: res.Header,
  5291. HTTPStatusCode: res.StatusCode,
  5292. },
  5293. }
  5294. target := &ret
  5295. if err := gensupport.DecodeResponse(target, res); err != nil {
  5296. return nil, err
  5297. }
  5298. return ret, nil
  5299. // {
  5300. // "description": "Streams data into BigQuery one record at a time without needing to run a load job. Requires the WRITER dataset role.",
  5301. // "httpMethod": "POST",
  5302. // "id": "bigquery.tabledata.insertAll",
  5303. // "parameterOrder": [
  5304. // "projectId",
  5305. // "datasetId",
  5306. // "tableId"
  5307. // ],
  5308. // "parameters": {
  5309. // "datasetId": {
  5310. // "description": "Dataset ID of the destination table.",
  5311. // "location": "path",
  5312. // "required": true,
  5313. // "type": "string"
  5314. // },
  5315. // "projectId": {
  5316. // "description": "Project ID of the destination table.",
  5317. // "location": "path",
  5318. // "required": true,
  5319. // "type": "string"
  5320. // },
  5321. // "tableId": {
  5322. // "description": "Table ID of the destination table.",
  5323. // "location": "path",
  5324. // "required": true,
  5325. // "type": "string"
  5326. // }
  5327. // },
  5328. // "path": "projects/{projectId}/datasets/{datasetId}/tables/{tableId}/insertAll",
  5329. // "request": {
  5330. // "$ref": "TableDataInsertAllRequest"
  5331. // },
  5332. // "response": {
  5333. // "$ref": "TableDataInsertAllResponse"
  5334. // },
  5335. // "scopes": [
  5336. // "https://www.googleapis.com/auth/bigquery",
  5337. // "https://www.googleapis.com/auth/bigquery.insertdata",
  5338. // "https://www.googleapis.com/auth/cloud-platform"
  5339. // ]
  5340. // }
  5341. }
  5342. // method id "bigquery.tabledata.list":
  5343. type TabledataListCall struct {
  5344. s *Service
  5345. projectId string
  5346. datasetId string
  5347. tableId string
  5348. urlParams_ gensupport.URLParams
  5349. ifNoneMatch_ string
  5350. ctx_ context.Context
  5351. header_ http.Header
  5352. }
  5353. // List: Retrieves table data from a specified set of rows. Requires the
  5354. // READER dataset role.
  5355. func (r *TabledataService) List(projectId string, datasetId string, tableId string) *TabledataListCall {
  5356. c := &TabledataListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5357. c.projectId = projectId
  5358. c.datasetId = datasetId
  5359. c.tableId = tableId
  5360. return c
  5361. }
  5362. // MaxResults sets the optional parameter "maxResults": Maximum number
  5363. // of results to return
  5364. func (c *TabledataListCall) MaxResults(maxResults int64) *TabledataListCall {
  5365. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  5366. return c
  5367. }
  5368. // PageToken sets the optional parameter "pageToken": Page token,
  5369. // returned by a previous call, identifying the result set
  5370. func (c *TabledataListCall) PageToken(pageToken string) *TabledataListCall {
  5371. c.urlParams_.Set("pageToken", pageToken)
  5372. return c
  5373. }
  5374. // SelectedFields sets the optional parameter "selectedFields": List of
  5375. // fields to return (comma-separated). If unspecified, all fields are
  5376. // returned
  5377. func (c *TabledataListCall) SelectedFields(selectedFields string) *TabledataListCall {
  5378. c.urlParams_.Set("selectedFields", selectedFields)
  5379. return c
  5380. }
  5381. // StartIndex sets the optional parameter "startIndex": Zero-based index
  5382. // of the starting row to read
  5383. func (c *TabledataListCall) StartIndex(startIndex uint64) *TabledataListCall {
  5384. c.urlParams_.Set("startIndex", fmt.Sprint(startIndex))
  5385. return c
  5386. }
  5387. // Fields allows partial responses to be retrieved. See
  5388. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5389. // for more information.
  5390. func (c *TabledataListCall) Fields(s ...googleapi.Field) *TabledataListCall {
  5391. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5392. return c
  5393. }
  5394. // IfNoneMatch sets the optional parameter which makes the operation
  5395. // fail if the object's ETag matches the given value. This is useful for
  5396. // getting updates only after the object has changed since the last
  5397. // request. Use googleapi.IsNotModified to check whether the response
  5398. // error from Do is the result of In-None-Match.
  5399. func (c *TabledataListCall) IfNoneMatch(entityTag string) *TabledataListCall {
  5400. c.ifNoneMatch_ = entityTag
  5401. return c
  5402. }
  5403. // Context sets the context to be used in this call's Do method. Any
  5404. // pending HTTP request will be aborted if the provided context is
  5405. // canceled.
  5406. func (c *TabledataListCall) Context(ctx context.Context) *TabledataListCall {
  5407. c.ctx_ = ctx
  5408. return c
  5409. }
  5410. // Header returns an http.Header that can be modified by the caller to
  5411. // add HTTP headers to the request.
  5412. func (c *TabledataListCall) Header() http.Header {
  5413. if c.header_ == nil {
  5414. c.header_ = make(http.Header)
  5415. }
  5416. return c.header_
  5417. }
  5418. func (c *TabledataListCall) doRequest(alt string) (*http.Response, error) {
  5419. reqHeaders := make(http.Header)
  5420. for k, v := range c.header_ {
  5421. reqHeaders[k] = v
  5422. }
  5423. reqHeaders.Set("User-Agent", c.s.userAgent())
  5424. if c.ifNoneMatch_ != "" {
  5425. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  5426. }
  5427. var body io.Reader = nil
  5428. c.urlParams_.Set("alt", alt)
  5429. urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{projectId}/datasets/{datasetId}/tables/{tableId}/data")
  5430. urls += "?" + c.urlParams_.Encode()
  5431. req, _ := http.NewRequest("GET", urls, body)
  5432. req.Header = reqHeaders
  5433. googleapi.Expand(req.URL, map[string]string{
  5434. "projectId": c.projectId,
  5435. "datasetId": c.datasetId,
  5436. "tableId": c.tableId,
  5437. })
  5438. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5439. }
  5440. // Do executes the "bigquery.tabledata.list" call.
  5441. // Exactly one of *TableDataList or error will be non-nil. Any non-2xx
  5442. // status code is an error. Response headers are in either
  5443. // *TableDataList.ServerResponse.Header or (if a response was returned
  5444. // at all) in error.(*googleapi.Error).Header. Use
  5445. // googleapi.IsNotModified to check whether the returned error was
  5446. // because http.StatusNotModified was returned.
  5447. func (c *TabledataListCall) Do(opts ...googleapi.CallOption) (*TableDataList, error) {
  5448. gensupport.SetOptions(c.urlParams_, opts...)
  5449. res, err := c.doRequest("json")
  5450. if res != nil && res.StatusCode == http.StatusNotModified {
  5451. if res.Body != nil {
  5452. res.Body.Close()
  5453. }
  5454. return nil, &googleapi.Error{
  5455. Code: res.StatusCode,
  5456. Header: res.Header,
  5457. }
  5458. }
  5459. if err != nil {
  5460. return nil, err
  5461. }
  5462. defer googleapi.CloseBody(res)
  5463. if err := googleapi.CheckResponse(res); err != nil {
  5464. return nil, err
  5465. }
  5466. ret := &TableDataList{
  5467. ServerResponse: googleapi.ServerResponse{
  5468. Header: res.Header,
  5469. HTTPStatusCode: res.StatusCode,
  5470. },
  5471. }
  5472. target := &ret
  5473. if err := gensupport.DecodeResponse(target, res); err != nil {
  5474. return nil, err
  5475. }
  5476. return ret, nil
  5477. // {
  5478. // "description": "Retrieves table data from a specified set of rows. Requires the READER dataset role.",
  5479. // "httpMethod": "GET",
  5480. // "id": "bigquery.tabledata.list",
  5481. // "parameterOrder": [
  5482. // "projectId",
  5483. // "datasetId",
  5484. // "tableId"
  5485. // ],
  5486. // "parameters": {
  5487. // "datasetId": {
  5488. // "description": "Dataset ID of the table to read",
  5489. // "location": "path",
  5490. // "required": true,
  5491. // "type": "string"
  5492. // },
  5493. // "maxResults": {
  5494. // "description": "Maximum number of results to return",
  5495. // "format": "uint32",
  5496. // "location": "query",
  5497. // "type": "integer"
  5498. // },
  5499. // "pageToken": {
  5500. // "description": "Page token, returned by a previous call, identifying the result set",
  5501. // "location": "query",
  5502. // "type": "string"
  5503. // },
  5504. // "projectId": {
  5505. // "description": "Project ID of the table to read",
  5506. // "location": "path",
  5507. // "required": true,
  5508. // "type": "string"
  5509. // },
  5510. // "selectedFields": {
  5511. // "description": "List of fields to return (comma-separated). If unspecified, all fields are returned",
  5512. // "location": "query",
  5513. // "type": "string"
  5514. // },
  5515. // "startIndex": {
  5516. // "description": "Zero-based index of the starting row to read",
  5517. // "format": "uint64",
  5518. // "location": "query",
  5519. // "type": "string"
  5520. // },
  5521. // "tableId": {
  5522. // "description": "Table ID of the table to read",
  5523. // "location": "path",
  5524. // "required": true,
  5525. // "type": "string"
  5526. // }
  5527. // },
  5528. // "path": "projects/{projectId}/datasets/{datasetId}/tables/{tableId}/data",
  5529. // "response": {
  5530. // "$ref": "TableDataList"
  5531. // },
  5532. // "scopes": [
  5533. // "https://www.googleapis.com/auth/bigquery",
  5534. // "https://www.googleapis.com/auth/cloud-platform",
  5535. // "https://www.googleapis.com/auth/cloud-platform.read-only"
  5536. // ]
  5537. // }
  5538. }
  5539. // Pages invokes f for each page of results.
  5540. // A non-nil error returned from f will halt the iteration.
  5541. // The provided context supersedes any context provided to the Context method.
  5542. func (c *TabledataListCall) Pages(ctx context.Context, f func(*TableDataList) error) error {
  5543. c.ctx_ = ctx
  5544. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  5545. for {
  5546. x, err := c.Do()
  5547. if err != nil {
  5548. return err
  5549. }
  5550. if err := f(x); err != nil {
  5551. return err
  5552. }
  5553. if x.PageToken == "" {
  5554. return nil
  5555. }
  5556. c.PageToken(x.PageToken)
  5557. }
  5558. }
  5559. // method id "bigquery.tables.delete":
  5560. type TablesDeleteCall struct {
  5561. s *Service
  5562. projectId string
  5563. datasetId string
  5564. tableId string
  5565. urlParams_ gensupport.URLParams
  5566. ctx_ context.Context
  5567. header_ http.Header
  5568. }
  5569. // Delete: Deletes the table specified by tableId from the dataset. If
  5570. // the table contains data, all the data will be deleted.
  5571. func (r *TablesService) Delete(projectId string, datasetId string, tableId string) *TablesDeleteCall {
  5572. c := &TablesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5573. c.projectId = projectId
  5574. c.datasetId = datasetId
  5575. c.tableId = tableId
  5576. return c
  5577. }
  5578. // Fields allows partial responses to be retrieved. See
  5579. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5580. // for more information.
  5581. func (c *TablesDeleteCall) Fields(s ...googleapi.Field) *TablesDeleteCall {
  5582. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5583. return c
  5584. }
  5585. // Context sets the context to be used in this call's Do method. Any
  5586. // pending HTTP request will be aborted if the provided context is
  5587. // canceled.
  5588. func (c *TablesDeleteCall) Context(ctx context.Context) *TablesDeleteCall {
  5589. c.ctx_ = ctx
  5590. return c
  5591. }
  5592. // Header returns an http.Header that can be modified by the caller to
  5593. // add HTTP headers to the request.
  5594. func (c *TablesDeleteCall) Header() http.Header {
  5595. if c.header_ == nil {
  5596. c.header_ = make(http.Header)
  5597. }
  5598. return c.header_
  5599. }
  5600. func (c *TablesDeleteCall) doRequest(alt string) (*http.Response, error) {
  5601. reqHeaders := make(http.Header)
  5602. for k, v := range c.header_ {
  5603. reqHeaders[k] = v
  5604. }
  5605. reqHeaders.Set("User-Agent", c.s.userAgent())
  5606. var body io.Reader = nil
  5607. c.urlParams_.Set("alt", alt)
  5608. urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{projectId}/datasets/{datasetId}/tables/{tableId}")
  5609. urls += "?" + c.urlParams_.Encode()
  5610. req, _ := http.NewRequest("DELETE", urls, body)
  5611. req.Header = reqHeaders
  5612. googleapi.Expand(req.URL, map[string]string{
  5613. "projectId": c.projectId,
  5614. "datasetId": c.datasetId,
  5615. "tableId": c.tableId,
  5616. })
  5617. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5618. }
  5619. // Do executes the "bigquery.tables.delete" call.
  5620. func (c *TablesDeleteCall) Do(opts ...googleapi.CallOption) error {
  5621. gensupport.SetOptions(c.urlParams_, opts...)
  5622. res, err := c.doRequest("json")
  5623. if err != nil {
  5624. return err
  5625. }
  5626. defer googleapi.CloseBody(res)
  5627. if err := googleapi.CheckResponse(res); err != nil {
  5628. return err
  5629. }
  5630. return nil
  5631. // {
  5632. // "description": "Deletes the table specified by tableId from the dataset. If the table contains data, all the data will be deleted.",
  5633. // "httpMethod": "DELETE",
  5634. // "id": "bigquery.tables.delete",
  5635. // "parameterOrder": [
  5636. // "projectId",
  5637. // "datasetId",
  5638. // "tableId"
  5639. // ],
  5640. // "parameters": {
  5641. // "datasetId": {
  5642. // "description": "Dataset ID of the table to delete",
  5643. // "location": "path",
  5644. // "required": true,
  5645. // "type": "string"
  5646. // },
  5647. // "projectId": {
  5648. // "description": "Project ID of the table to delete",
  5649. // "location": "path",
  5650. // "required": true,
  5651. // "type": "string"
  5652. // },
  5653. // "tableId": {
  5654. // "description": "Table ID of the table to delete",
  5655. // "location": "path",
  5656. // "required": true,
  5657. // "type": "string"
  5658. // }
  5659. // },
  5660. // "path": "projects/{projectId}/datasets/{datasetId}/tables/{tableId}",
  5661. // "scopes": [
  5662. // "https://www.googleapis.com/auth/bigquery",
  5663. // "https://www.googleapis.com/auth/cloud-platform"
  5664. // ]
  5665. // }
  5666. }
  5667. // method id "bigquery.tables.get":
  5668. type TablesGetCall struct {
  5669. s *Service
  5670. projectId string
  5671. datasetId string
  5672. tableId string
  5673. urlParams_ gensupport.URLParams
  5674. ifNoneMatch_ string
  5675. ctx_ context.Context
  5676. header_ http.Header
  5677. }
  5678. // Get: Gets the specified table resource by table ID. This method does
  5679. // not return the data in the table, it only returns the table resource,
  5680. // which describes the structure of this table.
  5681. func (r *TablesService) Get(projectId string, datasetId string, tableId string) *TablesGetCall {
  5682. c := &TablesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5683. c.projectId = projectId
  5684. c.datasetId = datasetId
  5685. c.tableId = tableId
  5686. return c
  5687. }
  5688. // SelectedFields sets the optional parameter "selectedFields": List of
  5689. // fields to return (comma-separated). If unspecified, all fields are
  5690. // returned
  5691. func (c *TablesGetCall) SelectedFields(selectedFields string) *TablesGetCall {
  5692. c.urlParams_.Set("selectedFields", selectedFields)
  5693. return c
  5694. }
  5695. // Fields allows partial responses to be retrieved. See
  5696. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5697. // for more information.
  5698. func (c *TablesGetCall) Fields(s ...googleapi.Field) *TablesGetCall {
  5699. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5700. return c
  5701. }
  5702. // IfNoneMatch sets the optional parameter which makes the operation
  5703. // fail if the object's ETag matches the given value. This is useful for
  5704. // getting updates only after the object has changed since the last
  5705. // request. Use googleapi.IsNotModified to check whether the response
  5706. // error from Do is the result of In-None-Match.
  5707. func (c *TablesGetCall) IfNoneMatch(entityTag string) *TablesGetCall {
  5708. c.ifNoneMatch_ = entityTag
  5709. return c
  5710. }
  5711. // Context sets the context to be used in this call's Do method. Any
  5712. // pending HTTP request will be aborted if the provided context is
  5713. // canceled.
  5714. func (c *TablesGetCall) Context(ctx context.Context) *TablesGetCall {
  5715. c.ctx_ = ctx
  5716. return c
  5717. }
  5718. // Header returns an http.Header that can be modified by the caller to
  5719. // add HTTP headers to the request.
  5720. func (c *TablesGetCall) Header() http.Header {
  5721. if c.header_ == nil {
  5722. c.header_ = make(http.Header)
  5723. }
  5724. return c.header_
  5725. }
  5726. func (c *TablesGetCall) doRequest(alt string) (*http.Response, error) {
  5727. reqHeaders := make(http.Header)
  5728. for k, v := range c.header_ {
  5729. reqHeaders[k] = v
  5730. }
  5731. reqHeaders.Set("User-Agent", c.s.userAgent())
  5732. if c.ifNoneMatch_ != "" {
  5733. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  5734. }
  5735. var body io.Reader = nil
  5736. c.urlParams_.Set("alt", alt)
  5737. urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{projectId}/datasets/{datasetId}/tables/{tableId}")
  5738. urls += "?" + c.urlParams_.Encode()
  5739. req, _ := http.NewRequest("GET", urls, body)
  5740. req.Header = reqHeaders
  5741. googleapi.Expand(req.URL, map[string]string{
  5742. "projectId": c.projectId,
  5743. "datasetId": c.datasetId,
  5744. "tableId": c.tableId,
  5745. })
  5746. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5747. }
  5748. // Do executes the "bigquery.tables.get" call.
  5749. // Exactly one of *Table or error will be non-nil. Any non-2xx status
  5750. // code is an error. Response headers are in either
  5751. // *Table.ServerResponse.Header or (if a response was returned at all)
  5752. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  5753. // check whether the returned error was because http.StatusNotModified
  5754. // was returned.
  5755. func (c *TablesGetCall) Do(opts ...googleapi.CallOption) (*Table, error) {
  5756. gensupport.SetOptions(c.urlParams_, opts...)
  5757. res, err := c.doRequest("json")
  5758. if res != nil && res.StatusCode == http.StatusNotModified {
  5759. if res.Body != nil {
  5760. res.Body.Close()
  5761. }
  5762. return nil, &googleapi.Error{
  5763. Code: res.StatusCode,
  5764. Header: res.Header,
  5765. }
  5766. }
  5767. if err != nil {
  5768. return nil, err
  5769. }
  5770. defer googleapi.CloseBody(res)
  5771. if err := googleapi.CheckResponse(res); err != nil {
  5772. return nil, err
  5773. }
  5774. ret := &Table{
  5775. ServerResponse: googleapi.ServerResponse{
  5776. Header: res.Header,
  5777. HTTPStatusCode: res.StatusCode,
  5778. },
  5779. }
  5780. target := &ret
  5781. if err := gensupport.DecodeResponse(target, res); err != nil {
  5782. return nil, err
  5783. }
  5784. return ret, nil
  5785. // {
  5786. // "description": "Gets the specified table resource by table ID. This method does not return the data in the table, it only returns the table resource, which describes the structure of this table.",
  5787. // "httpMethod": "GET",
  5788. // "id": "bigquery.tables.get",
  5789. // "parameterOrder": [
  5790. // "projectId",
  5791. // "datasetId",
  5792. // "tableId"
  5793. // ],
  5794. // "parameters": {
  5795. // "datasetId": {
  5796. // "description": "Dataset ID of the requested table",
  5797. // "location": "path",
  5798. // "required": true,
  5799. // "type": "string"
  5800. // },
  5801. // "projectId": {
  5802. // "description": "Project ID of the requested table",
  5803. // "location": "path",
  5804. // "required": true,
  5805. // "type": "string"
  5806. // },
  5807. // "selectedFields": {
  5808. // "description": "List of fields to return (comma-separated). If unspecified, all fields are returned",
  5809. // "location": "query",
  5810. // "type": "string"
  5811. // },
  5812. // "tableId": {
  5813. // "description": "Table ID of the requested table",
  5814. // "location": "path",
  5815. // "required": true,
  5816. // "type": "string"
  5817. // }
  5818. // },
  5819. // "path": "projects/{projectId}/datasets/{datasetId}/tables/{tableId}",
  5820. // "response": {
  5821. // "$ref": "Table"
  5822. // },
  5823. // "scopes": [
  5824. // "https://www.googleapis.com/auth/bigquery",
  5825. // "https://www.googleapis.com/auth/cloud-platform",
  5826. // "https://www.googleapis.com/auth/cloud-platform.read-only"
  5827. // ]
  5828. // }
  5829. }
  5830. // method id "bigquery.tables.insert":
  5831. type TablesInsertCall struct {
  5832. s *Service
  5833. projectId string
  5834. datasetId string
  5835. table *Table
  5836. urlParams_ gensupport.URLParams
  5837. ctx_ context.Context
  5838. header_ http.Header
  5839. }
  5840. // Insert: Creates a new, empty table in the dataset.
  5841. func (r *TablesService) Insert(projectId string, datasetId string, table *Table) *TablesInsertCall {
  5842. c := &TablesInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5843. c.projectId = projectId
  5844. c.datasetId = datasetId
  5845. c.table = table
  5846. return c
  5847. }
  5848. // Fields allows partial responses to be retrieved. See
  5849. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5850. // for more information.
  5851. func (c *TablesInsertCall) Fields(s ...googleapi.Field) *TablesInsertCall {
  5852. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5853. return c
  5854. }
  5855. // Context sets the context to be used in this call's Do method. Any
  5856. // pending HTTP request will be aborted if the provided context is
  5857. // canceled.
  5858. func (c *TablesInsertCall) Context(ctx context.Context) *TablesInsertCall {
  5859. c.ctx_ = ctx
  5860. return c
  5861. }
  5862. // Header returns an http.Header that can be modified by the caller to
  5863. // add HTTP headers to the request.
  5864. func (c *TablesInsertCall) Header() http.Header {
  5865. if c.header_ == nil {
  5866. c.header_ = make(http.Header)
  5867. }
  5868. return c.header_
  5869. }
  5870. func (c *TablesInsertCall) doRequest(alt string) (*http.Response, error) {
  5871. reqHeaders := make(http.Header)
  5872. for k, v := range c.header_ {
  5873. reqHeaders[k] = v
  5874. }
  5875. reqHeaders.Set("User-Agent", c.s.userAgent())
  5876. var body io.Reader = nil
  5877. body, err := googleapi.WithoutDataWrapper.JSONReader(c.table)
  5878. if err != nil {
  5879. return nil, err
  5880. }
  5881. reqHeaders.Set("Content-Type", "application/json")
  5882. c.urlParams_.Set("alt", alt)
  5883. urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{projectId}/datasets/{datasetId}/tables")
  5884. urls += "?" + c.urlParams_.Encode()
  5885. req, _ := http.NewRequest("POST", urls, body)
  5886. req.Header = reqHeaders
  5887. googleapi.Expand(req.URL, map[string]string{
  5888. "projectId": c.projectId,
  5889. "datasetId": c.datasetId,
  5890. })
  5891. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5892. }
  5893. // Do executes the "bigquery.tables.insert" call.
  5894. // Exactly one of *Table or error will be non-nil. Any non-2xx status
  5895. // code is an error. Response headers are in either
  5896. // *Table.ServerResponse.Header or (if a response was returned at all)
  5897. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  5898. // check whether the returned error was because http.StatusNotModified
  5899. // was returned.
  5900. func (c *TablesInsertCall) Do(opts ...googleapi.CallOption) (*Table, error) {
  5901. gensupport.SetOptions(c.urlParams_, opts...)
  5902. res, err := c.doRequest("json")
  5903. if res != nil && res.StatusCode == http.StatusNotModified {
  5904. if res.Body != nil {
  5905. res.Body.Close()
  5906. }
  5907. return nil, &googleapi.Error{
  5908. Code: res.StatusCode,
  5909. Header: res.Header,
  5910. }
  5911. }
  5912. if err != nil {
  5913. return nil, err
  5914. }
  5915. defer googleapi.CloseBody(res)
  5916. if err := googleapi.CheckResponse(res); err != nil {
  5917. return nil, err
  5918. }
  5919. ret := &Table{
  5920. ServerResponse: googleapi.ServerResponse{
  5921. Header: res.Header,
  5922. HTTPStatusCode: res.StatusCode,
  5923. },
  5924. }
  5925. target := &ret
  5926. if err := gensupport.DecodeResponse(target, res); err != nil {
  5927. return nil, err
  5928. }
  5929. return ret, nil
  5930. // {
  5931. // "description": "Creates a new, empty table in the dataset.",
  5932. // "httpMethod": "POST",
  5933. // "id": "bigquery.tables.insert",
  5934. // "parameterOrder": [
  5935. // "projectId",
  5936. // "datasetId"
  5937. // ],
  5938. // "parameters": {
  5939. // "datasetId": {
  5940. // "description": "Dataset ID of the new table",
  5941. // "location": "path",
  5942. // "required": true,
  5943. // "type": "string"
  5944. // },
  5945. // "projectId": {
  5946. // "description": "Project ID of the new table",
  5947. // "location": "path",
  5948. // "required": true,
  5949. // "type": "string"
  5950. // }
  5951. // },
  5952. // "path": "projects/{projectId}/datasets/{datasetId}/tables",
  5953. // "request": {
  5954. // "$ref": "Table"
  5955. // },
  5956. // "response": {
  5957. // "$ref": "Table"
  5958. // },
  5959. // "scopes": [
  5960. // "https://www.googleapis.com/auth/bigquery",
  5961. // "https://www.googleapis.com/auth/cloud-platform"
  5962. // ]
  5963. // }
  5964. }
  5965. // method id "bigquery.tables.list":
  5966. type TablesListCall struct {
  5967. s *Service
  5968. projectId string
  5969. datasetId string
  5970. urlParams_ gensupport.URLParams
  5971. ifNoneMatch_ string
  5972. ctx_ context.Context
  5973. header_ http.Header
  5974. }
  5975. // List: Lists all tables in the specified dataset. Requires the READER
  5976. // dataset role.
  5977. func (r *TablesService) List(projectId string, datasetId string) *TablesListCall {
  5978. c := &TablesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5979. c.projectId = projectId
  5980. c.datasetId = datasetId
  5981. return c
  5982. }
  5983. // MaxResults sets the optional parameter "maxResults": Maximum number
  5984. // of results to return
  5985. func (c *TablesListCall) MaxResults(maxResults int64) *TablesListCall {
  5986. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  5987. return c
  5988. }
  5989. // PageToken sets the optional parameter "pageToken": Page token,
  5990. // returned by a previous call, to request the next page of results
  5991. func (c *TablesListCall) PageToken(pageToken string) *TablesListCall {
  5992. c.urlParams_.Set("pageToken", pageToken)
  5993. return c
  5994. }
  5995. // Fields allows partial responses to be retrieved. See
  5996. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5997. // for more information.
  5998. func (c *TablesListCall) Fields(s ...googleapi.Field) *TablesListCall {
  5999. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6000. return c
  6001. }
  6002. // IfNoneMatch sets the optional parameter which makes the operation
  6003. // fail if the object's ETag matches the given value. This is useful for
  6004. // getting updates only after the object has changed since the last
  6005. // request. Use googleapi.IsNotModified to check whether the response
  6006. // error from Do is the result of In-None-Match.
  6007. func (c *TablesListCall) IfNoneMatch(entityTag string) *TablesListCall {
  6008. c.ifNoneMatch_ = entityTag
  6009. return c
  6010. }
  6011. // Context sets the context to be used in this call's Do method. Any
  6012. // pending HTTP request will be aborted if the provided context is
  6013. // canceled.
  6014. func (c *TablesListCall) Context(ctx context.Context) *TablesListCall {
  6015. c.ctx_ = ctx
  6016. return c
  6017. }
  6018. // Header returns an http.Header that can be modified by the caller to
  6019. // add HTTP headers to the request.
  6020. func (c *TablesListCall) Header() http.Header {
  6021. if c.header_ == nil {
  6022. c.header_ = make(http.Header)
  6023. }
  6024. return c.header_
  6025. }
  6026. func (c *TablesListCall) doRequest(alt string) (*http.Response, error) {
  6027. reqHeaders := make(http.Header)
  6028. for k, v := range c.header_ {
  6029. reqHeaders[k] = v
  6030. }
  6031. reqHeaders.Set("User-Agent", c.s.userAgent())
  6032. if c.ifNoneMatch_ != "" {
  6033. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  6034. }
  6035. var body io.Reader = nil
  6036. c.urlParams_.Set("alt", alt)
  6037. urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{projectId}/datasets/{datasetId}/tables")
  6038. urls += "?" + c.urlParams_.Encode()
  6039. req, _ := http.NewRequest("GET", urls, body)
  6040. req.Header = reqHeaders
  6041. googleapi.Expand(req.URL, map[string]string{
  6042. "projectId": c.projectId,
  6043. "datasetId": c.datasetId,
  6044. })
  6045. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6046. }
  6047. // Do executes the "bigquery.tables.list" call.
  6048. // Exactly one of *TableList or error will be non-nil. Any non-2xx
  6049. // status code is an error. Response headers are in either
  6050. // *TableList.ServerResponse.Header or (if a response was returned at
  6051. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  6052. // to check whether the returned error was because
  6053. // http.StatusNotModified was returned.
  6054. func (c *TablesListCall) Do(opts ...googleapi.CallOption) (*TableList, error) {
  6055. gensupport.SetOptions(c.urlParams_, opts...)
  6056. res, err := c.doRequest("json")
  6057. if res != nil && res.StatusCode == http.StatusNotModified {
  6058. if res.Body != nil {
  6059. res.Body.Close()
  6060. }
  6061. return nil, &googleapi.Error{
  6062. Code: res.StatusCode,
  6063. Header: res.Header,
  6064. }
  6065. }
  6066. if err != nil {
  6067. return nil, err
  6068. }
  6069. defer googleapi.CloseBody(res)
  6070. if err := googleapi.CheckResponse(res); err != nil {
  6071. return nil, err
  6072. }
  6073. ret := &TableList{
  6074. ServerResponse: googleapi.ServerResponse{
  6075. Header: res.Header,
  6076. HTTPStatusCode: res.StatusCode,
  6077. },
  6078. }
  6079. target := &ret
  6080. if err := gensupport.DecodeResponse(target, res); err != nil {
  6081. return nil, err
  6082. }
  6083. return ret, nil
  6084. // {
  6085. // "description": "Lists all tables in the specified dataset. Requires the READER dataset role.",
  6086. // "httpMethod": "GET",
  6087. // "id": "bigquery.tables.list",
  6088. // "parameterOrder": [
  6089. // "projectId",
  6090. // "datasetId"
  6091. // ],
  6092. // "parameters": {
  6093. // "datasetId": {
  6094. // "description": "Dataset ID of the tables to list",
  6095. // "location": "path",
  6096. // "required": true,
  6097. // "type": "string"
  6098. // },
  6099. // "maxResults": {
  6100. // "description": "Maximum number of results to return",
  6101. // "format": "uint32",
  6102. // "location": "query",
  6103. // "type": "integer"
  6104. // },
  6105. // "pageToken": {
  6106. // "description": "Page token, returned by a previous call, to request the next page of results",
  6107. // "location": "query",
  6108. // "type": "string"
  6109. // },
  6110. // "projectId": {
  6111. // "description": "Project ID of the tables to list",
  6112. // "location": "path",
  6113. // "required": true,
  6114. // "type": "string"
  6115. // }
  6116. // },
  6117. // "path": "projects/{projectId}/datasets/{datasetId}/tables",
  6118. // "response": {
  6119. // "$ref": "TableList"
  6120. // },
  6121. // "scopes": [
  6122. // "https://www.googleapis.com/auth/bigquery",
  6123. // "https://www.googleapis.com/auth/cloud-platform",
  6124. // "https://www.googleapis.com/auth/cloud-platform.read-only"
  6125. // ]
  6126. // }
  6127. }
  6128. // Pages invokes f for each page of results.
  6129. // A non-nil error returned from f will halt the iteration.
  6130. // The provided context supersedes any context provided to the Context method.
  6131. func (c *TablesListCall) Pages(ctx context.Context, f func(*TableList) error) error {
  6132. c.ctx_ = ctx
  6133. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  6134. for {
  6135. x, err := c.Do()
  6136. if err != nil {
  6137. return err
  6138. }
  6139. if err := f(x); err != nil {
  6140. return err
  6141. }
  6142. if x.NextPageToken == "" {
  6143. return nil
  6144. }
  6145. c.PageToken(x.NextPageToken)
  6146. }
  6147. }
  6148. // method id "bigquery.tables.patch":
  6149. type TablesPatchCall struct {
  6150. s *Service
  6151. projectId string
  6152. datasetId string
  6153. tableId string
  6154. table *Table
  6155. urlParams_ gensupport.URLParams
  6156. ctx_ context.Context
  6157. header_ http.Header
  6158. }
  6159. // Patch: Updates information in an existing table. The update method
  6160. // replaces the entire table resource, whereas the patch method only
  6161. // replaces fields that are provided in the submitted table resource.
  6162. // This method supports patch semantics.
  6163. func (r *TablesService) Patch(projectId string, datasetId string, tableId string, table *Table) *TablesPatchCall {
  6164. c := &TablesPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6165. c.projectId = projectId
  6166. c.datasetId = datasetId
  6167. c.tableId = tableId
  6168. c.table = table
  6169. return c
  6170. }
  6171. // Fields allows partial responses to be retrieved. See
  6172. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6173. // for more information.
  6174. func (c *TablesPatchCall) Fields(s ...googleapi.Field) *TablesPatchCall {
  6175. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6176. return c
  6177. }
  6178. // Context sets the context to be used in this call's Do method. Any
  6179. // pending HTTP request will be aborted if the provided context is
  6180. // canceled.
  6181. func (c *TablesPatchCall) Context(ctx context.Context) *TablesPatchCall {
  6182. c.ctx_ = ctx
  6183. return c
  6184. }
  6185. // Header returns an http.Header that can be modified by the caller to
  6186. // add HTTP headers to the request.
  6187. func (c *TablesPatchCall) Header() http.Header {
  6188. if c.header_ == nil {
  6189. c.header_ = make(http.Header)
  6190. }
  6191. return c.header_
  6192. }
  6193. func (c *TablesPatchCall) doRequest(alt string) (*http.Response, error) {
  6194. reqHeaders := make(http.Header)
  6195. for k, v := range c.header_ {
  6196. reqHeaders[k] = v
  6197. }
  6198. reqHeaders.Set("User-Agent", c.s.userAgent())
  6199. var body io.Reader = nil
  6200. body, err := googleapi.WithoutDataWrapper.JSONReader(c.table)
  6201. if err != nil {
  6202. return nil, err
  6203. }
  6204. reqHeaders.Set("Content-Type", "application/json")
  6205. c.urlParams_.Set("alt", alt)
  6206. urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{projectId}/datasets/{datasetId}/tables/{tableId}")
  6207. urls += "?" + c.urlParams_.Encode()
  6208. req, _ := http.NewRequest("PATCH", urls, body)
  6209. req.Header = reqHeaders
  6210. googleapi.Expand(req.URL, map[string]string{
  6211. "projectId": c.projectId,
  6212. "datasetId": c.datasetId,
  6213. "tableId": c.tableId,
  6214. })
  6215. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6216. }
  6217. // Do executes the "bigquery.tables.patch" call.
  6218. // Exactly one of *Table or error will be non-nil. Any non-2xx status
  6219. // code is an error. Response headers are in either
  6220. // *Table.ServerResponse.Header or (if a response was returned at all)
  6221. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  6222. // check whether the returned error was because http.StatusNotModified
  6223. // was returned.
  6224. func (c *TablesPatchCall) Do(opts ...googleapi.CallOption) (*Table, error) {
  6225. gensupport.SetOptions(c.urlParams_, opts...)
  6226. res, err := c.doRequest("json")
  6227. if res != nil && res.StatusCode == http.StatusNotModified {
  6228. if res.Body != nil {
  6229. res.Body.Close()
  6230. }
  6231. return nil, &googleapi.Error{
  6232. Code: res.StatusCode,
  6233. Header: res.Header,
  6234. }
  6235. }
  6236. if err != nil {
  6237. return nil, err
  6238. }
  6239. defer googleapi.CloseBody(res)
  6240. if err := googleapi.CheckResponse(res); err != nil {
  6241. return nil, err
  6242. }
  6243. ret := &Table{
  6244. ServerResponse: googleapi.ServerResponse{
  6245. Header: res.Header,
  6246. HTTPStatusCode: res.StatusCode,
  6247. },
  6248. }
  6249. target := &ret
  6250. if err := gensupport.DecodeResponse(target, res); err != nil {
  6251. return nil, err
  6252. }
  6253. return ret, nil
  6254. // {
  6255. // "description": "Updates information in an existing table. The update method replaces the entire table resource, whereas the patch method only replaces fields that are provided in the submitted table resource. This method supports patch semantics.",
  6256. // "httpMethod": "PATCH",
  6257. // "id": "bigquery.tables.patch",
  6258. // "parameterOrder": [
  6259. // "projectId",
  6260. // "datasetId",
  6261. // "tableId"
  6262. // ],
  6263. // "parameters": {
  6264. // "datasetId": {
  6265. // "description": "Dataset ID of the table to update",
  6266. // "location": "path",
  6267. // "required": true,
  6268. // "type": "string"
  6269. // },
  6270. // "projectId": {
  6271. // "description": "Project ID of the table to update",
  6272. // "location": "path",
  6273. // "required": true,
  6274. // "type": "string"
  6275. // },
  6276. // "tableId": {
  6277. // "description": "Table ID of the table to update",
  6278. // "location": "path",
  6279. // "required": true,
  6280. // "type": "string"
  6281. // }
  6282. // },
  6283. // "path": "projects/{projectId}/datasets/{datasetId}/tables/{tableId}",
  6284. // "request": {
  6285. // "$ref": "Table"
  6286. // },
  6287. // "response": {
  6288. // "$ref": "Table"
  6289. // },
  6290. // "scopes": [
  6291. // "https://www.googleapis.com/auth/bigquery",
  6292. // "https://www.googleapis.com/auth/cloud-platform"
  6293. // ]
  6294. // }
  6295. }
  6296. // method id "bigquery.tables.update":
  6297. type TablesUpdateCall struct {
  6298. s *Service
  6299. projectId string
  6300. datasetId string
  6301. tableId string
  6302. table *Table
  6303. urlParams_ gensupport.URLParams
  6304. ctx_ context.Context
  6305. header_ http.Header
  6306. }
  6307. // Update: Updates information in an existing table. The update method
  6308. // replaces the entire table resource, whereas the patch method only
  6309. // replaces fields that are provided in the submitted table resource.
  6310. func (r *TablesService) Update(projectId string, datasetId string, tableId string, table *Table) *TablesUpdateCall {
  6311. c := &TablesUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6312. c.projectId = projectId
  6313. c.datasetId = datasetId
  6314. c.tableId = tableId
  6315. c.table = table
  6316. return c
  6317. }
  6318. // Fields allows partial responses to be retrieved. See
  6319. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6320. // for more information.
  6321. func (c *TablesUpdateCall) Fields(s ...googleapi.Field) *TablesUpdateCall {
  6322. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6323. return c
  6324. }
  6325. // Context sets the context to be used in this call's Do method. Any
  6326. // pending HTTP request will be aborted if the provided context is
  6327. // canceled.
  6328. func (c *TablesUpdateCall) Context(ctx context.Context) *TablesUpdateCall {
  6329. c.ctx_ = ctx
  6330. return c
  6331. }
  6332. // Header returns an http.Header that can be modified by the caller to
  6333. // add HTTP headers to the request.
  6334. func (c *TablesUpdateCall) Header() http.Header {
  6335. if c.header_ == nil {
  6336. c.header_ = make(http.Header)
  6337. }
  6338. return c.header_
  6339. }
  6340. func (c *TablesUpdateCall) doRequest(alt string) (*http.Response, error) {
  6341. reqHeaders := make(http.Header)
  6342. for k, v := range c.header_ {
  6343. reqHeaders[k] = v
  6344. }
  6345. reqHeaders.Set("User-Agent", c.s.userAgent())
  6346. var body io.Reader = nil
  6347. body, err := googleapi.WithoutDataWrapper.JSONReader(c.table)
  6348. if err != nil {
  6349. return nil, err
  6350. }
  6351. reqHeaders.Set("Content-Type", "application/json")
  6352. c.urlParams_.Set("alt", alt)
  6353. urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{projectId}/datasets/{datasetId}/tables/{tableId}")
  6354. urls += "?" + c.urlParams_.Encode()
  6355. req, _ := http.NewRequest("PUT", urls, body)
  6356. req.Header = reqHeaders
  6357. googleapi.Expand(req.URL, map[string]string{
  6358. "projectId": c.projectId,
  6359. "datasetId": c.datasetId,
  6360. "tableId": c.tableId,
  6361. })
  6362. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6363. }
  6364. // Do executes the "bigquery.tables.update" call.
  6365. // Exactly one of *Table or error will be non-nil. Any non-2xx status
  6366. // code is an error. Response headers are in either
  6367. // *Table.ServerResponse.Header or (if a response was returned at all)
  6368. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  6369. // check whether the returned error was because http.StatusNotModified
  6370. // was returned.
  6371. func (c *TablesUpdateCall) Do(opts ...googleapi.CallOption) (*Table, error) {
  6372. gensupport.SetOptions(c.urlParams_, opts...)
  6373. res, err := c.doRequest("json")
  6374. if res != nil && res.StatusCode == http.StatusNotModified {
  6375. if res.Body != nil {
  6376. res.Body.Close()
  6377. }
  6378. return nil, &googleapi.Error{
  6379. Code: res.StatusCode,
  6380. Header: res.Header,
  6381. }
  6382. }
  6383. if err != nil {
  6384. return nil, err
  6385. }
  6386. defer googleapi.CloseBody(res)
  6387. if err := googleapi.CheckResponse(res); err != nil {
  6388. return nil, err
  6389. }
  6390. ret := &Table{
  6391. ServerResponse: googleapi.ServerResponse{
  6392. Header: res.Header,
  6393. HTTPStatusCode: res.StatusCode,
  6394. },
  6395. }
  6396. target := &ret
  6397. if err := gensupport.DecodeResponse(target, res); err != nil {
  6398. return nil, err
  6399. }
  6400. return ret, nil
  6401. // {
  6402. // "description": "Updates information in an existing table. The update method replaces the entire table resource, whereas the patch method only replaces fields that are provided in the submitted table resource.",
  6403. // "httpMethod": "PUT",
  6404. // "id": "bigquery.tables.update",
  6405. // "parameterOrder": [
  6406. // "projectId",
  6407. // "datasetId",
  6408. // "tableId"
  6409. // ],
  6410. // "parameters": {
  6411. // "datasetId": {
  6412. // "description": "Dataset ID of the table to update",
  6413. // "location": "path",
  6414. // "required": true,
  6415. // "type": "string"
  6416. // },
  6417. // "projectId": {
  6418. // "description": "Project ID of the table to update",
  6419. // "location": "path",
  6420. // "required": true,
  6421. // "type": "string"
  6422. // },
  6423. // "tableId": {
  6424. // "description": "Table ID of the table to update",
  6425. // "location": "path",
  6426. // "required": true,
  6427. // "type": "string"
  6428. // }
  6429. // },
  6430. // "path": "projects/{projectId}/datasets/{datasetId}/tables/{tableId}",
  6431. // "request": {
  6432. // "$ref": "Table"
  6433. // },
  6434. // "response": {
  6435. // "$ref": "Table"
  6436. // },
  6437. // "scopes": [
  6438. // "https://www.googleapis.com/auth/bigquery",
  6439. // "https://www.googleapis.com/auth/cloud-platform"
  6440. // ]
  6441. // }
  6442. }