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