bigquery-gen.go 186 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371
  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 CsvOptions struct {
  125. // AllowJaggedRows: [Optional] Indicates if BigQuery should accept rows
  126. // that are missing trailing optional columns. If true, BigQuery treats
  127. // missing trailing columns as null values. If false, records with
  128. // missing trailing columns are treated as bad records, and if there are
  129. // too many bad records, an invalid error is returned in the job result.
  130. // The default value is false.
  131. AllowJaggedRows bool `json:"allowJaggedRows,omitempty"`
  132. // AllowQuotedNewlines: [Optional] Indicates if BigQuery should allow
  133. // quoted data sections that contain newline characters in a CSV file.
  134. // The default value is false.
  135. AllowQuotedNewlines bool `json:"allowQuotedNewlines,omitempty"`
  136. // Encoding: [Optional] The character encoding of the data. The
  137. // supported values are UTF-8 or ISO-8859-1. The default value is UTF-8.
  138. // BigQuery decodes the data after the raw, binary data has been split
  139. // using the values of the quote and fieldDelimiter properties.
  140. Encoding string `json:"encoding,omitempty"`
  141. // FieldDelimiter: [Optional] The separator for fields in a CSV file.
  142. // BigQuery converts the string to ISO-8859-1 encoding, and then uses
  143. // the first byte of the encoded string to split the data in its raw,
  144. // binary state. BigQuery also supports the escape sequence "\t" to
  145. // specify a tab separator. The default value is a comma (',').
  146. FieldDelimiter string `json:"fieldDelimiter,omitempty"`
  147. // Quote: [Optional] The value that is used to quote data sections in a
  148. // CSV file. BigQuery converts the string to ISO-8859-1 encoding, and
  149. // then uses the first byte of the encoded string to split the data in
  150. // its raw, binary state. The default value is a double-quote ('"'). If
  151. // your data does not contain quoted sections, set the property value to
  152. // an empty string. If your data contains quoted newline characters, you
  153. // must also set the allowQuotedNewlines property to true.
  154. //
  155. // Default: "
  156. Quote *string `json:"quote,omitempty"`
  157. // SkipLeadingRows: [Optional] The number of rows at the top of a CSV
  158. // file that BigQuery will skip when reading the data. The default value
  159. // is 0. This property is useful if you have header rows in the file
  160. // that should be skipped.
  161. SkipLeadingRows int64 `json:"skipLeadingRows,omitempty"`
  162. // ForceSendFields is a list of field names (e.g. "AllowJaggedRows") to
  163. // unconditionally include in API requests. By default, fields with
  164. // empty values are omitted from API requests. However, any non-pointer,
  165. // non-interface field appearing in ForceSendFields will be sent to the
  166. // server regardless of whether the field is empty or not. This may be
  167. // used to include empty fields in Patch requests.
  168. ForceSendFields []string `json:"-"`
  169. }
  170. func (s *CsvOptions) MarshalJSON() ([]byte, error) {
  171. type noMethod CsvOptions
  172. raw := noMethod(*s)
  173. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  174. }
  175. type Dataset struct {
  176. // Access: [Optional] An array of objects that define dataset access for
  177. // one or more entities. You can set this property when inserting or
  178. // updating a dataset in order to control who is allowed to access the
  179. // data. If unspecified at dataset creation time, BigQuery adds default
  180. // dataset access for the following entities: access.specialGroup:
  181. // projectReaders; access.role: READER; access.specialGroup:
  182. // projectWriters; access.role: WRITER; access.specialGroup:
  183. // projectOwners; access.role: OWNER; access.userByEmail: [dataset
  184. // creator email]; access.role: OWNER;
  185. Access []*DatasetAccess `json:"access,omitempty"`
  186. // CreationTime: [Output-only] The time when this dataset was created,
  187. // in milliseconds since the epoch.
  188. CreationTime int64 `json:"creationTime,omitempty,string"`
  189. // DatasetReference: [Required] A reference that identifies the dataset.
  190. DatasetReference *DatasetReference `json:"datasetReference,omitempty"`
  191. // DefaultTableExpirationMs: [Experimental] The default lifetime of all
  192. // tables in the dataset, in milliseconds. The minimum value is 3600000
  193. // milliseconds (one hour). Once this property is set, all newly-created
  194. // tables in the dataset will have an expirationTime property set to the
  195. // creation time plus the value in this property, and changing the value
  196. // will only affect new tables, not existing ones. When the
  197. // expirationTime for a given table is reached, that table will be
  198. // deleted automatically. If a table's expirationTime is modified or
  199. // removed before the table expires, or if you provide an explicit
  200. // expirationTime when creating a table, that value takes precedence
  201. // over the default expiration time indicated by this property.
  202. DefaultTableExpirationMs int64 `json:"defaultTableExpirationMs,omitempty,string"`
  203. // Description: [Optional] A user-friendly description of the dataset.
  204. Description string `json:"description,omitempty"`
  205. // Etag: [Output-only] A hash of the resource.
  206. Etag string `json:"etag,omitempty"`
  207. // FriendlyName: [Optional] A descriptive name for the dataset.
  208. FriendlyName string `json:"friendlyName,omitempty"`
  209. // Id: [Output-only] The fully-qualified unique name of the dataset in
  210. // the format projectId:datasetId. The dataset name without the project
  211. // name is given in the datasetId field. When creating a new dataset,
  212. // leave this field blank, and instead specify the datasetId field.
  213. Id string `json:"id,omitempty"`
  214. // Kind: [Output-only] The resource type.
  215. Kind string `json:"kind,omitempty"`
  216. // LastModifiedTime: [Output-only] The date when this dataset or any of
  217. // its tables was last modified, in milliseconds since the epoch.
  218. LastModifiedTime int64 `json:"lastModifiedTime,omitempty,string"`
  219. // Location: [Experimental] The geographic location where the dataset
  220. // should reside. Possible values include EU and US. The default value
  221. // is US.
  222. Location string `json:"location,omitempty"`
  223. // SelfLink: [Output-only] A URL that can be used to access the resource
  224. // again. You can use this URL in Get or Update requests to the
  225. // resource.
  226. SelfLink string `json:"selfLink,omitempty"`
  227. // ServerResponse contains the HTTP response code and headers from the
  228. // server.
  229. googleapi.ServerResponse `json:"-"`
  230. // ForceSendFields is a list of field names (e.g. "Access") to
  231. // unconditionally include in API requests. By default, fields with
  232. // empty values are omitted from API requests. However, any non-pointer,
  233. // non-interface field appearing in ForceSendFields will be sent to the
  234. // server regardless of whether the field is empty or not. This may be
  235. // used to include empty fields in Patch requests.
  236. ForceSendFields []string `json:"-"`
  237. }
  238. func (s *Dataset) MarshalJSON() ([]byte, error) {
  239. type noMethod Dataset
  240. raw := noMethod(*s)
  241. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  242. }
  243. type DatasetAccess struct {
  244. // Domain: [Pick one] A domain to grant access to. Any users signed in
  245. // with the domain specified will be granted the specified access.
  246. // Example: "example.com".
  247. Domain string `json:"domain,omitempty"`
  248. // GroupByEmail: [Pick one] An email address of a Google Group to grant
  249. // access to.
  250. GroupByEmail string `json:"groupByEmail,omitempty"`
  251. // Role: [Required] Describes the rights granted to the user specified
  252. // by the other member of the access object. The following string values
  253. // are supported: READER, WRITER, OWNER.
  254. Role string `json:"role,omitempty"`
  255. // SpecialGroup: [Pick one] A special group to grant access to. Possible
  256. // values include: projectOwners: Owners of the enclosing project.
  257. // projectReaders: Readers of the enclosing project. projectWriters:
  258. // Writers of the enclosing project. allAuthenticatedUsers: All
  259. // authenticated BigQuery users.
  260. SpecialGroup string `json:"specialGroup,omitempty"`
  261. // UserByEmail: [Pick one] An email address of a user to grant access
  262. // to. For example: fred@example.com.
  263. UserByEmail string `json:"userByEmail,omitempty"`
  264. // View: [Pick one] A view from a different dataset to grant access to.
  265. // Queries executed against that view will have read access to tables in
  266. // this dataset. The role field is not required when this field is set.
  267. // If that view is updated by any user, access to the view needs to be
  268. // granted again via an update operation.
  269. View *TableReference `json:"view,omitempty"`
  270. // ForceSendFields is a list of field names (e.g. "Domain") to
  271. // unconditionally include in API requests. By default, fields with
  272. // empty values are omitted from API requests. However, any non-pointer,
  273. // non-interface field appearing in ForceSendFields will be sent to the
  274. // server regardless of whether the field is empty or not. This may be
  275. // used to include empty fields in Patch requests.
  276. ForceSendFields []string `json:"-"`
  277. }
  278. func (s *DatasetAccess) MarshalJSON() ([]byte, error) {
  279. type noMethod DatasetAccess
  280. raw := noMethod(*s)
  281. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  282. }
  283. type DatasetList struct {
  284. // Datasets: An array of the dataset resources in the project. Each
  285. // resource contains basic information. For full information about a
  286. // particular dataset resource, use the Datasets: get method. This
  287. // property is omitted when there are no datasets in the project.
  288. Datasets []*DatasetListDatasets `json:"datasets,omitempty"`
  289. // Etag: A hash value of the results page. You can use this property to
  290. // determine if the page has changed since the last request.
  291. Etag string `json:"etag,omitempty"`
  292. // Kind: The list type. This property always returns the value
  293. // "bigquery#datasetList".
  294. Kind string `json:"kind,omitempty"`
  295. // NextPageToken: A token that can be used to request the next results
  296. // page. This property is omitted on the final results page.
  297. NextPageToken string `json:"nextPageToken,omitempty"`
  298. // ServerResponse contains the HTTP response code and headers from the
  299. // server.
  300. googleapi.ServerResponse `json:"-"`
  301. // ForceSendFields is a list of field names (e.g. "Datasets") to
  302. // unconditionally include in API requests. By default, fields with
  303. // empty values are omitted from API requests. However, any non-pointer,
  304. // non-interface field appearing in ForceSendFields will be sent to the
  305. // server regardless of whether the field is empty or not. This may be
  306. // used to include empty fields in Patch requests.
  307. ForceSendFields []string `json:"-"`
  308. }
  309. func (s *DatasetList) MarshalJSON() ([]byte, error) {
  310. type noMethod DatasetList
  311. raw := noMethod(*s)
  312. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  313. }
  314. type DatasetListDatasets struct {
  315. // DatasetReference: The dataset reference. Use this property to access
  316. // specific parts of the dataset's ID, such as project ID or dataset ID.
  317. DatasetReference *DatasetReference `json:"datasetReference,omitempty"`
  318. // FriendlyName: A descriptive name for the dataset, if one exists.
  319. FriendlyName string `json:"friendlyName,omitempty"`
  320. // Id: The fully-qualified, unique, opaque ID of the dataset.
  321. Id string `json:"id,omitempty"`
  322. // Kind: The resource type. This property always returns the value
  323. // "bigquery#dataset".
  324. Kind string `json:"kind,omitempty"`
  325. // ForceSendFields is a list of field names (e.g. "DatasetReference") to
  326. // unconditionally include in API requests. By default, fields with
  327. // empty values are omitted from API requests. However, any non-pointer,
  328. // non-interface field appearing in ForceSendFields will be sent to the
  329. // server regardless of whether the field is empty or not. This may be
  330. // used to include empty fields in Patch requests.
  331. ForceSendFields []string `json:"-"`
  332. }
  333. func (s *DatasetListDatasets) MarshalJSON() ([]byte, error) {
  334. type noMethod DatasetListDatasets
  335. raw := noMethod(*s)
  336. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  337. }
  338. type DatasetReference struct {
  339. // DatasetId: [Required] A unique ID for this dataset, without the
  340. // project name. The ID must contain only letters (a-z, A-Z), numbers
  341. // (0-9), or underscores (_). The maximum length is 1,024 characters.
  342. DatasetId string `json:"datasetId,omitempty"`
  343. // ProjectId: [Optional] The ID of the project containing this dataset.
  344. ProjectId string `json:"projectId,omitempty"`
  345. // ForceSendFields is a list of field names (e.g. "DatasetId") to
  346. // unconditionally include in API requests. By default, fields with
  347. // empty values are omitted from API requests. However, any non-pointer,
  348. // non-interface field appearing in ForceSendFields will be sent to the
  349. // server regardless of whether the field is empty or not. This may be
  350. // used to include empty fields in Patch requests.
  351. ForceSendFields []string `json:"-"`
  352. }
  353. func (s *DatasetReference) MarshalJSON() ([]byte, error) {
  354. type noMethod DatasetReference
  355. raw := noMethod(*s)
  356. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  357. }
  358. type ErrorProto struct {
  359. // DebugInfo: Debugging information. This property is internal to Google
  360. // and should not be used.
  361. DebugInfo string `json:"debugInfo,omitempty"`
  362. // Location: Specifies where the error occurred, if present.
  363. Location string `json:"location,omitempty"`
  364. // Message: A human-readable description of the error.
  365. Message string `json:"message,omitempty"`
  366. // Reason: A short error code that summarizes the error.
  367. Reason string `json:"reason,omitempty"`
  368. // ForceSendFields is a list of field names (e.g. "DebugInfo") to
  369. // unconditionally include in API requests. By default, fields with
  370. // empty values are omitted from API requests. However, any non-pointer,
  371. // non-interface field appearing in ForceSendFields will be sent to the
  372. // server regardless of whether the field is empty or not. This may be
  373. // used to include empty fields in Patch requests.
  374. ForceSendFields []string `json:"-"`
  375. }
  376. func (s *ErrorProto) MarshalJSON() ([]byte, error) {
  377. type noMethod ErrorProto
  378. raw := noMethod(*s)
  379. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  380. }
  381. type ExplainQueryStage struct {
  382. // ComputeRatioAvg: Relative amount of time the average shard spent on
  383. // CPU-bound tasks.
  384. ComputeRatioAvg float64 `json:"computeRatioAvg,omitempty"`
  385. // ComputeRatioMax: Relative amount of time the slowest shard spent on
  386. // CPU-bound tasks.
  387. ComputeRatioMax float64 `json:"computeRatioMax,omitempty"`
  388. // Id: Unique ID for stage within plan.
  389. Id int64 `json:"id,omitempty,string"`
  390. // Name: Human-readable name for stage.
  391. Name string `json:"name,omitempty"`
  392. // ReadRatioAvg: Relative amount of time the average shard spent reading
  393. // input.
  394. ReadRatioAvg float64 `json:"readRatioAvg,omitempty"`
  395. // ReadRatioMax: Relative amount of time the slowest shard spent reading
  396. // input.
  397. ReadRatioMax float64 `json:"readRatioMax,omitempty"`
  398. // RecordsRead: Number of records read into the stage.
  399. RecordsRead int64 `json:"recordsRead,omitempty,string"`
  400. // RecordsWritten: Number of records written by the stage.
  401. RecordsWritten int64 `json:"recordsWritten,omitempty,string"`
  402. // Steps: List of operations within the stage in dependency order
  403. // (approximately chronological).
  404. Steps []*ExplainQueryStep `json:"steps,omitempty"`
  405. // WaitRatioAvg: Relative amount of time the average shard spent waiting
  406. // to be scheduled.
  407. WaitRatioAvg float64 `json:"waitRatioAvg,omitempty"`
  408. // WaitRatioMax: Relative amount of time the slowest shard spent waiting
  409. // to be scheduled.
  410. WaitRatioMax float64 `json:"waitRatioMax,omitempty"`
  411. // WriteRatioAvg: Relative amount of time the average shard spent on
  412. // writing output.
  413. WriteRatioAvg float64 `json:"writeRatioAvg,omitempty"`
  414. // WriteRatioMax: Relative amount of time the slowest shard spent on
  415. // writing output.
  416. WriteRatioMax float64 `json:"writeRatioMax,omitempty"`
  417. // ForceSendFields is a list of field names (e.g. "ComputeRatioAvg") to
  418. // unconditionally include in API requests. By default, fields with
  419. // empty values are omitted from API requests. However, any non-pointer,
  420. // non-interface field appearing in ForceSendFields will be sent to the
  421. // server regardless of whether the field is empty or not. This may be
  422. // used to include empty fields in Patch requests.
  423. ForceSendFields []string `json:"-"`
  424. }
  425. func (s *ExplainQueryStage) MarshalJSON() ([]byte, error) {
  426. type noMethod ExplainQueryStage
  427. raw := noMethod(*s)
  428. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  429. }
  430. type ExplainQueryStep struct {
  431. // Kind: Machine-readable operation type.
  432. Kind string `json:"kind,omitempty"`
  433. // Substeps: Human-readable stage descriptions.
  434. Substeps []string `json:"substeps,omitempty"`
  435. // ForceSendFields is a list of field names (e.g. "Kind") to
  436. // unconditionally include in API requests. By default, fields with
  437. // empty values are omitted from API requests. However, any non-pointer,
  438. // non-interface field appearing in ForceSendFields will be sent to the
  439. // server regardless of whether the field is empty or not. This may be
  440. // used to include empty fields in Patch requests.
  441. ForceSendFields []string `json:"-"`
  442. }
  443. func (s *ExplainQueryStep) MarshalJSON() ([]byte, error) {
  444. type noMethod ExplainQueryStep
  445. raw := noMethod(*s)
  446. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  447. }
  448. type ExternalDataConfiguration struct {
  449. // Compression: [Optional] The compression type of the data source.
  450. // Possible values include GZIP and NONE. The default value is NONE.
  451. // This setting is ignored for Google Cloud Datastore backups.
  452. Compression string `json:"compression,omitempty"`
  453. // CsvOptions: Additional properties to set if sourceFormat is set to
  454. // CSV.
  455. CsvOptions *CsvOptions `json:"csvOptions,omitempty"`
  456. // IgnoreUnknownValues: [Optional] Indicates if BigQuery should allow
  457. // extra values that are not represented in the table schema. If true,
  458. // the extra values are ignored. If false, records with extra columns
  459. // are treated as bad records, and if there are too many bad records, an
  460. // invalid error is returned in the job result. The default value is
  461. // false. The sourceFormat property determines what BigQuery treats as
  462. // an extra value: CSV: Trailing columns JSON: Named values that don't
  463. // match any column names Google Cloud Datastore backups: This setting
  464. // is ignored.
  465. IgnoreUnknownValues bool `json:"ignoreUnknownValues,omitempty"`
  466. // MaxBadRecords: [Optional] The maximum number of bad records that
  467. // BigQuery can ignore when reading data. If the number of bad records
  468. // exceeds this value, an invalid error is returned in the job result.
  469. // The default value is 0, which requires that all records are valid.
  470. // This setting is ignored for Google Cloud Datastore backups.
  471. MaxBadRecords int64 `json:"maxBadRecords,omitempty"`
  472. // Schema: [Optional] The schema for the data. Schema is required for
  473. // CSV and JSON formats. Schema is disallowed for Google Cloud Datastore
  474. // backups.
  475. Schema *TableSchema `json:"schema,omitempty"`
  476. // SourceFormat: [Required] The data format. For CSV files, specify
  477. // "CSV". For newline-delimited JSON, specify "NEWLINE_DELIMITED_JSON".
  478. // For Google Cloud Datastore backups, specify "DATASTORE_BACKUP".
  479. SourceFormat string `json:"sourceFormat,omitempty"`
  480. // SourceUris: [Required] The fully-qualified URIs that point to your
  481. // data in Google Cloud Storage. Each URI can contain one '*' wildcard
  482. // character and it must come after the 'bucket' name. Size limits
  483. // related to load jobs apply to external data sources, plus an
  484. // additional limit of 10 GB maximum size across all URIs. For Google
  485. // Cloud Datastore backups, exactly one URI can be specified, and it
  486. // must end with '.backup_info'. Also, the '*' wildcard character is not
  487. // allowed.
  488. SourceUris []string `json:"sourceUris,omitempty"`
  489. // ForceSendFields is a list of field names (e.g. "Compression") to
  490. // unconditionally include in API requests. By default, fields with
  491. // empty values are omitted from API requests. However, any non-pointer,
  492. // non-interface field appearing in ForceSendFields will be sent to the
  493. // server regardless of whether the field is empty or not. This may be
  494. // used to include empty fields in Patch requests.
  495. ForceSendFields []string `json:"-"`
  496. }
  497. func (s *ExternalDataConfiguration) MarshalJSON() ([]byte, error) {
  498. type noMethod ExternalDataConfiguration
  499. raw := noMethod(*s)
  500. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  501. }
  502. type GetQueryResultsResponse struct {
  503. // CacheHit: Whether the query result was fetched from the query cache.
  504. CacheHit bool `json:"cacheHit,omitempty"`
  505. // Errors: [Output-only] All errors and warnings encountered during the
  506. // running of the job. Errors here do not necessarily mean that the job
  507. // has completed or was unsuccessful.
  508. Errors []*ErrorProto `json:"errors,omitempty"`
  509. // Etag: A hash of this response.
  510. Etag string `json:"etag,omitempty"`
  511. // JobComplete: Whether the query has completed or not. If rows or
  512. // totalRows are present, this will always be true. If this is false,
  513. // totalRows will not be available.
  514. JobComplete bool `json:"jobComplete,omitempty"`
  515. // JobReference: Reference to the BigQuery Job that was created to run
  516. // the query. This field will be present even if the original request
  517. // timed out, in which case GetQueryResults can be used to read the
  518. // results once the query has completed. Since this API only returns the
  519. // first page of results, subsequent pages can be fetched via the same
  520. // mechanism (GetQueryResults).
  521. JobReference *JobReference `json:"jobReference,omitempty"`
  522. // Kind: The resource type of the response.
  523. Kind string `json:"kind,omitempty"`
  524. // PageToken: A token used for paging results.
  525. PageToken string `json:"pageToken,omitempty"`
  526. // Rows: An object with as many results as can be contained within the
  527. // maximum permitted reply size. To get any additional rows, you can
  528. // call GetQueryResults and specify the jobReference returned above.
  529. // Present only when the query completes successfully.
  530. Rows []*TableRow `json:"rows,omitempty"`
  531. // Schema: The schema of the results. Present only when the query
  532. // completes successfully.
  533. Schema *TableSchema `json:"schema,omitempty"`
  534. // TotalBytesProcessed: The total number of bytes processed for this
  535. // query.
  536. TotalBytesProcessed int64 `json:"totalBytesProcessed,omitempty,string"`
  537. // TotalRows: The total number of rows in the complete query result set,
  538. // which can be more than the number of rows in this single page of
  539. // results. Present only when the query completes successfully.
  540. TotalRows uint64 `json:"totalRows,omitempty,string"`
  541. // ServerResponse contains the HTTP response code and headers from the
  542. // server.
  543. googleapi.ServerResponse `json:"-"`
  544. // ForceSendFields is a list of field names (e.g. "CacheHit") to
  545. // unconditionally include in API requests. By default, fields with
  546. // empty values are omitted from API requests. However, any non-pointer,
  547. // non-interface field appearing in ForceSendFields will be sent to the
  548. // server regardless of whether the field is empty or not. This may be
  549. // used to include empty fields in Patch requests.
  550. ForceSendFields []string `json:"-"`
  551. }
  552. func (s *GetQueryResultsResponse) MarshalJSON() ([]byte, error) {
  553. type noMethod GetQueryResultsResponse
  554. raw := noMethod(*s)
  555. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  556. }
  557. type Job struct {
  558. // Configuration: [Required] Describes the job configuration.
  559. Configuration *JobConfiguration `json:"configuration,omitempty"`
  560. // Etag: [Output-only] A hash of this resource.
  561. Etag string `json:"etag,omitempty"`
  562. // Id: [Output-only] Opaque ID field of the job
  563. Id string `json:"id,omitempty"`
  564. // JobReference: [Optional] Reference describing the unique-per-user
  565. // name of the job.
  566. JobReference *JobReference `json:"jobReference,omitempty"`
  567. // Kind: [Output-only] The type of the resource.
  568. Kind string `json:"kind,omitempty"`
  569. // SelfLink: [Output-only] A URL that can be used to access this
  570. // resource again.
  571. SelfLink string `json:"selfLink,omitempty"`
  572. // Statistics: [Output-only] Information about the job, including
  573. // starting time and ending time of the job.
  574. Statistics *JobStatistics `json:"statistics,omitempty"`
  575. // Status: [Output-only] The status of this job. Examine this value when
  576. // polling an asynchronous job to see if the job is complete.
  577. Status *JobStatus `json:"status,omitempty"`
  578. // UserEmail: [Output-only] Email address of the user who ran the job.
  579. UserEmail string `json:"user_email,omitempty"`
  580. // ServerResponse contains the HTTP response code and headers from the
  581. // server.
  582. googleapi.ServerResponse `json:"-"`
  583. // ForceSendFields is a list of field names (e.g. "Configuration") to
  584. // unconditionally include in API requests. By default, fields with
  585. // empty values are omitted from API requests. However, any non-pointer,
  586. // non-interface field appearing in ForceSendFields will be sent to the
  587. // server regardless of whether the field is empty or not. This may be
  588. // used to include empty fields in Patch requests.
  589. ForceSendFields []string `json:"-"`
  590. }
  591. func (s *Job) MarshalJSON() ([]byte, error) {
  592. type noMethod Job
  593. raw := noMethod(*s)
  594. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  595. }
  596. type JobCancelResponse struct {
  597. // Job: The final state of the job.
  598. Job *Job `json:"job,omitempty"`
  599. // Kind: The resource type of the response.
  600. Kind string `json:"kind,omitempty"`
  601. // ServerResponse contains the HTTP response code and headers from the
  602. // server.
  603. googleapi.ServerResponse `json:"-"`
  604. // ForceSendFields is a list of field names (e.g. "Job") to
  605. // unconditionally include in API requests. By default, fields with
  606. // empty values are omitted from API requests. However, any non-pointer,
  607. // non-interface field appearing in ForceSendFields will be sent to the
  608. // server regardless of whether the field is empty or not. This may be
  609. // used to include empty fields in Patch requests.
  610. ForceSendFields []string `json:"-"`
  611. }
  612. func (s *JobCancelResponse) MarshalJSON() ([]byte, error) {
  613. type noMethod JobCancelResponse
  614. raw := noMethod(*s)
  615. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  616. }
  617. type JobConfiguration struct {
  618. // Copy: [Pick one] Copies a table.
  619. Copy *JobConfigurationTableCopy `json:"copy,omitempty"`
  620. // DryRun: [Optional] If set, don't actually run this job. A valid query
  621. // will return a mostly empty response with some processing statistics,
  622. // while an invalid query will return the same error it would if it
  623. // wasn't a dry run. Behavior of non-query jobs is undefined.
  624. DryRun bool `json:"dryRun,omitempty"`
  625. // Extract: [Pick one] Configures an extract job.
  626. Extract *JobConfigurationExtract `json:"extract,omitempty"`
  627. // Load: [Pick one] Configures a load job.
  628. Load *JobConfigurationLoad `json:"load,omitempty"`
  629. // Query: [Pick one] Configures a query job.
  630. Query *JobConfigurationQuery `json:"query,omitempty"`
  631. // ForceSendFields is a list of field names (e.g. "Copy") to
  632. // unconditionally include in API requests. By default, fields with
  633. // empty values are omitted from API requests. However, any non-pointer,
  634. // non-interface field appearing in ForceSendFields will be sent to the
  635. // server regardless of whether the field is empty or not. This may be
  636. // used to include empty fields in Patch requests.
  637. ForceSendFields []string `json:"-"`
  638. }
  639. func (s *JobConfiguration) MarshalJSON() ([]byte, error) {
  640. type noMethod JobConfiguration
  641. raw := noMethod(*s)
  642. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  643. }
  644. type JobConfigurationExtract struct {
  645. // Compression: [Optional] The compression type to use for exported
  646. // files. Possible values include GZIP and NONE. The default value is
  647. // NONE.
  648. Compression string `json:"compression,omitempty"`
  649. // DestinationFormat: [Optional] The exported file format. Possible
  650. // values include CSV, NEWLINE_DELIMITED_JSON and AVRO. The default
  651. // value is CSV. Tables with nested or repeated fields cannot be
  652. // exported as CSV.
  653. DestinationFormat string `json:"destinationFormat,omitempty"`
  654. // DestinationUri: [Pick one] DEPRECATED: Use destinationUris instead,
  655. // passing only one URI as necessary. The fully-qualified Google Cloud
  656. // Storage URI where the extracted table should be written.
  657. DestinationUri string `json:"destinationUri,omitempty"`
  658. // DestinationUris: [Pick one] A list of fully-qualified Google Cloud
  659. // Storage URIs where the extracted table should be written.
  660. DestinationUris []string `json:"destinationUris,omitempty"`
  661. // FieldDelimiter: [Optional] Delimiter to use between fields in the
  662. // exported data. Default is ','
  663. FieldDelimiter string `json:"fieldDelimiter,omitempty"`
  664. // PrintHeader: [Optional] Whether to print out a header row in the
  665. // results. Default is true.
  666. //
  667. // Default: true
  668. PrintHeader *bool `json:"printHeader,omitempty"`
  669. // SourceTable: [Required] A reference to the table being exported.
  670. SourceTable *TableReference `json:"sourceTable,omitempty"`
  671. // ForceSendFields is a list of field names (e.g. "Compression") to
  672. // unconditionally include in API requests. By default, fields with
  673. // empty values are omitted from API requests. However, any non-pointer,
  674. // non-interface field appearing in ForceSendFields will be sent to the
  675. // server regardless of whether the field is empty or not. This may be
  676. // used to include empty fields in Patch requests.
  677. ForceSendFields []string `json:"-"`
  678. }
  679. func (s *JobConfigurationExtract) MarshalJSON() ([]byte, error) {
  680. type noMethod JobConfigurationExtract
  681. raw := noMethod(*s)
  682. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  683. }
  684. type JobConfigurationLoad struct {
  685. // AllowJaggedRows: [Optional] Accept rows that are missing trailing
  686. // optional columns. The missing values are treated as nulls. If false,
  687. // records with missing trailing columns are treated as bad records, and
  688. // if there are too many bad records, an invalid error is returned in
  689. // the job result. The default value is false. Only applicable to CSV,
  690. // ignored for other formats.
  691. AllowJaggedRows bool `json:"allowJaggedRows,omitempty"`
  692. // AllowQuotedNewlines: Indicates if BigQuery should allow quoted data
  693. // sections that contain newline characters in a CSV file. The default
  694. // value is false.
  695. AllowQuotedNewlines bool `json:"allowQuotedNewlines,omitempty"`
  696. // CreateDisposition: [Optional] Specifies whether the job is allowed to
  697. // create new tables. The following values are supported:
  698. // CREATE_IF_NEEDED: If the table does not exist, BigQuery creates the
  699. // table. CREATE_NEVER: The table must already exist. If it does not, a
  700. // 'notFound' error is returned in the job result. The default value is
  701. // CREATE_IF_NEEDED. Creation, truncation and append actions occur as
  702. // one atomic update upon job completion.
  703. CreateDisposition string `json:"createDisposition,omitempty"`
  704. // DestinationTable: [Required] The destination table to load the data
  705. // into.
  706. DestinationTable *TableReference `json:"destinationTable,omitempty"`
  707. // Encoding: [Optional] The character encoding of the data. The
  708. // supported values are UTF-8 or ISO-8859-1. The default value is UTF-8.
  709. // BigQuery decodes the data after the raw, binary data has been split
  710. // using the values of the quote and fieldDelimiter properties.
  711. Encoding string `json:"encoding,omitempty"`
  712. // FieldDelimiter: [Optional] The separator for fields in a CSV file.
  713. // The separator can be any ISO-8859-1 single-byte character. To use a
  714. // character in the range 128-255, you must encode the character as
  715. // UTF8. BigQuery converts the string to ISO-8859-1 encoding, and then
  716. // uses the first byte of the encoded string to split the data in its
  717. // raw, binary state. BigQuery also supports the escape sequence "\t" to
  718. // specify a tab separator. The default value is a comma (',').
  719. FieldDelimiter string `json:"fieldDelimiter,omitempty"`
  720. // IgnoreUnknownValues: [Optional] Indicates if BigQuery should allow
  721. // extra values that are not represented in the table schema. If true,
  722. // the extra values are ignored. If false, records with extra columns
  723. // are treated as bad records, and if there are too many bad records, an
  724. // invalid error is returned in the job result. The default value is
  725. // false. The sourceFormat property determines what BigQuery treats as
  726. // an extra value: CSV: Trailing columns JSON: Named values that don't
  727. // match any column names
  728. IgnoreUnknownValues bool `json:"ignoreUnknownValues,omitempty"`
  729. // MaxBadRecords: [Optional] The maximum number of bad records that
  730. // BigQuery can ignore when running the job. If the number of bad
  731. // records exceeds this value, an invalid error is returned in the job
  732. // result. The default value is 0, which requires that all records are
  733. // valid.
  734. MaxBadRecords int64 `json:"maxBadRecords,omitempty"`
  735. // ProjectionFields: [Experimental] If sourceFormat is set to
  736. // "DATASTORE_BACKUP", indicates which entity properties to load into
  737. // BigQuery from a Cloud Datastore backup. Property names are case
  738. // sensitive and must be top-level properties. If no properties are
  739. // specified, BigQuery loads all properties. If any named property isn't
  740. // found in the Cloud Datastore backup, an invalid error is returned in
  741. // the job result.
  742. ProjectionFields []string `json:"projectionFields,omitempty"`
  743. // Quote: [Optional] The value that is used to quote data sections in a
  744. // CSV file. BigQuery converts the string to ISO-8859-1 encoding, and
  745. // then uses the first byte of the encoded string to split the data in
  746. // its raw, binary state. The default value is a double-quote ('"'). If
  747. // your data does not contain quoted sections, set the property value to
  748. // an empty string. If your data contains quoted newline characters, you
  749. // must also set the allowQuotedNewlines property to true.
  750. //
  751. // Default: "
  752. Quote *string `json:"quote,omitempty"`
  753. // Schema: [Optional] The schema for the destination table. The schema
  754. // can be omitted if the destination table already exists, or if you're
  755. // loading data from Google Cloud Datastore.
  756. Schema *TableSchema `json:"schema,omitempty"`
  757. // SchemaInline: [Deprecated] The inline schema. For CSV schemas,
  758. // specify as "Field1:Type1[,Field2:Type2]*". For example, "foo:STRING,
  759. // bar:INTEGER, baz:FLOAT".
  760. SchemaInline string `json:"schemaInline,omitempty"`
  761. // SchemaInlineFormat: [Deprecated] The format of the schemaInline
  762. // property.
  763. SchemaInlineFormat string `json:"schemaInlineFormat,omitempty"`
  764. // SkipLeadingRows: [Optional] The number of rows at the top of a CSV
  765. // file that BigQuery will skip when loading the data. The default value
  766. // is 0. This property is useful if you have header rows in the file
  767. // that should be skipped.
  768. SkipLeadingRows int64 `json:"skipLeadingRows,omitempty"`
  769. // SourceFormat: [Optional] The format of the data files. For CSV files,
  770. // specify "CSV". For datastore backups, specify "DATASTORE_BACKUP". For
  771. // newline-delimited JSON, specify "NEWLINE_DELIMITED_JSON". The default
  772. // value is CSV.
  773. SourceFormat string `json:"sourceFormat,omitempty"`
  774. // SourceUris: [Required] The fully-qualified URIs that point to your
  775. // data in Google Cloud Storage. Each URI can contain one '*' wildcard
  776. // character and it must come after the 'bucket' name.
  777. SourceUris []string `json:"sourceUris,omitempty"`
  778. // WriteDisposition: [Optional] Specifies the action that occurs if the
  779. // destination table already exists. The following values are supported:
  780. // WRITE_TRUNCATE: If the table already exists, BigQuery overwrites the
  781. // table data. WRITE_APPEND: If the table already exists, BigQuery
  782. // appends the data to the table. WRITE_EMPTY: If the table already
  783. // exists and contains data, a 'duplicate' error is returned in the job
  784. // result. The default value is WRITE_APPEND. Each action is atomic and
  785. // only occurs if BigQuery is able to complete the job successfully.
  786. // Creation, truncation and append actions occur as one atomic update
  787. // upon job completion.
  788. WriteDisposition string `json:"writeDisposition,omitempty"`
  789. // ForceSendFields is a list of field names (e.g. "AllowJaggedRows") to
  790. // unconditionally include in API requests. By default, fields with
  791. // empty values are omitted from API requests. However, any non-pointer,
  792. // non-interface field appearing in ForceSendFields will be sent to the
  793. // server regardless of whether the field is empty or not. This may be
  794. // used to include empty fields in Patch requests.
  795. ForceSendFields []string `json:"-"`
  796. }
  797. func (s *JobConfigurationLoad) MarshalJSON() ([]byte, error) {
  798. type noMethod JobConfigurationLoad
  799. raw := noMethod(*s)
  800. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  801. }
  802. type JobConfigurationQuery struct {
  803. // AllowLargeResults: If true, allows the query to produce arbitrarily
  804. // large result tables at a slight cost in performance. Requires
  805. // destinationTable to be set.
  806. AllowLargeResults bool `json:"allowLargeResults,omitempty"`
  807. // CreateDisposition: [Optional] Specifies whether the job is allowed to
  808. // create new tables. The following values are supported:
  809. // CREATE_IF_NEEDED: If the table does not exist, BigQuery creates the
  810. // table. CREATE_NEVER: The table must already exist. If it does not, a
  811. // 'notFound' error is returned in the job result. The default value is
  812. // CREATE_IF_NEEDED. Creation, truncation and append actions occur as
  813. // one atomic update upon job completion.
  814. CreateDisposition string `json:"createDisposition,omitempty"`
  815. // DefaultDataset: [Optional] Specifies the default dataset to use for
  816. // unqualified table names in the query.
  817. DefaultDataset *DatasetReference `json:"defaultDataset,omitempty"`
  818. // DestinationTable: [Optional] Describes the table where the query
  819. // results should be stored. If not present, a new table will be created
  820. // to store the results.
  821. DestinationTable *TableReference `json:"destinationTable,omitempty"`
  822. // FlattenResults: [Optional] Flattens all nested and repeated fields in
  823. // the query results. The default value is true. allowLargeResults must
  824. // be true if this is set to false.
  825. //
  826. // Default: true
  827. FlattenResults *bool `json:"flattenResults,omitempty"`
  828. // MaximumBillingTier: [Optional] Limits the billing tier for this job.
  829. // Queries that have resource usage beyond this tier will fail (without
  830. // incurring a charge). If unspecified, this will be set to your project
  831. // default.
  832. //
  833. // Default: 1
  834. MaximumBillingTier *int64 `json:"maximumBillingTier,omitempty"`
  835. // PreserveNulls: [Deprecated] This property is deprecated.
  836. PreserveNulls bool `json:"preserveNulls,omitempty"`
  837. // Priority: [Optional] Specifies a priority for the query. Possible
  838. // values include INTERACTIVE and BATCH. The default value is
  839. // INTERACTIVE.
  840. Priority string `json:"priority,omitempty"`
  841. // Query: [Required] BigQuery SQL query to execute.
  842. Query string `json:"query,omitempty"`
  843. // TableDefinitions: [Optional] If querying an external data source
  844. // outside of BigQuery, describes the data format, location and other
  845. // properties of the data source. By defining these properties, the data
  846. // source can then be queried as if it were a standard BigQuery table.
  847. TableDefinitions map[string]ExternalDataConfiguration `json:"tableDefinitions,omitempty"`
  848. // UseQueryCache: [Optional] Whether to look for the result in the query
  849. // cache. The query cache is a best-effort cache that will be flushed
  850. // whenever tables in the query are modified. Moreover, the query cache
  851. // is only available when a query does not have a destination table
  852. // specified. The default value is true.
  853. //
  854. // Default: true
  855. UseQueryCache *bool `json:"useQueryCache,omitempty"`
  856. // UserDefinedFunctionResources: [Experimental] Describes user-defined
  857. // function resources used in the query.
  858. UserDefinedFunctionResources []*UserDefinedFunctionResource `json:"userDefinedFunctionResources,omitempty"`
  859. // WriteDisposition: [Optional] Specifies the action that occurs if the
  860. // destination table already exists. The following values are supported:
  861. // WRITE_TRUNCATE: If the table already exists, BigQuery overwrites the
  862. // table data. WRITE_APPEND: If the table already exists, BigQuery
  863. // appends the data to the table. WRITE_EMPTY: If the table already
  864. // exists and contains data, a 'duplicate' error is returned in the job
  865. // result. The default value is WRITE_EMPTY. Each action is atomic and
  866. // only occurs if BigQuery is able to complete the job successfully.
  867. // Creation, truncation and append actions occur as one atomic update
  868. // upon job completion.
  869. WriteDisposition string `json:"writeDisposition,omitempty"`
  870. // ForceSendFields is a list of field names (e.g. "AllowLargeResults")
  871. // to unconditionally include in API requests. By default, fields with
  872. // empty values are omitted from API requests. However, any non-pointer,
  873. // non-interface field appearing in ForceSendFields will be sent to the
  874. // server regardless of whether the field is empty or not. This may be
  875. // used to include empty fields in Patch requests.
  876. ForceSendFields []string `json:"-"`
  877. }
  878. func (s *JobConfigurationQuery) MarshalJSON() ([]byte, error) {
  879. type noMethod JobConfigurationQuery
  880. raw := noMethod(*s)
  881. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  882. }
  883. type JobConfigurationTableCopy struct {
  884. // CreateDisposition: [Optional] Specifies whether the job is allowed to
  885. // create new tables. The following values are supported:
  886. // CREATE_IF_NEEDED: If the table does not exist, BigQuery creates the
  887. // table. CREATE_NEVER: The table must already exist. If it does not, a
  888. // 'notFound' error is returned in the job result. The default value is
  889. // CREATE_IF_NEEDED. Creation, truncation and append actions occur as
  890. // one atomic update upon job completion.
  891. CreateDisposition string `json:"createDisposition,omitempty"`
  892. // DestinationTable: [Required] The destination table
  893. DestinationTable *TableReference `json:"destinationTable,omitempty"`
  894. // SourceTable: [Pick one] Source table to copy.
  895. SourceTable *TableReference `json:"sourceTable,omitempty"`
  896. // SourceTables: [Pick one] Source tables to copy.
  897. SourceTables []*TableReference `json:"sourceTables,omitempty"`
  898. // WriteDisposition: [Optional] Specifies the action that occurs if the
  899. // destination table already exists. The following values are supported:
  900. // WRITE_TRUNCATE: If the table already exists, BigQuery overwrites the
  901. // table data. WRITE_APPEND: If the table already exists, BigQuery
  902. // appends the data to the table. WRITE_EMPTY: If the table already
  903. // exists and contains data, a 'duplicate' error is returned in the job
  904. // result. The default value is WRITE_EMPTY. Each action is atomic and
  905. // only occurs if BigQuery is able to complete the job successfully.
  906. // Creation, truncation and append actions occur as one atomic update
  907. // upon job completion.
  908. WriteDisposition string `json:"writeDisposition,omitempty"`
  909. // ForceSendFields is a list of field names (e.g. "CreateDisposition")
  910. // to unconditionally include in API requests. By default, fields with
  911. // empty values are omitted from API requests. However, any non-pointer,
  912. // non-interface field appearing in ForceSendFields will be sent to the
  913. // server regardless of whether the field is empty or not. This may be
  914. // used to include empty fields in Patch requests.
  915. ForceSendFields []string `json:"-"`
  916. }
  917. func (s *JobConfigurationTableCopy) MarshalJSON() ([]byte, error) {
  918. type noMethod JobConfigurationTableCopy
  919. raw := noMethod(*s)
  920. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  921. }
  922. type JobList struct {
  923. // Etag: A hash of this page of results.
  924. Etag string `json:"etag,omitempty"`
  925. // Jobs: List of jobs that were requested.
  926. Jobs []*JobListJobs `json:"jobs,omitempty"`
  927. // Kind: The resource type of the response.
  928. Kind string `json:"kind,omitempty"`
  929. // NextPageToken: A token to request the next page of results.
  930. NextPageToken string `json:"nextPageToken,omitempty"`
  931. // ServerResponse contains the HTTP response code and headers from the
  932. // server.
  933. googleapi.ServerResponse `json:"-"`
  934. // ForceSendFields is a list of field names (e.g. "Etag") to
  935. // unconditionally include in API requests. By default, fields with
  936. // empty values are omitted from API requests. However, any non-pointer,
  937. // non-interface field appearing in ForceSendFields will be sent to the
  938. // server regardless of whether the field is empty or not. This may be
  939. // used to include empty fields in Patch requests.
  940. ForceSendFields []string `json:"-"`
  941. }
  942. func (s *JobList) MarshalJSON() ([]byte, error) {
  943. type noMethod JobList
  944. raw := noMethod(*s)
  945. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  946. }
  947. type JobListJobs struct {
  948. // Configuration: [Full-projection-only] Specifies the job
  949. // configuration.
  950. Configuration *JobConfiguration `json:"configuration,omitempty"`
  951. // ErrorResult: A result object that will be present only if the job has
  952. // failed.
  953. ErrorResult *ErrorProto `json:"errorResult,omitempty"`
  954. // Id: Unique opaque ID of the job.
  955. Id string `json:"id,omitempty"`
  956. // JobReference: Job reference uniquely identifying the job.
  957. JobReference *JobReference `json:"jobReference,omitempty"`
  958. // Kind: The resource type.
  959. Kind string `json:"kind,omitempty"`
  960. // State: Running state of the job. When the state is DONE, errorResult
  961. // can be checked to determine whether the job succeeded or failed.
  962. State string `json:"state,omitempty"`
  963. // Statistics: [Output-only] Information about the job, including
  964. // starting time and ending time of the job.
  965. Statistics *JobStatistics `json:"statistics,omitempty"`
  966. // Status: [Full-projection-only] Describes the state of the job.
  967. Status *JobStatus `json:"status,omitempty"`
  968. // UserEmail: [Full-projection-only] Email address of the user who ran
  969. // the job.
  970. UserEmail string `json:"user_email,omitempty"`
  971. // ForceSendFields is a list of field names (e.g. "Configuration") 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. }
  979. func (s *JobListJobs) MarshalJSON() ([]byte, error) {
  980. type noMethod JobListJobs
  981. raw := noMethod(*s)
  982. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  983. }
  984. type JobReference struct {
  985. // JobId: [Required] The ID of the job. The ID must contain only letters
  986. // (a-z, A-Z), numbers (0-9), underscores (_), or dashes (-). The
  987. // maximum length is 1,024 characters.
  988. JobId string `json:"jobId,omitempty"`
  989. // ProjectId: [Required] The ID of the project containing this job.
  990. ProjectId string `json:"projectId,omitempty"`
  991. // ForceSendFields is a list of field names (e.g. "JobId") to
  992. // unconditionally include in API requests. By default, fields with
  993. // empty values are omitted from API requests. However, any non-pointer,
  994. // non-interface field appearing in ForceSendFields will be sent to the
  995. // server regardless of whether the field is empty or not. This may be
  996. // used to include empty fields in Patch requests.
  997. ForceSendFields []string `json:"-"`
  998. }
  999. func (s *JobReference) MarshalJSON() ([]byte, error) {
  1000. type noMethod JobReference
  1001. raw := noMethod(*s)
  1002. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  1003. }
  1004. type JobStatistics struct {
  1005. // CreationTime: [Output-only] Creation time of this job, in
  1006. // milliseconds since the epoch. This field will be present on all jobs.
  1007. CreationTime int64 `json:"creationTime,omitempty,string"`
  1008. // EndTime: [Output-only] End time of this job, in milliseconds since
  1009. // the epoch. This field will be present whenever a job is in the DONE
  1010. // state.
  1011. EndTime int64 `json:"endTime,omitempty,string"`
  1012. // Extract: [Output-only] Statistics for an extract job.
  1013. Extract *JobStatistics4 `json:"extract,omitempty"`
  1014. // Load: [Output-only] Statistics for a load job.
  1015. Load *JobStatistics3 `json:"load,omitempty"`
  1016. // Query: [Output-only] Statistics for a query job.
  1017. Query *JobStatistics2 `json:"query,omitempty"`
  1018. // StartTime: [Output-only] Start time of this job, in milliseconds
  1019. // since the epoch. This field will be present when the job transitions
  1020. // from the PENDING state to either RUNNING or DONE.
  1021. StartTime int64 `json:"startTime,omitempty,string"`
  1022. // TotalBytesProcessed: [Output-only] [Deprecated] Use the bytes
  1023. // processed in the query statistics instead.
  1024. TotalBytesProcessed int64 `json:"totalBytesProcessed,omitempty,string"`
  1025. // ForceSendFields is a list of field names (e.g. "CreationTime") to
  1026. // unconditionally include in API requests. By default, fields with
  1027. // empty values are omitted from API requests. However, any non-pointer,
  1028. // non-interface field appearing in ForceSendFields will be sent to the
  1029. // server regardless of whether the field is empty or not. This may be
  1030. // used to include empty fields in Patch requests.
  1031. ForceSendFields []string `json:"-"`
  1032. }
  1033. func (s *JobStatistics) MarshalJSON() ([]byte, error) {
  1034. type noMethod JobStatistics
  1035. raw := noMethod(*s)
  1036. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  1037. }
  1038. type JobStatistics2 struct {
  1039. // BillingTier: [Output-only] Billing tier for the job.
  1040. BillingTier int64 `json:"billingTier,omitempty"`
  1041. // CacheHit: [Output-only] Whether the query result was fetched from the
  1042. // query cache.
  1043. CacheHit bool `json:"cacheHit,omitempty"`
  1044. // QueryPlan: [Output-only, Experimental] Describes execution plan for
  1045. // the query as a list of stages.
  1046. QueryPlan []*ExplainQueryStage `json:"queryPlan,omitempty"`
  1047. // TotalBytesBilled: [Output-only] Total bytes billed for the job.
  1048. TotalBytesBilled int64 `json:"totalBytesBilled,omitempty,string"`
  1049. // TotalBytesProcessed: [Output-only] Total bytes processed for the job.
  1050. TotalBytesProcessed int64 `json:"totalBytesProcessed,omitempty,string"`
  1051. // ForceSendFields is a list of field names (e.g. "BillingTier") to
  1052. // unconditionally include in API requests. By default, fields with
  1053. // empty values are omitted from API requests. However, any non-pointer,
  1054. // non-interface field appearing in ForceSendFields will be sent to the
  1055. // server regardless of whether the field is empty or not. This may be
  1056. // used to include empty fields in Patch requests.
  1057. ForceSendFields []string `json:"-"`
  1058. }
  1059. func (s *JobStatistics2) MarshalJSON() ([]byte, error) {
  1060. type noMethod JobStatistics2
  1061. raw := noMethod(*s)
  1062. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  1063. }
  1064. type JobStatistics3 struct {
  1065. // InputFileBytes: [Output-only] Number of bytes of source data in a
  1066. // load job.
  1067. InputFileBytes int64 `json:"inputFileBytes,omitempty,string"`
  1068. // InputFiles: [Output-only] Number of source files in a load job.
  1069. InputFiles int64 `json:"inputFiles,omitempty,string"`
  1070. // OutputBytes: [Output-only] Size of the loaded data in bytes. Note
  1071. // that while a load job is in the running state, this value may change.
  1072. OutputBytes int64 `json:"outputBytes,omitempty,string"`
  1073. // OutputRows: [Output-only] Number of rows imported in a load job. Note
  1074. // that while an import job is in the running state, this value may
  1075. // change.
  1076. OutputRows int64 `json:"outputRows,omitempty,string"`
  1077. // ForceSendFields is a list of field names (e.g. "InputFileBytes") to
  1078. // unconditionally include in API requests. By default, fields with
  1079. // empty values are omitted from API requests. However, any non-pointer,
  1080. // non-interface field appearing in ForceSendFields will be sent to the
  1081. // server regardless of whether the field is empty or not. This may be
  1082. // used to include empty fields in Patch requests.
  1083. ForceSendFields []string `json:"-"`
  1084. }
  1085. func (s *JobStatistics3) MarshalJSON() ([]byte, error) {
  1086. type noMethod JobStatistics3
  1087. raw := noMethod(*s)
  1088. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  1089. }
  1090. type JobStatistics4 struct {
  1091. // DestinationUriFileCounts: [Output-only] Number of files per
  1092. // destination URI or URI pattern specified in the extract
  1093. // configuration. These values will be in the same order as the URIs
  1094. // specified in the 'destinationUris' field.
  1095. DestinationUriFileCounts googleapi.Int64s `json:"destinationUriFileCounts,omitempty"`
  1096. // ForceSendFields is a list of field names (e.g.
  1097. // "DestinationUriFileCounts") to unconditionally include in API
  1098. // requests. By default, fields with empty values are omitted from API
  1099. // requests. However, any non-pointer, non-interface field appearing in
  1100. // ForceSendFields will be sent to the server regardless of whether the
  1101. // field is empty or not. This may be used to include empty fields in
  1102. // Patch requests.
  1103. ForceSendFields []string `json:"-"`
  1104. }
  1105. func (s *JobStatistics4) MarshalJSON() ([]byte, error) {
  1106. type noMethod JobStatistics4
  1107. raw := noMethod(*s)
  1108. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  1109. }
  1110. type JobStatus struct {
  1111. // ErrorResult: [Output-only] Final error result of the job. If present,
  1112. // indicates that the job has completed and was unsuccessful.
  1113. ErrorResult *ErrorProto `json:"errorResult,omitempty"`
  1114. // Errors: [Output-only] All errors encountered during the running of
  1115. // the job. Errors here do not necessarily mean that the job has
  1116. // completed or was unsuccessful.
  1117. Errors []*ErrorProto `json:"errors,omitempty"`
  1118. // State: [Output-only] Running state of the job.
  1119. State string `json:"state,omitempty"`
  1120. // ForceSendFields is a list of field names (e.g. "ErrorResult") to
  1121. // unconditionally include in API requests. By default, fields with
  1122. // empty values are omitted from API requests. However, any non-pointer,
  1123. // non-interface field appearing in ForceSendFields will be sent to the
  1124. // server regardless of whether the field is empty or not. This may be
  1125. // used to include empty fields in Patch requests.
  1126. ForceSendFields []string `json:"-"`
  1127. }
  1128. func (s *JobStatus) MarshalJSON() ([]byte, error) {
  1129. type noMethod JobStatus
  1130. raw := noMethod(*s)
  1131. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  1132. }
  1133. type JsonValue interface{}
  1134. type ProjectList struct {
  1135. // Etag: A hash of the page of results
  1136. Etag string `json:"etag,omitempty"`
  1137. // Kind: The type of list.
  1138. Kind string `json:"kind,omitempty"`
  1139. // NextPageToken: A token to request the next page of results.
  1140. NextPageToken string `json:"nextPageToken,omitempty"`
  1141. // Projects: Projects to which you have at least READ access.
  1142. Projects []*ProjectListProjects `json:"projects,omitempty"`
  1143. // TotalItems: The total number of projects in the list.
  1144. TotalItems int64 `json:"totalItems,omitempty"`
  1145. // ServerResponse contains the HTTP response code and headers from the
  1146. // server.
  1147. googleapi.ServerResponse `json:"-"`
  1148. // ForceSendFields is a list of field names (e.g. "Etag") to
  1149. // unconditionally include in API requests. By default, fields with
  1150. // empty values are omitted from API requests. However, any non-pointer,
  1151. // non-interface field appearing in ForceSendFields will be sent to the
  1152. // server regardless of whether the field is empty or not. This may be
  1153. // used to include empty fields in Patch requests.
  1154. ForceSendFields []string `json:"-"`
  1155. }
  1156. func (s *ProjectList) MarshalJSON() ([]byte, error) {
  1157. type noMethod ProjectList
  1158. raw := noMethod(*s)
  1159. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  1160. }
  1161. type ProjectListProjects struct {
  1162. // FriendlyName: A descriptive name for this project.
  1163. FriendlyName string `json:"friendlyName,omitempty"`
  1164. // Id: An opaque ID of this project.
  1165. Id string `json:"id,omitempty"`
  1166. // Kind: The resource type.
  1167. Kind string `json:"kind,omitempty"`
  1168. // NumericId: The numeric ID of this project.
  1169. NumericId uint64 `json:"numericId,omitempty,string"`
  1170. // ProjectReference: A unique reference to this project.
  1171. ProjectReference *ProjectReference `json:"projectReference,omitempty"`
  1172. // ForceSendFields is a list of field names (e.g. "FriendlyName") to
  1173. // unconditionally include in API requests. By default, fields with
  1174. // empty values are omitted from API requests. However, any non-pointer,
  1175. // non-interface field appearing in ForceSendFields will be sent to the
  1176. // server regardless of whether the field is empty or not. This may be
  1177. // used to include empty fields in Patch requests.
  1178. ForceSendFields []string `json:"-"`
  1179. }
  1180. func (s *ProjectListProjects) MarshalJSON() ([]byte, error) {
  1181. type noMethod ProjectListProjects
  1182. raw := noMethod(*s)
  1183. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  1184. }
  1185. type ProjectReference struct {
  1186. // ProjectId: [Required] ID of the project. Can be either the numeric ID
  1187. // or the assigned ID of the project.
  1188. ProjectId string `json:"projectId,omitempty"`
  1189. // ForceSendFields is a list of field names (e.g. "ProjectId") to
  1190. // unconditionally include in API requests. By default, fields with
  1191. // empty values are omitted from API requests. However, any non-pointer,
  1192. // non-interface field appearing in ForceSendFields will be sent to the
  1193. // server regardless of whether the field is empty or not. This may be
  1194. // used to include empty fields in Patch requests.
  1195. ForceSendFields []string `json:"-"`
  1196. }
  1197. func (s *ProjectReference) MarshalJSON() ([]byte, error) {
  1198. type noMethod ProjectReference
  1199. raw := noMethod(*s)
  1200. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  1201. }
  1202. type QueryRequest struct {
  1203. // DefaultDataset: [Optional] Specifies the default datasetId and
  1204. // projectId to assume for any unqualified table names in the query. If
  1205. // not set, all table names in the query string must be qualified in the
  1206. // format 'datasetId.tableId'.
  1207. DefaultDataset *DatasetReference `json:"defaultDataset,omitempty"`
  1208. // DryRun: [Optional] If set to true, BigQuery doesn't run the job.
  1209. // Instead, if the query is valid, BigQuery returns statistics about the
  1210. // job such as how many bytes would be processed. If the query is
  1211. // invalid, an error returns. The default value is false.
  1212. DryRun bool `json:"dryRun,omitempty"`
  1213. // Kind: The resource type of the request.
  1214. Kind string `json:"kind,omitempty"`
  1215. // MaxResults: [Optional] The maximum number of rows of data to return
  1216. // per page of results. Setting this flag to a small value such as 1000
  1217. // and then paging through results might improve reliability when the
  1218. // query result set is large. In addition to this limit, responses are
  1219. // also limited to 10 MB. By default, there is no maximum row count, and
  1220. // only the byte limit applies.
  1221. MaxResults int64 `json:"maxResults,omitempty"`
  1222. // PreserveNulls: [Deprecated] This property is deprecated.
  1223. PreserveNulls bool `json:"preserveNulls,omitempty"`
  1224. // Query: [Required] A query string, following the BigQuery query
  1225. // syntax, of the query to execute. Example: "SELECT count(f1) FROM
  1226. // [myProjectId:myDatasetId.myTableId]".
  1227. Query string `json:"query,omitempty"`
  1228. // TimeoutMs: [Optional] How long to wait for the query to complete, in
  1229. // milliseconds, before the request times out and returns. Note that
  1230. // this is only a timeout for the request, not the query. If the query
  1231. // takes longer to run than the timeout value, the call returns without
  1232. // any results and with the 'jobComplete' flag set to false. You can
  1233. // call GetQueryResults() to wait for the query to complete and read the
  1234. // results. The default value is 10000 milliseconds (10 seconds).
  1235. TimeoutMs int64 `json:"timeoutMs,omitempty"`
  1236. // UseQueryCache: [Optional] Whether to look for the result in the query
  1237. // cache. The query cache is a best-effort cache that will be flushed
  1238. // whenever tables in the query are modified. The default value is true.
  1239. //
  1240. // Default: true
  1241. UseQueryCache *bool `json:"useQueryCache,omitempty"`
  1242. // ForceSendFields is a list of field names (e.g. "DefaultDataset") to
  1243. // unconditionally include in API requests. By default, fields with
  1244. // empty values are omitted from API requests. However, any non-pointer,
  1245. // non-interface field appearing in ForceSendFields will be sent to the
  1246. // server regardless of whether the field is empty or not. This may be
  1247. // used to include empty fields in Patch requests.
  1248. ForceSendFields []string `json:"-"`
  1249. }
  1250. func (s *QueryRequest) MarshalJSON() ([]byte, error) {
  1251. type noMethod QueryRequest
  1252. raw := noMethod(*s)
  1253. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  1254. }
  1255. type QueryResponse struct {
  1256. // CacheHit: Whether the query result was fetched from the query cache.
  1257. CacheHit bool `json:"cacheHit,omitempty"`
  1258. // Errors: [Output-only] All errors and warnings encountered during the
  1259. // running of the job. Errors here do not necessarily mean that the job
  1260. // has completed or was unsuccessful.
  1261. Errors []*ErrorProto `json:"errors,omitempty"`
  1262. // JobComplete: Whether the query has completed or not. If rows or
  1263. // totalRows are present, this will always be true. If this is false,
  1264. // totalRows will not be available.
  1265. JobComplete bool `json:"jobComplete,omitempty"`
  1266. // JobReference: Reference to the Job that was created to run the query.
  1267. // This field will be present even if the original request timed out, in
  1268. // which case GetQueryResults can be used to read the results once the
  1269. // query has completed. Since this API only returns the first page of
  1270. // results, subsequent pages can be fetched via the same mechanism
  1271. // (GetQueryResults).
  1272. JobReference *JobReference `json:"jobReference,omitempty"`
  1273. // Kind: The resource type.
  1274. Kind string `json:"kind,omitempty"`
  1275. // PageToken: A token used for paging results.
  1276. PageToken string `json:"pageToken,omitempty"`
  1277. // Rows: An object with as many results as can be contained within the
  1278. // maximum permitted reply size. To get any additional rows, you can
  1279. // call GetQueryResults and specify the jobReference returned above.
  1280. Rows []*TableRow `json:"rows,omitempty"`
  1281. // Schema: The schema of the results. Present only when the query
  1282. // completes successfully.
  1283. Schema *TableSchema `json:"schema,omitempty"`
  1284. // TotalBytesProcessed: The total number of bytes processed for this
  1285. // query. If this query was a dry run, this is the number of bytes that
  1286. // would be processed if the query were run.
  1287. TotalBytesProcessed int64 `json:"totalBytesProcessed,omitempty,string"`
  1288. // TotalRows: The total number of rows in the complete query result set,
  1289. // which can be more than the number of rows in this single page of
  1290. // results.
  1291. TotalRows uint64 `json:"totalRows,omitempty,string"`
  1292. // ServerResponse contains the HTTP response code and headers from the
  1293. // server.
  1294. googleapi.ServerResponse `json:"-"`
  1295. // ForceSendFields is a list of field names (e.g. "CacheHit") to
  1296. // unconditionally include in API requests. By default, fields with
  1297. // empty values are omitted from API requests. However, any non-pointer,
  1298. // non-interface field appearing in ForceSendFields will be sent to the
  1299. // server regardless of whether the field is empty or not. This may be
  1300. // used to include empty fields in Patch requests.
  1301. ForceSendFields []string `json:"-"`
  1302. }
  1303. func (s *QueryResponse) MarshalJSON() ([]byte, error) {
  1304. type noMethod QueryResponse
  1305. raw := noMethod(*s)
  1306. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  1307. }
  1308. type Streamingbuffer struct {
  1309. // EstimatedBytes: [Output-only] A lower-bound estimate of the number of
  1310. // bytes currently in the streaming buffer.
  1311. EstimatedBytes uint64 `json:"estimatedBytes,omitempty,string"`
  1312. // EstimatedRows: [Output-only] A lower-bound estimate of the number of
  1313. // rows currently in the streaming buffer.
  1314. EstimatedRows uint64 `json:"estimatedRows,omitempty,string"`
  1315. // OldestEntryTime: [Output-only] Contains the timestamp of the oldest
  1316. // entry in the streaming buffer, in milliseconds since the epoch, if
  1317. // the streaming buffer is available.
  1318. OldestEntryTime uint64 `json:"oldestEntryTime,omitempty,string"`
  1319. // ForceSendFields is a list of field names (e.g. "EstimatedBytes") to
  1320. // unconditionally include in API requests. By default, fields with
  1321. // empty values are omitted from API requests. However, any non-pointer,
  1322. // non-interface field appearing in ForceSendFields will be sent to the
  1323. // server regardless of whether the field is empty or not. This may be
  1324. // used to include empty fields in Patch requests.
  1325. ForceSendFields []string `json:"-"`
  1326. }
  1327. func (s *Streamingbuffer) MarshalJSON() ([]byte, error) {
  1328. type noMethod Streamingbuffer
  1329. raw := noMethod(*s)
  1330. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  1331. }
  1332. type Table struct {
  1333. // CreationTime: [Output-only] The time when this table was created, in
  1334. // milliseconds since the epoch.
  1335. CreationTime int64 `json:"creationTime,omitempty,string"`
  1336. // Description: [Optional] A user-friendly description of this table.
  1337. Description string `json:"description,omitempty"`
  1338. // Etag: [Output-only] A hash of this resource.
  1339. Etag string `json:"etag,omitempty"`
  1340. // ExpirationTime: [Optional] The time when this table expires, in
  1341. // milliseconds since the epoch. If not present, the table will persist
  1342. // indefinitely. Expired tables will be deleted and their storage
  1343. // reclaimed.
  1344. ExpirationTime int64 `json:"expirationTime,omitempty,string"`
  1345. // ExternalDataConfiguration: [Optional] Describes the data format,
  1346. // location, and other properties of a table stored outside of BigQuery.
  1347. // By defining these properties, the data source can then be queried as
  1348. // if it were a standard BigQuery table.
  1349. ExternalDataConfiguration *ExternalDataConfiguration `json:"externalDataConfiguration,omitempty"`
  1350. // FriendlyName: [Optional] A descriptive name for this table.
  1351. FriendlyName string `json:"friendlyName,omitempty"`
  1352. // Id: [Output-only] An opaque ID uniquely identifying the table.
  1353. Id string `json:"id,omitempty"`
  1354. // Kind: [Output-only] The type of the resource.
  1355. Kind string `json:"kind,omitempty"`
  1356. // LastModifiedTime: [Output-only] The time when this table was last
  1357. // modified, in milliseconds since the epoch.
  1358. LastModifiedTime uint64 `json:"lastModifiedTime,omitempty,string"`
  1359. // Location: [Output-only] The geographic location where the table
  1360. // resides. This value is inherited from the dataset.
  1361. Location string `json:"location,omitempty"`
  1362. // NumBytes: [Output-only] The size of this table in bytes, excluding
  1363. // any data in the streaming buffer.
  1364. NumBytes int64 `json:"numBytes,omitempty,string"`
  1365. // NumRows: [Output-only] The number of rows of data in this table,
  1366. // excluding any data in the streaming buffer.
  1367. NumRows uint64 `json:"numRows,omitempty,string"`
  1368. // Schema: [Optional] Describes the schema of this table.
  1369. Schema *TableSchema `json:"schema,omitempty"`
  1370. // SelfLink: [Output-only] A URL that can be used to access this
  1371. // resource again.
  1372. SelfLink string `json:"selfLink,omitempty"`
  1373. // StreamingBuffer: [Output-only] Contains information regarding this
  1374. // table's streaming buffer, if one is present. This field will be
  1375. // absent if the table is not being streamed to or if there is no data
  1376. // in the streaming buffer.
  1377. StreamingBuffer *Streamingbuffer `json:"streamingBuffer,omitempty"`
  1378. // TableReference: [Required] Reference describing the ID of this table.
  1379. TableReference *TableReference `json:"tableReference,omitempty"`
  1380. // Type: [Output-only] Describes the table type. The following values
  1381. // are supported: TABLE: A normal BigQuery table. VIEW: A virtual table
  1382. // defined by a SQL query. EXTERNAL: A table that references data stored
  1383. // in an external storage system, such as Google Cloud Storage. The
  1384. // default value is TABLE.
  1385. Type string `json:"type,omitempty"`
  1386. // View: [Optional] The view definition.
  1387. View *ViewDefinition `json:"view,omitempty"`
  1388. // ServerResponse contains the HTTP response code and headers from the
  1389. // server.
  1390. googleapi.ServerResponse `json:"-"`
  1391. // ForceSendFields is a list of field names (e.g. "CreationTime") to
  1392. // unconditionally include in API requests. By default, fields with
  1393. // empty values are omitted from API requests. However, any non-pointer,
  1394. // non-interface field appearing in ForceSendFields will be sent to the
  1395. // server regardless of whether the field is empty or not. This may be
  1396. // used to include empty fields in Patch requests.
  1397. ForceSendFields []string `json:"-"`
  1398. }
  1399. func (s *Table) MarshalJSON() ([]byte, error) {
  1400. type noMethod Table
  1401. raw := noMethod(*s)
  1402. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  1403. }
  1404. type TableCell struct {
  1405. V interface{} `json:"v,omitempty"`
  1406. // ForceSendFields is a list of field names (e.g. "V") to
  1407. // unconditionally include in API requests. By default, fields with
  1408. // empty values are omitted from API requests. However, any non-pointer,
  1409. // non-interface field appearing in ForceSendFields will be sent to the
  1410. // server regardless of whether the field is empty or not. This may be
  1411. // used to include empty fields in Patch requests.
  1412. ForceSendFields []string `json:"-"`
  1413. }
  1414. func (s *TableCell) MarshalJSON() ([]byte, error) {
  1415. type noMethod TableCell
  1416. raw := noMethod(*s)
  1417. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  1418. }
  1419. type TableDataInsertAllRequest struct {
  1420. // IgnoreUnknownValues: [Optional] Accept rows that contain values that
  1421. // do not match the schema. The unknown values are ignored. Default is
  1422. // false, which treats unknown values as errors.
  1423. IgnoreUnknownValues bool `json:"ignoreUnknownValues,omitempty"`
  1424. // Kind: The resource type of the response.
  1425. Kind string `json:"kind,omitempty"`
  1426. // Rows: The rows to insert.
  1427. Rows []*TableDataInsertAllRequestRows `json:"rows,omitempty"`
  1428. // SkipInvalidRows: [Optional] Insert all valid rows of a request, even
  1429. // if invalid rows exist. The default value is false, which causes the
  1430. // entire request to fail if any invalid rows exist.
  1431. SkipInvalidRows bool `json:"skipInvalidRows,omitempty"`
  1432. // TemplateSuffix: [Optional] If specified, treats the destination table
  1433. // as a base template, and inserts the rows into an instance table named
  1434. // "{destination}{templateSuffix}". BigQuery will manage creation of the
  1435. // instance table, using the schema of the base template table. See
  1436. // https://cloud.google.com/bigquery/streaming-data-into-bigquery#template-tables for considerations when working with templates
  1437. // tables.
  1438. TemplateSuffix string `json:"templateSuffix,omitempty"`
  1439. // ForceSendFields is a list of field names (e.g. "IgnoreUnknownValues")
  1440. // to unconditionally include in API requests. By default, fields with
  1441. // empty values are omitted from API requests. However, any non-pointer,
  1442. // non-interface field appearing in ForceSendFields will be sent to the
  1443. // server regardless of whether the field is empty or not. This may be
  1444. // used to include empty fields in Patch requests.
  1445. ForceSendFields []string `json:"-"`
  1446. }
  1447. func (s *TableDataInsertAllRequest) MarshalJSON() ([]byte, error) {
  1448. type noMethod TableDataInsertAllRequest
  1449. raw := noMethod(*s)
  1450. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  1451. }
  1452. type TableDataInsertAllRequestRows struct {
  1453. // InsertId: [Optional] A unique ID for each row. BigQuery uses this
  1454. // property to detect duplicate insertion requests on a best-effort
  1455. // basis.
  1456. InsertId string `json:"insertId,omitempty"`
  1457. // Json: [Required] A JSON object that contains a row of data. The
  1458. // object's properties and values must match the destination table's
  1459. // schema.
  1460. Json map[string]JsonValue `json:"json,omitempty"`
  1461. // ForceSendFields is a list of field names (e.g. "InsertId") to
  1462. // unconditionally include in API requests. By default, fields with
  1463. // empty values are omitted from API requests. However, any non-pointer,
  1464. // non-interface field appearing in ForceSendFields will be sent to the
  1465. // server regardless of whether the field is empty or not. This may be
  1466. // used to include empty fields in Patch requests.
  1467. ForceSendFields []string `json:"-"`
  1468. }
  1469. func (s *TableDataInsertAllRequestRows) MarshalJSON() ([]byte, error) {
  1470. type noMethod TableDataInsertAllRequestRows
  1471. raw := noMethod(*s)
  1472. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  1473. }
  1474. type TableDataInsertAllResponse struct {
  1475. // InsertErrors: An array of errors for rows that were not inserted.
  1476. InsertErrors []*TableDataInsertAllResponseInsertErrors `json:"insertErrors,omitempty"`
  1477. // Kind: The resource type of the response.
  1478. Kind string `json:"kind,omitempty"`
  1479. // ServerResponse contains the HTTP response code and headers from the
  1480. // server.
  1481. googleapi.ServerResponse `json:"-"`
  1482. // ForceSendFields is a list of field names (e.g. "InsertErrors") to
  1483. // unconditionally include in API requests. By default, fields with
  1484. // empty values are omitted from API requests. However, any non-pointer,
  1485. // non-interface field appearing in ForceSendFields will be sent to the
  1486. // server regardless of whether the field is empty or not. This may be
  1487. // used to include empty fields in Patch requests.
  1488. ForceSendFields []string `json:"-"`
  1489. }
  1490. func (s *TableDataInsertAllResponse) MarshalJSON() ([]byte, error) {
  1491. type noMethod TableDataInsertAllResponse
  1492. raw := noMethod(*s)
  1493. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  1494. }
  1495. type TableDataInsertAllResponseInsertErrors struct {
  1496. // Errors: Error information for the row indicated by the index
  1497. // property.
  1498. Errors []*ErrorProto `json:"errors,omitempty"`
  1499. // Index: The index of the row that error applies to.
  1500. Index int64 `json:"index,omitempty"`
  1501. // ForceSendFields is a list of field names (e.g. "Errors") to
  1502. // unconditionally include in API requests. By default, fields with
  1503. // empty values are omitted from API requests. However, any non-pointer,
  1504. // non-interface field appearing in ForceSendFields will be sent to the
  1505. // server regardless of whether the field is empty or not. This may be
  1506. // used to include empty fields in Patch requests.
  1507. ForceSendFields []string `json:"-"`
  1508. }
  1509. func (s *TableDataInsertAllResponseInsertErrors) MarshalJSON() ([]byte, error) {
  1510. type noMethod TableDataInsertAllResponseInsertErrors
  1511. raw := noMethod(*s)
  1512. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  1513. }
  1514. type TableDataList struct {
  1515. // Etag: A hash of this page of results.
  1516. Etag string `json:"etag,omitempty"`
  1517. // Kind: The resource type of the response.
  1518. Kind string `json:"kind,omitempty"`
  1519. // PageToken: A token used for paging results. Providing this token
  1520. // instead of the startIndex parameter can help you retrieve stable
  1521. // results when an underlying table is changing.
  1522. PageToken string `json:"pageToken,omitempty"`
  1523. // Rows: Rows of results.
  1524. Rows []*TableRow `json:"rows,omitempty"`
  1525. // TotalRows: The total number of rows in the complete table.
  1526. TotalRows int64 `json:"totalRows,omitempty,string"`
  1527. // ServerResponse contains the HTTP response code and headers from the
  1528. // server.
  1529. googleapi.ServerResponse `json:"-"`
  1530. // ForceSendFields is a list of field names (e.g. "Etag") to
  1531. // unconditionally include in API requests. By default, fields with
  1532. // empty values are omitted from API requests. However, any non-pointer,
  1533. // non-interface field appearing in ForceSendFields will be sent to the
  1534. // server regardless of whether the field is empty or not. This may be
  1535. // used to include empty fields in Patch requests.
  1536. ForceSendFields []string `json:"-"`
  1537. }
  1538. func (s *TableDataList) MarshalJSON() ([]byte, error) {
  1539. type noMethod TableDataList
  1540. raw := noMethod(*s)
  1541. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  1542. }
  1543. type TableFieldSchema struct {
  1544. // Description: [Optional] The field description. The maximum length is
  1545. // 16K characters.
  1546. Description string `json:"description,omitempty"`
  1547. // Fields: [Optional] Describes the nested schema fields if the type
  1548. // property is set to RECORD.
  1549. Fields []*TableFieldSchema `json:"fields,omitempty"`
  1550. // Mode: [Optional] The field mode. Possible values include NULLABLE,
  1551. // REQUIRED and REPEATED. The default value is NULLABLE.
  1552. Mode string `json:"mode,omitempty"`
  1553. // Name: [Required] The field name. The name must contain only letters
  1554. // (a-z, A-Z), numbers (0-9), or underscores (_), and must start with a
  1555. // letter or underscore. The maximum length is 128 characters.
  1556. Name string `json:"name,omitempty"`
  1557. // Type: [Required] The field data type. Possible values include STRING,
  1558. // INTEGER, FLOAT, BOOLEAN, TIMESTAMP or RECORD (where RECORD indicates
  1559. // that the field contains a nested schema).
  1560. Type string `json:"type,omitempty"`
  1561. // ForceSendFields is a list of field names (e.g. "Description") to
  1562. // unconditionally include in API requests. By default, fields with
  1563. // empty values are omitted from API requests. However, any non-pointer,
  1564. // non-interface field appearing in ForceSendFields will be sent to the
  1565. // server regardless of whether the field is empty or not. This may be
  1566. // used to include empty fields in Patch requests.
  1567. ForceSendFields []string `json:"-"`
  1568. }
  1569. func (s *TableFieldSchema) MarshalJSON() ([]byte, error) {
  1570. type noMethod TableFieldSchema
  1571. raw := noMethod(*s)
  1572. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  1573. }
  1574. type TableList struct {
  1575. // Etag: A hash of this page of results.
  1576. Etag string `json:"etag,omitempty"`
  1577. // Kind: The type of list.
  1578. Kind string `json:"kind,omitempty"`
  1579. // NextPageToken: A token to request the next page of results.
  1580. NextPageToken string `json:"nextPageToken,omitempty"`
  1581. // Tables: Tables in the requested dataset.
  1582. Tables []*TableListTables `json:"tables,omitempty"`
  1583. // TotalItems: The total number of tables in the dataset.
  1584. TotalItems int64 `json:"totalItems,omitempty"`
  1585. // ServerResponse contains the HTTP response code and headers from the
  1586. // server.
  1587. googleapi.ServerResponse `json:"-"`
  1588. // ForceSendFields is a list of field names (e.g. "Etag") to
  1589. // unconditionally include in API requests. By default, fields with
  1590. // empty values are omitted from API requests. However, any non-pointer,
  1591. // non-interface field appearing in ForceSendFields will be sent to the
  1592. // server regardless of whether the field is empty or not. This may be
  1593. // used to include empty fields in Patch requests.
  1594. ForceSendFields []string `json:"-"`
  1595. }
  1596. func (s *TableList) MarshalJSON() ([]byte, error) {
  1597. type noMethod TableList
  1598. raw := noMethod(*s)
  1599. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  1600. }
  1601. type TableListTables struct {
  1602. // FriendlyName: The user-friendly name for this table.
  1603. FriendlyName string `json:"friendlyName,omitempty"`
  1604. // Id: An opaque ID of the table
  1605. Id string `json:"id,omitempty"`
  1606. // Kind: The resource type.
  1607. Kind string `json:"kind,omitempty"`
  1608. // TableReference: A reference uniquely identifying the table.
  1609. TableReference *TableReference `json:"tableReference,omitempty"`
  1610. // Type: The type of table. Possible values are: TABLE, VIEW.
  1611. Type string `json:"type,omitempty"`
  1612. // ForceSendFields is a list of field names (e.g. "FriendlyName") to
  1613. // unconditionally include in API requests. By default, fields with
  1614. // empty values are omitted from API requests. However, any non-pointer,
  1615. // non-interface field appearing in ForceSendFields will be sent to the
  1616. // server regardless of whether the field is empty or not. This may be
  1617. // used to include empty fields in Patch requests.
  1618. ForceSendFields []string `json:"-"`
  1619. }
  1620. func (s *TableListTables) MarshalJSON() ([]byte, error) {
  1621. type noMethod TableListTables
  1622. raw := noMethod(*s)
  1623. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  1624. }
  1625. type TableReference struct {
  1626. // DatasetId: [Required] The ID of the dataset containing this table.
  1627. DatasetId string `json:"datasetId,omitempty"`
  1628. // ProjectId: [Required] The ID of the project containing this table.
  1629. ProjectId string `json:"projectId,omitempty"`
  1630. // TableId: [Required] The ID of the table. The ID must contain only
  1631. // letters (a-z, A-Z), numbers (0-9), or underscores (_). The maximum
  1632. // length is 1,024 characters.
  1633. TableId string `json:"tableId,omitempty"`
  1634. // ForceSendFields is a list of field names (e.g. "DatasetId") to
  1635. // unconditionally include in API requests. By default, fields with
  1636. // empty values are omitted from API requests. However, any non-pointer,
  1637. // non-interface field appearing in ForceSendFields will be sent to the
  1638. // server regardless of whether the field is empty or not. This may be
  1639. // used to include empty fields in Patch requests.
  1640. ForceSendFields []string `json:"-"`
  1641. }
  1642. func (s *TableReference) MarshalJSON() ([]byte, error) {
  1643. type noMethod TableReference
  1644. raw := noMethod(*s)
  1645. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  1646. }
  1647. type TableRow struct {
  1648. // F: Represents a single row in the result set, consisting of one or
  1649. // more fields.
  1650. F []*TableCell `json:"f,omitempty"`
  1651. // ForceSendFields is a list of field names (e.g. "F") to
  1652. // unconditionally include in API requests. By default, fields with
  1653. // empty values are omitted from API requests. However, any non-pointer,
  1654. // non-interface field appearing in ForceSendFields will be sent to the
  1655. // server regardless of whether the field is empty or not. This may be
  1656. // used to include empty fields in Patch requests.
  1657. ForceSendFields []string `json:"-"`
  1658. }
  1659. func (s *TableRow) MarshalJSON() ([]byte, error) {
  1660. type noMethod TableRow
  1661. raw := noMethod(*s)
  1662. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  1663. }
  1664. type TableSchema struct {
  1665. // Fields: Describes the fields in a table.
  1666. Fields []*TableFieldSchema `json:"fields,omitempty"`
  1667. // ForceSendFields is a list of field names (e.g. "Fields") to
  1668. // unconditionally include in API requests. By default, fields with
  1669. // empty values are omitted from API requests. However, any non-pointer,
  1670. // non-interface field appearing in ForceSendFields will be sent to the
  1671. // server regardless of whether the field is empty or not. This may be
  1672. // used to include empty fields in Patch requests.
  1673. ForceSendFields []string `json:"-"`
  1674. }
  1675. func (s *TableSchema) MarshalJSON() ([]byte, error) {
  1676. type noMethod TableSchema
  1677. raw := noMethod(*s)
  1678. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  1679. }
  1680. type UserDefinedFunctionResource struct {
  1681. // InlineCode: [Pick one] An inline resource that contains code for a
  1682. // user-defined function (UDF). Providing a inline code resource is
  1683. // equivalent to providing a URI for a file containing the same code.
  1684. InlineCode string `json:"inlineCode,omitempty"`
  1685. // ResourceUri: [Pick one] A code resource to load from a Google Cloud
  1686. // Storage URI (gs://bucket/path).
  1687. ResourceUri string `json:"resourceUri,omitempty"`
  1688. // ForceSendFields is a list of field names (e.g. "InlineCode") to
  1689. // unconditionally include in API requests. By default, fields with
  1690. // empty values are omitted from API requests. However, any non-pointer,
  1691. // non-interface field appearing in ForceSendFields will be sent to the
  1692. // server regardless of whether the field is empty or not. This may be
  1693. // used to include empty fields in Patch requests.
  1694. ForceSendFields []string `json:"-"`
  1695. }
  1696. func (s *UserDefinedFunctionResource) MarshalJSON() ([]byte, error) {
  1697. type noMethod UserDefinedFunctionResource
  1698. raw := noMethod(*s)
  1699. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  1700. }
  1701. type ViewDefinition struct {
  1702. // Query: [Required] A query that BigQuery executes when the view is
  1703. // referenced.
  1704. Query string `json:"query,omitempty"`
  1705. // UserDefinedFunctionResources: [Experimental] Describes user-defined
  1706. // function resources used in the query.
  1707. UserDefinedFunctionResources []*UserDefinedFunctionResource `json:"userDefinedFunctionResources,omitempty"`
  1708. // ForceSendFields is a list of field names (e.g. "Query") to
  1709. // unconditionally include in API requests. By default, fields with
  1710. // empty values are omitted from API requests. However, any non-pointer,
  1711. // non-interface field appearing in ForceSendFields will be sent to the
  1712. // server regardless of whether the field is empty or not. This may be
  1713. // used to include empty fields in Patch requests.
  1714. ForceSendFields []string `json:"-"`
  1715. }
  1716. func (s *ViewDefinition) MarshalJSON() ([]byte, error) {
  1717. type noMethod ViewDefinition
  1718. raw := noMethod(*s)
  1719. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  1720. }
  1721. // method id "bigquery.datasets.delete":
  1722. type DatasetsDeleteCall struct {
  1723. s *Service
  1724. projectId string
  1725. datasetId string
  1726. urlParams_ gensupport.URLParams
  1727. ctx_ context.Context
  1728. }
  1729. // Delete: Deletes the dataset specified by the datasetId value. Before
  1730. // you can delete a dataset, you must delete all its tables, either
  1731. // manually or by specifying deleteContents. Immediately after deletion,
  1732. // you can create another dataset with the same name.
  1733. func (r *DatasetsService) Delete(projectId string, datasetId string) *DatasetsDeleteCall {
  1734. c := &DatasetsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1735. c.projectId = projectId
  1736. c.datasetId = datasetId
  1737. return c
  1738. }
  1739. // DeleteContents sets the optional parameter "deleteContents": If True,
  1740. // delete all the tables in the dataset. If False and the dataset
  1741. // contains tables, the request will fail. Default is False
  1742. func (c *DatasetsDeleteCall) DeleteContents(deleteContents bool) *DatasetsDeleteCall {
  1743. c.urlParams_.Set("deleteContents", fmt.Sprint(deleteContents))
  1744. return c
  1745. }
  1746. // Fields allows partial responses to be retrieved. See
  1747. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1748. // for more information.
  1749. func (c *DatasetsDeleteCall) Fields(s ...googleapi.Field) *DatasetsDeleteCall {
  1750. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1751. return c
  1752. }
  1753. // Context sets the context to be used in this call's Do method. Any
  1754. // pending HTTP request will be aborted if the provided context is
  1755. // canceled.
  1756. func (c *DatasetsDeleteCall) Context(ctx context.Context) *DatasetsDeleteCall {
  1757. c.ctx_ = ctx
  1758. return c
  1759. }
  1760. func (c *DatasetsDeleteCall) doRequest(alt string) (*http.Response, error) {
  1761. var body io.Reader = nil
  1762. c.urlParams_.Set("alt", alt)
  1763. urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{projectId}/datasets/{datasetId}")
  1764. urls += "?" + c.urlParams_.Encode()
  1765. req, _ := http.NewRequest("DELETE", urls, body)
  1766. googleapi.Expand(req.URL, map[string]string{
  1767. "projectId": c.projectId,
  1768. "datasetId": c.datasetId,
  1769. })
  1770. req.Header.Set("User-Agent", c.s.userAgent())
  1771. if c.ctx_ != nil {
  1772. return ctxhttp.Do(c.ctx_, c.s.client, req)
  1773. }
  1774. return c.s.client.Do(req)
  1775. }
  1776. // Do executes the "bigquery.datasets.delete" call.
  1777. func (c *DatasetsDeleteCall) Do(opts ...googleapi.CallOption) error {
  1778. gensupport.SetOptions(c.urlParams_, opts...)
  1779. res, err := c.doRequest("json")
  1780. if err != nil {
  1781. return err
  1782. }
  1783. defer googleapi.CloseBody(res)
  1784. if err := googleapi.CheckResponse(res); err != nil {
  1785. return err
  1786. }
  1787. return nil
  1788. // {
  1789. // "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.",
  1790. // "httpMethod": "DELETE",
  1791. // "id": "bigquery.datasets.delete",
  1792. // "parameterOrder": [
  1793. // "projectId",
  1794. // "datasetId"
  1795. // ],
  1796. // "parameters": {
  1797. // "datasetId": {
  1798. // "description": "Dataset ID of dataset being deleted",
  1799. // "location": "path",
  1800. // "required": true,
  1801. // "type": "string"
  1802. // },
  1803. // "deleteContents": {
  1804. // "description": "If True, delete all the tables in the dataset. If False and the dataset contains tables, the request will fail. Default is False",
  1805. // "location": "query",
  1806. // "type": "boolean"
  1807. // },
  1808. // "projectId": {
  1809. // "description": "Project ID of the dataset being deleted",
  1810. // "location": "path",
  1811. // "required": true,
  1812. // "type": "string"
  1813. // }
  1814. // },
  1815. // "path": "projects/{projectId}/datasets/{datasetId}",
  1816. // "scopes": [
  1817. // "https://www.googleapis.com/auth/bigquery",
  1818. // "https://www.googleapis.com/auth/cloud-platform"
  1819. // ]
  1820. // }
  1821. }
  1822. // method id "bigquery.datasets.get":
  1823. type DatasetsGetCall struct {
  1824. s *Service
  1825. projectId string
  1826. datasetId string
  1827. urlParams_ gensupport.URLParams
  1828. ifNoneMatch_ string
  1829. ctx_ context.Context
  1830. }
  1831. // Get: Returns the dataset specified by datasetID.
  1832. func (r *DatasetsService) Get(projectId string, datasetId string) *DatasetsGetCall {
  1833. c := &DatasetsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1834. c.projectId = projectId
  1835. c.datasetId = datasetId
  1836. return c
  1837. }
  1838. // Fields allows partial responses to be retrieved. See
  1839. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1840. // for more information.
  1841. func (c *DatasetsGetCall) Fields(s ...googleapi.Field) *DatasetsGetCall {
  1842. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1843. return c
  1844. }
  1845. // IfNoneMatch sets the optional parameter which makes the operation
  1846. // fail if the object's ETag matches the given value. This is useful for
  1847. // getting updates only after the object has changed since the last
  1848. // request. Use googleapi.IsNotModified to check whether the response
  1849. // error from Do is the result of In-None-Match.
  1850. func (c *DatasetsGetCall) IfNoneMatch(entityTag string) *DatasetsGetCall {
  1851. c.ifNoneMatch_ = entityTag
  1852. return c
  1853. }
  1854. // Context sets the context to be used in this call's Do method. Any
  1855. // pending HTTP request will be aborted if the provided context is
  1856. // canceled.
  1857. func (c *DatasetsGetCall) Context(ctx context.Context) *DatasetsGetCall {
  1858. c.ctx_ = ctx
  1859. return c
  1860. }
  1861. func (c *DatasetsGetCall) doRequest(alt string) (*http.Response, error) {
  1862. var body io.Reader = nil
  1863. c.urlParams_.Set("alt", alt)
  1864. urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{projectId}/datasets/{datasetId}")
  1865. urls += "?" + c.urlParams_.Encode()
  1866. req, _ := http.NewRequest("GET", urls, body)
  1867. googleapi.Expand(req.URL, map[string]string{
  1868. "projectId": c.projectId,
  1869. "datasetId": c.datasetId,
  1870. })
  1871. req.Header.Set("User-Agent", c.s.userAgent())
  1872. if c.ifNoneMatch_ != "" {
  1873. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  1874. }
  1875. if c.ctx_ != nil {
  1876. return ctxhttp.Do(c.ctx_, c.s.client, req)
  1877. }
  1878. return c.s.client.Do(req)
  1879. }
  1880. // Do executes the "bigquery.datasets.get" call.
  1881. // Exactly one of *Dataset or error will be non-nil. Any non-2xx status
  1882. // code is an error. Response headers are in either
  1883. // *Dataset.ServerResponse.Header or (if a response was returned at all)
  1884. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  1885. // check whether the returned error was because http.StatusNotModified
  1886. // was returned.
  1887. func (c *DatasetsGetCall) Do(opts ...googleapi.CallOption) (*Dataset, error) {
  1888. gensupport.SetOptions(c.urlParams_, opts...)
  1889. res, err := c.doRequest("json")
  1890. if res != nil && res.StatusCode == http.StatusNotModified {
  1891. if res.Body != nil {
  1892. res.Body.Close()
  1893. }
  1894. return nil, &googleapi.Error{
  1895. Code: res.StatusCode,
  1896. Header: res.Header,
  1897. }
  1898. }
  1899. if err != nil {
  1900. return nil, err
  1901. }
  1902. defer googleapi.CloseBody(res)
  1903. if err := googleapi.CheckResponse(res); err != nil {
  1904. return nil, err
  1905. }
  1906. ret := &Dataset{
  1907. ServerResponse: googleapi.ServerResponse{
  1908. Header: res.Header,
  1909. HTTPStatusCode: res.StatusCode,
  1910. },
  1911. }
  1912. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  1913. return nil, err
  1914. }
  1915. return ret, nil
  1916. // {
  1917. // "description": "Returns the dataset specified by datasetID.",
  1918. // "httpMethod": "GET",
  1919. // "id": "bigquery.datasets.get",
  1920. // "parameterOrder": [
  1921. // "projectId",
  1922. // "datasetId"
  1923. // ],
  1924. // "parameters": {
  1925. // "datasetId": {
  1926. // "description": "Dataset ID of the requested dataset",
  1927. // "location": "path",
  1928. // "required": true,
  1929. // "type": "string"
  1930. // },
  1931. // "projectId": {
  1932. // "description": "Project ID of the requested dataset",
  1933. // "location": "path",
  1934. // "required": true,
  1935. // "type": "string"
  1936. // }
  1937. // },
  1938. // "path": "projects/{projectId}/datasets/{datasetId}",
  1939. // "response": {
  1940. // "$ref": "Dataset"
  1941. // },
  1942. // "scopes": [
  1943. // "https://www.googleapis.com/auth/bigquery",
  1944. // "https://www.googleapis.com/auth/cloud-platform",
  1945. // "https://www.googleapis.com/auth/cloud-platform.read-only"
  1946. // ]
  1947. // }
  1948. }
  1949. // method id "bigquery.datasets.insert":
  1950. type DatasetsInsertCall struct {
  1951. s *Service
  1952. projectId string
  1953. dataset *Dataset
  1954. urlParams_ gensupport.URLParams
  1955. ctx_ context.Context
  1956. }
  1957. // Insert: Creates a new empty dataset.
  1958. func (r *DatasetsService) Insert(projectId string, dataset *Dataset) *DatasetsInsertCall {
  1959. c := &DatasetsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1960. c.projectId = projectId
  1961. c.dataset = dataset
  1962. return c
  1963. }
  1964. // Fields allows partial responses to be retrieved. See
  1965. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1966. // for more information.
  1967. func (c *DatasetsInsertCall) Fields(s ...googleapi.Field) *DatasetsInsertCall {
  1968. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1969. return c
  1970. }
  1971. // Context sets the context to be used in this call's Do method. Any
  1972. // pending HTTP request will be aborted if the provided context is
  1973. // canceled.
  1974. func (c *DatasetsInsertCall) Context(ctx context.Context) *DatasetsInsertCall {
  1975. c.ctx_ = ctx
  1976. return c
  1977. }
  1978. func (c *DatasetsInsertCall) doRequest(alt string) (*http.Response, error) {
  1979. var body io.Reader = nil
  1980. body, err := googleapi.WithoutDataWrapper.JSONReader(c.dataset)
  1981. if err != nil {
  1982. return nil, err
  1983. }
  1984. ctype := "application/json"
  1985. c.urlParams_.Set("alt", alt)
  1986. urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{projectId}/datasets")
  1987. urls += "?" + c.urlParams_.Encode()
  1988. req, _ := http.NewRequest("POST", urls, body)
  1989. googleapi.Expand(req.URL, map[string]string{
  1990. "projectId": c.projectId,
  1991. })
  1992. req.Header.Set("Content-Type", ctype)
  1993. req.Header.Set("User-Agent", c.s.userAgent())
  1994. if c.ctx_ != nil {
  1995. return ctxhttp.Do(c.ctx_, c.s.client, req)
  1996. }
  1997. return c.s.client.Do(req)
  1998. }
  1999. // Do executes the "bigquery.datasets.insert" call.
  2000. // Exactly one of *Dataset or error will be non-nil. Any non-2xx status
  2001. // code is an error. Response headers are in either
  2002. // *Dataset.ServerResponse.Header or (if a response was returned at all)
  2003. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2004. // check whether the returned error was because http.StatusNotModified
  2005. // was returned.
  2006. func (c *DatasetsInsertCall) Do(opts ...googleapi.CallOption) (*Dataset, error) {
  2007. gensupport.SetOptions(c.urlParams_, opts...)
  2008. res, err := c.doRequest("json")
  2009. if res != nil && res.StatusCode == http.StatusNotModified {
  2010. if res.Body != nil {
  2011. res.Body.Close()
  2012. }
  2013. return nil, &googleapi.Error{
  2014. Code: res.StatusCode,
  2015. Header: res.Header,
  2016. }
  2017. }
  2018. if err != nil {
  2019. return nil, err
  2020. }
  2021. defer googleapi.CloseBody(res)
  2022. if err := googleapi.CheckResponse(res); err != nil {
  2023. return nil, err
  2024. }
  2025. ret := &Dataset{
  2026. ServerResponse: googleapi.ServerResponse{
  2027. Header: res.Header,
  2028. HTTPStatusCode: res.StatusCode,
  2029. },
  2030. }
  2031. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  2032. return nil, err
  2033. }
  2034. return ret, nil
  2035. // {
  2036. // "description": "Creates a new empty dataset.",
  2037. // "httpMethod": "POST",
  2038. // "id": "bigquery.datasets.insert",
  2039. // "parameterOrder": [
  2040. // "projectId"
  2041. // ],
  2042. // "parameters": {
  2043. // "projectId": {
  2044. // "description": "Project ID of the new dataset",
  2045. // "location": "path",
  2046. // "required": true,
  2047. // "type": "string"
  2048. // }
  2049. // },
  2050. // "path": "projects/{projectId}/datasets",
  2051. // "request": {
  2052. // "$ref": "Dataset"
  2053. // },
  2054. // "response": {
  2055. // "$ref": "Dataset"
  2056. // },
  2057. // "scopes": [
  2058. // "https://www.googleapis.com/auth/bigquery",
  2059. // "https://www.googleapis.com/auth/cloud-platform"
  2060. // ]
  2061. // }
  2062. }
  2063. // method id "bigquery.datasets.list":
  2064. type DatasetsListCall struct {
  2065. s *Service
  2066. projectId string
  2067. urlParams_ gensupport.URLParams
  2068. ifNoneMatch_ string
  2069. ctx_ context.Context
  2070. }
  2071. // List: Lists all datasets in the specified project to which you have
  2072. // been granted the READER dataset role.
  2073. func (r *DatasetsService) List(projectId string) *DatasetsListCall {
  2074. c := &DatasetsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2075. c.projectId = projectId
  2076. return c
  2077. }
  2078. // All sets the optional parameter "all": Whether to list all datasets,
  2079. // including hidden ones
  2080. func (c *DatasetsListCall) All(all bool) *DatasetsListCall {
  2081. c.urlParams_.Set("all", fmt.Sprint(all))
  2082. return c
  2083. }
  2084. // MaxResults sets the optional parameter "maxResults": The maximum
  2085. // number of results to return
  2086. func (c *DatasetsListCall) MaxResults(maxResults int64) *DatasetsListCall {
  2087. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  2088. return c
  2089. }
  2090. // PageToken sets the optional parameter "pageToken": Page token,
  2091. // returned by a previous call, to request the next page of results
  2092. func (c *DatasetsListCall) PageToken(pageToken string) *DatasetsListCall {
  2093. c.urlParams_.Set("pageToken", pageToken)
  2094. return c
  2095. }
  2096. // Fields allows partial responses to be retrieved. See
  2097. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2098. // for more information.
  2099. func (c *DatasetsListCall) Fields(s ...googleapi.Field) *DatasetsListCall {
  2100. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2101. return c
  2102. }
  2103. // IfNoneMatch sets the optional parameter which makes the operation
  2104. // fail if the object's ETag matches the given value. This is useful for
  2105. // getting updates only after the object has changed since the last
  2106. // request. Use googleapi.IsNotModified to check whether the response
  2107. // error from Do is the result of In-None-Match.
  2108. func (c *DatasetsListCall) IfNoneMatch(entityTag string) *DatasetsListCall {
  2109. c.ifNoneMatch_ = entityTag
  2110. return c
  2111. }
  2112. // Context sets the context to be used in this call's Do method. Any
  2113. // pending HTTP request will be aborted if the provided context is
  2114. // canceled.
  2115. func (c *DatasetsListCall) Context(ctx context.Context) *DatasetsListCall {
  2116. c.ctx_ = ctx
  2117. return c
  2118. }
  2119. func (c *DatasetsListCall) doRequest(alt string) (*http.Response, error) {
  2120. var body io.Reader = nil
  2121. c.urlParams_.Set("alt", alt)
  2122. urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{projectId}/datasets")
  2123. urls += "?" + c.urlParams_.Encode()
  2124. req, _ := http.NewRequest("GET", urls, body)
  2125. googleapi.Expand(req.URL, map[string]string{
  2126. "projectId": c.projectId,
  2127. })
  2128. req.Header.Set("User-Agent", c.s.userAgent())
  2129. if c.ifNoneMatch_ != "" {
  2130. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  2131. }
  2132. if c.ctx_ != nil {
  2133. return ctxhttp.Do(c.ctx_, c.s.client, req)
  2134. }
  2135. return c.s.client.Do(req)
  2136. }
  2137. // Do executes the "bigquery.datasets.list" call.
  2138. // Exactly one of *DatasetList or error will be non-nil. Any non-2xx
  2139. // status code is an error. Response headers are in either
  2140. // *DatasetList.ServerResponse.Header or (if a response was returned at
  2141. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  2142. // to check whether the returned error was because
  2143. // http.StatusNotModified was returned.
  2144. func (c *DatasetsListCall) Do(opts ...googleapi.CallOption) (*DatasetList, error) {
  2145. gensupport.SetOptions(c.urlParams_, opts...)
  2146. res, err := c.doRequest("json")
  2147. if res != nil && res.StatusCode == http.StatusNotModified {
  2148. if res.Body != nil {
  2149. res.Body.Close()
  2150. }
  2151. return nil, &googleapi.Error{
  2152. Code: res.StatusCode,
  2153. Header: res.Header,
  2154. }
  2155. }
  2156. if err != nil {
  2157. return nil, err
  2158. }
  2159. defer googleapi.CloseBody(res)
  2160. if err := googleapi.CheckResponse(res); err != nil {
  2161. return nil, err
  2162. }
  2163. ret := &DatasetList{
  2164. ServerResponse: googleapi.ServerResponse{
  2165. Header: res.Header,
  2166. HTTPStatusCode: res.StatusCode,
  2167. },
  2168. }
  2169. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  2170. return nil, err
  2171. }
  2172. return ret, nil
  2173. // {
  2174. // "description": "Lists all datasets in the specified project to which you have been granted the READER dataset role.",
  2175. // "httpMethod": "GET",
  2176. // "id": "bigquery.datasets.list",
  2177. // "parameterOrder": [
  2178. // "projectId"
  2179. // ],
  2180. // "parameters": {
  2181. // "all": {
  2182. // "description": "Whether to list all datasets, including hidden ones",
  2183. // "location": "query",
  2184. // "type": "boolean"
  2185. // },
  2186. // "maxResults": {
  2187. // "description": "The maximum number of results to return",
  2188. // "format": "uint32",
  2189. // "location": "query",
  2190. // "type": "integer"
  2191. // },
  2192. // "pageToken": {
  2193. // "description": "Page token, returned by a previous call, to request the next page of results",
  2194. // "location": "query",
  2195. // "type": "string"
  2196. // },
  2197. // "projectId": {
  2198. // "description": "Project ID of the datasets to be listed",
  2199. // "location": "path",
  2200. // "required": true,
  2201. // "type": "string"
  2202. // }
  2203. // },
  2204. // "path": "projects/{projectId}/datasets",
  2205. // "response": {
  2206. // "$ref": "DatasetList"
  2207. // },
  2208. // "scopes": [
  2209. // "https://www.googleapis.com/auth/bigquery",
  2210. // "https://www.googleapis.com/auth/cloud-platform",
  2211. // "https://www.googleapis.com/auth/cloud-platform.read-only"
  2212. // ]
  2213. // }
  2214. }
  2215. // Pages invokes f for each page of results.
  2216. // A non-nil error returned from f will halt the iteration.
  2217. // The provided context supersedes any context provided to the Context method.
  2218. func (c *DatasetsListCall) Pages(ctx context.Context, f func(*DatasetList) error) error {
  2219. c.ctx_ = ctx
  2220. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  2221. for {
  2222. x, err := c.Do()
  2223. if err != nil {
  2224. return err
  2225. }
  2226. if err := f(x); err != nil {
  2227. return err
  2228. }
  2229. if x.NextPageToken == "" {
  2230. return nil
  2231. }
  2232. c.PageToken(x.NextPageToken)
  2233. }
  2234. }
  2235. // method id "bigquery.datasets.patch":
  2236. type DatasetsPatchCall struct {
  2237. s *Service
  2238. projectId string
  2239. datasetId string
  2240. dataset *Dataset
  2241. urlParams_ gensupport.URLParams
  2242. ctx_ context.Context
  2243. }
  2244. // Patch: Updates information in an existing dataset. The update method
  2245. // replaces the entire dataset resource, whereas the patch method only
  2246. // replaces fields that are provided in the submitted dataset resource.
  2247. // This method supports patch semantics.
  2248. func (r *DatasetsService) Patch(projectId string, datasetId string, dataset *Dataset) *DatasetsPatchCall {
  2249. c := &DatasetsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2250. c.projectId = projectId
  2251. c.datasetId = datasetId
  2252. c.dataset = dataset
  2253. return c
  2254. }
  2255. // Fields allows partial responses to be retrieved. See
  2256. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2257. // for more information.
  2258. func (c *DatasetsPatchCall) Fields(s ...googleapi.Field) *DatasetsPatchCall {
  2259. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2260. return c
  2261. }
  2262. // Context sets the context to be used in this call's Do method. Any
  2263. // pending HTTP request will be aborted if the provided context is
  2264. // canceled.
  2265. func (c *DatasetsPatchCall) Context(ctx context.Context) *DatasetsPatchCall {
  2266. c.ctx_ = ctx
  2267. return c
  2268. }
  2269. func (c *DatasetsPatchCall) doRequest(alt string) (*http.Response, error) {
  2270. var body io.Reader = nil
  2271. body, err := googleapi.WithoutDataWrapper.JSONReader(c.dataset)
  2272. if err != nil {
  2273. return nil, err
  2274. }
  2275. ctype := "application/json"
  2276. c.urlParams_.Set("alt", alt)
  2277. urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{projectId}/datasets/{datasetId}")
  2278. urls += "?" + c.urlParams_.Encode()
  2279. req, _ := http.NewRequest("PATCH", urls, body)
  2280. googleapi.Expand(req.URL, map[string]string{
  2281. "projectId": c.projectId,
  2282. "datasetId": c.datasetId,
  2283. })
  2284. req.Header.Set("Content-Type", ctype)
  2285. req.Header.Set("User-Agent", c.s.userAgent())
  2286. if c.ctx_ != nil {
  2287. return ctxhttp.Do(c.ctx_, c.s.client, req)
  2288. }
  2289. return c.s.client.Do(req)
  2290. }
  2291. // Do executes the "bigquery.datasets.patch" call.
  2292. // Exactly one of *Dataset or error will be non-nil. Any non-2xx status
  2293. // code is an error. Response headers are in either
  2294. // *Dataset.ServerResponse.Header or (if a response was returned at all)
  2295. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2296. // check whether the returned error was because http.StatusNotModified
  2297. // was returned.
  2298. func (c *DatasetsPatchCall) Do(opts ...googleapi.CallOption) (*Dataset, error) {
  2299. gensupport.SetOptions(c.urlParams_, opts...)
  2300. res, err := c.doRequest("json")
  2301. if res != nil && res.StatusCode == http.StatusNotModified {
  2302. if res.Body != nil {
  2303. res.Body.Close()
  2304. }
  2305. return nil, &googleapi.Error{
  2306. Code: res.StatusCode,
  2307. Header: res.Header,
  2308. }
  2309. }
  2310. if err != nil {
  2311. return nil, err
  2312. }
  2313. defer googleapi.CloseBody(res)
  2314. if err := googleapi.CheckResponse(res); err != nil {
  2315. return nil, err
  2316. }
  2317. ret := &Dataset{
  2318. ServerResponse: googleapi.ServerResponse{
  2319. Header: res.Header,
  2320. HTTPStatusCode: res.StatusCode,
  2321. },
  2322. }
  2323. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  2324. return nil, err
  2325. }
  2326. return ret, nil
  2327. // {
  2328. // "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.",
  2329. // "httpMethod": "PATCH",
  2330. // "id": "bigquery.datasets.patch",
  2331. // "parameterOrder": [
  2332. // "projectId",
  2333. // "datasetId"
  2334. // ],
  2335. // "parameters": {
  2336. // "datasetId": {
  2337. // "description": "Dataset ID of the dataset being updated",
  2338. // "location": "path",
  2339. // "required": true,
  2340. // "type": "string"
  2341. // },
  2342. // "projectId": {
  2343. // "description": "Project ID of the dataset being updated",
  2344. // "location": "path",
  2345. // "required": true,
  2346. // "type": "string"
  2347. // }
  2348. // },
  2349. // "path": "projects/{projectId}/datasets/{datasetId}",
  2350. // "request": {
  2351. // "$ref": "Dataset"
  2352. // },
  2353. // "response": {
  2354. // "$ref": "Dataset"
  2355. // },
  2356. // "scopes": [
  2357. // "https://www.googleapis.com/auth/bigquery",
  2358. // "https://www.googleapis.com/auth/cloud-platform"
  2359. // ]
  2360. // }
  2361. }
  2362. // method id "bigquery.datasets.update":
  2363. type DatasetsUpdateCall struct {
  2364. s *Service
  2365. projectId string
  2366. datasetId string
  2367. dataset *Dataset
  2368. urlParams_ gensupport.URLParams
  2369. ctx_ context.Context
  2370. }
  2371. // Update: Updates information in an existing dataset. The update method
  2372. // replaces the entire dataset resource, whereas the patch method only
  2373. // replaces fields that are provided in the submitted dataset resource.
  2374. func (r *DatasetsService) Update(projectId string, datasetId string, dataset *Dataset) *DatasetsUpdateCall {
  2375. c := &DatasetsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2376. c.projectId = projectId
  2377. c.datasetId = datasetId
  2378. c.dataset = dataset
  2379. return c
  2380. }
  2381. // Fields allows partial responses to be retrieved. See
  2382. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2383. // for more information.
  2384. func (c *DatasetsUpdateCall) Fields(s ...googleapi.Field) *DatasetsUpdateCall {
  2385. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2386. return c
  2387. }
  2388. // Context sets the context to be used in this call's Do method. Any
  2389. // pending HTTP request will be aborted if the provided context is
  2390. // canceled.
  2391. func (c *DatasetsUpdateCall) Context(ctx context.Context) *DatasetsUpdateCall {
  2392. c.ctx_ = ctx
  2393. return c
  2394. }
  2395. func (c *DatasetsUpdateCall) doRequest(alt string) (*http.Response, error) {
  2396. var body io.Reader = nil
  2397. body, err := googleapi.WithoutDataWrapper.JSONReader(c.dataset)
  2398. if err != nil {
  2399. return nil, err
  2400. }
  2401. ctype := "application/json"
  2402. c.urlParams_.Set("alt", alt)
  2403. urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{projectId}/datasets/{datasetId}")
  2404. urls += "?" + c.urlParams_.Encode()
  2405. req, _ := http.NewRequest("PUT", urls, body)
  2406. googleapi.Expand(req.URL, map[string]string{
  2407. "projectId": c.projectId,
  2408. "datasetId": c.datasetId,
  2409. })
  2410. req.Header.Set("Content-Type", ctype)
  2411. req.Header.Set("User-Agent", c.s.userAgent())
  2412. if c.ctx_ != nil {
  2413. return ctxhttp.Do(c.ctx_, c.s.client, req)
  2414. }
  2415. return c.s.client.Do(req)
  2416. }
  2417. // Do executes the "bigquery.datasets.update" call.
  2418. // Exactly one of *Dataset or error will be non-nil. Any non-2xx status
  2419. // code is an error. Response headers are in either
  2420. // *Dataset.ServerResponse.Header or (if a response was returned at all)
  2421. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2422. // check whether the returned error was because http.StatusNotModified
  2423. // was returned.
  2424. func (c *DatasetsUpdateCall) Do(opts ...googleapi.CallOption) (*Dataset, error) {
  2425. gensupport.SetOptions(c.urlParams_, opts...)
  2426. res, err := c.doRequest("json")
  2427. if res != nil && res.StatusCode == http.StatusNotModified {
  2428. if res.Body != nil {
  2429. res.Body.Close()
  2430. }
  2431. return nil, &googleapi.Error{
  2432. Code: res.StatusCode,
  2433. Header: res.Header,
  2434. }
  2435. }
  2436. if err != nil {
  2437. return nil, err
  2438. }
  2439. defer googleapi.CloseBody(res)
  2440. if err := googleapi.CheckResponse(res); err != nil {
  2441. return nil, err
  2442. }
  2443. ret := &Dataset{
  2444. ServerResponse: googleapi.ServerResponse{
  2445. Header: res.Header,
  2446. HTTPStatusCode: res.StatusCode,
  2447. },
  2448. }
  2449. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  2450. return nil, err
  2451. }
  2452. return ret, nil
  2453. // {
  2454. // "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.",
  2455. // "httpMethod": "PUT",
  2456. // "id": "bigquery.datasets.update",
  2457. // "parameterOrder": [
  2458. // "projectId",
  2459. // "datasetId"
  2460. // ],
  2461. // "parameters": {
  2462. // "datasetId": {
  2463. // "description": "Dataset ID of the dataset being updated",
  2464. // "location": "path",
  2465. // "required": true,
  2466. // "type": "string"
  2467. // },
  2468. // "projectId": {
  2469. // "description": "Project ID of the dataset being updated",
  2470. // "location": "path",
  2471. // "required": true,
  2472. // "type": "string"
  2473. // }
  2474. // },
  2475. // "path": "projects/{projectId}/datasets/{datasetId}",
  2476. // "request": {
  2477. // "$ref": "Dataset"
  2478. // },
  2479. // "response": {
  2480. // "$ref": "Dataset"
  2481. // },
  2482. // "scopes": [
  2483. // "https://www.googleapis.com/auth/bigquery",
  2484. // "https://www.googleapis.com/auth/cloud-platform"
  2485. // ]
  2486. // }
  2487. }
  2488. // method id "bigquery.jobs.cancel":
  2489. type JobsCancelCall struct {
  2490. s *Service
  2491. projectId string
  2492. jobId string
  2493. urlParams_ gensupport.URLParams
  2494. ctx_ context.Context
  2495. }
  2496. // Cancel: Requests that a job be cancelled. This call will return
  2497. // immediately, and the client will need to poll for the job status to
  2498. // see if the cancel completed successfully. Cancelled jobs may still
  2499. // incur costs.
  2500. func (r *JobsService) Cancel(projectId string, jobId string) *JobsCancelCall {
  2501. c := &JobsCancelCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2502. c.projectId = projectId
  2503. c.jobId = jobId
  2504. return c
  2505. }
  2506. // Fields allows partial responses to be retrieved. See
  2507. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2508. // for more information.
  2509. func (c *JobsCancelCall) Fields(s ...googleapi.Field) *JobsCancelCall {
  2510. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2511. return c
  2512. }
  2513. // Context sets the context to be used in this call's Do method. Any
  2514. // pending HTTP request will be aborted if the provided context is
  2515. // canceled.
  2516. func (c *JobsCancelCall) Context(ctx context.Context) *JobsCancelCall {
  2517. c.ctx_ = ctx
  2518. return c
  2519. }
  2520. func (c *JobsCancelCall) doRequest(alt string) (*http.Response, error) {
  2521. var body io.Reader = nil
  2522. c.urlParams_.Set("alt", alt)
  2523. urls := googleapi.ResolveRelative(c.s.BasePath, "project/{projectId}/jobs/{jobId}/cancel")
  2524. urls += "?" + c.urlParams_.Encode()
  2525. req, _ := http.NewRequest("POST", urls, body)
  2526. googleapi.Expand(req.URL, map[string]string{
  2527. "projectId": c.projectId,
  2528. "jobId": c.jobId,
  2529. })
  2530. req.Header.Set("User-Agent", c.s.userAgent())
  2531. if c.ctx_ != nil {
  2532. return ctxhttp.Do(c.ctx_, c.s.client, req)
  2533. }
  2534. return c.s.client.Do(req)
  2535. }
  2536. // Do executes the "bigquery.jobs.cancel" call.
  2537. // Exactly one of *JobCancelResponse or error will be non-nil. Any
  2538. // non-2xx status code is an error. Response headers are in either
  2539. // *JobCancelResponse.ServerResponse.Header or (if a response was
  2540. // returned at all) in error.(*googleapi.Error).Header. Use
  2541. // googleapi.IsNotModified to check whether the returned error was
  2542. // because http.StatusNotModified was returned.
  2543. func (c *JobsCancelCall) Do(opts ...googleapi.CallOption) (*JobCancelResponse, error) {
  2544. gensupport.SetOptions(c.urlParams_, opts...)
  2545. res, err := c.doRequest("json")
  2546. if res != nil && res.StatusCode == http.StatusNotModified {
  2547. if res.Body != nil {
  2548. res.Body.Close()
  2549. }
  2550. return nil, &googleapi.Error{
  2551. Code: res.StatusCode,
  2552. Header: res.Header,
  2553. }
  2554. }
  2555. if err != nil {
  2556. return nil, err
  2557. }
  2558. defer googleapi.CloseBody(res)
  2559. if err := googleapi.CheckResponse(res); err != nil {
  2560. return nil, err
  2561. }
  2562. ret := &JobCancelResponse{
  2563. ServerResponse: googleapi.ServerResponse{
  2564. Header: res.Header,
  2565. HTTPStatusCode: res.StatusCode,
  2566. },
  2567. }
  2568. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  2569. return nil, err
  2570. }
  2571. return ret, nil
  2572. // {
  2573. // "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.",
  2574. // "httpMethod": "POST",
  2575. // "id": "bigquery.jobs.cancel",
  2576. // "parameterOrder": [
  2577. // "projectId",
  2578. // "jobId"
  2579. // ],
  2580. // "parameters": {
  2581. // "jobId": {
  2582. // "description": "[Required] Job ID of the job to cancel",
  2583. // "location": "path",
  2584. // "required": true,
  2585. // "type": "string"
  2586. // },
  2587. // "projectId": {
  2588. // "description": "[Required] Project ID of the job to cancel",
  2589. // "location": "path",
  2590. // "required": true,
  2591. // "type": "string"
  2592. // }
  2593. // },
  2594. // "path": "project/{projectId}/jobs/{jobId}/cancel",
  2595. // "response": {
  2596. // "$ref": "JobCancelResponse"
  2597. // },
  2598. // "scopes": [
  2599. // "https://www.googleapis.com/auth/bigquery",
  2600. // "https://www.googleapis.com/auth/cloud-platform"
  2601. // ]
  2602. // }
  2603. }
  2604. // method id "bigquery.jobs.get":
  2605. type JobsGetCall struct {
  2606. s *Service
  2607. projectId string
  2608. jobId string
  2609. urlParams_ gensupport.URLParams
  2610. ifNoneMatch_ string
  2611. ctx_ context.Context
  2612. }
  2613. // Get: Returns information about a specific job. Job information is
  2614. // available for a six month period after creation. Requires that you're
  2615. // the person who ran the job, or have the Is Owner project role.
  2616. func (r *JobsService) Get(projectId string, jobId string) *JobsGetCall {
  2617. c := &JobsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2618. c.projectId = projectId
  2619. c.jobId = jobId
  2620. return c
  2621. }
  2622. // Fields allows partial responses to be retrieved. See
  2623. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2624. // for more information.
  2625. func (c *JobsGetCall) Fields(s ...googleapi.Field) *JobsGetCall {
  2626. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2627. return c
  2628. }
  2629. // IfNoneMatch sets the optional parameter which makes the operation
  2630. // fail if the object's ETag matches the given value. This is useful for
  2631. // getting updates only after the object has changed since the last
  2632. // request. Use googleapi.IsNotModified to check whether the response
  2633. // error from Do is the result of In-None-Match.
  2634. func (c *JobsGetCall) IfNoneMatch(entityTag string) *JobsGetCall {
  2635. c.ifNoneMatch_ = entityTag
  2636. return c
  2637. }
  2638. // Context sets the context to be used in this call's Do method. Any
  2639. // pending HTTP request will be aborted if the provided context is
  2640. // canceled.
  2641. func (c *JobsGetCall) Context(ctx context.Context) *JobsGetCall {
  2642. c.ctx_ = ctx
  2643. return c
  2644. }
  2645. func (c *JobsGetCall) doRequest(alt string) (*http.Response, error) {
  2646. var body io.Reader = nil
  2647. c.urlParams_.Set("alt", alt)
  2648. urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{projectId}/jobs/{jobId}")
  2649. urls += "?" + c.urlParams_.Encode()
  2650. req, _ := http.NewRequest("GET", urls, body)
  2651. googleapi.Expand(req.URL, map[string]string{
  2652. "projectId": c.projectId,
  2653. "jobId": c.jobId,
  2654. })
  2655. req.Header.Set("User-Agent", c.s.userAgent())
  2656. if c.ifNoneMatch_ != "" {
  2657. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  2658. }
  2659. if c.ctx_ != nil {
  2660. return ctxhttp.Do(c.ctx_, c.s.client, req)
  2661. }
  2662. return c.s.client.Do(req)
  2663. }
  2664. // Do executes the "bigquery.jobs.get" call.
  2665. // Exactly one of *Job or error will be non-nil. Any non-2xx status code
  2666. // is an error. Response headers are in either
  2667. // *Job.ServerResponse.Header or (if a response was returned at all) in
  2668. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  2669. // whether the returned error was because http.StatusNotModified was
  2670. // returned.
  2671. func (c *JobsGetCall) Do(opts ...googleapi.CallOption) (*Job, error) {
  2672. gensupport.SetOptions(c.urlParams_, opts...)
  2673. res, err := c.doRequest("json")
  2674. if res != nil && res.StatusCode == http.StatusNotModified {
  2675. if res.Body != nil {
  2676. res.Body.Close()
  2677. }
  2678. return nil, &googleapi.Error{
  2679. Code: res.StatusCode,
  2680. Header: res.Header,
  2681. }
  2682. }
  2683. if err != nil {
  2684. return nil, err
  2685. }
  2686. defer googleapi.CloseBody(res)
  2687. if err := googleapi.CheckResponse(res); err != nil {
  2688. return nil, err
  2689. }
  2690. ret := &Job{
  2691. ServerResponse: googleapi.ServerResponse{
  2692. Header: res.Header,
  2693. HTTPStatusCode: res.StatusCode,
  2694. },
  2695. }
  2696. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  2697. return nil, err
  2698. }
  2699. return ret, nil
  2700. // {
  2701. // "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.",
  2702. // "httpMethod": "GET",
  2703. // "id": "bigquery.jobs.get",
  2704. // "parameterOrder": [
  2705. // "projectId",
  2706. // "jobId"
  2707. // ],
  2708. // "parameters": {
  2709. // "jobId": {
  2710. // "description": "[Required] Job ID of the requested job",
  2711. // "location": "path",
  2712. // "required": true,
  2713. // "type": "string"
  2714. // },
  2715. // "projectId": {
  2716. // "description": "[Required] Project ID of the requested job",
  2717. // "location": "path",
  2718. // "required": true,
  2719. // "type": "string"
  2720. // }
  2721. // },
  2722. // "path": "projects/{projectId}/jobs/{jobId}",
  2723. // "response": {
  2724. // "$ref": "Job"
  2725. // },
  2726. // "scopes": [
  2727. // "https://www.googleapis.com/auth/bigquery",
  2728. // "https://www.googleapis.com/auth/cloud-platform",
  2729. // "https://www.googleapis.com/auth/cloud-platform.read-only"
  2730. // ]
  2731. // }
  2732. }
  2733. // method id "bigquery.jobs.getQueryResults":
  2734. type JobsGetQueryResultsCall struct {
  2735. s *Service
  2736. projectId string
  2737. jobId string
  2738. urlParams_ gensupport.URLParams
  2739. ifNoneMatch_ string
  2740. ctx_ context.Context
  2741. }
  2742. // GetQueryResults: Retrieves the results of a query job.
  2743. func (r *JobsService) GetQueryResults(projectId string, jobId string) *JobsGetQueryResultsCall {
  2744. c := &JobsGetQueryResultsCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2745. c.projectId = projectId
  2746. c.jobId = jobId
  2747. return c
  2748. }
  2749. // MaxResults sets the optional parameter "maxResults": Maximum number
  2750. // of results to read
  2751. func (c *JobsGetQueryResultsCall) MaxResults(maxResults int64) *JobsGetQueryResultsCall {
  2752. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  2753. return c
  2754. }
  2755. // PageToken sets the optional parameter "pageToken": Page token,
  2756. // returned by a previous call, to request the next page of results
  2757. func (c *JobsGetQueryResultsCall) PageToken(pageToken string) *JobsGetQueryResultsCall {
  2758. c.urlParams_.Set("pageToken", pageToken)
  2759. return c
  2760. }
  2761. // StartIndex sets the optional parameter "startIndex": Zero-based index
  2762. // of the starting row
  2763. func (c *JobsGetQueryResultsCall) StartIndex(startIndex uint64) *JobsGetQueryResultsCall {
  2764. c.urlParams_.Set("startIndex", fmt.Sprint(startIndex))
  2765. return c
  2766. }
  2767. // TimeoutMs sets the optional parameter "timeoutMs": How long to wait
  2768. // for the query to complete, in milliseconds, before returning. Default
  2769. // is 10 seconds. If the timeout passes before the job completes, the
  2770. // 'jobComplete' field in the response will be false
  2771. func (c *JobsGetQueryResultsCall) TimeoutMs(timeoutMs int64) *JobsGetQueryResultsCall {
  2772. c.urlParams_.Set("timeoutMs", fmt.Sprint(timeoutMs))
  2773. return c
  2774. }
  2775. // Fields allows partial responses to be retrieved. See
  2776. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2777. // for more information.
  2778. func (c *JobsGetQueryResultsCall) Fields(s ...googleapi.Field) *JobsGetQueryResultsCall {
  2779. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2780. return c
  2781. }
  2782. // IfNoneMatch sets the optional parameter which makes the operation
  2783. // fail if the object's ETag matches the given value. This is useful for
  2784. // getting updates only after the object has changed since the last
  2785. // request. Use googleapi.IsNotModified to check whether the response
  2786. // error from Do is the result of In-None-Match.
  2787. func (c *JobsGetQueryResultsCall) IfNoneMatch(entityTag string) *JobsGetQueryResultsCall {
  2788. c.ifNoneMatch_ = entityTag
  2789. return c
  2790. }
  2791. // Context sets the context to be used in this call's Do method. Any
  2792. // pending HTTP request will be aborted if the provided context is
  2793. // canceled.
  2794. func (c *JobsGetQueryResultsCall) Context(ctx context.Context) *JobsGetQueryResultsCall {
  2795. c.ctx_ = ctx
  2796. return c
  2797. }
  2798. func (c *JobsGetQueryResultsCall) doRequest(alt string) (*http.Response, error) {
  2799. var body io.Reader = nil
  2800. c.urlParams_.Set("alt", alt)
  2801. urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{projectId}/queries/{jobId}")
  2802. urls += "?" + c.urlParams_.Encode()
  2803. req, _ := http.NewRequest("GET", urls, body)
  2804. googleapi.Expand(req.URL, map[string]string{
  2805. "projectId": c.projectId,
  2806. "jobId": c.jobId,
  2807. })
  2808. req.Header.Set("User-Agent", c.s.userAgent())
  2809. if c.ifNoneMatch_ != "" {
  2810. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  2811. }
  2812. if c.ctx_ != nil {
  2813. return ctxhttp.Do(c.ctx_, c.s.client, req)
  2814. }
  2815. return c.s.client.Do(req)
  2816. }
  2817. // Do executes the "bigquery.jobs.getQueryResults" call.
  2818. // Exactly one of *GetQueryResultsResponse or error will be non-nil. Any
  2819. // non-2xx status code is an error. Response headers are in either
  2820. // *GetQueryResultsResponse.ServerResponse.Header or (if a response was
  2821. // returned at all) in error.(*googleapi.Error).Header. Use
  2822. // googleapi.IsNotModified to check whether the returned error was
  2823. // because http.StatusNotModified was returned.
  2824. func (c *JobsGetQueryResultsCall) Do(opts ...googleapi.CallOption) (*GetQueryResultsResponse, error) {
  2825. gensupport.SetOptions(c.urlParams_, opts...)
  2826. res, err := c.doRequest("json")
  2827. if res != nil && res.StatusCode == http.StatusNotModified {
  2828. if res.Body != nil {
  2829. res.Body.Close()
  2830. }
  2831. return nil, &googleapi.Error{
  2832. Code: res.StatusCode,
  2833. Header: res.Header,
  2834. }
  2835. }
  2836. if err != nil {
  2837. return nil, err
  2838. }
  2839. defer googleapi.CloseBody(res)
  2840. if err := googleapi.CheckResponse(res); err != nil {
  2841. return nil, err
  2842. }
  2843. ret := &GetQueryResultsResponse{
  2844. ServerResponse: googleapi.ServerResponse{
  2845. Header: res.Header,
  2846. HTTPStatusCode: res.StatusCode,
  2847. },
  2848. }
  2849. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  2850. return nil, err
  2851. }
  2852. return ret, nil
  2853. // {
  2854. // "description": "Retrieves the results of a query job.",
  2855. // "httpMethod": "GET",
  2856. // "id": "bigquery.jobs.getQueryResults",
  2857. // "parameterOrder": [
  2858. // "projectId",
  2859. // "jobId"
  2860. // ],
  2861. // "parameters": {
  2862. // "jobId": {
  2863. // "description": "[Required] Job ID of the query job",
  2864. // "location": "path",
  2865. // "required": true,
  2866. // "type": "string"
  2867. // },
  2868. // "maxResults": {
  2869. // "description": "Maximum number of results to read",
  2870. // "format": "uint32",
  2871. // "location": "query",
  2872. // "type": "integer"
  2873. // },
  2874. // "pageToken": {
  2875. // "description": "Page token, returned by a previous call, to request the next page of results",
  2876. // "location": "query",
  2877. // "type": "string"
  2878. // },
  2879. // "projectId": {
  2880. // "description": "[Required] Project ID of the query job",
  2881. // "location": "path",
  2882. // "required": true,
  2883. // "type": "string"
  2884. // },
  2885. // "startIndex": {
  2886. // "description": "Zero-based index of the starting row",
  2887. // "format": "uint64",
  2888. // "location": "query",
  2889. // "type": "string"
  2890. // },
  2891. // "timeoutMs": {
  2892. // "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",
  2893. // "format": "uint32",
  2894. // "location": "query",
  2895. // "type": "integer"
  2896. // }
  2897. // },
  2898. // "path": "projects/{projectId}/queries/{jobId}",
  2899. // "response": {
  2900. // "$ref": "GetQueryResultsResponse"
  2901. // },
  2902. // "scopes": [
  2903. // "https://www.googleapis.com/auth/bigquery",
  2904. // "https://www.googleapis.com/auth/cloud-platform",
  2905. // "https://www.googleapis.com/auth/cloud-platform.read-only"
  2906. // ]
  2907. // }
  2908. }
  2909. // Pages invokes f for each page of results.
  2910. // A non-nil error returned from f will halt the iteration.
  2911. // The provided context supersedes any context provided to the Context method.
  2912. func (c *JobsGetQueryResultsCall) Pages(ctx context.Context, f func(*GetQueryResultsResponse) error) error {
  2913. c.ctx_ = ctx
  2914. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  2915. for {
  2916. x, err := c.Do()
  2917. if err != nil {
  2918. return err
  2919. }
  2920. if err := f(x); err != nil {
  2921. return err
  2922. }
  2923. if x.PageToken == "" {
  2924. return nil
  2925. }
  2926. c.PageToken(x.PageToken)
  2927. }
  2928. }
  2929. // method id "bigquery.jobs.insert":
  2930. type JobsInsertCall struct {
  2931. s *Service
  2932. projectId string
  2933. job *Job
  2934. urlParams_ gensupport.URLParams
  2935. media_ io.Reader
  2936. resumableBuffer_ *gensupport.ResumableBuffer
  2937. mediaType_ string
  2938. mediaSize_ int64 // mediaSize, if known. Used only for calls to progressUpdater_.
  2939. progressUpdater_ googleapi.ProgressUpdater
  2940. ctx_ context.Context
  2941. }
  2942. // Insert: Starts a new asynchronous job. Requires the Can View project
  2943. // role.
  2944. func (r *JobsService) Insert(projectId string, job *Job) *JobsInsertCall {
  2945. c := &JobsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2946. c.projectId = projectId
  2947. c.job = job
  2948. return c
  2949. }
  2950. // Media specifies the media to upload in one or more chunks. The chunk
  2951. // size may be controlled by supplying a MediaOption generated by
  2952. // googleapi.ChunkSize. The chunk size defaults to
  2953. // googleapi.DefaultUploadChunkSize.
  2954. // At most one of Media and ResumableMedia may be set.
  2955. func (c *JobsInsertCall) Media(r io.Reader, options ...googleapi.MediaOption) *JobsInsertCall {
  2956. opts := googleapi.ProcessMediaOptions(options)
  2957. chunkSize := opts.ChunkSize
  2958. r, c.mediaType_ = gensupport.DetermineContentType(r, opts.ContentType)
  2959. c.media_, c.resumableBuffer_ = gensupport.PrepareUpload(r, chunkSize)
  2960. return c
  2961. }
  2962. // ResumableMedia specifies the media to upload in chunks and can be
  2963. // canceled with ctx.
  2964. //
  2965. // Deprecated: use Media instead.
  2966. //
  2967. // At most one of Media and ResumableMedia may be set. mediaType
  2968. // identifies the MIME media type of the upload, such as "image/png". If
  2969. // mediaType is "", it will be auto-detected. The provided ctx will
  2970. // supersede any context previously provided to the Context method.
  2971. func (c *JobsInsertCall) ResumableMedia(ctx context.Context, r io.ReaderAt, size int64, mediaType string) *JobsInsertCall {
  2972. c.ctx_ = ctx
  2973. rdr := gensupport.ReaderAtToReader(r, size)
  2974. rdr, c.mediaType_ = gensupport.DetermineContentType(rdr, mediaType)
  2975. c.resumableBuffer_ = gensupport.NewResumableBuffer(rdr, googleapi.DefaultUploadChunkSize)
  2976. c.media_ = nil
  2977. c.mediaSize_ = size
  2978. return c
  2979. }
  2980. // ProgressUpdater provides a callback function that will be called
  2981. // after every chunk. It should be a low-latency function in order to
  2982. // not slow down the upload operation. This should only be called when
  2983. // using ResumableMedia (as opposed to Media).
  2984. func (c *JobsInsertCall) ProgressUpdater(pu googleapi.ProgressUpdater) *JobsInsertCall {
  2985. c.progressUpdater_ = pu
  2986. return c
  2987. }
  2988. // Fields allows partial responses to be retrieved. See
  2989. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2990. // for more information.
  2991. func (c *JobsInsertCall) Fields(s ...googleapi.Field) *JobsInsertCall {
  2992. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2993. return c
  2994. }
  2995. // Context sets the context to be used in this call's Do method. Any
  2996. // pending HTTP request will be aborted if the provided context is
  2997. // canceled.
  2998. // This context will supersede any context previously provided to the
  2999. // ResumableMedia method.
  3000. func (c *JobsInsertCall) Context(ctx context.Context) *JobsInsertCall {
  3001. c.ctx_ = ctx
  3002. return c
  3003. }
  3004. func (c *JobsInsertCall) doRequest(alt string) (*http.Response, error) {
  3005. var body io.Reader = nil
  3006. body, err := googleapi.WithoutDataWrapper.JSONReader(c.job)
  3007. if err != nil {
  3008. return nil, err
  3009. }
  3010. ctype := "application/json"
  3011. c.urlParams_.Set("alt", alt)
  3012. urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{projectId}/jobs")
  3013. if c.media_ != nil || c.resumableBuffer_ != nil {
  3014. urls = strings.Replace(urls, "https://www.googleapis.com/", "https://www.googleapis.com/upload/", 1)
  3015. protocol := "multipart"
  3016. if c.resumableBuffer_ != nil {
  3017. protocol = "resumable"
  3018. }
  3019. c.urlParams_.Set("uploadType", protocol)
  3020. }
  3021. urls += "?" + c.urlParams_.Encode()
  3022. if c.media_ != nil {
  3023. var combined io.ReadCloser
  3024. combined, ctype = gensupport.CombineBodyMedia(body, ctype, c.media_, c.mediaType_)
  3025. defer combined.Close()
  3026. body = combined
  3027. }
  3028. req, _ := http.NewRequest("POST", urls, body)
  3029. googleapi.Expand(req.URL, map[string]string{
  3030. "projectId": c.projectId,
  3031. })
  3032. if c.resumableBuffer_ != nil {
  3033. req.Header.Set("X-Upload-Content-Type", c.mediaType_)
  3034. }
  3035. req.Header.Set("Content-Type", ctype)
  3036. req.Header.Set("User-Agent", c.s.userAgent())
  3037. if c.ctx_ != nil {
  3038. return ctxhttp.Do(c.ctx_, c.s.client, req)
  3039. }
  3040. return c.s.client.Do(req)
  3041. }
  3042. // Do executes the "bigquery.jobs.insert" call.
  3043. // Exactly one of *Job or error will be non-nil. Any non-2xx status code
  3044. // is an error. Response headers are in either
  3045. // *Job.ServerResponse.Header or (if a response was returned at all) in
  3046. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  3047. // whether the returned error was because http.StatusNotModified was
  3048. // returned.
  3049. func (c *JobsInsertCall) Do(opts ...googleapi.CallOption) (*Job, error) {
  3050. gensupport.SetOptions(c.urlParams_, opts...)
  3051. res, err := gensupport.Retry(c.ctx_, func() (*http.Response, error) {
  3052. return c.doRequest("json")
  3053. }, gensupport.DefaultBackoffStrategy())
  3054. if res != nil && res.StatusCode == http.StatusNotModified {
  3055. if res.Body != nil {
  3056. res.Body.Close()
  3057. }
  3058. return nil, &googleapi.Error{
  3059. Code: res.StatusCode,
  3060. Header: res.Header,
  3061. }
  3062. }
  3063. if err != nil {
  3064. return nil, err
  3065. }
  3066. defer googleapi.CloseBody(res)
  3067. if err := googleapi.CheckResponse(res); err != nil {
  3068. return nil, err
  3069. }
  3070. if c.resumableBuffer_ != nil {
  3071. loc := res.Header.Get("Location")
  3072. rx := &gensupport.ResumableUpload{
  3073. Client: c.s.client,
  3074. UserAgent: c.s.userAgent(),
  3075. URI: loc,
  3076. Media: c.resumableBuffer_,
  3077. MediaType: c.mediaType_,
  3078. Callback: func(curr int64) {
  3079. if c.progressUpdater_ != nil {
  3080. c.progressUpdater_(curr, c.mediaSize_)
  3081. }
  3082. },
  3083. }
  3084. ctx := c.ctx_
  3085. if ctx == nil {
  3086. ctx = context.TODO()
  3087. }
  3088. res, err = rx.Upload(ctx)
  3089. if err != nil {
  3090. return nil, err
  3091. }
  3092. defer res.Body.Close()
  3093. if err := googleapi.CheckResponse(res); err != nil {
  3094. return nil, err
  3095. }
  3096. }
  3097. ret := &Job{
  3098. ServerResponse: googleapi.ServerResponse{
  3099. Header: res.Header,
  3100. HTTPStatusCode: res.StatusCode,
  3101. },
  3102. }
  3103. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  3104. return nil, err
  3105. }
  3106. return ret, nil
  3107. // {
  3108. // "description": "Starts a new asynchronous job. Requires the Can View project role.",
  3109. // "httpMethod": "POST",
  3110. // "id": "bigquery.jobs.insert",
  3111. // "mediaUpload": {
  3112. // "accept": [
  3113. // "*/*"
  3114. // ],
  3115. // "protocols": {
  3116. // "resumable": {
  3117. // "multipart": true,
  3118. // "path": "/resumable/upload/bigquery/v2/projects/{projectId}/jobs"
  3119. // },
  3120. // "simple": {
  3121. // "multipart": true,
  3122. // "path": "/upload/bigquery/v2/projects/{projectId}/jobs"
  3123. // }
  3124. // }
  3125. // },
  3126. // "parameterOrder": [
  3127. // "projectId"
  3128. // ],
  3129. // "parameters": {
  3130. // "projectId": {
  3131. // "description": "Project ID of the project that will be billed for the job",
  3132. // "location": "path",
  3133. // "required": true,
  3134. // "type": "string"
  3135. // }
  3136. // },
  3137. // "path": "projects/{projectId}/jobs",
  3138. // "request": {
  3139. // "$ref": "Job"
  3140. // },
  3141. // "response": {
  3142. // "$ref": "Job"
  3143. // },
  3144. // "scopes": [
  3145. // "https://www.googleapis.com/auth/bigquery",
  3146. // "https://www.googleapis.com/auth/cloud-platform",
  3147. // "https://www.googleapis.com/auth/devstorage.full_control",
  3148. // "https://www.googleapis.com/auth/devstorage.read_only",
  3149. // "https://www.googleapis.com/auth/devstorage.read_write"
  3150. // ],
  3151. // "supportsMediaUpload": true
  3152. // }
  3153. }
  3154. // method id "bigquery.jobs.list":
  3155. type JobsListCall struct {
  3156. s *Service
  3157. projectId string
  3158. urlParams_ gensupport.URLParams
  3159. ifNoneMatch_ string
  3160. ctx_ context.Context
  3161. }
  3162. // List: Lists all jobs that you started in the specified project. Job
  3163. // information is available for a six month period after creation. The
  3164. // job list is sorted in reverse chronological order, by job creation
  3165. // time. Requires the Can View project role, or the Is Owner project
  3166. // role if you set the allUsers property.
  3167. func (r *JobsService) List(projectId string) *JobsListCall {
  3168. c := &JobsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3169. c.projectId = projectId
  3170. return c
  3171. }
  3172. // AllUsers sets the optional parameter "allUsers": Whether to display
  3173. // jobs owned by all users in the project. Default false
  3174. func (c *JobsListCall) AllUsers(allUsers bool) *JobsListCall {
  3175. c.urlParams_.Set("allUsers", fmt.Sprint(allUsers))
  3176. return c
  3177. }
  3178. // MaxResults sets the optional parameter "maxResults": Maximum number
  3179. // of results to return
  3180. func (c *JobsListCall) MaxResults(maxResults int64) *JobsListCall {
  3181. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  3182. return c
  3183. }
  3184. // PageToken sets the optional parameter "pageToken": Page token,
  3185. // returned by a previous call, to request the next page of results
  3186. func (c *JobsListCall) PageToken(pageToken string) *JobsListCall {
  3187. c.urlParams_.Set("pageToken", pageToken)
  3188. return c
  3189. }
  3190. // Projection sets the optional parameter "projection": Restrict
  3191. // information returned to a set of selected fields
  3192. //
  3193. // Possible values:
  3194. // "full" - Includes all job data
  3195. // "minimal" - Does not include the job configuration
  3196. func (c *JobsListCall) Projection(projection string) *JobsListCall {
  3197. c.urlParams_.Set("projection", projection)
  3198. return c
  3199. }
  3200. // StateFilter sets the optional parameter "stateFilter": Filter for job
  3201. // state
  3202. //
  3203. // Possible values:
  3204. // "done" - Finished jobs
  3205. // "pending" - Pending jobs
  3206. // "running" - Running jobs
  3207. func (c *JobsListCall) StateFilter(stateFilter ...string) *JobsListCall {
  3208. c.urlParams_.SetMulti("stateFilter", append([]string{}, stateFilter...))
  3209. return c
  3210. }
  3211. // Fields allows partial responses to be retrieved. See
  3212. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3213. // for more information.
  3214. func (c *JobsListCall) Fields(s ...googleapi.Field) *JobsListCall {
  3215. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3216. return c
  3217. }
  3218. // IfNoneMatch sets the optional parameter which makes the operation
  3219. // fail if the object's ETag matches the given value. This is useful for
  3220. // getting updates only after the object has changed since the last
  3221. // request. Use googleapi.IsNotModified to check whether the response
  3222. // error from Do is the result of In-None-Match.
  3223. func (c *JobsListCall) IfNoneMatch(entityTag string) *JobsListCall {
  3224. c.ifNoneMatch_ = entityTag
  3225. return c
  3226. }
  3227. // Context sets the context to be used in this call's Do method. Any
  3228. // pending HTTP request will be aborted if the provided context is
  3229. // canceled.
  3230. func (c *JobsListCall) Context(ctx context.Context) *JobsListCall {
  3231. c.ctx_ = ctx
  3232. return c
  3233. }
  3234. func (c *JobsListCall) doRequest(alt string) (*http.Response, error) {
  3235. var body io.Reader = nil
  3236. c.urlParams_.Set("alt", alt)
  3237. urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{projectId}/jobs")
  3238. urls += "?" + c.urlParams_.Encode()
  3239. req, _ := http.NewRequest("GET", urls, body)
  3240. googleapi.Expand(req.URL, map[string]string{
  3241. "projectId": c.projectId,
  3242. })
  3243. req.Header.Set("User-Agent", c.s.userAgent())
  3244. if c.ifNoneMatch_ != "" {
  3245. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  3246. }
  3247. if c.ctx_ != nil {
  3248. return ctxhttp.Do(c.ctx_, c.s.client, req)
  3249. }
  3250. return c.s.client.Do(req)
  3251. }
  3252. // Do executes the "bigquery.jobs.list" call.
  3253. // Exactly one of *JobList or error will be non-nil. Any non-2xx status
  3254. // code is an error. Response headers are in either
  3255. // *JobList.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 *JobsListCall) Do(opts ...googleapi.CallOption) (*JobList, 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 := &JobList{
  3279. ServerResponse: googleapi.ServerResponse{
  3280. Header: res.Header,
  3281. HTTPStatusCode: res.StatusCode,
  3282. },
  3283. }
  3284. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  3285. return nil, err
  3286. }
  3287. return ret, nil
  3288. // {
  3289. // "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.",
  3290. // "httpMethod": "GET",
  3291. // "id": "bigquery.jobs.list",
  3292. // "parameterOrder": [
  3293. // "projectId"
  3294. // ],
  3295. // "parameters": {
  3296. // "allUsers": {
  3297. // "description": "Whether to display jobs owned by all users in the project. Default false",
  3298. // "location": "query",
  3299. // "type": "boolean"
  3300. // },
  3301. // "maxResults": {
  3302. // "description": "Maximum number of results to return",
  3303. // "format": "uint32",
  3304. // "location": "query",
  3305. // "type": "integer"
  3306. // },
  3307. // "pageToken": {
  3308. // "description": "Page token, returned by a previous call, to request the next page of results",
  3309. // "location": "query",
  3310. // "type": "string"
  3311. // },
  3312. // "projectId": {
  3313. // "description": "Project ID of the jobs to list",
  3314. // "location": "path",
  3315. // "required": true,
  3316. // "type": "string"
  3317. // },
  3318. // "projection": {
  3319. // "description": "Restrict information returned to a set of selected fields",
  3320. // "enum": [
  3321. // "full",
  3322. // "minimal"
  3323. // ],
  3324. // "enumDescriptions": [
  3325. // "Includes all job data",
  3326. // "Does not include the job configuration"
  3327. // ],
  3328. // "location": "query",
  3329. // "type": "string"
  3330. // },
  3331. // "stateFilter": {
  3332. // "description": "Filter for job state",
  3333. // "enum": [
  3334. // "done",
  3335. // "pending",
  3336. // "running"
  3337. // ],
  3338. // "enumDescriptions": [
  3339. // "Finished jobs",
  3340. // "Pending jobs",
  3341. // "Running jobs"
  3342. // ],
  3343. // "location": "query",
  3344. // "repeated": true,
  3345. // "type": "string"
  3346. // }
  3347. // },
  3348. // "path": "projects/{projectId}/jobs",
  3349. // "response": {
  3350. // "$ref": "JobList"
  3351. // },
  3352. // "scopes": [
  3353. // "https://www.googleapis.com/auth/bigquery",
  3354. // "https://www.googleapis.com/auth/cloud-platform",
  3355. // "https://www.googleapis.com/auth/cloud-platform.read-only"
  3356. // ]
  3357. // }
  3358. }
  3359. // Pages invokes f for each page of results.
  3360. // A non-nil error returned from f will halt the iteration.
  3361. // The provided context supersedes any context provided to the Context method.
  3362. func (c *JobsListCall) Pages(ctx context.Context, f func(*JobList) error) error {
  3363. c.ctx_ = ctx
  3364. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  3365. for {
  3366. x, err := c.Do()
  3367. if err != nil {
  3368. return err
  3369. }
  3370. if err := f(x); err != nil {
  3371. return err
  3372. }
  3373. if x.NextPageToken == "" {
  3374. return nil
  3375. }
  3376. c.PageToken(x.NextPageToken)
  3377. }
  3378. }
  3379. // method id "bigquery.jobs.query":
  3380. type JobsQueryCall struct {
  3381. s *Service
  3382. projectId string
  3383. queryrequest *QueryRequest
  3384. urlParams_ gensupport.URLParams
  3385. ctx_ context.Context
  3386. }
  3387. // Query: Runs a BigQuery SQL query synchronously and returns query
  3388. // results if the query completes within a specified timeout.
  3389. func (r *JobsService) Query(projectId string, queryrequest *QueryRequest) *JobsQueryCall {
  3390. c := &JobsQueryCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3391. c.projectId = projectId
  3392. c.queryrequest = queryrequest
  3393. return c
  3394. }
  3395. // Fields allows partial responses to be retrieved. See
  3396. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3397. // for more information.
  3398. func (c *JobsQueryCall) Fields(s ...googleapi.Field) *JobsQueryCall {
  3399. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3400. return c
  3401. }
  3402. // Context sets the context to be used in this call's Do method. Any
  3403. // pending HTTP request will be aborted if the provided context is
  3404. // canceled.
  3405. func (c *JobsQueryCall) Context(ctx context.Context) *JobsQueryCall {
  3406. c.ctx_ = ctx
  3407. return c
  3408. }
  3409. func (c *JobsQueryCall) doRequest(alt string) (*http.Response, error) {
  3410. var body io.Reader = nil
  3411. body, err := googleapi.WithoutDataWrapper.JSONReader(c.queryrequest)
  3412. if err != nil {
  3413. return nil, err
  3414. }
  3415. ctype := "application/json"
  3416. c.urlParams_.Set("alt", alt)
  3417. urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{projectId}/queries")
  3418. urls += "?" + c.urlParams_.Encode()
  3419. req, _ := http.NewRequest("POST", urls, body)
  3420. googleapi.Expand(req.URL, map[string]string{
  3421. "projectId": c.projectId,
  3422. })
  3423. req.Header.Set("Content-Type", ctype)
  3424. req.Header.Set("User-Agent", c.s.userAgent())
  3425. if c.ctx_ != nil {
  3426. return ctxhttp.Do(c.ctx_, c.s.client, req)
  3427. }
  3428. return c.s.client.Do(req)
  3429. }
  3430. // Do executes the "bigquery.jobs.query" call.
  3431. // Exactly one of *QueryResponse or error will be non-nil. Any non-2xx
  3432. // status code is an error. Response headers are in either
  3433. // *QueryResponse.ServerResponse.Header or (if a response was returned
  3434. // at all) in error.(*googleapi.Error).Header. Use
  3435. // googleapi.IsNotModified to check whether the returned error was
  3436. // because http.StatusNotModified was returned.
  3437. func (c *JobsQueryCall) Do(opts ...googleapi.CallOption) (*QueryResponse, error) {
  3438. gensupport.SetOptions(c.urlParams_, opts...)
  3439. res, err := c.doRequest("json")
  3440. if res != nil && res.StatusCode == http.StatusNotModified {
  3441. if res.Body != nil {
  3442. res.Body.Close()
  3443. }
  3444. return nil, &googleapi.Error{
  3445. Code: res.StatusCode,
  3446. Header: res.Header,
  3447. }
  3448. }
  3449. if err != nil {
  3450. return nil, err
  3451. }
  3452. defer googleapi.CloseBody(res)
  3453. if err := googleapi.CheckResponse(res); err != nil {
  3454. return nil, err
  3455. }
  3456. ret := &QueryResponse{
  3457. ServerResponse: googleapi.ServerResponse{
  3458. Header: res.Header,
  3459. HTTPStatusCode: res.StatusCode,
  3460. },
  3461. }
  3462. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  3463. return nil, err
  3464. }
  3465. return ret, nil
  3466. // {
  3467. // "description": "Runs a BigQuery SQL query synchronously and returns query results if the query completes within a specified timeout.",
  3468. // "httpMethod": "POST",
  3469. // "id": "bigquery.jobs.query",
  3470. // "parameterOrder": [
  3471. // "projectId"
  3472. // ],
  3473. // "parameters": {
  3474. // "projectId": {
  3475. // "description": "Project ID of the project billed for the query",
  3476. // "location": "path",
  3477. // "required": true,
  3478. // "type": "string"
  3479. // }
  3480. // },
  3481. // "path": "projects/{projectId}/queries",
  3482. // "request": {
  3483. // "$ref": "QueryRequest"
  3484. // },
  3485. // "response": {
  3486. // "$ref": "QueryResponse"
  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. // method id "bigquery.projects.list":
  3496. type ProjectsListCall struct {
  3497. s *Service
  3498. urlParams_ gensupport.URLParams
  3499. ifNoneMatch_ string
  3500. ctx_ context.Context
  3501. }
  3502. // List: Lists all projects to which you have been granted any project
  3503. // role.
  3504. func (r *ProjectsService) List() *ProjectsListCall {
  3505. c := &ProjectsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3506. return c
  3507. }
  3508. // MaxResults sets the optional parameter "maxResults": Maximum number
  3509. // of results to return
  3510. func (c *ProjectsListCall) MaxResults(maxResults int64) *ProjectsListCall {
  3511. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  3512. return c
  3513. }
  3514. // PageToken sets the optional parameter "pageToken": Page token,
  3515. // returned by a previous call, to request the next page of results
  3516. func (c *ProjectsListCall) PageToken(pageToken string) *ProjectsListCall {
  3517. c.urlParams_.Set("pageToken", pageToken)
  3518. return c
  3519. }
  3520. // Fields allows partial responses to be retrieved. See
  3521. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3522. // for more information.
  3523. func (c *ProjectsListCall) Fields(s ...googleapi.Field) *ProjectsListCall {
  3524. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3525. return c
  3526. }
  3527. // IfNoneMatch sets the optional parameter which makes the operation
  3528. // fail if the object's ETag matches the given value. This is useful for
  3529. // getting updates only after the object has changed since the last
  3530. // request. Use googleapi.IsNotModified to check whether the response
  3531. // error from Do is the result of In-None-Match.
  3532. func (c *ProjectsListCall) IfNoneMatch(entityTag string) *ProjectsListCall {
  3533. c.ifNoneMatch_ = entityTag
  3534. return c
  3535. }
  3536. // Context sets the context to be used in this call's Do method. Any
  3537. // pending HTTP request will be aborted if the provided context is
  3538. // canceled.
  3539. func (c *ProjectsListCall) Context(ctx context.Context) *ProjectsListCall {
  3540. c.ctx_ = ctx
  3541. return c
  3542. }
  3543. func (c *ProjectsListCall) doRequest(alt string) (*http.Response, error) {
  3544. var body io.Reader = nil
  3545. c.urlParams_.Set("alt", alt)
  3546. urls := googleapi.ResolveRelative(c.s.BasePath, "projects")
  3547. urls += "?" + c.urlParams_.Encode()
  3548. req, _ := http.NewRequest("GET", urls, body)
  3549. googleapi.SetOpaque(req.URL)
  3550. req.Header.Set("User-Agent", c.s.userAgent())
  3551. if c.ifNoneMatch_ != "" {
  3552. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  3553. }
  3554. if c.ctx_ != nil {
  3555. return ctxhttp.Do(c.ctx_, c.s.client, req)
  3556. }
  3557. return c.s.client.Do(req)
  3558. }
  3559. // Do executes the "bigquery.projects.list" call.
  3560. // Exactly one of *ProjectList or error will be non-nil. Any non-2xx
  3561. // status code is an error. Response headers are in either
  3562. // *ProjectList.ServerResponse.Header or (if a response was returned at
  3563. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  3564. // to check whether the returned error was because
  3565. // http.StatusNotModified was returned.
  3566. func (c *ProjectsListCall) Do(opts ...googleapi.CallOption) (*ProjectList, error) {
  3567. gensupport.SetOptions(c.urlParams_, opts...)
  3568. res, err := c.doRequest("json")
  3569. if res != nil && res.StatusCode == http.StatusNotModified {
  3570. if res.Body != nil {
  3571. res.Body.Close()
  3572. }
  3573. return nil, &googleapi.Error{
  3574. Code: res.StatusCode,
  3575. Header: res.Header,
  3576. }
  3577. }
  3578. if err != nil {
  3579. return nil, err
  3580. }
  3581. defer googleapi.CloseBody(res)
  3582. if err := googleapi.CheckResponse(res); err != nil {
  3583. return nil, err
  3584. }
  3585. ret := &ProjectList{
  3586. ServerResponse: googleapi.ServerResponse{
  3587. Header: res.Header,
  3588. HTTPStatusCode: res.StatusCode,
  3589. },
  3590. }
  3591. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  3592. return nil, err
  3593. }
  3594. return ret, nil
  3595. // {
  3596. // "description": "Lists all projects to which you have been granted any project role.",
  3597. // "httpMethod": "GET",
  3598. // "id": "bigquery.projects.list",
  3599. // "parameters": {
  3600. // "maxResults": {
  3601. // "description": "Maximum number of results to return",
  3602. // "format": "uint32",
  3603. // "location": "query",
  3604. // "type": "integer"
  3605. // },
  3606. // "pageToken": {
  3607. // "description": "Page token, returned by a previous call, to request the next page of results",
  3608. // "location": "query",
  3609. // "type": "string"
  3610. // }
  3611. // },
  3612. // "path": "projects",
  3613. // "response": {
  3614. // "$ref": "ProjectList"
  3615. // },
  3616. // "scopes": [
  3617. // "https://www.googleapis.com/auth/bigquery",
  3618. // "https://www.googleapis.com/auth/cloud-platform",
  3619. // "https://www.googleapis.com/auth/cloud-platform.read-only"
  3620. // ]
  3621. // }
  3622. }
  3623. // Pages invokes f for each page of results.
  3624. // A non-nil error returned from f will halt the iteration.
  3625. // The provided context supersedes any context provided to the Context method.
  3626. func (c *ProjectsListCall) Pages(ctx context.Context, f func(*ProjectList) error) error {
  3627. c.ctx_ = ctx
  3628. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  3629. for {
  3630. x, err := c.Do()
  3631. if err != nil {
  3632. return err
  3633. }
  3634. if err := f(x); err != nil {
  3635. return err
  3636. }
  3637. if x.NextPageToken == "" {
  3638. return nil
  3639. }
  3640. c.PageToken(x.NextPageToken)
  3641. }
  3642. }
  3643. // method id "bigquery.tabledata.insertAll":
  3644. type TabledataInsertAllCall struct {
  3645. s *Service
  3646. projectId string
  3647. datasetId string
  3648. tableId string
  3649. tabledatainsertallrequest *TableDataInsertAllRequest
  3650. urlParams_ gensupport.URLParams
  3651. ctx_ context.Context
  3652. }
  3653. // InsertAll: Streams data into BigQuery one record at a time without
  3654. // needing to run a load job. Requires the WRITER dataset role.
  3655. func (r *TabledataService) InsertAll(projectId string, datasetId string, tableId string, tabledatainsertallrequest *TableDataInsertAllRequest) *TabledataInsertAllCall {
  3656. c := &TabledataInsertAllCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3657. c.projectId = projectId
  3658. c.datasetId = datasetId
  3659. c.tableId = tableId
  3660. c.tabledatainsertallrequest = tabledatainsertallrequest
  3661. return c
  3662. }
  3663. // Fields allows partial responses to be retrieved. See
  3664. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3665. // for more information.
  3666. func (c *TabledataInsertAllCall) Fields(s ...googleapi.Field) *TabledataInsertAllCall {
  3667. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3668. return c
  3669. }
  3670. // Context sets the context to be used in this call's Do method. Any
  3671. // pending HTTP request will be aborted if the provided context is
  3672. // canceled.
  3673. func (c *TabledataInsertAllCall) Context(ctx context.Context) *TabledataInsertAllCall {
  3674. c.ctx_ = ctx
  3675. return c
  3676. }
  3677. func (c *TabledataInsertAllCall) doRequest(alt string) (*http.Response, error) {
  3678. var body io.Reader = nil
  3679. body, err := googleapi.WithoutDataWrapper.JSONReader(c.tabledatainsertallrequest)
  3680. if err != nil {
  3681. return nil, err
  3682. }
  3683. ctype := "application/json"
  3684. c.urlParams_.Set("alt", alt)
  3685. urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{projectId}/datasets/{datasetId}/tables/{tableId}/insertAll")
  3686. urls += "?" + c.urlParams_.Encode()
  3687. req, _ := http.NewRequest("POST", urls, body)
  3688. googleapi.Expand(req.URL, map[string]string{
  3689. "projectId": c.projectId,
  3690. "datasetId": c.datasetId,
  3691. "tableId": c.tableId,
  3692. })
  3693. req.Header.Set("Content-Type", ctype)
  3694. req.Header.Set("User-Agent", c.s.userAgent())
  3695. if c.ctx_ != nil {
  3696. return ctxhttp.Do(c.ctx_, c.s.client, req)
  3697. }
  3698. return c.s.client.Do(req)
  3699. }
  3700. // Do executes the "bigquery.tabledata.insertAll" call.
  3701. // Exactly one of *TableDataInsertAllResponse or error will be non-nil.
  3702. // Any non-2xx status code is an error. Response headers are in either
  3703. // *TableDataInsertAllResponse.ServerResponse.Header or (if a response
  3704. // was returned at all) in error.(*googleapi.Error).Header. Use
  3705. // googleapi.IsNotModified to check whether the returned error was
  3706. // because http.StatusNotModified was returned.
  3707. func (c *TabledataInsertAllCall) Do(opts ...googleapi.CallOption) (*TableDataInsertAllResponse, error) {
  3708. gensupport.SetOptions(c.urlParams_, opts...)
  3709. res, err := c.doRequest("json")
  3710. if res != nil && res.StatusCode == http.StatusNotModified {
  3711. if res.Body != nil {
  3712. res.Body.Close()
  3713. }
  3714. return nil, &googleapi.Error{
  3715. Code: res.StatusCode,
  3716. Header: res.Header,
  3717. }
  3718. }
  3719. if err != nil {
  3720. return nil, err
  3721. }
  3722. defer googleapi.CloseBody(res)
  3723. if err := googleapi.CheckResponse(res); err != nil {
  3724. return nil, err
  3725. }
  3726. ret := &TableDataInsertAllResponse{
  3727. ServerResponse: googleapi.ServerResponse{
  3728. Header: res.Header,
  3729. HTTPStatusCode: res.StatusCode,
  3730. },
  3731. }
  3732. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  3733. return nil, err
  3734. }
  3735. return ret, nil
  3736. // {
  3737. // "description": "Streams data into BigQuery one record at a time without needing to run a load job. Requires the WRITER dataset role.",
  3738. // "httpMethod": "POST",
  3739. // "id": "bigquery.tabledata.insertAll",
  3740. // "parameterOrder": [
  3741. // "projectId",
  3742. // "datasetId",
  3743. // "tableId"
  3744. // ],
  3745. // "parameters": {
  3746. // "datasetId": {
  3747. // "description": "Dataset ID of the destination table.",
  3748. // "location": "path",
  3749. // "required": true,
  3750. // "type": "string"
  3751. // },
  3752. // "projectId": {
  3753. // "description": "Project ID of the destination table.",
  3754. // "location": "path",
  3755. // "required": true,
  3756. // "type": "string"
  3757. // },
  3758. // "tableId": {
  3759. // "description": "Table ID of the destination table.",
  3760. // "location": "path",
  3761. // "required": true,
  3762. // "type": "string"
  3763. // }
  3764. // },
  3765. // "path": "projects/{projectId}/datasets/{datasetId}/tables/{tableId}/insertAll",
  3766. // "request": {
  3767. // "$ref": "TableDataInsertAllRequest"
  3768. // },
  3769. // "response": {
  3770. // "$ref": "TableDataInsertAllResponse"
  3771. // },
  3772. // "scopes": [
  3773. // "https://www.googleapis.com/auth/bigquery",
  3774. // "https://www.googleapis.com/auth/bigquery.insertdata",
  3775. // "https://www.googleapis.com/auth/cloud-platform"
  3776. // ]
  3777. // }
  3778. }
  3779. // method id "bigquery.tabledata.list":
  3780. type TabledataListCall struct {
  3781. s *Service
  3782. projectId string
  3783. datasetId string
  3784. tableId string
  3785. urlParams_ gensupport.URLParams
  3786. ifNoneMatch_ string
  3787. ctx_ context.Context
  3788. }
  3789. // List: Retrieves table data from a specified set of rows. Requires the
  3790. // READER dataset role.
  3791. func (r *TabledataService) List(projectId string, datasetId string, tableId string) *TabledataListCall {
  3792. c := &TabledataListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3793. c.projectId = projectId
  3794. c.datasetId = datasetId
  3795. c.tableId = tableId
  3796. return c
  3797. }
  3798. // MaxResults sets the optional parameter "maxResults": Maximum number
  3799. // of results to return
  3800. func (c *TabledataListCall) MaxResults(maxResults int64) *TabledataListCall {
  3801. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  3802. return c
  3803. }
  3804. // PageToken sets the optional parameter "pageToken": Page token,
  3805. // returned by a previous call, identifying the result set
  3806. func (c *TabledataListCall) PageToken(pageToken string) *TabledataListCall {
  3807. c.urlParams_.Set("pageToken", pageToken)
  3808. return c
  3809. }
  3810. // StartIndex sets the optional parameter "startIndex": Zero-based index
  3811. // of the starting row to read
  3812. func (c *TabledataListCall) StartIndex(startIndex uint64) *TabledataListCall {
  3813. c.urlParams_.Set("startIndex", fmt.Sprint(startIndex))
  3814. return c
  3815. }
  3816. // Fields allows partial responses to be retrieved. See
  3817. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3818. // for more information.
  3819. func (c *TabledataListCall) Fields(s ...googleapi.Field) *TabledataListCall {
  3820. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3821. return c
  3822. }
  3823. // IfNoneMatch sets the optional parameter which makes the operation
  3824. // fail if the object's ETag matches the given value. This is useful for
  3825. // getting updates only after the object has changed since the last
  3826. // request. Use googleapi.IsNotModified to check whether the response
  3827. // error from Do is the result of In-None-Match.
  3828. func (c *TabledataListCall) IfNoneMatch(entityTag string) *TabledataListCall {
  3829. c.ifNoneMatch_ = entityTag
  3830. return c
  3831. }
  3832. // Context sets the context to be used in this call's Do method. Any
  3833. // pending HTTP request will be aborted if the provided context is
  3834. // canceled.
  3835. func (c *TabledataListCall) Context(ctx context.Context) *TabledataListCall {
  3836. c.ctx_ = ctx
  3837. return c
  3838. }
  3839. func (c *TabledataListCall) doRequest(alt string) (*http.Response, error) {
  3840. var body io.Reader = nil
  3841. c.urlParams_.Set("alt", alt)
  3842. urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{projectId}/datasets/{datasetId}/tables/{tableId}/data")
  3843. urls += "?" + c.urlParams_.Encode()
  3844. req, _ := http.NewRequest("GET", urls, body)
  3845. googleapi.Expand(req.URL, map[string]string{
  3846. "projectId": c.projectId,
  3847. "datasetId": c.datasetId,
  3848. "tableId": c.tableId,
  3849. })
  3850. req.Header.Set("User-Agent", c.s.userAgent())
  3851. if c.ifNoneMatch_ != "" {
  3852. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  3853. }
  3854. if c.ctx_ != nil {
  3855. return ctxhttp.Do(c.ctx_, c.s.client, req)
  3856. }
  3857. return c.s.client.Do(req)
  3858. }
  3859. // Do executes the "bigquery.tabledata.list" call.
  3860. // Exactly one of *TableDataList or error will be non-nil. Any non-2xx
  3861. // status code is an error. Response headers are in either
  3862. // *TableDataList.ServerResponse.Header or (if a response was returned
  3863. // at all) in error.(*googleapi.Error).Header. Use
  3864. // googleapi.IsNotModified to check whether the returned error was
  3865. // because http.StatusNotModified was returned.
  3866. func (c *TabledataListCall) Do(opts ...googleapi.CallOption) (*TableDataList, error) {
  3867. gensupport.SetOptions(c.urlParams_, opts...)
  3868. res, err := c.doRequest("json")
  3869. if res != nil && res.StatusCode == http.StatusNotModified {
  3870. if res.Body != nil {
  3871. res.Body.Close()
  3872. }
  3873. return nil, &googleapi.Error{
  3874. Code: res.StatusCode,
  3875. Header: res.Header,
  3876. }
  3877. }
  3878. if err != nil {
  3879. return nil, err
  3880. }
  3881. defer googleapi.CloseBody(res)
  3882. if err := googleapi.CheckResponse(res); err != nil {
  3883. return nil, err
  3884. }
  3885. ret := &TableDataList{
  3886. ServerResponse: googleapi.ServerResponse{
  3887. Header: res.Header,
  3888. HTTPStatusCode: res.StatusCode,
  3889. },
  3890. }
  3891. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  3892. return nil, err
  3893. }
  3894. return ret, nil
  3895. // {
  3896. // "description": "Retrieves table data from a specified set of rows. Requires the READER dataset role.",
  3897. // "httpMethod": "GET",
  3898. // "id": "bigquery.tabledata.list",
  3899. // "parameterOrder": [
  3900. // "projectId",
  3901. // "datasetId",
  3902. // "tableId"
  3903. // ],
  3904. // "parameters": {
  3905. // "datasetId": {
  3906. // "description": "Dataset ID of the table to read",
  3907. // "location": "path",
  3908. // "required": true,
  3909. // "type": "string"
  3910. // },
  3911. // "maxResults": {
  3912. // "description": "Maximum number of results to return",
  3913. // "format": "uint32",
  3914. // "location": "query",
  3915. // "type": "integer"
  3916. // },
  3917. // "pageToken": {
  3918. // "description": "Page token, returned by a previous call, identifying the result set",
  3919. // "location": "query",
  3920. // "type": "string"
  3921. // },
  3922. // "projectId": {
  3923. // "description": "Project ID of the table to read",
  3924. // "location": "path",
  3925. // "required": true,
  3926. // "type": "string"
  3927. // },
  3928. // "startIndex": {
  3929. // "description": "Zero-based index of the starting row to read",
  3930. // "format": "uint64",
  3931. // "location": "query",
  3932. // "type": "string"
  3933. // },
  3934. // "tableId": {
  3935. // "description": "Table ID of the table to read",
  3936. // "location": "path",
  3937. // "required": true,
  3938. // "type": "string"
  3939. // }
  3940. // },
  3941. // "path": "projects/{projectId}/datasets/{datasetId}/tables/{tableId}/data",
  3942. // "response": {
  3943. // "$ref": "TableDataList"
  3944. // },
  3945. // "scopes": [
  3946. // "https://www.googleapis.com/auth/bigquery",
  3947. // "https://www.googleapis.com/auth/cloud-platform",
  3948. // "https://www.googleapis.com/auth/cloud-platform.read-only"
  3949. // ]
  3950. // }
  3951. }
  3952. // Pages invokes f for each page of results.
  3953. // A non-nil error returned from f will halt the iteration.
  3954. // The provided context supersedes any context provided to the Context method.
  3955. func (c *TabledataListCall) Pages(ctx context.Context, f func(*TableDataList) error) error {
  3956. c.ctx_ = ctx
  3957. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  3958. for {
  3959. x, err := c.Do()
  3960. if err != nil {
  3961. return err
  3962. }
  3963. if err := f(x); err != nil {
  3964. return err
  3965. }
  3966. if x.PageToken == "" {
  3967. return nil
  3968. }
  3969. c.PageToken(x.PageToken)
  3970. }
  3971. }
  3972. // method id "bigquery.tables.delete":
  3973. type TablesDeleteCall struct {
  3974. s *Service
  3975. projectId string
  3976. datasetId string
  3977. tableId string
  3978. urlParams_ gensupport.URLParams
  3979. ctx_ context.Context
  3980. }
  3981. // Delete: Deletes the table specified by tableId from the dataset. If
  3982. // the table contains data, all the data will be deleted.
  3983. func (r *TablesService) Delete(projectId string, datasetId string, tableId string) *TablesDeleteCall {
  3984. c := &TablesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3985. c.projectId = projectId
  3986. c.datasetId = datasetId
  3987. c.tableId = tableId
  3988. return c
  3989. }
  3990. // Fields allows partial responses to be retrieved. See
  3991. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3992. // for more information.
  3993. func (c *TablesDeleteCall) Fields(s ...googleapi.Field) *TablesDeleteCall {
  3994. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3995. return c
  3996. }
  3997. // Context sets the context to be used in this call's Do method. Any
  3998. // pending HTTP request will be aborted if the provided context is
  3999. // canceled.
  4000. func (c *TablesDeleteCall) Context(ctx context.Context) *TablesDeleteCall {
  4001. c.ctx_ = ctx
  4002. return c
  4003. }
  4004. func (c *TablesDeleteCall) doRequest(alt string) (*http.Response, error) {
  4005. var body io.Reader = nil
  4006. c.urlParams_.Set("alt", alt)
  4007. urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{projectId}/datasets/{datasetId}/tables/{tableId}")
  4008. urls += "?" + c.urlParams_.Encode()
  4009. req, _ := http.NewRequest("DELETE", urls, body)
  4010. googleapi.Expand(req.URL, map[string]string{
  4011. "projectId": c.projectId,
  4012. "datasetId": c.datasetId,
  4013. "tableId": c.tableId,
  4014. })
  4015. req.Header.Set("User-Agent", c.s.userAgent())
  4016. if c.ctx_ != nil {
  4017. return ctxhttp.Do(c.ctx_, c.s.client, req)
  4018. }
  4019. return c.s.client.Do(req)
  4020. }
  4021. // Do executes the "bigquery.tables.delete" call.
  4022. func (c *TablesDeleteCall) Do(opts ...googleapi.CallOption) error {
  4023. gensupport.SetOptions(c.urlParams_, opts...)
  4024. res, err := c.doRequest("json")
  4025. if err != nil {
  4026. return err
  4027. }
  4028. defer googleapi.CloseBody(res)
  4029. if err := googleapi.CheckResponse(res); err != nil {
  4030. return err
  4031. }
  4032. return nil
  4033. // {
  4034. // "description": "Deletes the table specified by tableId from the dataset. If the table contains data, all the data will be deleted.",
  4035. // "httpMethod": "DELETE",
  4036. // "id": "bigquery.tables.delete",
  4037. // "parameterOrder": [
  4038. // "projectId",
  4039. // "datasetId",
  4040. // "tableId"
  4041. // ],
  4042. // "parameters": {
  4043. // "datasetId": {
  4044. // "description": "Dataset ID of the table to delete",
  4045. // "location": "path",
  4046. // "required": true,
  4047. // "type": "string"
  4048. // },
  4049. // "projectId": {
  4050. // "description": "Project ID of the table to delete",
  4051. // "location": "path",
  4052. // "required": true,
  4053. // "type": "string"
  4054. // },
  4055. // "tableId": {
  4056. // "description": "Table ID of the table to delete",
  4057. // "location": "path",
  4058. // "required": true,
  4059. // "type": "string"
  4060. // }
  4061. // },
  4062. // "path": "projects/{projectId}/datasets/{datasetId}/tables/{tableId}",
  4063. // "scopes": [
  4064. // "https://www.googleapis.com/auth/bigquery",
  4065. // "https://www.googleapis.com/auth/cloud-platform"
  4066. // ]
  4067. // }
  4068. }
  4069. // method id "bigquery.tables.get":
  4070. type TablesGetCall struct {
  4071. s *Service
  4072. projectId string
  4073. datasetId string
  4074. tableId string
  4075. urlParams_ gensupport.URLParams
  4076. ifNoneMatch_ string
  4077. ctx_ context.Context
  4078. }
  4079. // Get: Gets the specified table resource by table ID. This method does
  4080. // not return the data in the table, it only returns the table resource,
  4081. // which describes the structure of this table.
  4082. func (r *TablesService) Get(projectId string, datasetId string, tableId string) *TablesGetCall {
  4083. c := &TablesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4084. c.projectId = projectId
  4085. c.datasetId = datasetId
  4086. c.tableId = tableId
  4087. return c
  4088. }
  4089. // Fields allows partial responses to be retrieved. See
  4090. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4091. // for more information.
  4092. func (c *TablesGetCall) Fields(s ...googleapi.Field) *TablesGetCall {
  4093. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4094. return c
  4095. }
  4096. // IfNoneMatch sets the optional parameter which makes the operation
  4097. // fail if the object's ETag matches the given value. This is useful for
  4098. // getting updates only after the object has changed since the last
  4099. // request. Use googleapi.IsNotModified to check whether the response
  4100. // error from Do is the result of In-None-Match.
  4101. func (c *TablesGetCall) IfNoneMatch(entityTag string) *TablesGetCall {
  4102. c.ifNoneMatch_ = entityTag
  4103. return c
  4104. }
  4105. // Context sets the context to be used in this call's Do method. Any
  4106. // pending HTTP request will be aborted if the provided context is
  4107. // canceled.
  4108. func (c *TablesGetCall) Context(ctx context.Context) *TablesGetCall {
  4109. c.ctx_ = ctx
  4110. return c
  4111. }
  4112. func (c *TablesGetCall) doRequest(alt string) (*http.Response, error) {
  4113. var body io.Reader = nil
  4114. c.urlParams_.Set("alt", alt)
  4115. urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{projectId}/datasets/{datasetId}/tables/{tableId}")
  4116. urls += "?" + c.urlParams_.Encode()
  4117. req, _ := http.NewRequest("GET", urls, body)
  4118. googleapi.Expand(req.URL, map[string]string{
  4119. "projectId": c.projectId,
  4120. "datasetId": c.datasetId,
  4121. "tableId": c.tableId,
  4122. })
  4123. req.Header.Set("User-Agent", c.s.userAgent())
  4124. if c.ifNoneMatch_ != "" {
  4125. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  4126. }
  4127. if c.ctx_ != nil {
  4128. return ctxhttp.Do(c.ctx_, c.s.client, req)
  4129. }
  4130. return c.s.client.Do(req)
  4131. }
  4132. // Do executes the "bigquery.tables.get" call.
  4133. // Exactly one of *Table or error will be non-nil. Any non-2xx status
  4134. // code is an error. Response headers are in either
  4135. // *Table.ServerResponse.Header or (if a response was returned at all)
  4136. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  4137. // check whether the returned error was because http.StatusNotModified
  4138. // was returned.
  4139. func (c *TablesGetCall) Do(opts ...googleapi.CallOption) (*Table, error) {
  4140. gensupport.SetOptions(c.urlParams_, opts...)
  4141. res, err := c.doRequest("json")
  4142. if res != nil && res.StatusCode == http.StatusNotModified {
  4143. if res.Body != nil {
  4144. res.Body.Close()
  4145. }
  4146. return nil, &googleapi.Error{
  4147. Code: res.StatusCode,
  4148. Header: res.Header,
  4149. }
  4150. }
  4151. if err != nil {
  4152. return nil, err
  4153. }
  4154. defer googleapi.CloseBody(res)
  4155. if err := googleapi.CheckResponse(res); err != nil {
  4156. return nil, err
  4157. }
  4158. ret := &Table{
  4159. ServerResponse: googleapi.ServerResponse{
  4160. Header: res.Header,
  4161. HTTPStatusCode: res.StatusCode,
  4162. },
  4163. }
  4164. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  4165. return nil, err
  4166. }
  4167. return ret, nil
  4168. // {
  4169. // "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.",
  4170. // "httpMethod": "GET",
  4171. // "id": "bigquery.tables.get",
  4172. // "parameterOrder": [
  4173. // "projectId",
  4174. // "datasetId",
  4175. // "tableId"
  4176. // ],
  4177. // "parameters": {
  4178. // "datasetId": {
  4179. // "description": "Dataset ID of the requested table",
  4180. // "location": "path",
  4181. // "required": true,
  4182. // "type": "string"
  4183. // },
  4184. // "projectId": {
  4185. // "description": "Project ID of the requested table",
  4186. // "location": "path",
  4187. // "required": true,
  4188. // "type": "string"
  4189. // },
  4190. // "tableId": {
  4191. // "description": "Table ID of the requested table",
  4192. // "location": "path",
  4193. // "required": true,
  4194. // "type": "string"
  4195. // }
  4196. // },
  4197. // "path": "projects/{projectId}/datasets/{datasetId}/tables/{tableId}",
  4198. // "response": {
  4199. // "$ref": "Table"
  4200. // },
  4201. // "scopes": [
  4202. // "https://www.googleapis.com/auth/bigquery",
  4203. // "https://www.googleapis.com/auth/cloud-platform",
  4204. // "https://www.googleapis.com/auth/cloud-platform.read-only"
  4205. // ]
  4206. // }
  4207. }
  4208. // method id "bigquery.tables.insert":
  4209. type TablesInsertCall struct {
  4210. s *Service
  4211. projectId string
  4212. datasetId string
  4213. table *Table
  4214. urlParams_ gensupport.URLParams
  4215. ctx_ context.Context
  4216. }
  4217. // Insert: Creates a new, empty table in the dataset.
  4218. func (r *TablesService) Insert(projectId string, datasetId string, table *Table) *TablesInsertCall {
  4219. c := &TablesInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4220. c.projectId = projectId
  4221. c.datasetId = datasetId
  4222. c.table = table
  4223. return c
  4224. }
  4225. // Fields allows partial responses to be retrieved. See
  4226. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4227. // for more information.
  4228. func (c *TablesInsertCall) Fields(s ...googleapi.Field) *TablesInsertCall {
  4229. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4230. return c
  4231. }
  4232. // Context sets the context to be used in this call's Do method. Any
  4233. // pending HTTP request will be aborted if the provided context is
  4234. // canceled.
  4235. func (c *TablesInsertCall) Context(ctx context.Context) *TablesInsertCall {
  4236. c.ctx_ = ctx
  4237. return c
  4238. }
  4239. func (c *TablesInsertCall) doRequest(alt string) (*http.Response, error) {
  4240. var body io.Reader = nil
  4241. body, err := googleapi.WithoutDataWrapper.JSONReader(c.table)
  4242. if err != nil {
  4243. return nil, err
  4244. }
  4245. ctype := "application/json"
  4246. c.urlParams_.Set("alt", alt)
  4247. urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{projectId}/datasets/{datasetId}/tables")
  4248. urls += "?" + c.urlParams_.Encode()
  4249. req, _ := http.NewRequest("POST", urls, body)
  4250. googleapi.Expand(req.URL, map[string]string{
  4251. "projectId": c.projectId,
  4252. "datasetId": c.datasetId,
  4253. })
  4254. req.Header.Set("Content-Type", ctype)
  4255. req.Header.Set("User-Agent", c.s.userAgent())
  4256. if c.ctx_ != nil {
  4257. return ctxhttp.Do(c.ctx_, c.s.client, req)
  4258. }
  4259. return c.s.client.Do(req)
  4260. }
  4261. // Do executes the "bigquery.tables.insert" call.
  4262. // Exactly one of *Table or error will be non-nil. Any non-2xx status
  4263. // code is an error. Response headers are in either
  4264. // *Table.ServerResponse.Header or (if a response was returned at all)
  4265. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  4266. // check whether the returned error was because http.StatusNotModified
  4267. // was returned.
  4268. func (c *TablesInsertCall) Do(opts ...googleapi.CallOption) (*Table, error) {
  4269. gensupport.SetOptions(c.urlParams_, opts...)
  4270. res, err := c.doRequest("json")
  4271. if res != nil && res.StatusCode == http.StatusNotModified {
  4272. if res.Body != nil {
  4273. res.Body.Close()
  4274. }
  4275. return nil, &googleapi.Error{
  4276. Code: res.StatusCode,
  4277. Header: res.Header,
  4278. }
  4279. }
  4280. if err != nil {
  4281. return nil, err
  4282. }
  4283. defer googleapi.CloseBody(res)
  4284. if err := googleapi.CheckResponse(res); err != nil {
  4285. return nil, err
  4286. }
  4287. ret := &Table{
  4288. ServerResponse: googleapi.ServerResponse{
  4289. Header: res.Header,
  4290. HTTPStatusCode: res.StatusCode,
  4291. },
  4292. }
  4293. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  4294. return nil, err
  4295. }
  4296. return ret, nil
  4297. // {
  4298. // "description": "Creates a new, empty table in the dataset.",
  4299. // "httpMethod": "POST",
  4300. // "id": "bigquery.tables.insert",
  4301. // "parameterOrder": [
  4302. // "projectId",
  4303. // "datasetId"
  4304. // ],
  4305. // "parameters": {
  4306. // "datasetId": {
  4307. // "description": "Dataset ID of the new table",
  4308. // "location": "path",
  4309. // "required": true,
  4310. // "type": "string"
  4311. // },
  4312. // "projectId": {
  4313. // "description": "Project ID of the new table",
  4314. // "location": "path",
  4315. // "required": true,
  4316. // "type": "string"
  4317. // }
  4318. // },
  4319. // "path": "projects/{projectId}/datasets/{datasetId}/tables",
  4320. // "request": {
  4321. // "$ref": "Table"
  4322. // },
  4323. // "response": {
  4324. // "$ref": "Table"
  4325. // },
  4326. // "scopes": [
  4327. // "https://www.googleapis.com/auth/bigquery",
  4328. // "https://www.googleapis.com/auth/cloud-platform"
  4329. // ]
  4330. // }
  4331. }
  4332. // method id "bigquery.tables.list":
  4333. type TablesListCall struct {
  4334. s *Service
  4335. projectId string
  4336. datasetId string
  4337. urlParams_ gensupport.URLParams
  4338. ifNoneMatch_ string
  4339. ctx_ context.Context
  4340. }
  4341. // List: Lists all tables in the specified dataset. Requires the READER
  4342. // dataset role.
  4343. func (r *TablesService) List(projectId string, datasetId string) *TablesListCall {
  4344. c := &TablesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4345. c.projectId = projectId
  4346. c.datasetId = datasetId
  4347. return c
  4348. }
  4349. // MaxResults sets the optional parameter "maxResults": Maximum number
  4350. // of results to return
  4351. func (c *TablesListCall) MaxResults(maxResults int64) *TablesListCall {
  4352. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  4353. return c
  4354. }
  4355. // PageToken sets the optional parameter "pageToken": Page token,
  4356. // returned by a previous call, to request the next page of results
  4357. func (c *TablesListCall) PageToken(pageToken string) *TablesListCall {
  4358. c.urlParams_.Set("pageToken", pageToken)
  4359. return c
  4360. }
  4361. // Fields allows partial responses to be retrieved. See
  4362. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4363. // for more information.
  4364. func (c *TablesListCall) Fields(s ...googleapi.Field) *TablesListCall {
  4365. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4366. return c
  4367. }
  4368. // IfNoneMatch sets the optional parameter which makes the operation
  4369. // fail if the object's ETag matches the given value. This is useful for
  4370. // getting updates only after the object has changed since the last
  4371. // request. Use googleapi.IsNotModified to check whether the response
  4372. // error from Do is the result of In-None-Match.
  4373. func (c *TablesListCall) IfNoneMatch(entityTag string) *TablesListCall {
  4374. c.ifNoneMatch_ = entityTag
  4375. return c
  4376. }
  4377. // Context sets the context to be used in this call's Do method. Any
  4378. // pending HTTP request will be aborted if the provided context is
  4379. // canceled.
  4380. func (c *TablesListCall) Context(ctx context.Context) *TablesListCall {
  4381. c.ctx_ = ctx
  4382. return c
  4383. }
  4384. func (c *TablesListCall) doRequest(alt string) (*http.Response, error) {
  4385. var body io.Reader = nil
  4386. c.urlParams_.Set("alt", alt)
  4387. urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{projectId}/datasets/{datasetId}/tables")
  4388. urls += "?" + c.urlParams_.Encode()
  4389. req, _ := http.NewRequest("GET", urls, body)
  4390. googleapi.Expand(req.URL, map[string]string{
  4391. "projectId": c.projectId,
  4392. "datasetId": c.datasetId,
  4393. })
  4394. req.Header.Set("User-Agent", c.s.userAgent())
  4395. if c.ifNoneMatch_ != "" {
  4396. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  4397. }
  4398. if c.ctx_ != nil {
  4399. return ctxhttp.Do(c.ctx_, c.s.client, req)
  4400. }
  4401. return c.s.client.Do(req)
  4402. }
  4403. // Do executes the "bigquery.tables.list" call.
  4404. // Exactly one of *TableList or error will be non-nil. Any non-2xx
  4405. // status code is an error. Response headers are in either
  4406. // *TableList.ServerResponse.Header or (if a response was returned at
  4407. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  4408. // to check whether the returned error was because
  4409. // http.StatusNotModified was returned.
  4410. func (c *TablesListCall) Do(opts ...googleapi.CallOption) (*TableList, error) {
  4411. gensupport.SetOptions(c.urlParams_, opts...)
  4412. res, err := c.doRequest("json")
  4413. if res != nil && res.StatusCode == http.StatusNotModified {
  4414. if res.Body != nil {
  4415. res.Body.Close()
  4416. }
  4417. return nil, &googleapi.Error{
  4418. Code: res.StatusCode,
  4419. Header: res.Header,
  4420. }
  4421. }
  4422. if err != nil {
  4423. return nil, err
  4424. }
  4425. defer googleapi.CloseBody(res)
  4426. if err := googleapi.CheckResponse(res); err != nil {
  4427. return nil, err
  4428. }
  4429. ret := &TableList{
  4430. ServerResponse: googleapi.ServerResponse{
  4431. Header: res.Header,
  4432. HTTPStatusCode: res.StatusCode,
  4433. },
  4434. }
  4435. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  4436. return nil, err
  4437. }
  4438. return ret, nil
  4439. // {
  4440. // "description": "Lists all tables in the specified dataset. Requires the READER dataset role.",
  4441. // "httpMethod": "GET",
  4442. // "id": "bigquery.tables.list",
  4443. // "parameterOrder": [
  4444. // "projectId",
  4445. // "datasetId"
  4446. // ],
  4447. // "parameters": {
  4448. // "datasetId": {
  4449. // "description": "Dataset ID of the tables to list",
  4450. // "location": "path",
  4451. // "required": true,
  4452. // "type": "string"
  4453. // },
  4454. // "maxResults": {
  4455. // "description": "Maximum number of results to return",
  4456. // "format": "uint32",
  4457. // "location": "query",
  4458. // "type": "integer"
  4459. // },
  4460. // "pageToken": {
  4461. // "description": "Page token, returned by a previous call, to request the next page of results",
  4462. // "location": "query",
  4463. // "type": "string"
  4464. // },
  4465. // "projectId": {
  4466. // "description": "Project ID of the tables to list",
  4467. // "location": "path",
  4468. // "required": true,
  4469. // "type": "string"
  4470. // }
  4471. // },
  4472. // "path": "projects/{projectId}/datasets/{datasetId}/tables",
  4473. // "response": {
  4474. // "$ref": "TableList"
  4475. // },
  4476. // "scopes": [
  4477. // "https://www.googleapis.com/auth/bigquery",
  4478. // "https://www.googleapis.com/auth/cloud-platform",
  4479. // "https://www.googleapis.com/auth/cloud-platform.read-only"
  4480. // ]
  4481. // }
  4482. }
  4483. // Pages invokes f for each page of results.
  4484. // A non-nil error returned from f will halt the iteration.
  4485. // The provided context supersedes any context provided to the Context method.
  4486. func (c *TablesListCall) Pages(ctx context.Context, f func(*TableList) error) error {
  4487. c.ctx_ = ctx
  4488. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  4489. for {
  4490. x, err := c.Do()
  4491. if err != nil {
  4492. return err
  4493. }
  4494. if err := f(x); err != nil {
  4495. return err
  4496. }
  4497. if x.NextPageToken == "" {
  4498. return nil
  4499. }
  4500. c.PageToken(x.NextPageToken)
  4501. }
  4502. }
  4503. // method id "bigquery.tables.patch":
  4504. type TablesPatchCall struct {
  4505. s *Service
  4506. projectId string
  4507. datasetId string
  4508. tableId string
  4509. table *Table
  4510. urlParams_ gensupport.URLParams
  4511. ctx_ context.Context
  4512. }
  4513. // Patch: Updates information in an existing table. The update method
  4514. // replaces the entire table resource, whereas the patch method only
  4515. // replaces fields that are provided in the submitted table resource.
  4516. // This method supports patch semantics.
  4517. func (r *TablesService) Patch(projectId string, datasetId string, tableId string, table *Table) *TablesPatchCall {
  4518. c := &TablesPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4519. c.projectId = projectId
  4520. c.datasetId = datasetId
  4521. c.tableId = tableId
  4522. c.table = table
  4523. return c
  4524. }
  4525. // Fields allows partial responses to be retrieved. See
  4526. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4527. // for more information.
  4528. func (c *TablesPatchCall) Fields(s ...googleapi.Field) *TablesPatchCall {
  4529. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4530. return c
  4531. }
  4532. // Context sets the context to be used in this call's Do method. Any
  4533. // pending HTTP request will be aborted if the provided context is
  4534. // canceled.
  4535. func (c *TablesPatchCall) Context(ctx context.Context) *TablesPatchCall {
  4536. c.ctx_ = ctx
  4537. return c
  4538. }
  4539. func (c *TablesPatchCall) doRequest(alt string) (*http.Response, error) {
  4540. var body io.Reader = nil
  4541. body, err := googleapi.WithoutDataWrapper.JSONReader(c.table)
  4542. if err != nil {
  4543. return nil, err
  4544. }
  4545. ctype := "application/json"
  4546. c.urlParams_.Set("alt", alt)
  4547. urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{projectId}/datasets/{datasetId}/tables/{tableId}")
  4548. urls += "?" + c.urlParams_.Encode()
  4549. req, _ := http.NewRequest("PATCH", urls, body)
  4550. googleapi.Expand(req.URL, map[string]string{
  4551. "projectId": c.projectId,
  4552. "datasetId": c.datasetId,
  4553. "tableId": c.tableId,
  4554. })
  4555. req.Header.Set("Content-Type", ctype)
  4556. req.Header.Set("User-Agent", c.s.userAgent())
  4557. if c.ctx_ != nil {
  4558. return ctxhttp.Do(c.ctx_, c.s.client, req)
  4559. }
  4560. return c.s.client.Do(req)
  4561. }
  4562. // Do executes the "bigquery.tables.patch" call.
  4563. // Exactly one of *Table or error will be non-nil. Any non-2xx status
  4564. // code is an error. Response headers are in either
  4565. // *Table.ServerResponse.Header or (if a response was returned at all)
  4566. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  4567. // check whether the returned error was because http.StatusNotModified
  4568. // was returned.
  4569. func (c *TablesPatchCall) Do(opts ...googleapi.CallOption) (*Table, error) {
  4570. gensupport.SetOptions(c.urlParams_, opts...)
  4571. res, err := c.doRequest("json")
  4572. if res != nil && res.StatusCode == http.StatusNotModified {
  4573. if res.Body != nil {
  4574. res.Body.Close()
  4575. }
  4576. return nil, &googleapi.Error{
  4577. Code: res.StatusCode,
  4578. Header: res.Header,
  4579. }
  4580. }
  4581. if err != nil {
  4582. return nil, err
  4583. }
  4584. defer googleapi.CloseBody(res)
  4585. if err := googleapi.CheckResponse(res); err != nil {
  4586. return nil, err
  4587. }
  4588. ret := &Table{
  4589. ServerResponse: googleapi.ServerResponse{
  4590. Header: res.Header,
  4591. HTTPStatusCode: res.StatusCode,
  4592. },
  4593. }
  4594. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  4595. return nil, err
  4596. }
  4597. return ret, nil
  4598. // {
  4599. // "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.",
  4600. // "httpMethod": "PATCH",
  4601. // "id": "bigquery.tables.patch",
  4602. // "parameterOrder": [
  4603. // "projectId",
  4604. // "datasetId",
  4605. // "tableId"
  4606. // ],
  4607. // "parameters": {
  4608. // "datasetId": {
  4609. // "description": "Dataset ID of the table to update",
  4610. // "location": "path",
  4611. // "required": true,
  4612. // "type": "string"
  4613. // },
  4614. // "projectId": {
  4615. // "description": "Project ID of the table to update",
  4616. // "location": "path",
  4617. // "required": true,
  4618. // "type": "string"
  4619. // },
  4620. // "tableId": {
  4621. // "description": "Table ID of the table to update",
  4622. // "location": "path",
  4623. // "required": true,
  4624. // "type": "string"
  4625. // }
  4626. // },
  4627. // "path": "projects/{projectId}/datasets/{datasetId}/tables/{tableId}",
  4628. // "request": {
  4629. // "$ref": "Table"
  4630. // },
  4631. // "response": {
  4632. // "$ref": "Table"
  4633. // },
  4634. // "scopes": [
  4635. // "https://www.googleapis.com/auth/bigquery",
  4636. // "https://www.googleapis.com/auth/cloud-platform"
  4637. // ]
  4638. // }
  4639. }
  4640. // method id "bigquery.tables.update":
  4641. type TablesUpdateCall struct {
  4642. s *Service
  4643. projectId string
  4644. datasetId string
  4645. tableId string
  4646. table *Table
  4647. urlParams_ gensupport.URLParams
  4648. ctx_ context.Context
  4649. }
  4650. // Update: Updates information in an existing table. The update method
  4651. // replaces the entire table resource, whereas the patch method only
  4652. // replaces fields that are provided in the submitted table resource.
  4653. func (r *TablesService) Update(projectId string, datasetId string, tableId string, table *Table) *TablesUpdateCall {
  4654. c := &TablesUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4655. c.projectId = projectId
  4656. c.datasetId = datasetId
  4657. c.tableId = tableId
  4658. c.table = table
  4659. return c
  4660. }
  4661. // Fields allows partial responses to be retrieved. See
  4662. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4663. // for more information.
  4664. func (c *TablesUpdateCall) Fields(s ...googleapi.Field) *TablesUpdateCall {
  4665. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4666. return c
  4667. }
  4668. // Context sets the context to be used in this call's Do method. Any
  4669. // pending HTTP request will be aborted if the provided context is
  4670. // canceled.
  4671. func (c *TablesUpdateCall) Context(ctx context.Context) *TablesUpdateCall {
  4672. c.ctx_ = ctx
  4673. return c
  4674. }
  4675. func (c *TablesUpdateCall) doRequest(alt string) (*http.Response, error) {
  4676. var body io.Reader = nil
  4677. body, err := googleapi.WithoutDataWrapper.JSONReader(c.table)
  4678. if err != nil {
  4679. return nil, err
  4680. }
  4681. ctype := "application/json"
  4682. c.urlParams_.Set("alt", alt)
  4683. urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{projectId}/datasets/{datasetId}/tables/{tableId}")
  4684. urls += "?" + c.urlParams_.Encode()
  4685. req, _ := http.NewRequest("PUT", urls, body)
  4686. googleapi.Expand(req.URL, map[string]string{
  4687. "projectId": c.projectId,
  4688. "datasetId": c.datasetId,
  4689. "tableId": c.tableId,
  4690. })
  4691. req.Header.Set("Content-Type", ctype)
  4692. req.Header.Set("User-Agent", c.s.userAgent())
  4693. if c.ctx_ != nil {
  4694. return ctxhttp.Do(c.ctx_, c.s.client, req)
  4695. }
  4696. return c.s.client.Do(req)
  4697. }
  4698. // Do executes the "bigquery.tables.update" call.
  4699. // Exactly one of *Table or error will be non-nil. Any non-2xx status
  4700. // code is an error. Response headers are in either
  4701. // *Table.ServerResponse.Header or (if a response was returned at all)
  4702. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  4703. // check whether the returned error was because http.StatusNotModified
  4704. // was returned.
  4705. func (c *TablesUpdateCall) Do(opts ...googleapi.CallOption) (*Table, error) {
  4706. gensupport.SetOptions(c.urlParams_, opts...)
  4707. res, err := c.doRequest("json")
  4708. if res != nil && res.StatusCode == http.StatusNotModified {
  4709. if res.Body != nil {
  4710. res.Body.Close()
  4711. }
  4712. return nil, &googleapi.Error{
  4713. Code: res.StatusCode,
  4714. Header: res.Header,
  4715. }
  4716. }
  4717. if err != nil {
  4718. return nil, err
  4719. }
  4720. defer googleapi.CloseBody(res)
  4721. if err := googleapi.CheckResponse(res); err != nil {
  4722. return nil, err
  4723. }
  4724. ret := &Table{
  4725. ServerResponse: googleapi.ServerResponse{
  4726. Header: res.Header,
  4727. HTTPStatusCode: res.StatusCode,
  4728. },
  4729. }
  4730. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  4731. return nil, err
  4732. }
  4733. return ret, nil
  4734. // {
  4735. // "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.",
  4736. // "httpMethod": "PUT",
  4737. // "id": "bigquery.tables.update",
  4738. // "parameterOrder": [
  4739. // "projectId",
  4740. // "datasetId",
  4741. // "tableId"
  4742. // ],
  4743. // "parameters": {
  4744. // "datasetId": {
  4745. // "description": "Dataset ID of the table to update",
  4746. // "location": "path",
  4747. // "required": true,
  4748. // "type": "string"
  4749. // },
  4750. // "projectId": {
  4751. // "description": "Project ID of the table to update",
  4752. // "location": "path",
  4753. // "required": true,
  4754. // "type": "string"
  4755. // },
  4756. // "tableId": {
  4757. // "description": "Table ID of the table to update",
  4758. // "location": "path",
  4759. // "required": true,
  4760. // "type": "string"
  4761. // }
  4762. // },
  4763. // "path": "projects/{projectId}/datasets/{datasetId}/tables/{tableId}",
  4764. // "request": {
  4765. // "$ref": "Table"
  4766. // },
  4767. // "response": {
  4768. // "$ref": "Table"
  4769. // },
  4770. // "scopes": [
  4771. // "https://www.googleapis.com/auth/bigquery",
  4772. // "https://www.googleapis.com/auth/cloud-platform"
  4773. // ]
  4774. // }
  4775. }