tpu-gen.go 122 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700
  1. // Copyright 2018 Google Inc. All rights reserved.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. // Code generated file. DO NOT EDIT.
  5. // Package tpu provides access to the Cloud TPU API.
  6. //
  7. // See https://cloud.google.com/tpu/
  8. //
  9. // Usage example:
  10. //
  11. // import "google.golang.org/api/tpu/v1"
  12. // ...
  13. // tpuService, err := tpu.New(oauthHttpClient)
  14. package tpu // import "google.golang.org/api/tpu/v1"
  15. import (
  16. "bytes"
  17. "context"
  18. "encoding/json"
  19. "errors"
  20. "fmt"
  21. "io"
  22. "net/http"
  23. "net/url"
  24. "strconv"
  25. "strings"
  26. gensupport "google.golang.org/api/gensupport"
  27. googleapi "google.golang.org/api/googleapi"
  28. )
  29. // Always reference these packages, just in case the auto-generated code
  30. // below doesn't.
  31. var _ = bytes.NewBuffer
  32. var _ = strconv.Itoa
  33. var _ = fmt.Sprintf
  34. var _ = json.NewDecoder
  35. var _ = io.Copy
  36. var _ = url.Parse
  37. var _ = gensupport.MarshalJSON
  38. var _ = googleapi.Version
  39. var _ = errors.New
  40. var _ = strings.Replace
  41. var _ = context.Canceled
  42. const apiId = "tpu:v1"
  43. const apiName = "tpu"
  44. const apiVersion = "v1"
  45. const basePath = "https://tpu.googleapis.com/"
  46. // OAuth2 scopes used by this API.
  47. const (
  48. // View and manage your data across Google Cloud Platform services
  49. CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platform"
  50. )
  51. func New(client *http.Client) (*Service, error) {
  52. if client == nil {
  53. return nil, errors.New("client is nil")
  54. }
  55. s := &Service{client: client, BasePath: basePath}
  56. s.Projects = NewProjectsService(s)
  57. return s, nil
  58. }
  59. type Service struct {
  60. client *http.Client
  61. BasePath string // API endpoint base URL
  62. UserAgent string // optional additional User-Agent fragment
  63. Projects *ProjectsService
  64. }
  65. func (s *Service) userAgent() string {
  66. if s.UserAgent == "" {
  67. return googleapi.UserAgent
  68. }
  69. return googleapi.UserAgent + " " + s.UserAgent
  70. }
  71. func NewProjectsService(s *Service) *ProjectsService {
  72. rs := &ProjectsService{s: s}
  73. rs.Locations = NewProjectsLocationsService(s)
  74. return rs
  75. }
  76. type ProjectsService struct {
  77. s *Service
  78. Locations *ProjectsLocationsService
  79. }
  80. func NewProjectsLocationsService(s *Service) *ProjectsLocationsService {
  81. rs := &ProjectsLocationsService{s: s}
  82. rs.AcceleratorTypes = NewProjectsLocationsAcceleratorTypesService(s)
  83. rs.Nodes = NewProjectsLocationsNodesService(s)
  84. rs.Operations = NewProjectsLocationsOperationsService(s)
  85. rs.TensorflowVersions = NewProjectsLocationsTensorflowVersionsService(s)
  86. return rs
  87. }
  88. type ProjectsLocationsService struct {
  89. s *Service
  90. AcceleratorTypes *ProjectsLocationsAcceleratorTypesService
  91. Nodes *ProjectsLocationsNodesService
  92. Operations *ProjectsLocationsOperationsService
  93. TensorflowVersions *ProjectsLocationsTensorflowVersionsService
  94. }
  95. func NewProjectsLocationsAcceleratorTypesService(s *Service) *ProjectsLocationsAcceleratorTypesService {
  96. rs := &ProjectsLocationsAcceleratorTypesService{s: s}
  97. return rs
  98. }
  99. type ProjectsLocationsAcceleratorTypesService struct {
  100. s *Service
  101. }
  102. func NewProjectsLocationsNodesService(s *Service) *ProjectsLocationsNodesService {
  103. rs := &ProjectsLocationsNodesService{s: s}
  104. return rs
  105. }
  106. type ProjectsLocationsNodesService struct {
  107. s *Service
  108. }
  109. func NewProjectsLocationsOperationsService(s *Service) *ProjectsLocationsOperationsService {
  110. rs := &ProjectsLocationsOperationsService{s: s}
  111. return rs
  112. }
  113. type ProjectsLocationsOperationsService struct {
  114. s *Service
  115. }
  116. func NewProjectsLocationsTensorflowVersionsService(s *Service) *ProjectsLocationsTensorflowVersionsService {
  117. rs := &ProjectsLocationsTensorflowVersionsService{s: s}
  118. return rs
  119. }
  120. type ProjectsLocationsTensorflowVersionsService struct {
  121. s *Service
  122. }
  123. // AcceleratorType: A accelerator type that a Node can be configured
  124. // with.
  125. type AcceleratorType struct {
  126. // Name: The resource name.
  127. Name string `json:"name,omitempty"`
  128. // Type: the accelerator type.
  129. Type string `json:"type,omitempty"`
  130. // ServerResponse contains the HTTP response code and headers from the
  131. // server.
  132. googleapi.ServerResponse `json:"-"`
  133. // ForceSendFields is a list of field names (e.g. "Name") to
  134. // unconditionally include in API requests. By default, fields with
  135. // empty values are omitted from API requests. However, any non-pointer,
  136. // non-interface field appearing in ForceSendFields will be sent to the
  137. // server regardless of whether the field is empty or not. This may be
  138. // used to include empty fields in Patch requests.
  139. ForceSendFields []string `json:"-"`
  140. // NullFields is a list of field names (e.g. "Name") to include in API
  141. // requests with the JSON null value. By default, fields with empty
  142. // values are omitted from API requests. However, any field with an
  143. // empty value appearing in NullFields will be sent to the server as
  144. // null. It is an error if a field in this list has a non-empty value.
  145. // This may be used to include null fields in Patch requests.
  146. NullFields []string `json:"-"`
  147. }
  148. func (s *AcceleratorType) MarshalJSON() ([]byte, error) {
  149. type NoMethod AcceleratorType
  150. raw := NoMethod(*s)
  151. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  152. }
  153. // Empty: A generic empty message that you can re-use to avoid defining
  154. // duplicated
  155. // empty messages in your APIs. A typical example is to use it as the
  156. // request
  157. // or the response type of an API method. For instance:
  158. //
  159. // service Foo {
  160. // rpc Bar(google.protobuf.Empty) returns
  161. // (google.protobuf.Empty);
  162. // }
  163. //
  164. // The JSON representation for `Empty` is empty JSON object `{}`.
  165. type Empty struct {
  166. // ServerResponse contains the HTTP response code and headers from the
  167. // server.
  168. googleapi.ServerResponse `json:"-"`
  169. }
  170. // ListAcceleratorTypesResponse: Response for ListAcceleratorTypes.
  171. type ListAcceleratorTypesResponse struct {
  172. // AcceleratorTypes: The listed nodes.
  173. AcceleratorTypes []*AcceleratorType `json:"acceleratorTypes,omitempty"`
  174. // NextPageToken: The next page token or empty if none.
  175. NextPageToken string `json:"nextPageToken,omitempty"`
  176. // ServerResponse contains the HTTP response code and headers from the
  177. // server.
  178. googleapi.ServerResponse `json:"-"`
  179. // ForceSendFields is a list of field names (e.g. "AcceleratorTypes") to
  180. // unconditionally include in API requests. By default, fields with
  181. // empty values are omitted from API requests. However, any non-pointer,
  182. // non-interface field appearing in ForceSendFields will be sent to the
  183. // server regardless of whether the field is empty or not. This may be
  184. // used to include empty fields in Patch requests.
  185. ForceSendFields []string `json:"-"`
  186. // NullFields is a list of field names (e.g. "AcceleratorTypes") to
  187. // include in API requests with the JSON null value. By default, fields
  188. // with empty values are omitted from API requests. However, any field
  189. // with an empty value appearing in NullFields will be sent to the
  190. // server as null. It is an error if a field in this list has a
  191. // non-empty value. This may be used to include null fields in Patch
  192. // requests.
  193. NullFields []string `json:"-"`
  194. }
  195. func (s *ListAcceleratorTypesResponse) MarshalJSON() ([]byte, error) {
  196. type NoMethod ListAcceleratorTypesResponse
  197. raw := NoMethod(*s)
  198. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  199. }
  200. // ListLocationsResponse: The response message for
  201. // Locations.ListLocations.
  202. type ListLocationsResponse struct {
  203. // Locations: A list of locations that matches the specified filter in
  204. // the request.
  205. Locations []*Location `json:"locations,omitempty"`
  206. // NextPageToken: The standard List next-page token.
  207. NextPageToken string `json:"nextPageToken,omitempty"`
  208. // ServerResponse contains the HTTP response code and headers from the
  209. // server.
  210. googleapi.ServerResponse `json:"-"`
  211. // ForceSendFields is a list of field names (e.g. "Locations") to
  212. // unconditionally include in API requests. By default, fields with
  213. // empty values are omitted from API requests. However, any non-pointer,
  214. // non-interface field appearing in ForceSendFields will be sent to the
  215. // server regardless of whether the field is empty or not. This may be
  216. // used to include empty fields in Patch requests.
  217. ForceSendFields []string `json:"-"`
  218. // NullFields is a list of field names (e.g. "Locations") to include in
  219. // API requests with the JSON null value. By default, fields with empty
  220. // values are omitted from API requests. However, any field with an
  221. // empty value appearing in NullFields will be sent to the server as
  222. // null. It is an error if a field in this list has a non-empty value.
  223. // This may be used to include null fields in Patch requests.
  224. NullFields []string `json:"-"`
  225. }
  226. func (s *ListLocationsResponse) MarshalJSON() ([]byte, error) {
  227. type NoMethod ListLocationsResponse
  228. raw := NoMethod(*s)
  229. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  230. }
  231. // ListNodesResponse: Response for ListNodes.
  232. type ListNodesResponse struct {
  233. // NextPageToken: The next page token or empty if none.
  234. NextPageToken string `json:"nextPageToken,omitempty"`
  235. // Nodes: The listed nodes.
  236. Nodes []*Node `json:"nodes,omitempty"`
  237. // Unreachable: Locations that could not be reached.
  238. Unreachable []string `json:"unreachable,omitempty"`
  239. // ServerResponse contains the HTTP response code and headers from the
  240. // server.
  241. googleapi.ServerResponse `json:"-"`
  242. // ForceSendFields is a list of field names (e.g. "NextPageToken") to
  243. // unconditionally include in API requests. By default, fields with
  244. // empty values are omitted from API requests. However, any non-pointer,
  245. // non-interface field appearing in ForceSendFields will be sent to the
  246. // server regardless of whether the field is empty or not. This may be
  247. // used to include empty fields in Patch requests.
  248. ForceSendFields []string `json:"-"`
  249. // NullFields is a list of field names (e.g. "NextPageToken") to include
  250. // in API requests with the JSON null value. By default, fields with
  251. // empty values are omitted from API requests. However, any field with
  252. // an empty value appearing in NullFields will be sent to the server as
  253. // null. It is an error if a field in this list has a non-empty value.
  254. // This may be used to include null fields in Patch requests.
  255. NullFields []string `json:"-"`
  256. }
  257. func (s *ListNodesResponse) MarshalJSON() ([]byte, error) {
  258. type NoMethod ListNodesResponse
  259. raw := NoMethod(*s)
  260. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  261. }
  262. // ListOperationsResponse: The response message for
  263. // Operations.ListOperations.
  264. type ListOperationsResponse struct {
  265. // NextPageToken: The standard List next-page token.
  266. NextPageToken string `json:"nextPageToken,omitempty"`
  267. // Operations: A list of operations that matches the specified filter in
  268. // the request.
  269. Operations []*Operation `json:"operations,omitempty"`
  270. // ServerResponse contains the HTTP response code and headers from the
  271. // server.
  272. googleapi.ServerResponse `json:"-"`
  273. // ForceSendFields is a list of field names (e.g. "NextPageToken") to
  274. // unconditionally include in API requests. By default, fields with
  275. // empty values are omitted from API requests. However, any non-pointer,
  276. // non-interface field appearing in ForceSendFields will be sent to the
  277. // server regardless of whether the field is empty or not. This may be
  278. // used to include empty fields in Patch requests.
  279. ForceSendFields []string `json:"-"`
  280. // NullFields is a list of field names (e.g. "NextPageToken") to include
  281. // in API requests with the JSON null value. By default, fields with
  282. // empty values are omitted from API requests. However, any field with
  283. // an empty value appearing in NullFields will be sent to the server as
  284. // null. It is an error if a field in this list has a non-empty value.
  285. // This may be used to include null fields in Patch requests.
  286. NullFields []string `json:"-"`
  287. }
  288. func (s *ListOperationsResponse) MarshalJSON() ([]byte, error) {
  289. type NoMethod ListOperationsResponse
  290. raw := NoMethod(*s)
  291. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  292. }
  293. // ListTensorFlowVersionsResponse: Response for ListTensorFlowVersions.
  294. type ListTensorFlowVersionsResponse struct {
  295. // NextPageToken: The next page token or empty if none.
  296. NextPageToken string `json:"nextPageToken,omitempty"`
  297. // TensorflowVersions: The listed nodes.
  298. TensorflowVersions []*TensorFlowVersion `json:"tensorflowVersions,omitempty"`
  299. // ServerResponse contains the HTTP response code and headers from the
  300. // server.
  301. googleapi.ServerResponse `json:"-"`
  302. // ForceSendFields is a list of field names (e.g. "NextPageToken") to
  303. // unconditionally include in API requests. By default, fields with
  304. // empty values are omitted from API requests. However, any non-pointer,
  305. // non-interface field appearing in ForceSendFields will be sent to the
  306. // server regardless of whether the field is empty or not. This may be
  307. // used to include empty fields in Patch requests.
  308. ForceSendFields []string `json:"-"`
  309. // NullFields is a list of field names (e.g. "NextPageToken") to include
  310. // in API requests with the JSON null value. By default, fields with
  311. // empty values are omitted from API requests. However, any field with
  312. // an empty value appearing in NullFields will be sent to the server as
  313. // null. It is an error if a field in this list has a non-empty value.
  314. // This may be used to include null fields in Patch requests.
  315. NullFields []string `json:"-"`
  316. }
  317. func (s *ListTensorFlowVersionsResponse) MarshalJSON() ([]byte, error) {
  318. type NoMethod ListTensorFlowVersionsResponse
  319. raw := NoMethod(*s)
  320. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  321. }
  322. // Location: A resource that represents Google Cloud Platform location.
  323. type Location struct {
  324. // DisplayName: The friendly name for this location, typically a nearby
  325. // city name.
  326. // For example, "Tokyo".
  327. DisplayName string `json:"displayName,omitempty"`
  328. // Labels: Cross-service attributes for the location. For example
  329. //
  330. // {"cloud.googleapis.com/region": "us-east1"}
  331. Labels map[string]string `json:"labels,omitempty"`
  332. // LocationId: The canonical id for this location. For example:
  333. // "us-east1".
  334. LocationId string `json:"locationId,omitempty"`
  335. // Metadata: Service-specific metadata. For example the available
  336. // capacity at the given
  337. // location.
  338. Metadata googleapi.RawMessage `json:"metadata,omitempty"`
  339. // Name: Resource name for the location, which may vary between
  340. // implementations.
  341. // For example: "projects/example-project/locations/us-east1"
  342. Name string `json:"name,omitempty"`
  343. // ServerResponse contains the HTTP response code and headers from the
  344. // server.
  345. googleapi.ServerResponse `json:"-"`
  346. // ForceSendFields is a list of field names (e.g. "DisplayName") to
  347. // unconditionally include in API requests. By default, fields with
  348. // empty values are omitted from API requests. However, any non-pointer,
  349. // non-interface field appearing in ForceSendFields will be sent to the
  350. // server regardless of whether the field is empty or not. This may be
  351. // used to include empty fields in Patch requests.
  352. ForceSendFields []string `json:"-"`
  353. // NullFields is a list of field names (e.g. "DisplayName") to include
  354. // in API requests with the JSON null value. By default, fields with
  355. // empty values are omitted from API requests. However, any field with
  356. // an empty value appearing in NullFields will be sent to the server as
  357. // null. It is an error if a field in this list has a non-empty value.
  358. // This may be used to include null fields in Patch requests.
  359. NullFields []string `json:"-"`
  360. }
  361. func (s *Location) MarshalJSON() ([]byte, error) {
  362. type NoMethod Location
  363. raw := NoMethod(*s)
  364. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  365. }
  366. // NetworkEndpoint: A network endpoint over which a TPU worker can be
  367. // reached.
  368. type NetworkEndpoint struct {
  369. // IpAddress: The IP address of this network endpoint.
  370. IpAddress string `json:"ipAddress,omitempty"`
  371. // Port: The port of this network endpoint.
  372. Port int64 `json:"port,omitempty"`
  373. // ForceSendFields is a list of field names (e.g. "IpAddress") to
  374. // unconditionally include in API requests. By default, fields with
  375. // empty values are omitted from API requests. However, any non-pointer,
  376. // non-interface field appearing in ForceSendFields will be sent to the
  377. // server regardless of whether the field is empty or not. This may be
  378. // used to include empty fields in Patch requests.
  379. ForceSendFields []string `json:"-"`
  380. // NullFields is a list of field names (e.g. "IpAddress") to include in
  381. // API requests with the JSON null value. By default, fields with empty
  382. // values are omitted from API requests. However, any field with an
  383. // empty value appearing in NullFields will be sent to the server as
  384. // null. It is an error if a field in this list has a non-empty value.
  385. // This may be used to include null fields in Patch requests.
  386. NullFields []string `json:"-"`
  387. }
  388. func (s *NetworkEndpoint) MarshalJSON() ([]byte, error) {
  389. type NoMethod NetworkEndpoint
  390. raw := NoMethod(*s)
  391. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  392. }
  393. // Node: A TPU instance.
  394. type Node struct {
  395. // AcceleratorType: The type of hardware accelerators associated with
  396. // this node.
  397. // Required.
  398. AcceleratorType string `json:"acceleratorType,omitempty"`
  399. // CidrBlock: The CIDR block that the TPU node will use when selecting
  400. // an IP address.
  401. // This CIDR block must be a /29 block; the Compute Engine networks
  402. // API
  403. // forbids a smaller block, and using a larger block would be wasteful
  404. // (a
  405. // node can only consume one IP address). Errors will occur if the CIDR
  406. // block
  407. // has already been used for a currently existing TPU node, the CIDR
  408. // block
  409. // conflicts with any subnetworks in the user's provided network, or
  410. // the
  411. // provided network is peered with another network that is using that
  412. // CIDR
  413. // block.
  414. // Required.
  415. CidrBlock string `json:"cidrBlock,omitempty"`
  416. // CreateTime: Output only.
  417. // The time when the node was created.
  418. CreateTime string `json:"createTime,omitempty"`
  419. // Description: The user-supplied description of the TPU. Maximum of 512
  420. // characters.
  421. Description string `json:"description,omitempty"`
  422. // Health: The health status of the TPU node.
  423. //
  424. // Possible values:
  425. // "HEALTH_UNSPECIFIED" - Health status is unknown: not initialized or
  426. // failed to retrieve.
  427. // "HEALTHY" - The resource is healthy.
  428. // "UNHEALTHY" - The resource is unhealthy.
  429. // "TIMEOUT" - The resource is unresponsive.
  430. Health string `json:"health,omitempty"`
  431. // HealthDescription: Output only.
  432. // If this field is populated, it contains a description of why the TPU
  433. // Node
  434. // is unhealthy.
  435. HealthDescription string `json:"healthDescription,omitempty"`
  436. // IpAddress: Output only.
  437. // DEPRECATED! Use network_endpoints instead.
  438. // The network address for the TPU Node as visible to Compute
  439. // Engine
  440. // instances.
  441. IpAddress string `json:"ipAddress,omitempty"`
  442. // Labels: Resource labels to represent user-provided metadata.
  443. Labels map[string]string `json:"labels,omitempty"`
  444. // Name: Output only.
  445. // The immutable name of the TPU
  446. Name string `json:"name,omitempty"`
  447. // Network: The name of a network they wish to peer the TPU node to. It
  448. // must be a
  449. // preexisting Compute Engine network inside of the project on which
  450. // this API
  451. // has been activated. If none is provided, "default" will be used.
  452. Network string `json:"network,omitempty"`
  453. // NetworkEndpoints: Output only. The network endpoints where TPU
  454. // workers can be accessed and sent work.
  455. // It is recommended that Tensorflow clients of the node reach out to
  456. // the 0th
  457. // entry in this map first.
  458. NetworkEndpoints []*NetworkEndpoint `json:"networkEndpoints,omitempty"`
  459. // Port: Output only.
  460. // DEPRECATED! Use network_endpoints instead.
  461. // The network port for the TPU Node as visible to Compute Engine
  462. // instances.
  463. Port string `json:"port,omitempty"`
  464. SchedulingConfig *SchedulingConfig `json:"schedulingConfig,omitempty"`
  465. // ServiceAccount: Output only.
  466. // The service account used to run the tensor flow services within the
  467. // node.
  468. // To share resources, including Google Cloud Storage data, with
  469. // the
  470. // Tensorflow job running in the Node, this account must have
  471. // permissions to
  472. // that data.
  473. ServiceAccount string `json:"serviceAccount,omitempty"`
  474. // State: Output only.
  475. // The current state for the TPU Node.
  476. //
  477. // Possible values:
  478. // "STATE_UNSPECIFIED" - TPU node state is not known/set.
  479. // "CREATING" - TPU node is being created.
  480. // "READY" - TPU node has been created and is fully usable.
  481. // "RESTARTING" - TPU node is restarting.
  482. // "REIMAGING" - TPU node is undergoing reimaging.
  483. // "DELETING" - TPU node is being deleted.
  484. // "REPAIRING" - TPU node is being repaired and may be unusable.
  485. // Details can be
  486. // found in the `help_description` field.
  487. // "STOPPED" - 7 - Reserved. Was SUSPENDED.
  488. // TPU node is stopped.
  489. // "STOPPING" - TPU node is currently stopping.
  490. // "STARTING" - TPU node is currently starting.
  491. // "PREEMPTED" - TPU node has been preempted. Only applies to
  492. // Preemptible TPU Nodes.
  493. // "TERMINATED" - TPU node has been terminated due to maintenance or
  494. // has reached the end of
  495. // its life cycle (for preemptible nodes).
  496. State string `json:"state,omitempty"`
  497. // TensorflowVersion: The version of Tensorflow running in the
  498. // Node.
  499. // Required.
  500. TensorflowVersion string `json:"tensorflowVersion,omitempty"`
  501. // ServerResponse contains the HTTP response code and headers from the
  502. // server.
  503. googleapi.ServerResponse `json:"-"`
  504. // ForceSendFields is a list of field names (e.g. "AcceleratorType") to
  505. // unconditionally include in API requests. By default, fields with
  506. // empty values are omitted from API requests. However, any non-pointer,
  507. // non-interface field appearing in ForceSendFields will be sent to the
  508. // server regardless of whether the field is empty or not. This may be
  509. // used to include empty fields in Patch requests.
  510. ForceSendFields []string `json:"-"`
  511. // NullFields is a list of field names (e.g. "AcceleratorType") to
  512. // include in API requests with the JSON null value. By default, fields
  513. // with empty values are omitted from API requests. However, any field
  514. // with an empty value appearing in NullFields will be sent to the
  515. // server as null. It is an error if a field in this list has a
  516. // non-empty value. This may be used to include null fields in Patch
  517. // requests.
  518. NullFields []string `json:"-"`
  519. }
  520. func (s *Node) MarshalJSON() ([]byte, error) {
  521. type NoMethod Node
  522. raw := NoMethod(*s)
  523. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  524. }
  525. // Operation: This resource represents a long-running operation that is
  526. // the result of a
  527. // network API call.
  528. type Operation struct {
  529. // Done: If the value is `false`, it means the operation is still in
  530. // progress.
  531. // If `true`, the operation is completed, and either `error` or
  532. // `response` is
  533. // available.
  534. Done bool `json:"done,omitempty"`
  535. // Error: The error result of the operation in case of failure or
  536. // cancellation.
  537. Error *Status `json:"error,omitempty"`
  538. // Metadata: Service-specific metadata associated with the operation.
  539. // It typically
  540. // contains progress information and common metadata such as create
  541. // time.
  542. // Some services might not provide such metadata. Any method that
  543. // returns a
  544. // long-running operation should document the metadata type, if any.
  545. Metadata googleapi.RawMessage `json:"metadata,omitempty"`
  546. // Name: The server-assigned name, which is only unique within the same
  547. // service that
  548. // originally returns it. If you use the default HTTP mapping,
  549. // the
  550. // `name` should have the format of `operations/some/unique/name`.
  551. Name string `json:"name,omitempty"`
  552. // Response: The normal response of the operation in case of success.
  553. // If the original
  554. // method returns no data on success, such as `Delete`, the response
  555. // is
  556. // `google.protobuf.Empty`. If the original method is
  557. // standard
  558. // `Get`/`Create`/`Update`, the response should be the resource. For
  559. // other
  560. // methods, the response should have the type `XxxResponse`, where
  561. // `Xxx`
  562. // is the original method name. For example, if the original method
  563. // name
  564. // is `TakeSnapshot()`, the inferred response type
  565. // is
  566. // `TakeSnapshotResponse`.
  567. Response googleapi.RawMessage `json:"response,omitempty"`
  568. // ServerResponse contains the HTTP response code and headers from the
  569. // server.
  570. googleapi.ServerResponse `json:"-"`
  571. // ForceSendFields is a list of field names (e.g. "Done") to
  572. // unconditionally include in API requests. By default, fields with
  573. // empty values are omitted from API requests. However, any non-pointer,
  574. // non-interface field appearing in ForceSendFields will be sent to the
  575. // server regardless of whether the field is empty or not. This may be
  576. // used to include empty fields in Patch requests.
  577. ForceSendFields []string `json:"-"`
  578. // NullFields is a list of field names (e.g. "Done") to include in API
  579. // requests with the JSON null value. By default, fields with empty
  580. // values are omitted from API requests. However, any field with an
  581. // empty value appearing in NullFields will be sent to the server as
  582. // null. It is an error if a field in this list has a non-empty value.
  583. // This may be used to include null fields in Patch requests.
  584. NullFields []string `json:"-"`
  585. }
  586. func (s *Operation) MarshalJSON() ([]byte, error) {
  587. type NoMethod Operation
  588. raw := NoMethod(*s)
  589. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  590. }
  591. // OperationMetadata: Represents the metadata of the long-running
  592. // operation.
  593. type OperationMetadata struct {
  594. // ApiVersion: [Output only] API version used to start the operation.
  595. ApiVersion string `json:"apiVersion,omitempty"`
  596. // CancelRequested: [Output only] Identifies whether the user has
  597. // requested cancellation
  598. // of the operation. Operations that have successfully been
  599. // cancelled
  600. // have Operation.error value with a google.rpc.Status.code of
  601. // 1,
  602. // corresponding to `Code.CANCELLED`.
  603. CancelRequested bool `json:"cancelRequested,omitempty"`
  604. // CreateTime: [Output only] The time the operation was created.
  605. CreateTime string `json:"createTime,omitempty"`
  606. // EndTime: [Output only] The time the operation finished running.
  607. EndTime string `json:"endTime,omitempty"`
  608. // StatusDetail: [Output only] Human-readable status of the operation,
  609. // if any.
  610. StatusDetail string `json:"statusDetail,omitempty"`
  611. // Target: [Output only] Server-defined resource path for the target of
  612. // the operation.
  613. Target string `json:"target,omitempty"`
  614. // Verb: [Output only] Name of the verb executed by the operation.
  615. Verb string `json:"verb,omitempty"`
  616. // ForceSendFields is a list of field names (e.g. "ApiVersion") to
  617. // unconditionally include in API requests. By default, fields with
  618. // empty values are omitted from API requests. However, any non-pointer,
  619. // non-interface field appearing in ForceSendFields will be sent to the
  620. // server regardless of whether the field is empty or not. This may be
  621. // used to include empty fields in Patch requests.
  622. ForceSendFields []string `json:"-"`
  623. // NullFields is a list of field names (e.g. "ApiVersion") to include in
  624. // API requests with the JSON null value. By default, fields with empty
  625. // values are omitted from API requests. However, any field with an
  626. // empty value appearing in NullFields will be sent to the server as
  627. // null. It is an error if a field in this list has a non-empty value.
  628. // This may be used to include null fields in Patch requests.
  629. NullFields []string `json:"-"`
  630. }
  631. func (s *OperationMetadata) MarshalJSON() ([]byte, error) {
  632. type NoMethod OperationMetadata
  633. raw := NoMethod(*s)
  634. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  635. }
  636. // ReimageNodeRequest: Request for ReimageNode.
  637. type ReimageNodeRequest struct {
  638. // TensorflowVersion: The version for reimage to create.
  639. TensorflowVersion string `json:"tensorflowVersion,omitempty"`
  640. // ForceSendFields is a list of field names (e.g. "TensorflowVersion")
  641. // to unconditionally include in API requests. By default, fields with
  642. // empty values are omitted from API requests. However, any non-pointer,
  643. // non-interface field appearing in ForceSendFields will be sent to the
  644. // server regardless of whether the field is empty or not. This may be
  645. // used to include empty fields in Patch requests.
  646. ForceSendFields []string `json:"-"`
  647. // NullFields is a list of field names (e.g. "TensorflowVersion") to
  648. // include in API requests with the JSON null value. By default, fields
  649. // with empty values are omitted from API requests. However, any field
  650. // with an empty value appearing in NullFields will be sent to the
  651. // server as null. It is an error if a field in this list has a
  652. // non-empty value. This may be used to include null fields in Patch
  653. // requests.
  654. NullFields []string `json:"-"`
  655. }
  656. func (s *ReimageNodeRequest) MarshalJSON() ([]byte, error) {
  657. type NoMethod ReimageNodeRequest
  658. raw := NoMethod(*s)
  659. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  660. }
  661. type SchedulingConfig struct {
  662. Preemptible bool `json:"preemptible,omitempty"`
  663. // ForceSendFields is a list of field names (e.g. "Preemptible") to
  664. // unconditionally include in API requests. By default, fields with
  665. // empty values are omitted from API requests. However, any non-pointer,
  666. // non-interface field appearing in ForceSendFields will be sent to the
  667. // server regardless of whether the field is empty or not. This may be
  668. // used to include empty fields in Patch requests.
  669. ForceSendFields []string `json:"-"`
  670. // NullFields is a list of field names (e.g. "Preemptible") to include
  671. // in API requests with the JSON null value. By default, fields with
  672. // empty values are omitted from API requests. However, any field with
  673. // an empty value appearing in NullFields will be sent to the server as
  674. // null. It is an error if a field in this list has a non-empty value.
  675. // This may be used to include null fields in Patch requests.
  676. NullFields []string `json:"-"`
  677. }
  678. func (s *SchedulingConfig) MarshalJSON() ([]byte, error) {
  679. type NoMethod SchedulingConfig
  680. raw := NoMethod(*s)
  681. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  682. }
  683. // StartNodeRequest: Request for StartNode.
  684. type StartNodeRequest struct {
  685. }
  686. // Status: The `Status` type defines a logical error model that is
  687. // suitable for different
  688. // programming environments, including REST APIs and RPC APIs. It is
  689. // used by
  690. // [gRPC](https://github.com/grpc). The error model is designed to
  691. // be:
  692. //
  693. // - Simple to use and understand for most users
  694. // - Flexible enough to meet unexpected needs
  695. //
  696. // # Overview
  697. //
  698. // The `Status` message contains three pieces of data: error code, error
  699. // message,
  700. // and error details. The error code should be an enum value
  701. // of
  702. // google.rpc.Code, but it may accept additional error codes if needed.
  703. // The
  704. // error message should be a developer-facing English message that
  705. // helps
  706. // developers *understand* and *resolve* the error. If a localized
  707. // user-facing
  708. // error message is needed, put the localized message in the error
  709. // details or
  710. // localize it in the client. The optional error details may contain
  711. // arbitrary
  712. // information about the error. There is a predefined set of error
  713. // detail types
  714. // in the package `google.rpc` that can be used for common error
  715. // conditions.
  716. //
  717. // # Language mapping
  718. //
  719. // The `Status` message is the logical representation of the error
  720. // model, but it
  721. // is not necessarily the actual wire format. When the `Status` message
  722. // is
  723. // exposed in different client libraries and different wire protocols,
  724. // it can be
  725. // mapped differently. For example, it will likely be mapped to some
  726. // exceptions
  727. // in Java, but more likely mapped to some error codes in C.
  728. //
  729. // # Other uses
  730. //
  731. // The error model and the `Status` message can be used in a variety
  732. // of
  733. // environments, either with or without APIs, to provide a
  734. // consistent developer experience across different
  735. // environments.
  736. //
  737. // Example uses of this error model include:
  738. //
  739. // - Partial errors. If a service needs to return partial errors to the
  740. // client,
  741. // it may embed the `Status` in the normal response to indicate the
  742. // partial
  743. // errors.
  744. //
  745. // - Workflow errors. A typical workflow has multiple steps. Each step
  746. // may
  747. // have a `Status` message for error reporting.
  748. //
  749. // - Batch operations. If a client uses batch request and batch
  750. // response, the
  751. // `Status` message should be used directly inside batch response,
  752. // one for
  753. // each error sub-response.
  754. //
  755. // - Asynchronous operations. If an API call embeds asynchronous
  756. // operation
  757. // results in its response, the status of those operations should
  758. // be
  759. // represented directly using the `Status` message.
  760. //
  761. // - Logging. If some API errors are stored in logs, the message
  762. // `Status` could
  763. // be used directly after any stripping needed for security/privacy
  764. // reasons.
  765. type Status struct {
  766. // Code: The status code, which should be an enum value of
  767. // google.rpc.Code.
  768. Code int64 `json:"code,omitempty"`
  769. // Details: A list of messages that carry the error details. There is a
  770. // common set of
  771. // message types for APIs to use.
  772. Details []googleapi.RawMessage `json:"details,omitempty"`
  773. // Message: A developer-facing error message, which should be in
  774. // English. Any
  775. // user-facing error message should be localized and sent in
  776. // the
  777. // google.rpc.Status.details field, or localized by the client.
  778. Message string `json:"message,omitempty"`
  779. // ForceSendFields is a list of field names (e.g. "Code") to
  780. // unconditionally include in API requests. By default, fields with
  781. // empty values are omitted from API requests. However, any non-pointer,
  782. // non-interface field appearing in ForceSendFields will be sent to the
  783. // server regardless of whether the field is empty or not. This may be
  784. // used to include empty fields in Patch requests.
  785. ForceSendFields []string `json:"-"`
  786. // NullFields is a list of field names (e.g. "Code") to include in API
  787. // requests with the JSON null value. By default, fields with empty
  788. // values are omitted from API requests. However, any field with an
  789. // empty value appearing in NullFields will be sent to the server as
  790. // null. It is an error if a field in this list has a non-empty value.
  791. // This may be used to include null fields in Patch requests.
  792. NullFields []string `json:"-"`
  793. }
  794. func (s *Status) MarshalJSON() ([]byte, error) {
  795. type NoMethod Status
  796. raw := NoMethod(*s)
  797. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  798. }
  799. // StopNodeRequest: Request for StopNode.
  800. type StopNodeRequest struct {
  801. }
  802. // TensorFlowVersion: A tensorflow version that a Node can be configured
  803. // with.
  804. type TensorFlowVersion struct {
  805. // Name: The resource name.
  806. Name string `json:"name,omitempty"`
  807. // Version: the tensorflow version.
  808. Version string `json:"version,omitempty"`
  809. // ServerResponse contains the HTTP response code and headers from the
  810. // server.
  811. googleapi.ServerResponse `json:"-"`
  812. // ForceSendFields is a list of field names (e.g. "Name") to
  813. // unconditionally include in API requests. By default, fields with
  814. // empty values are omitted from API requests. However, any non-pointer,
  815. // non-interface field appearing in ForceSendFields will be sent to the
  816. // server regardless of whether the field is empty or not. This may be
  817. // used to include empty fields in Patch requests.
  818. ForceSendFields []string `json:"-"`
  819. // NullFields is a list of field names (e.g. "Name") to include in API
  820. // requests with the JSON null value. By default, fields with empty
  821. // values are omitted from API requests. However, any field with an
  822. // empty value appearing in NullFields will be sent to the server as
  823. // null. It is an error if a field in this list has a non-empty value.
  824. // This may be used to include null fields in Patch requests.
  825. NullFields []string `json:"-"`
  826. }
  827. func (s *TensorFlowVersion) MarshalJSON() ([]byte, error) {
  828. type NoMethod TensorFlowVersion
  829. raw := NoMethod(*s)
  830. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  831. }
  832. // method id "tpu.projects.locations.get":
  833. type ProjectsLocationsGetCall struct {
  834. s *Service
  835. name string
  836. urlParams_ gensupport.URLParams
  837. ifNoneMatch_ string
  838. ctx_ context.Context
  839. header_ http.Header
  840. }
  841. // Get: Gets information about a location.
  842. func (r *ProjectsLocationsService) Get(name string) *ProjectsLocationsGetCall {
  843. c := &ProjectsLocationsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  844. c.name = name
  845. return c
  846. }
  847. // Fields allows partial responses to be retrieved. See
  848. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  849. // for more information.
  850. func (c *ProjectsLocationsGetCall) Fields(s ...googleapi.Field) *ProjectsLocationsGetCall {
  851. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  852. return c
  853. }
  854. // IfNoneMatch sets the optional parameter which makes the operation
  855. // fail if the object's ETag matches the given value. This is useful for
  856. // getting updates only after the object has changed since the last
  857. // request. Use googleapi.IsNotModified to check whether the response
  858. // error from Do is the result of In-None-Match.
  859. func (c *ProjectsLocationsGetCall) IfNoneMatch(entityTag string) *ProjectsLocationsGetCall {
  860. c.ifNoneMatch_ = entityTag
  861. return c
  862. }
  863. // Context sets the context to be used in this call's Do method. Any
  864. // pending HTTP request will be aborted if the provided context is
  865. // canceled.
  866. func (c *ProjectsLocationsGetCall) Context(ctx context.Context) *ProjectsLocationsGetCall {
  867. c.ctx_ = ctx
  868. return c
  869. }
  870. // Header returns an http.Header that can be modified by the caller to
  871. // add HTTP headers to the request.
  872. func (c *ProjectsLocationsGetCall) Header() http.Header {
  873. if c.header_ == nil {
  874. c.header_ = make(http.Header)
  875. }
  876. return c.header_
  877. }
  878. func (c *ProjectsLocationsGetCall) doRequest(alt string) (*http.Response, error) {
  879. reqHeaders := make(http.Header)
  880. for k, v := range c.header_ {
  881. reqHeaders[k] = v
  882. }
  883. reqHeaders.Set("User-Agent", c.s.userAgent())
  884. if c.ifNoneMatch_ != "" {
  885. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  886. }
  887. var body io.Reader = nil
  888. c.urlParams_.Set("alt", alt)
  889. c.urlParams_.Set("prettyPrint", "false")
  890. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  891. urls += "?" + c.urlParams_.Encode()
  892. req, err := http.NewRequest("GET", urls, body)
  893. if err != nil {
  894. return nil, err
  895. }
  896. req.Header = reqHeaders
  897. googleapi.Expand(req.URL, map[string]string{
  898. "name": c.name,
  899. })
  900. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  901. }
  902. // Do executes the "tpu.projects.locations.get" call.
  903. // Exactly one of *Location or error will be non-nil. Any non-2xx status
  904. // code is an error. Response headers are in either
  905. // *Location.ServerResponse.Header or (if a response was returned at
  906. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  907. // to check whether the returned error was because
  908. // http.StatusNotModified was returned.
  909. func (c *ProjectsLocationsGetCall) Do(opts ...googleapi.CallOption) (*Location, error) {
  910. gensupport.SetOptions(c.urlParams_, opts...)
  911. res, err := c.doRequest("json")
  912. if res != nil && res.StatusCode == http.StatusNotModified {
  913. if res.Body != nil {
  914. res.Body.Close()
  915. }
  916. return nil, &googleapi.Error{
  917. Code: res.StatusCode,
  918. Header: res.Header,
  919. }
  920. }
  921. if err != nil {
  922. return nil, err
  923. }
  924. defer googleapi.CloseBody(res)
  925. if err := googleapi.CheckResponse(res); err != nil {
  926. return nil, err
  927. }
  928. ret := &Location{
  929. ServerResponse: googleapi.ServerResponse{
  930. Header: res.Header,
  931. HTTPStatusCode: res.StatusCode,
  932. },
  933. }
  934. target := &ret
  935. if err := gensupport.DecodeResponse(target, res); err != nil {
  936. return nil, err
  937. }
  938. return ret, nil
  939. // {
  940. // "description": "Gets information about a location.",
  941. // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}",
  942. // "httpMethod": "GET",
  943. // "id": "tpu.projects.locations.get",
  944. // "parameterOrder": [
  945. // "name"
  946. // ],
  947. // "parameters": {
  948. // "name": {
  949. // "description": "Resource name for the location.",
  950. // "location": "path",
  951. // "pattern": "^projects/[^/]+/locations/[^/]+$",
  952. // "required": true,
  953. // "type": "string"
  954. // }
  955. // },
  956. // "path": "v1/{+name}",
  957. // "response": {
  958. // "$ref": "Location"
  959. // },
  960. // "scopes": [
  961. // "https://www.googleapis.com/auth/cloud-platform"
  962. // ]
  963. // }
  964. }
  965. // method id "tpu.projects.locations.list":
  966. type ProjectsLocationsListCall struct {
  967. s *Service
  968. name string
  969. urlParams_ gensupport.URLParams
  970. ifNoneMatch_ string
  971. ctx_ context.Context
  972. header_ http.Header
  973. }
  974. // List: Lists information about the supported locations for this
  975. // service.
  976. func (r *ProjectsLocationsService) List(name string) *ProjectsLocationsListCall {
  977. c := &ProjectsLocationsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  978. c.name = name
  979. return c
  980. }
  981. // Filter sets the optional parameter "filter": The standard list
  982. // filter.
  983. func (c *ProjectsLocationsListCall) Filter(filter string) *ProjectsLocationsListCall {
  984. c.urlParams_.Set("filter", filter)
  985. return c
  986. }
  987. // PageSize sets the optional parameter "pageSize": The standard list
  988. // page size.
  989. func (c *ProjectsLocationsListCall) PageSize(pageSize int64) *ProjectsLocationsListCall {
  990. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  991. return c
  992. }
  993. // PageToken sets the optional parameter "pageToken": The standard list
  994. // page token.
  995. func (c *ProjectsLocationsListCall) PageToken(pageToken string) *ProjectsLocationsListCall {
  996. c.urlParams_.Set("pageToken", pageToken)
  997. return c
  998. }
  999. // Fields allows partial responses to be retrieved. See
  1000. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1001. // for more information.
  1002. func (c *ProjectsLocationsListCall) Fields(s ...googleapi.Field) *ProjectsLocationsListCall {
  1003. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1004. return c
  1005. }
  1006. // IfNoneMatch sets the optional parameter which makes the operation
  1007. // fail if the object's ETag matches the given value. This is useful for
  1008. // getting updates only after the object has changed since the last
  1009. // request. Use googleapi.IsNotModified to check whether the response
  1010. // error from Do is the result of In-None-Match.
  1011. func (c *ProjectsLocationsListCall) IfNoneMatch(entityTag string) *ProjectsLocationsListCall {
  1012. c.ifNoneMatch_ = entityTag
  1013. return c
  1014. }
  1015. // Context sets the context to be used in this call's Do method. Any
  1016. // pending HTTP request will be aborted if the provided context is
  1017. // canceled.
  1018. func (c *ProjectsLocationsListCall) Context(ctx context.Context) *ProjectsLocationsListCall {
  1019. c.ctx_ = ctx
  1020. return c
  1021. }
  1022. // Header returns an http.Header that can be modified by the caller to
  1023. // add HTTP headers to the request.
  1024. func (c *ProjectsLocationsListCall) Header() http.Header {
  1025. if c.header_ == nil {
  1026. c.header_ = make(http.Header)
  1027. }
  1028. return c.header_
  1029. }
  1030. func (c *ProjectsLocationsListCall) doRequest(alt string) (*http.Response, error) {
  1031. reqHeaders := make(http.Header)
  1032. for k, v := range c.header_ {
  1033. reqHeaders[k] = v
  1034. }
  1035. reqHeaders.Set("User-Agent", c.s.userAgent())
  1036. if c.ifNoneMatch_ != "" {
  1037. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1038. }
  1039. var body io.Reader = nil
  1040. c.urlParams_.Set("alt", alt)
  1041. c.urlParams_.Set("prettyPrint", "false")
  1042. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}/locations")
  1043. urls += "?" + c.urlParams_.Encode()
  1044. req, err := http.NewRequest("GET", urls, body)
  1045. if err != nil {
  1046. return nil, err
  1047. }
  1048. req.Header = reqHeaders
  1049. googleapi.Expand(req.URL, map[string]string{
  1050. "name": c.name,
  1051. })
  1052. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1053. }
  1054. // Do executes the "tpu.projects.locations.list" call.
  1055. // Exactly one of *ListLocationsResponse or error will be non-nil. Any
  1056. // non-2xx status code is an error. Response headers are in either
  1057. // *ListLocationsResponse.ServerResponse.Header or (if a response was
  1058. // returned at all) in error.(*googleapi.Error).Header. Use
  1059. // googleapi.IsNotModified to check whether the returned error was
  1060. // because http.StatusNotModified was returned.
  1061. func (c *ProjectsLocationsListCall) Do(opts ...googleapi.CallOption) (*ListLocationsResponse, error) {
  1062. gensupport.SetOptions(c.urlParams_, opts...)
  1063. res, err := c.doRequest("json")
  1064. if res != nil && res.StatusCode == http.StatusNotModified {
  1065. if res.Body != nil {
  1066. res.Body.Close()
  1067. }
  1068. return nil, &googleapi.Error{
  1069. Code: res.StatusCode,
  1070. Header: res.Header,
  1071. }
  1072. }
  1073. if err != nil {
  1074. return nil, err
  1075. }
  1076. defer googleapi.CloseBody(res)
  1077. if err := googleapi.CheckResponse(res); err != nil {
  1078. return nil, err
  1079. }
  1080. ret := &ListLocationsResponse{
  1081. ServerResponse: googleapi.ServerResponse{
  1082. Header: res.Header,
  1083. HTTPStatusCode: res.StatusCode,
  1084. },
  1085. }
  1086. target := &ret
  1087. if err := gensupport.DecodeResponse(target, res); err != nil {
  1088. return nil, err
  1089. }
  1090. return ret, nil
  1091. // {
  1092. // "description": "Lists information about the supported locations for this service.",
  1093. // "flatPath": "v1/projects/{projectsId}/locations",
  1094. // "httpMethod": "GET",
  1095. // "id": "tpu.projects.locations.list",
  1096. // "parameterOrder": [
  1097. // "name"
  1098. // ],
  1099. // "parameters": {
  1100. // "filter": {
  1101. // "description": "The standard list filter.",
  1102. // "location": "query",
  1103. // "type": "string"
  1104. // },
  1105. // "name": {
  1106. // "description": "The resource that owns the locations collection, if applicable.",
  1107. // "location": "path",
  1108. // "pattern": "^projects/[^/]+$",
  1109. // "required": true,
  1110. // "type": "string"
  1111. // },
  1112. // "pageSize": {
  1113. // "description": "The standard list page size.",
  1114. // "format": "int32",
  1115. // "location": "query",
  1116. // "type": "integer"
  1117. // },
  1118. // "pageToken": {
  1119. // "description": "The standard list page token.",
  1120. // "location": "query",
  1121. // "type": "string"
  1122. // }
  1123. // },
  1124. // "path": "v1/{+name}/locations",
  1125. // "response": {
  1126. // "$ref": "ListLocationsResponse"
  1127. // },
  1128. // "scopes": [
  1129. // "https://www.googleapis.com/auth/cloud-platform"
  1130. // ]
  1131. // }
  1132. }
  1133. // Pages invokes f for each page of results.
  1134. // A non-nil error returned from f will halt the iteration.
  1135. // The provided context supersedes any context provided to the Context method.
  1136. func (c *ProjectsLocationsListCall) Pages(ctx context.Context, f func(*ListLocationsResponse) error) error {
  1137. c.ctx_ = ctx
  1138. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  1139. for {
  1140. x, err := c.Do()
  1141. if err != nil {
  1142. return err
  1143. }
  1144. if err := f(x); err != nil {
  1145. return err
  1146. }
  1147. if x.NextPageToken == "" {
  1148. return nil
  1149. }
  1150. c.PageToken(x.NextPageToken)
  1151. }
  1152. }
  1153. // method id "tpu.projects.locations.acceleratorTypes.get":
  1154. type ProjectsLocationsAcceleratorTypesGetCall struct {
  1155. s *Service
  1156. name string
  1157. urlParams_ gensupport.URLParams
  1158. ifNoneMatch_ string
  1159. ctx_ context.Context
  1160. header_ http.Header
  1161. }
  1162. // Get: Gets AcceleratorType.
  1163. func (r *ProjectsLocationsAcceleratorTypesService) Get(name string) *ProjectsLocationsAcceleratorTypesGetCall {
  1164. c := &ProjectsLocationsAcceleratorTypesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1165. c.name = name
  1166. return c
  1167. }
  1168. // Fields allows partial responses to be retrieved. See
  1169. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1170. // for more information.
  1171. func (c *ProjectsLocationsAcceleratorTypesGetCall) Fields(s ...googleapi.Field) *ProjectsLocationsAcceleratorTypesGetCall {
  1172. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1173. return c
  1174. }
  1175. // IfNoneMatch sets the optional parameter which makes the operation
  1176. // fail if the object's ETag matches the given value. This is useful for
  1177. // getting updates only after the object has changed since the last
  1178. // request. Use googleapi.IsNotModified to check whether the response
  1179. // error from Do is the result of In-None-Match.
  1180. func (c *ProjectsLocationsAcceleratorTypesGetCall) IfNoneMatch(entityTag string) *ProjectsLocationsAcceleratorTypesGetCall {
  1181. c.ifNoneMatch_ = entityTag
  1182. return c
  1183. }
  1184. // Context sets the context to be used in this call's Do method. Any
  1185. // pending HTTP request will be aborted if the provided context is
  1186. // canceled.
  1187. func (c *ProjectsLocationsAcceleratorTypesGetCall) Context(ctx context.Context) *ProjectsLocationsAcceleratorTypesGetCall {
  1188. c.ctx_ = ctx
  1189. return c
  1190. }
  1191. // Header returns an http.Header that can be modified by the caller to
  1192. // add HTTP headers to the request.
  1193. func (c *ProjectsLocationsAcceleratorTypesGetCall) Header() http.Header {
  1194. if c.header_ == nil {
  1195. c.header_ = make(http.Header)
  1196. }
  1197. return c.header_
  1198. }
  1199. func (c *ProjectsLocationsAcceleratorTypesGetCall) doRequest(alt string) (*http.Response, error) {
  1200. reqHeaders := make(http.Header)
  1201. for k, v := range c.header_ {
  1202. reqHeaders[k] = v
  1203. }
  1204. reqHeaders.Set("User-Agent", c.s.userAgent())
  1205. if c.ifNoneMatch_ != "" {
  1206. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1207. }
  1208. var body io.Reader = nil
  1209. c.urlParams_.Set("alt", alt)
  1210. c.urlParams_.Set("prettyPrint", "false")
  1211. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  1212. urls += "?" + c.urlParams_.Encode()
  1213. req, err := http.NewRequest("GET", urls, body)
  1214. if err != nil {
  1215. return nil, err
  1216. }
  1217. req.Header = reqHeaders
  1218. googleapi.Expand(req.URL, map[string]string{
  1219. "name": c.name,
  1220. })
  1221. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1222. }
  1223. // Do executes the "tpu.projects.locations.acceleratorTypes.get" call.
  1224. // Exactly one of *AcceleratorType or error will be non-nil. Any non-2xx
  1225. // status code is an error. Response headers are in either
  1226. // *AcceleratorType.ServerResponse.Header or (if a response was returned
  1227. // at all) in error.(*googleapi.Error).Header. Use
  1228. // googleapi.IsNotModified to check whether the returned error was
  1229. // because http.StatusNotModified was returned.
  1230. func (c *ProjectsLocationsAcceleratorTypesGetCall) Do(opts ...googleapi.CallOption) (*AcceleratorType, error) {
  1231. gensupport.SetOptions(c.urlParams_, opts...)
  1232. res, err := c.doRequest("json")
  1233. if res != nil && res.StatusCode == http.StatusNotModified {
  1234. if res.Body != nil {
  1235. res.Body.Close()
  1236. }
  1237. return nil, &googleapi.Error{
  1238. Code: res.StatusCode,
  1239. Header: res.Header,
  1240. }
  1241. }
  1242. if err != nil {
  1243. return nil, err
  1244. }
  1245. defer googleapi.CloseBody(res)
  1246. if err := googleapi.CheckResponse(res); err != nil {
  1247. return nil, err
  1248. }
  1249. ret := &AcceleratorType{
  1250. ServerResponse: googleapi.ServerResponse{
  1251. Header: res.Header,
  1252. HTTPStatusCode: res.StatusCode,
  1253. },
  1254. }
  1255. target := &ret
  1256. if err := gensupport.DecodeResponse(target, res); err != nil {
  1257. return nil, err
  1258. }
  1259. return ret, nil
  1260. // {
  1261. // "description": "Gets AcceleratorType.",
  1262. // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/acceleratorTypes/{acceleratorTypesId}",
  1263. // "httpMethod": "GET",
  1264. // "id": "tpu.projects.locations.acceleratorTypes.get",
  1265. // "parameterOrder": [
  1266. // "name"
  1267. // ],
  1268. // "parameters": {
  1269. // "name": {
  1270. // "description": "The resource name.",
  1271. // "location": "path",
  1272. // "pattern": "^projects/[^/]+/locations/[^/]+/acceleratorTypes/[^/]+$",
  1273. // "required": true,
  1274. // "type": "string"
  1275. // }
  1276. // },
  1277. // "path": "v1/{+name}",
  1278. // "response": {
  1279. // "$ref": "AcceleratorType"
  1280. // },
  1281. // "scopes": [
  1282. // "https://www.googleapis.com/auth/cloud-platform"
  1283. // ]
  1284. // }
  1285. }
  1286. // method id "tpu.projects.locations.acceleratorTypes.list":
  1287. type ProjectsLocationsAcceleratorTypesListCall struct {
  1288. s *Service
  1289. parent string
  1290. urlParams_ gensupport.URLParams
  1291. ifNoneMatch_ string
  1292. ctx_ context.Context
  1293. header_ http.Header
  1294. }
  1295. // List: Lists accelerator types supported by this API.
  1296. func (r *ProjectsLocationsAcceleratorTypesService) List(parent string) *ProjectsLocationsAcceleratorTypesListCall {
  1297. c := &ProjectsLocationsAcceleratorTypesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1298. c.parent = parent
  1299. return c
  1300. }
  1301. // Filter sets the optional parameter "filter": List filter.
  1302. func (c *ProjectsLocationsAcceleratorTypesListCall) Filter(filter string) *ProjectsLocationsAcceleratorTypesListCall {
  1303. c.urlParams_.Set("filter", filter)
  1304. return c
  1305. }
  1306. // OrderBy sets the optional parameter "orderBy": Sort results.
  1307. func (c *ProjectsLocationsAcceleratorTypesListCall) OrderBy(orderBy string) *ProjectsLocationsAcceleratorTypesListCall {
  1308. c.urlParams_.Set("orderBy", orderBy)
  1309. return c
  1310. }
  1311. // PageSize sets the optional parameter "pageSize": The maximum number
  1312. // of items to return.
  1313. func (c *ProjectsLocationsAcceleratorTypesListCall) PageSize(pageSize int64) *ProjectsLocationsAcceleratorTypesListCall {
  1314. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  1315. return c
  1316. }
  1317. // PageToken sets the optional parameter "pageToken": The
  1318. // next_page_token value returned from a previous List request, if any.
  1319. func (c *ProjectsLocationsAcceleratorTypesListCall) PageToken(pageToken string) *ProjectsLocationsAcceleratorTypesListCall {
  1320. c.urlParams_.Set("pageToken", pageToken)
  1321. return c
  1322. }
  1323. // Fields allows partial responses to be retrieved. See
  1324. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1325. // for more information.
  1326. func (c *ProjectsLocationsAcceleratorTypesListCall) Fields(s ...googleapi.Field) *ProjectsLocationsAcceleratorTypesListCall {
  1327. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1328. return c
  1329. }
  1330. // IfNoneMatch sets the optional parameter which makes the operation
  1331. // fail if the object's ETag matches the given value. This is useful for
  1332. // getting updates only after the object has changed since the last
  1333. // request. Use googleapi.IsNotModified to check whether the response
  1334. // error from Do is the result of In-None-Match.
  1335. func (c *ProjectsLocationsAcceleratorTypesListCall) IfNoneMatch(entityTag string) *ProjectsLocationsAcceleratorTypesListCall {
  1336. c.ifNoneMatch_ = entityTag
  1337. return c
  1338. }
  1339. // Context sets the context to be used in this call's Do method. Any
  1340. // pending HTTP request will be aborted if the provided context is
  1341. // canceled.
  1342. func (c *ProjectsLocationsAcceleratorTypesListCall) Context(ctx context.Context) *ProjectsLocationsAcceleratorTypesListCall {
  1343. c.ctx_ = ctx
  1344. return c
  1345. }
  1346. // Header returns an http.Header that can be modified by the caller to
  1347. // add HTTP headers to the request.
  1348. func (c *ProjectsLocationsAcceleratorTypesListCall) Header() http.Header {
  1349. if c.header_ == nil {
  1350. c.header_ = make(http.Header)
  1351. }
  1352. return c.header_
  1353. }
  1354. func (c *ProjectsLocationsAcceleratorTypesListCall) doRequest(alt string) (*http.Response, error) {
  1355. reqHeaders := make(http.Header)
  1356. for k, v := range c.header_ {
  1357. reqHeaders[k] = v
  1358. }
  1359. reqHeaders.Set("User-Agent", c.s.userAgent())
  1360. if c.ifNoneMatch_ != "" {
  1361. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1362. }
  1363. var body io.Reader = nil
  1364. c.urlParams_.Set("alt", alt)
  1365. c.urlParams_.Set("prettyPrint", "false")
  1366. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/acceleratorTypes")
  1367. urls += "?" + c.urlParams_.Encode()
  1368. req, err := http.NewRequest("GET", urls, body)
  1369. if err != nil {
  1370. return nil, err
  1371. }
  1372. req.Header = reqHeaders
  1373. googleapi.Expand(req.URL, map[string]string{
  1374. "parent": c.parent,
  1375. })
  1376. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1377. }
  1378. // Do executes the "tpu.projects.locations.acceleratorTypes.list" call.
  1379. // Exactly one of *ListAcceleratorTypesResponse or error will be
  1380. // non-nil. Any non-2xx status code is an error. Response headers are in
  1381. // either *ListAcceleratorTypesResponse.ServerResponse.Header or (if a
  1382. // response was returned at all) in error.(*googleapi.Error).Header. Use
  1383. // googleapi.IsNotModified to check whether the returned error was
  1384. // because http.StatusNotModified was returned.
  1385. func (c *ProjectsLocationsAcceleratorTypesListCall) Do(opts ...googleapi.CallOption) (*ListAcceleratorTypesResponse, error) {
  1386. gensupport.SetOptions(c.urlParams_, opts...)
  1387. res, err := c.doRequest("json")
  1388. if res != nil && res.StatusCode == http.StatusNotModified {
  1389. if res.Body != nil {
  1390. res.Body.Close()
  1391. }
  1392. return nil, &googleapi.Error{
  1393. Code: res.StatusCode,
  1394. Header: res.Header,
  1395. }
  1396. }
  1397. if err != nil {
  1398. return nil, err
  1399. }
  1400. defer googleapi.CloseBody(res)
  1401. if err := googleapi.CheckResponse(res); err != nil {
  1402. return nil, err
  1403. }
  1404. ret := &ListAcceleratorTypesResponse{
  1405. ServerResponse: googleapi.ServerResponse{
  1406. Header: res.Header,
  1407. HTTPStatusCode: res.StatusCode,
  1408. },
  1409. }
  1410. target := &ret
  1411. if err := gensupport.DecodeResponse(target, res); err != nil {
  1412. return nil, err
  1413. }
  1414. return ret, nil
  1415. // {
  1416. // "description": "Lists accelerator types supported by this API.",
  1417. // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/acceleratorTypes",
  1418. // "httpMethod": "GET",
  1419. // "id": "tpu.projects.locations.acceleratorTypes.list",
  1420. // "parameterOrder": [
  1421. // "parent"
  1422. // ],
  1423. // "parameters": {
  1424. // "filter": {
  1425. // "description": "List filter.",
  1426. // "location": "query",
  1427. // "type": "string"
  1428. // },
  1429. // "orderBy": {
  1430. // "description": "Sort results.",
  1431. // "location": "query",
  1432. // "type": "string"
  1433. // },
  1434. // "pageSize": {
  1435. // "description": "The maximum number of items to return.",
  1436. // "format": "int32",
  1437. // "location": "query",
  1438. // "type": "integer"
  1439. // },
  1440. // "pageToken": {
  1441. // "description": "The next_page_token value returned from a previous List request, if any.",
  1442. // "location": "query",
  1443. // "type": "string"
  1444. // },
  1445. // "parent": {
  1446. // "description": "The parent resource name.",
  1447. // "location": "path",
  1448. // "pattern": "^projects/[^/]+/locations/[^/]+$",
  1449. // "required": true,
  1450. // "type": "string"
  1451. // }
  1452. // },
  1453. // "path": "v1/{+parent}/acceleratorTypes",
  1454. // "response": {
  1455. // "$ref": "ListAcceleratorTypesResponse"
  1456. // },
  1457. // "scopes": [
  1458. // "https://www.googleapis.com/auth/cloud-platform"
  1459. // ]
  1460. // }
  1461. }
  1462. // Pages invokes f for each page of results.
  1463. // A non-nil error returned from f will halt the iteration.
  1464. // The provided context supersedes any context provided to the Context method.
  1465. func (c *ProjectsLocationsAcceleratorTypesListCall) Pages(ctx context.Context, f func(*ListAcceleratorTypesResponse) error) error {
  1466. c.ctx_ = ctx
  1467. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  1468. for {
  1469. x, err := c.Do()
  1470. if err != nil {
  1471. return err
  1472. }
  1473. if err := f(x); err != nil {
  1474. return err
  1475. }
  1476. if x.NextPageToken == "" {
  1477. return nil
  1478. }
  1479. c.PageToken(x.NextPageToken)
  1480. }
  1481. }
  1482. // method id "tpu.projects.locations.nodes.create":
  1483. type ProjectsLocationsNodesCreateCall struct {
  1484. s *Service
  1485. parent string
  1486. node *Node
  1487. urlParams_ gensupport.URLParams
  1488. ctx_ context.Context
  1489. header_ http.Header
  1490. }
  1491. // Create: Creates a node.
  1492. func (r *ProjectsLocationsNodesService) Create(parent string, node *Node) *ProjectsLocationsNodesCreateCall {
  1493. c := &ProjectsLocationsNodesCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1494. c.parent = parent
  1495. c.node = node
  1496. return c
  1497. }
  1498. // NodeId sets the optional parameter "nodeId": The unqualified resource
  1499. // name.
  1500. func (c *ProjectsLocationsNodesCreateCall) NodeId(nodeId string) *ProjectsLocationsNodesCreateCall {
  1501. c.urlParams_.Set("nodeId", nodeId)
  1502. return c
  1503. }
  1504. // Fields allows partial responses to be retrieved. See
  1505. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1506. // for more information.
  1507. func (c *ProjectsLocationsNodesCreateCall) Fields(s ...googleapi.Field) *ProjectsLocationsNodesCreateCall {
  1508. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1509. return c
  1510. }
  1511. // Context sets the context to be used in this call's Do method. Any
  1512. // pending HTTP request will be aborted if the provided context is
  1513. // canceled.
  1514. func (c *ProjectsLocationsNodesCreateCall) Context(ctx context.Context) *ProjectsLocationsNodesCreateCall {
  1515. c.ctx_ = ctx
  1516. return c
  1517. }
  1518. // Header returns an http.Header that can be modified by the caller to
  1519. // add HTTP headers to the request.
  1520. func (c *ProjectsLocationsNodesCreateCall) Header() http.Header {
  1521. if c.header_ == nil {
  1522. c.header_ = make(http.Header)
  1523. }
  1524. return c.header_
  1525. }
  1526. func (c *ProjectsLocationsNodesCreateCall) doRequest(alt string) (*http.Response, error) {
  1527. reqHeaders := make(http.Header)
  1528. for k, v := range c.header_ {
  1529. reqHeaders[k] = v
  1530. }
  1531. reqHeaders.Set("User-Agent", c.s.userAgent())
  1532. var body io.Reader = nil
  1533. body, err := googleapi.WithoutDataWrapper.JSONReader(c.node)
  1534. if err != nil {
  1535. return nil, err
  1536. }
  1537. reqHeaders.Set("Content-Type", "application/json")
  1538. c.urlParams_.Set("alt", alt)
  1539. c.urlParams_.Set("prettyPrint", "false")
  1540. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/nodes")
  1541. urls += "?" + c.urlParams_.Encode()
  1542. req, err := http.NewRequest("POST", urls, body)
  1543. if err != nil {
  1544. return nil, err
  1545. }
  1546. req.Header = reqHeaders
  1547. googleapi.Expand(req.URL, map[string]string{
  1548. "parent": c.parent,
  1549. })
  1550. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1551. }
  1552. // Do executes the "tpu.projects.locations.nodes.create" call.
  1553. // Exactly one of *Operation or error will be non-nil. Any non-2xx
  1554. // status code is an error. Response headers are in either
  1555. // *Operation.ServerResponse.Header or (if a response was returned at
  1556. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  1557. // to check whether the returned error was because
  1558. // http.StatusNotModified was returned.
  1559. func (c *ProjectsLocationsNodesCreateCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
  1560. gensupport.SetOptions(c.urlParams_, opts...)
  1561. res, err := c.doRequest("json")
  1562. if res != nil && res.StatusCode == http.StatusNotModified {
  1563. if res.Body != nil {
  1564. res.Body.Close()
  1565. }
  1566. return nil, &googleapi.Error{
  1567. Code: res.StatusCode,
  1568. Header: res.Header,
  1569. }
  1570. }
  1571. if err != nil {
  1572. return nil, err
  1573. }
  1574. defer googleapi.CloseBody(res)
  1575. if err := googleapi.CheckResponse(res); err != nil {
  1576. return nil, err
  1577. }
  1578. ret := &Operation{
  1579. ServerResponse: googleapi.ServerResponse{
  1580. Header: res.Header,
  1581. HTTPStatusCode: res.StatusCode,
  1582. },
  1583. }
  1584. target := &ret
  1585. if err := gensupport.DecodeResponse(target, res); err != nil {
  1586. return nil, err
  1587. }
  1588. return ret, nil
  1589. // {
  1590. // "description": "Creates a node.",
  1591. // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/nodes",
  1592. // "httpMethod": "POST",
  1593. // "id": "tpu.projects.locations.nodes.create",
  1594. // "parameterOrder": [
  1595. // "parent"
  1596. // ],
  1597. // "parameters": {
  1598. // "nodeId": {
  1599. // "description": "The unqualified resource name.",
  1600. // "location": "query",
  1601. // "type": "string"
  1602. // },
  1603. // "parent": {
  1604. // "description": "The parent resource name.",
  1605. // "location": "path",
  1606. // "pattern": "^projects/[^/]+/locations/[^/]+$",
  1607. // "required": true,
  1608. // "type": "string"
  1609. // }
  1610. // },
  1611. // "path": "v1/{+parent}/nodes",
  1612. // "request": {
  1613. // "$ref": "Node"
  1614. // },
  1615. // "response": {
  1616. // "$ref": "Operation"
  1617. // },
  1618. // "scopes": [
  1619. // "https://www.googleapis.com/auth/cloud-platform"
  1620. // ]
  1621. // }
  1622. }
  1623. // method id "tpu.projects.locations.nodes.delete":
  1624. type ProjectsLocationsNodesDeleteCall struct {
  1625. s *Service
  1626. name string
  1627. urlParams_ gensupport.URLParams
  1628. ctx_ context.Context
  1629. header_ http.Header
  1630. }
  1631. // Delete: Deletes a node.
  1632. func (r *ProjectsLocationsNodesService) Delete(name string) *ProjectsLocationsNodesDeleteCall {
  1633. c := &ProjectsLocationsNodesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1634. c.name = name
  1635. return c
  1636. }
  1637. // Fields allows partial responses to be retrieved. See
  1638. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1639. // for more information.
  1640. func (c *ProjectsLocationsNodesDeleteCall) Fields(s ...googleapi.Field) *ProjectsLocationsNodesDeleteCall {
  1641. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1642. return c
  1643. }
  1644. // Context sets the context to be used in this call's Do method. Any
  1645. // pending HTTP request will be aborted if the provided context is
  1646. // canceled.
  1647. func (c *ProjectsLocationsNodesDeleteCall) Context(ctx context.Context) *ProjectsLocationsNodesDeleteCall {
  1648. c.ctx_ = ctx
  1649. return c
  1650. }
  1651. // Header returns an http.Header that can be modified by the caller to
  1652. // add HTTP headers to the request.
  1653. func (c *ProjectsLocationsNodesDeleteCall) Header() http.Header {
  1654. if c.header_ == nil {
  1655. c.header_ = make(http.Header)
  1656. }
  1657. return c.header_
  1658. }
  1659. func (c *ProjectsLocationsNodesDeleteCall) doRequest(alt string) (*http.Response, error) {
  1660. reqHeaders := make(http.Header)
  1661. for k, v := range c.header_ {
  1662. reqHeaders[k] = v
  1663. }
  1664. reqHeaders.Set("User-Agent", c.s.userAgent())
  1665. var body io.Reader = nil
  1666. c.urlParams_.Set("alt", alt)
  1667. c.urlParams_.Set("prettyPrint", "false")
  1668. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  1669. urls += "?" + c.urlParams_.Encode()
  1670. req, err := http.NewRequest("DELETE", urls, body)
  1671. if err != nil {
  1672. return nil, err
  1673. }
  1674. req.Header = reqHeaders
  1675. googleapi.Expand(req.URL, map[string]string{
  1676. "name": c.name,
  1677. })
  1678. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1679. }
  1680. // Do executes the "tpu.projects.locations.nodes.delete" call.
  1681. // Exactly one of *Operation or error will be non-nil. Any non-2xx
  1682. // status code is an error. Response headers are in either
  1683. // *Operation.ServerResponse.Header or (if a response was returned at
  1684. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  1685. // to check whether the returned error was because
  1686. // http.StatusNotModified was returned.
  1687. func (c *ProjectsLocationsNodesDeleteCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
  1688. gensupport.SetOptions(c.urlParams_, opts...)
  1689. res, err := c.doRequest("json")
  1690. if res != nil && res.StatusCode == http.StatusNotModified {
  1691. if res.Body != nil {
  1692. res.Body.Close()
  1693. }
  1694. return nil, &googleapi.Error{
  1695. Code: res.StatusCode,
  1696. Header: res.Header,
  1697. }
  1698. }
  1699. if err != nil {
  1700. return nil, err
  1701. }
  1702. defer googleapi.CloseBody(res)
  1703. if err := googleapi.CheckResponse(res); err != nil {
  1704. return nil, err
  1705. }
  1706. ret := &Operation{
  1707. ServerResponse: googleapi.ServerResponse{
  1708. Header: res.Header,
  1709. HTTPStatusCode: res.StatusCode,
  1710. },
  1711. }
  1712. target := &ret
  1713. if err := gensupport.DecodeResponse(target, res); err != nil {
  1714. return nil, err
  1715. }
  1716. return ret, nil
  1717. // {
  1718. // "description": "Deletes a node.",
  1719. // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/nodes/{nodesId}",
  1720. // "httpMethod": "DELETE",
  1721. // "id": "tpu.projects.locations.nodes.delete",
  1722. // "parameterOrder": [
  1723. // "name"
  1724. // ],
  1725. // "parameters": {
  1726. // "name": {
  1727. // "description": "The resource name.",
  1728. // "location": "path",
  1729. // "pattern": "^projects/[^/]+/locations/[^/]+/nodes/[^/]+$",
  1730. // "required": true,
  1731. // "type": "string"
  1732. // }
  1733. // },
  1734. // "path": "v1/{+name}",
  1735. // "response": {
  1736. // "$ref": "Operation"
  1737. // },
  1738. // "scopes": [
  1739. // "https://www.googleapis.com/auth/cloud-platform"
  1740. // ]
  1741. // }
  1742. }
  1743. // method id "tpu.projects.locations.nodes.get":
  1744. type ProjectsLocationsNodesGetCall struct {
  1745. s *Service
  1746. name string
  1747. urlParams_ gensupport.URLParams
  1748. ifNoneMatch_ string
  1749. ctx_ context.Context
  1750. header_ http.Header
  1751. }
  1752. // Get: Gets the details of a node.
  1753. func (r *ProjectsLocationsNodesService) Get(name string) *ProjectsLocationsNodesGetCall {
  1754. c := &ProjectsLocationsNodesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1755. c.name = name
  1756. return c
  1757. }
  1758. // Fields allows partial responses to be retrieved. See
  1759. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1760. // for more information.
  1761. func (c *ProjectsLocationsNodesGetCall) Fields(s ...googleapi.Field) *ProjectsLocationsNodesGetCall {
  1762. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1763. return c
  1764. }
  1765. // IfNoneMatch sets the optional parameter which makes the operation
  1766. // fail if the object's ETag matches the given value. This is useful for
  1767. // getting updates only after the object has changed since the last
  1768. // request. Use googleapi.IsNotModified to check whether the response
  1769. // error from Do is the result of In-None-Match.
  1770. func (c *ProjectsLocationsNodesGetCall) IfNoneMatch(entityTag string) *ProjectsLocationsNodesGetCall {
  1771. c.ifNoneMatch_ = entityTag
  1772. return c
  1773. }
  1774. // Context sets the context to be used in this call's Do method. Any
  1775. // pending HTTP request will be aborted if the provided context is
  1776. // canceled.
  1777. func (c *ProjectsLocationsNodesGetCall) Context(ctx context.Context) *ProjectsLocationsNodesGetCall {
  1778. c.ctx_ = ctx
  1779. return c
  1780. }
  1781. // Header returns an http.Header that can be modified by the caller to
  1782. // add HTTP headers to the request.
  1783. func (c *ProjectsLocationsNodesGetCall) Header() http.Header {
  1784. if c.header_ == nil {
  1785. c.header_ = make(http.Header)
  1786. }
  1787. return c.header_
  1788. }
  1789. func (c *ProjectsLocationsNodesGetCall) doRequest(alt string) (*http.Response, error) {
  1790. reqHeaders := make(http.Header)
  1791. for k, v := range c.header_ {
  1792. reqHeaders[k] = v
  1793. }
  1794. reqHeaders.Set("User-Agent", c.s.userAgent())
  1795. if c.ifNoneMatch_ != "" {
  1796. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1797. }
  1798. var body io.Reader = nil
  1799. c.urlParams_.Set("alt", alt)
  1800. c.urlParams_.Set("prettyPrint", "false")
  1801. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  1802. urls += "?" + c.urlParams_.Encode()
  1803. req, err := http.NewRequest("GET", urls, body)
  1804. if err != nil {
  1805. return nil, err
  1806. }
  1807. req.Header = reqHeaders
  1808. googleapi.Expand(req.URL, map[string]string{
  1809. "name": c.name,
  1810. })
  1811. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1812. }
  1813. // Do executes the "tpu.projects.locations.nodes.get" call.
  1814. // Exactly one of *Node or error will be non-nil. Any non-2xx status
  1815. // code is an error. Response headers are in either
  1816. // *Node.ServerResponse.Header or (if a response was returned at all) in
  1817. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  1818. // whether the returned error was because http.StatusNotModified was
  1819. // returned.
  1820. func (c *ProjectsLocationsNodesGetCall) Do(opts ...googleapi.CallOption) (*Node, error) {
  1821. gensupport.SetOptions(c.urlParams_, opts...)
  1822. res, err := c.doRequest("json")
  1823. if res != nil && res.StatusCode == http.StatusNotModified {
  1824. if res.Body != nil {
  1825. res.Body.Close()
  1826. }
  1827. return nil, &googleapi.Error{
  1828. Code: res.StatusCode,
  1829. Header: res.Header,
  1830. }
  1831. }
  1832. if err != nil {
  1833. return nil, err
  1834. }
  1835. defer googleapi.CloseBody(res)
  1836. if err := googleapi.CheckResponse(res); err != nil {
  1837. return nil, err
  1838. }
  1839. ret := &Node{
  1840. ServerResponse: googleapi.ServerResponse{
  1841. Header: res.Header,
  1842. HTTPStatusCode: res.StatusCode,
  1843. },
  1844. }
  1845. target := &ret
  1846. if err := gensupport.DecodeResponse(target, res); err != nil {
  1847. return nil, err
  1848. }
  1849. return ret, nil
  1850. // {
  1851. // "description": "Gets the details of a node.",
  1852. // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/nodes/{nodesId}",
  1853. // "httpMethod": "GET",
  1854. // "id": "tpu.projects.locations.nodes.get",
  1855. // "parameterOrder": [
  1856. // "name"
  1857. // ],
  1858. // "parameters": {
  1859. // "name": {
  1860. // "description": "The resource name.",
  1861. // "location": "path",
  1862. // "pattern": "^projects/[^/]+/locations/[^/]+/nodes/[^/]+$",
  1863. // "required": true,
  1864. // "type": "string"
  1865. // }
  1866. // },
  1867. // "path": "v1/{+name}",
  1868. // "response": {
  1869. // "$ref": "Node"
  1870. // },
  1871. // "scopes": [
  1872. // "https://www.googleapis.com/auth/cloud-platform"
  1873. // ]
  1874. // }
  1875. }
  1876. // method id "tpu.projects.locations.nodes.list":
  1877. type ProjectsLocationsNodesListCall struct {
  1878. s *Service
  1879. parent string
  1880. urlParams_ gensupport.URLParams
  1881. ifNoneMatch_ string
  1882. ctx_ context.Context
  1883. header_ http.Header
  1884. }
  1885. // List: Lists nodes.
  1886. func (r *ProjectsLocationsNodesService) List(parent string) *ProjectsLocationsNodesListCall {
  1887. c := &ProjectsLocationsNodesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1888. c.parent = parent
  1889. return c
  1890. }
  1891. // PageSize sets the optional parameter "pageSize": The maximum number
  1892. // of items to return.
  1893. func (c *ProjectsLocationsNodesListCall) PageSize(pageSize int64) *ProjectsLocationsNodesListCall {
  1894. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  1895. return c
  1896. }
  1897. // PageToken sets the optional parameter "pageToken": The
  1898. // next_page_token value returned from a previous List request, if any.
  1899. func (c *ProjectsLocationsNodesListCall) PageToken(pageToken string) *ProjectsLocationsNodesListCall {
  1900. c.urlParams_.Set("pageToken", pageToken)
  1901. return c
  1902. }
  1903. // Fields allows partial responses to be retrieved. See
  1904. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1905. // for more information.
  1906. func (c *ProjectsLocationsNodesListCall) Fields(s ...googleapi.Field) *ProjectsLocationsNodesListCall {
  1907. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1908. return c
  1909. }
  1910. // IfNoneMatch sets the optional parameter which makes the operation
  1911. // fail if the object's ETag matches the given value. This is useful for
  1912. // getting updates only after the object has changed since the last
  1913. // request. Use googleapi.IsNotModified to check whether the response
  1914. // error from Do is the result of In-None-Match.
  1915. func (c *ProjectsLocationsNodesListCall) IfNoneMatch(entityTag string) *ProjectsLocationsNodesListCall {
  1916. c.ifNoneMatch_ = entityTag
  1917. return c
  1918. }
  1919. // Context sets the context to be used in this call's Do method. Any
  1920. // pending HTTP request will be aborted if the provided context is
  1921. // canceled.
  1922. func (c *ProjectsLocationsNodesListCall) Context(ctx context.Context) *ProjectsLocationsNodesListCall {
  1923. c.ctx_ = ctx
  1924. return c
  1925. }
  1926. // Header returns an http.Header that can be modified by the caller to
  1927. // add HTTP headers to the request.
  1928. func (c *ProjectsLocationsNodesListCall) Header() http.Header {
  1929. if c.header_ == nil {
  1930. c.header_ = make(http.Header)
  1931. }
  1932. return c.header_
  1933. }
  1934. func (c *ProjectsLocationsNodesListCall) doRequest(alt string) (*http.Response, error) {
  1935. reqHeaders := make(http.Header)
  1936. for k, v := range c.header_ {
  1937. reqHeaders[k] = v
  1938. }
  1939. reqHeaders.Set("User-Agent", c.s.userAgent())
  1940. if c.ifNoneMatch_ != "" {
  1941. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1942. }
  1943. var body io.Reader = nil
  1944. c.urlParams_.Set("alt", alt)
  1945. c.urlParams_.Set("prettyPrint", "false")
  1946. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/nodes")
  1947. urls += "?" + c.urlParams_.Encode()
  1948. req, err := http.NewRequest("GET", urls, body)
  1949. if err != nil {
  1950. return nil, err
  1951. }
  1952. req.Header = reqHeaders
  1953. googleapi.Expand(req.URL, map[string]string{
  1954. "parent": c.parent,
  1955. })
  1956. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1957. }
  1958. // Do executes the "tpu.projects.locations.nodes.list" call.
  1959. // Exactly one of *ListNodesResponse or error will be non-nil. Any
  1960. // non-2xx status code is an error. Response headers are in either
  1961. // *ListNodesResponse.ServerResponse.Header or (if a response was
  1962. // returned at all) in error.(*googleapi.Error).Header. Use
  1963. // googleapi.IsNotModified to check whether the returned error was
  1964. // because http.StatusNotModified was returned.
  1965. func (c *ProjectsLocationsNodesListCall) Do(opts ...googleapi.CallOption) (*ListNodesResponse, error) {
  1966. gensupport.SetOptions(c.urlParams_, opts...)
  1967. res, err := c.doRequest("json")
  1968. if res != nil && res.StatusCode == http.StatusNotModified {
  1969. if res.Body != nil {
  1970. res.Body.Close()
  1971. }
  1972. return nil, &googleapi.Error{
  1973. Code: res.StatusCode,
  1974. Header: res.Header,
  1975. }
  1976. }
  1977. if err != nil {
  1978. return nil, err
  1979. }
  1980. defer googleapi.CloseBody(res)
  1981. if err := googleapi.CheckResponse(res); err != nil {
  1982. return nil, err
  1983. }
  1984. ret := &ListNodesResponse{
  1985. ServerResponse: googleapi.ServerResponse{
  1986. Header: res.Header,
  1987. HTTPStatusCode: res.StatusCode,
  1988. },
  1989. }
  1990. target := &ret
  1991. if err := gensupport.DecodeResponse(target, res); err != nil {
  1992. return nil, err
  1993. }
  1994. return ret, nil
  1995. // {
  1996. // "description": "Lists nodes.",
  1997. // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/nodes",
  1998. // "httpMethod": "GET",
  1999. // "id": "tpu.projects.locations.nodes.list",
  2000. // "parameterOrder": [
  2001. // "parent"
  2002. // ],
  2003. // "parameters": {
  2004. // "pageSize": {
  2005. // "description": "The maximum number of items to return.",
  2006. // "format": "int32",
  2007. // "location": "query",
  2008. // "type": "integer"
  2009. // },
  2010. // "pageToken": {
  2011. // "description": "The next_page_token value returned from a previous List request, if any.",
  2012. // "location": "query",
  2013. // "type": "string"
  2014. // },
  2015. // "parent": {
  2016. // "description": "The parent resource name.",
  2017. // "location": "path",
  2018. // "pattern": "^projects/[^/]+/locations/[^/]+$",
  2019. // "required": true,
  2020. // "type": "string"
  2021. // }
  2022. // },
  2023. // "path": "v1/{+parent}/nodes",
  2024. // "response": {
  2025. // "$ref": "ListNodesResponse"
  2026. // },
  2027. // "scopes": [
  2028. // "https://www.googleapis.com/auth/cloud-platform"
  2029. // ]
  2030. // }
  2031. }
  2032. // Pages invokes f for each page of results.
  2033. // A non-nil error returned from f will halt the iteration.
  2034. // The provided context supersedes any context provided to the Context method.
  2035. func (c *ProjectsLocationsNodesListCall) Pages(ctx context.Context, f func(*ListNodesResponse) error) error {
  2036. c.ctx_ = ctx
  2037. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  2038. for {
  2039. x, err := c.Do()
  2040. if err != nil {
  2041. return err
  2042. }
  2043. if err := f(x); err != nil {
  2044. return err
  2045. }
  2046. if x.NextPageToken == "" {
  2047. return nil
  2048. }
  2049. c.PageToken(x.NextPageToken)
  2050. }
  2051. }
  2052. // method id "tpu.projects.locations.nodes.reimage":
  2053. type ProjectsLocationsNodesReimageCall struct {
  2054. s *Service
  2055. name string
  2056. reimagenoderequest *ReimageNodeRequest
  2057. urlParams_ gensupport.URLParams
  2058. ctx_ context.Context
  2059. header_ http.Header
  2060. }
  2061. // Reimage: Reimages a node's OS.
  2062. func (r *ProjectsLocationsNodesService) Reimage(name string, reimagenoderequest *ReimageNodeRequest) *ProjectsLocationsNodesReimageCall {
  2063. c := &ProjectsLocationsNodesReimageCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2064. c.name = name
  2065. c.reimagenoderequest = reimagenoderequest
  2066. return c
  2067. }
  2068. // Fields allows partial responses to be retrieved. See
  2069. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2070. // for more information.
  2071. func (c *ProjectsLocationsNodesReimageCall) Fields(s ...googleapi.Field) *ProjectsLocationsNodesReimageCall {
  2072. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2073. return c
  2074. }
  2075. // Context sets the context to be used in this call's Do method. Any
  2076. // pending HTTP request will be aborted if the provided context is
  2077. // canceled.
  2078. func (c *ProjectsLocationsNodesReimageCall) Context(ctx context.Context) *ProjectsLocationsNodesReimageCall {
  2079. c.ctx_ = ctx
  2080. return c
  2081. }
  2082. // Header returns an http.Header that can be modified by the caller to
  2083. // add HTTP headers to the request.
  2084. func (c *ProjectsLocationsNodesReimageCall) Header() http.Header {
  2085. if c.header_ == nil {
  2086. c.header_ = make(http.Header)
  2087. }
  2088. return c.header_
  2089. }
  2090. func (c *ProjectsLocationsNodesReimageCall) doRequest(alt string) (*http.Response, error) {
  2091. reqHeaders := make(http.Header)
  2092. for k, v := range c.header_ {
  2093. reqHeaders[k] = v
  2094. }
  2095. reqHeaders.Set("User-Agent", c.s.userAgent())
  2096. var body io.Reader = nil
  2097. body, err := googleapi.WithoutDataWrapper.JSONReader(c.reimagenoderequest)
  2098. if err != nil {
  2099. return nil, err
  2100. }
  2101. reqHeaders.Set("Content-Type", "application/json")
  2102. c.urlParams_.Set("alt", alt)
  2103. c.urlParams_.Set("prettyPrint", "false")
  2104. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}:reimage")
  2105. urls += "?" + c.urlParams_.Encode()
  2106. req, err := http.NewRequest("POST", urls, body)
  2107. if err != nil {
  2108. return nil, err
  2109. }
  2110. req.Header = reqHeaders
  2111. googleapi.Expand(req.URL, map[string]string{
  2112. "name": c.name,
  2113. })
  2114. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2115. }
  2116. // Do executes the "tpu.projects.locations.nodes.reimage" call.
  2117. // Exactly one of *Operation or error will be non-nil. Any non-2xx
  2118. // status code is an error. Response headers are in either
  2119. // *Operation.ServerResponse.Header or (if a response was returned at
  2120. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  2121. // to check whether the returned error was because
  2122. // http.StatusNotModified was returned.
  2123. func (c *ProjectsLocationsNodesReimageCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
  2124. gensupport.SetOptions(c.urlParams_, opts...)
  2125. res, err := c.doRequest("json")
  2126. if res != nil && res.StatusCode == http.StatusNotModified {
  2127. if res.Body != nil {
  2128. res.Body.Close()
  2129. }
  2130. return nil, &googleapi.Error{
  2131. Code: res.StatusCode,
  2132. Header: res.Header,
  2133. }
  2134. }
  2135. if err != nil {
  2136. return nil, err
  2137. }
  2138. defer googleapi.CloseBody(res)
  2139. if err := googleapi.CheckResponse(res); err != nil {
  2140. return nil, err
  2141. }
  2142. ret := &Operation{
  2143. ServerResponse: googleapi.ServerResponse{
  2144. Header: res.Header,
  2145. HTTPStatusCode: res.StatusCode,
  2146. },
  2147. }
  2148. target := &ret
  2149. if err := gensupport.DecodeResponse(target, res); err != nil {
  2150. return nil, err
  2151. }
  2152. return ret, nil
  2153. // {
  2154. // "description": "Reimages a node's OS.",
  2155. // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/nodes/{nodesId}:reimage",
  2156. // "httpMethod": "POST",
  2157. // "id": "tpu.projects.locations.nodes.reimage",
  2158. // "parameterOrder": [
  2159. // "name"
  2160. // ],
  2161. // "parameters": {
  2162. // "name": {
  2163. // "description": "The resource name.",
  2164. // "location": "path",
  2165. // "pattern": "^projects/[^/]+/locations/[^/]+/nodes/[^/]+$",
  2166. // "required": true,
  2167. // "type": "string"
  2168. // }
  2169. // },
  2170. // "path": "v1/{+name}:reimage",
  2171. // "request": {
  2172. // "$ref": "ReimageNodeRequest"
  2173. // },
  2174. // "response": {
  2175. // "$ref": "Operation"
  2176. // },
  2177. // "scopes": [
  2178. // "https://www.googleapis.com/auth/cloud-platform"
  2179. // ]
  2180. // }
  2181. }
  2182. // method id "tpu.projects.locations.nodes.start":
  2183. type ProjectsLocationsNodesStartCall struct {
  2184. s *Service
  2185. name string
  2186. startnoderequest *StartNodeRequest
  2187. urlParams_ gensupport.URLParams
  2188. ctx_ context.Context
  2189. header_ http.Header
  2190. }
  2191. // Start: Starts a node.
  2192. func (r *ProjectsLocationsNodesService) Start(name string, startnoderequest *StartNodeRequest) *ProjectsLocationsNodesStartCall {
  2193. c := &ProjectsLocationsNodesStartCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2194. c.name = name
  2195. c.startnoderequest = startnoderequest
  2196. return c
  2197. }
  2198. // Fields allows partial responses to be retrieved. See
  2199. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2200. // for more information.
  2201. func (c *ProjectsLocationsNodesStartCall) Fields(s ...googleapi.Field) *ProjectsLocationsNodesStartCall {
  2202. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2203. return c
  2204. }
  2205. // Context sets the context to be used in this call's Do method. Any
  2206. // pending HTTP request will be aborted if the provided context is
  2207. // canceled.
  2208. func (c *ProjectsLocationsNodesStartCall) Context(ctx context.Context) *ProjectsLocationsNodesStartCall {
  2209. c.ctx_ = ctx
  2210. return c
  2211. }
  2212. // Header returns an http.Header that can be modified by the caller to
  2213. // add HTTP headers to the request.
  2214. func (c *ProjectsLocationsNodesStartCall) Header() http.Header {
  2215. if c.header_ == nil {
  2216. c.header_ = make(http.Header)
  2217. }
  2218. return c.header_
  2219. }
  2220. func (c *ProjectsLocationsNodesStartCall) doRequest(alt string) (*http.Response, error) {
  2221. reqHeaders := make(http.Header)
  2222. for k, v := range c.header_ {
  2223. reqHeaders[k] = v
  2224. }
  2225. reqHeaders.Set("User-Agent", c.s.userAgent())
  2226. var body io.Reader = nil
  2227. body, err := googleapi.WithoutDataWrapper.JSONReader(c.startnoderequest)
  2228. if err != nil {
  2229. return nil, err
  2230. }
  2231. reqHeaders.Set("Content-Type", "application/json")
  2232. c.urlParams_.Set("alt", alt)
  2233. c.urlParams_.Set("prettyPrint", "false")
  2234. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}:start")
  2235. urls += "?" + c.urlParams_.Encode()
  2236. req, err := http.NewRequest("POST", urls, body)
  2237. if err != nil {
  2238. return nil, err
  2239. }
  2240. req.Header = reqHeaders
  2241. googleapi.Expand(req.URL, map[string]string{
  2242. "name": c.name,
  2243. })
  2244. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2245. }
  2246. // Do executes the "tpu.projects.locations.nodes.start" call.
  2247. // Exactly one of *Operation or error will be non-nil. Any non-2xx
  2248. // status code is an error. Response headers are in either
  2249. // *Operation.ServerResponse.Header or (if a response was returned at
  2250. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  2251. // to check whether the returned error was because
  2252. // http.StatusNotModified was returned.
  2253. func (c *ProjectsLocationsNodesStartCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
  2254. gensupport.SetOptions(c.urlParams_, opts...)
  2255. res, err := c.doRequest("json")
  2256. if res != nil && res.StatusCode == http.StatusNotModified {
  2257. if res.Body != nil {
  2258. res.Body.Close()
  2259. }
  2260. return nil, &googleapi.Error{
  2261. Code: res.StatusCode,
  2262. Header: res.Header,
  2263. }
  2264. }
  2265. if err != nil {
  2266. return nil, err
  2267. }
  2268. defer googleapi.CloseBody(res)
  2269. if err := googleapi.CheckResponse(res); err != nil {
  2270. return nil, err
  2271. }
  2272. ret := &Operation{
  2273. ServerResponse: googleapi.ServerResponse{
  2274. Header: res.Header,
  2275. HTTPStatusCode: res.StatusCode,
  2276. },
  2277. }
  2278. target := &ret
  2279. if err := gensupport.DecodeResponse(target, res); err != nil {
  2280. return nil, err
  2281. }
  2282. return ret, nil
  2283. // {
  2284. // "description": "Starts a node.",
  2285. // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/nodes/{nodesId}:start",
  2286. // "httpMethod": "POST",
  2287. // "id": "tpu.projects.locations.nodes.start",
  2288. // "parameterOrder": [
  2289. // "name"
  2290. // ],
  2291. // "parameters": {
  2292. // "name": {
  2293. // "description": "The resource name.",
  2294. // "location": "path",
  2295. // "pattern": "^projects/[^/]+/locations/[^/]+/nodes/[^/]+$",
  2296. // "required": true,
  2297. // "type": "string"
  2298. // }
  2299. // },
  2300. // "path": "v1/{+name}:start",
  2301. // "request": {
  2302. // "$ref": "StartNodeRequest"
  2303. // },
  2304. // "response": {
  2305. // "$ref": "Operation"
  2306. // },
  2307. // "scopes": [
  2308. // "https://www.googleapis.com/auth/cloud-platform"
  2309. // ]
  2310. // }
  2311. }
  2312. // method id "tpu.projects.locations.nodes.stop":
  2313. type ProjectsLocationsNodesStopCall struct {
  2314. s *Service
  2315. name string
  2316. stopnoderequest *StopNodeRequest
  2317. urlParams_ gensupport.URLParams
  2318. ctx_ context.Context
  2319. header_ http.Header
  2320. }
  2321. // Stop: Stops a node.
  2322. func (r *ProjectsLocationsNodesService) Stop(name string, stopnoderequest *StopNodeRequest) *ProjectsLocationsNodesStopCall {
  2323. c := &ProjectsLocationsNodesStopCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2324. c.name = name
  2325. c.stopnoderequest = stopnoderequest
  2326. return c
  2327. }
  2328. // Fields allows partial responses to be retrieved. See
  2329. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2330. // for more information.
  2331. func (c *ProjectsLocationsNodesStopCall) Fields(s ...googleapi.Field) *ProjectsLocationsNodesStopCall {
  2332. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2333. return c
  2334. }
  2335. // Context sets the context to be used in this call's Do method. Any
  2336. // pending HTTP request will be aborted if the provided context is
  2337. // canceled.
  2338. func (c *ProjectsLocationsNodesStopCall) Context(ctx context.Context) *ProjectsLocationsNodesStopCall {
  2339. c.ctx_ = ctx
  2340. return c
  2341. }
  2342. // Header returns an http.Header that can be modified by the caller to
  2343. // add HTTP headers to the request.
  2344. func (c *ProjectsLocationsNodesStopCall) Header() http.Header {
  2345. if c.header_ == nil {
  2346. c.header_ = make(http.Header)
  2347. }
  2348. return c.header_
  2349. }
  2350. func (c *ProjectsLocationsNodesStopCall) doRequest(alt string) (*http.Response, error) {
  2351. reqHeaders := make(http.Header)
  2352. for k, v := range c.header_ {
  2353. reqHeaders[k] = v
  2354. }
  2355. reqHeaders.Set("User-Agent", c.s.userAgent())
  2356. var body io.Reader = nil
  2357. body, err := googleapi.WithoutDataWrapper.JSONReader(c.stopnoderequest)
  2358. if err != nil {
  2359. return nil, err
  2360. }
  2361. reqHeaders.Set("Content-Type", "application/json")
  2362. c.urlParams_.Set("alt", alt)
  2363. c.urlParams_.Set("prettyPrint", "false")
  2364. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}:stop")
  2365. urls += "?" + c.urlParams_.Encode()
  2366. req, err := http.NewRequest("POST", urls, body)
  2367. if err != nil {
  2368. return nil, err
  2369. }
  2370. req.Header = reqHeaders
  2371. googleapi.Expand(req.URL, map[string]string{
  2372. "name": c.name,
  2373. })
  2374. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2375. }
  2376. // Do executes the "tpu.projects.locations.nodes.stop" call.
  2377. // Exactly one of *Operation or error will be non-nil. Any non-2xx
  2378. // status code is an error. Response headers are in either
  2379. // *Operation.ServerResponse.Header or (if a response was returned at
  2380. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  2381. // to check whether the returned error was because
  2382. // http.StatusNotModified was returned.
  2383. func (c *ProjectsLocationsNodesStopCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
  2384. gensupport.SetOptions(c.urlParams_, opts...)
  2385. res, err := c.doRequest("json")
  2386. if res != nil && res.StatusCode == http.StatusNotModified {
  2387. if res.Body != nil {
  2388. res.Body.Close()
  2389. }
  2390. return nil, &googleapi.Error{
  2391. Code: res.StatusCode,
  2392. Header: res.Header,
  2393. }
  2394. }
  2395. if err != nil {
  2396. return nil, err
  2397. }
  2398. defer googleapi.CloseBody(res)
  2399. if err := googleapi.CheckResponse(res); err != nil {
  2400. return nil, err
  2401. }
  2402. ret := &Operation{
  2403. ServerResponse: googleapi.ServerResponse{
  2404. Header: res.Header,
  2405. HTTPStatusCode: res.StatusCode,
  2406. },
  2407. }
  2408. target := &ret
  2409. if err := gensupport.DecodeResponse(target, res); err != nil {
  2410. return nil, err
  2411. }
  2412. return ret, nil
  2413. // {
  2414. // "description": "Stops a node.",
  2415. // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/nodes/{nodesId}:stop",
  2416. // "httpMethod": "POST",
  2417. // "id": "tpu.projects.locations.nodes.stop",
  2418. // "parameterOrder": [
  2419. // "name"
  2420. // ],
  2421. // "parameters": {
  2422. // "name": {
  2423. // "description": "The resource name.",
  2424. // "location": "path",
  2425. // "pattern": "^projects/[^/]+/locations/[^/]+/nodes/[^/]+$",
  2426. // "required": true,
  2427. // "type": "string"
  2428. // }
  2429. // },
  2430. // "path": "v1/{+name}:stop",
  2431. // "request": {
  2432. // "$ref": "StopNodeRequest"
  2433. // },
  2434. // "response": {
  2435. // "$ref": "Operation"
  2436. // },
  2437. // "scopes": [
  2438. // "https://www.googleapis.com/auth/cloud-platform"
  2439. // ]
  2440. // }
  2441. }
  2442. // method id "tpu.projects.locations.operations.cancel":
  2443. type ProjectsLocationsOperationsCancelCall struct {
  2444. s *Service
  2445. name string
  2446. urlParams_ gensupport.URLParams
  2447. ctx_ context.Context
  2448. header_ http.Header
  2449. }
  2450. // Cancel: Starts asynchronous cancellation on a long-running operation.
  2451. // The server
  2452. // makes a best effort to cancel the operation, but success is
  2453. // not
  2454. // guaranteed. If the server doesn't support this method, it
  2455. // returns
  2456. // `google.rpc.Code.UNIMPLEMENTED`. Clients can
  2457. // use
  2458. // Operations.GetOperation or
  2459. // other methods to check whether the cancellation succeeded or whether
  2460. // the
  2461. // operation completed despite cancellation. On successful
  2462. // cancellation,
  2463. // the operation is not deleted; instead, it becomes an operation
  2464. // with
  2465. // an Operation.error value with a google.rpc.Status.code of
  2466. // 1,
  2467. // corresponding to `Code.CANCELLED`.
  2468. func (r *ProjectsLocationsOperationsService) Cancel(name string) *ProjectsLocationsOperationsCancelCall {
  2469. c := &ProjectsLocationsOperationsCancelCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2470. c.name = name
  2471. return c
  2472. }
  2473. // Fields allows partial responses to be retrieved. See
  2474. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2475. // for more information.
  2476. func (c *ProjectsLocationsOperationsCancelCall) Fields(s ...googleapi.Field) *ProjectsLocationsOperationsCancelCall {
  2477. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2478. return c
  2479. }
  2480. // Context sets the context to be used in this call's Do method. Any
  2481. // pending HTTP request will be aborted if the provided context is
  2482. // canceled.
  2483. func (c *ProjectsLocationsOperationsCancelCall) Context(ctx context.Context) *ProjectsLocationsOperationsCancelCall {
  2484. c.ctx_ = ctx
  2485. return c
  2486. }
  2487. // Header returns an http.Header that can be modified by the caller to
  2488. // add HTTP headers to the request.
  2489. func (c *ProjectsLocationsOperationsCancelCall) Header() http.Header {
  2490. if c.header_ == nil {
  2491. c.header_ = make(http.Header)
  2492. }
  2493. return c.header_
  2494. }
  2495. func (c *ProjectsLocationsOperationsCancelCall) doRequest(alt string) (*http.Response, error) {
  2496. reqHeaders := make(http.Header)
  2497. for k, v := range c.header_ {
  2498. reqHeaders[k] = v
  2499. }
  2500. reqHeaders.Set("User-Agent", c.s.userAgent())
  2501. var body io.Reader = nil
  2502. c.urlParams_.Set("alt", alt)
  2503. c.urlParams_.Set("prettyPrint", "false")
  2504. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}:cancel")
  2505. urls += "?" + c.urlParams_.Encode()
  2506. req, err := http.NewRequest("POST", urls, body)
  2507. if err != nil {
  2508. return nil, err
  2509. }
  2510. req.Header = reqHeaders
  2511. googleapi.Expand(req.URL, map[string]string{
  2512. "name": c.name,
  2513. })
  2514. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2515. }
  2516. // Do executes the "tpu.projects.locations.operations.cancel" call.
  2517. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  2518. // code is an error. Response headers are in either
  2519. // *Empty.ServerResponse.Header or (if a response was returned at all)
  2520. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2521. // check whether the returned error was because http.StatusNotModified
  2522. // was returned.
  2523. func (c *ProjectsLocationsOperationsCancelCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  2524. gensupport.SetOptions(c.urlParams_, opts...)
  2525. res, err := c.doRequest("json")
  2526. if res != nil && res.StatusCode == http.StatusNotModified {
  2527. if res.Body != nil {
  2528. res.Body.Close()
  2529. }
  2530. return nil, &googleapi.Error{
  2531. Code: res.StatusCode,
  2532. Header: res.Header,
  2533. }
  2534. }
  2535. if err != nil {
  2536. return nil, err
  2537. }
  2538. defer googleapi.CloseBody(res)
  2539. if err := googleapi.CheckResponse(res); err != nil {
  2540. return nil, err
  2541. }
  2542. ret := &Empty{
  2543. ServerResponse: googleapi.ServerResponse{
  2544. Header: res.Header,
  2545. HTTPStatusCode: res.StatusCode,
  2546. },
  2547. }
  2548. target := &ret
  2549. if err := gensupport.DecodeResponse(target, res); err != nil {
  2550. return nil, err
  2551. }
  2552. return ret, nil
  2553. // {
  2554. // "description": "Starts asynchronous cancellation on a long-running operation. The server\nmakes a best effort to cancel the operation, but success is not\nguaranteed. If the server doesn't support this method, it returns\n`google.rpc.Code.UNIMPLEMENTED`. Clients can use\nOperations.GetOperation or\nother methods to check whether the cancellation succeeded or whether the\noperation completed despite cancellation. On successful cancellation,\nthe operation is not deleted; instead, it becomes an operation with\nan Operation.error value with a google.rpc.Status.code of 1,\ncorresponding to `Code.CANCELLED`.",
  2555. // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/operations/{operationsId}:cancel",
  2556. // "httpMethod": "POST",
  2557. // "id": "tpu.projects.locations.operations.cancel",
  2558. // "parameterOrder": [
  2559. // "name"
  2560. // ],
  2561. // "parameters": {
  2562. // "name": {
  2563. // "description": "The name of the operation resource to be cancelled.",
  2564. // "location": "path",
  2565. // "pattern": "^projects/[^/]+/locations/[^/]+/operations/[^/]+$",
  2566. // "required": true,
  2567. // "type": "string"
  2568. // }
  2569. // },
  2570. // "path": "v1/{+name}:cancel",
  2571. // "response": {
  2572. // "$ref": "Empty"
  2573. // },
  2574. // "scopes": [
  2575. // "https://www.googleapis.com/auth/cloud-platform"
  2576. // ]
  2577. // }
  2578. }
  2579. // method id "tpu.projects.locations.operations.delete":
  2580. type ProjectsLocationsOperationsDeleteCall struct {
  2581. s *Service
  2582. name string
  2583. urlParams_ gensupport.URLParams
  2584. ctx_ context.Context
  2585. header_ http.Header
  2586. }
  2587. // Delete: Deletes a long-running operation. This method indicates that
  2588. // the client is
  2589. // no longer interested in the operation result. It does not cancel
  2590. // the
  2591. // operation. If the server doesn't support this method, it
  2592. // returns
  2593. // `google.rpc.Code.UNIMPLEMENTED`.
  2594. func (r *ProjectsLocationsOperationsService) Delete(name string) *ProjectsLocationsOperationsDeleteCall {
  2595. c := &ProjectsLocationsOperationsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2596. c.name = name
  2597. return c
  2598. }
  2599. // Fields allows partial responses to be retrieved. See
  2600. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2601. // for more information.
  2602. func (c *ProjectsLocationsOperationsDeleteCall) Fields(s ...googleapi.Field) *ProjectsLocationsOperationsDeleteCall {
  2603. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2604. return c
  2605. }
  2606. // Context sets the context to be used in this call's Do method. Any
  2607. // pending HTTP request will be aborted if the provided context is
  2608. // canceled.
  2609. func (c *ProjectsLocationsOperationsDeleteCall) Context(ctx context.Context) *ProjectsLocationsOperationsDeleteCall {
  2610. c.ctx_ = ctx
  2611. return c
  2612. }
  2613. // Header returns an http.Header that can be modified by the caller to
  2614. // add HTTP headers to the request.
  2615. func (c *ProjectsLocationsOperationsDeleteCall) Header() http.Header {
  2616. if c.header_ == nil {
  2617. c.header_ = make(http.Header)
  2618. }
  2619. return c.header_
  2620. }
  2621. func (c *ProjectsLocationsOperationsDeleteCall) doRequest(alt string) (*http.Response, error) {
  2622. reqHeaders := make(http.Header)
  2623. for k, v := range c.header_ {
  2624. reqHeaders[k] = v
  2625. }
  2626. reqHeaders.Set("User-Agent", c.s.userAgent())
  2627. var body io.Reader = nil
  2628. c.urlParams_.Set("alt", alt)
  2629. c.urlParams_.Set("prettyPrint", "false")
  2630. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  2631. urls += "?" + c.urlParams_.Encode()
  2632. req, err := http.NewRequest("DELETE", urls, body)
  2633. if err != nil {
  2634. return nil, err
  2635. }
  2636. req.Header = reqHeaders
  2637. googleapi.Expand(req.URL, map[string]string{
  2638. "name": c.name,
  2639. })
  2640. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2641. }
  2642. // Do executes the "tpu.projects.locations.operations.delete" call.
  2643. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  2644. // code is an error. Response headers are in either
  2645. // *Empty.ServerResponse.Header or (if a response was returned at all)
  2646. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2647. // check whether the returned error was because http.StatusNotModified
  2648. // was returned.
  2649. func (c *ProjectsLocationsOperationsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  2650. gensupport.SetOptions(c.urlParams_, opts...)
  2651. res, err := c.doRequest("json")
  2652. if res != nil && res.StatusCode == http.StatusNotModified {
  2653. if res.Body != nil {
  2654. res.Body.Close()
  2655. }
  2656. return nil, &googleapi.Error{
  2657. Code: res.StatusCode,
  2658. Header: res.Header,
  2659. }
  2660. }
  2661. if err != nil {
  2662. return nil, err
  2663. }
  2664. defer googleapi.CloseBody(res)
  2665. if err := googleapi.CheckResponse(res); err != nil {
  2666. return nil, err
  2667. }
  2668. ret := &Empty{
  2669. ServerResponse: googleapi.ServerResponse{
  2670. Header: res.Header,
  2671. HTTPStatusCode: res.StatusCode,
  2672. },
  2673. }
  2674. target := &ret
  2675. if err := gensupport.DecodeResponse(target, res); err != nil {
  2676. return nil, err
  2677. }
  2678. return ret, nil
  2679. // {
  2680. // "description": "Deletes a long-running operation. This method indicates that the client is\nno longer interested in the operation result. It does not cancel the\noperation. If the server doesn't support this method, it returns\n`google.rpc.Code.UNIMPLEMENTED`.",
  2681. // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/operations/{operationsId}",
  2682. // "httpMethod": "DELETE",
  2683. // "id": "tpu.projects.locations.operations.delete",
  2684. // "parameterOrder": [
  2685. // "name"
  2686. // ],
  2687. // "parameters": {
  2688. // "name": {
  2689. // "description": "The name of the operation resource to be deleted.",
  2690. // "location": "path",
  2691. // "pattern": "^projects/[^/]+/locations/[^/]+/operations/[^/]+$",
  2692. // "required": true,
  2693. // "type": "string"
  2694. // }
  2695. // },
  2696. // "path": "v1/{+name}",
  2697. // "response": {
  2698. // "$ref": "Empty"
  2699. // },
  2700. // "scopes": [
  2701. // "https://www.googleapis.com/auth/cloud-platform"
  2702. // ]
  2703. // }
  2704. }
  2705. // method id "tpu.projects.locations.operations.get":
  2706. type ProjectsLocationsOperationsGetCall struct {
  2707. s *Service
  2708. name string
  2709. urlParams_ gensupport.URLParams
  2710. ifNoneMatch_ string
  2711. ctx_ context.Context
  2712. header_ http.Header
  2713. }
  2714. // Get: Gets the latest state of a long-running operation. Clients can
  2715. // use this
  2716. // method to poll the operation result at intervals as recommended by
  2717. // the API
  2718. // service.
  2719. func (r *ProjectsLocationsOperationsService) Get(name string) *ProjectsLocationsOperationsGetCall {
  2720. c := &ProjectsLocationsOperationsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2721. c.name = name
  2722. return c
  2723. }
  2724. // Fields allows partial responses to be retrieved. See
  2725. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2726. // for more information.
  2727. func (c *ProjectsLocationsOperationsGetCall) Fields(s ...googleapi.Field) *ProjectsLocationsOperationsGetCall {
  2728. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2729. return c
  2730. }
  2731. // IfNoneMatch sets the optional parameter which makes the operation
  2732. // fail if the object's ETag matches the given value. This is useful for
  2733. // getting updates only after the object has changed since the last
  2734. // request. Use googleapi.IsNotModified to check whether the response
  2735. // error from Do is the result of In-None-Match.
  2736. func (c *ProjectsLocationsOperationsGetCall) IfNoneMatch(entityTag string) *ProjectsLocationsOperationsGetCall {
  2737. c.ifNoneMatch_ = entityTag
  2738. return c
  2739. }
  2740. // Context sets the context to be used in this call's Do method. Any
  2741. // pending HTTP request will be aborted if the provided context is
  2742. // canceled.
  2743. func (c *ProjectsLocationsOperationsGetCall) Context(ctx context.Context) *ProjectsLocationsOperationsGetCall {
  2744. c.ctx_ = ctx
  2745. return c
  2746. }
  2747. // Header returns an http.Header that can be modified by the caller to
  2748. // add HTTP headers to the request.
  2749. func (c *ProjectsLocationsOperationsGetCall) Header() http.Header {
  2750. if c.header_ == nil {
  2751. c.header_ = make(http.Header)
  2752. }
  2753. return c.header_
  2754. }
  2755. func (c *ProjectsLocationsOperationsGetCall) doRequest(alt string) (*http.Response, error) {
  2756. reqHeaders := make(http.Header)
  2757. for k, v := range c.header_ {
  2758. reqHeaders[k] = v
  2759. }
  2760. reqHeaders.Set("User-Agent", c.s.userAgent())
  2761. if c.ifNoneMatch_ != "" {
  2762. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2763. }
  2764. var body io.Reader = nil
  2765. c.urlParams_.Set("alt", alt)
  2766. c.urlParams_.Set("prettyPrint", "false")
  2767. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  2768. urls += "?" + c.urlParams_.Encode()
  2769. req, err := http.NewRequest("GET", urls, body)
  2770. if err != nil {
  2771. return nil, err
  2772. }
  2773. req.Header = reqHeaders
  2774. googleapi.Expand(req.URL, map[string]string{
  2775. "name": c.name,
  2776. })
  2777. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2778. }
  2779. // Do executes the "tpu.projects.locations.operations.get" call.
  2780. // Exactly one of *Operation or error will be non-nil. Any non-2xx
  2781. // status code is an error. Response headers are in either
  2782. // *Operation.ServerResponse.Header or (if a response was returned at
  2783. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  2784. // to check whether the returned error was because
  2785. // http.StatusNotModified was returned.
  2786. func (c *ProjectsLocationsOperationsGetCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
  2787. gensupport.SetOptions(c.urlParams_, opts...)
  2788. res, err := c.doRequest("json")
  2789. if res != nil && res.StatusCode == http.StatusNotModified {
  2790. if res.Body != nil {
  2791. res.Body.Close()
  2792. }
  2793. return nil, &googleapi.Error{
  2794. Code: res.StatusCode,
  2795. Header: res.Header,
  2796. }
  2797. }
  2798. if err != nil {
  2799. return nil, err
  2800. }
  2801. defer googleapi.CloseBody(res)
  2802. if err := googleapi.CheckResponse(res); err != nil {
  2803. return nil, err
  2804. }
  2805. ret := &Operation{
  2806. ServerResponse: googleapi.ServerResponse{
  2807. Header: res.Header,
  2808. HTTPStatusCode: res.StatusCode,
  2809. },
  2810. }
  2811. target := &ret
  2812. if err := gensupport.DecodeResponse(target, res); err != nil {
  2813. return nil, err
  2814. }
  2815. return ret, nil
  2816. // {
  2817. // "description": "Gets the latest state of a long-running operation. Clients can use this\nmethod to poll the operation result at intervals as recommended by the API\nservice.",
  2818. // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/operations/{operationsId}",
  2819. // "httpMethod": "GET",
  2820. // "id": "tpu.projects.locations.operations.get",
  2821. // "parameterOrder": [
  2822. // "name"
  2823. // ],
  2824. // "parameters": {
  2825. // "name": {
  2826. // "description": "The name of the operation resource.",
  2827. // "location": "path",
  2828. // "pattern": "^projects/[^/]+/locations/[^/]+/operations/[^/]+$",
  2829. // "required": true,
  2830. // "type": "string"
  2831. // }
  2832. // },
  2833. // "path": "v1/{+name}",
  2834. // "response": {
  2835. // "$ref": "Operation"
  2836. // },
  2837. // "scopes": [
  2838. // "https://www.googleapis.com/auth/cloud-platform"
  2839. // ]
  2840. // }
  2841. }
  2842. // method id "tpu.projects.locations.operations.list":
  2843. type ProjectsLocationsOperationsListCall struct {
  2844. s *Service
  2845. name string
  2846. urlParams_ gensupport.URLParams
  2847. ifNoneMatch_ string
  2848. ctx_ context.Context
  2849. header_ http.Header
  2850. }
  2851. // List: Lists operations that match the specified filter in the
  2852. // request. If the
  2853. // server doesn't support this method, it returns
  2854. // `UNIMPLEMENTED`.
  2855. //
  2856. // NOTE: the `name` binding allows API services to override the
  2857. // binding
  2858. // to use different resource name schemes, such as `users/*/operations`.
  2859. // To
  2860. // override the binding, API services can add a binding such
  2861. // as
  2862. // "/v1/{name=users/*}/operations" to their service configuration.
  2863. // For backwards compatibility, the default name includes the
  2864. // operations
  2865. // collection id, however overriding users must ensure the name
  2866. // binding
  2867. // is the parent resource, without the operations collection id.
  2868. func (r *ProjectsLocationsOperationsService) List(name string) *ProjectsLocationsOperationsListCall {
  2869. c := &ProjectsLocationsOperationsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2870. c.name = name
  2871. return c
  2872. }
  2873. // Filter sets the optional parameter "filter": The standard list
  2874. // filter.
  2875. func (c *ProjectsLocationsOperationsListCall) Filter(filter string) *ProjectsLocationsOperationsListCall {
  2876. c.urlParams_.Set("filter", filter)
  2877. return c
  2878. }
  2879. // PageSize sets the optional parameter "pageSize": The standard list
  2880. // page size.
  2881. func (c *ProjectsLocationsOperationsListCall) PageSize(pageSize int64) *ProjectsLocationsOperationsListCall {
  2882. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  2883. return c
  2884. }
  2885. // PageToken sets the optional parameter "pageToken": The standard list
  2886. // page token.
  2887. func (c *ProjectsLocationsOperationsListCall) PageToken(pageToken string) *ProjectsLocationsOperationsListCall {
  2888. c.urlParams_.Set("pageToken", pageToken)
  2889. return c
  2890. }
  2891. // Fields allows partial responses to be retrieved. See
  2892. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2893. // for more information.
  2894. func (c *ProjectsLocationsOperationsListCall) Fields(s ...googleapi.Field) *ProjectsLocationsOperationsListCall {
  2895. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2896. return c
  2897. }
  2898. // IfNoneMatch sets the optional parameter which makes the operation
  2899. // fail if the object's ETag matches the given value. This is useful for
  2900. // getting updates only after the object has changed since the last
  2901. // request. Use googleapi.IsNotModified to check whether the response
  2902. // error from Do is the result of In-None-Match.
  2903. func (c *ProjectsLocationsOperationsListCall) IfNoneMatch(entityTag string) *ProjectsLocationsOperationsListCall {
  2904. c.ifNoneMatch_ = entityTag
  2905. return c
  2906. }
  2907. // Context sets the context to be used in this call's Do method. Any
  2908. // pending HTTP request will be aborted if the provided context is
  2909. // canceled.
  2910. func (c *ProjectsLocationsOperationsListCall) Context(ctx context.Context) *ProjectsLocationsOperationsListCall {
  2911. c.ctx_ = ctx
  2912. return c
  2913. }
  2914. // Header returns an http.Header that can be modified by the caller to
  2915. // add HTTP headers to the request.
  2916. func (c *ProjectsLocationsOperationsListCall) Header() http.Header {
  2917. if c.header_ == nil {
  2918. c.header_ = make(http.Header)
  2919. }
  2920. return c.header_
  2921. }
  2922. func (c *ProjectsLocationsOperationsListCall) doRequest(alt string) (*http.Response, error) {
  2923. reqHeaders := make(http.Header)
  2924. for k, v := range c.header_ {
  2925. reqHeaders[k] = v
  2926. }
  2927. reqHeaders.Set("User-Agent", c.s.userAgent())
  2928. if c.ifNoneMatch_ != "" {
  2929. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2930. }
  2931. var body io.Reader = nil
  2932. c.urlParams_.Set("alt", alt)
  2933. c.urlParams_.Set("prettyPrint", "false")
  2934. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}/operations")
  2935. urls += "?" + c.urlParams_.Encode()
  2936. req, err := http.NewRequest("GET", urls, body)
  2937. if err != nil {
  2938. return nil, err
  2939. }
  2940. req.Header = reqHeaders
  2941. googleapi.Expand(req.URL, map[string]string{
  2942. "name": c.name,
  2943. })
  2944. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2945. }
  2946. // Do executes the "tpu.projects.locations.operations.list" call.
  2947. // Exactly one of *ListOperationsResponse or error will be non-nil. Any
  2948. // non-2xx status code is an error. Response headers are in either
  2949. // *ListOperationsResponse.ServerResponse.Header or (if a response was
  2950. // returned at all) in error.(*googleapi.Error).Header. Use
  2951. // googleapi.IsNotModified to check whether the returned error was
  2952. // because http.StatusNotModified was returned.
  2953. func (c *ProjectsLocationsOperationsListCall) Do(opts ...googleapi.CallOption) (*ListOperationsResponse, error) {
  2954. gensupport.SetOptions(c.urlParams_, opts...)
  2955. res, err := c.doRequest("json")
  2956. if res != nil && res.StatusCode == http.StatusNotModified {
  2957. if res.Body != nil {
  2958. res.Body.Close()
  2959. }
  2960. return nil, &googleapi.Error{
  2961. Code: res.StatusCode,
  2962. Header: res.Header,
  2963. }
  2964. }
  2965. if err != nil {
  2966. return nil, err
  2967. }
  2968. defer googleapi.CloseBody(res)
  2969. if err := googleapi.CheckResponse(res); err != nil {
  2970. return nil, err
  2971. }
  2972. ret := &ListOperationsResponse{
  2973. ServerResponse: googleapi.ServerResponse{
  2974. Header: res.Header,
  2975. HTTPStatusCode: res.StatusCode,
  2976. },
  2977. }
  2978. target := &ret
  2979. if err := gensupport.DecodeResponse(target, res); err != nil {
  2980. return nil, err
  2981. }
  2982. return ret, nil
  2983. // {
  2984. // "description": "Lists operations that match the specified filter in the request. If the\nserver doesn't support this method, it returns `UNIMPLEMENTED`.\n\nNOTE: the `name` binding allows API services to override the binding\nto use different resource name schemes, such as `users/*/operations`. To\noverride the binding, API services can add a binding such as\n`\"/v1/{name=users/*}/operations\"` to their service configuration.\nFor backwards compatibility, the default name includes the operations\ncollection id, however overriding users must ensure the name binding\nis the parent resource, without the operations collection id.",
  2985. // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/operations",
  2986. // "httpMethod": "GET",
  2987. // "id": "tpu.projects.locations.operations.list",
  2988. // "parameterOrder": [
  2989. // "name"
  2990. // ],
  2991. // "parameters": {
  2992. // "filter": {
  2993. // "description": "The standard list filter.",
  2994. // "location": "query",
  2995. // "type": "string"
  2996. // },
  2997. // "name": {
  2998. // "description": "The name of the operation's parent resource.",
  2999. // "location": "path",
  3000. // "pattern": "^projects/[^/]+/locations/[^/]+$",
  3001. // "required": true,
  3002. // "type": "string"
  3003. // },
  3004. // "pageSize": {
  3005. // "description": "The standard list page size.",
  3006. // "format": "int32",
  3007. // "location": "query",
  3008. // "type": "integer"
  3009. // },
  3010. // "pageToken": {
  3011. // "description": "The standard list page token.",
  3012. // "location": "query",
  3013. // "type": "string"
  3014. // }
  3015. // },
  3016. // "path": "v1/{+name}/operations",
  3017. // "response": {
  3018. // "$ref": "ListOperationsResponse"
  3019. // },
  3020. // "scopes": [
  3021. // "https://www.googleapis.com/auth/cloud-platform"
  3022. // ]
  3023. // }
  3024. }
  3025. // Pages invokes f for each page of results.
  3026. // A non-nil error returned from f will halt the iteration.
  3027. // The provided context supersedes any context provided to the Context method.
  3028. func (c *ProjectsLocationsOperationsListCall) Pages(ctx context.Context, f func(*ListOperationsResponse) error) error {
  3029. c.ctx_ = ctx
  3030. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  3031. for {
  3032. x, err := c.Do()
  3033. if err != nil {
  3034. return err
  3035. }
  3036. if err := f(x); err != nil {
  3037. return err
  3038. }
  3039. if x.NextPageToken == "" {
  3040. return nil
  3041. }
  3042. c.PageToken(x.NextPageToken)
  3043. }
  3044. }
  3045. // method id "tpu.projects.locations.tensorflowVersions.get":
  3046. type ProjectsLocationsTensorflowVersionsGetCall struct {
  3047. s *Service
  3048. name string
  3049. urlParams_ gensupport.URLParams
  3050. ifNoneMatch_ string
  3051. ctx_ context.Context
  3052. header_ http.Header
  3053. }
  3054. // Get: Gets TensorFlow Version.
  3055. func (r *ProjectsLocationsTensorflowVersionsService) Get(name string) *ProjectsLocationsTensorflowVersionsGetCall {
  3056. c := &ProjectsLocationsTensorflowVersionsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3057. c.name = name
  3058. return c
  3059. }
  3060. // Fields allows partial responses to be retrieved. See
  3061. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3062. // for more information.
  3063. func (c *ProjectsLocationsTensorflowVersionsGetCall) Fields(s ...googleapi.Field) *ProjectsLocationsTensorflowVersionsGetCall {
  3064. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3065. return c
  3066. }
  3067. // IfNoneMatch sets the optional parameter which makes the operation
  3068. // fail if the object's ETag matches the given value. This is useful for
  3069. // getting updates only after the object has changed since the last
  3070. // request. Use googleapi.IsNotModified to check whether the response
  3071. // error from Do is the result of In-None-Match.
  3072. func (c *ProjectsLocationsTensorflowVersionsGetCall) IfNoneMatch(entityTag string) *ProjectsLocationsTensorflowVersionsGetCall {
  3073. c.ifNoneMatch_ = entityTag
  3074. return c
  3075. }
  3076. // Context sets the context to be used in this call's Do method. Any
  3077. // pending HTTP request will be aborted if the provided context is
  3078. // canceled.
  3079. func (c *ProjectsLocationsTensorflowVersionsGetCall) Context(ctx context.Context) *ProjectsLocationsTensorflowVersionsGetCall {
  3080. c.ctx_ = ctx
  3081. return c
  3082. }
  3083. // Header returns an http.Header that can be modified by the caller to
  3084. // add HTTP headers to the request.
  3085. func (c *ProjectsLocationsTensorflowVersionsGetCall) Header() http.Header {
  3086. if c.header_ == nil {
  3087. c.header_ = make(http.Header)
  3088. }
  3089. return c.header_
  3090. }
  3091. func (c *ProjectsLocationsTensorflowVersionsGetCall) doRequest(alt string) (*http.Response, error) {
  3092. reqHeaders := make(http.Header)
  3093. for k, v := range c.header_ {
  3094. reqHeaders[k] = v
  3095. }
  3096. reqHeaders.Set("User-Agent", c.s.userAgent())
  3097. if c.ifNoneMatch_ != "" {
  3098. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  3099. }
  3100. var body io.Reader = nil
  3101. c.urlParams_.Set("alt", alt)
  3102. c.urlParams_.Set("prettyPrint", "false")
  3103. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  3104. urls += "?" + c.urlParams_.Encode()
  3105. req, err := http.NewRequest("GET", urls, body)
  3106. if err != nil {
  3107. return nil, err
  3108. }
  3109. req.Header = reqHeaders
  3110. googleapi.Expand(req.URL, map[string]string{
  3111. "name": c.name,
  3112. })
  3113. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3114. }
  3115. // Do executes the "tpu.projects.locations.tensorflowVersions.get" call.
  3116. // Exactly one of *TensorFlowVersion or error will be non-nil. Any
  3117. // non-2xx status code is an error. Response headers are in either
  3118. // *TensorFlowVersion.ServerResponse.Header or (if a response was
  3119. // returned at all) in error.(*googleapi.Error).Header. Use
  3120. // googleapi.IsNotModified to check whether the returned error was
  3121. // because http.StatusNotModified was returned.
  3122. func (c *ProjectsLocationsTensorflowVersionsGetCall) Do(opts ...googleapi.CallOption) (*TensorFlowVersion, error) {
  3123. gensupport.SetOptions(c.urlParams_, opts...)
  3124. res, err := c.doRequest("json")
  3125. if res != nil && res.StatusCode == http.StatusNotModified {
  3126. if res.Body != nil {
  3127. res.Body.Close()
  3128. }
  3129. return nil, &googleapi.Error{
  3130. Code: res.StatusCode,
  3131. Header: res.Header,
  3132. }
  3133. }
  3134. if err != nil {
  3135. return nil, err
  3136. }
  3137. defer googleapi.CloseBody(res)
  3138. if err := googleapi.CheckResponse(res); err != nil {
  3139. return nil, err
  3140. }
  3141. ret := &TensorFlowVersion{
  3142. ServerResponse: googleapi.ServerResponse{
  3143. Header: res.Header,
  3144. HTTPStatusCode: res.StatusCode,
  3145. },
  3146. }
  3147. target := &ret
  3148. if err := gensupport.DecodeResponse(target, res); err != nil {
  3149. return nil, err
  3150. }
  3151. return ret, nil
  3152. // {
  3153. // "description": "Gets TensorFlow Version.",
  3154. // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/tensorflowVersions/{tensorflowVersionsId}",
  3155. // "httpMethod": "GET",
  3156. // "id": "tpu.projects.locations.tensorflowVersions.get",
  3157. // "parameterOrder": [
  3158. // "name"
  3159. // ],
  3160. // "parameters": {
  3161. // "name": {
  3162. // "description": "The resource name.",
  3163. // "location": "path",
  3164. // "pattern": "^projects/[^/]+/locations/[^/]+/tensorflowVersions/[^/]+$",
  3165. // "required": true,
  3166. // "type": "string"
  3167. // }
  3168. // },
  3169. // "path": "v1/{+name}",
  3170. // "response": {
  3171. // "$ref": "TensorFlowVersion"
  3172. // },
  3173. // "scopes": [
  3174. // "https://www.googleapis.com/auth/cloud-platform"
  3175. // ]
  3176. // }
  3177. }
  3178. // method id "tpu.projects.locations.tensorflowVersions.list":
  3179. type ProjectsLocationsTensorflowVersionsListCall struct {
  3180. s *Service
  3181. parent string
  3182. urlParams_ gensupport.URLParams
  3183. ifNoneMatch_ string
  3184. ctx_ context.Context
  3185. header_ http.Header
  3186. }
  3187. // List: List TensorFlow versions supported by this API.
  3188. func (r *ProjectsLocationsTensorflowVersionsService) List(parent string) *ProjectsLocationsTensorflowVersionsListCall {
  3189. c := &ProjectsLocationsTensorflowVersionsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3190. c.parent = parent
  3191. return c
  3192. }
  3193. // Filter sets the optional parameter "filter": List filter.
  3194. func (c *ProjectsLocationsTensorflowVersionsListCall) Filter(filter string) *ProjectsLocationsTensorflowVersionsListCall {
  3195. c.urlParams_.Set("filter", filter)
  3196. return c
  3197. }
  3198. // OrderBy sets the optional parameter "orderBy": Sort results.
  3199. func (c *ProjectsLocationsTensorflowVersionsListCall) OrderBy(orderBy string) *ProjectsLocationsTensorflowVersionsListCall {
  3200. c.urlParams_.Set("orderBy", orderBy)
  3201. return c
  3202. }
  3203. // PageSize sets the optional parameter "pageSize": The maximum number
  3204. // of items to return.
  3205. func (c *ProjectsLocationsTensorflowVersionsListCall) PageSize(pageSize int64) *ProjectsLocationsTensorflowVersionsListCall {
  3206. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  3207. return c
  3208. }
  3209. // PageToken sets the optional parameter "pageToken": The
  3210. // next_page_token value returned from a previous List request, if any.
  3211. func (c *ProjectsLocationsTensorflowVersionsListCall) PageToken(pageToken string) *ProjectsLocationsTensorflowVersionsListCall {
  3212. c.urlParams_.Set("pageToken", pageToken)
  3213. return c
  3214. }
  3215. // Fields allows partial responses to be retrieved. See
  3216. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3217. // for more information.
  3218. func (c *ProjectsLocationsTensorflowVersionsListCall) Fields(s ...googleapi.Field) *ProjectsLocationsTensorflowVersionsListCall {
  3219. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3220. return c
  3221. }
  3222. // IfNoneMatch sets the optional parameter which makes the operation
  3223. // fail if the object's ETag matches the given value. This is useful for
  3224. // getting updates only after the object has changed since the last
  3225. // request. Use googleapi.IsNotModified to check whether the response
  3226. // error from Do is the result of In-None-Match.
  3227. func (c *ProjectsLocationsTensorflowVersionsListCall) IfNoneMatch(entityTag string) *ProjectsLocationsTensorflowVersionsListCall {
  3228. c.ifNoneMatch_ = entityTag
  3229. return c
  3230. }
  3231. // Context sets the context to be used in this call's Do method. Any
  3232. // pending HTTP request will be aborted if the provided context is
  3233. // canceled.
  3234. func (c *ProjectsLocationsTensorflowVersionsListCall) Context(ctx context.Context) *ProjectsLocationsTensorflowVersionsListCall {
  3235. c.ctx_ = ctx
  3236. return c
  3237. }
  3238. // Header returns an http.Header that can be modified by the caller to
  3239. // add HTTP headers to the request.
  3240. func (c *ProjectsLocationsTensorflowVersionsListCall) Header() http.Header {
  3241. if c.header_ == nil {
  3242. c.header_ = make(http.Header)
  3243. }
  3244. return c.header_
  3245. }
  3246. func (c *ProjectsLocationsTensorflowVersionsListCall) doRequest(alt string) (*http.Response, error) {
  3247. reqHeaders := make(http.Header)
  3248. for k, v := range c.header_ {
  3249. reqHeaders[k] = v
  3250. }
  3251. reqHeaders.Set("User-Agent", c.s.userAgent())
  3252. if c.ifNoneMatch_ != "" {
  3253. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  3254. }
  3255. var body io.Reader = nil
  3256. c.urlParams_.Set("alt", alt)
  3257. c.urlParams_.Set("prettyPrint", "false")
  3258. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/tensorflowVersions")
  3259. urls += "?" + c.urlParams_.Encode()
  3260. req, err := http.NewRequest("GET", urls, body)
  3261. if err != nil {
  3262. return nil, err
  3263. }
  3264. req.Header = reqHeaders
  3265. googleapi.Expand(req.URL, map[string]string{
  3266. "parent": c.parent,
  3267. })
  3268. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3269. }
  3270. // Do executes the "tpu.projects.locations.tensorflowVersions.list" call.
  3271. // Exactly one of *ListTensorFlowVersionsResponse or error will be
  3272. // non-nil. Any non-2xx status code is an error. Response headers are in
  3273. // either *ListTensorFlowVersionsResponse.ServerResponse.Header or (if a
  3274. // response was returned at all) in error.(*googleapi.Error).Header. Use
  3275. // googleapi.IsNotModified to check whether the returned error was
  3276. // because http.StatusNotModified was returned.
  3277. func (c *ProjectsLocationsTensorflowVersionsListCall) Do(opts ...googleapi.CallOption) (*ListTensorFlowVersionsResponse, error) {
  3278. gensupport.SetOptions(c.urlParams_, opts...)
  3279. res, err := c.doRequest("json")
  3280. if res != nil && res.StatusCode == http.StatusNotModified {
  3281. if res.Body != nil {
  3282. res.Body.Close()
  3283. }
  3284. return nil, &googleapi.Error{
  3285. Code: res.StatusCode,
  3286. Header: res.Header,
  3287. }
  3288. }
  3289. if err != nil {
  3290. return nil, err
  3291. }
  3292. defer googleapi.CloseBody(res)
  3293. if err := googleapi.CheckResponse(res); err != nil {
  3294. return nil, err
  3295. }
  3296. ret := &ListTensorFlowVersionsResponse{
  3297. ServerResponse: googleapi.ServerResponse{
  3298. Header: res.Header,
  3299. HTTPStatusCode: res.StatusCode,
  3300. },
  3301. }
  3302. target := &ret
  3303. if err := gensupport.DecodeResponse(target, res); err != nil {
  3304. return nil, err
  3305. }
  3306. return ret, nil
  3307. // {
  3308. // "description": "List TensorFlow versions supported by this API.",
  3309. // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/tensorflowVersions",
  3310. // "httpMethod": "GET",
  3311. // "id": "tpu.projects.locations.tensorflowVersions.list",
  3312. // "parameterOrder": [
  3313. // "parent"
  3314. // ],
  3315. // "parameters": {
  3316. // "filter": {
  3317. // "description": "List filter.",
  3318. // "location": "query",
  3319. // "type": "string"
  3320. // },
  3321. // "orderBy": {
  3322. // "description": "Sort results.",
  3323. // "location": "query",
  3324. // "type": "string"
  3325. // },
  3326. // "pageSize": {
  3327. // "description": "The maximum number of items to return.",
  3328. // "format": "int32",
  3329. // "location": "query",
  3330. // "type": "integer"
  3331. // },
  3332. // "pageToken": {
  3333. // "description": "The next_page_token value returned from a previous List request, if any.",
  3334. // "location": "query",
  3335. // "type": "string"
  3336. // },
  3337. // "parent": {
  3338. // "description": "The parent resource name.",
  3339. // "location": "path",
  3340. // "pattern": "^projects/[^/]+/locations/[^/]+$",
  3341. // "required": true,
  3342. // "type": "string"
  3343. // }
  3344. // },
  3345. // "path": "v1/{+parent}/tensorflowVersions",
  3346. // "response": {
  3347. // "$ref": "ListTensorFlowVersionsResponse"
  3348. // },
  3349. // "scopes": [
  3350. // "https://www.googleapis.com/auth/cloud-platform"
  3351. // ]
  3352. // }
  3353. }
  3354. // Pages invokes f for each page of results.
  3355. // A non-nil error returned from f will halt the iteration.
  3356. // The provided context supersedes any context provided to the Context method.
  3357. func (c *ProjectsLocationsTensorflowVersionsListCall) Pages(ctx context.Context, f func(*ListTensorFlowVersionsResponse) error) error {
  3358. c.ctx_ = ctx
  3359. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  3360. for {
  3361. x, err := c.Do()
  3362. if err != nil {
  3363. return err
  3364. }
  3365. if err := f(x); err != nil {
  3366. return err
  3367. }
  3368. if x.NextPageToken == "" {
  3369. return nil
  3370. }
  3371. c.PageToken(x.NextPageToken)
  3372. }
  3373. }