...

Source file src/google.golang.org/api/tpu/v1/tpu-gen.go

Documentation: google.golang.org/api/tpu/v1

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

View as plain text