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