...

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

Documentation: google.golang.org/api/bigqueryreservation/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 bigqueryreservation provides access to the BigQuery Reservation API.
     8  //
     9  // For product documentation, see: https://cloud.google.com/bigquery/
    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/bigqueryreservation/v1"
    27  //	...
    28  //	ctx := context.Background()
    29  //	bigqueryreservationService, err := bigqueryreservation.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  // By default, all available scopes (see "Constants") are used to authenticate.
    38  // To restrict scopes, use [google.golang.org/api/option.WithScopes]:
    39  //
    40  //	bigqueryreservationService, err := bigqueryreservation.NewService(ctx, option.WithScopes(bigqueryreservation.CloudPlatformScope))
    41  //
    42  // To use an API key for authentication (note: some APIs do not support API
    43  // keys), use [google.golang.org/api/option.WithAPIKey]:
    44  //
    45  //	bigqueryreservationService, err := bigqueryreservation.NewService(ctx, option.WithAPIKey("AIza..."))
    46  //
    47  // To use an OAuth token (e.g., a user token obtained via a three-legged OAuth
    48  // flow, use [google.golang.org/api/option.WithTokenSource]:
    49  //
    50  //	config := &oauth2.Config{...}
    51  //	// ...
    52  //	token, err := config.Exchange(ctx, ...)
    53  //	bigqueryreservationService, err := bigqueryreservation.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token)))
    54  //
    55  // See [google.golang.org/api/option.ClientOption] for details on options.
    56  package bigqueryreservation // import "google.golang.org/api/bigqueryreservation/v1"
    57  
    58  import (
    59  	"bytes"
    60  	"context"
    61  	"encoding/json"
    62  	"errors"
    63  	"fmt"
    64  	"io"
    65  	"net/http"
    66  	"net/url"
    67  	"strconv"
    68  	"strings"
    69  
    70  	googleapi "google.golang.org/api/googleapi"
    71  	internal "google.golang.org/api/internal"
    72  	gensupport "google.golang.org/api/internal/gensupport"
    73  	option "google.golang.org/api/option"
    74  	internaloption "google.golang.org/api/option/internaloption"
    75  	htransport "google.golang.org/api/transport/http"
    76  )
    77  
    78  // Always reference these packages, just in case the auto-generated code
    79  // below doesn't.
    80  var _ = bytes.NewBuffer
    81  var _ = strconv.Itoa
    82  var _ = fmt.Sprintf
    83  var _ = json.NewDecoder
    84  var _ = io.Copy
    85  var _ = url.Parse
    86  var _ = gensupport.MarshalJSON
    87  var _ = googleapi.Version
    88  var _ = errors.New
    89  var _ = strings.Replace
    90  var _ = context.Canceled
    91  var _ = internaloption.WithDefaultEndpoint
    92  var _ = internal.Version
    93  
    94  const apiId = "bigqueryreservation:v1"
    95  const apiName = "bigqueryreservation"
    96  const apiVersion = "v1"
    97  const basePath = "https://bigqueryreservation.googleapis.com/"
    98  const basePathTemplate = "https://bigqueryreservation.UNIVERSE_DOMAIN/"
    99  const mtlsBasePath = "https://bigqueryreservation.mtls.googleapis.com/"
   100  
   101  // OAuth2 scopes used by this API.
   102  const (
   103  	// View and manage your data in Google BigQuery and see the email address for
   104  	// your Google Account
   105  	BigqueryScope = "https://www.googleapis.com/auth/bigquery"
   106  
   107  	// See, edit, configure, and delete your Google Cloud data and see the email
   108  	// address for your Google Account.
   109  	CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platform"
   110  )
   111  
   112  // NewService creates a new Service.
   113  func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
   114  	scopesOption := internaloption.WithDefaultScopes(
   115  		"https://www.googleapis.com/auth/bigquery",
   116  		"https://www.googleapis.com/auth/cloud-platform",
   117  	)
   118  	// NOTE: prepend, so we don't override user-specified scopes.
   119  	opts = append([]option.ClientOption{scopesOption}, opts...)
   120  	opts = append(opts, internaloption.WithDefaultEndpoint(basePath))
   121  	opts = append(opts, internaloption.WithDefaultEndpointTemplate(basePathTemplate))
   122  	opts = append(opts, internaloption.WithDefaultMTLSEndpoint(mtlsBasePath))
   123  	opts = append(opts, internaloption.EnableNewAuthLibrary())
   124  	client, endpoint, err := htransport.NewClient(ctx, opts...)
   125  	if err != nil {
   126  		return nil, err
   127  	}
   128  	s, err := New(client)
   129  	if err != nil {
   130  		return nil, err
   131  	}
   132  	if endpoint != "" {
   133  		s.BasePath = endpoint
   134  	}
   135  	return s, nil
   136  }
   137  
   138  // New creates a new Service. It uses the provided http.Client for requests.
   139  //
   140  // Deprecated: please use NewService instead.
   141  // To provide a custom HTTP client, use option.WithHTTPClient.
   142  // If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead.
   143  func New(client *http.Client) (*Service, error) {
   144  	if client == nil {
   145  		return nil, errors.New("client is nil")
   146  	}
   147  	s := &Service{client: client, BasePath: basePath}
   148  	s.Projects = NewProjectsService(s)
   149  	return s, nil
   150  }
   151  
   152  type Service struct {
   153  	client    *http.Client
   154  	BasePath  string // API endpoint base URL
   155  	UserAgent string // optional additional User-Agent fragment
   156  
   157  	Projects *ProjectsService
   158  }
   159  
   160  func (s *Service) userAgent() string {
   161  	if s.UserAgent == "" {
   162  		return googleapi.UserAgent
   163  	}
   164  	return googleapi.UserAgent + " " + s.UserAgent
   165  }
   166  
   167  func NewProjectsService(s *Service) *ProjectsService {
   168  	rs := &ProjectsService{s: s}
   169  	rs.Locations = NewProjectsLocationsService(s)
   170  	return rs
   171  }
   172  
   173  type ProjectsService struct {
   174  	s *Service
   175  
   176  	Locations *ProjectsLocationsService
   177  }
   178  
   179  func NewProjectsLocationsService(s *Service) *ProjectsLocationsService {
   180  	rs := &ProjectsLocationsService{s: s}
   181  	rs.CapacityCommitments = NewProjectsLocationsCapacityCommitmentsService(s)
   182  	rs.Reservations = NewProjectsLocationsReservationsService(s)
   183  	return rs
   184  }
   185  
   186  type ProjectsLocationsService struct {
   187  	s *Service
   188  
   189  	CapacityCommitments *ProjectsLocationsCapacityCommitmentsService
   190  
   191  	Reservations *ProjectsLocationsReservationsService
   192  }
   193  
   194  func NewProjectsLocationsCapacityCommitmentsService(s *Service) *ProjectsLocationsCapacityCommitmentsService {
   195  	rs := &ProjectsLocationsCapacityCommitmentsService{s: s}
   196  	return rs
   197  }
   198  
   199  type ProjectsLocationsCapacityCommitmentsService struct {
   200  	s *Service
   201  }
   202  
   203  func NewProjectsLocationsReservationsService(s *Service) *ProjectsLocationsReservationsService {
   204  	rs := &ProjectsLocationsReservationsService{s: s}
   205  	rs.Assignments = NewProjectsLocationsReservationsAssignmentsService(s)
   206  	return rs
   207  }
   208  
   209  type ProjectsLocationsReservationsService struct {
   210  	s *Service
   211  
   212  	Assignments *ProjectsLocationsReservationsAssignmentsService
   213  }
   214  
   215  func NewProjectsLocationsReservationsAssignmentsService(s *Service) *ProjectsLocationsReservationsAssignmentsService {
   216  	rs := &ProjectsLocationsReservationsAssignmentsService{s: s}
   217  	return rs
   218  }
   219  
   220  type ProjectsLocationsReservationsAssignmentsService struct {
   221  	s *Service
   222  }
   223  
   224  // Assignment: An assignment allows a project to submit jobs of a certain type
   225  // using slots from the specified reservation.
   226  type Assignment struct {
   227  	// Assignee: The resource which will use the reservation. E.g.
   228  	// `projects/myproject`, `folders/123`, or `organizations/456`.
   229  	Assignee string `json:"assignee,omitempty"`
   230  	// JobType: Which type of jobs will use the reservation.
   231  	//
   232  	// Possible values:
   233  	//   "JOB_TYPE_UNSPECIFIED" - Invalid type. Requests with this value will be
   234  	// rejected with error code `google.rpc.Code.INVALID_ARGUMENT`.
   235  	//   "PIPELINE" - Pipeline (load/export) jobs from the project will use the
   236  	// reservation.
   237  	//   "QUERY" - Query jobs from the project will use the reservation.
   238  	//   "ML_EXTERNAL" - BigQuery ML jobs that use services external to BigQuery
   239  	// for model training. These jobs will not utilize idle slots from other
   240  	// reservations.
   241  	//   "BACKGROUND" - Background jobs that BigQuery runs for the customers in the
   242  	// background.
   243  	//   "CONTINUOUS" - Continuous SQL jobs will use this reservation. Reservations
   244  	// with continuous assignments cannot be mixed with non-continuous assignments.
   245  	JobType string `json:"jobType,omitempty"`
   246  	// Name: Output only. Name of the resource. E.g.:
   247  	// `projects/myproject/locations/US/reservations/team1-prod/assignments/123`.
   248  	// The assignment_id must only contain lower case alphanumeric characters or
   249  	// dashes and the max length is 64 characters.
   250  	Name string `json:"name,omitempty"`
   251  	// State: Output only. State of the assignment.
   252  	//
   253  	// Possible values:
   254  	//   "STATE_UNSPECIFIED" - Invalid state value.
   255  	//   "PENDING" - Queries from assignee will be executed as on-demand, if
   256  	// related assignment is pending.
   257  	//   "ACTIVE" - Assignment is ready.
   258  	State string `json:"state,omitempty"`
   259  
   260  	// ServerResponse contains the HTTP response code and headers from the server.
   261  	googleapi.ServerResponse `json:"-"`
   262  	// ForceSendFields is a list of field names (e.g. "Assignee") to
   263  	// unconditionally include in API requests. By default, fields with empty or
   264  	// default values are omitted from API requests. See
   265  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   266  	// details.
   267  	ForceSendFields []string `json:"-"`
   268  	// NullFields is a list of field names (e.g. "Assignee") to include in API
   269  	// requests with the JSON null value. By default, fields with empty values are
   270  	// omitted from API requests. See
   271  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   272  	NullFields []string `json:"-"`
   273  }
   274  
   275  func (s *Assignment) MarshalJSON() ([]byte, error) {
   276  	type NoMethod Assignment
   277  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   278  }
   279  
   280  // Autoscale: Auto scaling settings.
   281  type Autoscale struct {
   282  	// CurrentSlots: Output only. The slot capacity added to this reservation when
   283  	// autoscale happens. Will be between [0, max_slots].
   284  	CurrentSlots int64 `json:"currentSlots,omitempty,string"`
   285  	// MaxSlots: Number of slots to be scaled when needed.
   286  	MaxSlots int64 `json:"maxSlots,omitempty,string"`
   287  	// ForceSendFields is a list of field names (e.g. "CurrentSlots") to
   288  	// unconditionally include in API requests. By default, fields with empty or
   289  	// default values are omitted from API requests. See
   290  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   291  	// details.
   292  	ForceSendFields []string `json:"-"`
   293  	// NullFields is a list of field names (e.g. "CurrentSlots") to include in API
   294  	// requests with the JSON null value. By default, fields with empty values are
   295  	// omitted from API requests. See
   296  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   297  	NullFields []string `json:"-"`
   298  }
   299  
   300  func (s *Autoscale) MarshalJSON() ([]byte, error) {
   301  	type NoMethod Autoscale
   302  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   303  }
   304  
   305  // BiReservation: Represents a BI Reservation.
   306  type BiReservation struct {
   307  	// Name: The resource name of the singleton BI reservation. Reservation names
   308  	// have the form `projects/{project_id}/locations/{location_id}/biReservation`.
   309  	Name string `json:"name,omitempty"`
   310  	// PreferredTables: Preferred tables to use BI capacity for.
   311  	PreferredTables []*TableReference `json:"preferredTables,omitempty"`
   312  	// Size: Size of a reservation, in bytes.
   313  	Size int64 `json:"size,omitempty,string"`
   314  	// UpdateTime: Output only. The last update timestamp of a reservation.
   315  	UpdateTime string `json:"updateTime,omitempty"`
   316  
   317  	// ServerResponse contains the HTTP response code and headers from the server.
   318  	googleapi.ServerResponse `json:"-"`
   319  	// ForceSendFields is a list of field names (e.g. "Name") to unconditionally
   320  	// include in API requests. By default, fields with empty or default values are
   321  	// omitted from API requests. See
   322  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   323  	// details.
   324  	ForceSendFields []string `json:"-"`
   325  	// NullFields is a list of field names (e.g. "Name") to include in API requests
   326  	// with the JSON null value. By default, fields with empty values are omitted
   327  	// from API requests. See
   328  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   329  	NullFields []string `json:"-"`
   330  }
   331  
   332  func (s *BiReservation) MarshalJSON() ([]byte, error) {
   333  	type NoMethod BiReservation
   334  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   335  }
   336  
   337  // CapacityCommitment: Capacity commitment is a way to purchase compute
   338  // capacity for BigQuery jobs (in the form of slots) with some committed period
   339  // of usage. Annual commitments renew by default. Commitments can be removed
   340  // after their commitment end time passes. In order to remove annual
   341  // commitment, its plan needs to be changed to monthly or flex first. A
   342  // capacity commitment resource exists as a child resource of the admin
   343  // project.
   344  type CapacityCommitment struct {
   345  	// CommitmentEndTime: Output only. The end of the current commitment period. It
   346  	// is applicable only for ACTIVE capacity commitments.
   347  	CommitmentEndTime string `json:"commitmentEndTime,omitempty"`
   348  	// CommitmentStartTime: Output only. The start of the current commitment
   349  	// period. It is applicable only for ACTIVE capacity commitments.
   350  	CommitmentStartTime string `json:"commitmentStartTime,omitempty"`
   351  	// Edition: Edition of the capacity commitment.
   352  	//
   353  	// Possible values:
   354  	//   "EDITION_UNSPECIFIED" - Default value, which will be treated as
   355  	// ENTERPRISE.
   356  	//   "STANDARD" - Standard edition.
   357  	//   "ENTERPRISE" - Enterprise edition.
   358  	//   "ENTERPRISE_PLUS" - Enterprise plus edition.
   359  	Edition string `json:"edition,omitempty"`
   360  	// FailureStatus: Output only. For FAILED commitment plan, provides the reason
   361  	// of failure.
   362  	FailureStatus *Status `json:"failureStatus,omitempty"`
   363  	// IsFlatRate: Output only. If true, the commitment is a flat-rate commitment,
   364  	// otherwise, it's an edition commitment.
   365  	IsFlatRate bool `json:"isFlatRate,omitempty"`
   366  	// MultiRegionAuxiliary: Applicable only for commitments located within one of
   367  	// the BigQuery multi-regions (US or EU). If set to true, this commitment is
   368  	// placed in the organization's secondary region which is designated for
   369  	// disaster recovery purposes. If false, this commitment is placed in the
   370  	// organization's default region. NOTE: this is a preview feature. Project must
   371  	// be allow-listed in order to set this field.
   372  	MultiRegionAuxiliary bool `json:"multiRegionAuxiliary,omitempty"`
   373  	// Name: Output only. The resource name of the capacity commitment, e.g.,
   374  	// `projects/myproject/locations/US/capacityCommitments/123` The commitment_id
   375  	// must only contain lower case alphanumeric characters or dashes. It must
   376  	// start with a letter and must not end with a dash. Its maximum length is 64
   377  	// characters.
   378  	Name string `json:"name,omitempty"`
   379  	// Plan: Capacity commitment commitment plan.
   380  	//
   381  	// Possible values:
   382  	//   "COMMITMENT_PLAN_UNSPECIFIED" - Invalid plan value. Requests with this
   383  	// value will be rejected with error code `google.rpc.Code.INVALID_ARGUMENT`.
   384  	//   "FLEX" - Flex commitments have committed period of 1 minute after becoming
   385  	// ACTIVE. After that, they are not in a committed period anymore and can be
   386  	// removed any time.
   387  	//   "FLEX_FLAT_RATE" - Same as FLEX, should only be used if flat-rate
   388  	// commitments are still available.
   389  	//   "TRIAL" - Trial commitments have a committed period of 182 days after
   390  	// becoming ACTIVE. After that, they are converted to a new commitment based on
   391  	// the `renewal_plan`. Default `renewal_plan` for Trial commitment is Flex so
   392  	// that it can be deleted right after committed period ends.
   393  	//   "MONTHLY" - Monthly commitments have a committed period of 30 days after
   394  	// becoming ACTIVE. After that, they are not in a committed period anymore and
   395  	// can be removed any time.
   396  	//   "MONTHLY_FLAT_RATE" - Same as MONTHLY, should only be used if flat-rate
   397  	// commitments are still available.
   398  	//   "ANNUAL" - Annual commitments have a committed period of 365 days after
   399  	// becoming ACTIVE. After that they are converted to a new commitment based on
   400  	// the renewal_plan.
   401  	//   "ANNUAL_FLAT_RATE" - Same as ANNUAL, should only be used if flat-rate
   402  	// commitments are still available.
   403  	//   "THREE_YEAR" - 3-year commitments have a committed period of 1095(3 * 365)
   404  	// days after becoming ACTIVE. After that they are converted to a new
   405  	// commitment based on the renewal_plan.
   406  	//   "NONE" - Should only be used for `renewal_plan` and is only meaningful if
   407  	// edition is specified to values other than EDITION_UNSPECIFIED. Otherwise
   408  	// CreateCapacityCommitmentRequest or UpdateCapacityCommitmentRequest will be
   409  	// rejected with error code `google.rpc.Code.INVALID_ARGUMENT`. If the
   410  	// renewal_plan is NONE, capacity commitment will be removed at the end of its
   411  	// commitment period.
   412  	Plan string `json:"plan,omitempty"`
   413  	// RenewalPlan: The plan this capacity commitment is converted to after
   414  	// commitment_end_time passes. Once the plan is changed, committed period is
   415  	// extended according to commitment plan. Only applicable for ANNUAL and TRIAL
   416  	// commitments.
   417  	//
   418  	// Possible values:
   419  	//   "COMMITMENT_PLAN_UNSPECIFIED" - Invalid plan value. Requests with this
   420  	// value will be rejected with error code `google.rpc.Code.INVALID_ARGUMENT`.
   421  	//   "FLEX" - Flex commitments have committed period of 1 minute after becoming
   422  	// ACTIVE. After that, they are not in a committed period anymore and can be
   423  	// removed any time.
   424  	//   "FLEX_FLAT_RATE" - Same as FLEX, should only be used if flat-rate
   425  	// commitments are still available.
   426  	//   "TRIAL" - Trial commitments have a committed period of 182 days after
   427  	// becoming ACTIVE. After that, they are converted to a new commitment based on
   428  	// the `renewal_plan`. Default `renewal_plan` for Trial commitment is Flex so
   429  	// that it can be deleted right after committed period ends.
   430  	//   "MONTHLY" - Monthly commitments have a committed period of 30 days after
   431  	// becoming ACTIVE. After that, they are not in a committed period anymore and
   432  	// can be removed any time.
   433  	//   "MONTHLY_FLAT_RATE" - Same as MONTHLY, should only be used if flat-rate
   434  	// commitments are still available.
   435  	//   "ANNUAL" - Annual commitments have a committed period of 365 days after
   436  	// becoming ACTIVE. After that they are converted to a new commitment based on
   437  	// the renewal_plan.
   438  	//   "ANNUAL_FLAT_RATE" - Same as ANNUAL, should only be used if flat-rate
   439  	// commitments are still available.
   440  	//   "THREE_YEAR" - 3-year commitments have a committed period of 1095(3 * 365)
   441  	// days after becoming ACTIVE. After that they are converted to a new
   442  	// commitment based on the renewal_plan.
   443  	//   "NONE" - Should only be used for `renewal_plan` and is only meaningful if
   444  	// edition is specified to values other than EDITION_UNSPECIFIED. Otherwise
   445  	// CreateCapacityCommitmentRequest or UpdateCapacityCommitmentRequest will be
   446  	// rejected with error code `google.rpc.Code.INVALID_ARGUMENT`. If the
   447  	// renewal_plan is NONE, capacity commitment will be removed at the end of its
   448  	// commitment period.
   449  	RenewalPlan string `json:"renewalPlan,omitempty"`
   450  	// SlotCount: Number of slots in this commitment.
   451  	SlotCount int64 `json:"slotCount,omitempty,string"`
   452  	// State: Output only. State of the commitment.
   453  	//
   454  	// Possible values:
   455  	//   "STATE_UNSPECIFIED" - Invalid state value.
   456  	//   "PENDING" - Capacity commitment is pending provisioning. Pending capacity
   457  	// commitment does not contribute to the project's slot_capacity.
   458  	//   "ACTIVE" - Once slots are provisioned, capacity commitment becomes active.
   459  	// slot_count is added to the project's slot_capacity.
   460  	//   "FAILED" - Capacity commitment is failed to be activated by the backend.
   461  	State string `json:"state,omitempty"`
   462  
   463  	// ServerResponse contains the HTTP response code and headers from the server.
   464  	googleapi.ServerResponse `json:"-"`
   465  	// ForceSendFields is a list of field names (e.g. "CommitmentEndTime") to
   466  	// unconditionally include in API requests. By default, fields with empty or
   467  	// default values are omitted from API requests. See
   468  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   469  	// details.
   470  	ForceSendFields []string `json:"-"`
   471  	// NullFields is a list of field names (e.g. "CommitmentEndTime") to include in
   472  	// API requests with the JSON null value. By default, fields with empty values
   473  	// are omitted from API requests. See
   474  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   475  	NullFields []string `json:"-"`
   476  }
   477  
   478  func (s *CapacityCommitment) MarshalJSON() ([]byte, error) {
   479  	type NoMethod CapacityCommitment
   480  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   481  }
   482  
   483  // Empty: A generic empty message that you can re-use to avoid defining
   484  // duplicated empty messages in your APIs. A typical example is to use it as
   485  // the request or the response type of an API method. For instance: service Foo
   486  // { rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); }
   487  type Empty struct {
   488  	// ServerResponse contains the HTTP response code and headers from the server.
   489  	googleapi.ServerResponse `json:"-"`
   490  }
   491  
   492  // FailoverReservationRequest: The request for
   493  // ReservationService.FailoverReservation.
   494  type FailoverReservationRequest struct {
   495  }
   496  
   497  // ListAssignmentsResponse: The response for
   498  // ReservationService.ListAssignments.
   499  type ListAssignmentsResponse struct {
   500  	// Assignments: List of assignments visible to the user.
   501  	Assignments []*Assignment `json:"assignments,omitempty"`
   502  	// NextPageToken: Token to retrieve the next page of results, or empty if there
   503  	// are no more results in the list.
   504  	NextPageToken string `json:"nextPageToken,omitempty"`
   505  
   506  	// ServerResponse contains the HTTP response code and headers from the server.
   507  	googleapi.ServerResponse `json:"-"`
   508  	// ForceSendFields is a list of field names (e.g. "Assignments") to
   509  	// unconditionally include in API requests. By default, fields with empty or
   510  	// default values are omitted from API requests. See
   511  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   512  	// details.
   513  	ForceSendFields []string `json:"-"`
   514  	// NullFields is a list of field names (e.g. "Assignments") to include in API
   515  	// requests with the JSON null value. By default, fields with empty values are
   516  	// omitted from API requests. See
   517  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   518  	NullFields []string `json:"-"`
   519  }
   520  
   521  func (s *ListAssignmentsResponse) MarshalJSON() ([]byte, error) {
   522  	type NoMethod ListAssignmentsResponse
   523  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   524  }
   525  
   526  // ListCapacityCommitmentsResponse: The response for
   527  // ReservationService.ListCapacityCommitments.
   528  type ListCapacityCommitmentsResponse struct {
   529  	// CapacityCommitments: List of capacity commitments visible to the user.
   530  	CapacityCommitments []*CapacityCommitment `json:"capacityCommitments,omitempty"`
   531  	// NextPageToken: Token to retrieve the next page of results, or empty if there
   532  	// are no more results in the list.
   533  	NextPageToken string `json:"nextPageToken,omitempty"`
   534  
   535  	// ServerResponse contains the HTTP response code and headers from the server.
   536  	googleapi.ServerResponse `json:"-"`
   537  	// ForceSendFields is a list of field names (e.g. "CapacityCommitments") to
   538  	// unconditionally include in API requests. By default, fields with empty or
   539  	// default values are omitted from API requests. See
   540  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   541  	// details.
   542  	ForceSendFields []string `json:"-"`
   543  	// NullFields is a list of field names (e.g. "CapacityCommitments") to include
   544  	// in API requests with the JSON null value. By default, fields with empty
   545  	// values are omitted from API requests. See
   546  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   547  	NullFields []string `json:"-"`
   548  }
   549  
   550  func (s *ListCapacityCommitmentsResponse) MarshalJSON() ([]byte, error) {
   551  	type NoMethod ListCapacityCommitmentsResponse
   552  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   553  }
   554  
   555  // ListReservationsResponse: The response for
   556  // ReservationService.ListReservations.
   557  type ListReservationsResponse struct {
   558  	// NextPageToken: Token to retrieve the next page of results, or empty if there
   559  	// are no more results in the list.
   560  	NextPageToken string `json:"nextPageToken,omitempty"`
   561  	// Reservations: List of reservations visible to the user.
   562  	Reservations []*Reservation `json:"reservations,omitempty"`
   563  
   564  	// ServerResponse contains the HTTP response code and headers from the server.
   565  	googleapi.ServerResponse `json:"-"`
   566  	// ForceSendFields is a list of field names (e.g. "NextPageToken") to
   567  	// unconditionally include in API requests. By default, fields with empty or
   568  	// default values are omitted from API requests. See
   569  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   570  	// details.
   571  	ForceSendFields []string `json:"-"`
   572  	// NullFields is a list of field names (e.g. "NextPageToken") to include in API
   573  	// requests with the JSON null value. By default, fields with empty values are
   574  	// omitted from API requests. See
   575  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   576  	NullFields []string `json:"-"`
   577  }
   578  
   579  func (s *ListReservationsResponse) MarshalJSON() ([]byte, error) {
   580  	type NoMethod ListReservationsResponse
   581  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   582  }
   583  
   584  // MergeCapacityCommitmentsRequest: The request for
   585  // ReservationService.MergeCapacityCommitments.
   586  type MergeCapacityCommitmentsRequest struct {
   587  	// CapacityCommitmentIds: Ids of capacity commitments to merge. These capacity
   588  	// commitments must exist under admin project and location specified in the
   589  	// parent. ID is the last portion of capacity commitment name e.g., 'abc' for
   590  	// projects/myproject/locations/US/capacityCommitments/abc
   591  	CapacityCommitmentIds []string `json:"capacityCommitmentIds,omitempty"`
   592  	// ForceSendFields is a list of field names (e.g. "CapacityCommitmentIds") to
   593  	// unconditionally include in API requests. By default, fields with empty or
   594  	// default values are omitted from API requests. See
   595  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   596  	// details.
   597  	ForceSendFields []string `json:"-"`
   598  	// NullFields is a list of field names (e.g. "CapacityCommitmentIds") to
   599  	// include in API requests with the JSON null value. By default, fields with
   600  	// empty values are omitted from API requests. See
   601  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   602  	NullFields []string `json:"-"`
   603  }
   604  
   605  func (s *MergeCapacityCommitmentsRequest) MarshalJSON() ([]byte, error) {
   606  	type NoMethod MergeCapacityCommitmentsRequest
   607  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   608  }
   609  
   610  // MoveAssignmentRequest: The request for ReservationService.MoveAssignment.
   611  // **Note**: "bigquery.reservationAssignments.create" permission is required on
   612  // the destination_id. **Note**: "bigquery.reservationAssignments.create" and
   613  // "bigquery.reservationAssignments.delete" permission are required on the
   614  // related assignee.
   615  type MoveAssignmentRequest struct {
   616  	// AssignmentId: The optional assignment ID. A new assignment name is generated
   617  	// if this field is empty. This field can contain only lowercase alphanumeric
   618  	// characters or dashes. Max length is 64 characters.
   619  	AssignmentId string `json:"assignmentId,omitempty"`
   620  	// DestinationId: The new reservation ID, e.g.:
   621  	// `projects/myotherproject/locations/US/reservations/team2-prod`
   622  	DestinationId string `json:"destinationId,omitempty"`
   623  	// ForceSendFields is a list of field names (e.g. "AssignmentId") to
   624  	// unconditionally include in API requests. By default, fields with empty or
   625  	// default values are omitted from API requests. See
   626  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   627  	// details.
   628  	ForceSendFields []string `json:"-"`
   629  	// NullFields is a list of field names (e.g. "AssignmentId") to include in API
   630  	// requests with the JSON null value. By default, fields with empty values are
   631  	// omitted from API requests. See
   632  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   633  	NullFields []string `json:"-"`
   634  }
   635  
   636  func (s *MoveAssignmentRequest) MarshalJSON() ([]byte, error) {
   637  	type NoMethod MoveAssignmentRequest
   638  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   639  }
   640  
   641  // Reservation: A reservation is a mechanism used to guarantee slots to users.
   642  type Reservation struct {
   643  	// Autoscale: The configuration parameters for the auto scaling feature.
   644  	Autoscale *Autoscale `json:"autoscale,omitempty"`
   645  	// Concurrency: Job concurrency target which sets a soft upper bound on the
   646  	// number of jobs that can run concurrently in this reservation. This is a soft
   647  	// target due to asynchronous nature of the system and various optimizations
   648  	// for small queries. Default value is 0 which means that concurrency target
   649  	// will be automatically computed by the system. NOTE: this field is exposed as
   650  	// target job concurrency in the Information Schema, DDL and BQ CLI.
   651  	Concurrency int64 `json:"concurrency,omitempty,string"`
   652  	// CreationTime: Output only. Creation time of the reservation.
   653  	CreationTime string `json:"creationTime,omitempty"`
   654  	// Edition: Edition of the reservation.
   655  	//
   656  	// Possible values:
   657  	//   "EDITION_UNSPECIFIED" - Default value, which will be treated as
   658  	// ENTERPRISE.
   659  	//   "STANDARD" - Standard edition.
   660  	//   "ENTERPRISE" - Enterprise edition.
   661  	//   "ENTERPRISE_PLUS" - Enterprise plus edition.
   662  	Edition string `json:"edition,omitempty"`
   663  	// IgnoreIdleSlots: If false, any query or pipeline job using this reservation
   664  	// will use idle slots from other reservations within the same admin project.
   665  	// If true, a query or pipeline job using this reservation will execute with
   666  	// the slot capacity specified in the slot_capacity field at most.
   667  	IgnoreIdleSlots bool `json:"ignoreIdleSlots,omitempty"`
   668  	// MultiRegionAuxiliary: Applicable only for reservations located within one of
   669  	// the BigQuery multi-regions (US or EU). If set to true, this reservation is
   670  	// placed in the organization's secondary region which is designated for
   671  	// disaster recovery purposes. If false, this reservation is placed in the
   672  	// organization's default region. NOTE: this is a preview feature. Project must
   673  	// be allow-listed in order to set this field.
   674  	MultiRegionAuxiliary bool `json:"multiRegionAuxiliary,omitempty"`
   675  	// Name: The resource name of the reservation, e.g.,
   676  	// `projects/*/locations/*/reservations/team1-prod`. The reservation_id must
   677  	// only contain lower case alphanumeric characters or dashes. It must start
   678  	// with a letter and must not end with a dash. Its maximum length is 64
   679  	// characters.
   680  	Name string `json:"name,omitempty"`
   681  	// OriginalPrimaryLocation: Optional. The original primary location of the
   682  	// reservation which is set only during its creation and remains unchanged
   683  	// afterwards. It can be used by the customer to answer questions about
   684  	// disaster recovery billing. The field is output only for customers and should
   685  	// not be specified, however, the google.api.field_behavior is not set to
   686  	// OUTPUT_ONLY since these fields are set in rerouted requests sent across
   687  	// regions.
   688  	OriginalPrimaryLocation string `json:"originalPrimaryLocation,omitempty"`
   689  	// PrimaryLocation: Optional. The primary location of the reservation. The
   690  	// field is only meaningful for reservation used for cross region disaster
   691  	// recovery. The field is output only for customers and should not be
   692  	// specified, however, the google.api.field_behavior is not set to OUTPUT_ONLY
   693  	// since these fields are set in rerouted requests sent across regions.
   694  	PrimaryLocation string `json:"primaryLocation,omitempty"`
   695  	// SecondaryLocation: Optional. The secondary location of the reservation which
   696  	// is used for cross region disaster recovery purposes. Customer can set this
   697  	// in create/update reservation calls to create a failover reservation or
   698  	// convert a non-failover reservation to a failover reservation.
   699  	SecondaryLocation string `json:"secondaryLocation,omitempty"`
   700  	// SlotCapacity: Baseline slots available to this reservation. A slot is a unit
   701  	// of computational power in BigQuery, and serves as the unit of parallelism.
   702  	// Queries using this reservation might use more slots during runtime if
   703  	// ignore_idle_slots is set to false, or autoscaling is enabled. If edition is
   704  	// EDITION_UNSPECIFIED and total slot_capacity of the reservation and its
   705  	// siblings exceeds the total slot_count of all capacity commitments, the
   706  	// request will fail with `google.rpc.Code.RESOURCE_EXHAUSTED`. If edition is
   707  	// any value but EDITION_UNSPECIFIED, then the above requirement is not needed.
   708  	// The total slot_capacity of the reservation and its siblings may exceed the
   709  	// total slot_count of capacity commitments. In that case, the exceeding slots
   710  	// will be charged with the autoscale SKU. You can increase the number of
   711  	// baseline slots in a reservation every few minutes. If you want to decrease
   712  	// your baseline slots, you are limited to once an hour if you have recently
   713  	// changed your baseline slot capacity and your baseline slots exceed your
   714  	// committed slots. Otherwise, you can decrease your baseline slots every few
   715  	// minutes.
   716  	SlotCapacity int64 `json:"slotCapacity,omitempty,string"`
   717  	// UpdateTime: Output only. Last update time of the reservation.
   718  	UpdateTime string `json:"updateTime,omitempty"`
   719  
   720  	// ServerResponse contains the HTTP response code and headers from the server.
   721  	googleapi.ServerResponse `json:"-"`
   722  	// ForceSendFields is a list of field names (e.g. "Autoscale") to
   723  	// unconditionally include in API requests. By default, fields with empty or
   724  	// default values are omitted from API requests. See
   725  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   726  	// details.
   727  	ForceSendFields []string `json:"-"`
   728  	// NullFields is a list of field names (e.g. "Autoscale") to include in API
   729  	// requests with the JSON null value. By default, fields with empty values are
   730  	// omitted from API requests. See
   731  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   732  	NullFields []string `json:"-"`
   733  }
   734  
   735  func (s *Reservation) MarshalJSON() ([]byte, error) {
   736  	type NoMethod Reservation
   737  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   738  }
   739  
   740  // SearchAllAssignmentsResponse: The response for
   741  // ReservationService.SearchAllAssignments.
   742  type SearchAllAssignmentsResponse struct {
   743  	// Assignments: List of assignments visible to the user.
   744  	Assignments []*Assignment `json:"assignments,omitempty"`
   745  	// NextPageToken: Token to retrieve the next page of results, or empty if there
   746  	// are no more results in the list.
   747  	NextPageToken string `json:"nextPageToken,omitempty"`
   748  
   749  	// ServerResponse contains the HTTP response code and headers from the server.
   750  	googleapi.ServerResponse `json:"-"`
   751  	// ForceSendFields is a list of field names (e.g. "Assignments") to
   752  	// unconditionally include in API requests. By default, fields with empty or
   753  	// default values are omitted from API requests. See
   754  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   755  	// details.
   756  	ForceSendFields []string `json:"-"`
   757  	// NullFields is a list of field names (e.g. "Assignments") to include in API
   758  	// requests with the JSON null value. By default, fields with empty values are
   759  	// omitted from API requests. See
   760  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   761  	NullFields []string `json:"-"`
   762  }
   763  
   764  func (s *SearchAllAssignmentsResponse) MarshalJSON() ([]byte, error) {
   765  	type NoMethod SearchAllAssignmentsResponse
   766  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   767  }
   768  
   769  // SearchAssignmentsResponse: The response for
   770  // ReservationService.SearchAssignments.
   771  type SearchAssignmentsResponse struct {
   772  	// Assignments: List of assignments visible to the user.
   773  	Assignments []*Assignment `json:"assignments,omitempty"`
   774  	// NextPageToken: Token to retrieve the next page of results, or empty if there
   775  	// are no more results in the list.
   776  	NextPageToken string `json:"nextPageToken,omitempty"`
   777  
   778  	// ServerResponse contains the HTTP response code and headers from the server.
   779  	googleapi.ServerResponse `json:"-"`
   780  	// ForceSendFields is a list of field names (e.g. "Assignments") to
   781  	// unconditionally include in API requests. By default, fields with empty or
   782  	// default values are omitted from API requests. See
   783  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   784  	// details.
   785  	ForceSendFields []string `json:"-"`
   786  	// NullFields is a list of field names (e.g. "Assignments") to include in API
   787  	// requests with the JSON null value. By default, fields with empty values are
   788  	// omitted from API requests. See
   789  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   790  	NullFields []string `json:"-"`
   791  }
   792  
   793  func (s *SearchAssignmentsResponse) MarshalJSON() ([]byte, error) {
   794  	type NoMethod SearchAssignmentsResponse
   795  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   796  }
   797  
   798  // SplitCapacityCommitmentRequest: The request for
   799  // ReservationService.SplitCapacityCommitment.
   800  type SplitCapacityCommitmentRequest struct {
   801  	// SlotCount: Number of slots in the capacity commitment after the split.
   802  	SlotCount int64 `json:"slotCount,omitempty,string"`
   803  	// ForceSendFields is a list of field names (e.g. "SlotCount") to
   804  	// unconditionally include in API requests. By default, fields with empty or
   805  	// default values are omitted from API requests. See
   806  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   807  	// details.
   808  	ForceSendFields []string `json:"-"`
   809  	// NullFields is a list of field names (e.g. "SlotCount") to include in API
   810  	// requests with the JSON null value. By default, fields with empty values are
   811  	// omitted from API requests. See
   812  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   813  	NullFields []string `json:"-"`
   814  }
   815  
   816  func (s *SplitCapacityCommitmentRequest) MarshalJSON() ([]byte, error) {
   817  	type NoMethod SplitCapacityCommitmentRequest
   818  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   819  }
   820  
   821  // SplitCapacityCommitmentResponse: The response for
   822  // ReservationService.SplitCapacityCommitment.
   823  type SplitCapacityCommitmentResponse struct {
   824  	// First: First capacity commitment, result of a split.
   825  	First *CapacityCommitment `json:"first,omitempty"`
   826  	// Second: Second capacity commitment, result of a split.
   827  	Second *CapacityCommitment `json:"second,omitempty"`
   828  
   829  	// ServerResponse contains the HTTP response code and headers from the server.
   830  	googleapi.ServerResponse `json:"-"`
   831  	// ForceSendFields is a list of field names (e.g. "First") to unconditionally
   832  	// include in API requests. By default, fields with empty or default values are
   833  	// omitted from API requests. See
   834  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   835  	// details.
   836  	ForceSendFields []string `json:"-"`
   837  	// NullFields is a list of field names (e.g. "First") to include in API
   838  	// requests with the JSON null value. By default, fields with empty values are
   839  	// omitted from API requests. See
   840  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   841  	NullFields []string `json:"-"`
   842  }
   843  
   844  func (s *SplitCapacityCommitmentResponse) MarshalJSON() ([]byte, error) {
   845  	type NoMethod SplitCapacityCommitmentResponse
   846  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   847  }
   848  
   849  // Status: The `Status` type defines a logical error model that is suitable for
   850  // different programming environments, including REST APIs and RPC APIs. It is
   851  // used by gRPC (https://github.com/grpc). Each `Status` message contains three
   852  // pieces of data: error code, error message, and error details. You can find
   853  // out more about this error model and how to work with it in the API Design
   854  // Guide (https://cloud.google.com/apis/design/errors).
   855  type Status struct {
   856  	// Code: The status code, which should be an enum value of google.rpc.Code.
   857  	Code int64 `json:"code,omitempty"`
   858  	// Details: A list of messages that carry the error details. There is a common
   859  	// set of message types for APIs to use.
   860  	Details []googleapi.RawMessage `json:"details,omitempty"`
   861  	// Message: A developer-facing error message, which should be in English. Any
   862  	// user-facing error message should be localized and sent in the
   863  	// google.rpc.Status.details field, or localized by the client.
   864  	Message string `json:"message,omitempty"`
   865  	// ForceSendFields is a list of field names (e.g. "Code") to unconditionally
   866  	// include in API requests. By default, fields with empty or default values are
   867  	// omitted from API requests. See
   868  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   869  	// details.
   870  	ForceSendFields []string `json:"-"`
   871  	// NullFields is a list of field names (e.g. "Code") to include in API requests
   872  	// with the JSON null value. By default, fields with empty values are omitted
   873  	// from API requests. See
   874  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   875  	NullFields []string `json:"-"`
   876  }
   877  
   878  func (s *Status) MarshalJSON() ([]byte, error) {
   879  	type NoMethod Status
   880  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   881  }
   882  
   883  // TableReference: Fully qualified reference to BigQuery table. Internally
   884  // stored as google.cloud.bi.v1.BqTableReference.
   885  type TableReference struct {
   886  	// DatasetId: The ID of the dataset in the above project.
   887  	DatasetId string `json:"datasetId,omitempty"`
   888  	// ProjectId: The assigned project ID of the project.
   889  	ProjectId string `json:"projectId,omitempty"`
   890  	// TableId: The ID of the table in the above dataset.
   891  	TableId string `json:"tableId,omitempty"`
   892  	// ForceSendFields is a list of field names (e.g. "DatasetId") to
   893  	// unconditionally include in API requests. By default, fields with empty or
   894  	// default values are omitted from API requests. See
   895  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   896  	// details.
   897  	ForceSendFields []string `json:"-"`
   898  	// NullFields is a list of field names (e.g. "DatasetId") to include in API
   899  	// requests with the JSON null value. By default, fields with empty values are
   900  	// omitted from API requests. See
   901  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   902  	NullFields []string `json:"-"`
   903  }
   904  
   905  func (s *TableReference) MarshalJSON() ([]byte, error) {
   906  	type NoMethod TableReference
   907  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   908  }
   909  
   910  type ProjectsLocationsGetBiReservationCall struct {
   911  	s            *Service
   912  	name         string
   913  	urlParams_   gensupport.URLParams
   914  	ifNoneMatch_ string
   915  	ctx_         context.Context
   916  	header_      http.Header
   917  }
   918  
   919  // GetBiReservation: Retrieves a BI reservation.
   920  //
   921  //   - name: Name of the requested reservation, for example:
   922  //     `projects/{project_id}/locations/{location_id}/biReservation`.
   923  func (r *ProjectsLocationsService) GetBiReservation(name string) *ProjectsLocationsGetBiReservationCall {
   924  	c := &ProjectsLocationsGetBiReservationCall{s: r.s, urlParams_: make(gensupport.URLParams)}
   925  	c.name = name
   926  	return c
   927  }
   928  
   929  // Fields allows partial responses to be retrieved. See
   930  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
   931  // details.
   932  func (c *ProjectsLocationsGetBiReservationCall) Fields(s ...googleapi.Field) *ProjectsLocationsGetBiReservationCall {
   933  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
   934  	return c
   935  }
   936  
   937  // IfNoneMatch sets an optional parameter which makes the operation fail if the
   938  // object's ETag matches the given value. This is useful for getting updates
   939  // only after the object has changed since the last request.
   940  func (c *ProjectsLocationsGetBiReservationCall) IfNoneMatch(entityTag string) *ProjectsLocationsGetBiReservationCall {
   941  	c.ifNoneMatch_ = entityTag
   942  	return c
   943  }
   944  
   945  // Context sets the context to be used in this call's Do method.
   946  func (c *ProjectsLocationsGetBiReservationCall) Context(ctx context.Context) *ProjectsLocationsGetBiReservationCall {
   947  	c.ctx_ = ctx
   948  	return c
   949  }
   950  
   951  // Header returns a http.Header that can be modified by the caller to add
   952  // headers to the request.
   953  func (c *ProjectsLocationsGetBiReservationCall) Header() http.Header {
   954  	if c.header_ == nil {
   955  		c.header_ = make(http.Header)
   956  	}
   957  	return c.header_
   958  }
   959  
   960  func (c *ProjectsLocationsGetBiReservationCall) doRequest(alt string) (*http.Response, error) {
   961  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
   962  	if c.ifNoneMatch_ != "" {
   963  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
   964  	}
   965  	var body io.Reader = nil
   966  	c.urlParams_.Set("alt", alt)
   967  	c.urlParams_.Set("prettyPrint", "false")
   968  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
   969  	urls += "?" + c.urlParams_.Encode()
   970  	req, err := http.NewRequest("GET", urls, body)
   971  	if err != nil {
   972  		return nil, err
   973  	}
   974  	req.Header = reqHeaders
   975  	googleapi.Expand(req.URL, map[string]string{
   976  		"name": c.name,
   977  	})
   978  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
   979  }
   980  
   981  // Do executes the "bigqueryreservation.projects.locations.getBiReservation" call.
   982  // Any non-2xx status code is an error. Response headers are in either
   983  // *BiReservation.ServerResponse.Header or (if a response was returned at all)
   984  // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
   985  // whether the returned error was because http.StatusNotModified was returned.
   986  func (c *ProjectsLocationsGetBiReservationCall) Do(opts ...googleapi.CallOption) (*BiReservation, error) {
   987  	gensupport.SetOptions(c.urlParams_, opts...)
   988  	res, err := c.doRequest("json")
   989  	if res != nil && res.StatusCode == http.StatusNotModified {
   990  		if res.Body != nil {
   991  			res.Body.Close()
   992  		}
   993  		return nil, gensupport.WrapError(&googleapi.Error{
   994  			Code:   res.StatusCode,
   995  			Header: res.Header,
   996  		})
   997  	}
   998  	if err != nil {
   999  		return nil, err
  1000  	}
  1001  	defer googleapi.CloseBody(res)
  1002  	if err := googleapi.CheckResponse(res); err != nil {
  1003  		return nil, gensupport.WrapError(err)
  1004  	}
  1005  	ret := &BiReservation{
  1006  		ServerResponse: googleapi.ServerResponse{
  1007  			Header:         res.Header,
  1008  			HTTPStatusCode: res.StatusCode,
  1009  		},
  1010  	}
  1011  	target := &ret
  1012  	if err := gensupport.DecodeResponse(target, res); err != nil {
  1013  		return nil, err
  1014  	}
  1015  	return ret, nil
  1016  }
  1017  
  1018  type ProjectsLocationsSearchAllAssignmentsCall struct {
  1019  	s            *Service
  1020  	parent       string
  1021  	urlParams_   gensupport.URLParams
  1022  	ifNoneMatch_ string
  1023  	ctx_         context.Context
  1024  	header_      http.Header
  1025  }
  1026  
  1027  // SearchAllAssignments: Looks up assignments for a specified resource for a
  1028  // particular region. If the request is about a project: 1. Assignments created
  1029  // on the project will be returned if they exist. 2. Otherwise assignments
  1030  // created on the closest ancestor will be returned. 3. Assignments for
  1031  // different JobTypes will all be returned. The same logic applies if the
  1032  // request is about a folder. If the request is about an organization, then
  1033  // assignments created on the organization will be returned (organization
  1034  // doesn't have ancestors). Comparing to ListAssignments, there are some
  1035  // behavior differences: 1. permission on the assignee will be verified in this
  1036  // API. 2. Hierarchy lookup (project->folder->organization) happens in this
  1037  // API. 3. Parent here is `projects/*/locations/*`, instead of
  1038  // `projects/*/locations/*reservations/*`.
  1039  //
  1040  //   - parent: The resource name with location (project name could be the
  1041  //     wildcard '-'), e.g.: `projects/-/locations/US`.
  1042  func (r *ProjectsLocationsService) SearchAllAssignments(parent string) *ProjectsLocationsSearchAllAssignmentsCall {
  1043  	c := &ProjectsLocationsSearchAllAssignmentsCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1044  	c.parent = parent
  1045  	return c
  1046  }
  1047  
  1048  // PageSize sets the optional parameter "pageSize": The maximum number of items
  1049  // to return per page.
  1050  func (c *ProjectsLocationsSearchAllAssignmentsCall) PageSize(pageSize int64) *ProjectsLocationsSearchAllAssignmentsCall {
  1051  	c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  1052  	return c
  1053  }
  1054  
  1055  // PageToken sets the optional parameter "pageToken": The next_page_token value
  1056  // returned from a previous List request, if any.
  1057  func (c *ProjectsLocationsSearchAllAssignmentsCall) PageToken(pageToken string) *ProjectsLocationsSearchAllAssignmentsCall {
  1058  	c.urlParams_.Set("pageToken", pageToken)
  1059  	return c
  1060  }
  1061  
  1062  // Query sets the optional parameter "query": Please specify resource name as
  1063  // assignee in the query. Examples: * `assignee=projects/myproject` *
  1064  // `assignee=folders/123` * `assignee=organizations/456`
  1065  func (c *ProjectsLocationsSearchAllAssignmentsCall) Query(query string) *ProjectsLocationsSearchAllAssignmentsCall {
  1066  	c.urlParams_.Set("query", query)
  1067  	return c
  1068  }
  1069  
  1070  // Fields allows partial responses to be retrieved. See
  1071  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  1072  // details.
  1073  func (c *ProjectsLocationsSearchAllAssignmentsCall) Fields(s ...googleapi.Field) *ProjectsLocationsSearchAllAssignmentsCall {
  1074  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1075  	return c
  1076  }
  1077  
  1078  // IfNoneMatch sets an optional parameter which makes the operation fail if the
  1079  // object's ETag matches the given value. This is useful for getting updates
  1080  // only after the object has changed since the last request.
  1081  func (c *ProjectsLocationsSearchAllAssignmentsCall) IfNoneMatch(entityTag string) *ProjectsLocationsSearchAllAssignmentsCall {
  1082  	c.ifNoneMatch_ = entityTag
  1083  	return c
  1084  }
  1085  
  1086  // Context sets the context to be used in this call's Do method.
  1087  func (c *ProjectsLocationsSearchAllAssignmentsCall) Context(ctx context.Context) *ProjectsLocationsSearchAllAssignmentsCall {
  1088  	c.ctx_ = ctx
  1089  	return c
  1090  }
  1091  
  1092  // Header returns a http.Header that can be modified by the caller to add
  1093  // headers to the request.
  1094  func (c *ProjectsLocationsSearchAllAssignmentsCall) Header() http.Header {
  1095  	if c.header_ == nil {
  1096  		c.header_ = make(http.Header)
  1097  	}
  1098  	return c.header_
  1099  }
  1100  
  1101  func (c *ProjectsLocationsSearchAllAssignmentsCall) doRequest(alt string) (*http.Response, error) {
  1102  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
  1103  	if c.ifNoneMatch_ != "" {
  1104  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1105  	}
  1106  	var body io.Reader = nil
  1107  	c.urlParams_.Set("alt", alt)
  1108  	c.urlParams_.Set("prettyPrint", "false")
  1109  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}:searchAllAssignments")
  1110  	urls += "?" + c.urlParams_.Encode()
  1111  	req, err := http.NewRequest("GET", urls, body)
  1112  	if err != nil {
  1113  		return nil, err
  1114  	}
  1115  	req.Header = reqHeaders
  1116  	googleapi.Expand(req.URL, map[string]string{
  1117  		"parent": c.parent,
  1118  	})
  1119  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1120  }
  1121  
  1122  // Do executes the "bigqueryreservation.projects.locations.searchAllAssignments" call.
  1123  // Any non-2xx status code is an error. Response headers are in either
  1124  // *SearchAllAssignmentsResponse.ServerResponse.Header or (if a response was
  1125  // returned at all) in error.(*googleapi.Error).Header. Use
  1126  // googleapi.IsNotModified to check whether the returned error was because
  1127  // http.StatusNotModified was returned.
  1128  func (c *ProjectsLocationsSearchAllAssignmentsCall) Do(opts ...googleapi.CallOption) (*SearchAllAssignmentsResponse, error) {
  1129  	gensupport.SetOptions(c.urlParams_, opts...)
  1130  	res, err := c.doRequest("json")
  1131  	if res != nil && res.StatusCode == http.StatusNotModified {
  1132  		if res.Body != nil {
  1133  			res.Body.Close()
  1134  		}
  1135  		return nil, gensupport.WrapError(&googleapi.Error{
  1136  			Code:   res.StatusCode,
  1137  			Header: res.Header,
  1138  		})
  1139  	}
  1140  	if err != nil {
  1141  		return nil, err
  1142  	}
  1143  	defer googleapi.CloseBody(res)
  1144  	if err := googleapi.CheckResponse(res); err != nil {
  1145  		return nil, gensupport.WrapError(err)
  1146  	}
  1147  	ret := &SearchAllAssignmentsResponse{
  1148  		ServerResponse: googleapi.ServerResponse{
  1149  			Header:         res.Header,
  1150  			HTTPStatusCode: res.StatusCode,
  1151  		},
  1152  	}
  1153  	target := &ret
  1154  	if err := gensupport.DecodeResponse(target, res); err != nil {
  1155  		return nil, err
  1156  	}
  1157  	return ret, nil
  1158  }
  1159  
  1160  // Pages invokes f for each page of results.
  1161  // A non-nil error returned from f will halt the iteration.
  1162  // The provided context supersedes any context provided to the Context method.
  1163  func (c *ProjectsLocationsSearchAllAssignmentsCall) Pages(ctx context.Context, f func(*SearchAllAssignmentsResponse) error) error {
  1164  	c.ctx_ = ctx
  1165  	defer c.PageToken(c.urlParams_.Get("pageToken"))
  1166  	for {
  1167  		x, err := c.Do()
  1168  		if err != nil {
  1169  			return err
  1170  		}
  1171  		if err := f(x); err != nil {
  1172  			return err
  1173  		}
  1174  		if x.NextPageToken == "" {
  1175  			return nil
  1176  		}
  1177  		c.PageToken(x.NextPageToken)
  1178  	}
  1179  }
  1180  
  1181  type ProjectsLocationsSearchAssignmentsCall struct {
  1182  	s            *Service
  1183  	parent       string
  1184  	urlParams_   gensupport.URLParams
  1185  	ifNoneMatch_ string
  1186  	ctx_         context.Context
  1187  	header_      http.Header
  1188  }
  1189  
  1190  // SearchAssignments: Deprecated: Looks up assignments for a specified resource
  1191  // for a particular region. If the request is about a project: 1. Assignments
  1192  // created on the project will be returned if they exist. 2. Otherwise
  1193  // assignments created on the closest ancestor will be returned. 3. Assignments
  1194  // for different JobTypes will all be returned. The same logic applies if the
  1195  // request is about a folder. If the request is about an organization, then
  1196  // assignments created on the organization will be returned (organization
  1197  // doesn't have ancestors). Comparing to ListAssignments, there are some
  1198  // behavior differences: 1. permission on the assignee will be verified in this
  1199  // API. 2. Hierarchy lookup (project->folder->organization) happens in this
  1200  // API. 3. Parent here is `projects/*/locations/*`, instead of
  1201  // `projects/*/locations/*reservations/*`. **Note** "-" cannot be used for
  1202  // projects nor locations.
  1203  //
  1204  //   - parent: The resource name of the admin project(containing project and
  1205  //     location), e.g.: `projects/myproject/locations/US`.
  1206  func (r *ProjectsLocationsService) SearchAssignments(parent string) *ProjectsLocationsSearchAssignmentsCall {
  1207  	c := &ProjectsLocationsSearchAssignmentsCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1208  	c.parent = parent
  1209  	return c
  1210  }
  1211  
  1212  // PageSize sets the optional parameter "pageSize": The maximum number of items
  1213  // to return per page.
  1214  func (c *ProjectsLocationsSearchAssignmentsCall) PageSize(pageSize int64) *ProjectsLocationsSearchAssignmentsCall {
  1215  	c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  1216  	return c
  1217  }
  1218  
  1219  // PageToken sets the optional parameter "pageToken": The next_page_token value
  1220  // returned from a previous List request, if any.
  1221  func (c *ProjectsLocationsSearchAssignmentsCall) PageToken(pageToken string) *ProjectsLocationsSearchAssignmentsCall {
  1222  	c.urlParams_.Set("pageToken", pageToken)
  1223  	return c
  1224  }
  1225  
  1226  // Query sets the optional parameter "query": Please specify resource name as
  1227  // assignee in the query. Examples: * `assignee=projects/myproject` *
  1228  // `assignee=folders/123` * `assignee=organizations/456`
  1229  func (c *ProjectsLocationsSearchAssignmentsCall) Query(query string) *ProjectsLocationsSearchAssignmentsCall {
  1230  	c.urlParams_.Set("query", query)
  1231  	return c
  1232  }
  1233  
  1234  // Fields allows partial responses to be retrieved. See
  1235  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  1236  // details.
  1237  func (c *ProjectsLocationsSearchAssignmentsCall) Fields(s ...googleapi.Field) *ProjectsLocationsSearchAssignmentsCall {
  1238  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1239  	return c
  1240  }
  1241  
  1242  // IfNoneMatch sets an optional parameter which makes the operation fail if the
  1243  // object's ETag matches the given value. This is useful for getting updates
  1244  // only after the object has changed since the last request.
  1245  func (c *ProjectsLocationsSearchAssignmentsCall) IfNoneMatch(entityTag string) *ProjectsLocationsSearchAssignmentsCall {
  1246  	c.ifNoneMatch_ = entityTag
  1247  	return c
  1248  }
  1249  
  1250  // Context sets the context to be used in this call's Do method.
  1251  func (c *ProjectsLocationsSearchAssignmentsCall) Context(ctx context.Context) *ProjectsLocationsSearchAssignmentsCall {
  1252  	c.ctx_ = ctx
  1253  	return c
  1254  }
  1255  
  1256  // Header returns a http.Header that can be modified by the caller to add
  1257  // headers to the request.
  1258  func (c *ProjectsLocationsSearchAssignmentsCall) Header() http.Header {
  1259  	if c.header_ == nil {
  1260  		c.header_ = make(http.Header)
  1261  	}
  1262  	return c.header_
  1263  }
  1264  
  1265  func (c *ProjectsLocationsSearchAssignmentsCall) doRequest(alt string) (*http.Response, error) {
  1266  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
  1267  	if c.ifNoneMatch_ != "" {
  1268  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1269  	}
  1270  	var body io.Reader = nil
  1271  	c.urlParams_.Set("alt", alt)
  1272  	c.urlParams_.Set("prettyPrint", "false")
  1273  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}:searchAssignments")
  1274  	urls += "?" + c.urlParams_.Encode()
  1275  	req, err := http.NewRequest("GET", urls, body)
  1276  	if err != nil {
  1277  		return nil, err
  1278  	}
  1279  	req.Header = reqHeaders
  1280  	googleapi.Expand(req.URL, map[string]string{
  1281  		"parent": c.parent,
  1282  	})
  1283  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1284  }
  1285  
  1286  // Do executes the "bigqueryreservation.projects.locations.searchAssignments" call.
  1287  // Any non-2xx status code is an error. Response headers are in either
  1288  // *SearchAssignmentsResponse.ServerResponse.Header or (if a response was
  1289  // returned at all) in error.(*googleapi.Error).Header. Use
  1290  // googleapi.IsNotModified to check whether the returned error was because
  1291  // http.StatusNotModified was returned.
  1292  func (c *ProjectsLocationsSearchAssignmentsCall) Do(opts ...googleapi.CallOption) (*SearchAssignmentsResponse, error) {
  1293  	gensupport.SetOptions(c.urlParams_, opts...)
  1294  	res, err := c.doRequest("json")
  1295  	if res != nil && res.StatusCode == http.StatusNotModified {
  1296  		if res.Body != nil {
  1297  			res.Body.Close()
  1298  		}
  1299  		return nil, gensupport.WrapError(&googleapi.Error{
  1300  			Code:   res.StatusCode,
  1301  			Header: res.Header,
  1302  		})
  1303  	}
  1304  	if err != nil {
  1305  		return nil, err
  1306  	}
  1307  	defer googleapi.CloseBody(res)
  1308  	if err := googleapi.CheckResponse(res); err != nil {
  1309  		return nil, gensupport.WrapError(err)
  1310  	}
  1311  	ret := &SearchAssignmentsResponse{
  1312  		ServerResponse: googleapi.ServerResponse{
  1313  			Header:         res.Header,
  1314  			HTTPStatusCode: res.StatusCode,
  1315  		},
  1316  	}
  1317  	target := &ret
  1318  	if err := gensupport.DecodeResponse(target, res); err != nil {
  1319  		return nil, err
  1320  	}
  1321  	return ret, nil
  1322  }
  1323  
  1324  // Pages invokes f for each page of results.
  1325  // A non-nil error returned from f will halt the iteration.
  1326  // The provided context supersedes any context provided to the Context method.
  1327  func (c *ProjectsLocationsSearchAssignmentsCall) Pages(ctx context.Context, f func(*SearchAssignmentsResponse) error) error {
  1328  	c.ctx_ = ctx
  1329  	defer c.PageToken(c.urlParams_.Get("pageToken"))
  1330  	for {
  1331  		x, err := c.Do()
  1332  		if err != nil {
  1333  			return err
  1334  		}
  1335  		if err := f(x); err != nil {
  1336  			return err
  1337  		}
  1338  		if x.NextPageToken == "" {
  1339  			return nil
  1340  		}
  1341  		c.PageToken(x.NextPageToken)
  1342  	}
  1343  }
  1344  
  1345  type ProjectsLocationsUpdateBiReservationCall struct {
  1346  	s             *Service
  1347  	name          string
  1348  	bireservation *BiReservation
  1349  	urlParams_    gensupport.URLParams
  1350  	ctx_          context.Context
  1351  	header_       http.Header
  1352  }
  1353  
  1354  // UpdateBiReservation: Updates a BI reservation. Only fields specified in the
  1355  // `field_mask` are updated. A singleton BI reservation always exists with
  1356  // default size 0. In order to reserve BI capacity it needs to be updated to an
  1357  // amount greater than 0. In order to release BI capacity reservation size must
  1358  // be set to 0.
  1359  //
  1360  //   - name: The resource name of the singleton BI reservation. Reservation names
  1361  //     have the form
  1362  //     `projects/{project_id}/locations/{location_id}/biReservation`.
  1363  func (r *ProjectsLocationsService) UpdateBiReservation(name string, bireservation *BiReservation) *ProjectsLocationsUpdateBiReservationCall {
  1364  	c := &ProjectsLocationsUpdateBiReservationCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1365  	c.name = name
  1366  	c.bireservation = bireservation
  1367  	return c
  1368  }
  1369  
  1370  // UpdateMask sets the optional parameter "updateMask": A list of fields to be
  1371  // updated in this request.
  1372  func (c *ProjectsLocationsUpdateBiReservationCall) UpdateMask(updateMask string) *ProjectsLocationsUpdateBiReservationCall {
  1373  	c.urlParams_.Set("updateMask", updateMask)
  1374  	return c
  1375  }
  1376  
  1377  // Fields allows partial responses to be retrieved. See
  1378  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  1379  // details.
  1380  func (c *ProjectsLocationsUpdateBiReservationCall) Fields(s ...googleapi.Field) *ProjectsLocationsUpdateBiReservationCall {
  1381  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1382  	return c
  1383  }
  1384  
  1385  // Context sets the context to be used in this call's Do method.
  1386  func (c *ProjectsLocationsUpdateBiReservationCall) Context(ctx context.Context) *ProjectsLocationsUpdateBiReservationCall {
  1387  	c.ctx_ = ctx
  1388  	return c
  1389  }
  1390  
  1391  // Header returns a http.Header that can be modified by the caller to add
  1392  // headers to the request.
  1393  func (c *ProjectsLocationsUpdateBiReservationCall) Header() http.Header {
  1394  	if c.header_ == nil {
  1395  		c.header_ = make(http.Header)
  1396  	}
  1397  	return c.header_
  1398  }
  1399  
  1400  func (c *ProjectsLocationsUpdateBiReservationCall) doRequest(alt string) (*http.Response, error) {
  1401  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
  1402  	var body io.Reader = nil
  1403  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.bireservation)
  1404  	if err != nil {
  1405  		return nil, err
  1406  	}
  1407  	c.urlParams_.Set("alt", alt)
  1408  	c.urlParams_.Set("prettyPrint", "false")
  1409  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  1410  	urls += "?" + c.urlParams_.Encode()
  1411  	req, err := http.NewRequest("PATCH", urls, body)
  1412  	if err != nil {
  1413  		return nil, err
  1414  	}
  1415  	req.Header = reqHeaders
  1416  	googleapi.Expand(req.URL, map[string]string{
  1417  		"name": c.name,
  1418  	})
  1419  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1420  }
  1421  
  1422  // Do executes the "bigqueryreservation.projects.locations.updateBiReservation" call.
  1423  // Any non-2xx status code is an error. Response headers are in either
  1424  // *BiReservation.ServerResponse.Header or (if a response was returned at all)
  1425  // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  1426  // whether the returned error was because http.StatusNotModified was returned.
  1427  func (c *ProjectsLocationsUpdateBiReservationCall) Do(opts ...googleapi.CallOption) (*BiReservation, error) {
  1428  	gensupport.SetOptions(c.urlParams_, opts...)
  1429  	res, err := c.doRequest("json")
  1430  	if res != nil && res.StatusCode == http.StatusNotModified {
  1431  		if res.Body != nil {
  1432  			res.Body.Close()
  1433  		}
  1434  		return nil, gensupport.WrapError(&googleapi.Error{
  1435  			Code:   res.StatusCode,
  1436  			Header: res.Header,
  1437  		})
  1438  	}
  1439  	if err != nil {
  1440  		return nil, err
  1441  	}
  1442  	defer googleapi.CloseBody(res)
  1443  	if err := googleapi.CheckResponse(res); err != nil {
  1444  		return nil, gensupport.WrapError(err)
  1445  	}
  1446  	ret := &BiReservation{
  1447  		ServerResponse: googleapi.ServerResponse{
  1448  			Header:         res.Header,
  1449  			HTTPStatusCode: res.StatusCode,
  1450  		},
  1451  	}
  1452  	target := &ret
  1453  	if err := gensupport.DecodeResponse(target, res); err != nil {
  1454  		return nil, err
  1455  	}
  1456  	return ret, nil
  1457  }
  1458  
  1459  type ProjectsLocationsCapacityCommitmentsCreateCall struct {
  1460  	s                  *Service
  1461  	parent             string
  1462  	capacitycommitment *CapacityCommitment
  1463  	urlParams_         gensupport.URLParams
  1464  	ctx_               context.Context
  1465  	header_            http.Header
  1466  }
  1467  
  1468  // Create: Creates a new capacity commitment resource.
  1469  //
  1470  //   - parent: Resource name of the parent reservation. E.g.,
  1471  //     `projects/myproject/locations/US`.
  1472  func (r *ProjectsLocationsCapacityCommitmentsService) Create(parent string, capacitycommitment *CapacityCommitment) *ProjectsLocationsCapacityCommitmentsCreateCall {
  1473  	c := &ProjectsLocationsCapacityCommitmentsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1474  	c.parent = parent
  1475  	c.capacitycommitment = capacitycommitment
  1476  	return c
  1477  }
  1478  
  1479  // CapacityCommitmentId sets the optional parameter "capacityCommitmentId": The
  1480  // optional capacity commitment ID. Capacity commitment name will be generated
  1481  // automatically if this field is empty. This field must only contain lower
  1482  // case alphanumeric characters or dashes. The first and last character cannot
  1483  // be a dash. Max length is 64 characters. NOTE: this ID won't be kept if the
  1484  // capacity commitment is split or merged.
  1485  func (c *ProjectsLocationsCapacityCommitmentsCreateCall) CapacityCommitmentId(capacityCommitmentId string) *ProjectsLocationsCapacityCommitmentsCreateCall {
  1486  	c.urlParams_.Set("capacityCommitmentId", capacityCommitmentId)
  1487  	return c
  1488  }
  1489  
  1490  // EnforceSingleAdminProjectPerOrg sets the optional parameter
  1491  // "enforceSingleAdminProjectPerOrg": If true, fail the request if another
  1492  // project in the organization has a capacity commitment.
  1493  func (c *ProjectsLocationsCapacityCommitmentsCreateCall) EnforceSingleAdminProjectPerOrg(enforceSingleAdminProjectPerOrg bool) *ProjectsLocationsCapacityCommitmentsCreateCall {
  1494  	c.urlParams_.Set("enforceSingleAdminProjectPerOrg", fmt.Sprint(enforceSingleAdminProjectPerOrg))
  1495  	return c
  1496  }
  1497  
  1498  // Fields allows partial responses to be retrieved. See
  1499  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  1500  // details.
  1501  func (c *ProjectsLocationsCapacityCommitmentsCreateCall) Fields(s ...googleapi.Field) *ProjectsLocationsCapacityCommitmentsCreateCall {
  1502  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1503  	return c
  1504  }
  1505  
  1506  // Context sets the context to be used in this call's Do method.
  1507  func (c *ProjectsLocationsCapacityCommitmentsCreateCall) Context(ctx context.Context) *ProjectsLocationsCapacityCommitmentsCreateCall {
  1508  	c.ctx_ = ctx
  1509  	return c
  1510  }
  1511  
  1512  // Header returns a http.Header that can be modified by the caller to add
  1513  // headers to the request.
  1514  func (c *ProjectsLocationsCapacityCommitmentsCreateCall) Header() http.Header {
  1515  	if c.header_ == nil {
  1516  		c.header_ = make(http.Header)
  1517  	}
  1518  	return c.header_
  1519  }
  1520  
  1521  func (c *ProjectsLocationsCapacityCommitmentsCreateCall) doRequest(alt string) (*http.Response, error) {
  1522  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
  1523  	var body io.Reader = nil
  1524  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.capacitycommitment)
  1525  	if err != nil {
  1526  		return nil, err
  1527  	}
  1528  	c.urlParams_.Set("alt", alt)
  1529  	c.urlParams_.Set("prettyPrint", "false")
  1530  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/capacityCommitments")
  1531  	urls += "?" + c.urlParams_.Encode()
  1532  	req, err := http.NewRequest("POST", urls, body)
  1533  	if err != nil {
  1534  		return nil, err
  1535  	}
  1536  	req.Header = reqHeaders
  1537  	googleapi.Expand(req.URL, map[string]string{
  1538  		"parent": c.parent,
  1539  	})
  1540  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1541  }
  1542  
  1543  // Do executes the "bigqueryreservation.projects.locations.capacityCommitments.create" call.
  1544  // Any non-2xx status code is an error. Response headers are in either
  1545  // *CapacityCommitment.ServerResponse.Header or (if a response was returned at
  1546  // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  1547  // check whether the returned error was because http.StatusNotModified was
  1548  // returned.
  1549  func (c *ProjectsLocationsCapacityCommitmentsCreateCall) Do(opts ...googleapi.CallOption) (*CapacityCommitment, error) {
  1550  	gensupport.SetOptions(c.urlParams_, opts...)
  1551  	res, err := c.doRequest("json")
  1552  	if res != nil && res.StatusCode == http.StatusNotModified {
  1553  		if res.Body != nil {
  1554  			res.Body.Close()
  1555  		}
  1556  		return nil, gensupport.WrapError(&googleapi.Error{
  1557  			Code:   res.StatusCode,
  1558  			Header: res.Header,
  1559  		})
  1560  	}
  1561  	if err != nil {
  1562  		return nil, err
  1563  	}
  1564  	defer googleapi.CloseBody(res)
  1565  	if err := googleapi.CheckResponse(res); err != nil {
  1566  		return nil, gensupport.WrapError(err)
  1567  	}
  1568  	ret := &CapacityCommitment{
  1569  		ServerResponse: googleapi.ServerResponse{
  1570  			Header:         res.Header,
  1571  			HTTPStatusCode: res.StatusCode,
  1572  		},
  1573  	}
  1574  	target := &ret
  1575  	if err := gensupport.DecodeResponse(target, res); err != nil {
  1576  		return nil, err
  1577  	}
  1578  	return ret, nil
  1579  }
  1580  
  1581  type ProjectsLocationsCapacityCommitmentsDeleteCall struct {
  1582  	s          *Service
  1583  	name       string
  1584  	urlParams_ gensupport.URLParams
  1585  	ctx_       context.Context
  1586  	header_    http.Header
  1587  }
  1588  
  1589  // Delete: Deletes a capacity commitment. Attempting to delete capacity
  1590  // commitment before its commitment_end_time will fail with the error code
  1591  // `google.rpc.Code.FAILED_PRECONDITION`.
  1592  //
  1593  //   - name: Resource name of the capacity commitment to delete. E.g.,
  1594  //     `projects/myproject/locations/US/capacityCommitments/123`.
  1595  func (r *ProjectsLocationsCapacityCommitmentsService) Delete(name string) *ProjectsLocationsCapacityCommitmentsDeleteCall {
  1596  	c := &ProjectsLocationsCapacityCommitmentsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1597  	c.name = name
  1598  	return c
  1599  }
  1600  
  1601  // Force sets the optional parameter "force": Can be used to force delete
  1602  // commitments even if assignments exist. Deleting commitments with assignments
  1603  // may cause queries to fail if they no longer have access to slots.
  1604  func (c *ProjectsLocationsCapacityCommitmentsDeleteCall) Force(force bool) *ProjectsLocationsCapacityCommitmentsDeleteCall {
  1605  	c.urlParams_.Set("force", fmt.Sprint(force))
  1606  	return c
  1607  }
  1608  
  1609  // Fields allows partial responses to be retrieved. See
  1610  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  1611  // details.
  1612  func (c *ProjectsLocationsCapacityCommitmentsDeleteCall) Fields(s ...googleapi.Field) *ProjectsLocationsCapacityCommitmentsDeleteCall {
  1613  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1614  	return c
  1615  }
  1616  
  1617  // Context sets the context to be used in this call's Do method.
  1618  func (c *ProjectsLocationsCapacityCommitmentsDeleteCall) Context(ctx context.Context) *ProjectsLocationsCapacityCommitmentsDeleteCall {
  1619  	c.ctx_ = ctx
  1620  	return c
  1621  }
  1622  
  1623  // Header returns a http.Header that can be modified by the caller to add
  1624  // headers to the request.
  1625  func (c *ProjectsLocationsCapacityCommitmentsDeleteCall) Header() http.Header {
  1626  	if c.header_ == nil {
  1627  		c.header_ = make(http.Header)
  1628  	}
  1629  	return c.header_
  1630  }
  1631  
  1632  func (c *ProjectsLocationsCapacityCommitmentsDeleteCall) doRequest(alt string) (*http.Response, error) {
  1633  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
  1634  	var body io.Reader = nil
  1635  	c.urlParams_.Set("alt", alt)
  1636  	c.urlParams_.Set("prettyPrint", "false")
  1637  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  1638  	urls += "?" + c.urlParams_.Encode()
  1639  	req, err := http.NewRequest("DELETE", urls, body)
  1640  	if err != nil {
  1641  		return nil, err
  1642  	}
  1643  	req.Header = reqHeaders
  1644  	googleapi.Expand(req.URL, map[string]string{
  1645  		"name": c.name,
  1646  	})
  1647  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1648  }
  1649  
  1650  // Do executes the "bigqueryreservation.projects.locations.capacityCommitments.delete" call.
  1651  // Any non-2xx status code is an error. Response headers are in either
  1652  // *Empty.ServerResponse.Header or (if a response was returned at all) in
  1653  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  1654  // whether the returned error was because http.StatusNotModified was returned.
  1655  func (c *ProjectsLocationsCapacityCommitmentsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  1656  	gensupport.SetOptions(c.urlParams_, opts...)
  1657  	res, err := c.doRequest("json")
  1658  	if res != nil && res.StatusCode == http.StatusNotModified {
  1659  		if res.Body != nil {
  1660  			res.Body.Close()
  1661  		}
  1662  		return nil, gensupport.WrapError(&googleapi.Error{
  1663  			Code:   res.StatusCode,
  1664  			Header: res.Header,
  1665  		})
  1666  	}
  1667  	if err != nil {
  1668  		return nil, err
  1669  	}
  1670  	defer googleapi.CloseBody(res)
  1671  	if err := googleapi.CheckResponse(res); err != nil {
  1672  		return nil, gensupport.WrapError(err)
  1673  	}
  1674  	ret := &Empty{
  1675  		ServerResponse: googleapi.ServerResponse{
  1676  			Header:         res.Header,
  1677  			HTTPStatusCode: res.StatusCode,
  1678  		},
  1679  	}
  1680  	target := &ret
  1681  	if err := gensupport.DecodeResponse(target, res); err != nil {
  1682  		return nil, err
  1683  	}
  1684  	return ret, nil
  1685  }
  1686  
  1687  type ProjectsLocationsCapacityCommitmentsGetCall struct {
  1688  	s            *Service
  1689  	name         string
  1690  	urlParams_   gensupport.URLParams
  1691  	ifNoneMatch_ string
  1692  	ctx_         context.Context
  1693  	header_      http.Header
  1694  }
  1695  
  1696  // Get: Returns information about the capacity commitment.
  1697  //
  1698  //   - name: Resource name of the capacity commitment to retrieve. E.g.,
  1699  //     `projects/myproject/locations/US/capacityCommitments/123`.
  1700  func (r *ProjectsLocationsCapacityCommitmentsService) Get(name string) *ProjectsLocationsCapacityCommitmentsGetCall {
  1701  	c := &ProjectsLocationsCapacityCommitmentsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1702  	c.name = name
  1703  	return c
  1704  }
  1705  
  1706  // Fields allows partial responses to be retrieved. See
  1707  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  1708  // details.
  1709  func (c *ProjectsLocationsCapacityCommitmentsGetCall) Fields(s ...googleapi.Field) *ProjectsLocationsCapacityCommitmentsGetCall {
  1710  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1711  	return c
  1712  }
  1713  
  1714  // IfNoneMatch sets an optional parameter which makes the operation fail if the
  1715  // object's ETag matches the given value. This is useful for getting updates
  1716  // only after the object has changed since the last request.
  1717  func (c *ProjectsLocationsCapacityCommitmentsGetCall) IfNoneMatch(entityTag string) *ProjectsLocationsCapacityCommitmentsGetCall {
  1718  	c.ifNoneMatch_ = entityTag
  1719  	return c
  1720  }
  1721  
  1722  // Context sets the context to be used in this call's Do method.
  1723  func (c *ProjectsLocationsCapacityCommitmentsGetCall) Context(ctx context.Context) *ProjectsLocationsCapacityCommitmentsGetCall {
  1724  	c.ctx_ = ctx
  1725  	return c
  1726  }
  1727  
  1728  // Header returns a http.Header that can be modified by the caller to add
  1729  // headers to the request.
  1730  func (c *ProjectsLocationsCapacityCommitmentsGetCall) Header() http.Header {
  1731  	if c.header_ == nil {
  1732  		c.header_ = make(http.Header)
  1733  	}
  1734  	return c.header_
  1735  }
  1736  
  1737  func (c *ProjectsLocationsCapacityCommitmentsGetCall) doRequest(alt string) (*http.Response, error) {
  1738  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
  1739  	if c.ifNoneMatch_ != "" {
  1740  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1741  	}
  1742  	var body io.Reader = nil
  1743  	c.urlParams_.Set("alt", alt)
  1744  	c.urlParams_.Set("prettyPrint", "false")
  1745  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  1746  	urls += "?" + c.urlParams_.Encode()
  1747  	req, err := http.NewRequest("GET", urls, body)
  1748  	if err != nil {
  1749  		return nil, err
  1750  	}
  1751  	req.Header = reqHeaders
  1752  	googleapi.Expand(req.URL, map[string]string{
  1753  		"name": c.name,
  1754  	})
  1755  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1756  }
  1757  
  1758  // Do executes the "bigqueryreservation.projects.locations.capacityCommitments.get" call.
  1759  // Any non-2xx status code is an error. Response headers are in either
  1760  // *CapacityCommitment.ServerResponse.Header or (if a response was returned at
  1761  // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  1762  // check whether the returned error was because http.StatusNotModified was
  1763  // returned.
  1764  func (c *ProjectsLocationsCapacityCommitmentsGetCall) Do(opts ...googleapi.CallOption) (*CapacityCommitment, error) {
  1765  	gensupport.SetOptions(c.urlParams_, opts...)
  1766  	res, err := c.doRequest("json")
  1767  	if res != nil && res.StatusCode == http.StatusNotModified {
  1768  		if res.Body != nil {
  1769  			res.Body.Close()
  1770  		}
  1771  		return nil, gensupport.WrapError(&googleapi.Error{
  1772  			Code:   res.StatusCode,
  1773  			Header: res.Header,
  1774  		})
  1775  	}
  1776  	if err != nil {
  1777  		return nil, err
  1778  	}
  1779  	defer googleapi.CloseBody(res)
  1780  	if err := googleapi.CheckResponse(res); err != nil {
  1781  		return nil, gensupport.WrapError(err)
  1782  	}
  1783  	ret := &CapacityCommitment{
  1784  		ServerResponse: googleapi.ServerResponse{
  1785  			Header:         res.Header,
  1786  			HTTPStatusCode: res.StatusCode,
  1787  		},
  1788  	}
  1789  	target := &ret
  1790  	if err := gensupport.DecodeResponse(target, res); err != nil {
  1791  		return nil, err
  1792  	}
  1793  	return ret, nil
  1794  }
  1795  
  1796  type ProjectsLocationsCapacityCommitmentsListCall struct {
  1797  	s            *Service
  1798  	parent       string
  1799  	urlParams_   gensupport.URLParams
  1800  	ifNoneMatch_ string
  1801  	ctx_         context.Context
  1802  	header_      http.Header
  1803  }
  1804  
  1805  // List: Lists all the capacity commitments for the admin project.
  1806  //
  1807  //   - parent: Resource name of the parent reservation. E.g.,
  1808  //     `projects/myproject/locations/US`.
  1809  func (r *ProjectsLocationsCapacityCommitmentsService) List(parent string) *ProjectsLocationsCapacityCommitmentsListCall {
  1810  	c := &ProjectsLocationsCapacityCommitmentsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1811  	c.parent = parent
  1812  	return c
  1813  }
  1814  
  1815  // PageSize sets the optional parameter "pageSize": The maximum number of items
  1816  // to return.
  1817  func (c *ProjectsLocationsCapacityCommitmentsListCall) PageSize(pageSize int64) *ProjectsLocationsCapacityCommitmentsListCall {
  1818  	c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  1819  	return c
  1820  }
  1821  
  1822  // PageToken sets the optional parameter "pageToken": The next_page_token value
  1823  // returned from a previous List request, if any.
  1824  func (c *ProjectsLocationsCapacityCommitmentsListCall) PageToken(pageToken string) *ProjectsLocationsCapacityCommitmentsListCall {
  1825  	c.urlParams_.Set("pageToken", pageToken)
  1826  	return c
  1827  }
  1828  
  1829  // Fields allows partial responses to be retrieved. See
  1830  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  1831  // details.
  1832  func (c *ProjectsLocationsCapacityCommitmentsListCall) Fields(s ...googleapi.Field) *ProjectsLocationsCapacityCommitmentsListCall {
  1833  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1834  	return c
  1835  }
  1836  
  1837  // IfNoneMatch sets an optional parameter which makes the operation fail if the
  1838  // object's ETag matches the given value. This is useful for getting updates
  1839  // only after the object has changed since the last request.
  1840  func (c *ProjectsLocationsCapacityCommitmentsListCall) IfNoneMatch(entityTag string) *ProjectsLocationsCapacityCommitmentsListCall {
  1841  	c.ifNoneMatch_ = entityTag
  1842  	return c
  1843  }
  1844  
  1845  // Context sets the context to be used in this call's Do method.
  1846  func (c *ProjectsLocationsCapacityCommitmentsListCall) Context(ctx context.Context) *ProjectsLocationsCapacityCommitmentsListCall {
  1847  	c.ctx_ = ctx
  1848  	return c
  1849  }
  1850  
  1851  // Header returns a http.Header that can be modified by the caller to add
  1852  // headers to the request.
  1853  func (c *ProjectsLocationsCapacityCommitmentsListCall) Header() http.Header {
  1854  	if c.header_ == nil {
  1855  		c.header_ = make(http.Header)
  1856  	}
  1857  	return c.header_
  1858  }
  1859  
  1860  func (c *ProjectsLocationsCapacityCommitmentsListCall) doRequest(alt string) (*http.Response, error) {
  1861  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
  1862  	if c.ifNoneMatch_ != "" {
  1863  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1864  	}
  1865  	var body io.Reader = nil
  1866  	c.urlParams_.Set("alt", alt)
  1867  	c.urlParams_.Set("prettyPrint", "false")
  1868  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/capacityCommitments")
  1869  	urls += "?" + c.urlParams_.Encode()
  1870  	req, err := http.NewRequest("GET", urls, body)
  1871  	if err != nil {
  1872  		return nil, err
  1873  	}
  1874  	req.Header = reqHeaders
  1875  	googleapi.Expand(req.URL, map[string]string{
  1876  		"parent": c.parent,
  1877  	})
  1878  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1879  }
  1880  
  1881  // Do executes the "bigqueryreservation.projects.locations.capacityCommitments.list" call.
  1882  // Any non-2xx status code is an error. Response headers are in either
  1883  // *ListCapacityCommitmentsResponse.ServerResponse.Header or (if a response was
  1884  // returned at all) in error.(*googleapi.Error).Header. Use
  1885  // googleapi.IsNotModified to check whether the returned error was because
  1886  // http.StatusNotModified was returned.
  1887  func (c *ProjectsLocationsCapacityCommitmentsListCall) Do(opts ...googleapi.CallOption) (*ListCapacityCommitmentsResponse, error) {
  1888  	gensupport.SetOptions(c.urlParams_, opts...)
  1889  	res, err := c.doRequest("json")
  1890  	if res != nil && res.StatusCode == http.StatusNotModified {
  1891  		if res.Body != nil {
  1892  			res.Body.Close()
  1893  		}
  1894  		return nil, gensupport.WrapError(&googleapi.Error{
  1895  			Code:   res.StatusCode,
  1896  			Header: res.Header,
  1897  		})
  1898  	}
  1899  	if err != nil {
  1900  		return nil, err
  1901  	}
  1902  	defer googleapi.CloseBody(res)
  1903  	if err := googleapi.CheckResponse(res); err != nil {
  1904  		return nil, gensupport.WrapError(err)
  1905  	}
  1906  	ret := &ListCapacityCommitmentsResponse{
  1907  		ServerResponse: googleapi.ServerResponse{
  1908  			Header:         res.Header,
  1909  			HTTPStatusCode: res.StatusCode,
  1910  		},
  1911  	}
  1912  	target := &ret
  1913  	if err := gensupport.DecodeResponse(target, res); err != nil {
  1914  		return nil, err
  1915  	}
  1916  	return ret, nil
  1917  }
  1918  
  1919  // Pages invokes f for each page of results.
  1920  // A non-nil error returned from f will halt the iteration.
  1921  // The provided context supersedes any context provided to the Context method.
  1922  func (c *ProjectsLocationsCapacityCommitmentsListCall) Pages(ctx context.Context, f func(*ListCapacityCommitmentsResponse) error) error {
  1923  	c.ctx_ = ctx
  1924  	defer c.PageToken(c.urlParams_.Get("pageToken"))
  1925  	for {
  1926  		x, err := c.Do()
  1927  		if err != nil {
  1928  			return err
  1929  		}
  1930  		if err := f(x); err != nil {
  1931  			return err
  1932  		}
  1933  		if x.NextPageToken == "" {
  1934  			return nil
  1935  		}
  1936  		c.PageToken(x.NextPageToken)
  1937  	}
  1938  }
  1939  
  1940  type ProjectsLocationsCapacityCommitmentsMergeCall struct {
  1941  	s                               *Service
  1942  	parent                          string
  1943  	mergecapacitycommitmentsrequest *MergeCapacityCommitmentsRequest
  1944  	urlParams_                      gensupport.URLParams
  1945  	ctx_                            context.Context
  1946  	header_                         http.Header
  1947  }
  1948  
  1949  // Merge: Merges capacity commitments of the same plan into a single
  1950  // commitment. The resulting capacity commitment has the greater
  1951  // commitment_end_time out of the to-be-merged capacity commitments. Attempting
  1952  // to merge capacity commitments of different plan will fail with the error
  1953  // code `google.rpc.Code.FAILED_PRECONDITION`.
  1954  //
  1955  //   - parent: Parent resource that identifies admin project and location e.g.,
  1956  //     `projects/myproject/locations/us`.
  1957  func (r *ProjectsLocationsCapacityCommitmentsService) Merge(parent string, mergecapacitycommitmentsrequest *MergeCapacityCommitmentsRequest) *ProjectsLocationsCapacityCommitmentsMergeCall {
  1958  	c := &ProjectsLocationsCapacityCommitmentsMergeCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1959  	c.parent = parent
  1960  	c.mergecapacitycommitmentsrequest = mergecapacitycommitmentsrequest
  1961  	return c
  1962  }
  1963  
  1964  // Fields allows partial responses to be retrieved. See
  1965  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  1966  // details.
  1967  func (c *ProjectsLocationsCapacityCommitmentsMergeCall) Fields(s ...googleapi.Field) *ProjectsLocationsCapacityCommitmentsMergeCall {
  1968  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1969  	return c
  1970  }
  1971  
  1972  // Context sets the context to be used in this call's Do method.
  1973  func (c *ProjectsLocationsCapacityCommitmentsMergeCall) Context(ctx context.Context) *ProjectsLocationsCapacityCommitmentsMergeCall {
  1974  	c.ctx_ = ctx
  1975  	return c
  1976  }
  1977  
  1978  // Header returns a http.Header that can be modified by the caller to add
  1979  // headers to the request.
  1980  func (c *ProjectsLocationsCapacityCommitmentsMergeCall) Header() http.Header {
  1981  	if c.header_ == nil {
  1982  		c.header_ = make(http.Header)
  1983  	}
  1984  	return c.header_
  1985  }
  1986  
  1987  func (c *ProjectsLocationsCapacityCommitmentsMergeCall) doRequest(alt string) (*http.Response, error) {
  1988  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
  1989  	var body io.Reader = nil
  1990  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.mergecapacitycommitmentsrequest)
  1991  	if err != nil {
  1992  		return nil, err
  1993  	}
  1994  	c.urlParams_.Set("alt", alt)
  1995  	c.urlParams_.Set("prettyPrint", "false")
  1996  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/capacityCommitments:merge")
  1997  	urls += "?" + c.urlParams_.Encode()
  1998  	req, err := http.NewRequest("POST", urls, body)
  1999  	if err != nil {
  2000  		return nil, err
  2001  	}
  2002  	req.Header = reqHeaders
  2003  	googleapi.Expand(req.URL, map[string]string{
  2004  		"parent": c.parent,
  2005  	})
  2006  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2007  }
  2008  
  2009  // Do executes the "bigqueryreservation.projects.locations.capacityCommitments.merge" call.
  2010  // Any non-2xx status code is an error. Response headers are in either
  2011  // *CapacityCommitment.ServerResponse.Header or (if a response was returned at
  2012  // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2013  // check whether the returned error was because http.StatusNotModified was
  2014  // returned.
  2015  func (c *ProjectsLocationsCapacityCommitmentsMergeCall) Do(opts ...googleapi.CallOption) (*CapacityCommitment, error) {
  2016  	gensupport.SetOptions(c.urlParams_, opts...)
  2017  	res, err := c.doRequest("json")
  2018  	if res != nil && res.StatusCode == http.StatusNotModified {
  2019  		if res.Body != nil {
  2020  			res.Body.Close()
  2021  		}
  2022  		return nil, gensupport.WrapError(&googleapi.Error{
  2023  			Code:   res.StatusCode,
  2024  			Header: res.Header,
  2025  		})
  2026  	}
  2027  	if err != nil {
  2028  		return nil, err
  2029  	}
  2030  	defer googleapi.CloseBody(res)
  2031  	if err := googleapi.CheckResponse(res); err != nil {
  2032  		return nil, gensupport.WrapError(err)
  2033  	}
  2034  	ret := &CapacityCommitment{
  2035  		ServerResponse: googleapi.ServerResponse{
  2036  			Header:         res.Header,
  2037  			HTTPStatusCode: res.StatusCode,
  2038  		},
  2039  	}
  2040  	target := &ret
  2041  	if err := gensupport.DecodeResponse(target, res); err != nil {
  2042  		return nil, err
  2043  	}
  2044  	return ret, nil
  2045  }
  2046  
  2047  type ProjectsLocationsCapacityCommitmentsPatchCall struct {
  2048  	s                  *Service
  2049  	name               string
  2050  	capacitycommitment *CapacityCommitment
  2051  	urlParams_         gensupport.URLParams
  2052  	ctx_               context.Context
  2053  	header_            http.Header
  2054  }
  2055  
  2056  // Patch: Updates an existing capacity commitment. Only `plan` and
  2057  // `renewal_plan` fields can be updated. Plan can only be changed to a plan of
  2058  // a longer commitment period. Attempting to change to a plan with shorter
  2059  // commitment period will fail with the error code
  2060  // `google.rpc.Code.FAILED_PRECONDITION`.
  2061  //
  2062  //   - name: Output only. The resource name of the capacity commitment, e.g.,
  2063  //     `projects/myproject/locations/US/capacityCommitments/123` The
  2064  //     commitment_id must only contain lower case alphanumeric characters or
  2065  //     dashes. It must start with a letter and must not end with a dash. Its
  2066  //     maximum length is 64 characters.
  2067  func (r *ProjectsLocationsCapacityCommitmentsService) Patch(name string, capacitycommitment *CapacityCommitment) *ProjectsLocationsCapacityCommitmentsPatchCall {
  2068  	c := &ProjectsLocationsCapacityCommitmentsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2069  	c.name = name
  2070  	c.capacitycommitment = capacitycommitment
  2071  	return c
  2072  }
  2073  
  2074  // UpdateMask sets the optional parameter "updateMask": Standard field mask for
  2075  // the set of fields to be updated.
  2076  func (c *ProjectsLocationsCapacityCommitmentsPatchCall) UpdateMask(updateMask string) *ProjectsLocationsCapacityCommitmentsPatchCall {
  2077  	c.urlParams_.Set("updateMask", updateMask)
  2078  	return c
  2079  }
  2080  
  2081  // Fields allows partial responses to be retrieved. See
  2082  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  2083  // details.
  2084  func (c *ProjectsLocationsCapacityCommitmentsPatchCall) Fields(s ...googleapi.Field) *ProjectsLocationsCapacityCommitmentsPatchCall {
  2085  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2086  	return c
  2087  }
  2088  
  2089  // Context sets the context to be used in this call's Do method.
  2090  func (c *ProjectsLocationsCapacityCommitmentsPatchCall) Context(ctx context.Context) *ProjectsLocationsCapacityCommitmentsPatchCall {
  2091  	c.ctx_ = ctx
  2092  	return c
  2093  }
  2094  
  2095  // Header returns a http.Header that can be modified by the caller to add
  2096  // headers to the request.
  2097  func (c *ProjectsLocationsCapacityCommitmentsPatchCall) Header() http.Header {
  2098  	if c.header_ == nil {
  2099  		c.header_ = make(http.Header)
  2100  	}
  2101  	return c.header_
  2102  }
  2103  
  2104  func (c *ProjectsLocationsCapacityCommitmentsPatchCall) doRequest(alt string) (*http.Response, error) {
  2105  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
  2106  	var body io.Reader = nil
  2107  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.capacitycommitment)
  2108  	if err != nil {
  2109  		return nil, err
  2110  	}
  2111  	c.urlParams_.Set("alt", alt)
  2112  	c.urlParams_.Set("prettyPrint", "false")
  2113  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  2114  	urls += "?" + c.urlParams_.Encode()
  2115  	req, err := http.NewRequest("PATCH", urls, body)
  2116  	if err != nil {
  2117  		return nil, err
  2118  	}
  2119  	req.Header = reqHeaders
  2120  	googleapi.Expand(req.URL, map[string]string{
  2121  		"name": c.name,
  2122  	})
  2123  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2124  }
  2125  
  2126  // Do executes the "bigqueryreservation.projects.locations.capacityCommitments.patch" call.
  2127  // Any non-2xx status code is an error. Response headers are in either
  2128  // *CapacityCommitment.ServerResponse.Header or (if a response was returned at
  2129  // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2130  // check whether the returned error was because http.StatusNotModified was
  2131  // returned.
  2132  func (c *ProjectsLocationsCapacityCommitmentsPatchCall) Do(opts ...googleapi.CallOption) (*CapacityCommitment, error) {
  2133  	gensupport.SetOptions(c.urlParams_, opts...)
  2134  	res, err := c.doRequest("json")
  2135  	if res != nil && res.StatusCode == http.StatusNotModified {
  2136  		if res.Body != nil {
  2137  			res.Body.Close()
  2138  		}
  2139  		return nil, gensupport.WrapError(&googleapi.Error{
  2140  			Code:   res.StatusCode,
  2141  			Header: res.Header,
  2142  		})
  2143  	}
  2144  	if err != nil {
  2145  		return nil, err
  2146  	}
  2147  	defer googleapi.CloseBody(res)
  2148  	if err := googleapi.CheckResponse(res); err != nil {
  2149  		return nil, gensupport.WrapError(err)
  2150  	}
  2151  	ret := &CapacityCommitment{
  2152  		ServerResponse: googleapi.ServerResponse{
  2153  			Header:         res.Header,
  2154  			HTTPStatusCode: res.StatusCode,
  2155  		},
  2156  	}
  2157  	target := &ret
  2158  	if err := gensupport.DecodeResponse(target, res); err != nil {
  2159  		return nil, err
  2160  	}
  2161  	return ret, nil
  2162  }
  2163  
  2164  type ProjectsLocationsCapacityCommitmentsSplitCall struct {
  2165  	s                              *Service
  2166  	name                           string
  2167  	splitcapacitycommitmentrequest *SplitCapacityCommitmentRequest
  2168  	urlParams_                     gensupport.URLParams
  2169  	ctx_                           context.Context
  2170  	header_                        http.Header
  2171  }
  2172  
  2173  // Split: Splits capacity commitment to two commitments of the same plan and
  2174  // `commitment_end_time`. A common use case is to enable downgrading
  2175  // commitments. For example, in order to downgrade from 10000 slots to 8000,
  2176  // you might split a 10000 capacity commitment into commitments of 2000 and
  2177  // 8000. Then, you delete the first one after the commitment end time passes.
  2178  //
  2179  //   - name: The resource name e.g.,:
  2180  //     `projects/myproject/locations/US/capacityCommitments/123`.
  2181  func (r *ProjectsLocationsCapacityCommitmentsService) Split(name string, splitcapacitycommitmentrequest *SplitCapacityCommitmentRequest) *ProjectsLocationsCapacityCommitmentsSplitCall {
  2182  	c := &ProjectsLocationsCapacityCommitmentsSplitCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2183  	c.name = name
  2184  	c.splitcapacitycommitmentrequest = splitcapacitycommitmentrequest
  2185  	return c
  2186  }
  2187  
  2188  // Fields allows partial responses to be retrieved. See
  2189  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  2190  // details.
  2191  func (c *ProjectsLocationsCapacityCommitmentsSplitCall) Fields(s ...googleapi.Field) *ProjectsLocationsCapacityCommitmentsSplitCall {
  2192  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2193  	return c
  2194  }
  2195  
  2196  // Context sets the context to be used in this call's Do method.
  2197  func (c *ProjectsLocationsCapacityCommitmentsSplitCall) Context(ctx context.Context) *ProjectsLocationsCapacityCommitmentsSplitCall {
  2198  	c.ctx_ = ctx
  2199  	return c
  2200  }
  2201  
  2202  // Header returns a http.Header that can be modified by the caller to add
  2203  // headers to the request.
  2204  func (c *ProjectsLocationsCapacityCommitmentsSplitCall) Header() http.Header {
  2205  	if c.header_ == nil {
  2206  		c.header_ = make(http.Header)
  2207  	}
  2208  	return c.header_
  2209  }
  2210  
  2211  func (c *ProjectsLocationsCapacityCommitmentsSplitCall) doRequest(alt string) (*http.Response, error) {
  2212  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
  2213  	var body io.Reader = nil
  2214  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.splitcapacitycommitmentrequest)
  2215  	if err != nil {
  2216  		return nil, err
  2217  	}
  2218  	c.urlParams_.Set("alt", alt)
  2219  	c.urlParams_.Set("prettyPrint", "false")
  2220  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}:split")
  2221  	urls += "?" + c.urlParams_.Encode()
  2222  	req, err := http.NewRequest("POST", urls, body)
  2223  	if err != nil {
  2224  		return nil, err
  2225  	}
  2226  	req.Header = reqHeaders
  2227  	googleapi.Expand(req.URL, map[string]string{
  2228  		"name": c.name,
  2229  	})
  2230  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2231  }
  2232  
  2233  // Do executes the "bigqueryreservation.projects.locations.capacityCommitments.split" call.
  2234  // Any non-2xx status code is an error. Response headers are in either
  2235  // *SplitCapacityCommitmentResponse.ServerResponse.Header or (if a response was
  2236  // returned at all) in error.(*googleapi.Error).Header. Use
  2237  // googleapi.IsNotModified to check whether the returned error was because
  2238  // http.StatusNotModified was returned.
  2239  func (c *ProjectsLocationsCapacityCommitmentsSplitCall) Do(opts ...googleapi.CallOption) (*SplitCapacityCommitmentResponse, error) {
  2240  	gensupport.SetOptions(c.urlParams_, opts...)
  2241  	res, err := c.doRequest("json")
  2242  	if res != nil && res.StatusCode == http.StatusNotModified {
  2243  		if res.Body != nil {
  2244  			res.Body.Close()
  2245  		}
  2246  		return nil, gensupport.WrapError(&googleapi.Error{
  2247  			Code:   res.StatusCode,
  2248  			Header: res.Header,
  2249  		})
  2250  	}
  2251  	if err != nil {
  2252  		return nil, err
  2253  	}
  2254  	defer googleapi.CloseBody(res)
  2255  	if err := googleapi.CheckResponse(res); err != nil {
  2256  		return nil, gensupport.WrapError(err)
  2257  	}
  2258  	ret := &SplitCapacityCommitmentResponse{
  2259  		ServerResponse: googleapi.ServerResponse{
  2260  			Header:         res.Header,
  2261  			HTTPStatusCode: res.StatusCode,
  2262  		},
  2263  	}
  2264  	target := &ret
  2265  	if err := gensupport.DecodeResponse(target, res); err != nil {
  2266  		return nil, err
  2267  	}
  2268  	return ret, nil
  2269  }
  2270  
  2271  type ProjectsLocationsReservationsCreateCall struct {
  2272  	s           *Service
  2273  	parent      string
  2274  	reservation *Reservation
  2275  	urlParams_  gensupport.URLParams
  2276  	ctx_        context.Context
  2277  	header_     http.Header
  2278  }
  2279  
  2280  // Create: Creates a new reservation resource.
  2281  //
  2282  // - parent: Project, location. E.g., `projects/myproject/locations/US`.
  2283  func (r *ProjectsLocationsReservationsService) Create(parent string, reservation *Reservation) *ProjectsLocationsReservationsCreateCall {
  2284  	c := &ProjectsLocationsReservationsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2285  	c.parent = parent
  2286  	c.reservation = reservation
  2287  	return c
  2288  }
  2289  
  2290  // ReservationId sets the optional parameter "reservationId": The reservation
  2291  // ID. It must only contain lower case alphanumeric characters or dashes. It
  2292  // must start with a letter and must not end with a dash. Its maximum length is
  2293  // 64 characters.
  2294  func (c *ProjectsLocationsReservationsCreateCall) ReservationId(reservationId string) *ProjectsLocationsReservationsCreateCall {
  2295  	c.urlParams_.Set("reservationId", reservationId)
  2296  	return c
  2297  }
  2298  
  2299  // Fields allows partial responses to be retrieved. See
  2300  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  2301  // details.
  2302  func (c *ProjectsLocationsReservationsCreateCall) Fields(s ...googleapi.Field) *ProjectsLocationsReservationsCreateCall {
  2303  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2304  	return c
  2305  }
  2306  
  2307  // Context sets the context to be used in this call's Do method.
  2308  func (c *ProjectsLocationsReservationsCreateCall) Context(ctx context.Context) *ProjectsLocationsReservationsCreateCall {
  2309  	c.ctx_ = ctx
  2310  	return c
  2311  }
  2312  
  2313  // Header returns a http.Header that can be modified by the caller to add
  2314  // headers to the request.
  2315  func (c *ProjectsLocationsReservationsCreateCall) Header() http.Header {
  2316  	if c.header_ == nil {
  2317  		c.header_ = make(http.Header)
  2318  	}
  2319  	return c.header_
  2320  }
  2321  
  2322  func (c *ProjectsLocationsReservationsCreateCall) doRequest(alt string) (*http.Response, error) {
  2323  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
  2324  	var body io.Reader = nil
  2325  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.reservation)
  2326  	if err != nil {
  2327  		return nil, err
  2328  	}
  2329  	c.urlParams_.Set("alt", alt)
  2330  	c.urlParams_.Set("prettyPrint", "false")
  2331  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/reservations")
  2332  	urls += "?" + c.urlParams_.Encode()
  2333  	req, err := http.NewRequest("POST", urls, body)
  2334  	if err != nil {
  2335  		return nil, err
  2336  	}
  2337  	req.Header = reqHeaders
  2338  	googleapi.Expand(req.URL, map[string]string{
  2339  		"parent": c.parent,
  2340  	})
  2341  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2342  }
  2343  
  2344  // Do executes the "bigqueryreservation.projects.locations.reservations.create" call.
  2345  // Any non-2xx status code is an error. Response headers are in either
  2346  // *Reservation.ServerResponse.Header or (if a response was returned at all) in
  2347  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  2348  // whether the returned error was because http.StatusNotModified was returned.
  2349  func (c *ProjectsLocationsReservationsCreateCall) Do(opts ...googleapi.CallOption) (*Reservation, error) {
  2350  	gensupport.SetOptions(c.urlParams_, opts...)
  2351  	res, err := c.doRequest("json")
  2352  	if res != nil && res.StatusCode == http.StatusNotModified {
  2353  		if res.Body != nil {
  2354  			res.Body.Close()
  2355  		}
  2356  		return nil, gensupport.WrapError(&googleapi.Error{
  2357  			Code:   res.StatusCode,
  2358  			Header: res.Header,
  2359  		})
  2360  	}
  2361  	if err != nil {
  2362  		return nil, err
  2363  	}
  2364  	defer googleapi.CloseBody(res)
  2365  	if err := googleapi.CheckResponse(res); err != nil {
  2366  		return nil, gensupport.WrapError(err)
  2367  	}
  2368  	ret := &Reservation{
  2369  		ServerResponse: googleapi.ServerResponse{
  2370  			Header:         res.Header,
  2371  			HTTPStatusCode: res.StatusCode,
  2372  		},
  2373  	}
  2374  	target := &ret
  2375  	if err := gensupport.DecodeResponse(target, res); err != nil {
  2376  		return nil, err
  2377  	}
  2378  	return ret, nil
  2379  }
  2380  
  2381  type ProjectsLocationsReservationsDeleteCall struct {
  2382  	s          *Service
  2383  	name       string
  2384  	urlParams_ gensupport.URLParams
  2385  	ctx_       context.Context
  2386  	header_    http.Header
  2387  }
  2388  
  2389  // Delete: Deletes a reservation. Returns `google.rpc.Code.FAILED_PRECONDITION`
  2390  // when reservation has assignments.
  2391  //
  2392  //   - name: Resource name of the reservation to retrieve. E.g.,
  2393  //     `projects/myproject/locations/US/reservations/team1-prod`.
  2394  func (r *ProjectsLocationsReservationsService) Delete(name string) *ProjectsLocationsReservationsDeleteCall {
  2395  	c := &ProjectsLocationsReservationsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2396  	c.name = name
  2397  	return c
  2398  }
  2399  
  2400  // Fields allows partial responses to be retrieved. See
  2401  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  2402  // details.
  2403  func (c *ProjectsLocationsReservationsDeleteCall) Fields(s ...googleapi.Field) *ProjectsLocationsReservationsDeleteCall {
  2404  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2405  	return c
  2406  }
  2407  
  2408  // Context sets the context to be used in this call's Do method.
  2409  func (c *ProjectsLocationsReservationsDeleteCall) Context(ctx context.Context) *ProjectsLocationsReservationsDeleteCall {
  2410  	c.ctx_ = ctx
  2411  	return c
  2412  }
  2413  
  2414  // Header returns a http.Header that can be modified by the caller to add
  2415  // headers to the request.
  2416  func (c *ProjectsLocationsReservationsDeleteCall) Header() http.Header {
  2417  	if c.header_ == nil {
  2418  		c.header_ = make(http.Header)
  2419  	}
  2420  	return c.header_
  2421  }
  2422  
  2423  func (c *ProjectsLocationsReservationsDeleteCall) doRequest(alt string) (*http.Response, error) {
  2424  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
  2425  	var body io.Reader = nil
  2426  	c.urlParams_.Set("alt", alt)
  2427  	c.urlParams_.Set("prettyPrint", "false")
  2428  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  2429  	urls += "?" + c.urlParams_.Encode()
  2430  	req, err := http.NewRequest("DELETE", urls, body)
  2431  	if err != nil {
  2432  		return nil, err
  2433  	}
  2434  	req.Header = reqHeaders
  2435  	googleapi.Expand(req.URL, map[string]string{
  2436  		"name": c.name,
  2437  	})
  2438  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2439  }
  2440  
  2441  // Do executes the "bigqueryreservation.projects.locations.reservations.delete" call.
  2442  // Any non-2xx status code is an error. Response headers are in either
  2443  // *Empty.ServerResponse.Header or (if a response was returned at all) in
  2444  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  2445  // whether the returned error was because http.StatusNotModified was returned.
  2446  func (c *ProjectsLocationsReservationsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  2447  	gensupport.SetOptions(c.urlParams_, opts...)
  2448  	res, err := c.doRequest("json")
  2449  	if res != nil && res.StatusCode == http.StatusNotModified {
  2450  		if res.Body != nil {
  2451  			res.Body.Close()
  2452  		}
  2453  		return nil, gensupport.WrapError(&googleapi.Error{
  2454  			Code:   res.StatusCode,
  2455  			Header: res.Header,
  2456  		})
  2457  	}
  2458  	if err != nil {
  2459  		return nil, err
  2460  	}
  2461  	defer googleapi.CloseBody(res)
  2462  	if err := googleapi.CheckResponse(res); err != nil {
  2463  		return nil, gensupport.WrapError(err)
  2464  	}
  2465  	ret := &Empty{
  2466  		ServerResponse: googleapi.ServerResponse{
  2467  			Header:         res.Header,
  2468  			HTTPStatusCode: res.StatusCode,
  2469  		},
  2470  	}
  2471  	target := &ret
  2472  	if err := gensupport.DecodeResponse(target, res); err != nil {
  2473  		return nil, err
  2474  	}
  2475  	return ret, nil
  2476  }
  2477  
  2478  type ProjectsLocationsReservationsFailoverReservationCall struct {
  2479  	s                          *Service
  2480  	name                       string
  2481  	failoverreservationrequest *FailoverReservationRequest
  2482  	urlParams_                 gensupport.URLParams
  2483  	ctx_                       context.Context
  2484  	header_                    http.Header
  2485  }
  2486  
  2487  // FailoverReservation: Failover a reservation to the secondary location. The
  2488  // operation should be done in the current secondary location, which will be
  2489  // promoted to the new primary location for the reservation. Attempting to
  2490  // failover a reservation in the current primary location will fail with the
  2491  // error code `google.rpc.Code.FAILED_PRECONDITION`.
  2492  //
  2493  //   - name: Resource name of the reservation to failover. E.g.,
  2494  //     `projects/myproject/locations/US/reservations/team1-prod`.
  2495  func (r *ProjectsLocationsReservationsService) FailoverReservation(name string, failoverreservationrequest *FailoverReservationRequest) *ProjectsLocationsReservationsFailoverReservationCall {
  2496  	c := &ProjectsLocationsReservationsFailoverReservationCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2497  	c.name = name
  2498  	c.failoverreservationrequest = failoverreservationrequest
  2499  	return c
  2500  }
  2501  
  2502  // Fields allows partial responses to be retrieved. See
  2503  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  2504  // details.
  2505  func (c *ProjectsLocationsReservationsFailoverReservationCall) Fields(s ...googleapi.Field) *ProjectsLocationsReservationsFailoverReservationCall {
  2506  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2507  	return c
  2508  }
  2509  
  2510  // Context sets the context to be used in this call's Do method.
  2511  func (c *ProjectsLocationsReservationsFailoverReservationCall) Context(ctx context.Context) *ProjectsLocationsReservationsFailoverReservationCall {
  2512  	c.ctx_ = ctx
  2513  	return c
  2514  }
  2515  
  2516  // Header returns a http.Header that can be modified by the caller to add
  2517  // headers to the request.
  2518  func (c *ProjectsLocationsReservationsFailoverReservationCall) Header() http.Header {
  2519  	if c.header_ == nil {
  2520  		c.header_ = make(http.Header)
  2521  	}
  2522  	return c.header_
  2523  }
  2524  
  2525  func (c *ProjectsLocationsReservationsFailoverReservationCall) doRequest(alt string) (*http.Response, error) {
  2526  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
  2527  	var body io.Reader = nil
  2528  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.failoverreservationrequest)
  2529  	if err != nil {
  2530  		return nil, err
  2531  	}
  2532  	c.urlParams_.Set("alt", alt)
  2533  	c.urlParams_.Set("prettyPrint", "false")
  2534  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}:failoverReservation")
  2535  	urls += "?" + c.urlParams_.Encode()
  2536  	req, err := http.NewRequest("POST", urls, body)
  2537  	if err != nil {
  2538  		return nil, err
  2539  	}
  2540  	req.Header = reqHeaders
  2541  	googleapi.Expand(req.URL, map[string]string{
  2542  		"name": c.name,
  2543  	})
  2544  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2545  }
  2546  
  2547  // Do executes the "bigqueryreservation.projects.locations.reservations.failoverReservation" call.
  2548  // Any non-2xx status code is an error. Response headers are in either
  2549  // *Reservation.ServerResponse.Header or (if a response was returned at all) in
  2550  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  2551  // whether the returned error was because http.StatusNotModified was returned.
  2552  func (c *ProjectsLocationsReservationsFailoverReservationCall) Do(opts ...googleapi.CallOption) (*Reservation, error) {
  2553  	gensupport.SetOptions(c.urlParams_, opts...)
  2554  	res, err := c.doRequest("json")
  2555  	if res != nil && res.StatusCode == http.StatusNotModified {
  2556  		if res.Body != nil {
  2557  			res.Body.Close()
  2558  		}
  2559  		return nil, gensupport.WrapError(&googleapi.Error{
  2560  			Code:   res.StatusCode,
  2561  			Header: res.Header,
  2562  		})
  2563  	}
  2564  	if err != nil {
  2565  		return nil, err
  2566  	}
  2567  	defer googleapi.CloseBody(res)
  2568  	if err := googleapi.CheckResponse(res); err != nil {
  2569  		return nil, gensupport.WrapError(err)
  2570  	}
  2571  	ret := &Reservation{
  2572  		ServerResponse: googleapi.ServerResponse{
  2573  			Header:         res.Header,
  2574  			HTTPStatusCode: res.StatusCode,
  2575  		},
  2576  	}
  2577  	target := &ret
  2578  	if err := gensupport.DecodeResponse(target, res); err != nil {
  2579  		return nil, err
  2580  	}
  2581  	return ret, nil
  2582  }
  2583  
  2584  type ProjectsLocationsReservationsGetCall struct {
  2585  	s            *Service
  2586  	name         string
  2587  	urlParams_   gensupport.URLParams
  2588  	ifNoneMatch_ string
  2589  	ctx_         context.Context
  2590  	header_      http.Header
  2591  }
  2592  
  2593  // Get: Returns information about the reservation.
  2594  //
  2595  //   - name: Resource name of the reservation to retrieve. E.g.,
  2596  //     `projects/myproject/locations/US/reservations/team1-prod`.
  2597  func (r *ProjectsLocationsReservationsService) Get(name string) *ProjectsLocationsReservationsGetCall {
  2598  	c := &ProjectsLocationsReservationsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2599  	c.name = name
  2600  	return c
  2601  }
  2602  
  2603  // Fields allows partial responses to be retrieved. See
  2604  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  2605  // details.
  2606  func (c *ProjectsLocationsReservationsGetCall) Fields(s ...googleapi.Field) *ProjectsLocationsReservationsGetCall {
  2607  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2608  	return c
  2609  }
  2610  
  2611  // IfNoneMatch sets an optional parameter which makes the operation fail if the
  2612  // object's ETag matches the given value. This is useful for getting updates
  2613  // only after the object has changed since the last request.
  2614  func (c *ProjectsLocationsReservationsGetCall) IfNoneMatch(entityTag string) *ProjectsLocationsReservationsGetCall {
  2615  	c.ifNoneMatch_ = entityTag
  2616  	return c
  2617  }
  2618  
  2619  // Context sets the context to be used in this call's Do method.
  2620  func (c *ProjectsLocationsReservationsGetCall) Context(ctx context.Context) *ProjectsLocationsReservationsGetCall {
  2621  	c.ctx_ = ctx
  2622  	return c
  2623  }
  2624  
  2625  // Header returns a http.Header that can be modified by the caller to add
  2626  // headers to the request.
  2627  func (c *ProjectsLocationsReservationsGetCall) Header() http.Header {
  2628  	if c.header_ == nil {
  2629  		c.header_ = make(http.Header)
  2630  	}
  2631  	return c.header_
  2632  }
  2633  
  2634  func (c *ProjectsLocationsReservationsGetCall) doRequest(alt string) (*http.Response, error) {
  2635  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
  2636  	if c.ifNoneMatch_ != "" {
  2637  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2638  	}
  2639  	var body io.Reader = nil
  2640  	c.urlParams_.Set("alt", alt)
  2641  	c.urlParams_.Set("prettyPrint", "false")
  2642  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  2643  	urls += "?" + c.urlParams_.Encode()
  2644  	req, err := http.NewRequest("GET", urls, body)
  2645  	if err != nil {
  2646  		return nil, err
  2647  	}
  2648  	req.Header = reqHeaders
  2649  	googleapi.Expand(req.URL, map[string]string{
  2650  		"name": c.name,
  2651  	})
  2652  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2653  }
  2654  
  2655  // Do executes the "bigqueryreservation.projects.locations.reservations.get" call.
  2656  // Any non-2xx status code is an error. Response headers are in either
  2657  // *Reservation.ServerResponse.Header or (if a response was returned at all) in
  2658  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  2659  // whether the returned error was because http.StatusNotModified was returned.
  2660  func (c *ProjectsLocationsReservationsGetCall) Do(opts ...googleapi.CallOption) (*Reservation, error) {
  2661  	gensupport.SetOptions(c.urlParams_, opts...)
  2662  	res, err := c.doRequest("json")
  2663  	if res != nil && res.StatusCode == http.StatusNotModified {
  2664  		if res.Body != nil {
  2665  			res.Body.Close()
  2666  		}
  2667  		return nil, gensupport.WrapError(&googleapi.Error{
  2668  			Code:   res.StatusCode,
  2669  			Header: res.Header,
  2670  		})
  2671  	}
  2672  	if err != nil {
  2673  		return nil, err
  2674  	}
  2675  	defer googleapi.CloseBody(res)
  2676  	if err := googleapi.CheckResponse(res); err != nil {
  2677  		return nil, gensupport.WrapError(err)
  2678  	}
  2679  	ret := &Reservation{
  2680  		ServerResponse: googleapi.ServerResponse{
  2681  			Header:         res.Header,
  2682  			HTTPStatusCode: res.StatusCode,
  2683  		},
  2684  	}
  2685  	target := &ret
  2686  	if err := gensupport.DecodeResponse(target, res); err != nil {
  2687  		return nil, err
  2688  	}
  2689  	return ret, nil
  2690  }
  2691  
  2692  type ProjectsLocationsReservationsListCall struct {
  2693  	s            *Service
  2694  	parent       string
  2695  	urlParams_   gensupport.URLParams
  2696  	ifNoneMatch_ string
  2697  	ctx_         context.Context
  2698  	header_      http.Header
  2699  }
  2700  
  2701  // List: Lists all the reservations for the project in the specified location.
  2702  //
  2703  //   - parent: The parent resource name containing project and location, e.g.:
  2704  //     `projects/myproject/locations/US`.
  2705  func (r *ProjectsLocationsReservationsService) List(parent string) *ProjectsLocationsReservationsListCall {
  2706  	c := &ProjectsLocationsReservationsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2707  	c.parent = parent
  2708  	return c
  2709  }
  2710  
  2711  // PageSize sets the optional parameter "pageSize": The maximum number of items
  2712  // to return per page.
  2713  func (c *ProjectsLocationsReservationsListCall) PageSize(pageSize int64) *ProjectsLocationsReservationsListCall {
  2714  	c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  2715  	return c
  2716  }
  2717  
  2718  // PageToken sets the optional parameter "pageToken": The next_page_token value
  2719  // returned from a previous List request, if any.
  2720  func (c *ProjectsLocationsReservationsListCall) PageToken(pageToken string) *ProjectsLocationsReservationsListCall {
  2721  	c.urlParams_.Set("pageToken", pageToken)
  2722  	return c
  2723  }
  2724  
  2725  // Fields allows partial responses to be retrieved. See
  2726  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  2727  // details.
  2728  func (c *ProjectsLocationsReservationsListCall) Fields(s ...googleapi.Field) *ProjectsLocationsReservationsListCall {
  2729  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2730  	return c
  2731  }
  2732  
  2733  // IfNoneMatch sets an optional parameter which makes the operation fail if the
  2734  // object's ETag matches the given value. This is useful for getting updates
  2735  // only after the object has changed since the last request.
  2736  func (c *ProjectsLocationsReservationsListCall) IfNoneMatch(entityTag string) *ProjectsLocationsReservationsListCall {
  2737  	c.ifNoneMatch_ = entityTag
  2738  	return c
  2739  }
  2740  
  2741  // Context sets the context to be used in this call's Do method.
  2742  func (c *ProjectsLocationsReservationsListCall) Context(ctx context.Context) *ProjectsLocationsReservationsListCall {
  2743  	c.ctx_ = ctx
  2744  	return c
  2745  }
  2746  
  2747  // Header returns a http.Header that can be modified by the caller to add
  2748  // headers to the request.
  2749  func (c *ProjectsLocationsReservationsListCall) Header() http.Header {
  2750  	if c.header_ == nil {
  2751  		c.header_ = make(http.Header)
  2752  	}
  2753  	return c.header_
  2754  }
  2755  
  2756  func (c *ProjectsLocationsReservationsListCall) doRequest(alt string) (*http.Response, error) {
  2757  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
  2758  	if c.ifNoneMatch_ != "" {
  2759  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2760  	}
  2761  	var body io.Reader = nil
  2762  	c.urlParams_.Set("alt", alt)
  2763  	c.urlParams_.Set("prettyPrint", "false")
  2764  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/reservations")
  2765  	urls += "?" + c.urlParams_.Encode()
  2766  	req, err := http.NewRequest("GET", urls, body)
  2767  	if err != nil {
  2768  		return nil, err
  2769  	}
  2770  	req.Header = reqHeaders
  2771  	googleapi.Expand(req.URL, map[string]string{
  2772  		"parent": c.parent,
  2773  	})
  2774  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2775  }
  2776  
  2777  // Do executes the "bigqueryreservation.projects.locations.reservations.list" call.
  2778  // Any non-2xx status code is an error. Response headers are in either
  2779  // *ListReservationsResponse.ServerResponse.Header or (if a response was
  2780  // returned at all) in error.(*googleapi.Error).Header. Use
  2781  // googleapi.IsNotModified to check whether the returned error was because
  2782  // http.StatusNotModified was returned.
  2783  func (c *ProjectsLocationsReservationsListCall) Do(opts ...googleapi.CallOption) (*ListReservationsResponse, error) {
  2784  	gensupport.SetOptions(c.urlParams_, opts...)
  2785  	res, err := c.doRequest("json")
  2786  	if res != nil && res.StatusCode == http.StatusNotModified {
  2787  		if res.Body != nil {
  2788  			res.Body.Close()
  2789  		}
  2790  		return nil, gensupport.WrapError(&googleapi.Error{
  2791  			Code:   res.StatusCode,
  2792  			Header: res.Header,
  2793  		})
  2794  	}
  2795  	if err != nil {
  2796  		return nil, err
  2797  	}
  2798  	defer googleapi.CloseBody(res)
  2799  	if err := googleapi.CheckResponse(res); err != nil {
  2800  		return nil, gensupport.WrapError(err)
  2801  	}
  2802  	ret := &ListReservationsResponse{
  2803  		ServerResponse: googleapi.ServerResponse{
  2804  			Header:         res.Header,
  2805  			HTTPStatusCode: res.StatusCode,
  2806  		},
  2807  	}
  2808  	target := &ret
  2809  	if err := gensupport.DecodeResponse(target, res); err != nil {
  2810  		return nil, err
  2811  	}
  2812  	return ret, nil
  2813  }
  2814  
  2815  // Pages invokes f for each page of results.
  2816  // A non-nil error returned from f will halt the iteration.
  2817  // The provided context supersedes any context provided to the Context method.
  2818  func (c *ProjectsLocationsReservationsListCall) Pages(ctx context.Context, f func(*ListReservationsResponse) error) error {
  2819  	c.ctx_ = ctx
  2820  	defer c.PageToken(c.urlParams_.Get("pageToken"))
  2821  	for {
  2822  		x, err := c.Do()
  2823  		if err != nil {
  2824  			return err
  2825  		}
  2826  		if err := f(x); err != nil {
  2827  			return err
  2828  		}
  2829  		if x.NextPageToken == "" {
  2830  			return nil
  2831  		}
  2832  		c.PageToken(x.NextPageToken)
  2833  	}
  2834  }
  2835  
  2836  type ProjectsLocationsReservationsPatchCall struct {
  2837  	s           *Service
  2838  	name        string
  2839  	reservation *Reservation
  2840  	urlParams_  gensupport.URLParams
  2841  	ctx_        context.Context
  2842  	header_     http.Header
  2843  }
  2844  
  2845  // Patch: Updates an existing reservation resource.
  2846  //
  2847  //   - name: The resource name of the reservation, e.g.,
  2848  //     `projects/*/locations/*/reservations/team1-prod`. The reservation_id must
  2849  //     only contain lower case alphanumeric characters or dashes. It must start
  2850  //     with a letter and must not end with a dash. Its maximum length is 64
  2851  //     characters.
  2852  func (r *ProjectsLocationsReservationsService) Patch(name string, reservation *Reservation) *ProjectsLocationsReservationsPatchCall {
  2853  	c := &ProjectsLocationsReservationsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2854  	c.name = name
  2855  	c.reservation = reservation
  2856  	return c
  2857  }
  2858  
  2859  // UpdateMask sets the optional parameter "updateMask": Standard field mask for
  2860  // the set of fields to be updated.
  2861  func (c *ProjectsLocationsReservationsPatchCall) UpdateMask(updateMask string) *ProjectsLocationsReservationsPatchCall {
  2862  	c.urlParams_.Set("updateMask", updateMask)
  2863  	return c
  2864  }
  2865  
  2866  // Fields allows partial responses to be retrieved. See
  2867  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  2868  // details.
  2869  func (c *ProjectsLocationsReservationsPatchCall) Fields(s ...googleapi.Field) *ProjectsLocationsReservationsPatchCall {
  2870  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2871  	return c
  2872  }
  2873  
  2874  // Context sets the context to be used in this call's Do method.
  2875  func (c *ProjectsLocationsReservationsPatchCall) Context(ctx context.Context) *ProjectsLocationsReservationsPatchCall {
  2876  	c.ctx_ = ctx
  2877  	return c
  2878  }
  2879  
  2880  // Header returns a http.Header that can be modified by the caller to add
  2881  // headers to the request.
  2882  func (c *ProjectsLocationsReservationsPatchCall) Header() http.Header {
  2883  	if c.header_ == nil {
  2884  		c.header_ = make(http.Header)
  2885  	}
  2886  	return c.header_
  2887  }
  2888  
  2889  func (c *ProjectsLocationsReservationsPatchCall) doRequest(alt string) (*http.Response, error) {
  2890  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
  2891  	var body io.Reader = nil
  2892  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.reservation)
  2893  	if err != nil {
  2894  		return nil, err
  2895  	}
  2896  	c.urlParams_.Set("alt", alt)
  2897  	c.urlParams_.Set("prettyPrint", "false")
  2898  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  2899  	urls += "?" + c.urlParams_.Encode()
  2900  	req, err := http.NewRequest("PATCH", urls, body)
  2901  	if err != nil {
  2902  		return nil, err
  2903  	}
  2904  	req.Header = reqHeaders
  2905  	googleapi.Expand(req.URL, map[string]string{
  2906  		"name": c.name,
  2907  	})
  2908  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2909  }
  2910  
  2911  // Do executes the "bigqueryreservation.projects.locations.reservations.patch" call.
  2912  // Any non-2xx status code is an error. Response headers are in either
  2913  // *Reservation.ServerResponse.Header or (if a response was returned at all) in
  2914  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  2915  // whether the returned error was because http.StatusNotModified was returned.
  2916  func (c *ProjectsLocationsReservationsPatchCall) Do(opts ...googleapi.CallOption) (*Reservation, error) {
  2917  	gensupport.SetOptions(c.urlParams_, opts...)
  2918  	res, err := c.doRequest("json")
  2919  	if res != nil && res.StatusCode == http.StatusNotModified {
  2920  		if res.Body != nil {
  2921  			res.Body.Close()
  2922  		}
  2923  		return nil, gensupport.WrapError(&googleapi.Error{
  2924  			Code:   res.StatusCode,
  2925  			Header: res.Header,
  2926  		})
  2927  	}
  2928  	if err != nil {
  2929  		return nil, err
  2930  	}
  2931  	defer googleapi.CloseBody(res)
  2932  	if err := googleapi.CheckResponse(res); err != nil {
  2933  		return nil, gensupport.WrapError(err)
  2934  	}
  2935  	ret := &Reservation{
  2936  		ServerResponse: googleapi.ServerResponse{
  2937  			Header:         res.Header,
  2938  			HTTPStatusCode: res.StatusCode,
  2939  		},
  2940  	}
  2941  	target := &ret
  2942  	if err := gensupport.DecodeResponse(target, res); err != nil {
  2943  		return nil, err
  2944  	}
  2945  	return ret, nil
  2946  }
  2947  
  2948  type ProjectsLocationsReservationsAssignmentsCreateCall struct {
  2949  	s          *Service
  2950  	parent     string
  2951  	assignment *Assignment
  2952  	urlParams_ gensupport.URLParams
  2953  	ctx_       context.Context
  2954  	header_    http.Header
  2955  }
  2956  
  2957  // Create: Creates an assignment object which allows the given project to
  2958  // submit jobs of a certain type using slots from the specified reservation.
  2959  // Currently a resource (project, folder, organization) can only have one
  2960  // assignment per each (job_type, location) combination, and that reservation
  2961  // will be used for all jobs of the matching type. Different assignments can be
  2962  // created on different levels of the projects, folders or organization
  2963  // hierarchy. During query execution, the assignment is looked up at the
  2964  // project, folder and organization levels in that order. The first assignment
  2965  // found is applied to the query. When creating assignments, it does not matter
  2966  // if other assignments exist at higher levels. Example: * The organization
  2967  // `organizationA` contains two projects, `project1` and `project2`. *
  2968  // Assignments for all three entities (`organizationA`, `project1`, and
  2969  // `project2`) could all be created and mapped to the same or different
  2970  // reservations. "None" assignments represent an absence of the assignment.
  2971  // Projects assigned to None use on-demand pricing. To create a "None"
  2972  // assignment, use "none" as a reservation_id in the parent. Example parent:
  2973  // `projects/myproject/locations/US/reservations/none`. Returns
  2974  // `google.rpc.Code.PERMISSION_DENIED` if user does not have 'bigquery.admin'
  2975  // permissions on the project using the reservation and the project that owns
  2976  // this reservation. Returns `google.rpc.Code.INVALID_ARGUMENT` when location
  2977  // of the assignment does not match location of the reservation.
  2978  //
  2979  //   - parent: The parent resource name of the assignment E.g.
  2980  //     `projects/myproject/locations/US/reservations/team1-prod`.
  2981  func (r *ProjectsLocationsReservationsAssignmentsService) Create(parent string, assignment *Assignment) *ProjectsLocationsReservationsAssignmentsCreateCall {
  2982  	c := &ProjectsLocationsReservationsAssignmentsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2983  	c.parent = parent
  2984  	c.assignment = assignment
  2985  	return c
  2986  }
  2987  
  2988  // AssignmentId sets the optional parameter "assignmentId": The optional
  2989  // assignment ID. Assignment name will be generated automatically if this field
  2990  // is empty. This field must only contain lower case alphanumeric characters or
  2991  // dashes. Max length is 64 characters.
  2992  func (c *ProjectsLocationsReservationsAssignmentsCreateCall) AssignmentId(assignmentId string) *ProjectsLocationsReservationsAssignmentsCreateCall {
  2993  	c.urlParams_.Set("assignmentId", assignmentId)
  2994  	return c
  2995  }
  2996  
  2997  // Fields allows partial responses to be retrieved. See
  2998  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  2999  // details.
  3000  func (c *ProjectsLocationsReservationsAssignmentsCreateCall) Fields(s ...googleapi.Field) *ProjectsLocationsReservationsAssignmentsCreateCall {
  3001  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3002  	return c
  3003  }
  3004  
  3005  // Context sets the context to be used in this call's Do method.
  3006  func (c *ProjectsLocationsReservationsAssignmentsCreateCall) Context(ctx context.Context) *ProjectsLocationsReservationsAssignmentsCreateCall {
  3007  	c.ctx_ = ctx
  3008  	return c
  3009  }
  3010  
  3011  // Header returns a http.Header that can be modified by the caller to add
  3012  // headers to the request.
  3013  func (c *ProjectsLocationsReservationsAssignmentsCreateCall) Header() http.Header {
  3014  	if c.header_ == nil {
  3015  		c.header_ = make(http.Header)
  3016  	}
  3017  	return c.header_
  3018  }
  3019  
  3020  func (c *ProjectsLocationsReservationsAssignmentsCreateCall) doRequest(alt string) (*http.Response, error) {
  3021  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
  3022  	var body io.Reader = nil
  3023  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.assignment)
  3024  	if err != nil {
  3025  		return nil, err
  3026  	}
  3027  	c.urlParams_.Set("alt", alt)
  3028  	c.urlParams_.Set("prettyPrint", "false")
  3029  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/assignments")
  3030  	urls += "?" + c.urlParams_.Encode()
  3031  	req, err := http.NewRequest("POST", urls, body)
  3032  	if err != nil {
  3033  		return nil, err
  3034  	}
  3035  	req.Header = reqHeaders
  3036  	googleapi.Expand(req.URL, map[string]string{
  3037  		"parent": c.parent,
  3038  	})
  3039  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3040  }
  3041  
  3042  // Do executes the "bigqueryreservation.projects.locations.reservations.assignments.create" call.
  3043  // Any non-2xx status code is an error. Response headers are in either
  3044  // *Assignment.ServerResponse.Header or (if a response was returned at all) in
  3045  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  3046  // whether the returned error was because http.StatusNotModified was returned.
  3047  func (c *ProjectsLocationsReservationsAssignmentsCreateCall) Do(opts ...googleapi.CallOption) (*Assignment, error) {
  3048  	gensupport.SetOptions(c.urlParams_, opts...)
  3049  	res, err := c.doRequest("json")
  3050  	if res != nil && res.StatusCode == http.StatusNotModified {
  3051  		if res.Body != nil {
  3052  			res.Body.Close()
  3053  		}
  3054  		return nil, gensupport.WrapError(&googleapi.Error{
  3055  			Code:   res.StatusCode,
  3056  			Header: res.Header,
  3057  		})
  3058  	}
  3059  	if err != nil {
  3060  		return nil, err
  3061  	}
  3062  	defer googleapi.CloseBody(res)
  3063  	if err := googleapi.CheckResponse(res); err != nil {
  3064  		return nil, gensupport.WrapError(err)
  3065  	}
  3066  	ret := &Assignment{
  3067  		ServerResponse: googleapi.ServerResponse{
  3068  			Header:         res.Header,
  3069  			HTTPStatusCode: res.StatusCode,
  3070  		},
  3071  	}
  3072  	target := &ret
  3073  	if err := gensupport.DecodeResponse(target, res); err != nil {
  3074  		return nil, err
  3075  	}
  3076  	return ret, nil
  3077  }
  3078  
  3079  type ProjectsLocationsReservationsAssignmentsDeleteCall struct {
  3080  	s          *Service
  3081  	name       string
  3082  	urlParams_ gensupport.URLParams
  3083  	ctx_       context.Context
  3084  	header_    http.Header
  3085  }
  3086  
  3087  // Delete: Deletes a assignment. No expansion will happen. Example: *
  3088  // Organization `organizationA` contains two projects, `project1` and
  3089  // `project2`. * Reservation `res1` exists and was created previously. *
  3090  // CreateAssignment was used previously to define the following associations
  3091  // between entities and reservations: “ and “ In this example, deletion of
  3092  // the “ assignment won't affect the other assignment “. After said deletion,
  3093  // queries from `project1` will still use `res1` while queries from `project2`
  3094  // will switch to use on-demand mode.
  3095  //
  3096  //   - name: Name of the resource, e.g.
  3097  //     `projects/myproject/locations/US/reservations/team1-prod/assignments/123`.
  3098  func (r *ProjectsLocationsReservationsAssignmentsService) Delete(name string) *ProjectsLocationsReservationsAssignmentsDeleteCall {
  3099  	c := &ProjectsLocationsReservationsAssignmentsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3100  	c.name = name
  3101  	return c
  3102  }
  3103  
  3104  // Fields allows partial responses to be retrieved. See
  3105  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  3106  // details.
  3107  func (c *ProjectsLocationsReservationsAssignmentsDeleteCall) Fields(s ...googleapi.Field) *ProjectsLocationsReservationsAssignmentsDeleteCall {
  3108  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3109  	return c
  3110  }
  3111  
  3112  // Context sets the context to be used in this call's Do method.
  3113  func (c *ProjectsLocationsReservationsAssignmentsDeleteCall) Context(ctx context.Context) *ProjectsLocationsReservationsAssignmentsDeleteCall {
  3114  	c.ctx_ = ctx
  3115  	return c
  3116  }
  3117  
  3118  // Header returns a http.Header that can be modified by the caller to add
  3119  // headers to the request.
  3120  func (c *ProjectsLocationsReservationsAssignmentsDeleteCall) Header() http.Header {
  3121  	if c.header_ == nil {
  3122  		c.header_ = make(http.Header)
  3123  	}
  3124  	return c.header_
  3125  }
  3126  
  3127  func (c *ProjectsLocationsReservationsAssignmentsDeleteCall) doRequest(alt string) (*http.Response, error) {
  3128  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
  3129  	var body io.Reader = nil
  3130  	c.urlParams_.Set("alt", alt)
  3131  	c.urlParams_.Set("prettyPrint", "false")
  3132  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  3133  	urls += "?" + c.urlParams_.Encode()
  3134  	req, err := http.NewRequest("DELETE", urls, body)
  3135  	if err != nil {
  3136  		return nil, err
  3137  	}
  3138  	req.Header = reqHeaders
  3139  	googleapi.Expand(req.URL, map[string]string{
  3140  		"name": c.name,
  3141  	})
  3142  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3143  }
  3144  
  3145  // Do executes the "bigqueryreservation.projects.locations.reservations.assignments.delete" call.
  3146  // Any non-2xx status code is an error. Response headers are in either
  3147  // *Empty.ServerResponse.Header or (if a response was returned at all) in
  3148  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  3149  // whether the returned error was because http.StatusNotModified was returned.
  3150  func (c *ProjectsLocationsReservationsAssignmentsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  3151  	gensupport.SetOptions(c.urlParams_, opts...)
  3152  	res, err := c.doRequest("json")
  3153  	if res != nil && res.StatusCode == http.StatusNotModified {
  3154  		if res.Body != nil {
  3155  			res.Body.Close()
  3156  		}
  3157  		return nil, gensupport.WrapError(&googleapi.Error{
  3158  			Code:   res.StatusCode,
  3159  			Header: res.Header,
  3160  		})
  3161  	}
  3162  	if err != nil {
  3163  		return nil, err
  3164  	}
  3165  	defer googleapi.CloseBody(res)
  3166  	if err := googleapi.CheckResponse(res); err != nil {
  3167  		return nil, gensupport.WrapError(err)
  3168  	}
  3169  	ret := &Empty{
  3170  		ServerResponse: googleapi.ServerResponse{
  3171  			Header:         res.Header,
  3172  			HTTPStatusCode: res.StatusCode,
  3173  		},
  3174  	}
  3175  	target := &ret
  3176  	if err := gensupport.DecodeResponse(target, res); err != nil {
  3177  		return nil, err
  3178  	}
  3179  	return ret, nil
  3180  }
  3181  
  3182  type ProjectsLocationsReservationsAssignmentsListCall struct {
  3183  	s            *Service
  3184  	parent       string
  3185  	urlParams_   gensupport.URLParams
  3186  	ifNoneMatch_ string
  3187  	ctx_         context.Context
  3188  	header_      http.Header
  3189  }
  3190  
  3191  // List: Lists assignments. Only explicitly created assignments will be
  3192  // returned. Example: * Organization `organizationA` contains two projects,
  3193  // `project1` and `project2`. * Reservation `res1` exists and was created
  3194  // previously. * CreateAssignment was used previously to define the following
  3195  // associations between entities and reservations: “ and “ In this example,
  3196  // ListAssignments will just return the above two assignments for reservation
  3197  // `res1`, and no expansion/merge will happen. The wildcard "-" can be used for
  3198  // reservations in the request. In that case all assignments belongs to the
  3199  // specified project and location will be listed. **Note** "-" cannot be used
  3200  // for projects nor locations.
  3201  //
  3202  //   - parent: The parent resource name e.g.:
  3203  //     `projects/myproject/locations/US/reservations/team1-prod` Or:
  3204  //     `projects/myproject/locations/US/reservations/-`.
  3205  func (r *ProjectsLocationsReservationsAssignmentsService) List(parent string) *ProjectsLocationsReservationsAssignmentsListCall {
  3206  	c := &ProjectsLocationsReservationsAssignmentsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3207  	c.parent = parent
  3208  	return c
  3209  }
  3210  
  3211  // PageSize sets the optional parameter "pageSize": The maximum number of items
  3212  // to return per page.
  3213  func (c *ProjectsLocationsReservationsAssignmentsListCall) PageSize(pageSize int64) *ProjectsLocationsReservationsAssignmentsListCall {
  3214  	c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  3215  	return c
  3216  }
  3217  
  3218  // PageToken sets the optional parameter "pageToken": The next_page_token value
  3219  // returned from a previous List request, if any.
  3220  func (c *ProjectsLocationsReservationsAssignmentsListCall) PageToken(pageToken string) *ProjectsLocationsReservationsAssignmentsListCall {
  3221  	c.urlParams_.Set("pageToken", pageToken)
  3222  	return c
  3223  }
  3224  
  3225  // Fields allows partial responses to be retrieved. See
  3226  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  3227  // details.
  3228  func (c *ProjectsLocationsReservationsAssignmentsListCall) Fields(s ...googleapi.Field) *ProjectsLocationsReservationsAssignmentsListCall {
  3229  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3230  	return c
  3231  }
  3232  
  3233  // IfNoneMatch sets an optional parameter which makes the operation fail if the
  3234  // object's ETag matches the given value. This is useful for getting updates
  3235  // only after the object has changed since the last request.
  3236  func (c *ProjectsLocationsReservationsAssignmentsListCall) IfNoneMatch(entityTag string) *ProjectsLocationsReservationsAssignmentsListCall {
  3237  	c.ifNoneMatch_ = entityTag
  3238  	return c
  3239  }
  3240  
  3241  // Context sets the context to be used in this call's Do method.
  3242  func (c *ProjectsLocationsReservationsAssignmentsListCall) Context(ctx context.Context) *ProjectsLocationsReservationsAssignmentsListCall {
  3243  	c.ctx_ = ctx
  3244  	return c
  3245  }
  3246  
  3247  // Header returns a http.Header that can be modified by the caller to add
  3248  // headers to the request.
  3249  func (c *ProjectsLocationsReservationsAssignmentsListCall) Header() http.Header {
  3250  	if c.header_ == nil {
  3251  		c.header_ = make(http.Header)
  3252  	}
  3253  	return c.header_
  3254  }
  3255  
  3256  func (c *ProjectsLocationsReservationsAssignmentsListCall) doRequest(alt string) (*http.Response, error) {
  3257  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
  3258  	if c.ifNoneMatch_ != "" {
  3259  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  3260  	}
  3261  	var body io.Reader = nil
  3262  	c.urlParams_.Set("alt", alt)
  3263  	c.urlParams_.Set("prettyPrint", "false")
  3264  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/assignments")
  3265  	urls += "?" + c.urlParams_.Encode()
  3266  	req, err := http.NewRequest("GET", urls, body)
  3267  	if err != nil {
  3268  		return nil, err
  3269  	}
  3270  	req.Header = reqHeaders
  3271  	googleapi.Expand(req.URL, map[string]string{
  3272  		"parent": c.parent,
  3273  	})
  3274  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3275  }
  3276  
  3277  // Do executes the "bigqueryreservation.projects.locations.reservations.assignments.list" call.
  3278  // Any non-2xx status code is an error. Response headers are in either
  3279  // *ListAssignmentsResponse.ServerResponse.Header or (if a response was
  3280  // returned at all) in error.(*googleapi.Error).Header. Use
  3281  // googleapi.IsNotModified to check whether the returned error was because
  3282  // http.StatusNotModified was returned.
  3283  func (c *ProjectsLocationsReservationsAssignmentsListCall) Do(opts ...googleapi.CallOption) (*ListAssignmentsResponse, error) {
  3284  	gensupport.SetOptions(c.urlParams_, opts...)
  3285  	res, err := c.doRequest("json")
  3286  	if res != nil && res.StatusCode == http.StatusNotModified {
  3287  		if res.Body != nil {
  3288  			res.Body.Close()
  3289  		}
  3290  		return nil, gensupport.WrapError(&googleapi.Error{
  3291  			Code:   res.StatusCode,
  3292  			Header: res.Header,
  3293  		})
  3294  	}
  3295  	if err != nil {
  3296  		return nil, err
  3297  	}
  3298  	defer googleapi.CloseBody(res)
  3299  	if err := googleapi.CheckResponse(res); err != nil {
  3300  		return nil, gensupport.WrapError(err)
  3301  	}
  3302  	ret := &ListAssignmentsResponse{
  3303  		ServerResponse: googleapi.ServerResponse{
  3304  			Header:         res.Header,
  3305  			HTTPStatusCode: res.StatusCode,
  3306  		},
  3307  	}
  3308  	target := &ret
  3309  	if err := gensupport.DecodeResponse(target, res); err != nil {
  3310  		return nil, err
  3311  	}
  3312  	return ret, nil
  3313  }
  3314  
  3315  // Pages invokes f for each page of results.
  3316  // A non-nil error returned from f will halt the iteration.
  3317  // The provided context supersedes any context provided to the Context method.
  3318  func (c *ProjectsLocationsReservationsAssignmentsListCall) Pages(ctx context.Context, f func(*ListAssignmentsResponse) error) error {
  3319  	c.ctx_ = ctx
  3320  	defer c.PageToken(c.urlParams_.Get("pageToken"))
  3321  	for {
  3322  		x, err := c.Do()
  3323  		if err != nil {
  3324  			return err
  3325  		}
  3326  		if err := f(x); err != nil {
  3327  			return err
  3328  		}
  3329  		if x.NextPageToken == "" {
  3330  			return nil
  3331  		}
  3332  		c.PageToken(x.NextPageToken)
  3333  	}
  3334  }
  3335  
  3336  type ProjectsLocationsReservationsAssignmentsMoveCall struct {
  3337  	s                     *Service
  3338  	name                  string
  3339  	moveassignmentrequest *MoveAssignmentRequest
  3340  	urlParams_            gensupport.URLParams
  3341  	ctx_                  context.Context
  3342  	header_               http.Header
  3343  }
  3344  
  3345  // Move: Moves an assignment under a new reservation. This differs from
  3346  // removing an existing assignment and recreating a new one by providing a
  3347  // transactional change that ensures an assignee always has an associated
  3348  // reservation.
  3349  //
  3350  //   - name: The resource name of the assignment, e.g.
  3351  //     `projects/myproject/locations/US/reservations/team1-prod/assignments/123`.
  3352  func (r *ProjectsLocationsReservationsAssignmentsService) Move(name string, moveassignmentrequest *MoveAssignmentRequest) *ProjectsLocationsReservationsAssignmentsMoveCall {
  3353  	c := &ProjectsLocationsReservationsAssignmentsMoveCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3354  	c.name = name
  3355  	c.moveassignmentrequest = moveassignmentrequest
  3356  	return c
  3357  }
  3358  
  3359  // Fields allows partial responses to be retrieved. See
  3360  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  3361  // details.
  3362  func (c *ProjectsLocationsReservationsAssignmentsMoveCall) Fields(s ...googleapi.Field) *ProjectsLocationsReservationsAssignmentsMoveCall {
  3363  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3364  	return c
  3365  }
  3366  
  3367  // Context sets the context to be used in this call's Do method.
  3368  func (c *ProjectsLocationsReservationsAssignmentsMoveCall) Context(ctx context.Context) *ProjectsLocationsReservationsAssignmentsMoveCall {
  3369  	c.ctx_ = ctx
  3370  	return c
  3371  }
  3372  
  3373  // Header returns a http.Header that can be modified by the caller to add
  3374  // headers to the request.
  3375  func (c *ProjectsLocationsReservationsAssignmentsMoveCall) Header() http.Header {
  3376  	if c.header_ == nil {
  3377  		c.header_ = make(http.Header)
  3378  	}
  3379  	return c.header_
  3380  }
  3381  
  3382  func (c *ProjectsLocationsReservationsAssignmentsMoveCall) doRequest(alt string) (*http.Response, error) {
  3383  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
  3384  	var body io.Reader = nil
  3385  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.moveassignmentrequest)
  3386  	if err != nil {
  3387  		return nil, err
  3388  	}
  3389  	c.urlParams_.Set("alt", alt)
  3390  	c.urlParams_.Set("prettyPrint", "false")
  3391  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}:move")
  3392  	urls += "?" + c.urlParams_.Encode()
  3393  	req, err := http.NewRequest("POST", urls, body)
  3394  	if err != nil {
  3395  		return nil, err
  3396  	}
  3397  	req.Header = reqHeaders
  3398  	googleapi.Expand(req.URL, map[string]string{
  3399  		"name": c.name,
  3400  	})
  3401  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3402  }
  3403  
  3404  // Do executes the "bigqueryreservation.projects.locations.reservations.assignments.move" call.
  3405  // Any non-2xx status code is an error. Response headers are in either
  3406  // *Assignment.ServerResponse.Header or (if a response was returned at all) in
  3407  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  3408  // whether the returned error was because http.StatusNotModified was returned.
  3409  func (c *ProjectsLocationsReservationsAssignmentsMoveCall) Do(opts ...googleapi.CallOption) (*Assignment, error) {
  3410  	gensupport.SetOptions(c.urlParams_, opts...)
  3411  	res, err := c.doRequest("json")
  3412  	if res != nil && res.StatusCode == http.StatusNotModified {
  3413  		if res.Body != nil {
  3414  			res.Body.Close()
  3415  		}
  3416  		return nil, gensupport.WrapError(&googleapi.Error{
  3417  			Code:   res.StatusCode,
  3418  			Header: res.Header,
  3419  		})
  3420  	}
  3421  	if err != nil {
  3422  		return nil, err
  3423  	}
  3424  	defer googleapi.CloseBody(res)
  3425  	if err := googleapi.CheckResponse(res); err != nil {
  3426  		return nil, gensupport.WrapError(err)
  3427  	}
  3428  	ret := &Assignment{
  3429  		ServerResponse: googleapi.ServerResponse{
  3430  			Header:         res.Header,
  3431  			HTTPStatusCode: res.StatusCode,
  3432  		},
  3433  	}
  3434  	target := &ret
  3435  	if err := gensupport.DecodeResponse(target, res); err != nil {
  3436  		return nil, err
  3437  	}
  3438  	return ret, nil
  3439  }
  3440  
  3441  type ProjectsLocationsReservationsAssignmentsPatchCall struct {
  3442  	s          *Service
  3443  	name       string
  3444  	assignment *Assignment
  3445  	urlParams_ gensupport.URLParams
  3446  	ctx_       context.Context
  3447  	header_    http.Header
  3448  }
  3449  
  3450  // Patch: Updates an existing assignment. Only the `priority` field can be
  3451  // updated.
  3452  //
  3453  //   - name: Output only. Name of the resource. E.g.:
  3454  //     `projects/myproject/locations/US/reservations/team1-prod/assignments/123`.
  3455  //     The assignment_id must only contain lower case alphanumeric characters or
  3456  //     dashes and the max length is 64 characters.
  3457  func (r *ProjectsLocationsReservationsAssignmentsService) Patch(name string, assignment *Assignment) *ProjectsLocationsReservationsAssignmentsPatchCall {
  3458  	c := &ProjectsLocationsReservationsAssignmentsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3459  	c.name = name
  3460  	c.assignment = assignment
  3461  	return c
  3462  }
  3463  
  3464  // UpdateMask sets the optional parameter "updateMask": Standard field mask for
  3465  // the set of fields to be updated.
  3466  func (c *ProjectsLocationsReservationsAssignmentsPatchCall) UpdateMask(updateMask string) *ProjectsLocationsReservationsAssignmentsPatchCall {
  3467  	c.urlParams_.Set("updateMask", updateMask)
  3468  	return c
  3469  }
  3470  
  3471  // Fields allows partial responses to be retrieved. See
  3472  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  3473  // details.
  3474  func (c *ProjectsLocationsReservationsAssignmentsPatchCall) Fields(s ...googleapi.Field) *ProjectsLocationsReservationsAssignmentsPatchCall {
  3475  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3476  	return c
  3477  }
  3478  
  3479  // Context sets the context to be used in this call's Do method.
  3480  func (c *ProjectsLocationsReservationsAssignmentsPatchCall) Context(ctx context.Context) *ProjectsLocationsReservationsAssignmentsPatchCall {
  3481  	c.ctx_ = ctx
  3482  	return c
  3483  }
  3484  
  3485  // Header returns a http.Header that can be modified by the caller to add
  3486  // headers to the request.
  3487  func (c *ProjectsLocationsReservationsAssignmentsPatchCall) Header() http.Header {
  3488  	if c.header_ == nil {
  3489  		c.header_ = make(http.Header)
  3490  	}
  3491  	return c.header_
  3492  }
  3493  
  3494  func (c *ProjectsLocationsReservationsAssignmentsPatchCall) doRequest(alt string) (*http.Response, error) {
  3495  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
  3496  	var body io.Reader = nil
  3497  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.assignment)
  3498  	if err != nil {
  3499  		return nil, err
  3500  	}
  3501  	c.urlParams_.Set("alt", alt)
  3502  	c.urlParams_.Set("prettyPrint", "false")
  3503  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  3504  	urls += "?" + c.urlParams_.Encode()
  3505  	req, err := http.NewRequest("PATCH", urls, body)
  3506  	if err != nil {
  3507  		return nil, err
  3508  	}
  3509  	req.Header = reqHeaders
  3510  	googleapi.Expand(req.URL, map[string]string{
  3511  		"name": c.name,
  3512  	})
  3513  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3514  }
  3515  
  3516  // Do executes the "bigqueryreservation.projects.locations.reservations.assignments.patch" call.
  3517  // Any non-2xx status code is an error. Response headers are in either
  3518  // *Assignment.ServerResponse.Header or (if a response was returned at all) in
  3519  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  3520  // whether the returned error was because http.StatusNotModified was returned.
  3521  func (c *ProjectsLocationsReservationsAssignmentsPatchCall) Do(opts ...googleapi.CallOption) (*Assignment, error) {
  3522  	gensupport.SetOptions(c.urlParams_, opts...)
  3523  	res, err := c.doRequest("json")
  3524  	if res != nil && res.StatusCode == http.StatusNotModified {
  3525  		if res.Body != nil {
  3526  			res.Body.Close()
  3527  		}
  3528  		return nil, gensupport.WrapError(&googleapi.Error{
  3529  			Code:   res.StatusCode,
  3530  			Header: res.Header,
  3531  		})
  3532  	}
  3533  	if err != nil {
  3534  		return nil, err
  3535  	}
  3536  	defer googleapi.CloseBody(res)
  3537  	if err := googleapi.CheckResponse(res); err != nil {
  3538  		return nil, gensupport.WrapError(err)
  3539  	}
  3540  	ret := &Assignment{
  3541  		ServerResponse: googleapi.ServerResponse{
  3542  			Header:         res.Header,
  3543  			HTTPStatusCode: res.StatusCode,
  3544  		},
  3545  	}
  3546  	target := &ret
  3547  	if err := gensupport.DecodeResponse(target, res); err != nil {
  3548  		return nil, err
  3549  	}
  3550  	return ret, nil
  3551  }
  3552  

View as plain text