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

3758 lines
124 KiB

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