Não pode escolher mais do que 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 
 

3757 linhas
124 KiB

  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/v1alpha1"
  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/v1alpha1"
  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:v1alpha1"
  67. const apiName = "tpu"
  68. const apiVersion = "v1alpha1"
  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 sent work.
  508. // It is recommended that Tensorflow clients of the node reach out to
  509. // the 0th
  510. // 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" - 7 - Reserved. Was SUSPENDED.
  541. // TPU node is stopped.
  542. // "STOPPING" - TPU node is currently stopping.
  543. // "STARTING" - TPU node is currently starting.
  544. // "PREEMPTED" - TPU node has been preempted. Only applies to
  545. // Preemptible TPU Nodes.
  546. // "TERMINATED" - TPU node has been terminated due to maintenance or
  547. // has reached the end of
  548. // its life cycle (for preemptible nodes).
  549. // "HIDING" - TPU node is currently hiding.
  550. // "HIDDEN" - TPU node has been hidden.
  551. // "UNHIDING" - TPU node is currently unhiding.
  552. State string `json:"state,omitempty"`
  553. // TensorflowVersion: The version of Tensorflow running in the
  554. // Node.
  555. // Required.
  556. TensorflowVersion string `json:"tensorflowVersion,omitempty"`
  557. // ServerResponse contains the HTTP response code and headers from the
  558. // server.
  559. googleapi.ServerResponse `json:"-"`
  560. // ForceSendFields is a list of field names (e.g. "AcceleratorType") to
  561. // unconditionally include in API requests. By default, fields with
  562. // empty values are omitted from API requests. However, any non-pointer,
  563. // non-interface field appearing in ForceSendFields will be sent to the
  564. // server regardless of whether the field is empty or not. This may be
  565. // used to include empty fields in Patch requests.
  566. ForceSendFields []string `json:"-"`
  567. // NullFields is a list of field names (e.g. "AcceleratorType") to
  568. // include in API requests with the JSON null value. By default, fields
  569. // with empty values are omitted from API requests. However, any field
  570. // with an empty value appearing in NullFields will be sent to the
  571. // server as null. It is an error if a field in this list has a
  572. // non-empty value. This may be used to include null fields in Patch
  573. // requests.
  574. NullFields []string `json:"-"`
  575. }
  576. func (s *Node) MarshalJSON() ([]byte, error) {
  577. type NoMethod Node
  578. raw := NoMethod(*s)
  579. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  580. }
  581. // Operation: This resource represents a long-running operation that is
  582. // the result of a
  583. // network API call.
  584. type Operation struct {
  585. // Done: If the value is `false`, it means the operation is still in
  586. // progress.
  587. // If `true`, the operation is completed, and either `error` or
  588. // `response` is
  589. // available.
  590. Done bool `json:"done,omitempty"`
  591. // Error: The error result of the operation in case of failure or
  592. // cancellation.
  593. Error *Status `json:"error,omitempty"`
  594. // Metadata: Service-specific metadata associated with the operation.
  595. // It typically
  596. // contains progress information and common metadata such as create
  597. // time.
  598. // Some services might not provide such metadata. Any method that
  599. // returns a
  600. // long-running operation should document the metadata type, if any.
  601. Metadata googleapi.RawMessage `json:"metadata,omitempty"`
  602. // Name: The server-assigned name, which is only unique within the same
  603. // service that
  604. // originally returns it. If you use the default HTTP mapping,
  605. // the
  606. // `name` should have the format of `operations/some/unique/name`.
  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. // ForceSendFields is a list of field names (e.g. "Preemptible") to
  720. // unconditionally include in API requests. By default, fields with
  721. // empty values are omitted from API requests. However, any non-pointer,
  722. // non-interface field appearing in ForceSendFields will be sent to the
  723. // server regardless of whether the field is empty or not. This may be
  724. // used to include empty fields in Patch requests.
  725. ForceSendFields []string `json:"-"`
  726. // NullFields is a list of field names (e.g. "Preemptible") to include
  727. // in API requests with the JSON null value. By default, fields with
  728. // empty values are omitted from API requests. However, any field with
  729. // an empty value appearing in NullFields will be sent to the server as
  730. // null. It is an error if a field in this list has a non-empty value.
  731. // This may be used to include null fields in Patch requests.
  732. NullFields []string `json:"-"`
  733. }
  734. func (s *SchedulingConfig) MarshalJSON() ([]byte, error) {
  735. type NoMethod SchedulingConfig
  736. raw := NoMethod(*s)
  737. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  738. }
  739. // StartNodeRequest: Request for StartNode.
  740. type StartNodeRequest struct {
  741. }
  742. // Status: The `Status` type defines a logical error model that is
  743. // suitable for
  744. // different programming environments, including REST APIs and RPC APIs.
  745. // It is
  746. // used by [gRPC](https://github.com/grpc). The error model is designed
  747. // to be:
  748. //
  749. // - Simple to use and understand for most users
  750. // - Flexible enough to meet unexpected needs
  751. //
  752. // # Overview
  753. //
  754. // The `Status` message contains three pieces of data: error code,
  755. // error
  756. // message, and error details. The error code should be an enum value
  757. // of
  758. // google.rpc.Code, but it may accept additional error codes if needed.
  759. // The
  760. // error message should be a developer-facing English message that
  761. // helps
  762. // developers *understand* and *resolve* the error. If a localized
  763. // user-facing
  764. // error message is needed, put the localized message in the error
  765. // details or
  766. // localize it in the client. The optional error details may contain
  767. // arbitrary
  768. // information about the error. There is a predefined set of error
  769. // detail types
  770. // in the package `google.rpc` that can be used for common error
  771. // conditions.
  772. //
  773. // # Language mapping
  774. //
  775. // The `Status` message is the logical representation of the error
  776. // model, but it
  777. // is not necessarily the actual wire format. When the `Status` message
  778. // is
  779. // exposed in different client libraries and different wire protocols,
  780. // it can be
  781. // mapped differently. For example, it will likely be mapped to some
  782. // exceptions
  783. // in Java, but more likely mapped to some error codes in C.
  784. //
  785. // # Other uses
  786. //
  787. // The error model and the `Status` message can be used in a variety
  788. // of
  789. // environments, either with or without APIs, to provide a
  790. // consistent developer experience across different
  791. // environments.
  792. //
  793. // Example uses of this error model include:
  794. //
  795. // - Partial errors. If a service needs to return partial errors to the
  796. // client,
  797. // it may embed the `Status` in the normal response to indicate the
  798. // partial
  799. // errors.
  800. //
  801. // - Workflow errors. A typical workflow has multiple steps. Each step
  802. // may
  803. // have a `Status` message for error reporting.
  804. //
  805. // - Batch operations. If a client uses batch request and batch
  806. // response, the
  807. // `Status` message should be used directly inside batch response,
  808. // one for
  809. // each error sub-response.
  810. //
  811. // - Asynchronous operations. If an API call embeds asynchronous
  812. // operation
  813. // results in its response, the status of those operations should
  814. // be
  815. // represented directly using the `Status` message.
  816. //
  817. // - Logging. If some API errors are stored in logs, the message
  818. // `Status` could
  819. // be used directly after any stripping needed for security/privacy
  820. // reasons.
  821. type Status struct {
  822. // Code: The status code, which should be an enum value of
  823. // google.rpc.Code.
  824. Code int64 `json:"code,omitempty"`
  825. // Details: A list of messages that carry the error details. There is a
  826. // common set of
  827. // message types for APIs to use.
  828. Details []googleapi.RawMessage `json:"details,omitempty"`
  829. // Message: A developer-facing error message, which should be in
  830. // English. Any
  831. // user-facing error message should be localized and sent in
  832. // the
  833. // google.rpc.Status.details field, or localized by the client.
  834. Message string `json:"message,omitempty"`
  835. // ForceSendFields is a list of field names (e.g. "Code") to
  836. // unconditionally include in API requests. By default, fields with
  837. // empty values are omitted from API requests. However, any non-pointer,
  838. // non-interface field appearing in ForceSendFields will be sent to the
  839. // server regardless of whether the field is empty or not. This may be
  840. // used to include empty fields in Patch requests.
  841. ForceSendFields []string `json:"-"`
  842. // NullFields is a list of field names (e.g. "Code") to include in API
  843. // requests with the JSON null value. By default, fields with empty
  844. // values are omitted from API requests. However, any field with an
  845. // empty value appearing in NullFields will be sent to the server as
  846. // null. It is an error if a field in this list has a non-empty value.
  847. // This may be used to include null fields in Patch requests.
  848. NullFields []string `json:"-"`
  849. }
  850. func (s *Status) MarshalJSON() ([]byte, error) {
  851. type NoMethod Status
  852. raw := NoMethod(*s)
  853. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  854. }
  855. // StopNodeRequest: Request for StopNode.
  856. type StopNodeRequest struct {
  857. }
  858. // TensorFlowVersion: A tensorflow version that a Node can be configured
  859. // with.
  860. type TensorFlowVersion struct {
  861. // Name: The resource name.
  862. Name string `json:"name,omitempty"`
  863. // Version: the tensorflow version.
  864. Version string `json:"version,omitempty"`
  865. // ServerResponse contains the HTTP response code and headers from the
  866. // server.
  867. googleapi.ServerResponse `json:"-"`
  868. // ForceSendFields is a list of field names (e.g. "Name") to
  869. // unconditionally include in API requests. By default, fields with
  870. // empty values are omitted from API requests. However, any non-pointer,
  871. // non-interface field appearing in ForceSendFields will be sent to the
  872. // server regardless of whether the field is empty or not. This may be
  873. // used to include empty fields in Patch requests.
  874. ForceSendFields []string `json:"-"`
  875. // NullFields is a list of field names (e.g. "Name") to include in API
  876. // requests with the JSON null value. By default, fields with empty
  877. // values are omitted from API requests. However, any field with an
  878. // empty value appearing in NullFields will be sent to the server as
  879. // null. It is an error if a field in this list has a non-empty value.
  880. // This may be used to include null fields in Patch requests.
  881. NullFields []string `json:"-"`
  882. }
  883. func (s *TensorFlowVersion) MarshalJSON() ([]byte, error) {
  884. type NoMethod TensorFlowVersion
  885. raw := NoMethod(*s)
  886. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  887. }
  888. // method id "tpu.projects.locations.get":
  889. type ProjectsLocationsGetCall struct {
  890. s *Service
  891. name string
  892. urlParams_ gensupport.URLParams
  893. ifNoneMatch_ string
  894. ctx_ context.Context
  895. header_ http.Header
  896. }
  897. // Get: Gets information about a location.
  898. func (r *ProjectsLocationsService) Get(name string) *ProjectsLocationsGetCall {
  899. c := &ProjectsLocationsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  900. c.name = name
  901. return c
  902. }
  903. // Fields allows partial responses to be retrieved. See
  904. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  905. // for more information.
  906. func (c *ProjectsLocationsGetCall) Fields(s ...googleapi.Field) *ProjectsLocationsGetCall {
  907. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  908. return c
  909. }
  910. // IfNoneMatch sets the optional parameter which makes the operation
  911. // fail if the object's ETag matches the given value. This is useful for
  912. // getting updates only after the object has changed since the last
  913. // request. Use googleapi.IsNotModified to check whether the response
  914. // error from Do is the result of In-None-Match.
  915. func (c *ProjectsLocationsGetCall) IfNoneMatch(entityTag string) *ProjectsLocationsGetCall {
  916. c.ifNoneMatch_ = entityTag
  917. return c
  918. }
  919. // Context sets the context to be used in this call's Do method. Any
  920. // pending HTTP request will be aborted if the provided context is
  921. // canceled.
  922. func (c *ProjectsLocationsGetCall) Context(ctx context.Context) *ProjectsLocationsGetCall {
  923. c.ctx_ = ctx
  924. return c
  925. }
  926. // Header returns an http.Header that can be modified by the caller to
  927. // add HTTP headers to the request.
  928. func (c *ProjectsLocationsGetCall) Header() http.Header {
  929. if c.header_ == nil {
  930. c.header_ = make(http.Header)
  931. }
  932. return c.header_
  933. }
  934. func (c *ProjectsLocationsGetCall) doRequest(alt string) (*http.Response, error) {
  935. reqHeaders := make(http.Header)
  936. for k, v := range c.header_ {
  937. reqHeaders[k] = v
  938. }
  939. reqHeaders.Set("User-Agent", c.s.userAgent())
  940. if c.ifNoneMatch_ != "" {
  941. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  942. }
  943. var body io.Reader = nil
  944. c.urlParams_.Set("alt", alt)
  945. c.urlParams_.Set("prettyPrint", "false")
  946. urls := googleapi.ResolveRelative(c.s.BasePath, "v1alpha1/{+name}")
  947. urls += "?" + c.urlParams_.Encode()
  948. req, err := http.NewRequest("GET", urls, body)
  949. if err != nil {
  950. return nil, err
  951. }
  952. req.Header = reqHeaders
  953. googleapi.Expand(req.URL, map[string]string{
  954. "name": c.name,
  955. })
  956. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  957. }
  958. // Do executes the "tpu.projects.locations.get" call.
  959. // Exactly one of *Location or error will be non-nil. Any non-2xx status
  960. // code is an error. Response headers are in either
  961. // *Location.ServerResponse.Header or (if a response was returned at
  962. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  963. // to check whether the returned error was because
  964. // http.StatusNotModified was returned.
  965. func (c *ProjectsLocationsGetCall) Do(opts ...googleapi.CallOption) (*Location, error) {
  966. gensupport.SetOptions(c.urlParams_, opts...)
  967. res, err := c.doRequest("json")
  968. if res != nil && res.StatusCode == http.StatusNotModified {
  969. if res.Body != nil {
  970. res.Body.Close()
  971. }
  972. return nil, &googleapi.Error{
  973. Code: res.StatusCode,
  974. Header: res.Header,
  975. }
  976. }
  977. if err != nil {
  978. return nil, err
  979. }
  980. defer googleapi.CloseBody(res)
  981. if err := googleapi.CheckResponse(res); err != nil {
  982. return nil, err
  983. }
  984. ret := &Location{
  985. ServerResponse: googleapi.ServerResponse{
  986. Header: res.Header,
  987. HTTPStatusCode: res.StatusCode,
  988. },
  989. }
  990. target := &ret
  991. if err := gensupport.DecodeResponse(target, res); err != nil {
  992. return nil, err
  993. }
  994. return ret, nil
  995. // {
  996. // "description": "Gets information about a location.",
  997. // "flatPath": "v1alpha1/projects/{projectsId}/locations/{locationsId}",
  998. // "httpMethod": "GET",
  999. // "id": "tpu.projects.locations.get",
  1000. // "parameterOrder": [
  1001. // "name"
  1002. // ],
  1003. // "parameters": {
  1004. // "name": {
  1005. // "description": "Resource name for the location.",
  1006. // "location": "path",
  1007. // "pattern": "^projects/[^/]+/locations/[^/]+$",
  1008. // "required": true,
  1009. // "type": "string"
  1010. // }
  1011. // },
  1012. // "path": "v1alpha1/{+name}",
  1013. // "response": {
  1014. // "$ref": "Location"
  1015. // },
  1016. // "scopes": [
  1017. // "https://www.googleapis.com/auth/cloud-platform"
  1018. // ]
  1019. // }
  1020. }
  1021. // method id "tpu.projects.locations.list":
  1022. type ProjectsLocationsListCall struct {
  1023. s *Service
  1024. name string
  1025. urlParams_ gensupport.URLParams
  1026. ifNoneMatch_ string
  1027. ctx_ context.Context
  1028. header_ http.Header
  1029. }
  1030. // List: Lists information about the supported locations for this
  1031. // service.
  1032. func (r *ProjectsLocationsService) List(name string) *ProjectsLocationsListCall {
  1033. c := &ProjectsLocationsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1034. c.name = name
  1035. return c
  1036. }
  1037. // Filter sets the optional parameter "filter": The standard list
  1038. // filter.
  1039. func (c *ProjectsLocationsListCall) Filter(filter string) *ProjectsLocationsListCall {
  1040. c.urlParams_.Set("filter", filter)
  1041. return c
  1042. }
  1043. // PageSize sets the optional parameter "pageSize": The standard list
  1044. // page size.
  1045. func (c *ProjectsLocationsListCall) PageSize(pageSize int64) *ProjectsLocationsListCall {
  1046. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  1047. return c
  1048. }
  1049. // PageToken sets the optional parameter "pageToken": The standard list
  1050. // page token.
  1051. func (c *ProjectsLocationsListCall) PageToken(pageToken string) *ProjectsLocationsListCall {
  1052. c.urlParams_.Set("pageToken", pageToken)
  1053. return c
  1054. }
  1055. // Fields allows partial responses to be retrieved. See
  1056. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1057. // for more information.
  1058. func (c *ProjectsLocationsListCall) Fields(s ...googleapi.Field) *ProjectsLocationsListCall {
  1059. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1060. return c
  1061. }
  1062. // IfNoneMatch sets the optional parameter which makes the operation
  1063. // fail if the object's ETag matches the given value. This is useful for
  1064. // getting updates only after the object has changed since the last
  1065. // request. Use googleapi.IsNotModified to check whether the response
  1066. // error from Do is the result of In-None-Match.
  1067. func (c *ProjectsLocationsListCall) IfNoneMatch(entityTag string) *ProjectsLocationsListCall {
  1068. c.ifNoneMatch_ = entityTag
  1069. return c
  1070. }
  1071. // Context sets the context to be used in this call's Do method. Any
  1072. // pending HTTP request will be aborted if the provided context is
  1073. // canceled.
  1074. func (c *ProjectsLocationsListCall) Context(ctx context.Context) *ProjectsLocationsListCall {
  1075. c.ctx_ = ctx
  1076. return c
  1077. }
  1078. // Header returns an http.Header that can be modified by the caller to
  1079. // add HTTP headers to the request.
  1080. func (c *ProjectsLocationsListCall) Header() http.Header {
  1081. if c.header_ == nil {
  1082. c.header_ = make(http.Header)
  1083. }
  1084. return c.header_
  1085. }
  1086. func (c *ProjectsLocationsListCall) doRequest(alt string) (*http.Response, error) {
  1087. reqHeaders := make(http.Header)
  1088. for k, v := range c.header_ {
  1089. reqHeaders[k] = v
  1090. }
  1091. reqHeaders.Set("User-Agent", c.s.userAgent())
  1092. if c.ifNoneMatch_ != "" {
  1093. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1094. }
  1095. var body io.Reader = nil
  1096. c.urlParams_.Set("alt", alt)
  1097. c.urlParams_.Set("prettyPrint", "false")
  1098. urls := googleapi.ResolveRelative(c.s.BasePath, "v1alpha1/{+name}/locations")
  1099. urls += "?" + c.urlParams_.Encode()
  1100. req, err := http.NewRequest("GET", urls, body)
  1101. if err != nil {
  1102. return nil, err
  1103. }
  1104. req.Header = reqHeaders
  1105. googleapi.Expand(req.URL, map[string]string{
  1106. "name": c.name,
  1107. })
  1108. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1109. }
  1110. // Do executes the "tpu.projects.locations.list" call.
  1111. // Exactly one of *ListLocationsResponse or error will be non-nil. Any
  1112. // non-2xx status code is an error. Response headers are in either
  1113. // *ListLocationsResponse.ServerResponse.Header or (if a response was
  1114. // returned at all) in error.(*googleapi.Error).Header. Use
  1115. // googleapi.IsNotModified to check whether the returned error was
  1116. // because http.StatusNotModified was returned.
  1117. func (c *ProjectsLocationsListCall) Do(opts ...googleapi.CallOption) (*ListLocationsResponse, error) {
  1118. gensupport.SetOptions(c.urlParams_, opts...)
  1119. res, err := c.doRequest("json")
  1120. if res != nil && res.StatusCode == http.StatusNotModified {
  1121. if res.Body != nil {
  1122. res.Body.Close()
  1123. }
  1124. return nil, &googleapi.Error{
  1125. Code: res.StatusCode,
  1126. Header: res.Header,
  1127. }
  1128. }
  1129. if err != nil {
  1130. return nil, err
  1131. }
  1132. defer googleapi.CloseBody(res)
  1133. if err := googleapi.CheckResponse(res); err != nil {
  1134. return nil, err
  1135. }
  1136. ret := &ListLocationsResponse{
  1137. ServerResponse: googleapi.ServerResponse{
  1138. Header: res.Header,
  1139. HTTPStatusCode: res.StatusCode,
  1140. },
  1141. }
  1142. target := &ret
  1143. if err := gensupport.DecodeResponse(target, res); err != nil {
  1144. return nil, err
  1145. }
  1146. return ret, nil
  1147. // {
  1148. // "description": "Lists information about the supported locations for this service.",
  1149. // "flatPath": "v1alpha1/projects/{projectsId}/locations",
  1150. // "httpMethod": "GET",
  1151. // "id": "tpu.projects.locations.list",
  1152. // "parameterOrder": [
  1153. // "name"
  1154. // ],
  1155. // "parameters": {
  1156. // "filter": {
  1157. // "description": "The standard list filter.",
  1158. // "location": "query",
  1159. // "type": "string"
  1160. // },
  1161. // "name": {
  1162. // "description": "The resource that owns the locations collection, if applicable.",
  1163. // "location": "path",
  1164. // "pattern": "^projects/[^/]+$",
  1165. // "required": true,
  1166. // "type": "string"
  1167. // },
  1168. // "pageSize": {
  1169. // "description": "The standard list page size.",
  1170. // "format": "int32",
  1171. // "location": "query",
  1172. // "type": "integer"
  1173. // },
  1174. // "pageToken": {
  1175. // "description": "The standard list page token.",
  1176. // "location": "query",
  1177. // "type": "string"
  1178. // }
  1179. // },
  1180. // "path": "v1alpha1/{+name}/locations",
  1181. // "response": {
  1182. // "$ref": "ListLocationsResponse"
  1183. // },
  1184. // "scopes": [
  1185. // "https://www.googleapis.com/auth/cloud-platform"
  1186. // ]
  1187. // }
  1188. }
  1189. // Pages invokes f for each page of results.
  1190. // A non-nil error returned from f will halt the iteration.
  1191. // The provided context supersedes any context provided to the Context method.
  1192. func (c *ProjectsLocationsListCall) Pages(ctx context.Context, f func(*ListLocationsResponse) error) error {
  1193. c.ctx_ = ctx
  1194. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  1195. for {
  1196. x, err := c.Do()
  1197. if err != nil {
  1198. return err
  1199. }
  1200. if err := f(x); err != nil {
  1201. return err
  1202. }
  1203. if x.NextPageToken == "" {
  1204. return nil
  1205. }
  1206. c.PageToken(x.NextPageToken)
  1207. }
  1208. }
  1209. // method id "tpu.projects.locations.acceleratorTypes.get":
  1210. type ProjectsLocationsAcceleratorTypesGetCall struct {
  1211. s *Service
  1212. name string
  1213. urlParams_ gensupport.URLParams
  1214. ifNoneMatch_ string
  1215. ctx_ context.Context
  1216. header_ http.Header
  1217. }
  1218. // Get: Gets AcceleratorType.
  1219. func (r *ProjectsLocationsAcceleratorTypesService) Get(name string) *ProjectsLocationsAcceleratorTypesGetCall {
  1220. c := &ProjectsLocationsAcceleratorTypesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1221. c.name = name
  1222. return c
  1223. }
  1224. // Fields allows partial responses to be retrieved. See
  1225. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1226. // for more information.
  1227. func (c *ProjectsLocationsAcceleratorTypesGetCall) Fields(s ...googleapi.Field) *ProjectsLocationsAcceleratorTypesGetCall {
  1228. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1229. return c
  1230. }
  1231. // IfNoneMatch sets the optional parameter which makes the operation
  1232. // fail if the object's ETag matches the given value. This is useful for
  1233. // getting updates only after the object has changed since the last
  1234. // request. Use googleapi.IsNotModified to check whether the response
  1235. // error from Do is the result of In-None-Match.
  1236. func (c *ProjectsLocationsAcceleratorTypesGetCall) IfNoneMatch(entityTag string) *ProjectsLocationsAcceleratorTypesGetCall {
  1237. c.ifNoneMatch_ = entityTag
  1238. return c
  1239. }
  1240. // Context sets the context to be used in this call's Do method. Any
  1241. // pending HTTP request will be aborted if the provided context is
  1242. // canceled.
  1243. func (c *ProjectsLocationsAcceleratorTypesGetCall) Context(ctx context.Context) *ProjectsLocationsAcceleratorTypesGetCall {
  1244. c.ctx_ = ctx
  1245. return c
  1246. }
  1247. // Header returns an http.Header that can be modified by the caller to
  1248. // add HTTP headers to the request.
  1249. func (c *ProjectsLocationsAcceleratorTypesGetCall) Header() http.Header {
  1250. if c.header_ == nil {
  1251. c.header_ = make(http.Header)
  1252. }
  1253. return c.header_
  1254. }
  1255. func (c *ProjectsLocationsAcceleratorTypesGetCall) doRequest(alt string) (*http.Response, error) {
  1256. reqHeaders := make(http.Header)
  1257. for k, v := range c.header_ {
  1258. reqHeaders[k] = v
  1259. }
  1260. reqHeaders.Set("User-Agent", c.s.userAgent())
  1261. if c.ifNoneMatch_ != "" {
  1262. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1263. }
  1264. var body io.Reader = nil
  1265. c.urlParams_.Set("alt", alt)
  1266. c.urlParams_.Set("prettyPrint", "false")
  1267. urls := googleapi.ResolveRelative(c.s.BasePath, "v1alpha1/{+name}")
  1268. urls += "?" + c.urlParams_.Encode()
  1269. req, err := http.NewRequest("GET", urls, body)
  1270. if err != nil {
  1271. return nil, err
  1272. }
  1273. req.Header = reqHeaders
  1274. googleapi.Expand(req.URL, map[string]string{
  1275. "name": c.name,
  1276. })
  1277. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1278. }
  1279. // Do executes the "tpu.projects.locations.acceleratorTypes.get" call.
  1280. // Exactly one of *AcceleratorType or error will be non-nil. Any non-2xx
  1281. // status code is an error. Response headers are in either
  1282. // *AcceleratorType.ServerResponse.Header or (if a response was returned
  1283. // at all) in error.(*googleapi.Error).Header. Use
  1284. // googleapi.IsNotModified to check whether the returned error was
  1285. // because http.StatusNotModified was returned.
  1286. func (c *ProjectsLocationsAcceleratorTypesGetCall) Do(opts ...googleapi.CallOption) (*AcceleratorType, error) {
  1287. gensupport.SetOptions(c.urlParams_, opts...)
  1288. res, err := c.doRequest("json")
  1289. if res != nil && res.StatusCode == http.StatusNotModified {
  1290. if res.Body != nil {
  1291. res.Body.Close()
  1292. }
  1293. return nil, &googleapi.Error{
  1294. Code: res.StatusCode,
  1295. Header: res.Header,
  1296. }
  1297. }
  1298. if err != nil {
  1299. return nil, err
  1300. }
  1301. defer googleapi.CloseBody(res)
  1302. if err := googleapi.CheckResponse(res); err != nil {
  1303. return nil, err
  1304. }
  1305. ret := &AcceleratorType{
  1306. ServerResponse: googleapi.ServerResponse{
  1307. Header: res.Header,
  1308. HTTPStatusCode: res.StatusCode,
  1309. },
  1310. }
  1311. target := &ret
  1312. if err := gensupport.DecodeResponse(target, res); err != nil {
  1313. return nil, err
  1314. }
  1315. return ret, nil
  1316. // {
  1317. // "description": "Gets AcceleratorType.",
  1318. // "flatPath": "v1alpha1/projects/{projectsId}/locations/{locationsId}/acceleratorTypes/{acceleratorTypesId}",
  1319. // "httpMethod": "GET",
  1320. // "id": "tpu.projects.locations.acceleratorTypes.get",
  1321. // "parameterOrder": [
  1322. // "name"
  1323. // ],
  1324. // "parameters": {
  1325. // "name": {
  1326. // "description": "The resource name.",
  1327. // "location": "path",
  1328. // "pattern": "^projects/[^/]+/locations/[^/]+/acceleratorTypes/[^/]+$",
  1329. // "required": true,
  1330. // "type": "string"
  1331. // }
  1332. // },
  1333. // "path": "v1alpha1/{+name}",
  1334. // "response": {
  1335. // "$ref": "AcceleratorType"
  1336. // },
  1337. // "scopes": [
  1338. // "https://www.googleapis.com/auth/cloud-platform"
  1339. // ]
  1340. // }
  1341. }
  1342. // method id "tpu.projects.locations.acceleratorTypes.list":
  1343. type ProjectsLocationsAcceleratorTypesListCall struct {
  1344. s *Service
  1345. parent string
  1346. urlParams_ gensupport.URLParams
  1347. ifNoneMatch_ string
  1348. ctx_ context.Context
  1349. header_ http.Header
  1350. }
  1351. // List: Lists accelerator types supported by this API.
  1352. func (r *ProjectsLocationsAcceleratorTypesService) List(parent string) *ProjectsLocationsAcceleratorTypesListCall {
  1353. c := &ProjectsLocationsAcceleratorTypesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1354. c.parent = parent
  1355. return c
  1356. }
  1357. // Filter sets the optional parameter "filter": List filter.
  1358. func (c *ProjectsLocationsAcceleratorTypesListCall) Filter(filter string) *ProjectsLocationsAcceleratorTypesListCall {
  1359. c.urlParams_.Set("filter", filter)
  1360. return c
  1361. }
  1362. // OrderBy sets the optional parameter "orderBy": Sort results.
  1363. func (c *ProjectsLocationsAcceleratorTypesListCall) OrderBy(orderBy string) *ProjectsLocationsAcceleratorTypesListCall {
  1364. c.urlParams_.Set("orderBy", orderBy)
  1365. return c
  1366. }
  1367. // PageSize sets the optional parameter "pageSize": The maximum number
  1368. // of items to return.
  1369. func (c *ProjectsLocationsAcceleratorTypesListCall) PageSize(pageSize int64) *ProjectsLocationsAcceleratorTypesListCall {
  1370. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  1371. return c
  1372. }
  1373. // PageToken sets the optional parameter "pageToken": The
  1374. // next_page_token value returned from a previous List request, if any.
  1375. func (c *ProjectsLocationsAcceleratorTypesListCall) PageToken(pageToken string) *ProjectsLocationsAcceleratorTypesListCall {
  1376. c.urlParams_.Set("pageToken", pageToken)
  1377. return c
  1378. }
  1379. // Fields allows partial responses to be retrieved. See
  1380. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1381. // for more information.
  1382. func (c *ProjectsLocationsAcceleratorTypesListCall) Fields(s ...googleapi.Field) *ProjectsLocationsAcceleratorTypesListCall {
  1383. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1384. return c
  1385. }
  1386. // IfNoneMatch sets the optional parameter which makes the operation
  1387. // fail if the object's ETag matches the given value. This is useful for
  1388. // getting updates only after the object has changed since the last
  1389. // request. Use googleapi.IsNotModified to check whether the response
  1390. // error from Do is the result of In-None-Match.
  1391. func (c *ProjectsLocationsAcceleratorTypesListCall) IfNoneMatch(entityTag string) *ProjectsLocationsAcceleratorTypesListCall {
  1392. c.ifNoneMatch_ = entityTag
  1393. return c
  1394. }
  1395. // Context sets the context to be used in this call's Do method. Any
  1396. // pending HTTP request will be aborted if the provided context is
  1397. // canceled.
  1398. func (c *ProjectsLocationsAcceleratorTypesListCall) Context(ctx context.Context) *ProjectsLocationsAcceleratorTypesListCall {
  1399. c.ctx_ = ctx
  1400. return c
  1401. }
  1402. // Header returns an http.Header that can be modified by the caller to
  1403. // add HTTP headers to the request.
  1404. func (c *ProjectsLocationsAcceleratorTypesListCall) Header() http.Header {
  1405. if c.header_ == nil {
  1406. c.header_ = make(http.Header)
  1407. }
  1408. return c.header_
  1409. }
  1410. func (c *ProjectsLocationsAcceleratorTypesListCall) doRequest(alt string) (*http.Response, error) {
  1411. reqHeaders := make(http.Header)
  1412. for k, v := range c.header_ {
  1413. reqHeaders[k] = v
  1414. }
  1415. reqHeaders.Set("User-Agent", c.s.userAgent())
  1416. if c.ifNoneMatch_ != "" {
  1417. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1418. }
  1419. var body io.Reader = nil
  1420. c.urlParams_.Set("alt", alt)
  1421. c.urlParams_.Set("prettyPrint", "false")
  1422. urls := googleapi.ResolveRelative(c.s.BasePath, "v1alpha1/{+parent}/acceleratorTypes")
  1423. urls += "?" + c.urlParams_.Encode()
  1424. req, err := http.NewRequest("GET", urls, body)
  1425. if err != nil {
  1426. return nil, err
  1427. }
  1428. req.Header = reqHeaders
  1429. googleapi.Expand(req.URL, map[string]string{
  1430. "parent": c.parent,
  1431. })
  1432. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1433. }
  1434. // Do executes the "tpu.projects.locations.acceleratorTypes.list" call.
  1435. // Exactly one of *ListAcceleratorTypesResponse or error will be
  1436. // non-nil. Any non-2xx status code is an error. Response headers are in
  1437. // either *ListAcceleratorTypesResponse.ServerResponse.Header or (if a
  1438. // response was returned at all) in error.(*googleapi.Error).Header. Use
  1439. // googleapi.IsNotModified to check whether the returned error was
  1440. // because http.StatusNotModified was returned.
  1441. func (c *ProjectsLocationsAcceleratorTypesListCall) Do(opts ...googleapi.CallOption) (*ListAcceleratorTypesResponse, error) {
  1442. gensupport.SetOptions(c.urlParams_, opts...)
  1443. res, err := c.doRequest("json")
  1444. if res != nil && res.StatusCode == http.StatusNotModified {
  1445. if res.Body != nil {
  1446. res.Body.Close()
  1447. }
  1448. return nil, &googleapi.Error{
  1449. Code: res.StatusCode,
  1450. Header: res.Header,
  1451. }
  1452. }
  1453. if err != nil {
  1454. return nil, err
  1455. }
  1456. defer googleapi.CloseBody(res)
  1457. if err := googleapi.CheckResponse(res); err != nil {
  1458. return nil, err
  1459. }
  1460. ret := &ListAcceleratorTypesResponse{
  1461. ServerResponse: googleapi.ServerResponse{
  1462. Header: res.Header,
  1463. HTTPStatusCode: res.StatusCode,
  1464. },
  1465. }
  1466. target := &ret
  1467. if err := gensupport.DecodeResponse(target, res); err != nil {
  1468. return nil, err
  1469. }
  1470. return ret, nil
  1471. // {
  1472. // "description": "Lists accelerator types supported by this API.",
  1473. // "flatPath": "v1alpha1/projects/{projectsId}/locations/{locationsId}/acceleratorTypes",
  1474. // "httpMethod": "GET",
  1475. // "id": "tpu.projects.locations.acceleratorTypes.list",
  1476. // "parameterOrder": [
  1477. // "parent"
  1478. // ],
  1479. // "parameters": {
  1480. // "filter": {
  1481. // "description": "List filter.",
  1482. // "location": "query",
  1483. // "type": "string"
  1484. // },
  1485. // "orderBy": {
  1486. // "description": "Sort results.",
  1487. // "location": "query",
  1488. // "type": "string"
  1489. // },
  1490. // "pageSize": {
  1491. // "description": "The maximum number of items to return.",
  1492. // "format": "int32",
  1493. // "location": "query",
  1494. // "type": "integer"
  1495. // },
  1496. // "pageToken": {
  1497. // "description": "The next_page_token value returned from a previous List request, if any.",
  1498. // "location": "query",
  1499. // "type": "string"
  1500. // },
  1501. // "parent": {
  1502. // "description": "The parent resource name.",
  1503. // "location": "path",
  1504. // "pattern": "^projects/[^/]+/locations/[^/]+$",
  1505. // "required": true,
  1506. // "type": "string"
  1507. // }
  1508. // },
  1509. // "path": "v1alpha1/{+parent}/acceleratorTypes",
  1510. // "response": {
  1511. // "$ref": "ListAcceleratorTypesResponse"
  1512. // },
  1513. // "scopes": [
  1514. // "https://www.googleapis.com/auth/cloud-platform"
  1515. // ]
  1516. // }
  1517. }
  1518. // Pages invokes f for each page of results.
  1519. // A non-nil error returned from f will halt the iteration.
  1520. // The provided context supersedes any context provided to the Context method.
  1521. func (c *ProjectsLocationsAcceleratorTypesListCall) Pages(ctx context.Context, f func(*ListAcceleratorTypesResponse) error) error {
  1522. c.ctx_ = ctx
  1523. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  1524. for {
  1525. x, err := c.Do()
  1526. if err != nil {
  1527. return err
  1528. }
  1529. if err := f(x); err != nil {
  1530. return err
  1531. }
  1532. if x.NextPageToken == "" {
  1533. return nil
  1534. }
  1535. c.PageToken(x.NextPageToken)
  1536. }
  1537. }
  1538. // method id "tpu.projects.locations.nodes.create":
  1539. type ProjectsLocationsNodesCreateCall struct {
  1540. s *Service
  1541. parent string
  1542. node *Node
  1543. urlParams_ gensupport.URLParams
  1544. ctx_ context.Context
  1545. header_ http.Header
  1546. }
  1547. // Create: Creates a node.
  1548. func (r *ProjectsLocationsNodesService) Create(parent string, node *Node) *ProjectsLocationsNodesCreateCall {
  1549. c := &ProjectsLocationsNodesCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1550. c.parent = parent
  1551. c.node = node
  1552. return c
  1553. }
  1554. // NodeId sets the optional parameter "nodeId": The unqualified resource
  1555. // name.
  1556. func (c *ProjectsLocationsNodesCreateCall) NodeId(nodeId string) *ProjectsLocationsNodesCreateCall {
  1557. c.urlParams_.Set("nodeId", nodeId)
  1558. return c
  1559. }
  1560. // Fields allows partial responses to be retrieved. See
  1561. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1562. // for more information.
  1563. func (c *ProjectsLocationsNodesCreateCall) Fields(s ...googleapi.Field) *ProjectsLocationsNodesCreateCall {
  1564. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1565. return c
  1566. }
  1567. // Context sets the context to be used in this call's Do method. Any
  1568. // pending HTTP request will be aborted if the provided context is
  1569. // canceled.
  1570. func (c *ProjectsLocationsNodesCreateCall) Context(ctx context.Context) *ProjectsLocationsNodesCreateCall {
  1571. c.ctx_ = ctx
  1572. return c
  1573. }
  1574. // Header returns an http.Header that can be modified by the caller to
  1575. // add HTTP headers to the request.
  1576. func (c *ProjectsLocationsNodesCreateCall) Header() http.Header {
  1577. if c.header_ == nil {
  1578. c.header_ = make(http.Header)
  1579. }
  1580. return c.header_
  1581. }
  1582. func (c *ProjectsLocationsNodesCreateCall) doRequest(alt string) (*http.Response, error) {
  1583. reqHeaders := make(http.Header)
  1584. for k, v := range c.header_ {
  1585. reqHeaders[k] = v
  1586. }
  1587. reqHeaders.Set("User-Agent", c.s.userAgent())
  1588. var body io.Reader = nil
  1589. body, err := googleapi.WithoutDataWrapper.JSONReader(c.node)
  1590. if err != nil {
  1591. return nil, err
  1592. }
  1593. reqHeaders.Set("Content-Type", "application/json")
  1594. c.urlParams_.Set("alt", alt)
  1595. c.urlParams_.Set("prettyPrint", "false")
  1596. urls := googleapi.ResolveRelative(c.s.BasePath, "v1alpha1/{+parent}/nodes")
  1597. urls += "?" + c.urlParams_.Encode()
  1598. req, err := http.NewRequest("POST", urls, body)
  1599. if err != nil {
  1600. return nil, err
  1601. }
  1602. req.Header = reqHeaders
  1603. googleapi.Expand(req.URL, map[string]string{
  1604. "parent": c.parent,
  1605. })
  1606. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1607. }
  1608. // Do executes the "tpu.projects.locations.nodes.create" call.
  1609. // Exactly one of *Operation or error will be non-nil. Any non-2xx
  1610. // status code is an error. Response headers are in either
  1611. // *Operation.ServerResponse.Header or (if a response was returned at
  1612. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  1613. // to check whether the returned error was because
  1614. // http.StatusNotModified was returned.
  1615. func (c *ProjectsLocationsNodesCreateCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
  1616. gensupport.SetOptions(c.urlParams_, opts...)
  1617. res, err := c.doRequest("json")
  1618. if res != nil && res.StatusCode == http.StatusNotModified {
  1619. if res.Body != nil {
  1620. res.Body.Close()
  1621. }
  1622. return nil, &googleapi.Error{
  1623. Code: res.StatusCode,
  1624. Header: res.Header,
  1625. }
  1626. }
  1627. if err != nil {
  1628. return nil, err
  1629. }
  1630. defer googleapi.CloseBody(res)
  1631. if err := googleapi.CheckResponse(res); err != nil {
  1632. return nil, err
  1633. }
  1634. ret := &Operation{
  1635. ServerResponse: googleapi.ServerResponse{
  1636. Header: res.Header,
  1637. HTTPStatusCode: res.StatusCode,
  1638. },
  1639. }
  1640. target := &ret
  1641. if err := gensupport.DecodeResponse(target, res); err != nil {
  1642. return nil, err
  1643. }
  1644. return ret, nil
  1645. // {
  1646. // "description": "Creates a node.",
  1647. // "flatPath": "v1alpha1/projects/{projectsId}/locations/{locationsId}/nodes",
  1648. // "httpMethod": "POST",
  1649. // "id": "tpu.projects.locations.nodes.create",
  1650. // "parameterOrder": [
  1651. // "parent"
  1652. // ],
  1653. // "parameters": {
  1654. // "nodeId": {
  1655. // "description": "The unqualified resource name.",
  1656. // "location": "query",
  1657. // "type": "string"
  1658. // },
  1659. // "parent": {
  1660. // "description": "The parent resource name.",
  1661. // "location": "path",
  1662. // "pattern": "^projects/[^/]+/locations/[^/]+$",
  1663. // "required": true,
  1664. // "type": "string"
  1665. // }
  1666. // },
  1667. // "path": "v1alpha1/{+parent}/nodes",
  1668. // "request": {
  1669. // "$ref": "Node"
  1670. // },
  1671. // "response": {
  1672. // "$ref": "Operation"
  1673. // },
  1674. // "scopes": [
  1675. // "https://www.googleapis.com/auth/cloud-platform"
  1676. // ]
  1677. // }
  1678. }
  1679. // method id "tpu.projects.locations.nodes.delete":
  1680. type ProjectsLocationsNodesDeleteCall struct {
  1681. s *Service
  1682. name string
  1683. urlParams_ gensupport.URLParams
  1684. ctx_ context.Context
  1685. header_ http.Header
  1686. }
  1687. // Delete: Deletes a node.
  1688. func (r *ProjectsLocationsNodesService) Delete(name string) *ProjectsLocationsNodesDeleteCall {
  1689. c := &ProjectsLocationsNodesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1690. c.name = name
  1691. return c
  1692. }
  1693. // Fields allows partial responses to be retrieved. See
  1694. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1695. // for more information.
  1696. func (c *ProjectsLocationsNodesDeleteCall) Fields(s ...googleapi.Field) *ProjectsLocationsNodesDeleteCall {
  1697. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1698. return c
  1699. }
  1700. // Context sets the context to be used in this call's Do method. Any
  1701. // pending HTTP request will be aborted if the provided context is
  1702. // canceled.
  1703. func (c *ProjectsLocationsNodesDeleteCall) Context(ctx context.Context) *ProjectsLocationsNodesDeleteCall {
  1704. c.ctx_ = ctx
  1705. return c
  1706. }
  1707. // Header returns an http.Header that can be modified by the caller to
  1708. // add HTTP headers to the request.
  1709. func (c *ProjectsLocationsNodesDeleteCall) Header() http.Header {
  1710. if c.header_ == nil {
  1711. c.header_ = make(http.Header)
  1712. }
  1713. return c.header_
  1714. }
  1715. func (c *ProjectsLocationsNodesDeleteCall) doRequest(alt string) (*http.Response, error) {
  1716. reqHeaders := make(http.Header)
  1717. for k, v := range c.header_ {
  1718. reqHeaders[k] = v
  1719. }
  1720. reqHeaders.Set("User-Agent", c.s.userAgent())
  1721. var body io.Reader = nil
  1722. c.urlParams_.Set("alt", alt)
  1723. c.urlParams_.Set("prettyPrint", "false")
  1724. urls := googleapi.ResolveRelative(c.s.BasePath, "v1alpha1/{+name}")
  1725. urls += "?" + c.urlParams_.Encode()
  1726. req, err := http.NewRequest("DELETE", urls, body)
  1727. if err != nil {
  1728. return nil, err
  1729. }
  1730. req.Header = reqHeaders
  1731. googleapi.Expand(req.URL, map[string]string{
  1732. "name": c.name,
  1733. })
  1734. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1735. }
  1736. // Do executes the "tpu.projects.locations.nodes.delete" call.
  1737. // Exactly one of *Operation or error will be non-nil. Any non-2xx
  1738. // status code is an error. Response headers are in either
  1739. // *Operation.ServerResponse.Header or (if a response was returned at
  1740. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  1741. // to check whether the returned error was because
  1742. // http.StatusNotModified was returned.
  1743. func (c *ProjectsLocationsNodesDeleteCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
  1744. gensupport.SetOptions(c.urlParams_, opts...)
  1745. res, err := c.doRequest("json")
  1746. if res != nil && res.StatusCode == http.StatusNotModified {
  1747. if res.Body != nil {
  1748. res.Body.Close()
  1749. }
  1750. return nil, &googleapi.Error{
  1751. Code: res.StatusCode,
  1752. Header: res.Header,
  1753. }
  1754. }
  1755. if err != nil {
  1756. return nil, err
  1757. }
  1758. defer googleapi.CloseBody(res)
  1759. if err := googleapi.CheckResponse(res); err != nil {
  1760. return nil, err
  1761. }
  1762. ret := &Operation{
  1763. ServerResponse: googleapi.ServerResponse{
  1764. Header: res.Header,
  1765. HTTPStatusCode: res.StatusCode,
  1766. },
  1767. }
  1768. target := &ret
  1769. if err := gensupport.DecodeResponse(target, res); err != nil {
  1770. return nil, err
  1771. }
  1772. return ret, nil
  1773. // {
  1774. // "description": "Deletes a node.",
  1775. // "flatPath": "v1alpha1/projects/{projectsId}/locations/{locationsId}/nodes/{nodesId}",
  1776. // "httpMethod": "DELETE",
  1777. // "id": "tpu.projects.locations.nodes.delete",
  1778. // "parameterOrder": [
  1779. // "name"
  1780. // ],
  1781. // "parameters": {
  1782. // "name": {
  1783. // "description": "The resource name.",
  1784. // "location": "path",
  1785. // "pattern": "^projects/[^/]+/locations/[^/]+/nodes/[^/]+$",
  1786. // "required": true,
  1787. // "type": "string"
  1788. // }
  1789. // },
  1790. // "path": "v1alpha1/{+name}",
  1791. // "response": {
  1792. // "$ref": "Operation"
  1793. // },
  1794. // "scopes": [
  1795. // "https://www.googleapis.com/auth/cloud-platform"
  1796. // ]
  1797. // }
  1798. }
  1799. // method id "tpu.projects.locations.nodes.get":
  1800. type ProjectsLocationsNodesGetCall struct {
  1801. s *Service
  1802. name string
  1803. urlParams_ gensupport.URLParams
  1804. ifNoneMatch_ string
  1805. ctx_ context.Context
  1806. header_ http.Header
  1807. }
  1808. // Get: Gets the details of a node.
  1809. func (r *ProjectsLocationsNodesService) Get(name string) *ProjectsLocationsNodesGetCall {
  1810. c := &ProjectsLocationsNodesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1811. c.name = name
  1812. return c
  1813. }
  1814. // Fields allows partial responses to be retrieved. See
  1815. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1816. // for more information.
  1817. func (c *ProjectsLocationsNodesGetCall) Fields(s ...googleapi.Field) *ProjectsLocationsNodesGetCall {
  1818. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1819. return c
  1820. }
  1821. // IfNoneMatch sets the optional parameter which makes the operation
  1822. // fail if the object's ETag matches the given value. This is useful for
  1823. // getting updates only after the object has changed since the last
  1824. // request. Use googleapi.IsNotModified to check whether the response
  1825. // error from Do is the result of In-None-Match.
  1826. func (c *ProjectsLocationsNodesGetCall) IfNoneMatch(entityTag string) *ProjectsLocationsNodesGetCall {
  1827. c.ifNoneMatch_ = entityTag
  1828. return c
  1829. }
  1830. // Context sets the context to be used in this call's Do method. Any
  1831. // pending HTTP request will be aborted if the provided context is
  1832. // canceled.
  1833. func (c *ProjectsLocationsNodesGetCall) Context(ctx context.Context) *ProjectsLocationsNodesGetCall {
  1834. c.ctx_ = ctx
  1835. return c
  1836. }
  1837. // Header returns an http.Header that can be modified by the caller to
  1838. // add HTTP headers to the request.
  1839. func (c *ProjectsLocationsNodesGetCall) Header() http.Header {
  1840. if c.header_ == nil {
  1841. c.header_ = make(http.Header)
  1842. }
  1843. return c.header_
  1844. }
  1845. func (c *ProjectsLocationsNodesGetCall) doRequest(alt string) (*http.Response, error) {
  1846. reqHeaders := make(http.Header)
  1847. for k, v := range c.header_ {
  1848. reqHeaders[k] = v
  1849. }
  1850. reqHeaders.Set("User-Agent", c.s.userAgent())
  1851. if c.ifNoneMatch_ != "" {
  1852. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1853. }
  1854. var body io.Reader = nil
  1855. c.urlParams_.Set("alt", alt)
  1856. c.urlParams_.Set("prettyPrint", "false")
  1857. urls := googleapi.ResolveRelative(c.s.BasePath, "v1alpha1/{+name}")
  1858. urls += "?" + c.urlParams_.Encode()
  1859. req, err := http.NewRequest("GET", urls, body)
  1860. if err != nil {
  1861. return nil, err
  1862. }
  1863. req.Header = reqHeaders
  1864. googleapi.Expand(req.URL, map[string]string{
  1865. "name": c.name,
  1866. })
  1867. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1868. }
  1869. // Do executes the "tpu.projects.locations.nodes.get" call.
  1870. // Exactly one of *Node or error will be non-nil. Any non-2xx status
  1871. // code is an error. Response headers are in either
  1872. // *Node.ServerResponse.Header or (if a response was returned at all) in
  1873. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  1874. // whether the returned error was because http.StatusNotModified was
  1875. // returned.
  1876. func (c *ProjectsLocationsNodesGetCall) Do(opts ...googleapi.CallOption) (*Node, error) {
  1877. gensupport.SetOptions(c.urlParams_, opts...)
  1878. res, err := c.doRequest("json")
  1879. if res != nil && res.StatusCode == http.StatusNotModified {
  1880. if res.Body != nil {
  1881. res.Body.Close()
  1882. }
  1883. return nil, &googleapi.Error{
  1884. Code: res.StatusCode,
  1885. Header: res.Header,
  1886. }
  1887. }
  1888. if err != nil {
  1889. return nil, err
  1890. }
  1891. defer googleapi.CloseBody(res)
  1892. if err := googleapi.CheckResponse(res); err != nil {
  1893. return nil, err
  1894. }
  1895. ret := &Node{
  1896. ServerResponse: googleapi.ServerResponse{
  1897. Header: res.Header,
  1898. HTTPStatusCode: res.StatusCode,
  1899. },
  1900. }
  1901. target := &ret
  1902. if err := gensupport.DecodeResponse(target, res); err != nil {
  1903. return nil, err
  1904. }
  1905. return ret, nil
  1906. // {
  1907. // "description": "Gets the details of a node.",
  1908. // "flatPath": "v1alpha1/projects/{projectsId}/locations/{locationsId}/nodes/{nodesId}",
  1909. // "httpMethod": "GET",
  1910. // "id": "tpu.projects.locations.nodes.get",
  1911. // "parameterOrder": [
  1912. // "name"
  1913. // ],
  1914. // "parameters": {
  1915. // "name": {
  1916. // "description": "The resource name.",
  1917. // "location": "path",
  1918. // "pattern": "^projects/[^/]+/locations/[^/]+/nodes/[^/]+$",
  1919. // "required": true,
  1920. // "type": "string"
  1921. // }
  1922. // },
  1923. // "path": "v1alpha1/{+name}",
  1924. // "response": {
  1925. // "$ref": "Node"
  1926. // },
  1927. // "scopes": [
  1928. // "https://www.googleapis.com/auth/cloud-platform"
  1929. // ]
  1930. // }
  1931. }
  1932. // method id "tpu.projects.locations.nodes.list":
  1933. type ProjectsLocationsNodesListCall struct {
  1934. s *Service
  1935. parent string
  1936. urlParams_ gensupport.URLParams
  1937. ifNoneMatch_ string
  1938. ctx_ context.Context
  1939. header_ http.Header
  1940. }
  1941. // List: Lists nodes.
  1942. func (r *ProjectsLocationsNodesService) List(parent string) *ProjectsLocationsNodesListCall {
  1943. c := &ProjectsLocationsNodesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1944. c.parent = parent
  1945. return c
  1946. }
  1947. // PageSize sets the optional parameter "pageSize": The maximum number
  1948. // of items to return.
  1949. func (c *ProjectsLocationsNodesListCall) PageSize(pageSize int64) *ProjectsLocationsNodesListCall {
  1950. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  1951. return c
  1952. }
  1953. // PageToken sets the optional parameter "pageToken": The
  1954. // next_page_token value returned from a previous List request, if any.
  1955. func (c *ProjectsLocationsNodesListCall) PageToken(pageToken string) *ProjectsLocationsNodesListCall {
  1956. c.urlParams_.Set("pageToken", pageToken)
  1957. return c
  1958. }
  1959. // Fields allows partial responses to be retrieved. See
  1960. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1961. // for more information.
  1962. func (c *ProjectsLocationsNodesListCall) Fields(s ...googleapi.Field) *ProjectsLocationsNodesListCall {
  1963. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1964. return c
  1965. }
  1966. // IfNoneMatch sets the optional parameter which makes the operation
  1967. // fail if the object's ETag matches the given value. This is useful for
  1968. // getting updates only after the object has changed since the last
  1969. // request. Use googleapi.IsNotModified to check whether the response
  1970. // error from Do is the result of In-None-Match.
  1971. func (c *ProjectsLocationsNodesListCall) IfNoneMatch(entityTag string) *ProjectsLocationsNodesListCall {
  1972. c.ifNoneMatch_ = entityTag
  1973. return c
  1974. }
  1975. // Context sets the context to be used in this call's Do method. Any
  1976. // pending HTTP request will be aborted if the provided context is
  1977. // canceled.
  1978. func (c *ProjectsLocationsNodesListCall) Context(ctx context.Context) *ProjectsLocationsNodesListCall {
  1979. c.ctx_ = ctx
  1980. return c
  1981. }
  1982. // Header returns an http.Header that can be modified by the caller to
  1983. // add HTTP headers to the request.
  1984. func (c *ProjectsLocationsNodesListCall) Header() http.Header {
  1985. if c.header_ == nil {
  1986. c.header_ = make(http.Header)
  1987. }
  1988. return c.header_
  1989. }
  1990. func (c *ProjectsLocationsNodesListCall) doRequest(alt string) (*http.Response, error) {
  1991. reqHeaders := make(http.Header)
  1992. for k, v := range c.header_ {
  1993. reqHeaders[k] = v
  1994. }
  1995. reqHeaders.Set("User-Agent", c.s.userAgent())
  1996. if c.ifNoneMatch_ != "" {
  1997. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1998. }
  1999. var body io.Reader = nil
  2000. c.urlParams_.Set("alt", alt)
  2001. c.urlParams_.Set("prettyPrint", "false")
  2002. urls := googleapi.ResolveRelative(c.s.BasePath, "v1alpha1/{+parent}/nodes")
  2003. urls += "?" + c.urlParams_.Encode()
  2004. req, err := http.NewRequest("GET", urls, body)
  2005. if err != nil {
  2006. return nil, err
  2007. }
  2008. req.Header = reqHeaders
  2009. googleapi.Expand(req.URL, map[string]string{
  2010. "parent": c.parent,
  2011. })
  2012. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2013. }
  2014. // Do executes the "tpu.projects.locations.nodes.list" call.
  2015. // Exactly one of *ListNodesResponse or error will be non-nil. Any
  2016. // non-2xx status code is an error. Response headers are in either
  2017. // *ListNodesResponse.ServerResponse.Header or (if a response was
  2018. // returned at all) in error.(*googleapi.Error).Header. Use
  2019. // googleapi.IsNotModified to check whether the returned error was
  2020. // because http.StatusNotModified was returned.
  2021. func (c *ProjectsLocationsNodesListCall) Do(opts ...googleapi.CallOption) (*ListNodesResponse, error) {
  2022. gensupport.SetOptions(c.urlParams_, opts...)
  2023. res, err := c.doRequest("json")
  2024. if res != nil && res.StatusCode == http.StatusNotModified {
  2025. if res.Body != nil {
  2026. res.Body.Close()
  2027. }
  2028. return nil, &googleapi.Error{
  2029. Code: res.StatusCode,
  2030. Header: res.Header,
  2031. }
  2032. }
  2033. if err != nil {
  2034. return nil, err
  2035. }
  2036. defer googleapi.CloseBody(res)
  2037. if err := googleapi.CheckResponse(res); err != nil {
  2038. return nil, err
  2039. }
  2040. ret := &ListNodesResponse{
  2041. ServerResponse: googleapi.ServerResponse{
  2042. Header: res.Header,
  2043. HTTPStatusCode: res.StatusCode,
  2044. },
  2045. }
  2046. target := &ret
  2047. if err := gensupport.DecodeResponse(target, res); err != nil {
  2048. return nil, err
  2049. }
  2050. return ret, nil
  2051. // {
  2052. // "description": "Lists nodes.",
  2053. // "flatPath": "v1alpha1/projects/{projectsId}/locations/{locationsId}/nodes",
  2054. // "httpMethod": "GET",
  2055. // "id": "tpu.projects.locations.nodes.list",
  2056. // "parameterOrder": [
  2057. // "parent"
  2058. // ],
  2059. // "parameters": {
  2060. // "pageSize": {
  2061. // "description": "The maximum number of items to return.",
  2062. // "format": "int32",
  2063. // "location": "query",
  2064. // "type": "integer"
  2065. // },
  2066. // "pageToken": {
  2067. // "description": "The next_page_token value returned from a previous List request, if any.",
  2068. // "location": "query",
  2069. // "type": "string"
  2070. // },
  2071. // "parent": {
  2072. // "description": "The parent resource name.",
  2073. // "location": "path",
  2074. // "pattern": "^projects/[^/]+/locations/[^/]+$",
  2075. // "required": true,
  2076. // "type": "string"
  2077. // }
  2078. // },
  2079. // "path": "v1alpha1/{+parent}/nodes",
  2080. // "response": {
  2081. // "$ref": "ListNodesResponse"
  2082. // },
  2083. // "scopes": [
  2084. // "https://www.googleapis.com/auth/cloud-platform"
  2085. // ]
  2086. // }
  2087. }
  2088. // Pages invokes f for each page of results.
  2089. // A non-nil error returned from f will halt the iteration.
  2090. // The provided context supersedes any context provided to the Context method.
  2091. func (c *ProjectsLocationsNodesListCall) Pages(ctx context.Context, f func(*ListNodesResponse) error) error {
  2092. c.ctx_ = ctx
  2093. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  2094. for {
  2095. x, err := c.Do()
  2096. if err != nil {
  2097. return err
  2098. }
  2099. if err := f(x); err != nil {
  2100. return err
  2101. }
  2102. if x.NextPageToken == "" {
  2103. return nil
  2104. }
  2105. c.PageToken(x.NextPageToken)
  2106. }
  2107. }
  2108. // method id "tpu.projects.locations.nodes.reimage":
  2109. type ProjectsLocationsNodesReimageCall struct {
  2110. s *Service
  2111. name string
  2112. reimagenoderequest *ReimageNodeRequest
  2113. urlParams_ gensupport.URLParams
  2114. ctx_ context.Context
  2115. header_ http.Header
  2116. }
  2117. // Reimage: Reimages a node's OS.
  2118. func (r *ProjectsLocationsNodesService) Reimage(name string, reimagenoderequest *ReimageNodeRequest) *ProjectsLocationsNodesReimageCall {
  2119. c := &ProjectsLocationsNodesReimageCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2120. c.name = name
  2121. c.reimagenoderequest = reimagenoderequest
  2122. return c
  2123. }
  2124. // Fields allows partial responses to be retrieved. See
  2125. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2126. // for more information.
  2127. func (c *ProjectsLocationsNodesReimageCall) Fields(s ...googleapi.Field) *ProjectsLocationsNodesReimageCall {
  2128. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2129. return c
  2130. }
  2131. // Context sets the context to be used in this call's Do method. Any
  2132. // pending HTTP request will be aborted if the provided context is
  2133. // canceled.
  2134. func (c *ProjectsLocationsNodesReimageCall) Context(ctx context.Context) *ProjectsLocationsNodesReimageCall {
  2135. c.ctx_ = ctx
  2136. return c
  2137. }
  2138. // Header returns an http.Header that can be modified by the caller to
  2139. // add HTTP headers to the request.
  2140. func (c *ProjectsLocationsNodesReimageCall) Header() http.Header {
  2141. if c.header_ == nil {
  2142. c.header_ = make(http.Header)
  2143. }
  2144. return c.header_
  2145. }
  2146. func (c *ProjectsLocationsNodesReimageCall) doRequest(alt string) (*http.Response, error) {
  2147. reqHeaders := make(http.Header)
  2148. for k, v := range c.header_ {
  2149. reqHeaders[k] = v
  2150. }
  2151. reqHeaders.Set("User-Agent", c.s.userAgent())
  2152. var body io.Reader = nil
  2153. body, err := googleapi.WithoutDataWrapper.JSONReader(c.reimagenoderequest)
  2154. if err != nil {
  2155. return nil, err
  2156. }
  2157. reqHeaders.Set("Content-Type", "application/json")
  2158. c.urlParams_.Set("alt", alt)
  2159. c.urlParams_.Set("prettyPrint", "false")
  2160. urls := googleapi.ResolveRelative(c.s.BasePath, "v1alpha1/{+name}:reimage")
  2161. urls += "?" + c.urlParams_.Encode()
  2162. req, err := http.NewRequest("POST", urls, body)
  2163. if err != nil {
  2164. return nil, err
  2165. }
  2166. req.Header = reqHeaders
  2167. googleapi.Expand(req.URL, map[string]string{
  2168. "name": c.name,
  2169. })
  2170. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2171. }
  2172. // Do executes the "tpu.projects.locations.nodes.reimage" call.
  2173. // Exactly one of *Operation or error will be non-nil. Any non-2xx
  2174. // status code is an error. Response headers are in either
  2175. // *Operation.ServerResponse.Header or (if a response was returned at
  2176. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  2177. // to check whether the returned error was because
  2178. // http.StatusNotModified was returned.
  2179. func (c *ProjectsLocationsNodesReimageCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
  2180. gensupport.SetOptions(c.urlParams_, opts...)
  2181. res, err := c.doRequest("json")
  2182. if res != nil && res.StatusCode == http.StatusNotModified {
  2183. if res.Body != nil {
  2184. res.Body.Close()
  2185. }
  2186. return nil, &googleapi.Error{
  2187. Code: res.StatusCode,
  2188. Header: res.Header,
  2189. }
  2190. }
  2191. if err != nil {
  2192. return nil, err
  2193. }
  2194. defer googleapi.CloseBody(res)
  2195. if err := googleapi.CheckResponse(res); err != nil {
  2196. return nil, err
  2197. }
  2198. ret := &Operation{
  2199. ServerResponse: googleapi.ServerResponse{
  2200. Header: res.Header,
  2201. HTTPStatusCode: res.StatusCode,
  2202. },
  2203. }
  2204. target := &ret
  2205. if err := gensupport.DecodeResponse(target, res); err != nil {
  2206. return nil, err
  2207. }
  2208. return ret, nil
  2209. // {
  2210. // "description": "Reimages a node's OS.",
  2211. // "flatPath": "v1alpha1/projects/{projectsId}/locations/{locationsId}/nodes/{nodesId}:reimage",
  2212. // "httpMethod": "POST",
  2213. // "id": "tpu.projects.locations.nodes.reimage",
  2214. // "parameterOrder": [
  2215. // "name"
  2216. // ],
  2217. // "parameters": {
  2218. // "name": {
  2219. // "description": "The resource name.",
  2220. // "location": "path",
  2221. // "pattern": "^projects/[^/]+/locations/[^/]+/nodes/[^/]+$",
  2222. // "required": true,
  2223. // "type": "string"
  2224. // }
  2225. // },
  2226. // "path": "v1alpha1/{+name}:reimage",
  2227. // "request": {
  2228. // "$ref": "ReimageNodeRequest"
  2229. // },
  2230. // "response": {
  2231. // "$ref": "Operation"
  2232. // },
  2233. // "scopes": [
  2234. // "https://www.googleapis.com/auth/cloud-platform"
  2235. // ]
  2236. // }
  2237. }
  2238. // method id "tpu.projects.locations.nodes.start":
  2239. type ProjectsLocationsNodesStartCall struct {
  2240. s *Service
  2241. name string
  2242. startnoderequest *StartNodeRequest
  2243. urlParams_ gensupport.URLParams
  2244. ctx_ context.Context
  2245. header_ http.Header
  2246. }
  2247. // Start: Starts a node.
  2248. func (r *ProjectsLocationsNodesService) Start(name string, startnoderequest *StartNodeRequest) *ProjectsLocationsNodesStartCall {
  2249. c := &ProjectsLocationsNodesStartCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2250. c.name = name
  2251. c.startnoderequest = startnoderequest
  2252. return c
  2253. }
  2254. // Fields allows partial responses to be retrieved. See
  2255. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2256. // for more information.
  2257. func (c *ProjectsLocationsNodesStartCall) Fields(s ...googleapi.Field) *ProjectsLocationsNodesStartCall {
  2258. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2259. return c
  2260. }
  2261. // Context sets the context to be used in this call's Do method. Any
  2262. // pending HTTP request will be aborted if the provided context is
  2263. // canceled.
  2264. func (c *ProjectsLocationsNodesStartCall) Context(ctx context.Context) *ProjectsLocationsNodesStartCall {
  2265. c.ctx_ = ctx
  2266. return c
  2267. }
  2268. // Header returns an http.Header that can be modified by the caller to
  2269. // add HTTP headers to the request.
  2270. func (c *ProjectsLocationsNodesStartCall) Header() http.Header {
  2271. if c.header_ == nil {
  2272. c.header_ = make(http.Header)
  2273. }
  2274. return c.header_
  2275. }
  2276. func (c *ProjectsLocationsNodesStartCall) doRequest(alt string) (*http.Response, error) {
  2277. reqHeaders := make(http.Header)
  2278. for k, v := range c.header_ {
  2279. reqHeaders[k] = v
  2280. }
  2281. reqHeaders.Set("User-Agent", c.s.userAgent())
  2282. var body io.Reader = nil
  2283. body, err := googleapi.WithoutDataWrapper.JSONReader(c.startnoderequest)
  2284. if err != nil {
  2285. return nil, err
  2286. }
  2287. reqHeaders.Set("Content-Type", "application/json")
  2288. c.urlParams_.Set("alt", alt)
  2289. c.urlParams_.Set("prettyPrint", "false")
  2290. urls := googleapi.ResolveRelative(c.s.BasePath, "v1alpha1/{+name}:start")
  2291. urls += "?" + c.urlParams_.Encode()
  2292. req, err := http.NewRequest("POST", urls, body)
  2293. if err != nil {
  2294. return nil, err
  2295. }
  2296. req.Header = reqHeaders
  2297. googleapi.Expand(req.URL, map[string]string{
  2298. "name": c.name,
  2299. })
  2300. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2301. }
  2302. // Do executes the "tpu.projects.locations.nodes.start" call.
  2303. // Exactly one of *Operation or error will be non-nil. Any non-2xx
  2304. // status code is an error. Response headers are in either
  2305. // *Operation.ServerResponse.Header or (if a response was returned at
  2306. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  2307. // to check whether the returned error was because
  2308. // http.StatusNotModified was returned.
  2309. func (c *ProjectsLocationsNodesStartCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
  2310. gensupport.SetOptions(c.urlParams_, opts...)
  2311. res, err := c.doRequest("json")
  2312. if res != nil && res.StatusCode == http.StatusNotModified {
  2313. if res.Body != nil {
  2314. res.Body.Close()
  2315. }
  2316. return nil, &googleapi.Error{
  2317. Code: res.StatusCode,
  2318. Header: res.Header,
  2319. }
  2320. }
  2321. if err != nil {
  2322. return nil, err
  2323. }
  2324. defer googleapi.CloseBody(res)
  2325. if err := googleapi.CheckResponse(res); err != nil {
  2326. return nil, err
  2327. }
  2328. ret := &Operation{
  2329. ServerResponse: googleapi.ServerResponse{
  2330. Header: res.Header,
  2331. HTTPStatusCode: res.StatusCode,
  2332. },
  2333. }
  2334. target := &ret
  2335. if err := gensupport.DecodeResponse(target, res); err != nil {
  2336. return nil, err
  2337. }
  2338. return ret, nil
  2339. // {
  2340. // "description": "Starts a node.",
  2341. // "flatPath": "v1alpha1/projects/{projectsId}/locations/{locationsId}/nodes/{nodesId}:start",
  2342. // "httpMethod": "POST",
  2343. // "id": "tpu.projects.locations.nodes.start",
  2344. // "parameterOrder": [
  2345. // "name"
  2346. // ],
  2347. // "parameters": {
  2348. // "name": {
  2349. // "description": "The resource name.",
  2350. // "location": "path",
  2351. // "pattern": "^projects/[^/]+/locations/[^/]+/nodes/[^/]+$",
  2352. // "required": true,
  2353. // "type": "string"
  2354. // }
  2355. // },
  2356. // "path": "v1alpha1/{+name}:start",
  2357. // "request": {
  2358. // "$ref": "StartNodeRequest"
  2359. // },
  2360. // "response": {
  2361. // "$ref": "Operation"
  2362. // },
  2363. // "scopes": [
  2364. // "https://www.googleapis.com/auth/cloud-platform"
  2365. // ]
  2366. // }
  2367. }
  2368. // method id "tpu.projects.locations.nodes.stop":
  2369. type ProjectsLocationsNodesStopCall struct {
  2370. s *Service
  2371. name string
  2372. stopnoderequest *StopNodeRequest
  2373. urlParams_ gensupport.URLParams
  2374. ctx_ context.Context
  2375. header_ http.Header
  2376. }
  2377. // Stop: Stops a node.
  2378. func (r *ProjectsLocationsNodesService) Stop(name string, stopnoderequest *StopNodeRequest) *ProjectsLocationsNodesStopCall {
  2379. c := &ProjectsLocationsNodesStopCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2380. c.name = name
  2381. c.stopnoderequest = stopnoderequest
  2382. return c
  2383. }
  2384. // Fields allows partial responses to be retrieved. See
  2385. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2386. // for more information.
  2387. func (c *ProjectsLocationsNodesStopCall) Fields(s ...googleapi.Field) *ProjectsLocationsNodesStopCall {
  2388. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2389. return c
  2390. }
  2391. // Context sets the context to be used in this call's Do method. Any
  2392. // pending HTTP request will be aborted if the provided context is
  2393. // canceled.
  2394. func (c *ProjectsLocationsNodesStopCall) Context(ctx context.Context) *ProjectsLocationsNodesStopCall {
  2395. c.ctx_ = ctx
  2396. return c
  2397. }
  2398. // Header returns an http.Header that can be modified by the caller to
  2399. // add HTTP headers to the request.
  2400. func (c *ProjectsLocationsNodesStopCall) Header() http.Header {
  2401. if c.header_ == nil {
  2402. c.header_ = make(http.Header)
  2403. }
  2404. return c.header_
  2405. }
  2406. func (c *ProjectsLocationsNodesStopCall) doRequest(alt string) (*http.Response, error) {
  2407. reqHeaders := make(http.Header)
  2408. for k, v := range c.header_ {
  2409. reqHeaders[k] = v
  2410. }
  2411. reqHeaders.Set("User-Agent", c.s.userAgent())
  2412. var body io.Reader = nil
  2413. body, err := googleapi.WithoutDataWrapper.JSONReader(c.stopnoderequest)
  2414. if err != nil {
  2415. return nil, err
  2416. }
  2417. reqHeaders.Set("Content-Type", "application/json")
  2418. c.urlParams_.Set("alt", alt)
  2419. c.urlParams_.Set("prettyPrint", "false")
  2420. urls := googleapi.ResolveRelative(c.s.BasePath, "v1alpha1/{+name}:stop")
  2421. urls += "?" + c.urlParams_.Encode()
  2422. req, err := http.NewRequest("POST", urls, body)
  2423. if err != nil {
  2424. return nil, err
  2425. }
  2426. req.Header = reqHeaders
  2427. googleapi.Expand(req.URL, map[string]string{
  2428. "name": c.name,
  2429. })
  2430. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2431. }
  2432. // Do executes the "tpu.projects.locations.nodes.stop" call.
  2433. // Exactly one of *Operation or error will be non-nil. Any non-2xx
  2434. // status code is an error. Response headers are in either
  2435. // *Operation.ServerResponse.Header or (if a response was returned at
  2436. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  2437. // to check whether the returned error was because
  2438. // http.StatusNotModified was returned.
  2439. func (c *ProjectsLocationsNodesStopCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
  2440. gensupport.SetOptions(c.urlParams_, opts...)
  2441. res, err := c.doRequest("json")
  2442. if res != nil && res.StatusCode == http.StatusNotModified {
  2443. if res.Body != nil {
  2444. res.Body.Close()
  2445. }
  2446. return nil, &googleapi.Error{
  2447. Code: res.StatusCode,
  2448. Header: res.Header,
  2449. }
  2450. }
  2451. if err != nil {
  2452. return nil, err
  2453. }
  2454. defer googleapi.CloseBody(res)
  2455. if err := googleapi.CheckResponse(res); err != nil {
  2456. return nil, err
  2457. }
  2458. ret := &Operation{
  2459. ServerResponse: googleapi.ServerResponse{
  2460. Header: res.Header,
  2461. HTTPStatusCode: res.StatusCode,
  2462. },
  2463. }
  2464. target := &ret
  2465. if err := gensupport.DecodeResponse(target, res); err != nil {
  2466. return nil, err
  2467. }
  2468. return ret, nil
  2469. // {
  2470. // "description": "Stops a node.",
  2471. // "flatPath": "v1alpha1/projects/{projectsId}/locations/{locationsId}/nodes/{nodesId}:stop",
  2472. // "httpMethod": "POST",
  2473. // "id": "tpu.projects.locations.nodes.stop",
  2474. // "parameterOrder": [
  2475. // "name"
  2476. // ],
  2477. // "parameters": {
  2478. // "name": {
  2479. // "description": "The resource name.",
  2480. // "location": "path",
  2481. // "pattern": "^projects/[^/]+/locations/[^/]+/nodes/[^/]+$",
  2482. // "required": true,
  2483. // "type": "string"
  2484. // }
  2485. // },
  2486. // "path": "v1alpha1/{+name}:stop",
  2487. // "request": {
  2488. // "$ref": "StopNodeRequest"
  2489. // },
  2490. // "response": {
  2491. // "$ref": "Operation"
  2492. // },
  2493. // "scopes": [
  2494. // "https://www.googleapis.com/auth/cloud-platform"
  2495. // ]
  2496. // }
  2497. }
  2498. // method id "tpu.projects.locations.operations.cancel":
  2499. type ProjectsLocationsOperationsCancelCall struct {
  2500. s *Service
  2501. name string
  2502. urlParams_ gensupport.URLParams
  2503. ctx_ context.Context
  2504. header_ http.Header
  2505. }
  2506. // Cancel: Starts asynchronous cancellation on a long-running operation.
  2507. // The server
  2508. // makes a best effort to cancel the operation, but success is
  2509. // not
  2510. // guaranteed. If the server doesn't support this method, it
  2511. // returns
  2512. // `google.rpc.Code.UNIMPLEMENTED`. Clients can
  2513. // use
  2514. // Operations.GetOperation or
  2515. // other methods to check whether the cancellation succeeded or whether
  2516. // the
  2517. // operation completed despite cancellation. On successful
  2518. // cancellation,
  2519. // the operation is not deleted; instead, it becomes an operation
  2520. // with
  2521. // an Operation.error value with a google.rpc.Status.code of
  2522. // 1,
  2523. // corresponding to `Code.CANCELLED`.
  2524. func (r *ProjectsLocationsOperationsService) Cancel(name string) *ProjectsLocationsOperationsCancelCall {
  2525. c := &ProjectsLocationsOperationsCancelCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2526. c.name = name
  2527. return c
  2528. }
  2529. // Fields allows partial responses to be retrieved. See
  2530. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2531. // for more information.
  2532. func (c *ProjectsLocationsOperationsCancelCall) Fields(s ...googleapi.Field) *ProjectsLocationsOperationsCancelCall {
  2533. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2534. return c
  2535. }
  2536. // Context sets the context to be used in this call's Do method. Any
  2537. // pending HTTP request will be aborted if the provided context is
  2538. // canceled.
  2539. func (c *ProjectsLocationsOperationsCancelCall) Context(ctx context.Context) *ProjectsLocationsOperationsCancelCall {
  2540. c.ctx_ = ctx
  2541. return c
  2542. }
  2543. // Header returns an http.Header that can be modified by the caller to
  2544. // add HTTP headers to the request.
  2545. func (c *ProjectsLocationsOperationsCancelCall) Header() http.Header {
  2546. if c.header_ == nil {
  2547. c.header_ = make(http.Header)
  2548. }
  2549. return c.header_
  2550. }
  2551. func (c *ProjectsLocationsOperationsCancelCall) doRequest(alt string) (*http.Response, error) {
  2552. reqHeaders := make(http.Header)
  2553. for k, v := range c.header_ {
  2554. reqHeaders[k] = v
  2555. }
  2556. reqHeaders.Set("User-Agent", c.s.userAgent())
  2557. var body io.Reader = nil
  2558. c.urlParams_.Set("alt", alt)
  2559. c.urlParams_.Set("prettyPrint", "false")
  2560. urls := googleapi.ResolveRelative(c.s.BasePath, "v1alpha1/{+name}:cancel")
  2561. urls += "?" + c.urlParams_.Encode()
  2562. req, err := http.NewRequest("POST", urls, body)
  2563. if err != nil {
  2564. return nil, err
  2565. }
  2566. req.Header = reqHeaders
  2567. googleapi.Expand(req.URL, map[string]string{
  2568. "name": c.name,
  2569. })
  2570. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2571. }
  2572. // Do executes the "tpu.projects.locations.operations.cancel" call.
  2573. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  2574. // code is an error. Response headers are in either
  2575. // *Empty.ServerResponse.Header or (if a response was returned at all)
  2576. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2577. // check whether the returned error was because http.StatusNotModified
  2578. // was returned.
  2579. func (c *ProjectsLocationsOperationsCancelCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  2580. gensupport.SetOptions(c.urlParams_, opts...)
  2581. res, err := c.doRequest("json")
  2582. if res != nil && res.StatusCode == http.StatusNotModified {
  2583. if res.Body != nil {
  2584. res.Body.Close()
  2585. }
  2586. return nil, &googleapi.Error{
  2587. Code: res.StatusCode,
  2588. Header: res.Header,
  2589. }
  2590. }
  2591. if err != nil {
  2592. return nil, err
  2593. }
  2594. defer googleapi.CloseBody(res)
  2595. if err := googleapi.CheckResponse(res); err != nil {
  2596. return nil, err
  2597. }
  2598. ret := &Empty{
  2599. ServerResponse: googleapi.ServerResponse{
  2600. Header: res.Header,
  2601. HTTPStatusCode: res.StatusCode,
  2602. },
  2603. }
  2604. target := &ret
  2605. if err := gensupport.DecodeResponse(target, res); err != nil {
  2606. return nil, err
  2607. }
  2608. return ret, nil
  2609. // {
  2610. // "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`.",
  2611. // "flatPath": "v1alpha1/projects/{projectsId}/locations/{locationsId}/operations/{operationsId}:cancel",
  2612. // "httpMethod": "POST",
  2613. // "id": "tpu.projects.locations.operations.cancel",
  2614. // "parameterOrder": [
  2615. // "name"
  2616. // ],
  2617. // "parameters": {
  2618. // "name": {
  2619. // "description": "The name of the operation resource to be cancelled.",
  2620. // "location": "path",
  2621. // "pattern": "^projects/[^/]+/locations/[^/]+/operations/[^/]+$",
  2622. // "required": true,
  2623. // "type": "string"
  2624. // }
  2625. // },
  2626. // "path": "v1alpha1/{+name}:cancel",
  2627. // "response": {
  2628. // "$ref": "Empty"
  2629. // },
  2630. // "scopes": [
  2631. // "https://www.googleapis.com/auth/cloud-platform"
  2632. // ]
  2633. // }
  2634. }
  2635. // method id "tpu.projects.locations.operations.delete":
  2636. type ProjectsLocationsOperationsDeleteCall struct {
  2637. s *Service
  2638. name string
  2639. urlParams_ gensupport.URLParams
  2640. ctx_ context.Context
  2641. header_ http.Header
  2642. }
  2643. // Delete: Deletes a long-running operation. This method indicates that
  2644. // the client is
  2645. // no longer interested in the operation result. It does not cancel
  2646. // the
  2647. // operation. If the server doesn't support this method, it
  2648. // returns
  2649. // `google.rpc.Code.UNIMPLEMENTED`.
  2650. func (r *ProjectsLocationsOperationsService) Delete(name string) *ProjectsLocationsOperationsDeleteCall {
  2651. c := &ProjectsLocationsOperationsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2652. c.name = name
  2653. return c
  2654. }
  2655. // Fields allows partial responses to be retrieved. See
  2656. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2657. // for more information.
  2658. func (c *ProjectsLocationsOperationsDeleteCall) Fields(s ...googleapi.Field) *ProjectsLocationsOperationsDeleteCall {
  2659. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2660. return c
  2661. }
  2662. // Context sets the context to be used in this call's Do method. Any
  2663. // pending HTTP request will be aborted if the provided context is
  2664. // canceled.
  2665. func (c *ProjectsLocationsOperationsDeleteCall) Context(ctx context.Context) *ProjectsLocationsOperationsDeleteCall {
  2666. c.ctx_ = ctx
  2667. return c
  2668. }
  2669. // Header returns an http.Header that can be modified by the caller to
  2670. // add HTTP headers to the request.
  2671. func (c *ProjectsLocationsOperationsDeleteCall) Header() http.Header {
  2672. if c.header_ == nil {
  2673. c.header_ = make(http.Header)
  2674. }
  2675. return c.header_
  2676. }
  2677. func (c *ProjectsLocationsOperationsDeleteCall) doRequest(alt string) (*http.Response, error) {
  2678. reqHeaders := make(http.Header)
  2679. for k, v := range c.header_ {
  2680. reqHeaders[k] = v
  2681. }
  2682. reqHeaders.Set("User-Agent", c.s.userAgent())
  2683. var body io.Reader = nil
  2684. c.urlParams_.Set("alt", alt)
  2685. c.urlParams_.Set("prettyPrint", "false")
  2686. urls := googleapi.ResolveRelative(c.s.BasePath, "v1alpha1/{+name}")
  2687. urls += "?" + c.urlParams_.Encode()
  2688. req, err := http.NewRequest("DELETE", urls, body)
  2689. if err != nil {
  2690. return nil, err
  2691. }
  2692. req.Header = reqHeaders
  2693. googleapi.Expand(req.URL, map[string]string{
  2694. "name": c.name,
  2695. })
  2696. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2697. }
  2698. // Do executes the "tpu.projects.locations.operations.delete" call.
  2699. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  2700. // code is an error. Response headers are in either
  2701. // *Empty.ServerResponse.Header or (if a response was returned at all)
  2702. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2703. // check whether the returned error was because http.StatusNotModified
  2704. // was returned.
  2705. func (c *ProjectsLocationsOperationsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  2706. gensupport.SetOptions(c.urlParams_, opts...)
  2707. res, err := c.doRequest("json")
  2708. if res != nil && res.StatusCode == http.StatusNotModified {
  2709. if res.Body != nil {
  2710. res.Body.Close()
  2711. }
  2712. return nil, &googleapi.Error{
  2713. Code: res.StatusCode,
  2714. Header: res.Header,
  2715. }
  2716. }
  2717. if err != nil {
  2718. return nil, err
  2719. }
  2720. defer googleapi.CloseBody(res)
  2721. if err := googleapi.CheckResponse(res); err != nil {
  2722. return nil, err
  2723. }
  2724. ret := &Empty{
  2725. ServerResponse: googleapi.ServerResponse{
  2726. Header: res.Header,
  2727. HTTPStatusCode: res.StatusCode,
  2728. },
  2729. }
  2730. target := &ret
  2731. if err := gensupport.DecodeResponse(target, res); err != nil {
  2732. return nil, err
  2733. }
  2734. return ret, nil
  2735. // {
  2736. // "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`.",
  2737. // "flatPath": "v1alpha1/projects/{projectsId}/locations/{locationsId}/operations/{operationsId}",
  2738. // "httpMethod": "DELETE",
  2739. // "id": "tpu.projects.locations.operations.delete",
  2740. // "parameterOrder": [
  2741. // "name"
  2742. // ],
  2743. // "parameters": {
  2744. // "name": {
  2745. // "description": "The name of the operation resource to be deleted.",
  2746. // "location": "path",
  2747. // "pattern": "^projects/[^/]+/locations/[^/]+/operations/[^/]+$",
  2748. // "required": true,
  2749. // "type": "string"
  2750. // }
  2751. // },
  2752. // "path": "v1alpha1/{+name}",
  2753. // "response": {
  2754. // "$ref": "Empty"
  2755. // },
  2756. // "scopes": [
  2757. // "https://www.googleapis.com/auth/cloud-platform"
  2758. // ]
  2759. // }
  2760. }
  2761. // method id "tpu.projects.locations.operations.get":
  2762. type ProjectsLocationsOperationsGetCall struct {
  2763. s *Service
  2764. name string
  2765. urlParams_ gensupport.URLParams
  2766. ifNoneMatch_ string
  2767. ctx_ context.Context
  2768. header_ http.Header
  2769. }
  2770. // Get: Gets the latest state of a long-running operation. Clients can
  2771. // use this
  2772. // method to poll the operation result at intervals as recommended by
  2773. // the API
  2774. // service.
  2775. func (r *ProjectsLocationsOperationsService) Get(name string) *ProjectsLocationsOperationsGetCall {
  2776. c := &ProjectsLocationsOperationsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2777. c.name = name
  2778. return c
  2779. }
  2780. // Fields allows partial responses to be retrieved. See
  2781. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2782. // for more information.
  2783. func (c *ProjectsLocationsOperationsGetCall) Fields(s ...googleapi.Field) *ProjectsLocationsOperationsGetCall {
  2784. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2785. return c
  2786. }
  2787. // IfNoneMatch sets the optional parameter which makes the operation
  2788. // fail if the object's ETag matches the given value. This is useful for
  2789. // getting updates only after the object has changed since the last
  2790. // request. Use googleapi.IsNotModified to check whether the response
  2791. // error from Do is the result of In-None-Match.
  2792. func (c *ProjectsLocationsOperationsGetCall) IfNoneMatch(entityTag string) *ProjectsLocationsOperationsGetCall {
  2793. c.ifNoneMatch_ = entityTag
  2794. return c
  2795. }
  2796. // Context sets the context to be used in this call's Do method. Any
  2797. // pending HTTP request will be aborted if the provided context is
  2798. // canceled.
  2799. func (c *ProjectsLocationsOperationsGetCall) Context(ctx context.Context) *ProjectsLocationsOperationsGetCall {
  2800. c.ctx_ = ctx
  2801. return c
  2802. }
  2803. // Header returns an http.Header that can be modified by the caller to
  2804. // add HTTP headers to the request.
  2805. func (c *ProjectsLocationsOperationsGetCall) Header() http.Header {
  2806. if c.header_ == nil {
  2807. c.header_ = make(http.Header)
  2808. }
  2809. return c.header_
  2810. }
  2811. func (c *ProjectsLocationsOperationsGetCall) doRequest(alt string) (*http.Response, error) {
  2812. reqHeaders := make(http.Header)
  2813. for k, v := range c.header_ {
  2814. reqHeaders[k] = v
  2815. }
  2816. reqHeaders.Set("User-Agent", c.s.userAgent())
  2817. if c.ifNoneMatch_ != "" {
  2818. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2819. }
  2820. var body io.Reader = nil
  2821. c.urlParams_.Set("alt", alt)
  2822. c.urlParams_.Set("prettyPrint", "false")
  2823. urls := googleapi.ResolveRelative(c.s.BasePath, "v1alpha1/{+name}")
  2824. urls += "?" + c.urlParams_.Encode()
  2825. req, err := http.NewRequest("GET", urls, body)
  2826. if err != nil {
  2827. return nil, err
  2828. }
  2829. req.Header = reqHeaders
  2830. googleapi.Expand(req.URL, map[string]string{
  2831. "name": c.name,
  2832. })
  2833. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2834. }
  2835. // Do executes the "tpu.projects.locations.operations.get" call.
  2836. // Exactly one of *Operation or error will be non-nil. Any non-2xx
  2837. // status code is an error. Response headers are in either
  2838. // *Operation.ServerResponse.Header or (if a response was returned at
  2839. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  2840. // to check whether the returned error was because
  2841. // http.StatusNotModified was returned.
  2842. func (c *ProjectsLocationsOperationsGetCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
  2843. gensupport.SetOptions(c.urlParams_, opts...)
  2844. res, err := c.doRequest("json")
  2845. if res != nil && res.StatusCode == http.StatusNotModified {
  2846. if res.Body != nil {
  2847. res.Body.Close()
  2848. }
  2849. return nil, &googleapi.Error{
  2850. Code: res.StatusCode,
  2851. Header: res.Header,
  2852. }
  2853. }
  2854. if err != nil {
  2855. return nil, err
  2856. }
  2857. defer googleapi.CloseBody(res)
  2858. if err := googleapi.CheckResponse(res); err != nil {
  2859. return nil, err
  2860. }
  2861. ret := &Operation{
  2862. ServerResponse: googleapi.ServerResponse{
  2863. Header: res.Header,
  2864. HTTPStatusCode: res.StatusCode,
  2865. },
  2866. }
  2867. target := &ret
  2868. if err := gensupport.DecodeResponse(target, res); err != nil {
  2869. return nil, err
  2870. }
  2871. return ret, nil
  2872. // {
  2873. // "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.",
  2874. // "flatPath": "v1alpha1/projects/{projectsId}/locations/{locationsId}/operations/{operationsId}",
  2875. // "httpMethod": "GET",
  2876. // "id": "tpu.projects.locations.operations.get",
  2877. // "parameterOrder": [
  2878. // "name"
  2879. // ],
  2880. // "parameters": {
  2881. // "name": {
  2882. // "description": "The name of the operation resource.",
  2883. // "location": "path",
  2884. // "pattern": "^projects/[^/]+/locations/[^/]+/operations/[^/]+$",
  2885. // "required": true,
  2886. // "type": "string"
  2887. // }
  2888. // },
  2889. // "path": "v1alpha1/{+name}",
  2890. // "response": {
  2891. // "$ref": "Operation"
  2892. // },
  2893. // "scopes": [
  2894. // "https://www.googleapis.com/auth/cloud-platform"
  2895. // ]
  2896. // }
  2897. }
  2898. // method id "tpu.projects.locations.operations.list":
  2899. type ProjectsLocationsOperationsListCall struct {
  2900. s *Service
  2901. name string
  2902. urlParams_ gensupport.URLParams
  2903. ifNoneMatch_ string
  2904. ctx_ context.Context
  2905. header_ http.Header
  2906. }
  2907. // List: Lists operations that match the specified filter in the
  2908. // request. If the
  2909. // server doesn't support this method, it returns
  2910. // `UNIMPLEMENTED`.
  2911. //
  2912. // NOTE: the `name` binding allows API services to override the
  2913. // binding
  2914. // to use different resource name schemes, such as `users/*/operations`.
  2915. // To
  2916. // override the binding, API services can add a binding such
  2917. // as
  2918. // "/v1/{name=users/*}/operations" to their service configuration.
  2919. // For backwards compatibility, the default name includes the
  2920. // operations
  2921. // collection id, however overriding users must ensure the name
  2922. // binding
  2923. // is the parent resource, without the operations collection id.
  2924. func (r *ProjectsLocationsOperationsService) List(name string) *ProjectsLocationsOperationsListCall {
  2925. c := &ProjectsLocationsOperationsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2926. c.name = name
  2927. return c
  2928. }
  2929. // Filter sets the optional parameter "filter": The standard list
  2930. // filter.
  2931. func (c *ProjectsLocationsOperationsListCall) Filter(filter string) *ProjectsLocationsOperationsListCall {
  2932. c.urlParams_.Set("filter", filter)
  2933. return c
  2934. }
  2935. // PageSize sets the optional parameter "pageSize": The standard list
  2936. // page size.
  2937. func (c *ProjectsLocationsOperationsListCall) PageSize(pageSize int64) *ProjectsLocationsOperationsListCall {
  2938. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  2939. return c
  2940. }
  2941. // PageToken sets the optional parameter "pageToken": The standard list
  2942. // page token.
  2943. func (c *ProjectsLocationsOperationsListCall) PageToken(pageToken string) *ProjectsLocationsOperationsListCall {
  2944. c.urlParams_.Set("pageToken", pageToken)
  2945. return c
  2946. }
  2947. // Fields allows partial responses to be retrieved. See
  2948. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2949. // for more information.
  2950. func (c *ProjectsLocationsOperationsListCall) Fields(s ...googleapi.Field) *ProjectsLocationsOperationsListCall {
  2951. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2952. return c
  2953. }
  2954. // IfNoneMatch sets the optional parameter which makes the operation
  2955. // fail if the object's ETag matches the given value. This is useful for
  2956. // getting updates only after the object has changed since the last
  2957. // request. Use googleapi.IsNotModified to check whether the response
  2958. // error from Do is the result of In-None-Match.
  2959. func (c *ProjectsLocationsOperationsListCall) IfNoneMatch(entityTag string) *ProjectsLocationsOperationsListCall {
  2960. c.ifNoneMatch_ = entityTag
  2961. return c
  2962. }
  2963. // Context sets the context to be used in this call's Do method. Any
  2964. // pending HTTP request will be aborted if the provided context is
  2965. // canceled.
  2966. func (c *ProjectsLocationsOperationsListCall) Context(ctx context.Context) *ProjectsLocationsOperationsListCall {
  2967. c.ctx_ = ctx
  2968. return c
  2969. }
  2970. // Header returns an http.Header that can be modified by the caller to
  2971. // add HTTP headers to the request.
  2972. func (c *ProjectsLocationsOperationsListCall) Header() http.Header {
  2973. if c.header_ == nil {
  2974. c.header_ = make(http.Header)
  2975. }
  2976. return c.header_
  2977. }
  2978. func (c *ProjectsLocationsOperationsListCall) doRequest(alt string) (*http.Response, error) {
  2979. reqHeaders := make(http.Header)
  2980. for k, v := range c.header_ {
  2981. reqHeaders[k] = v
  2982. }
  2983. reqHeaders.Set("User-Agent", c.s.userAgent())
  2984. if c.ifNoneMatch_ != "" {
  2985. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2986. }
  2987. var body io.Reader = nil
  2988. c.urlParams_.Set("alt", alt)
  2989. c.urlParams_.Set("prettyPrint", "false")
  2990. urls := googleapi.ResolveRelative(c.s.BasePath, "v1alpha1/{+name}/operations")
  2991. urls += "?" + c.urlParams_.Encode()
  2992. req, err := http.NewRequest("GET", urls, body)
  2993. if err != nil {
  2994. return nil, err
  2995. }
  2996. req.Header = reqHeaders
  2997. googleapi.Expand(req.URL, map[string]string{
  2998. "name": c.name,
  2999. })
  3000. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3001. }
  3002. // Do executes the "tpu.projects.locations.operations.list" call.
  3003. // Exactly one of *ListOperationsResponse or error will be non-nil. Any
  3004. // non-2xx status code is an error. Response headers are in either
  3005. // *ListOperationsResponse.ServerResponse.Header or (if a response was
  3006. // returned at all) in error.(*googleapi.Error).Header. Use
  3007. // googleapi.IsNotModified to check whether the returned error was
  3008. // because http.StatusNotModified was returned.
  3009. func (c *ProjectsLocationsOperationsListCall) Do(opts ...googleapi.CallOption) (*ListOperationsResponse, error) {
  3010. gensupport.SetOptions(c.urlParams_, opts...)
  3011. res, err := c.doRequest("json")
  3012. if res != nil && res.StatusCode == http.StatusNotModified {
  3013. if res.Body != nil {
  3014. res.Body.Close()
  3015. }
  3016. return nil, &googleapi.Error{
  3017. Code: res.StatusCode,
  3018. Header: res.Header,
  3019. }
  3020. }
  3021. if err != nil {
  3022. return nil, err
  3023. }
  3024. defer googleapi.CloseBody(res)
  3025. if err := googleapi.CheckResponse(res); err != nil {
  3026. return nil, err
  3027. }
  3028. ret := &ListOperationsResponse{
  3029. ServerResponse: googleapi.ServerResponse{
  3030. Header: res.Header,
  3031. HTTPStatusCode: res.StatusCode,
  3032. },
  3033. }
  3034. target := &ret
  3035. if err := gensupport.DecodeResponse(target, res); err != nil {
  3036. return nil, err
  3037. }
  3038. return ret, nil
  3039. // {
  3040. // "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.",
  3041. // "flatPath": "v1alpha1/projects/{projectsId}/locations/{locationsId}/operations",
  3042. // "httpMethod": "GET",
  3043. // "id": "tpu.projects.locations.operations.list",
  3044. // "parameterOrder": [
  3045. // "name"
  3046. // ],
  3047. // "parameters": {
  3048. // "filter": {
  3049. // "description": "The standard list filter.",
  3050. // "location": "query",
  3051. // "type": "string"
  3052. // },
  3053. // "name": {
  3054. // "description": "The name of the operation's parent resource.",
  3055. // "location": "path",
  3056. // "pattern": "^projects/[^/]+/locations/[^/]+$",
  3057. // "required": true,
  3058. // "type": "string"
  3059. // },
  3060. // "pageSize": {
  3061. // "description": "The standard list page size.",
  3062. // "format": "int32",
  3063. // "location": "query",
  3064. // "type": "integer"
  3065. // },
  3066. // "pageToken": {
  3067. // "description": "The standard list page token.",
  3068. // "location": "query",
  3069. // "type": "string"
  3070. // }
  3071. // },
  3072. // "path": "v1alpha1/{+name}/operations",
  3073. // "response": {
  3074. // "$ref": "ListOperationsResponse"
  3075. // },
  3076. // "scopes": [
  3077. // "https://www.googleapis.com/auth/cloud-platform"
  3078. // ]
  3079. // }
  3080. }
  3081. // Pages invokes f for each page of results.
  3082. // A non-nil error returned from f will halt the iteration.
  3083. // The provided context supersedes any context provided to the Context method.
  3084. func (c *ProjectsLocationsOperationsListCall) Pages(ctx context.Context, f func(*ListOperationsResponse) error) error {
  3085. c.ctx_ = ctx
  3086. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  3087. for {
  3088. x, err := c.Do()
  3089. if err != nil {
  3090. return err
  3091. }
  3092. if err := f(x); err != nil {
  3093. return err
  3094. }
  3095. if x.NextPageToken == "" {
  3096. return nil
  3097. }
  3098. c.PageToken(x.NextPageToken)
  3099. }
  3100. }
  3101. // method id "tpu.projects.locations.tensorflowVersions.get":
  3102. type ProjectsLocationsTensorflowVersionsGetCall struct {
  3103. s *Service
  3104. name string
  3105. urlParams_ gensupport.URLParams
  3106. ifNoneMatch_ string
  3107. ctx_ context.Context
  3108. header_ http.Header
  3109. }
  3110. // Get: Gets TensorFlow Version.
  3111. func (r *ProjectsLocationsTensorflowVersionsService) Get(name string) *ProjectsLocationsTensorflowVersionsGetCall {
  3112. c := &ProjectsLocationsTensorflowVersionsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3113. c.name = name
  3114. return c
  3115. }
  3116. // Fields allows partial responses to be retrieved. See
  3117. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3118. // for more information.
  3119. func (c *ProjectsLocationsTensorflowVersionsGetCall) Fields(s ...googleapi.Field) *ProjectsLocationsTensorflowVersionsGetCall {
  3120. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3121. return c
  3122. }
  3123. // IfNoneMatch sets the optional parameter which makes the operation
  3124. // fail if the object's ETag matches the given value. This is useful for
  3125. // getting updates only after the object has changed since the last
  3126. // request. Use googleapi.IsNotModified to check whether the response
  3127. // error from Do is the result of In-None-Match.
  3128. func (c *ProjectsLocationsTensorflowVersionsGetCall) IfNoneMatch(entityTag string) *ProjectsLocationsTensorflowVersionsGetCall {
  3129. c.ifNoneMatch_ = entityTag
  3130. return c
  3131. }
  3132. // Context sets the context to be used in this call's Do method. Any
  3133. // pending HTTP request will be aborted if the provided context is
  3134. // canceled.
  3135. func (c *ProjectsLocationsTensorflowVersionsGetCall) Context(ctx context.Context) *ProjectsLocationsTensorflowVersionsGetCall {
  3136. c.ctx_ = ctx
  3137. return c
  3138. }
  3139. // Header returns an http.Header that can be modified by the caller to
  3140. // add HTTP headers to the request.
  3141. func (c *ProjectsLocationsTensorflowVersionsGetCall) Header() http.Header {
  3142. if c.header_ == nil {
  3143. c.header_ = make(http.Header)
  3144. }
  3145. return c.header_
  3146. }
  3147. func (c *ProjectsLocationsTensorflowVersionsGetCall) doRequest(alt string) (*http.Response, error) {
  3148. reqHeaders := make(http.Header)
  3149. for k, v := range c.header_ {
  3150. reqHeaders[k] = v
  3151. }
  3152. reqHeaders.Set("User-Agent", c.s.userAgent())
  3153. if c.ifNoneMatch_ != "" {
  3154. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  3155. }
  3156. var body io.Reader = nil
  3157. c.urlParams_.Set("alt", alt)
  3158. c.urlParams_.Set("prettyPrint", "false")
  3159. urls := googleapi.ResolveRelative(c.s.BasePath, "v1alpha1/{+name}")
  3160. urls += "?" + c.urlParams_.Encode()
  3161. req, err := http.NewRequest("GET", urls, body)
  3162. if err != nil {
  3163. return nil, err
  3164. }
  3165. req.Header = reqHeaders
  3166. googleapi.Expand(req.URL, map[string]string{
  3167. "name": c.name,
  3168. })
  3169. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3170. }
  3171. // Do executes the "tpu.projects.locations.tensorflowVersions.get" call.
  3172. // Exactly one of *TensorFlowVersion or error will be non-nil. Any
  3173. // non-2xx status code is an error. Response headers are in either
  3174. // *TensorFlowVersion.ServerResponse.Header or (if a response was
  3175. // returned at all) in error.(*googleapi.Error).Header. Use
  3176. // googleapi.IsNotModified to check whether the returned error was
  3177. // because http.StatusNotModified was returned.
  3178. func (c *ProjectsLocationsTensorflowVersionsGetCall) Do(opts ...googleapi.CallOption) (*TensorFlowVersion, error) {
  3179. gensupport.SetOptions(c.urlParams_, opts...)
  3180. res, err := c.doRequest("json")
  3181. if res != nil && res.StatusCode == http.StatusNotModified {
  3182. if res.Body != nil {
  3183. res.Body.Close()
  3184. }
  3185. return nil, &googleapi.Error{
  3186. Code: res.StatusCode,
  3187. Header: res.Header,
  3188. }
  3189. }
  3190. if err != nil {
  3191. return nil, err
  3192. }
  3193. defer googleapi.CloseBody(res)
  3194. if err := googleapi.CheckResponse(res); err != nil {
  3195. return nil, err
  3196. }
  3197. ret := &TensorFlowVersion{
  3198. ServerResponse: googleapi.ServerResponse{
  3199. Header: res.Header,
  3200. HTTPStatusCode: res.StatusCode,
  3201. },
  3202. }
  3203. target := &ret
  3204. if err := gensupport.DecodeResponse(target, res); err != nil {
  3205. return nil, err
  3206. }
  3207. return ret, nil
  3208. // {
  3209. // "description": "Gets TensorFlow Version.",
  3210. // "flatPath": "v1alpha1/projects/{projectsId}/locations/{locationsId}/tensorflowVersions/{tensorflowVersionsId}",
  3211. // "httpMethod": "GET",
  3212. // "id": "tpu.projects.locations.tensorflowVersions.get",
  3213. // "parameterOrder": [
  3214. // "name"
  3215. // ],
  3216. // "parameters": {
  3217. // "name": {
  3218. // "description": "The resource name.",
  3219. // "location": "path",
  3220. // "pattern": "^projects/[^/]+/locations/[^/]+/tensorflowVersions/[^/]+$",
  3221. // "required": true,
  3222. // "type": "string"
  3223. // }
  3224. // },
  3225. // "path": "v1alpha1/{+name}",
  3226. // "response": {
  3227. // "$ref": "TensorFlowVersion"
  3228. // },
  3229. // "scopes": [
  3230. // "https://www.googleapis.com/auth/cloud-platform"
  3231. // ]
  3232. // }
  3233. }
  3234. // method id "tpu.projects.locations.tensorflowVersions.list":
  3235. type ProjectsLocationsTensorflowVersionsListCall struct {
  3236. s *Service
  3237. parent string
  3238. urlParams_ gensupport.URLParams
  3239. ifNoneMatch_ string
  3240. ctx_ context.Context
  3241. header_ http.Header
  3242. }
  3243. // List: Lists TensorFlow versions supported by this API.
  3244. func (r *ProjectsLocationsTensorflowVersionsService) List(parent string) *ProjectsLocationsTensorflowVersionsListCall {
  3245. c := &ProjectsLocationsTensorflowVersionsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3246. c.parent = parent
  3247. return c
  3248. }
  3249. // Filter sets the optional parameter "filter": List filter.
  3250. func (c *ProjectsLocationsTensorflowVersionsListCall) Filter(filter string) *ProjectsLocationsTensorflowVersionsListCall {
  3251. c.urlParams_.Set("filter", filter)
  3252. return c
  3253. }
  3254. // OrderBy sets the optional parameter "orderBy": Sort results.
  3255. func (c *ProjectsLocationsTensorflowVersionsListCall) OrderBy(orderBy string) *ProjectsLocationsTensorflowVersionsListCall {
  3256. c.urlParams_.Set("orderBy", orderBy)
  3257. return c
  3258. }
  3259. // PageSize sets the optional parameter "pageSize": The maximum number
  3260. // of items to return.
  3261. func (c *ProjectsLocationsTensorflowVersionsListCall) PageSize(pageSize int64) *ProjectsLocationsTensorflowVersionsListCall {
  3262. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  3263. return c
  3264. }
  3265. // PageToken sets the optional parameter "pageToken": The
  3266. // next_page_token value returned from a previous List request, if any.
  3267. func (c *ProjectsLocationsTensorflowVersionsListCall) PageToken(pageToken string) *ProjectsLocationsTensorflowVersionsListCall {
  3268. c.urlParams_.Set("pageToken", pageToken)
  3269. return c
  3270. }
  3271. // Fields allows partial responses to be retrieved. See
  3272. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3273. // for more information.
  3274. func (c *ProjectsLocationsTensorflowVersionsListCall) Fields(s ...googleapi.Field) *ProjectsLocationsTensorflowVersionsListCall {
  3275. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3276. return c
  3277. }
  3278. // IfNoneMatch sets the optional parameter which makes the operation
  3279. // fail if the object's ETag matches the given value. This is useful for
  3280. // getting updates only after the object has changed since the last
  3281. // request. Use googleapi.IsNotModified to check whether the response
  3282. // error from Do is the result of In-None-Match.
  3283. func (c *ProjectsLocationsTensorflowVersionsListCall) IfNoneMatch(entityTag string) *ProjectsLocationsTensorflowVersionsListCall {
  3284. c.ifNoneMatch_ = entityTag
  3285. return c
  3286. }
  3287. // Context sets the context to be used in this call's Do method. Any
  3288. // pending HTTP request will be aborted if the provided context is
  3289. // canceled.
  3290. func (c *ProjectsLocationsTensorflowVersionsListCall) Context(ctx context.Context) *ProjectsLocationsTensorflowVersionsListCall {
  3291. c.ctx_ = ctx
  3292. return c
  3293. }
  3294. // Header returns an http.Header that can be modified by the caller to
  3295. // add HTTP headers to the request.
  3296. func (c *ProjectsLocationsTensorflowVersionsListCall) Header() http.Header {
  3297. if c.header_ == nil {
  3298. c.header_ = make(http.Header)
  3299. }
  3300. return c.header_
  3301. }
  3302. func (c *ProjectsLocationsTensorflowVersionsListCall) doRequest(alt string) (*http.Response, error) {
  3303. reqHeaders := make(http.Header)
  3304. for k, v := range c.header_ {
  3305. reqHeaders[k] = v
  3306. }
  3307. reqHeaders.Set("User-Agent", c.s.userAgent())
  3308. if c.ifNoneMatch_ != "" {
  3309. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  3310. }
  3311. var body io.Reader = nil
  3312. c.urlParams_.Set("alt", alt)
  3313. c.urlParams_.Set("prettyPrint", "false")
  3314. urls := googleapi.ResolveRelative(c.s.BasePath, "v1alpha1/{+parent}/tensorflowVersions")
  3315. urls += "?" + c.urlParams_.Encode()
  3316. req, err := http.NewRequest("GET", urls, body)
  3317. if err != nil {
  3318. return nil, err
  3319. }
  3320. req.Header = reqHeaders
  3321. googleapi.Expand(req.URL, map[string]string{
  3322. "parent": c.parent,
  3323. })
  3324. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3325. }
  3326. // Do executes the "tpu.projects.locations.tensorflowVersions.list" call.
  3327. // Exactly one of *ListTensorFlowVersionsResponse or error will be
  3328. // non-nil. Any non-2xx status code is an error. Response headers are in
  3329. // either *ListTensorFlowVersionsResponse.ServerResponse.Header or (if a
  3330. // response was returned at all) in error.(*googleapi.Error).Header. Use
  3331. // googleapi.IsNotModified to check whether the returned error was
  3332. // because http.StatusNotModified was returned.
  3333. func (c *ProjectsLocationsTensorflowVersionsListCall) Do(opts ...googleapi.CallOption) (*ListTensorFlowVersionsResponse, error) {
  3334. gensupport.SetOptions(c.urlParams_, opts...)
  3335. res, err := c.doRequest("json")
  3336. if res != nil && res.StatusCode == http.StatusNotModified {
  3337. if res.Body != nil {
  3338. res.Body.Close()
  3339. }
  3340. return nil, &googleapi.Error{
  3341. Code: res.StatusCode,
  3342. Header: res.Header,
  3343. }
  3344. }
  3345. if err != nil {
  3346. return nil, err
  3347. }
  3348. defer googleapi.CloseBody(res)
  3349. if err := googleapi.CheckResponse(res); err != nil {
  3350. return nil, err
  3351. }
  3352. ret := &ListTensorFlowVersionsResponse{
  3353. ServerResponse: googleapi.ServerResponse{
  3354. Header: res.Header,
  3355. HTTPStatusCode: res.StatusCode,
  3356. },
  3357. }
  3358. target := &ret
  3359. if err := gensupport.DecodeResponse(target, res); err != nil {
  3360. return nil, err
  3361. }
  3362. return ret, nil
  3363. // {
  3364. // "description": "Lists TensorFlow versions supported by this API.",
  3365. // "flatPath": "v1alpha1/projects/{projectsId}/locations/{locationsId}/tensorflowVersions",
  3366. // "httpMethod": "GET",
  3367. // "id": "tpu.projects.locations.tensorflowVersions.list",
  3368. // "parameterOrder": [
  3369. // "parent"
  3370. // ],
  3371. // "parameters": {
  3372. // "filter": {
  3373. // "description": "List filter.",
  3374. // "location": "query",
  3375. // "type": "string"
  3376. // },
  3377. // "orderBy": {
  3378. // "description": "Sort results.",
  3379. // "location": "query",
  3380. // "type": "string"
  3381. // },
  3382. // "pageSize": {
  3383. // "description": "The maximum number of items to return.",
  3384. // "format": "int32",
  3385. // "location": "query",
  3386. // "type": "integer"
  3387. // },
  3388. // "pageToken": {
  3389. // "description": "The next_page_token value returned from a previous List request, if any.",
  3390. // "location": "query",
  3391. // "type": "string"
  3392. // },
  3393. // "parent": {
  3394. // "description": "The parent resource name.",
  3395. // "location": "path",
  3396. // "pattern": "^projects/[^/]+/locations/[^/]+$",
  3397. // "required": true,
  3398. // "type": "string"
  3399. // }
  3400. // },
  3401. // "path": "v1alpha1/{+parent}/tensorflowVersions",
  3402. // "response": {
  3403. // "$ref": "ListTensorFlowVersionsResponse"
  3404. // },
  3405. // "scopes": [
  3406. // "https://www.googleapis.com/auth/cloud-platform"
  3407. // ]
  3408. // }
  3409. }
  3410. // Pages invokes f for each page of results.
  3411. // A non-nil error returned from f will halt the iteration.
  3412. // The provided context supersedes any context provided to the Context method.
  3413. func (c *ProjectsLocationsTensorflowVersionsListCall) Pages(ctx context.Context, f func(*ListTensorFlowVersionsResponse) error) error {
  3414. c.ctx_ = ctx
  3415. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  3416. for {
  3417. x, err := c.Do()
  3418. if err != nil {
  3419. return err
  3420. }
  3421. if err := f(x); err != nil {
  3422. return err
  3423. }
  3424. if x.NextPageToken == "" {
  3425. return nil
  3426. }
  3427. c.PageToken(x.NextPageToken)
  3428. }
  3429. }