tpu-gen.go 124 KB

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