1 // Copyright 2020 Google LLC. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 // Code generated file. DO NOT EDIT. 6 7 // Package replicapoolupdater provides access to the Google Compute Engine Instance Group Updater API. 8 // 9 // For product documentation, see: https://cloud.google.com/compute/docs/instance-groups/manager/#applying_rolling_updates_using_the_updater_service 10 // 11 // # Creating a client 12 // 13 // Usage example: 14 // 15 // import "google.golang.org/api/replicapoolupdater/v1beta1" 16 // ... 17 // ctx := context.Background() 18 // replicapoolupdaterService, err := replicapoolupdater.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 // replicapoolupdaterService, err := replicapoolupdater.NewService(ctx, option.WithScopes(replicapoolupdater.ReplicapoolReadonlyScope)) 29 // 30 // To use an API key for authentication (note: some APIs do not support API keys), use option.WithAPIKey: 31 // 32 // replicapoolupdaterService, err := replicapoolupdater.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 // replicapoolupdaterService, err := replicapoolupdater.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 replicapoolupdater // import "google.golang.org/api/replicapoolupdater/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 gensupport "google.golang.org/api/internal/gensupport" 58 option "google.golang.org/api/option" 59 htransport "google.golang.org/api/transport/http" 60 ) 61 62 // Always reference these packages, just in case the auto-generated code 63 // below doesn't. 64 var _ = bytes.NewBuffer 65 var _ = strconv.Itoa 66 var _ = fmt.Sprintf 67 var _ = json.NewDecoder 68 var _ = io.Copy 69 var _ = url.Parse 70 var _ = gensupport.MarshalJSON 71 var _ = googleapi.Version 72 var _ = errors.New 73 var _ = strings.Replace 74 var _ = context.Canceled 75 76 const apiId = "replicapoolupdater:v1beta1" 77 const apiName = "replicapoolupdater" 78 const apiVersion = "v1beta1" 79 const basePath = "https://www.googleapis.com/replicapoolupdater/v1beta1/projects/" 80 81 // OAuth2 scopes used by this API. 82 const ( 83 // View and manage your data across Google Cloud Platform services 84 CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platform" 85 86 // View your data across Google Cloud Platform services 87 CloudPlatformReadOnlyScope = "https://www.googleapis.com/auth/cloud-platform.read-only" 88 89 // View and manage replica pools 90 ReplicapoolScope = "https://www.googleapis.com/auth/replicapool" 91 92 // View replica pools 93 ReplicapoolReadonlyScope = "https://www.googleapis.com/auth/replicapool.readonly" 94 ) 95 96 // NewService creates a new Service. 97 func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) { 98 scopesOption := option.WithScopes( 99 "https://www.googleapis.com/auth/cloud-platform", 100 "https://www.googleapis.com/auth/cloud-platform.read-only", 101 "https://www.googleapis.com/auth/replicapool", 102 "https://www.googleapis.com/auth/replicapool.readonly", 103 ) 104 // NOTE: prepend, so we don't override user-specified scopes. 105 opts = append([]option.ClientOption{scopesOption}, opts...) 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.RollingUpdates = NewRollingUpdatesService(s) 131 s.ZoneOperations = NewZoneOperationsService(s) 132 return s, nil 133 } 134 135 type Service struct { 136 client *http.Client 137 BasePath string // API endpoint base URL 138 UserAgent string // optional additional User-Agent fragment 139 140 RollingUpdates *RollingUpdatesService 141 142 ZoneOperations *ZoneOperationsService 143 } 144 145 func (s *Service) userAgent() string { 146 if s.UserAgent == "" { 147 return googleapi.UserAgent 148 } 149 return googleapi.UserAgent + " " + s.UserAgent 150 } 151 152 func NewRollingUpdatesService(s *Service) *RollingUpdatesService { 153 rs := &RollingUpdatesService{s: s} 154 return rs 155 } 156 157 type RollingUpdatesService struct { 158 s *Service 159 } 160 161 func NewZoneOperationsService(s *Service) *ZoneOperationsService { 162 rs := &ZoneOperationsService{s: s} 163 return rs 164 } 165 166 type ZoneOperationsService struct { 167 s *Service 168 } 169 170 // InstanceUpdate: Update of a single instance. 171 type InstanceUpdate struct { 172 // Error: Errors that occurred during the instance update. 173 Error *InstanceUpdateError `json:"error,omitempty"` 174 175 // Instance: Fully-qualified URL of the instance being updated. 176 Instance string `json:"instance,omitempty"` 177 178 // Status: Status of the instance update. Possible values are: 179 // - "PENDING": The instance update is pending execution. 180 // - "ROLLING_FORWARD": The instance update is going forward. 181 // - "ROLLING_BACK": The instance update is being rolled back. 182 // - "PAUSED": The instance update is temporarily paused (inactive). 183 // - "ROLLED_OUT": The instance update is finished, the instance is 184 // running the new template. 185 // - "ROLLED_BACK": The instance update is finished, the instance has 186 // been reverted to the previous template. 187 // - "CANCELLED": The instance update is paused and no longer can be 188 // resumed, undefined in which template the instance is running. 189 Status string `json:"status,omitempty"` 190 191 // ForceSendFields is a list of field names (e.g. "Error") to 192 // unconditionally include in API requests. By default, fields with 193 // empty values are omitted from API requests. However, any non-pointer, 194 // non-interface field appearing in ForceSendFields will be sent to the 195 // server regardless of whether the field is empty or not. This may be 196 // used to include empty fields in Patch requests. 197 ForceSendFields []string `json:"-"` 198 199 // NullFields is a list of field names (e.g. "Error") to include in API 200 // requests with the JSON null value. By default, fields with empty 201 // values are omitted from API requests. However, any field with an 202 // empty value appearing in NullFields will be sent to the server as 203 // null. It is an error if a field in this list has a non-empty value. 204 // This may be used to include null fields in Patch requests. 205 NullFields []string `json:"-"` 206 } 207 208 func (s *InstanceUpdate) MarshalJSON() ([]byte, error) { 209 type NoMethod InstanceUpdate 210 raw := NoMethod(*s) 211 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 212 } 213 214 // InstanceUpdateError: Errors that occurred during the instance update. 215 type InstanceUpdateError struct { 216 // Errors: [Output Only] The array of errors encountered while 217 // processing this operation. 218 Errors []*InstanceUpdateErrorErrors `json:"errors,omitempty"` 219 220 // ForceSendFields is a list of field names (e.g. "Errors") to 221 // unconditionally include in API requests. By default, fields with 222 // empty values are omitted from API requests. However, any non-pointer, 223 // non-interface field appearing in ForceSendFields will be sent to the 224 // server regardless of whether the field is empty or not. This may be 225 // used to include empty fields in Patch requests. 226 ForceSendFields []string `json:"-"` 227 228 // NullFields is a list of field names (e.g. "Errors") to include in API 229 // requests with the JSON null value. By default, fields with empty 230 // values are omitted from API requests. However, any field with an 231 // empty value appearing in NullFields will be sent to the server as 232 // null. It is an error if a field in this list has a non-empty value. 233 // This may be used to include null fields in Patch requests. 234 NullFields []string `json:"-"` 235 } 236 237 func (s *InstanceUpdateError) MarshalJSON() ([]byte, error) { 238 type NoMethod InstanceUpdateError 239 raw := NoMethod(*s) 240 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 241 } 242 243 type InstanceUpdateErrorErrors struct { 244 // Code: [Output Only] The error type identifier for this error. 245 Code string `json:"code,omitempty"` 246 247 // Location: [Output Only] Indicates the field in the request that 248 // caused the error. This property is optional. 249 Location string `json:"location,omitempty"` 250 251 // Message: [Output Only] An optional, human-readable error message. 252 Message string `json:"message,omitempty"` 253 254 // ForceSendFields is a list of field names (e.g. "Code") to 255 // unconditionally include in API requests. By default, fields with 256 // empty values are omitted from API requests. However, any non-pointer, 257 // non-interface field appearing in ForceSendFields will be sent to the 258 // server regardless of whether the field is empty or not. This may be 259 // used to include empty fields in Patch requests. 260 ForceSendFields []string `json:"-"` 261 262 // NullFields is a list of field names (e.g. "Code") to include in API 263 // requests with the JSON null value. By default, fields with empty 264 // values are omitted from API requests. However, any field with an 265 // empty value appearing in NullFields will be sent to the server as 266 // null. It is an error if a field in this list has a non-empty value. 267 // This may be used to include null fields in Patch requests. 268 NullFields []string `json:"-"` 269 } 270 271 func (s *InstanceUpdateErrorErrors) MarshalJSON() ([]byte, error) { 272 type NoMethod InstanceUpdateErrorErrors 273 raw := NoMethod(*s) 274 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 275 } 276 277 // InstanceUpdateList: Response returned by ListInstanceUpdates method. 278 type InstanceUpdateList struct { 279 // Items: Collection of requested instance updates. 280 Items []*InstanceUpdate `json:"items,omitempty"` 281 282 // Kind: [Output Only] Type of the resource. 283 Kind string `json:"kind,omitempty"` 284 285 // NextPageToken: A token used to continue a truncated list request. 286 NextPageToken string `json:"nextPageToken,omitempty"` 287 288 // SelfLink: [Output Only] The fully qualified URL for the resource. 289 SelfLink string `json:"selfLink,omitempty"` 290 291 // ServerResponse contains the HTTP response code and headers from the 292 // server. 293 googleapi.ServerResponse `json:"-"` 294 295 // ForceSendFields is a list of field names (e.g. "Items") to 296 // unconditionally include in API requests. By default, fields with 297 // empty values are omitted from API requests. However, any non-pointer, 298 // non-interface field appearing in ForceSendFields will be sent to the 299 // server regardless of whether the field is empty or not. This may be 300 // used to include empty fields in Patch requests. 301 ForceSendFields []string `json:"-"` 302 303 // NullFields is a list of field names (e.g. "Items") to include in API 304 // requests with the JSON null value. By default, fields with empty 305 // values are omitted from API requests. However, any field with an 306 // empty value appearing in NullFields will be sent to the server as 307 // null. It is an error if a field in this list has a non-empty value. 308 // This may be used to include null fields in Patch requests. 309 NullFields []string `json:"-"` 310 } 311 312 func (s *InstanceUpdateList) MarshalJSON() ([]byte, error) { 313 type NoMethod InstanceUpdateList 314 raw := NoMethod(*s) 315 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 316 } 317 318 // Operation: An operation resource, used to manage asynchronous API 319 // requests. 320 type Operation struct { 321 ClientOperationId string `json:"clientOperationId,omitempty"` 322 323 // CreationTimestamp: [Output Only] Creation timestamp in RFC3339 text 324 // format. 325 CreationTimestamp string `json:"creationTimestamp,omitempty"` 326 327 EndTime string `json:"endTime,omitempty"` 328 329 // Error: [Output Only] If errors occurred during processing of this 330 // operation, this field will be populated. 331 Error *OperationError `json:"error,omitempty"` 332 333 HttpErrorMessage string `json:"httpErrorMessage,omitempty"` 334 335 HttpErrorStatusCode int64 `json:"httpErrorStatusCode,omitempty"` 336 337 // Id: [Output Only] Unique identifier for the resource; defined by the 338 // server. 339 Id uint64 `json:"id,omitempty,string"` 340 341 // InsertTime: [Output Only] The time that this operation was requested. 342 // This is in RFC 3339 format. 343 InsertTime string `json:"insertTime,omitempty"` 344 345 // Kind: [Output Only] Type of the resource. Always 346 // replicapoolupdater#operation for Operation resources. 347 Kind string `json:"kind,omitempty"` 348 349 // Name: [Output Only] Name of the resource. 350 Name string `json:"name,omitempty"` 351 352 OperationType string `json:"operationType,omitempty"` 353 354 Progress int64 `json:"progress,omitempty"` 355 356 // Region: [Output Only] URL of the region where the operation resides. 357 Region string `json:"region,omitempty"` 358 359 // SelfLink: [Output Only] The fully qualified URL for the resource. 360 SelfLink string `json:"selfLink,omitempty"` 361 362 // StartTime: [Output Only] The time that this operation was started by 363 // the server. This is in RFC 3339 format. 364 StartTime string `json:"startTime,omitempty"` 365 366 // Status: [Output Only] Status of the operation. Can be one of the 367 // following: "PENDING", "RUNNING", or "DONE". 368 Status string `json:"status,omitempty"` 369 370 // StatusMessage: [Output Only] An optional textual description of the 371 // current status of the operation. 372 StatusMessage string `json:"statusMessage,omitempty"` 373 374 // TargetId: [Output Only] Unique target id which identifies a 375 // particular incarnation of the target. 376 TargetId uint64 `json:"targetId,omitempty,string"` 377 378 // TargetLink: [Output Only] URL of the resource the operation is 379 // mutating. 380 TargetLink string `json:"targetLink,omitempty"` 381 382 User string `json:"user,omitempty"` 383 384 Warnings []*OperationWarnings `json:"warnings,omitempty"` 385 386 // Zone: [Output Only] URL of the zone where the operation resides. 387 Zone string `json:"zone,omitempty"` 388 389 // ServerResponse contains the HTTP response code and headers from the 390 // server. 391 googleapi.ServerResponse `json:"-"` 392 393 // ForceSendFields is a list of field names (e.g. "ClientOperationId") 394 // to unconditionally include in API requests. By default, fields with 395 // empty values are omitted from API requests. However, any non-pointer, 396 // non-interface field appearing in ForceSendFields will be sent to the 397 // server regardless of whether the field is empty or not. This may be 398 // used to include empty fields in Patch requests. 399 ForceSendFields []string `json:"-"` 400 401 // NullFields is a list of field names (e.g. "ClientOperationId") to 402 // include in API requests with the JSON null value. By default, fields 403 // with empty values are omitted from API requests. However, any field 404 // with an empty value appearing in NullFields will be sent to the 405 // server as null. It is an error if a field in this list has a 406 // non-empty value. This may be used to include null fields in Patch 407 // requests. 408 NullFields []string `json:"-"` 409 } 410 411 func (s *Operation) MarshalJSON() ([]byte, error) { 412 type NoMethod Operation 413 raw := NoMethod(*s) 414 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 415 } 416 417 // OperationError: [Output Only] If errors occurred during processing of 418 // this operation, this field will be populated. 419 type OperationError struct { 420 // Errors: [Output Only] The array of errors encountered while 421 // processing this operation. 422 Errors []*OperationErrorErrors `json:"errors,omitempty"` 423 424 // ForceSendFields is a list of field names (e.g. "Errors") to 425 // unconditionally include in API requests. By default, fields with 426 // empty values are omitted from API requests. However, any non-pointer, 427 // non-interface field appearing in ForceSendFields will be sent to the 428 // server regardless of whether the field is empty or not. This may be 429 // used to include empty fields in Patch requests. 430 ForceSendFields []string `json:"-"` 431 432 // NullFields is a list of field names (e.g. "Errors") to include in API 433 // requests with the JSON null value. By default, fields with empty 434 // values are omitted from API requests. However, any field with an 435 // empty value appearing in NullFields will be sent to the server as 436 // null. It is an error if a field in this list has a non-empty value. 437 // This may be used to include null fields in Patch requests. 438 NullFields []string `json:"-"` 439 } 440 441 func (s *OperationError) MarshalJSON() ([]byte, error) { 442 type NoMethod OperationError 443 raw := NoMethod(*s) 444 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 445 } 446 447 type OperationErrorErrors struct { 448 // Code: [Output Only] The error type identifier for this error. 449 Code string `json:"code,omitempty"` 450 451 // Location: [Output Only] Indicates the field in the request that 452 // caused the error. This property is optional. 453 Location string `json:"location,omitempty"` 454 455 // Message: [Output Only] An optional, human-readable error message. 456 Message string `json:"message,omitempty"` 457 458 // ForceSendFields is a list of field names (e.g. "Code") to 459 // unconditionally include in API requests. By default, fields with 460 // empty values are omitted from API requests. However, any non-pointer, 461 // non-interface field appearing in ForceSendFields will be sent to the 462 // server regardless of whether the field is empty or not. This may be 463 // used to include empty fields in Patch requests. 464 ForceSendFields []string `json:"-"` 465 466 // NullFields is a list of field names (e.g. "Code") to include in API 467 // requests with the JSON null value. By default, fields with empty 468 // values are omitted from API requests. However, any field with an 469 // empty value appearing in NullFields will be sent to the server as 470 // null. It is an error if a field in this list has a non-empty value. 471 // This may be used to include null fields in Patch requests. 472 NullFields []string `json:"-"` 473 } 474 475 func (s *OperationErrorErrors) MarshalJSON() ([]byte, error) { 476 type NoMethod OperationErrorErrors 477 raw := NoMethod(*s) 478 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 479 } 480 481 type OperationWarnings struct { 482 // Code: [Output only] The warning type identifier for this warning. 483 Code string `json:"code,omitempty"` 484 485 // Data: [Output only] Metadata for this warning in key:value format. 486 Data []*OperationWarningsData `json:"data,omitempty"` 487 488 // Message: [Output only] Optional human-readable details for this 489 // warning. 490 Message string `json:"message,omitempty"` 491 492 // ForceSendFields is a list of field names (e.g. "Code") to 493 // unconditionally include in API requests. By default, fields with 494 // empty values are omitted from API requests. However, any non-pointer, 495 // non-interface field appearing in ForceSendFields will be sent to the 496 // server regardless of whether the field is empty or not. This may be 497 // used to include empty fields in Patch requests. 498 ForceSendFields []string `json:"-"` 499 500 // NullFields is a list of field names (e.g. "Code") to include in API 501 // requests with the JSON null value. By default, fields with empty 502 // values are omitted from API requests. However, any field with an 503 // empty value appearing in NullFields will be sent to the server as 504 // null. It is an error if a field in this list has a non-empty value. 505 // This may be used to include null fields in Patch requests. 506 NullFields []string `json:"-"` 507 } 508 509 func (s *OperationWarnings) MarshalJSON() ([]byte, error) { 510 type NoMethod OperationWarnings 511 raw := NoMethod(*s) 512 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 513 } 514 515 type OperationWarningsData struct { 516 // Key: [Output Only] Metadata key for this warning. 517 Key string `json:"key,omitempty"` 518 519 // Value: [Output Only] Metadata value for this warning. 520 Value string `json:"value,omitempty"` 521 522 // ForceSendFields is a list of field names (e.g. "Key") to 523 // unconditionally include in API requests. By default, fields with 524 // empty values are omitted from API requests. However, any non-pointer, 525 // non-interface field appearing in ForceSendFields will be sent to the 526 // server regardless of whether the field is empty or not. This may be 527 // used to include empty fields in Patch requests. 528 ForceSendFields []string `json:"-"` 529 530 // NullFields is a list of field names (e.g. "Key") to include in API 531 // requests with the JSON null value. By default, fields with empty 532 // values are omitted from API requests. However, any field with an 533 // empty value appearing in NullFields will be sent to the server as 534 // null. It is an error if a field in this list has a non-empty value. 535 // This may be used to include null fields in Patch requests. 536 NullFields []string `json:"-"` 537 } 538 539 func (s *OperationWarningsData) MarshalJSON() ([]byte, error) { 540 type NoMethod OperationWarningsData 541 raw := NoMethod(*s) 542 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 543 } 544 545 // OperationList: Contains a list of Operation resources. 546 type OperationList struct { 547 // Id: [Output Only] Unique identifier for the resource; defined by the 548 // server. 549 Id string `json:"id,omitempty"` 550 551 // Items: [Output Only] The Operation resources. 552 Items []*Operation `json:"items,omitempty"` 553 554 // Kind: [Output Only] Type of resource. Always 555 // replicapoolupdater#operationList for OperationList resources. 556 Kind string `json:"kind,omitempty"` 557 558 // NextPageToken: [Output Only] A token used to continue a truncate. 559 NextPageToken string `json:"nextPageToken,omitempty"` 560 561 // SelfLink: [Output Only] The fully qualified URL for the resource. 562 SelfLink string `json:"selfLink,omitempty"` 563 564 // ServerResponse contains the HTTP response code and headers from the 565 // server. 566 googleapi.ServerResponse `json:"-"` 567 568 // ForceSendFields is a list of field names (e.g. "Id") to 569 // unconditionally include in API requests. By default, fields with 570 // empty values are omitted from API requests. However, any non-pointer, 571 // non-interface field appearing in ForceSendFields will be sent to the 572 // server regardless of whether the field is empty or not. This may be 573 // used to include empty fields in Patch requests. 574 ForceSendFields []string `json:"-"` 575 576 // NullFields is a list of field names (e.g. "Id") to include in API 577 // requests with the JSON null value. By default, fields with empty 578 // values are omitted from API requests. However, any field with an 579 // empty value appearing in NullFields will be sent to the server as 580 // null. It is an error if a field in this list has a non-empty value. 581 // This may be used to include null fields in Patch requests. 582 NullFields []string `json:"-"` 583 } 584 585 func (s *OperationList) MarshalJSON() ([]byte, error) { 586 type NoMethod OperationList 587 raw := NoMethod(*s) 588 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 589 } 590 591 // RollingUpdate: The following represents a resource describing a 592 // single update (rollout) of a group of instances to the given 593 // template. 594 type RollingUpdate struct { 595 // ActionType: Specifies the action to take for each instance within the 596 // instance group. This can be RECREATE which will recreate each 597 // instance and is only available for managed instance groups. It can 598 // also be REBOOT which performs a soft reboot for each instance and is 599 // only available for regular (non-managed) instance groups. 600 ActionType string `json:"actionType,omitempty"` 601 602 // CreationTimestamp: [Output Only] Creation timestamp in RFC3339 text 603 // format. 604 CreationTimestamp string `json:"creationTimestamp,omitempty"` 605 606 // Description: An optional textual description of the resource; 607 // provided by the client when the resource is created. 608 Description string `json:"description,omitempty"` 609 610 // Error: [Output Only] Errors that occurred during the rolling update. 611 Error *RollingUpdateError `json:"error,omitempty"` 612 613 // Id: [Output Only] Unique identifier for the resource; defined by the 614 // server. 615 Id string `json:"id,omitempty"` 616 617 // InstanceGroup: Fully-qualified URL of an instance group being 618 // updated. Exactly one of instanceGroupManager and instanceGroup must 619 // be set. 620 InstanceGroup string `json:"instanceGroup,omitempty"` 621 622 // InstanceGroupManager: Fully-qualified URL of an instance group 623 // manager being updated. Exactly one of instanceGroupManager and 624 // instanceGroup must be set. 625 InstanceGroupManager string `json:"instanceGroupManager,omitempty"` 626 627 // InstanceTemplate: Fully-qualified URL of an instance template to 628 // apply. 629 InstanceTemplate string `json:"instanceTemplate,omitempty"` 630 631 // Kind: [Output Only] Type of the resource. 632 Kind string `json:"kind,omitempty"` 633 634 // OldInstanceTemplate: Fully-qualified URL of the instance template 635 // encountered while starting the update. 636 OldInstanceTemplate string `json:"oldInstanceTemplate,omitempty"` 637 638 // Policy: Parameters of the update process. 639 Policy *RollingUpdatePolicy `json:"policy,omitempty"` 640 641 // Progress: [Output Only] An optional progress indicator that ranges 642 // from 0 to 100. There is no requirement that this be linear or support 643 // any granularity of operations. This should not be used to guess at 644 // when the update will be complete. This number should be monotonically 645 // increasing as the update progresses. 646 Progress int64 `json:"progress,omitempty"` 647 648 // SelfLink: [Output Only] The fully qualified URL for the resource. 649 SelfLink string `json:"selfLink,omitempty"` 650 651 // Status: [Output Only] Status of the update. Possible values are: 652 // - "ROLLING_FORWARD": The update is going forward. 653 // - "ROLLING_BACK": The update is being rolled back. 654 // - "PAUSED": The update is temporarily paused (inactive). 655 // - "ROLLED_OUT": The update is finished, all instances have been 656 // updated successfully. 657 // - "ROLLED_BACK": The update is finished, all instances have been 658 // reverted to the previous template. 659 // - "CANCELLED": The update is paused and no longer can be resumed, 660 // undefined how many instances are running in which template. 661 Status string `json:"status,omitempty"` 662 663 // StatusMessage: [Output Only] An optional textual description of the 664 // current status of the update. 665 StatusMessage string `json:"statusMessage,omitempty"` 666 667 // User: [Output Only] User who requested the update, for example: 668 // user@example.com. 669 User string `json:"user,omitempty"` 670 671 // ServerResponse contains the HTTP response code and headers from the 672 // server. 673 googleapi.ServerResponse `json:"-"` 674 675 // ForceSendFields is a list of field names (e.g. "ActionType") to 676 // unconditionally include in API requests. By default, fields with 677 // empty values are omitted from API requests. However, any non-pointer, 678 // non-interface field appearing in ForceSendFields will be sent to the 679 // server regardless of whether the field is empty or not. This may be 680 // used to include empty fields in Patch requests. 681 ForceSendFields []string `json:"-"` 682 683 // NullFields is a list of field names (e.g. "ActionType") to include in 684 // API requests with the JSON null value. By default, fields with empty 685 // values are omitted from API requests. However, any field with an 686 // empty value appearing in NullFields will be sent to the server as 687 // null. It is an error if a field in this list has a non-empty value. 688 // This may be used to include null fields in Patch requests. 689 NullFields []string `json:"-"` 690 } 691 692 func (s *RollingUpdate) MarshalJSON() ([]byte, error) { 693 type NoMethod RollingUpdate 694 raw := NoMethod(*s) 695 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 696 } 697 698 // RollingUpdateError: [Output Only] Errors that occurred during the 699 // rolling update. 700 type RollingUpdateError struct { 701 // Errors: [Output Only] The array of errors encountered while 702 // processing this operation. 703 Errors []*RollingUpdateErrorErrors `json:"errors,omitempty"` 704 705 // ForceSendFields is a list of field names (e.g. "Errors") to 706 // unconditionally include in API requests. By default, fields with 707 // empty values are omitted from API requests. However, any non-pointer, 708 // non-interface field appearing in ForceSendFields will be sent to the 709 // server regardless of whether the field is empty or not. This may be 710 // used to include empty fields in Patch requests. 711 ForceSendFields []string `json:"-"` 712 713 // NullFields is a list of field names (e.g. "Errors") to include in API 714 // requests with the JSON null value. By default, fields with empty 715 // values are omitted from API requests. However, any field with an 716 // empty value appearing in NullFields will be sent to the server as 717 // null. It is an error if a field in this list has a non-empty value. 718 // This may be used to include null fields in Patch requests. 719 NullFields []string `json:"-"` 720 } 721 722 func (s *RollingUpdateError) MarshalJSON() ([]byte, error) { 723 type NoMethod RollingUpdateError 724 raw := NoMethod(*s) 725 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 726 } 727 728 type RollingUpdateErrorErrors struct { 729 // Code: [Output Only] The error type identifier for this error. 730 Code string `json:"code,omitempty"` 731 732 // Location: [Output Only] Indicates the field in the request that 733 // caused the error. This property is optional. 734 Location string `json:"location,omitempty"` 735 736 // Message: [Output Only] An optional, human-readable error message. 737 Message string `json:"message,omitempty"` 738 739 // ForceSendFields is a list of field names (e.g. "Code") to 740 // unconditionally include in API requests. By default, fields with 741 // empty values are omitted from API requests. However, any non-pointer, 742 // non-interface field appearing in ForceSendFields will be sent to the 743 // server regardless of whether the field is empty or not. This may be 744 // used to include empty fields in Patch requests. 745 ForceSendFields []string `json:"-"` 746 747 // NullFields is a list of field names (e.g. "Code") to include in API 748 // requests with the JSON null value. By default, fields with empty 749 // values are omitted from API requests. However, any field with an 750 // empty value appearing in NullFields will be sent to the server as 751 // null. It is an error if a field in this list has a non-empty value. 752 // This may be used to include null fields in Patch requests. 753 NullFields []string `json:"-"` 754 } 755 756 func (s *RollingUpdateErrorErrors) MarshalJSON() ([]byte, error) { 757 type NoMethod RollingUpdateErrorErrors 758 raw := NoMethod(*s) 759 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 760 } 761 762 // RollingUpdatePolicy: Parameters of the update process. 763 type RollingUpdatePolicy struct { 764 // AutoPauseAfterInstances: Number of instances to update before the 765 // updater pauses the rolling update. 766 AutoPauseAfterInstances int64 `json:"autoPauseAfterInstances,omitempty"` 767 768 // InstanceStartupTimeoutSec: The maximum amount of time that the 769 // updater waits for a HEALTHY state after all of the update steps are 770 // complete. If the HEALTHY state is not received before the deadline, 771 // the instance update is considered a failure. 772 InstanceStartupTimeoutSec int64 `json:"instanceStartupTimeoutSec,omitempty"` 773 774 // MaxNumConcurrentInstances: The maximum number of instances that can 775 // be updated simultaneously. An instance update is considered complete 776 // only after the instance is restarted and initialized. 777 MaxNumConcurrentInstances int64 `json:"maxNumConcurrentInstances,omitempty"` 778 779 // MaxNumFailedInstances: The maximum number of instance updates that 780 // can fail before the group update is considered a failure. An instance 781 // update is considered failed if any of its update actions (e.g. Stop 782 // call on Instance resource in Rolling Reboot) failed with permanent 783 // failure, or if the instance is in an UNHEALTHY state after it 784 // finishes all of the update actions. 785 MaxNumFailedInstances int64 `json:"maxNumFailedInstances,omitempty"` 786 787 // MinInstanceUpdateTimeSec: The minimum amount of time that the updater 788 // spends to update each instance. Update time is the time it takes to 789 // complete all update actions (e.g. Stop call on Instance resource in 790 // Rolling Reboot), reboot, and initialize. If the instance update 791 // finishes early, the updater pauses for the remainder of the time 792 // before it starts the next instance update. 793 MinInstanceUpdateTimeSec int64 `json:"minInstanceUpdateTimeSec,omitempty"` 794 795 // ForceSendFields is a list of field names (e.g. 796 // "AutoPauseAfterInstances") to unconditionally include in API 797 // requests. By default, fields with empty values are omitted from API 798 // requests. However, any non-pointer, non-interface field appearing in 799 // ForceSendFields will be sent to the server regardless of whether the 800 // field is empty or not. This may be used to include empty fields in 801 // Patch requests. 802 ForceSendFields []string `json:"-"` 803 804 // NullFields is a list of field names (e.g. "AutoPauseAfterInstances") 805 // to include in API requests with the JSON null value. By default, 806 // fields with empty values are omitted from API requests. However, any 807 // field with an empty value appearing in NullFields will be sent to the 808 // server as null. It is an error if a field in this list has a 809 // non-empty value. This may be used to include null fields in Patch 810 // requests. 811 NullFields []string `json:"-"` 812 } 813 814 func (s *RollingUpdatePolicy) MarshalJSON() ([]byte, error) { 815 type NoMethod RollingUpdatePolicy 816 raw := NoMethod(*s) 817 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 818 } 819 820 // RollingUpdateList: Response returned by List method. 821 type RollingUpdateList struct { 822 // Items: Collection of requested updates. 823 Items []*RollingUpdate `json:"items,omitempty"` 824 825 // Kind: [Output Only] Type of the resource. 826 Kind string `json:"kind,omitempty"` 827 828 // NextPageToken: A token used to continue a truncated list request. 829 NextPageToken string `json:"nextPageToken,omitempty"` 830 831 // SelfLink: [Output Only] The fully qualified URL for the resource. 832 SelfLink string `json:"selfLink,omitempty"` 833 834 // ServerResponse contains the HTTP response code and headers from the 835 // server. 836 googleapi.ServerResponse `json:"-"` 837 838 // ForceSendFields is a list of field names (e.g. "Items") to 839 // unconditionally include in API requests. By default, fields with 840 // empty values are omitted from API requests. However, any non-pointer, 841 // non-interface field appearing in ForceSendFields will be sent to the 842 // server regardless of whether the field is empty or not. This may be 843 // used to include empty fields in Patch requests. 844 ForceSendFields []string `json:"-"` 845 846 // NullFields is a list of field names (e.g. "Items") to include in API 847 // requests with the JSON null value. By default, fields with empty 848 // values are omitted from API requests. However, any field with an 849 // empty value appearing in NullFields will be sent to the server as 850 // null. It is an error if a field in this list has a non-empty value. 851 // This may be used to include null fields in Patch requests. 852 NullFields []string `json:"-"` 853 } 854 855 func (s *RollingUpdateList) MarshalJSON() ([]byte, error) { 856 type NoMethod RollingUpdateList 857 raw := NoMethod(*s) 858 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 859 } 860 861 // method id "replicapoolupdater.rollingUpdates.cancel": 862 863 type RollingUpdatesCancelCall struct { 864 s *Service 865 project string 866 zone string 867 rollingUpdate string 868 urlParams_ gensupport.URLParams 869 ctx_ context.Context 870 header_ http.Header 871 } 872 873 // Cancel: Cancels an update. The update must be PAUSED before it can be 874 // cancelled. This has no effect if the update is already CANCELLED. 875 // For details, see https://cloud.google.com/compute/docs/instance-groups/manager/#cancelrollingupdate 876 func (r *RollingUpdatesService) Cancel(project string, zone string, rollingUpdate string) *RollingUpdatesCancelCall { 877 c := &RollingUpdatesCancelCall{s: r.s, urlParams_: make(gensupport.URLParams)} 878 c.project = project 879 c.zone = zone 880 c.rollingUpdate = rollingUpdate 881 return c 882 } 883 884 // Fields allows partial responses to be retrieved. See 885 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 886 // for more information. 887 func (c *RollingUpdatesCancelCall) Fields(s ...googleapi.Field) *RollingUpdatesCancelCall { 888 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 889 return c 890 } 891 892 // Context sets the context to be used in this call's Do method. Any 893 // pending HTTP request will be aborted if the provided context is 894 // canceled. 895 func (c *RollingUpdatesCancelCall) Context(ctx context.Context) *RollingUpdatesCancelCall { 896 c.ctx_ = ctx 897 return c 898 } 899 900 // Header returns an http.Header that can be modified by the caller to 901 // add HTTP headers to the request. 902 func (c *RollingUpdatesCancelCall) Header() http.Header { 903 if c.header_ == nil { 904 c.header_ = make(http.Header) 905 } 906 return c.header_ 907 } 908 909 func (c *RollingUpdatesCancelCall) doRequest(alt string) (*http.Response, error) { 910 reqHeaders := make(http.Header) 911 reqHeaders.Set("x-goog-api-client", "gl-go/1.13.7 gdcl/20200203") 912 for k, v := range c.header_ { 913 reqHeaders[k] = v 914 } 915 reqHeaders.Set("User-Agent", c.s.userAgent()) 916 var body io.Reader = nil 917 c.urlParams_.Set("alt", alt) 918 c.urlParams_.Set("prettyPrint", "false") 919 urls := googleapi.ResolveRelative(c.s.BasePath, "{project}/zones/{zone}/rollingUpdates/{rollingUpdate}/cancel") 920 urls += "?" + c.urlParams_.Encode() 921 req, err := http.NewRequest("POST", urls, body) 922 if err != nil { 923 return nil, err 924 } 925 req.Header = reqHeaders 926 googleapi.Expand(req.URL, map[string]string{ 927 "project": c.project, 928 "zone": c.zone, 929 "rollingUpdate": c.rollingUpdate, 930 }) 931 return gensupport.SendRequest(c.ctx_, c.s.client, req) 932 } 933 934 // Do executes the "replicapoolupdater.rollingUpdates.cancel" call. 935 // Exactly one of *Operation or error will be non-nil. Any non-2xx 936 // status code is an error. Response headers are in either 937 // *Operation.ServerResponse.Header or (if a response was returned at 938 // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 939 // to check whether the returned error was because 940 // http.StatusNotModified was returned. 941 func (c *RollingUpdatesCancelCall) Do(opts ...googleapi.CallOption) (*Operation, error) { 942 gensupport.SetOptions(c.urlParams_, opts...) 943 res, err := c.doRequest("json") 944 if res != nil && res.StatusCode == http.StatusNotModified { 945 if res.Body != nil { 946 res.Body.Close() 947 } 948 return nil, &googleapi.Error{ 949 Code: res.StatusCode, 950 Header: res.Header, 951 } 952 } 953 if err != nil { 954 return nil, err 955 } 956 defer googleapi.CloseBody(res) 957 if err := googleapi.CheckResponse(res); err != nil { 958 return nil, err 959 } 960 ret := &Operation{ 961 ServerResponse: googleapi.ServerResponse{ 962 Header: res.Header, 963 HTTPStatusCode: res.StatusCode, 964 }, 965 } 966 target := &ret 967 if err := gensupport.DecodeResponse(target, res); err != nil { 968 return nil, err 969 } 970 return ret, nil 971 // { 972 // "description": "Cancels an update. The update must be PAUSED before it can be cancelled. This has no effect if the update is already CANCELLED.", 973 // "httpMethod": "POST", 974 // "id": "replicapoolupdater.rollingUpdates.cancel", 975 // "parameterOrder": [ 976 // "project", 977 // "zone", 978 // "rollingUpdate" 979 // ], 980 // "parameters": { 981 // "project": { 982 // "description": "The Google Developers Console project name.", 983 // "location": "path", 984 // "pattern": "(?:(?:[-a-z0-9]{1,63}\\.)*(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?):)?(?:[0-9]{1,19}|(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?))", 985 // "required": true, 986 // "type": "string" 987 // }, 988 // "rollingUpdate": { 989 // "description": "The name of the update.", 990 // "location": "path", 991 // "required": true, 992 // "type": "string" 993 // }, 994 // "zone": { 995 // "description": "The name of the zone in which the update's target resides.", 996 // "location": "path", 997 // "required": true, 998 // "type": "string" 999 // } 1000 // }, 1001 // "path": "{project}/zones/{zone}/rollingUpdates/{rollingUpdate}/cancel", 1002 // "response": { 1003 // "$ref": "Operation" 1004 // }, 1005 // "scopes": [ 1006 // "https://www.googleapis.com/auth/cloud-platform", 1007 // "https://www.googleapis.com/auth/replicapool" 1008 // ] 1009 // } 1010 1011 } 1012 1013 // method id "replicapoolupdater.rollingUpdates.get": 1014 1015 type RollingUpdatesGetCall struct { 1016 s *Service 1017 project string 1018 zone string 1019 rollingUpdate string 1020 urlParams_ gensupport.URLParams 1021 ifNoneMatch_ string 1022 ctx_ context.Context 1023 header_ http.Header 1024 } 1025 1026 // Get: Returns information about an update. 1027 // For details, see https://cloud.google.com/compute/docs/instance-groups/manager/#getlistrollingupdate 1028 func (r *RollingUpdatesService) Get(project string, zone string, rollingUpdate string) *RollingUpdatesGetCall { 1029 c := &RollingUpdatesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1030 c.project = project 1031 c.zone = zone 1032 c.rollingUpdate = rollingUpdate 1033 return c 1034 } 1035 1036 // Fields allows partial responses to be retrieved. See 1037 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1038 // for more information. 1039 func (c *RollingUpdatesGetCall) Fields(s ...googleapi.Field) *RollingUpdatesGetCall { 1040 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1041 return c 1042 } 1043 1044 // IfNoneMatch sets the optional parameter which makes the operation 1045 // fail if the object's ETag matches the given value. This is useful for 1046 // getting updates only after the object has changed since the last 1047 // request. Use googleapi.IsNotModified to check whether the response 1048 // error from Do is the result of In-None-Match. 1049 func (c *RollingUpdatesGetCall) IfNoneMatch(entityTag string) *RollingUpdatesGetCall { 1050 c.ifNoneMatch_ = entityTag 1051 return c 1052 } 1053 1054 // Context sets the context to be used in this call's Do method. Any 1055 // pending HTTP request will be aborted if the provided context is 1056 // canceled. 1057 func (c *RollingUpdatesGetCall) Context(ctx context.Context) *RollingUpdatesGetCall { 1058 c.ctx_ = ctx 1059 return c 1060 } 1061 1062 // Header returns an http.Header that can be modified by the caller to 1063 // add HTTP headers to the request. 1064 func (c *RollingUpdatesGetCall) Header() http.Header { 1065 if c.header_ == nil { 1066 c.header_ = make(http.Header) 1067 } 1068 return c.header_ 1069 } 1070 1071 func (c *RollingUpdatesGetCall) doRequest(alt string) (*http.Response, error) { 1072 reqHeaders := make(http.Header) 1073 reqHeaders.Set("x-goog-api-client", "gl-go/1.13.7 gdcl/20200203") 1074 for k, v := range c.header_ { 1075 reqHeaders[k] = v 1076 } 1077 reqHeaders.Set("User-Agent", c.s.userAgent()) 1078 if c.ifNoneMatch_ != "" { 1079 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 1080 } 1081 var body io.Reader = nil 1082 c.urlParams_.Set("alt", alt) 1083 c.urlParams_.Set("prettyPrint", "false") 1084 urls := googleapi.ResolveRelative(c.s.BasePath, "{project}/zones/{zone}/rollingUpdates/{rollingUpdate}") 1085 urls += "?" + c.urlParams_.Encode() 1086 req, err := http.NewRequest("GET", urls, body) 1087 if err != nil { 1088 return nil, err 1089 } 1090 req.Header = reqHeaders 1091 googleapi.Expand(req.URL, map[string]string{ 1092 "project": c.project, 1093 "zone": c.zone, 1094 "rollingUpdate": c.rollingUpdate, 1095 }) 1096 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1097 } 1098 1099 // Do executes the "replicapoolupdater.rollingUpdates.get" call. 1100 // Exactly one of *RollingUpdate or error will be non-nil. Any non-2xx 1101 // status code is an error. Response headers are in either 1102 // *RollingUpdate.ServerResponse.Header or (if a response was returned 1103 // at all) in error.(*googleapi.Error).Header. Use 1104 // googleapi.IsNotModified to check whether the returned error was 1105 // because http.StatusNotModified was returned. 1106 func (c *RollingUpdatesGetCall) Do(opts ...googleapi.CallOption) (*RollingUpdate, error) { 1107 gensupport.SetOptions(c.urlParams_, opts...) 1108 res, err := c.doRequest("json") 1109 if res != nil && res.StatusCode == http.StatusNotModified { 1110 if res.Body != nil { 1111 res.Body.Close() 1112 } 1113 return nil, &googleapi.Error{ 1114 Code: res.StatusCode, 1115 Header: res.Header, 1116 } 1117 } 1118 if err != nil { 1119 return nil, err 1120 } 1121 defer googleapi.CloseBody(res) 1122 if err := googleapi.CheckResponse(res); err != nil { 1123 return nil, err 1124 } 1125 ret := &RollingUpdate{ 1126 ServerResponse: googleapi.ServerResponse{ 1127 Header: res.Header, 1128 HTTPStatusCode: res.StatusCode, 1129 }, 1130 } 1131 target := &ret 1132 if err := gensupport.DecodeResponse(target, res); err != nil { 1133 return nil, err 1134 } 1135 return ret, nil 1136 // { 1137 // "description": "Returns information about an update.", 1138 // "httpMethod": "GET", 1139 // "id": "replicapoolupdater.rollingUpdates.get", 1140 // "parameterOrder": [ 1141 // "project", 1142 // "zone", 1143 // "rollingUpdate" 1144 // ], 1145 // "parameters": { 1146 // "project": { 1147 // "description": "The Google Developers Console project name.", 1148 // "location": "path", 1149 // "pattern": "(?:(?:[-a-z0-9]{1,63}\\.)*(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?):)?(?:[0-9]{1,19}|(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?))", 1150 // "required": true, 1151 // "type": "string" 1152 // }, 1153 // "rollingUpdate": { 1154 // "description": "The name of the update.", 1155 // "location": "path", 1156 // "required": true, 1157 // "type": "string" 1158 // }, 1159 // "zone": { 1160 // "description": "The name of the zone in which the update's target resides.", 1161 // "location": "path", 1162 // "required": true, 1163 // "type": "string" 1164 // } 1165 // }, 1166 // "path": "{project}/zones/{zone}/rollingUpdates/{rollingUpdate}", 1167 // "response": { 1168 // "$ref": "RollingUpdate" 1169 // }, 1170 // "scopes": [ 1171 // "https://www.googleapis.com/auth/cloud-platform", 1172 // "https://www.googleapis.com/auth/cloud-platform.read-only", 1173 // "https://www.googleapis.com/auth/replicapool", 1174 // "https://www.googleapis.com/auth/replicapool.readonly" 1175 // ] 1176 // } 1177 1178 } 1179 1180 // method id "replicapoolupdater.rollingUpdates.insert": 1181 1182 type RollingUpdatesInsertCall struct { 1183 s *Service 1184 project string 1185 zone string 1186 rollingupdate *RollingUpdate 1187 urlParams_ gensupport.URLParams 1188 ctx_ context.Context 1189 header_ http.Header 1190 } 1191 1192 // Insert: Inserts and starts a new update. 1193 // For details, see https://cloud.google.com/compute/docs/instance-groups/manager/#starting_an_update 1194 func (r *RollingUpdatesService) Insert(project string, zone string, rollingupdate *RollingUpdate) *RollingUpdatesInsertCall { 1195 c := &RollingUpdatesInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1196 c.project = project 1197 c.zone = zone 1198 c.rollingupdate = rollingupdate 1199 return c 1200 } 1201 1202 // Fields allows partial responses to be retrieved. See 1203 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1204 // for more information. 1205 func (c *RollingUpdatesInsertCall) Fields(s ...googleapi.Field) *RollingUpdatesInsertCall { 1206 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1207 return c 1208 } 1209 1210 // Context sets the context to be used in this call's Do method. Any 1211 // pending HTTP request will be aborted if the provided context is 1212 // canceled. 1213 func (c *RollingUpdatesInsertCall) Context(ctx context.Context) *RollingUpdatesInsertCall { 1214 c.ctx_ = ctx 1215 return c 1216 } 1217 1218 // Header returns an http.Header that can be modified by the caller to 1219 // add HTTP headers to the request. 1220 func (c *RollingUpdatesInsertCall) Header() http.Header { 1221 if c.header_ == nil { 1222 c.header_ = make(http.Header) 1223 } 1224 return c.header_ 1225 } 1226 1227 func (c *RollingUpdatesInsertCall) doRequest(alt string) (*http.Response, error) { 1228 reqHeaders := make(http.Header) 1229 reqHeaders.Set("x-goog-api-client", "gl-go/1.13.7 gdcl/20200203") 1230 for k, v := range c.header_ { 1231 reqHeaders[k] = v 1232 } 1233 reqHeaders.Set("User-Agent", c.s.userAgent()) 1234 var body io.Reader = nil 1235 body, err := googleapi.WithoutDataWrapper.JSONReader(c.rollingupdate) 1236 if err != nil { 1237 return nil, err 1238 } 1239 reqHeaders.Set("Content-Type", "application/json") 1240 c.urlParams_.Set("alt", alt) 1241 c.urlParams_.Set("prettyPrint", "false") 1242 urls := googleapi.ResolveRelative(c.s.BasePath, "{project}/zones/{zone}/rollingUpdates") 1243 urls += "?" + c.urlParams_.Encode() 1244 req, err := http.NewRequest("POST", urls, body) 1245 if err != nil { 1246 return nil, err 1247 } 1248 req.Header = reqHeaders 1249 googleapi.Expand(req.URL, map[string]string{ 1250 "project": c.project, 1251 "zone": c.zone, 1252 }) 1253 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1254 } 1255 1256 // Do executes the "replicapoolupdater.rollingUpdates.insert" call. 1257 // Exactly one of *Operation or error will be non-nil. Any non-2xx 1258 // status code is an error. Response headers are in either 1259 // *Operation.ServerResponse.Header or (if a response was returned at 1260 // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 1261 // to check whether the returned error was because 1262 // http.StatusNotModified was returned. 1263 func (c *RollingUpdatesInsertCall) Do(opts ...googleapi.CallOption) (*Operation, error) { 1264 gensupport.SetOptions(c.urlParams_, opts...) 1265 res, err := c.doRequest("json") 1266 if res != nil && res.StatusCode == http.StatusNotModified { 1267 if res.Body != nil { 1268 res.Body.Close() 1269 } 1270 return nil, &googleapi.Error{ 1271 Code: res.StatusCode, 1272 Header: res.Header, 1273 } 1274 } 1275 if err != nil { 1276 return nil, err 1277 } 1278 defer googleapi.CloseBody(res) 1279 if err := googleapi.CheckResponse(res); err != nil { 1280 return nil, err 1281 } 1282 ret := &Operation{ 1283 ServerResponse: googleapi.ServerResponse{ 1284 Header: res.Header, 1285 HTTPStatusCode: res.StatusCode, 1286 }, 1287 } 1288 target := &ret 1289 if err := gensupport.DecodeResponse(target, res); err != nil { 1290 return nil, err 1291 } 1292 return ret, nil 1293 // { 1294 // "description": "Inserts and starts a new update.", 1295 // "httpMethod": "POST", 1296 // "id": "replicapoolupdater.rollingUpdates.insert", 1297 // "parameterOrder": [ 1298 // "project", 1299 // "zone" 1300 // ], 1301 // "parameters": { 1302 // "project": { 1303 // "description": "The Google Developers Console project name.", 1304 // "location": "path", 1305 // "pattern": "(?:(?:[-a-z0-9]{1,63}\\.)*(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?):)?(?:[0-9]{1,19}|(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?))", 1306 // "required": true, 1307 // "type": "string" 1308 // }, 1309 // "zone": { 1310 // "description": "The name of the zone in which the update's target resides.", 1311 // "location": "path", 1312 // "required": true, 1313 // "type": "string" 1314 // } 1315 // }, 1316 // "path": "{project}/zones/{zone}/rollingUpdates", 1317 // "request": { 1318 // "$ref": "RollingUpdate" 1319 // }, 1320 // "response": { 1321 // "$ref": "Operation" 1322 // }, 1323 // "scopes": [ 1324 // "https://www.googleapis.com/auth/cloud-platform", 1325 // "https://www.googleapis.com/auth/replicapool" 1326 // ] 1327 // } 1328 1329 } 1330 1331 // method id "replicapoolupdater.rollingUpdates.list": 1332 1333 type RollingUpdatesListCall struct { 1334 s *Service 1335 project string 1336 zone string 1337 urlParams_ gensupport.URLParams 1338 ifNoneMatch_ string 1339 ctx_ context.Context 1340 header_ http.Header 1341 } 1342 1343 // List: Lists recent updates for a given managed instance group, in 1344 // reverse chronological order and paginated format. 1345 // For details, see https://cloud.google.com/compute/docs/instance-groups/manager/#getlistrollingupdate 1346 func (r *RollingUpdatesService) List(project string, zone string) *RollingUpdatesListCall { 1347 c := &RollingUpdatesListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1348 c.project = project 1349 c.zone = zone 1350 return c 1351 } 1352 1353 // Filter sets the optional parameter "filter": Filter expression for 1354 // filtering listed resources. 1355 func (c *RollingUpdatesListCall) Filter(filter string) *RollingUpdatesListCall { 1356 c.urlParams_.Set("filter", filter) 1357 return c 1358 } 1359 1360 // MaxResults sets the optional parameter "maxResults": Maximum count of 1361 // results to be returned. Maximum value is 500 and default value is 1362 // 500. 1363 func (c *RollingUpdatesListCall) MaxResults(maxResults int64) *RollingUpdatesListCall { 1364 c.urlParams_.Set("maxResults", fmt.Sprint(maxResults)) 1365 return c 1366 } 1367 1368 // PageToken sets the optional parameter "pageToken": Tag returned by a 1369 // previous list request truncated by maxResults. Used to continue a 1370 // previous list request. 1371 func (c *RollingUpdatesListCall) PageToken(pageToken string) *RollingUpdatesListCall { 1372 c.urlParams_.Set("pageToken", pageToken) 1373 return c 1374 } 1375 1376 // Fields allows partial responses to be retrieved. See 1377 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1378 // for more information. 1379 func (c *RollingUpdatesListCall) Fields(s ...googleapi.Field) *RollingUpdatesListCall { 1380 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1381 return c 1382 } 1383 1384 // IfNoneMatch sets the optional parameter which makes the operation 1385 // fail if the object's ETag matches the given value. This is useful for 1386 // getting updates only after the object has changed since the last 1387 // request. Use googleapi.IsNotModified to check whether the response 1388 // error from Do is the result of In-None-Match. 1389 func (c *RollingUpdatesListCall) IfNoneMatch(entityTag string) *RollingUpdatesListCall { 1390 c.ifNoneMatch_ = entityTag 1391 return c 1392 } 1393 1394 // Context sets the context to be used in this call's Do method. Any 1395 // pending HTTP request will be aborted if the provided context is 1396 // canceled. 1397 func (c *RollingUpdatesListCall) Context(ctx context.Context) *RollingUpdatesListCall { 1398 c.ctx_ = ctx 1399 return c 1400 } 1401 1402 // Header returns an http.Header that can be modified by the caller to 1403 // add HTTP headers to the request. 1404 func (c *RollingUpdatesListCall) Header() http.Header { 1405 if c.header_ == nil { 1406 c.header_ = make(http.Header) 1407 } 1408 return c.header_ 1409 } 1410 1411 func (c *RollingUpdatesListCall) doRequest(alt string) (*http.Response, error) { 1412 reqHeaders := make(http.Header) 1413 reqHeaders.Set("x-goog-api-client", "gl-go/1.13.7 gdcl/20200203") 1414 for k, v := range c.header_ { 1415 reqHeaders[k] = v 1416 } 1417 reqHeaders.Set("User-Agent", c.s.userAgent()) 1418 if c.ifNoneMatch_ != "" { 1419 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 1420 } 1421 var body io.Reader = nil 1422 c.urlParams_.Set("alt", alt) 1423 c.urlParams_.Set("prettyPrint", "false") 1424 urls := googleapi.ResolveRelative(c.s.BasePath, "{project}/zones/{zone}/rollingUpdates") 1425 urls += "?" + c.urlParams_.Encode() 1426 req, err := http.NewRequest("GET", urls, body) 1427 if err != nil { 1428 return nil, err 1429 } 1430 req.Header = reqHeaders 1431 googleapi.Expand(req.URL, map[string]string{ 1432 "project": c.project, 1433 "zone": c.zone, 1434 }) 1435 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1436 } 1437 1438 // Do executes the "replicapoolupdater.rollingUpdates.list" call. 1439 // Exactly one of *RollingUpdateList or error will be non-nil. Any 1440 // non-2xx status code is an error. Response headers are in either 1441 // *RollingUpdateList.ServerResponse.Header or (if a response was 1442 // returned at all) in error.(*googleapi.Error).Header. Use 1443 // googleapi.IsNotModified to check whether the returned error was 1444 // because http.StatusNotModified was returned. 1445 func (c *RollingUpdatesListCall) Do(opts ...googleapi.CallOption) (*RollingUpdateList, error) { 1446 gensupport.SetOptions(c.urlParams_, opts...) 1447 res, err := c.doRequest("json") 1448 if res != nil && res.StatusCode == http.StatusNotModified { 1449 if res.Body != nil { 1450 res.Body.Close() 1451 } 1452 return nil, &googleapi.Error{ 1453 Code: res.StatusCode, 1454 Header: res.Header, 1455 } 1456 } 1457 if err != nil { 1458 return nil, err 1459 } 1460 defer googleapi.CloseBody(res) 1461 if err := googleapi.CheckResponse(res); err != nil { 1462 return nil, err 1463 } 1464 ret := &RollingUpdateList{ 1465 ServerResponse: googleapi.ServerResponse{ 1466 Header: res.Header, 1467 HTTPStatusCode: res.StatusCode, 1468 }, 1469 } 1470 target := &ret 1471 if err := gensupport.DecodeResponse(target, res); err != nil { 1472 return nil, err 1473 } 1474 return ret, nil 1475 // { 1476 // "description": "Lists recent updates for a given managed instance group, in reverse chronological order and paginated format.", 1477 // "httpMethod": "GET", 1478 // "id": "replicapoolupdater.rollingUpdates.list", 1479 // "parameterOrder": [ 1480 // "project", 1481 // "zone" 1482 // ], 1483 // "parameters": { 1484 // "filter": { 1485 // "description": "Optional. Filter expression for filtering listed resources.", 1486 // "location": "query", 1487 // "type": "string" 1488 // }, 1489 // "maxResults": { 1490 // "default": "500", 1491 // "description": "Optional. Maximum count of results to be returned. Maximum value is 500 and default value is 500.", 1492 // "format": "uint32", 1493 // "location": "query", 1494 // "maximum": "500", 1495 // "minimum": "0", 1496 // "type": "integer" 1497 // }, 1498 // "pageToken": { 1499 // "description": "Optional. Tag returned by a previous list request truncated by maxResults. Used to continue a previous list request.", 1500 // "location": "query", 1501 // "type": "string" 1502 // }, 1503 // "project": { 1504 // "description": "The Google Developers Console project name.", 1505 // "location": "path", 1506 // "pattern": "(?:(?:[-a-z0-9]{1,63}\\.)*(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?):)?(?:[0-9]{1,19}|(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?))", 1507 // "required": true, 1508 // "type": "string" 1509 // }, 1510 // "zone": { 1511 // "description": "The name of the zone in which the update's target resides.", 1512 // "location": "path", 1513 // "required": true, 1514 // "type": "string" 1515 // } 1516 // }, 1517 // "path": "{project}/zones/{zone}/rollingUpdates", 1518 // "response": { 1519 // "$ref": "RollingUpdateList" 1520 // }, 1521 // "scopes": [ 1522 // "https://www.googleapis.com/auth/cloud-platform", 1523 // "https://www.googleapis.com/auth/cloud-platform.read-only", 1524 // "https://www.googleapis.com/auth/replicapool", 1525 // "https://www.googleapis.com/auth/replicapool.readonly" 1526 // ] 1527 // } 1528 1529 } 1530 1531 // Pages invokes f for each page of results. 1532 // A non-nil error returned from f will halt the iteration. 1533 // The provided context supersedes any context provided to the Context method. 1534 func (c *RollingUpdatesListCall) Pages(ctx context.Context, f func(*RollingUpdateList) error) error { 1535 c.ctx_ = ctx 1536 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 1537 for { 1538 x, err := c.Do() 1539 if err != nil { 1540 return err 1541 } 1542 if err := f(x); err != nil { 1543 return err 1544 } 1545 if x.NextPageToken == "" { 1546 return nil 1547 } 1548 c.PageToken(x.NextPageToken) 1549 } 1550 } 1551 1552 // method id "replicapoolupdater.rollingUpdates.listInstanceUpdates": 1553 1554 type RollingUpdatesListInstanceUpdatesCall struct { 1555 s *Service 1556 project string 1557 zone string 1558 rollingUpdate string 1559 urlParams_ gensupport.URLParams 1560 ifNoneMatch_ string 1561 ctx_ context.Context 1562 header_ http.Header 1563 } 1564 1565 // ListInstanceUpdates: Lists the current status for each instance 1566 // within a given update. 1567 // For details, see https://cloud.google.com/compute/docs/instance-groups/manager/#getlistrollingupdate 1568 func (r *RollingUpdatesService) ListInstanceUpdates(project string, zone string, rollingUpdate string) *RollingUpdatesListInstanceUpdatesCall { 1569 c := &RollingUpdatesListInstanceUpdatesCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1570 c.project = project 1571 c.zone = zone 1572 c.rollingUpdate = rollingUpdate 1573 return c 1574 } 1575 1576 // Filter sets the optional parameter "filter": Filter expression for 1577 // filtering listed resources. 1578 func (c *RollingUpdatesListInstanceUpdatesCall) Filter(filter string) *RollingUpdatesListInstanceUpdatesCall { 1579 c.urlParams_.Set("filter", filter) 1580 return c 1581 } 1582 1583 // MaxResults sets the optional parameter "maxResults": Maximum count of 1584 // results to be returned. Maximum value is 500 and default value is 1585 // 500. 1586 func (c *RollingUpdatesListInstanceUpdatesCall) MaxResults(maxResults int64) *RollingUpdatesListInstanceUpdatesCall { 1587 c.urlParams_.Set("maxResults", fmt.Sprint(maxResults)) 1588 return c 1589 } 1590 1591 // PageToken sets the optional parameter "pageToken": Tag returned by a 1592 // previous list request truncated by maxResults. Used to continue a 1593 // previous list request. 1594 func (c *RollingUpdatesListInstanceUpdatesCall) PageToken(pageToken string) *RollingUpdatesListInstanceUpdatesCall { 1595 c.urlParams_.Set("pageToken", pageToken) 1596 return c 1597 } 1598 1599 // Fields allows partial responses to be retrieved. See 1600 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1601 // for more information. 1602 func (c *RollingUpdatesListInstanceUpdatesCall) Fields(s ...googleapi.Field) *RollingUpdatesListInstanceUpdatesCall { 1603 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1604 return c 1605 } 1606 1607 // IfNoneMatch sets the optional parameter which makes the operation 1608 // fail if the object's ETag matches the given value. This is useful for 1609 // getting updates only after the object has changed since the last 1610 // request. Use googleapi.IsNotModified to check whether the response 1611 // error from Do is the result of In-None-Match. 1612 func (c *RollingUpdatesListInstanceUpdatesCall) IfNoneMatch(entityTag string) *RollingUpdatesListInstanceUpdatesCall { 1613 c.ifNoneMatch_ = entityTag 1614 return c 1615 } 1616 1617 // Context sets the context to be used in this call's Do method. Any 1618 // pending HTTP request will be aborted if the provided context is 1619 // canceled. 1620 func (c *RollingUpdatesListInstanceUpdatesCall) Context(ctx context.Context) *RollingUpdatesListInstanceUpdatesCall { 1621 c.ctx_ = ctx 1622 return c 1623 } 1624 1625 // Header returns an http.Header that can be modified by the caller to 1626 // add HTTP headers to the request. 1627 func (c *RollingUpdatesListInstanceUpdatesCall) Header() http.Header { 1628 if c.header_ == nil { 1629 c.header_ = make(http.Header) 1630 } 1631 return c.header_ 1632 } 1633 1634 func (c *RollingUpdatesListInstanceUpdatesCall) doRequest(alt string) (*http.Response, error) { 1635 reqHeaders := make(http.Header) 1636 reqHeaders.Set("x-goog-api-client", "gl-go/1.13.7 gdcl/20200203") 1637 for k, v := range c.header_ { 1638 reqHeaders[k] = v 1639 } 1640 reqHeaders.Set("User-Agent", c.s.userAgent()) 1641 if c.ifNoneMatch_ != "" { 1642 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 1643 } 1644 var body io.Reader = nil 1645 c.urlParams_.Set("alt", alt) 1646 c.urlParams_.Set("prettyPrint", "false") 1647 urls := googleapi.ResolveRelative(c.s.BasePath, "{project}/zones/{zone}/rollingUpdates/{rollingUpdate}/instanceUpdates") 1648 urls += "?" + c.urlParams_.Encode() 1649 req, err := http.NewRequest("GET", urls, body) 1650 if err != nil { 1651 return nil, err 1652 } 1653 req.Header = reqHeaders 1654 googleapi.Expand(req.URL, map[string]string{ 1655 "project": c.project, 1656 "zone": c.zone, 1657 "rollingUpdate": c.rollingUpdate, 1658 }) 1659 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1660 } 1661 1662 // Do executes the "replicapoolupdater.rollingUpdates.listInstanceUpdates" call. 1663 // Exactly one of *InstanceUpdateList or error will be non-nil. Any 1664 // non-2xx status code is an error. Response headers are in either 1665 // *InstanceUpdateList.ServerResponse.Header or (if a response was 1666 // returned at all) in error.(*googleapi.Error).Header. Use 1667 // googleapi.IsNotModified to check whether the returned error was 1668 // because http.StatusNotModified was returned. 1669 func (c *RollingUpdatesListInstanceUpdatesCall) Do(opts ...googleapi.CallOption) (*InstanceUpdateList, error) { 1670 gensupport.SetOptions(c.urlParams_, opts...) 1671 res, err := c.doRequest("json") 1672 if res != nil && res.StatusCode == http.StatusNotModified { 1673 if res.Body != nil { 1674 res.Body.Close() 1675 } 1676 return nil, &googleapi.Error{ 1677 Code: res.StatusCode, 1678 Header: res.Header, 1679 } 1680 } 1681 if err != nil { 1682 return nil, err 1683 } 1684 defer googleapi.CloseBody(res) 1685 if err := googleapi.CheckResponse(res); err != nil { 1686 return nil, err 1687 } 1688 ret := &InstanceUpdateList{ 1689 ServerResponse: googleapi.ServerResponse{ 1690 Header: res.Header, 1691 HTTPStatusCode: res.StatusCode, 1692 }, 1693 } 1694 target := &ret 1695 if err := gensupport.DecodeResponse(target, res); err != nil { 1696 return nil, err 1697 } 1698 return ret, nil 1699 // { 1700 // "description": "Lists the current status for each instance within a given update.", 1701 // "httpMethod": "GET", 1702 // "id": "replicapoolupdater.rollingUpdates.listInstanceUpdates", 1703 // "parameterOrder": [ 1704 // "project", 1705 // "zone", 1706 // "rollingUpdate" 1707 // ], 1708 // "parameters": { 1709 // "filter": { 1710 // "description": "Optional. Filter expression for filtering listed resources.", 1711 // "location": "query", 1712 // "type": "string" 1713 // }, 1714 // "maxResults": { 1715 // "default": "500", 1716 // "description": "Optional. Maximum count of results to be returned. Maximum value is 500 and default value is 500.", 1717 // "format": "uint32", 1718 // "location": "query", 1719 // "maximum": "500", 1720 // "minimum": "0", 1721 // "type": "integer" 1722 // }, 1723 // "pageToken": { 1724 // "description": "Optional. Tag returned by a previous list request truncated by maxResults. Used to continue a previous list request.", 1725 // "location": "query", 1726 // "type": "string" 1727 // }, 1728 // "project": { 1729 // "description": "The Google Developers Console project name.", 1730 // "location": "path", 1731 // "pattern": "(?:(?:[-a-z0-9]{1,63}\\.)*(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?):)?(?:[0-9]{1,19}|(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?))", 1732 // "required": true, 1733 // "type": "string" 1734 // }, 1735 // "rollingUpdate": { 1736 // "description": "The name of the update.", 1737 // "location": "path", 1738 // "required": true, 1739 // "type": "string" 1740 // }, 1741 // "zone": { 1742 // "description": "The name of the zone in which the update's target resides.", 1743 // "location": "path", 1744 // "required": true, 1745 // "type": "string" 1746 // } 1747 // }, 1748 // "path": "{project}/zones/{zone}/rollingUpdates/{rollingUpdate}/instanceUpdates", 1749 // "response": { 1750 // "$ref": "InstanceUpdateList" 1751 // }, 1752 // "scopes": [ 1753 // "https://www.googleapis.com/auth/cloud-platform", 1754 // "https://www.googleapis.com/auth/cloud-platform.read-only", 1755 // "https://www.googleapis.com/auth/replicapool", 1756 // "https://www.googleapis.com/auth/replicapool.readonly" 1757 // ] 1758 // } 1759 1760 } 1761 1762 // Pages invokes f for each page of results. 1763 // A non-nil error returned from f will halt the iteration. 1764 // The provided context supersedes any context provided to the Context method. 1765 func (c *RollingUpdatesListInstanceUpdatesCall) Pages(ctx context.Context, f func(*InstanceUpdateList) error) error { 1766 c.ctx_ = ctx 1767 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 1768 for { 1769 x, err := c.Do() 1770 if err != nil { 1771 return err 1772 } 1773 if err := f(x); err != nil { 1774 return err 1775 } 1776 if x.NextPageToken == "" { 1777 return nil 1778 } 1779 c.PageToken(x.NextPageToken) 1780 } 1781 } 1782 1783 // method id "replicapoolupdater.rollingUpdates.pause": 1784 1785 type RollingUpdatesPauseCall struct { 1786 s *Service 1787 project string 1788 zone string 1789 rollingUpdate string 1790 urlParams_ gensupport.URLParams 1791 ctx_ context.Context 1792 header_ http.Header 1793 } 1794 1795 // Pause: Pauses the update in state from ROLLING_FORWARD or 1796 // ROLLING_BACK. Has no effect if invoked when the state of the update 1797 // is PAUSED. 1798 // For details, see https://cloud.google.com/compute/docs/instance-groups/manager/#pausing_a_rolling_update 1799 func (r *RollingUpdatesService) Pause(project string, zone string, rollingUpdate string) *RollingUpdatesPauseCall { 1800 c := &RollingUpdatesPauseCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1801 c.project = project 1802 c.zone = zone 1803 c.rollingUpdate = rollingUpdate 1804 return c 1805 } 1806 1807 // Fields allows partial responses to be retrieved. See 1808 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1809 // for more information. 1810 func (c *RollingUpdatesPauseCall) Fields(s ...googleapi.Field) *RollingUpdatesPauseCall { 1811 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1812 return c 1813 } 1814 1815 // Context sets the context to be used in this call's Do method. Any 1816 // pending HTTP request will be aborted if the provided context is 1817 // canceled. 1818 func (c *RollingUpdatesPauseCall) Context(ctx context.Context) *RollingUpdatesPauseCall { 1819 c.ctx_ = ctx 1820 return c 1821 } 1822 1823 // Header returns an http.Header that can be modified by the caller to 1824 // add HTTP headers to the request. 1825 func (c *RollingUpdatesPauseCall) Header() http.Header { 1826 if c.header_ == nil { 1827 c.header_ = make(http.Header) 1828 } 1829 return c.header_ 1830 } 1831 1832 func (c *RollingUpdatesPauseCall) doRequest(alt string) (*http.Response, error) { 1833 reqHeaders := make(http.Header) 1834 reqHeaders.Set("x-goog-api-client", "gl-go/1.13.7 gdcl/20200203") 1835 for k, v := range c.header_ { 1836 reqHeaders[k] = v 1837 } 1838 reqHeaders.Set("User-Agent", c.s.userAgent()) 1839 var body io.Reader = nil 1840 c.urlParams_.Set("alt", alt) 1841 c.urlParams_.Set("prettyPrint", "false") 1842 urls := googleapi.ResolveRelative(c.s.BasePath, "{project}/zones/{zone}/rollingUpdates/{rollingUpdate}/pause") 1843 urls += "?" + c.urlParams_.Encode() 1844 req, err := http.NewRequest("POST", urls, body) 1845 if err != nil { 1846 return nil, err 1847 } 1848 req.Header = reqHeaders 1849 googleapi.Expand(req.URL, map[string]string{ 1850 "project": c.project, 1851 "zone": c.zone, 1852 "rollingUpdate": c.rollingUpdate, 1853 }) 1854 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1855 } 1856 1857 // Do executes the "replicapoolupdater.rollingUpdates.pause" call. 1858 // Exactly one of *Operation or error will be non-nil. Any non-2xx 1859 // status code is an error. Response headers are in either 1860 // *Operation.ServerResponse.Header or (if a response was returned at 1861 // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 1862 // to check whether the returned error was because 1863 // http.StatusNotModified was returned. 1864 func (c *RollingUpdatesPauseCall) Do(opts ...googleapi.CallOption) (*Operation, error) { 1865 gensupport.SetOptions(c.urlParams_, opts...) 1866 res, err := c.doRequest("json") 1867 if res != nil && res.StatusCode == http.StatusNotModified { 1868 if res.Body != nil { 1869 res.Body.Close() 1870 } 1871 return nil, &googleapi.Error{ 1872 Code: res.StatusCode, 1873 Header: res.Header, 1874 } 1875 } 1876 if err != nil { 1877 return nil, err 1878 } 1879 defer googleapi.CloseBody(res) 1880 if err := googleapi.CheckResponse(res); err != nil { 1881 return nil, err 1882 } 1883 ret := &Operation{ 1884 ServerResponse: googleapi.ServerResponse{ 1885 Header: res.Header, 1886 HTTPStatusCode: res.StatusCode, 1887 }, 1888 } 1889 target := &ret 1890 if err := gensupport.DecodeResponse(target, res); err != nil { 1891 return nil, err 1892 } 1893 return ret, nil 1894 // { 1895 // "description": "Pauses the update in state from ROLLING_FORWARD or ROLLING_BACK. Has no effect if invoked when the state of the update is PAUSED.", 1896 // "httpMethod": "POST", 1897 // "id": "replicapoolupdater.rollingUpdates.pause", 1898 // "parameterOrder": [ 1899 // "project", 1900 // "zone", 1901 // "rollingUpdate" 1902 // ], 1903 // "parameters": { 1904 // "project": { 1905 // "description": "The Google Developers Console project name.", 1906 // "location": "path", 1907 // "pattern": "(?:(?:[-a-z0-9]{1,63}\\.)*(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?):)?(?:[0-9]{1,19}|(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?))", 1908 // "required": true, 1909 // "type": "string" 1910 // }, 1911 // "rollingUpdate": { 1912 // "description": "The name of the update.", 1913 // "location": "path", 1914 // "required": true, 1915 // "type": "string" 1916 // }, 1917 // "zone": { 1918 // "description": "The name of the zone in which the update's target resides.", 1919 // "location": "path", 1920 // "required": true, 1921 // "type": "string" 1922 // } 1923 // }, 1924 // "path": "{project}/zones/{zone}/rollingUpdates/{rollingUpdate}/pause", 1925 // "response": { 1926 // "$ref": "Operation" 1927 // }, 1928 // "scopes": [ 1929 // "https://www.googleapis.com/auth/cloud-platform", 1930 // "https://www.googleapis.com/auth/replicapool" 1931 // ] 1932 // } 1933 1934 } 1935 1936 // method id "replicapoolupdater.rollingUpdates.resume": 1937 1938 type RollingUpdatesResumeCall struct { 1939 s *Service 1940 project string 1941 zone string 1942 rollingUpdate string 1943 urlParams_ gensupport.URLParams 1944 ctx_ context.Context 1945 header_ http.Header 1946 } 1947 1948 // Resume: Continues an update in PAUSED state. Has no effect if invoked 1949 // when the state of the update is ROLLED_OUT. 1950 // For details, see https://cloud.google.com/compute/docs/instance-groups/manager/#continuerollingupdate 1951 func (r *RollingUpdatesService) Resume(project string, zone string, rollingUpdate string) *RollingUpdatesResumeCall { 1952 c := &RollingUpdatesResumeCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1953 c.project = project 1954 c.zone = zone 1955 c.rollingUpdate = rollingUpdate 1956 return c 1957 } 1958 1959 // Fields allows partial responses to be retrieved. See 1960 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1961 // for more information. 1962 func (c *RollingUpdatesResumeCall) Fields(s ...googleapi.Field) *RollingUpdatesResumeCall { 1963 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1964 return c 1965 } 1966 1967 // Context sets the context to be used in this call's Do method. Any 1968 // pending HTTP request will be aborted if the provided context is 1969 // canceled. 1970 func (c *RollingUpdatesResumeCall) Context(ctx context.Context) *RollingUpdatesResumeCall { 1971 c.ctx_ = ctx 1972 return c 1973 } 1974 1975 // Header returns an http.Header that can be modified by the caller to 1976 // add HTTP headers to the request. 1977 func (c *RollingUpdatesResumeCall) Header() http.Header { 1978 if c.header_ == nil { 1979 c.header_ = make(http.Header) 1980 } 1981 return c.header_ 1982 } 1983 1984 func (c *RollingUpdatesResumeCall) doRequest(alt string) (*http.Response, error) { 1985 reqHeaders := make(http.Header) 1986 reqHeaders.Set("x-goog-api-client", "gl-go/1.13.7 gdcl/20200203") 1987 for k, v := range c.header_ { 1988 reqHeaders[k] = v 1989 } 1990 reqHeaders.Set("User-Agent", c.s.userAgent()) 1991 var body io.Reader = nil 1992 c.urlParams_.Set("alt", alt) 1993 c.urlParams_.Set("prettyPrint", "false") 1994 urls := googleapi.ResolveRelative(c.s.BasePath, "{project}/zones/{zone}/rollingUpdates/{rollingUpdate}/resume") 1995 urls += "?" + c.urlParams_.Encode() 1996 req, err := http.NewRequest("POST", urls, body) 1997 if err != nil { 1998 return nil, err 1999 } 2000 req.Header = reqHeaders 2001 googleapi.Expand(req.URL, map[string]string{ 2002 "project": c.project, 2003 "zone": c.zone, 2004 "rollingUpdate": c.rollingUpdate, 2005 }) 2006 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2007 } 2008 2009 // Do executes the "replicapoolupdater.rollingUpdates.resume" call. 2010 // Exactly one of *Operation or error will be non-nil. Any non-2xx 2011 // status code is an error. Response headers are in either 2012 // *Operation.ServerResponse.Header or (if a response was returned at 2013 // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 2014 // to check whether the returned error was because 2015 // http.StatusNotModified was returned. 2016 func (c *RollingUpdatesResumeCall) Do(opts ...googleapi.CallOption) (*Operation, error) { 2017 gensupport.SetOptions(c.urlParams_, opts...) 2018 res, err := c.doRequest("json") 2019 if res != nil && res.StatusCode == http.StatusNotModified { 2020 if res.Body != nil { 2021 res.Body.Close() 2022 } 2023 return nil, &googleapi.Error{ 2024 Code: res.StatusCode, 2025 Header: res.Header, 2026 } 2027 } 2028 if err != nil { 2029 return nil, err 2030 } 2031 defer googleapi.CloseBody(res) 2032 if err := googleapi.CheckResponse(res); err != nil { 2033 return nil, err 2034 } 2035 ret := &Operation{ 2036 ServerResponse: googleapi.ServerResponse{ 2037 Header: res.Header, 2038 HTTPStatusCode: res.StatusCode, 2039 }, 2040 } 2041 target := &ret 2042 if err := gensupport.DecodeResponse(target, res); err != nil { 2043 return nil, err 2044 } 2045 return ret, nil 2046 // { 2047 // "description": "Continues an update in PAUSED state. Has no effect if invoked when the state of the update is ROLLED_OUT.", 2048 // "httpMethod": "POST", 2049 // "id": "replicapoolupdater.rollingUpdates.resume", 2050 // "parameterOrder": [ 2051 // "project", 2052 // "zone", 2053 // "rollingUpdate" 2054 // ], 2055 // "parameters": { 2056 // "project": { 2057 // "description": "The Google Developers Console project name.", 2058 // "location": "path", 2059 // "pattern": "(?:(?:[-a-z0-9]{1,63}\\.)*(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?):)?(?:[0-9]{1,19}|(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?))", 2060 // "required": true, 2061 // "type": "string" 2062 // }, 2063 // "rollingUpdate": { 2064 // "description": "The name of the update.", 2065 // "location": "path", 2066 // "required": true, 2067 // "type": "string" 2068 // }, 2069 // "zone": { 2070 // "description": "The name of the zone in which the update's target resides.", 2071 // "location": "path", 2072 // "required": true, 2073 // "type": "string" 2074 // } 2075 // }, 2076 // "path": "{project}/zones/{zone}/rollingUpdates/{rollingUpdate}/resume", 2077 // "response": { 2078 // "$ref": "Operation" 2079 // }, 2080 // "scopes": [ 2081 // "https://www.googleapis.com/auth/cloud-platform", 2082 // "https://www.googleapis.com/auth/replicapool" 2083 // ] 2084 // } 2085 2086 } 2087 2088 // method id "replicapoolupdater.rollingUpdates.rollback": 2089 2090 type RollingUpdatesRollbackCall struct { 2091 s *Service 2092 project string 2093 zone string 2094 rollingUpdate string 2095 urlParams_ gensupport.URLParams 2096 ctx_ context.Context 2097 header_ http.Header 2098 } 2099 2100 // Rollback: Rolls back the update in state from ROLLING_FORWARD or 2101 // PAUSED. Has no effect if invoked when the state of the update is 2102 // ROLLED_BACK. 2103 // For details, see https://cloud.google.com/compute/docs/instance-groups/manager/#rollingbackupdate 2104 func (r *RollingUpdatesService) Rollback(project string, zone string, rollingUpdate string) *RollingUpdatesRollbackCall { 2105 c := &RollingUpdatesRollbackCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2106 c.project = project 2107 c.zone = zone 2108 c.rollingUpdate = rollingUpdate 2109 return c 2110 } 2111 2112 // Fields allows partial responses to be retrieved. See 2113 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2114 // for more information. 2115 func (c *RollingUpdatesRollbackCall) Fields(s ...googleapi.Field) *RollingUpdatesRollbackCall { 2116 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2117 return c 2118 } 2119 2120 // Context sets the context to be used in this call's Do method. Any 2121 // pending HTTP request will be aborted if the provided context is 2122 // canceled. 2123 func (c *RollingUpdatesRollbackCall) Context(ctx context.Context) *RollingUpdatesRollbackCall { 2124 c.ctx_ = ctx 2125 return c 2126 } 2127 2128 // Header returns an http.Header that can be modified by the caller to 2129 // add HTTP headers to the request. 2130 func (c *RollingUpdatesRollbackCall) Header() http.Header { 2131 if c.header_ == nil { 2132 c.header_ = make(http.Header) 2133 } 2134 return c.header_ 2135 } 2136 2137 func (c *RollingUpdatesRollbackCall) doRequest(alt string) (*http.Response, error) { 2138 reqHeaders := make(http.Header) 2139 reqHeaders.Set("x-goog-api-client", "gl-go/1.13.7 gdcl/20200203") 2140 for k, v := range c.header_ { 2141 reqHeaders[k] = v 2142 } 2143 reqHeaders.Set("User-Agent", c.s.userAgent()) 2144 var body io.Reader = nil 2145 c.urlParams_.Set("alt", alt) 2146 c.urlParams_.Set("prettyPrint", "false") 2147 urls := googleapi.ResolveRelative(c.s.BasePath, "{project}/zones/{zone}/rollingUpdates/{rollingUpdate}/rollback") 2148 urls += "?" + c.urlParams_.Encode() 2149 req, err := http.NewRequest("POST", urls, body) 2150 if err != nil { 2151 return nil, err 2152 } 2153 req.Header = reqHeaders 2154 googleapi.Expand(req.URL, map[string]string{ 2155 "project": c.project, 2156 "zone": c.zone, 2157 "rollingUpdate": c.rollingUpdate, 2158 }) 2159 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2160 } 2161 2162 // Do executes the "replicapoolupdater.rollingUpdates.rollback" call. 2163 // Exactly one of *Operation or error will be non-nil. Any non-2xx 2164 // status code is an error. Response headers are in either 2165 // *Operation.ServerResponse.Header or (if a response was returned at 2166 // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 2167 // to check whether the returned error was because 2168 // http.StatusNotModified was returned. 2169 func (c *RollingUpdatesRollbackCall) Do(opts ...googleapi.CallOption) (*Operation, error) { 2170 gensupport.SetOptions(c.urlParams_, opts...) 2171 res, err := c.doRequest("json") 2172 if res != nil && res.StatusCode == http.StatusNotModified { 2173 if res.Body != nil { 2174 res.Body.Close() 2175 } 2176 return nil, &googleapi.Error{ 2177 Code: res.StatusCode, 2178 Header: res.Header, 2179 } 2180 } 2181 if err != nil { 2182 return nil, err 2183 } 2184 defer googleapi.CloseBody(res) 2185 if err := googleapi.CheckResponse(res); err != nil { 2186 return nil, err 2187 } 2188 ret := &Operation{ 2189 ServerResponse: googleapi.ServerResponse{ 2190 Header: res.Header, 2191 HTTPStatusCode: res.StatusCode, 2192 }, 2193 } 2194 target := &ret 2195 if err := gensupport.DecodeResponse(target, res); err != nil { 2196 return nil, err 2197 } 2198 return ret, nil 2199 // { 2200 // "description": "Rolls back the update in state from ROLLING_FORWARD or PAUSED. Has no effect if invoked when the state of the update is ROLLED_BACK.", 2201 // "httpMethod": "POST", 2202 // "id": "replicapoolupdater.rollingUpdates.rollback", 2203 // "parameterOrder": [ 2204 // "project", 2205 // "zone", 2206 // "rollingUpdate" 2207 // ], 2208 // "parameters": { 2209 // "project": { 2210 // "description": "The Google Developers Console project name.", 2211 // "location": "path", 2212 // "pattern": "(?:(?:[-a-z0-9]{1,63}\\.)*(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?):)?(?:[0-9]{1,19}|(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?))", 2213 // "required": true, 2214 // "type": "string" 2215 // }, 2216 // "rollingUpdate": { 2217 // "description": "The name of the update.", 2218 // "location": "path", 2219 // "required": true, 2220 // "type": "string" 2221 // }, 2222 // "zone": { 2223 // "description": "The name of the zone in which the update's target resides.", 2224 // "location": "path", 2225 // "required": true, 2226 // "type": "string" 2227 // } 2228 // }, 2229 // "path": "{project}/zones/{zone}/rollingUpdates/{rollingUpdate}/rollback", 2230 // "response": { 2231 // "$ref": "Operation" 2232 // }, 2233 // "scopes": [ 2234 // "https://www.googleapis.com/auth/cloud-platform", 2235 // "https://www.googleapis.com/auth/replicapool" 2236 // ] 2237 // } 2238 2239 } 2240 2241 // method id "replicapoolupdater.zoneOperations.get": 2242 2243 type ZoneOperationsGetCall struct { 2244 s *Service 2245 project string 2246 zone string 2247 operation string 2248 urlParams_ gensupport.URLParams 2249 ifNoneMatch_ string 2250 ctx_ context.Context 2251 header_ http.Header 2252 } 2253 2254 // Get: Retrieves the specified zone-specific operation resource. 2255 func (r *ZoneOperationsService) Get(project string, zone string, operation string) *ZoneOperationsGetCall { 2256 c := &ZoneOperationsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2257 c.project = project 2258 c.zone = zone 2259 c.operation = operation 2260 return c 2261 } 2262 2263 // Fields allows partial responses to be retrieved. See 2264 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2265 // for more information. 2266 func (c *ZoneOperationsGetCall) Fields(s ...googleapi.Field) *ZoneOperationsGetCall { 2267 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2268 return c 2269 } 2270 2271 // IfNoneMatch sets the optional parameter which makes the operation 2272 // fail if the object's ETag matches the given value. This is useful for 2273 // getting updates only after the object has changed since the last 2274 // request. Use googleapi.IsNotModified to check whether the response 2275 // error from Do is the result of In-None-Match. 2276 func (c *ZoneOperationsGetCall) IfNoneMatch(entityTag string) *ZoneOperationsGetCall { 2277 c.ifNoneMatch_ = entityTag 2278 return c 2279 } 2280 2281 // Context sets the context to be used in this call's Do method. Any 2282 // pending HTTP request will be aborted if the provided context is 2283 // canceled. 2284 func (c *ZoneOperationsGetCall) Context(ctx context.Context) *ZoneOperationsGetCall { 2285 c.ctx_ = ctx 2286 return c 2287 } 2288 2289 // Header returns an http.Header that can be modified by the caller to 2290 // add HTTP headers to the request. 2291 func (c *ZoneOperationsGetCall) Header() http.Header { 2292 if c.header_ == nil { 2293 c.header_ = make(http.Header) 2294 } 2295 return c.header_ 2296 } 2297 2298 func (c *ZoneOperationsGetCall) doRequest(alt string) (*http.Response, error) { 2299 reqHeaders := make(http.Header) 2300 reqHeaders.Set("x-goog-api-client", "gl-go/1.13.7 gdcl/20200203") 2301 for k, v := range c.header_ { 2302 reqHeaders[k] = v 2303 } 2304 reqHeaders.Set("User-Agent", c.s.userAgent()) 2305 if c.ifNoneMatch_ != "" { 2306 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 2307 } 2308 var body io.Reader = nil 2309 c.urlParams_.Set("alt", alt) 2310 c.urlParams_.Set("prettyPrint", "false") 2311 urls := googleapi.ResolveRelative(c.s.BasePath, "{project}/zones/{zone}/operations/{operation}") 2312 urls += "?" + c.urlParams_.Encode() 2313 req, err := http.NewRequest("GET", urls, body) 2314 if err != nil { 2315 return nil, err 2316 } 2317 req.Header = reqHeaders 2318 googleapi.Expand(req.URL, map[string]string{ 2319 "project": c.project, 2320 "zone": c.zone, 2321 "operation": c.operation, 2322 }) 2323 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2324 } 2325 2326 // Do executes the "replicapoolupdater.zoneOperations.get" call. 2327 // Exactly one of *Operation or error will be non-nil. Any non-2xx 2328 // status code is an error. Response headers are in either 2329 // *Operation.ServerResponse.Header or (if a response was returned at 2330 // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 2331 // to check whether the returned error was because 2332 // http.StatusNotModified was returned. 2333 func (c *ZoneOperationsGetCall) Do(opts ...googleapi.CallOption) (*Operation, error) { 2334 gensupport.SetOptions(c.urlParams_, opts...) 2335 res, err := c.doRequest("json") 2336 if res != nil && res.StatusCode == http.StatusNotModified { 2337 if res.Body != nil { 2338 res.Body.Close() 2339 } 2340 return nil, &googleapi.Error{ 2341 Code: res.StatusCode, 2342 Header: res.Header, 2343 } 2344 } 2345 if err != nil { 2346 return nil, err 2347 } 2348 defer googleapi.CloseBody(res) 2349 if err := googleapi.CheckResponse(res); err != nil { 2350 return nil, err 2351 } 2352 ret := &Operation{ 2353 ServerResponse: googleapi.ServerResponse{ 2354 Header: res.Header, 2355 HTTPStatusCode: res.StatusCode, 2356 }, 2357 } 2358 target := &ret 2359 if err := gensupport.DecodeResponse(target, res); err != nil { 2360 return nil, err 2361 } 2362 return ret, nil 2363 // { 2364 // "description": "Retrieves the specified zone-specific operation resource.", 2365 // "httpMethod": "GET", 2366 // "id": "replicapoolupdater.zoneOperations.get", 2367 // "parameterOrder": [ 2368 // "project", 2369 // "zone", 2370 // "operation" 2371 // ], 2372 // "parameters": { 2373 // "operation": { 2374 // "description": "Name of the operation resource to return.", 2375 // "location": "path", 2376 // "required": true, 2377 // "type": "string" 2378 // }, 2379 // "project": { 2380 // "description": "Name of the project scoping this request.", 2381 // "location": "path", 2382 // "pattern": "(?:(?:[-a-z0-9]{1,63}\\.)*(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?):)?(?:[0-9]{1,19}|(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?))", 2383 // "required": true, 2384 // "type": "string" 2385 // }, 2386 // "zone": { 2387 // "description": "Name of the zone scoping this request.", 2388 // "location": "path", 2389 // "required": true, 2390 // "type": "string" 2391 // } 2392 // }, 2393 // "path": "{project}/zones/{zone}/operations/{operation}", 2394 // "response": { 2395 // "$ref": "Operation" 2396 // }, 2397 // "scopes": [ 2398 // "https://www.googleapis.com/auth/cloud-platform", 2399 // "https://www.googleapis.com/auth/replicapool" 2400 // ] 2401 // } 2402 2403 } 2404 2405 // method id "replicapoolupdater.zoneOperations.list": 2406 2407 type ZoneOperationsListCall struct { 2408 s *Service 2409 project string 2410 zone string 2411 urlParams_ gensupport.URLParams 2412 ifNoneMatch_ string 2413 ctx_ context.Context 2414 header_ http.Header 2415 } 2416 2417 // List: Retrieves the list of Operation resources contained within the 2418 // specified zone. 2419 func (r *ZoneOperationsService) List(project string, zone string) *ZoneOperationsListCall { 2420 c := &ZoneOperationsListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2421 c.project = project 2422 c.zone = zone 2423 return c 2424 } 2425 2426 // Filter sets the optional parameter "filter": Filter expression for 2427 // filtering listed resources. 2428 func (c *ZoneOperationsListCall) Filter(filter string) *ZoneOperationsListCall { 2429 c.urlParams_.Set("filter", filter) 2430 return c 2431 } 2432 2433 // MaxResults sets the optional parameter "maxResults": Maximum count of 2434 // results to be returned. Maximum value is 500 and default value is 2435 // 500. 2436 func (c *ZoneOperationsListCall) MaxResults(maxResults int64) *ZoneOperationsListCall { 2437 c.urlParams_.Set("maxResults", fmt.Sprint(maxResults)) 2438 return c 2439 } 2440 2441 // PageToken sets the optional parameter "pageToken": Tag returned by a 2442 // previous list request truncated by maxResults. Used to continue a 2443 // previous list request. 2444 func (c *ZoneOperationsListCall) PageToken(pageToken string) *ZoneOperationsListCall { 2445 c.urlParams_.Set("pageToken", pageToken) 2446 return c 2447 } 2448 2449 // Fields allows partial responses to be retrieved. See 2450 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2451 // for more information. 2452 func (c *ZoneOperationsListCall) Fields(s ...googleapi.Field) *ZoneOperationsListCall { 2453 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2454 return c 2455 } 2456 2457 // IfNoneMatch sets the optional parameter which makes the operation 2458 // fail if the object's ETag matches the given value. This is useful for 2459 // getting updates only after the object has changed since the last 2460 // request. Use googleapi.IsNotModified to check whether the response 2461 // error from Do is the result of In-None-Match. 2462 func (c *ZoneOperationsListCall) IfNoneMatch(entityTag string) *ZoneOperationsListCall { 2463 c.ifNoneMatch_ = entityTag 2464 return c 2465 } 2466 2467 // Context sets the context to be used in this call's Do method. Any 2468 // pending HTTP request will be aborted if the provided context is 2469 // canceled. 2470 func (c *ZoneOperationsListCall) Context(ctx context.Context) *ZoneOperationsListCall { 2471 c.ctx_ = ctx 2472 return c 2473 } 2474 2475 // Header returns an http.Header that can be modified by the caller to 2476 // add HTTP headers to the request. 2477 func (c *ZoneOperationsListCall) Header() http.Header { 2478 if c.header_ == nil { 2479 c.header_ = make(http.Header) 2480 } 2481 return c.header_ 2482 } 2483 2484 func (c *ZoneOperationsListCall) doRequest(alt string) (*http.Response, error) { 2485 reqHeaders := make(http.Header) 2486 reqHeaders.Set("x-goog-api-client", "gl-go/1.13.7 gdcl/20200203") 2487 for k, v := range c.header_ { 2488 reqHeaders[k] = v 2489 } 2490 reqHeaders.Set("User-Agent", c.s.userAgent()) 2491 if c.ifNoneMatch_ != "" { 2492 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 2493 } 2494 var body io.Reader = nil 2495 c.urlParams_.Set("alt", alt) 2496 c.urlParams_.Set("prettyPrint", "false") 2497 urls := googleapi.ResolveRelative(c.s.BasePath, "{project}/zones/{zone}/operations") 2498 urls += "?" + c.urlParams_.Encode() 2499 req, err := http.NewRequest("GET", urls, body) 2500 if err != nil { 2501 return nil, err 2502 } 2503 req.Header = reqHeaders 2504 googleapi.Expand(req.URL, map[string]string{ 2505 "project": c.project, 2506 "zone": c.zone, 2507 }) 2508 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2509 } 2510 2511 // Do executes the "replicapoolupdater.zoneOperations.list" call. 2512 // Exactly one of *OperationList or error will be non-nil. Any non-2xx 2513 // status code is an error. Response headers are in either 2514 // *OperationList.ServerResponse.Header or (if a response was returned 2515 // at all) in error.(*googleapi.Error).Header. Use 2516 // googleapi.IsNotModified to check whether the returned error was 2517 // because http.StatusNotModified was returned. 2518 func (c *ZoneOperationsListCall) Do(opts ...googleapi.CallOption) (*OperationList, error) { 2519 gensupport.SetOptions(c.urlParams_, opts...) 2520 res, err := c.doRequest("json") 2521 if res != nil && res.StatusCode == http.StatusNotModified { 2522 if res.Body != nil { 2523 res.Body.Close() 2524 } 2525 return nil, &googleapi.Error{ 2526 Code: res.StatusCode, 2527 Header: res.Header, 2528 } 2529 } 2530 if err != nil { 2531 return nil, err 2532 } 2533 defer googleapi.CloseBody(res) 2534 if err := googleapi.CheckResponse(res); err != nil { 2535 return nil, err 2536 } 2537 ret := &OperationList{ 2538 ServerResponse: googleapi.ServerResponse{ 2539 Header: res.Header, 2540 HTTPStatusCode: res.StatusCode, 2541 }, 2542 } 2543 target := &ret 2544 if err := gensupport.DecodeResponse(target, res); err != nil { 2545 return nil, err 2546 } 2547 return ret, nil 2548 // { 2549 // "description": "Retrieves the list of Operation resources contained within the specified zone.", 2550 // "httpMethod": "GET", 2551 // "id": "replicapoolupdater.zoneOperations.list", 2552 // "parameterOrder": [ 2553 // "project", 2554 // "zone" 2555 // ], 2556 // "parameters": { 2557 // "filter": { 2558 // "description": "Optional. Filter expression for filtering listed resources.", 2559 // "location": "query", 2560 // "type": "string" 2561 // }, 2562 // "maxResults": { 2563 // "default": "500", 2564 // "description": "Optional. Maximum count of results to be returned. Maximum value is 500 and default value is 500.", 2565 // "format": "uint32", 2566 // "location": "query", 2567 // "maximum": "500", 2568 // "minimum": "0", 2569 // "type": "integer" 2570 // }, 2571 // "pageToken": { 2572 // "description": "Optional. Tag returned by a previous list request truncated by maxResults. Used to continue a previous list request.", 2573 // "location": "query", 2574 // "type": "string" 2575 // }, 2576 // "project": { 2577 // "description": "Name of the project scoping this request.", 2578 // "location": "path", 2579 // "pattern": "(?:(?:[-a-z0-9]{1,63}\\.)*(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?):)?(?:[0-9]{1,19}|(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?))", 2580 // "required": true, 2581 // "type": "string" 2582 // }, 2583 // "zone": { 2584 // "description": "Name of the zone scoping this request.", 2585 // "location": "path", 2586 // "required": true, 2587 // "type": "string" 2588 // } 2589 // }, 2590 // "path": "{project}/zones/{zone}/operations", 2591 // "response": { 2592 // "$ref": "OperationList" 2593 // }, 2594 // "scopes": [ 2595 // "https://www.googleapis.com/auth/cloud-platform", 2596 // "https://www.googleapis.com/auth/replicapool" 2597 // ] 2598 // } 2599 2600 } 2601 2602 // Pages invokes f for each page of results. 2603 // A non-nil error returned from f will halt the iteration. 2604 // The provided context supersedes any context provided to the Context method. 2605 func (c *ZoneOperationsListCall) Pages(ctx context.Context, f func(*OperationList) error) error { 2606 c.ctx_ = ctx 2607 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 2608 for { 2609 x, err := c.Do() 2610 if err != nil { 2611 return err 2612 } 2613 if err := f(x); err != nil { 2614 return err 2615 } 2616 if x.NextPageToken == "" { 2617 return nil 2618 } 2619 c.PageToken(x.NextPageToken) 2620 } 2621 } 2622