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 replicapool provides access to the Replica Pool API. 8 // 9 // For product documentation, see: https://developers.google.com/compute/docs/replica-pool/ 10 // 11 // # Creating a client 12 // 13 // Usage example: 14 // 15 // import "google.golang.org/api/replicapool/v1beta1" 16 // ... 17 // ctx := context.Background() 18 // replicapoolService, err := replicapool.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 // replicapoolService, err := replicapool.NewService(ctx, option.WithScopes(replicapool.ReplicapoolReadonlyScope)) 29 // 30 // To use an API key for authentication (note: some APIs do not support API keys), use option.WithAPIKey: 31 // 32 // replicapoolService, err := replicapool.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 // replicapoolService, err := replicapool.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 replicapool // import "google.golang.org/api/replicapool/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 = "replicapool:v1beta1" 77 const apiName = "replicapool" 78 const apiVersion = "v1beta1" 79 const basePath = "https://www.googleapis.com/replicapool/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 your Google Cloud Platform management resources and 90 // deployment status information 91 NdevCloudmanScope = "https://www.googleapis.com/auth/ndev.cloudman" 92 93 // View your Google Cloud Platform management resources and deployment 94 // status information 95 NdevCloudmanReadonlyScope = "https://www.googleapis.com/auth/ndev.cloudman.readonly" 96 97 // View and manage replica pools 98 ReplicapoolScope = "https://www.googleapis.com/auth/replicapool" 99 100 // View replica pools 101 ReplicapoolReadonlyScope = "https://www.googleapis.com/auth/replicapool.readonly" 102 ) 103 104 // NewService creates a new Service. 105 func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) { 106 scopesOption := option.WithScopes( 107 "https://www.googleapis.com/auth/cloud-platform", 108 "https://www.googleapis.com/auth/cloud-platform.read-only", 109 "https://www.googleapis.com/auth/ndev.cloudman", 110 "https://www.googleapis.com/auth/ndev.cloudman.readonly", 111 "https://www.googleapis.com/auth/replicapool", 112 "https://www.googleapis.com/auth/replicapool.readonly", 113 ) 114 // NOTE: prepend, so we don't override user-specified scopes. 115 opts = append([]option.ClientOption{scopesOption}, opts...) 116 client, endpoint, err := htransport.NewClient(ctx, opts...) 117 if err != nil { 118 return nil, err 119 } 120 s, err := New(client) 121 if err != nil { 122 return nil, err 123 } 124 if endpoint != "" { 125 s.BasePath = endpoint 126 } 127 return s, nil 128 } 129 130 // New creates a new Service. It uses the provided http.Client for requests. 131 // 132 // Deprecated: please use NewService instead. 133 // To provide a custom HTTP client, use option.WithHTTPClient. 134 // If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead. 135 func New(client *http.Client) (*Service, error) { 136 if client == nil { 137 return nil, errors.New("client is nil") 138 } 139 s := &Service{client: client, BasePath: basePath} 140 s.Pools = NewPoolsService(s) 141 s.Replicas = NewReplicasService(s) 142 return s, nil 143 } 144 145 type Service struct { 146 client *http.Client 147 BasePath string // API endpoint base URL 148 UserAgent string // optional additional User-Agent fragment 149 150 Pools *PoolsService 151 152 Replicas *ReplicasService 153 } 154 155 func (s *Service) userAgent() string { 156 if s.UserAgent == "" { 157 return googleapi.UserAgent 158 } 159 return googleapi.UserAgent + " " + s.UserAgent 160 } 161 162 func NewPoolsService(s *Service) *PoolsService { 163 rs := &PoolsService{s: s} 164 return rs 165 } 166 167 type PoolsService struct { 168 s *Service 169 } 170 171 func NewReplicasService(s *Service) *ReplicasService { 172 rs := &ReplicasService{s: s} 173 return rs 174 } 175 176 type ReplicasService struct { 177 s *Service 178 } 179 180 // AccessConfig: A Compute Engine network accessConfig. Identical to the 181 // accessConfig on corresponding Compute Engine resource. 182 type AccessConfig struct { 183 // Name: Name of this access configuration. 184 Name string `json:"name,omitempty"` 185 186 // NatIp: An external IP address associated with this instance. 187 NatIp string `json:"natIp,omitempty"` 188 189 // Type: Type of this access configuration file. Currently only 190 // ONE_TO_ONE_NAT is supported. 191 Type string `json:"type,omitempty"` 192 193 // ForceSendFields is a list of field names (e.g. "Name") to 194 // unconditionally include in API requests. By default, fields with 195 // empty values are omitted from API requests. However, any non-pointer, 196 // non-interface field appearing in ForceSendFields will be sent to the 197 // server regardless of whether the field is empty or not. This may be 198 // used to include empty fields in Patch requests. 199 ForceSendFields []string `json:"-"` 200 201 // NullFields is a list of field names (e.g. "Name") to include in API 202 // requests with the JSON null value. By default, fields with empty 203 // values are omitted from API requests. However, any field with an 204 // empty value appearing in NullFields will be sent to the server as 205 // null. It is an error if a field in this list has a non-empty value. 206 // This may be used to include null fields in Patch requests. 207 NullFields []string `json:"-"` 208 } 209 210 func (s *AccessConfig) MarshalJSON() ([]byte, error) { 211 type NoMethod AccessConfig 212 raw := NoMethod(*s) 213 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 214 } 215 216 // Action: An action that gets executed during initialization of the 217 // replicas. 218 type Action struct { 219 // Commands: A list of commands to run, one per line. If any command 220 // fails, the whole action is considered a failure and no further 221 // actions are run. This also marks the virtual machine or replica as a 222 // failure. 223 Commands []string `json:"commands,omitempty"` 224 225 // EnvVariables: A list of environment variables to use for the commands 226 // in this action. 227 EnvVariables []*EnvVariable `json:"envVariables,omitempty"` 228 229 // TimeoutMilliSeconds: If an action's commands on a particular replica 230 // do not finish in the specified timeoutMilliSeconds, the replica is 231 // considered to be in a FAILING state. No efforts are made to stop any 232 // processes that were spawned or created as the result of running the 233 // action's commands. The default is the max allowed value, 1 hour (i.e. 234 // 3600000 milliseconds). 235 TimeoutMilliSeconds int64 `json:"timeoutMilliSeconds,omitempty"` 236 237 // ForceSendFields is a list of field names (e.g. "Commands") to 238 // unconditionally include in API requests. By default, fields with 239 // empty values are omitted from API requests. However, any non-pointer, 240 // non-interface field appearing in ForceSendFields will be sent to the 241 // server regardless of whether the field is empty or not. This may be 242 // used to include empty fields in Patch requests. 243 ForceSendFields []string `json:"-"` 244 245 // NullFields is a list of field names (e.g. "Commands") to include in 246 // API requests with the JSON null value. By default, fields with empty 247 // values are omitted from API requests. However, any field with an 248 // empty value appearing in NullFields will be sent to the server as 249 // null. It is an error if a field in this list has a non-empty value. 250 // This may be used to include null fields in Patch requests. 251 NullFields []string `json:"-"` 252 } 253 254 func (s *Action) MarshalJSON() ([]byte, error) { 255 type NoMethod Action 256 raw := NoMethod(*s) 257 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 258 } 259 260 // DiskAttachment: Specifies how to attach a disk to a Replica. 261 type DiskAttachment struct { 262 // DeviceName: The device name of this disk. 263 DeviceName string `json:"deviceName,omitempty"` 264 265 // Index: A zero-based index to assign to this disk, where 0 is reserved 266 // for the boot disk. If not specified, this is assigned by the server. 267 Index int64 `json:"index,omitempty"` 268 269 // ForceSendFields is a list of field names (e.g. "DeviceName") to 270 // unconditionally include in API requests. By default, fields with 271 // empty values are omitted from API requests. However, any non-pointer, 272 // non-interface field appearing in ForceSendFields will be sent to the 273 // server regardless of whether the field is empty or not. This may be 274 // used to include empty fields in Patch requests. 275 ForceSendFields []string `json:"-"` 276 277 // NullFields is a list of field names (e.g. "DeviceName") to include in 278 // API requests with the JSON null value. By default, fields with empty 279 // values are omitted from API requests. However, any field with an 280 // empty value appearing in NullFields will be sent to the server as 281 // null. It is an error if a field in this list has a non-empty value. 282 // This may be used to include null fields in Patch requests. 283 NullFields []string `json:"-"` 284 } 285 286 func (s *DiskAttachment) MarshalJSON() ([]byte, error) { 287 type NoMethod DiskAttachment 288 raw := NoMethod(*s) 289 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 290 } 291 292 // EnvVariable: An environment variable to set for an action. 293 type EnvVariable struct { 294 // Hidden: Deprecated, do not use. 295 Hidden bool `json:"hidden,omitempty"` 296 297 // Name: The name of the environment variable. 298 Name string `json:"name,omitempty"` 299 300 // Value: The value of the variable. 301 Value string `json:"value,omitempty"` 302 303 // ForceSendFields is a list of field names (e.g. "Hidden") to 304 // unconditionally include in API requests. By default, fields with 305 // empty values are omitted from API requests. However, any non-pointer, 306 // non-interface field appearing in ForceSendFields will be sent to the 307 // server regardless of whether the field is empty or not. This may be 308 // used to include empty fields in Patch requests. 309 ForceSendFields []string `json:"-"` 310 311 // NullFields is a list of field names (e.g. "Hidden") to include in API 312 // requests with the JSON null value. By default, fields with empty 313 // values are omitted from API requests. However, any field with an 314 // empty value appearing in NullFields will be sent to the server as 315 // null. It is an error if a field in this list has a non-empty value. 316 // This may be used to include null fields in Patch requests. 317 NullFields []string `json:"-"` 318 } 319 320 func (s *EnvVariable) MarshalJSON() ([]byte, error) { 321 type NoMethod EnvVariable 322 raw := NoMethod(*s) 323 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 324 } 325 326 // ExistingDisk: A pre-existing persistent disk that will be attached to 327 // every Replica in the Pool in READ_ONLY mode. 328 type ExistingDisk struct { 329 // Attachment: How the disk will be attached to the Replica. 330 Attachment *DiskAttachment `json:"attachment,omitempty"` 331 332 // Source: The name of the Persistent Disk resource. The Persistent Disk 333 // resource must be in the same zone as the Pool. 334 Source string `json:"source,omitempty"` 335 336 // ForceSendFields is a list of field names (e.g. "Attachment") to 337 // unconditionally include in API requests. By default, fields with 338 // empty values are omitted from API requests. However, any non-pointer, 339 // non-interface field appearing in ForceSendFields will be sent to the 340 // server regardless of whether the field is empty or not. This may be 341 // used to include empty fields in Patch requests. 342 ForceSendFields []string `json:"-"` 343 344 // NullFields is a list of field names (e.g. "Attachment") to include in 345 // API requests with the JSON null value. By default, fields with empty 346 // values are omitted from API requests. However, any field with an 347 // empty value appearing in NullFields will be sent to the server as 348 // null. It is an error if a field in this list has a non-empty value. 349 // This may be used to include null fields in Patch requests. 350 NullFields []string `json:"-"` 351 } 352 353 func (s *ExistingDisk) MarshalJSON() ([]byte, error) { 354 type NoMethod ExistingDisk 355 raw := NoMethod(*s) 356 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 357 } 358 359 type HealthCheck struct { 360 // CheckIntervalSec: How often (in seconds) to make HTTP requests for 361 // this healthcheck. The default value is 5 seconds. 362 CheckIntervalSec int64 `json:"checkIntervalSec,omitempty"` 363 364 // Description: The description for this health check. 365 Description string `json:"description,omitempty"` 366 367 // HealthyThreshold: The number of consecutive health check requests 368 // that need to succeed before the replica is considered healthy again. 369 // The default value is 2. 370 HealthyThreshold int64 `json:"healthyThreshold,omitempty"` 371 372 // Host: The value of the host header in the HTTP health check request. 373 // If left empty (default value), the localhost IP 127.0.0.1 will be 374 // used. 375 Host string `json:"host,omitempty"` 376 377 // Name: The name of this health check. 378 Name string `json:"name,omitempty"` 379 380 // Path: The localhost request path to send this health check, in the 381 // format /path/to/use. For example, /healthcheck. 382 Path string `json:"path,omitempty"` 383 384 // Port: The TCP port for the health check requests. 385 Port int64 `json:"port,omitempty"` 386 387 // TimeoutSec: How long (in seconds) to wait before a timeout failure 388 // for this healthcheck. The default value is 5 seconds. 389 TimeoutSec int64 `json:"timeoutSec,omitempty"` 390 391 // UnhealthyThreshold: The number of consecutive health check requests 392 // that need to fail in order to consider the replica unhealthy. The 393 // default value is 2. 394 UnhealthyThreshold int64 `json:"unhealthyThreshold,omitempty"` 395 396 // ForceSendFields is a list of field names (e.g. "CheckIntervalSec") to 397 // unconditionally include in API requests. By default, fields with 398 // empty values are omitted from API requests. However, any non-pointer, 399 // non-interface field appearing in ForceSendFields will be sent to the 400 // server regardless of whether the field is empty or not. This may be 401 // used to include empty fields in Patch requests. 402 ForceSendFields []string `json:"-"` 403 404 // NullFields is a list of field names (e.g. "CheckIntervalSec") to 405 // include in API requests with the JSON null value. By default, fields 406 // with empty values are omitted from API requests. However, any field 407 // with an empty value appearing in NullFields will be sent to the 408 // server as null. It is an error if a field in this list has a 409 // non-empty value. This may be used to include null fields in Patch 410 // requests. 411 NullFields []string `json:"-"` 412 } 413 414 func (s *HealthCheck) MarshalJSON() ([]byte, error) { 415 type NoMethod HealthCheck 416 raw := NoMethod(*s) 417 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 418 } 419 420 // Label: A label to apply to this replica pool. 421 type Label struct { 422 // Key: The key for this label. 423 Key string `json:"key,omitempty"` 424 425 // Value: The value of this label. 426 Value string `json:"value,omitempty"` 427 428 // ForceSendFields is a list of field names (e.g. "Key") to 429 // unconditionally include in API requests. By default, fields with 430 // empty values are omitted from API requests. However, any non-pointer, 431 // non-interface field appearing in ForceSendFields will be sent to the 432 // server regardless of whether the field is empty or not. This may be 433 // used to include empty fields in Patch requests. 434 ForceSendFields []string `json:"-"` 435 436 // NullFields is a list of field names (e.g. "Key") to include in API 437 // requests with the JSON null value. By default, fields with empty 438 // values are omitted from API requests. However, any field with an 439 // empty value appearing in NullFields will be sent to the server as 440 // null. It is an error if a field in this list has a non-empty value. 441 // This may be used to include null fields in Patch requests. 442 NullFields []string `json:"-"` 443 } 444 445 func (s *Label) MarshalJSON() ([]byte, error) { 446 type NoMethod Label 447 raw := NoMethod(*s) 448 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 449 } 450 451 // Metadata: A Compute Engine metadata entry. Identical to the metadata 452 // on the corresponding Compute Engine resource. 453 type Metadata struct { 454 // FingerPrint: The fingerprint of the metadata. Required for updating 455 // the metadata entries for this instance. 456 FingerPrint string `json:"fingerPrint,omitempty"` 457 458 // Items: A list of metadata items. 459 Items []*MetadataItem `json:"items,omitempty"` 460 461 // ForceSendFields is a list of field names (e.g. "FingerPrint") to 462 // unconditionally include in API requests. By default, fields with 463 // empty values are omitted from API requests. However, any non-pointer, 464 // non-interface field appearing in ForceSendFields will be sent to the 465 // server regardless of whether the field is empty or not. This may be 466 // used to include empty fields in Patch requests. 467 ForceSendFields []string `json:"-"` 468 469 // NullFields is a list of field names (e.g. "FingerPrint") to include 470 // in API requests with the JSON null value. By default, fields with 471 // empty values are omitted from API requests. However, any field with 472 // an empty value appearing in NullFields will be sent to the server as 473 // null. It is an error if a field in this list has a non-empty value. 474 // This may be used to include null fields in Patch requests. 475 NullFields []string `json:"-"` 476 } 477 478 func (s *Metadata) MarshalJSON() ([]byte, error) { 479 type NoMethod Metadata 480 raw := NoMethod(*s) 481 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 482 } 483 484 // MetadataItem: A Compute Engine metadata item, defined as a key:value 485 // pair. Identical to the metadata on the corresponding Compute Engine 486 // resource. 487 type MetadataItem struct { 488 // Key: A metadata key. 489 Key string `json:"key,omitempty"` 490 491 // Value: A metadata value. 492 Value string `json:"value,omitempty"` 493 494 // ForceSendFields is a list of field names (e.g. "Key") to 495 // unconditionally include in API requests. By default, fields with 496 // empty values are omitted from API requests. However, any non-pointer, 497 // non-interface field appearing in ForceSendFields will be sent to the 498 // server regardless of whether the field is empty or not. This may be 499 // used to include empty fields in Patch requests. 500 ForceSendFields []string `json:"-"` 501 502 // NullFields is a list of field names (e.g. "Key") to include in API 503 // requests with the JSON null value. By default, fields with empty 504 // values are omitted from API requests. However, any field with an 505 // empty value appearing in NullFields will be sent to the server as 506 // null. It is an error if a field in this list has a non-empty value. 507 // This may be used to include null fields in Patch requests. 508 NullFields []string `json:"-"` 509 } 510 511 func (s *MetadataItem) MarshalJSON() ([]byte, error) { 512 type NoMethod MetadataItem 513 raw := NoMethod(*s) 514 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 515 } 516 517 // NetworkInterface: A Compute Engine NetworkInterface resource. 518 // Identical to the NetworkInterface on the corresponding Compute Engine 519 // resource. 520 type NetworkInterface struct { 521 // AccessConfigs: An array of configurations for this interface. This 522 // specifies how this interface is configured to interact with other 523 // network services. 524 AccessConfigs []*AccessConfig `json:"accessConfigs,omitempty"` 525 526 // Network: Name the Network resource to which this interface applies. 527 Network string `json:"network,omitempty"` 528 529 // NetworkIp: An optional IPV4 internal network address to assign to the 530 // instance for this network interface. 531 NetworkIp string `json:"networkIp,omitempty"` 532 533 // ForceSendFields is a list of field names (e.g. "AccessConfigs") to 534 // unconditionally include in API requests. By default, fields with 535 // empty values are omitted from API requests. However, any non-pointer, 536 // non-interface field appearing in ForceSendFields will be sent to the 537 // server regardless of whether the field is empty or not. This may be 538 // used to include empty fields in Patch requests. 539 ForceSendFields []string `json:"-"` 540 541 // NullFields is a list of field names (e.g. "AccessConfigs") to include 542 // in API requests with the JSON null value. By default, fields with 543 // empty values are omitted from API requests. However, any field with 544 // an empty value appearing in NullFields will be sent to the server as 545 // null. It is an error if a field in this list has a non-empty value. 546 // This may be used to include null fields in Patch requests. 547 NullFields []string `json:"-"` 548 } 549 550 func (s *NetworkInterface) MarshalJSON() ([]byte, error) { 551 type NoMethod NetworkInterface 552 raw := NoMethod(*s) 553 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 554 } 555 556 // NewDisk: A Persistent Disk resource that will be created and attached 557 // to each Replica in the Pool. Each Replica will have a unique 558 // persistent disk that is created and attached to that Replica in 559 // READ_WRITE mode. 560 type NewDisk struct { 561 // Attachment: How the disk will be attached to the Replica. 562 Attachment *DiskAttachment `json:"attachment,omitempty"` 563 564 // AutoDelete: If true, then this disk will be deleted when the instance 565 // is deleted. The default value is true. 566 AutoDelete bool `json:"autoDelete,omitempty"` 567 568 // Boot: If true, indicates that this is the root persistent disk. 569 Boot bool `json:"boot,omitempty"` 570 571 // InitializeParams: Create the new disk using these parameters. The 572 // name of the disk will be <instance_name>-<four_random_charactersgt;. 573 InitializeParams *NewDiskInitializeParams `json:"initializeParams,omitempty"` 574 575 // ForceSendFields is a list of field names (e.g. "Attachment") to 576 // unconditionally include in API requests. By default, fields with 577 // empty values are omitted from API requests. However, any non-pointer, 578 // non-interface field appearing in ForceSendFields will be sent to the 579 // server regardless of whether the field is empty or not. This may be 580 // used to include empty fields in Patch requests. 581 ForceSendFields []string `json:"-"` 582 583 // NullFields is a list of field names (e.g. "Attachment") to include in 584 // API requests with the JSON null value. By default, fields with empty 585 // values are omitted from API requests. However, any field with an 586 // empty value appearing in NullFields will be sent to the server as 587 // null. It is an error if a field in this list has a non-empty value. 588 // This may be used to include null fields in Patch requests. 589 NullFields []string `json:"-"` 590 } 591 592 func (s *NewDisk) MarshalJSON() ([]byte, error) { 593 type NoMethod NewDisk 594 raw := NoMethod(*s) 595 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 596 } 597 598 // NewDiskInitializeParams: Initialization parameters for creating a new 599 // disk. 600 type NewDiskInitializeParams struct { 601 // DiskSizeGb: The size of the created disk in gigabytes. 602 DiskSizeGb int64 `json:"diskSizeGb,omitempty,string"` 603 604 // DiskType: Name of the disk type resource describing which disk type 605 // to use to create the disk. For example 'pd-ssd' or 'pd-standard'. 606 // Default is 'pd-standard' 607 DiskType string `json:"diskType,omitempty"` 608 609 // SourceImage: The name or fully-qualified URL of a source image to use 610 // to create this disk. If you provide a name of the source image, 611 // Replica Pool will look for an image with that name in your project. 612 // If you are specifying an image provided by Compute Engine, you will 613 // need to provide the full URL with the correct project, such 614 // as: 615 // http://www.googleapis.com/compute/v1/projects/debian-cloud/ 616 // global/images/debian-wheezy-7-vYYYYMMDD 617 SourceImage string `json:"sourceImage,omitempty"` 618 619 // ForceSendFields is a list of field names (e.g. "DiskSizeGb") to 620 // unconditionally include in API requests. By default, fields with 621 // empty values are omitted from API requests. However, any non-pointer, 622 // non-interface field appearing in ForceSendFields will be sent to the 623 // server regardless of whether the field is empty or not. This may be 624 // used to include empty fields in Patch requests. 625 ForceSendFields []string `json:"-"` 626 627 // NullFields is a list of field names (e.g. "DiskSizeGb") to include in 628 // API requests with the JSON null value. By default, fields with empty 629 // values are omitted from API requests. However, any field with an 630 // empty value appearing in NullFields will be sent to the server as 631 // null. It is an error if a field in this list has a non-empty value. 632 // This may be used to include null fields in Patch requests. 633 NullFields []string `json:"-"` 634 } 635 636 func (s *NewDiskInitializeParams) MarshalJSON() ([]byte, error) { 637 type NoMethod NewDiskInitializeParams 638 raw := NoMethod(*s) 639 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 640 } 641 642 type Pool struct { 643 // AutoRestart: Whether replicas in this pool should be restarted if 644 // they experience a failure. The default value is true. 645 AutoRestart bool `json:"autoRestart,omitempty"` 646 647 // BaseInstanceName: The base instance name to use for the replicas in 648 // this pool. This must match the regex [a-z]([-a-z0-9]*[a-z0-9])?. If 649 // specified, the instances in this replica pool will be named in the 650 // format <base-instance-name>-<ID>. The <ID> postfix will be a four 651 // character alphanumeric identifier generated by the service. 652 // 653 // If this is not specified by the user, a random base instance name is 654 // generated by the service. 655 BaseInstanceName string `json:"baseInstanceName,omitempty"` 656 657 // CurrentNumReplicas: [Output Only] The current number of replicas in 658 // the pool. 659 CurrentNumReplicas int64 `json:"currentNumReplicas,omitempty"` 660 661 // Description: An optional description of the replica pool. 662 Description string `json:"description,omitempty"` 663 664 // HealthChecks: Deprecated. Please use template[].healthChecks instead. 665 HealthChecks []*HealthCheck `json:"healthChecks,omitempty"` 666 667 // InitialNumReplicas: The initial number of replicas this pool should 668 // have. You must provide a value greater than or equal to 0. 669 InitialNumReplicas int64 `json:"initialNumReplicas,omitempty"` 670 671 // Labels: A list of labels to attach to this replica pool and all 672 // created virtual machines in this replica pool. 673 Labels []*Label `json:"labels,omitempty"` 674 675 // Name: The name of the replica pool. Must follow the regex 676 // [a-z]([-a-z0-9]*[a-z0-9])? and be 1-28 characters long. 677 Name string `json:"name,omitempty"` 678 679 // NumReplicas: Deprecated! Use initial_num_replicas instead. 680 NumReplicas int64 `json:"numReplicas,omitempty"` 681 682 // ResourceViews: The list of resource views that should be updated with 683 // all the replicas that are managed by this pool. 684 ResourceViews []string `json:"resourceViews,omitempty"` 685 686 // SelfLink: [Output Only] A self-link to the replica pool. 687 SelfLink string `json:"selfLink,omitempty"` 688 689 // TargetPool: Deprecated, please use target_pools instead. 690 TargetPool string `json:"targetPool,omitempty"` 691 692 // TargetPools: A list of target pools to update with the replicas that 693 // are managed by this pool. If specified, the replicas in this replica 694 // pool will be added to the specified target pools for load balancing 695 // purposes. The replica pool must live in the same region as the 696 // specified target pools. These values must be the target pool resource 697 // names, and not fully qualified URLs. 698 TargetPools []string `json:"targetPools,omitempty"` 699 700 // Template: The template to use when creating replicas in this pool. 701 // This template is used during initial instance creation of the pool, 702 // when growing the pool in size, or when a replica restarts. 703 Template *Template `json:"template,omitempty"` 704 705 // Type: Deprecated! Do not set. 706 Type string `json:"type,omitempty"` 707 708 // ServerResponse contains the HTTP response code and headers from the 709 // server. 710 googleapi.ServerResponse `json:"-"` 711 712 // ForceSendFields is a list of field names (e.g. "AutoRestart") to 713 // unconditionally include in API requests. By default, fields with 714 // empty values are omitted from API requests. However, any non-pointer, 715 // non-interface field appearing in ForceSendFields will be sent to the 716 // server regardless of whether the field is empty or not. This may be 717 // used to include empty fields in Patch requests. 718 ForceSendFields []string `json:"-"` 719 720 // NullFields is a list of field names (e.g. "AutoRestart") to include 721 // in API requests with the JSON null value. By default, fields with 722 // empty values are omitted from API requests. However, any field with 723 // an empty value appearing in NullFields will be sent to the server as 724 // null. It is an error if a field in this list has a non-empty value. 725 // This may be used to include null fields in Patch requests. 726 NullFields []string `json:"-"` 727 } 728 729 func (s *Pool) MarshalJSON() ([]byte, error) { 730 type NoMethod Pool 731 raw := NoMethod(*s) 732 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 733 } 734 735 type PoolsDeleteRequest struct { 736 // AbandonInstances: If there are instances you would like to keep, you 737 // can specify them here. These instances won't be deleted, but the 738 // associated replica objects will be removed. 739 AbandonInstances []string `json:"abandonInstances,omitempty"` 740 741 // ForceSendFields is a list of field names (e.g. "AbandonInstances") to 742 // unconditionally include in API requests. By default, fields with 743 // empty values are omitted from API requests. However, any non-pointer, 744 // non-interface field appearing in ForceSendFields will be sent to the 745 // server regardless of whether the field is empty or not. This may be 746 // used to include empty fields in Patch requests. 747 ForceSendFields []string `json:"-"` 748 749 // NullFields is a list of field names (e.g. "AbandonInstances") to 750 // include in API requests with the JSON null value. By default, fields 751 // with empty values are omitted from API requests. However, any field 752 // with an empty value appearing in NullFields will be sent to the 753 // server as null. It is an error if a field in this list has a 754 // non-empty value. This may be used to include null fields in Patch 755 // requests. 756 NullFields []string `json:"-"` 757 } 758 759 func (s *PoolsDeleteRequest) MarshalJSON() ([]byte, error) { 760 type NoMethod PoolsDeleteRequest 761 raw := NoMethod(*s) 762 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 763 } 764 765 type PoolsListResponse struct { 766 NextPageToken string `json:"nextPageToken,omitempty"` 767 768 Resources []*Pool `json:"resources,omitempty"` 769 770 // ServerResponse contains the HTTP response code and headers from the 771 // server. 772 googleapi.ServerResponse `json:"-"` 773 774 // ForceSendFields is a list of field names (e.g. "NextPageToken") to 775 // unconditionally include in API requests. By default, fields with 776 // empty values are omitted from API requests. However, any non-pointer, 777 // non-interface field appearing in ForceSendFields will be sent to the 778 // server regardless of whether the field is empty or not. This may be 779 // used to include empty fields in Patch requests. 780 ForceSendFields []string `json:"-"` 781 782 // NullFields is a list of field names (e.g. "NextPageToken") to include 783 // in API requests with the JSON null value. By default, fields with 784 // empty values are omitted from API requests. However, any field with 785 // an empty value appearing in NullFields will be sent to the server as 786 // null. It is an error if a field in this list has a non-empty value. 787 // This may be used to include null fields in Patch requests. 788 NullFields []string `json:"-"` 789 } 790 791 func (s *PoolsListResponse) MarshalJSON() ([]byte, error) { 792 type NoMethod PoolsListResponse 793 raw := NoMethod(*s) 794 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 795 } 796 797 // Replica: An individual Replica within a Pool. Replicas are 798 // automatically created by the replica pool, using the template 799 // provided by the user. You cannot directly create replicas. 800 type Replica struct { 801 // Name: [Output Only] The name of the Replica object. 802 Name string `json:"name,omitempty"` 803 804 // SelfLink: [Output Only] The self-link of the Replica. 805 SelfLink string `json:"selfLink,omitempty"` 806 807 // Status: [Output Only] Last known status of the Replica. 808 Status *ReplicaStatus `json:"status,omitempty"` 809 810 // ServerResponse contains the HTTP response code and headers from the 811 // server. 812 googleapi.ServerResponse `json:"-"` 813 814 // ForceSendFields is a list of field names (e.g. "Name") to 815 // unconditionally include in API requests. By default, fields with 816 // empty values are omitted from API requests. However, any non-pointer, 817 // non-interface field appearing in ForceSendFields will be sent to the 818 // server regardless of whether the field is empty or not. This may be 819 // used to include empty fields in Patch requests. 820 ForceSendFields []string `json:"-"` 821 822 // NullFields is a list of field names (e.g. "Name") to include in API 823 // requests with the JSON null value. By default, fields with empty 824 // values are omitted from API requests. However, any field with an 825 // empty value appearing in NullFields will be sent to the server as 826 // null. It is an error if a field in this list has a non-empty value. 827 // This may be used to include null fields in Patch requests. 828 NullFields []string `json:"-"` 829 } 830 831 func (s *Replica) MarshalJSON() ([]byte, error) { 832 type NoMethod Replica 833 raw := NoMethod(*s) 834 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 835 } 836 837 // ReplicaStatus: The current status of a Replica. 838 type ReplicaStatus struct { 839 // Details: [Output Only] Human-readable details about the current state 840 // of the replica 841 Details string `json:"details,omitempty"` 842 843 // State: [Output Only] The state of the Replica. 844 State string `json:"state,omitempty"` 845 846 // TemplateVersion: [Output Only] The template used to build the 847 // replica. 848 TemplateVersion string `json:"templateVersion,omitempty"` 849 850 // VmLink: [Output Only] Link to the virtual machine that this Replica 851 // represents. 852 VmLink string `json:"vmLink,omitempty"` 853 854 // VmStartTime: [Output Only] The time that this Replica got to the 855 // RUNNING state, in RFC 3339 format. If the start time is unknown, 856 // UNKNOWN is returned. 857 VmStartTime string `json:"vmStartTime,omitempty"` 858 859 // ForceSendFields is a list of field names (e.g. "Details") to 860 // unconditionally include in API requests. By default, fields with 861 // empty values are omitted from API requests. However, any non-pointer, 862 // non-interface field appearing in ForceSendFields will be sent to the 863 // server regardless of whether the field is empty or not. This may be 864 // used to include empty fields in Patch requests. 865 ForceSendFields []string `json:"-"` 866 867 // NullFields is a list of field names (e.g. "Details") to include in 868 // API requests with the JSON null value. By default, fields with empty 869 // values are omitted from API requests. However, any field with an 870 // empty value appearing in NullFields will be sent to the server as 871 // null. It is an error if a field in this list has a non-empty value. 872 // This may be used to include null fields in Patch requests. 873 NullFields []string `json:"-"` 874 } 875 876 func (s *ReplicaStatus) MarshalJSON() ([]byte, error) { 877 type NoMethod ReplicaStatus 878 raw := NoMethod(*s) 879 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 880 } 881 882 type ReplicasDeleteRequest struct { 883 // AbandonInstance: Whether the instance resource represented by this 884 // replica should be deleted or abandoned. If abandoned, the replica 885 // will be deleted but the virtual machine instance will remain. By 886 // default, this is set to false and the instance will be deleted along 887 // with the replica. 888 AbandonInstance bool `json:"abandonInstance,omitempty"` 889 890 // ForceSendFields is a list of field names (e.g. "AbandonInstance") to 891 // unconditionally include in API requests. By default, fields with 892 // empty values are omitted from API requests. However, any non-pointer, 893 // non-interface field appearing in ForceSendFields will be sent to the 894 // server regardless of whether the field is empty or not. This may be 895 // used to include empty fields in Patch requests. 896 ForceSendFields []string `json:"-"` 897 898 // NullFields is a list of field names (e.g. "AbandonInstance") to 899 // include in API requests with the JSON null value. By default, fields 900 // with empty values are omitted from API requests. However, any field 901 // with an empty value appearing in NullFields will be sent to the 902 // server as null. It is an error if a field in this list has a 903 // non-empty value. This may be used to include null fields in Patch 904 // requests. 905 NullFields []string `json:"-"` 906 } 907 908 func (s *ReplicasDeleteRequest) MarshalJSON() ([]byte, error) { 909 type NoMethod ReplicasDeleteRequest 910 raw := NoMethod(*s) 911 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 912 } 913 914 type ReplicasListResponse struct { 915 NextPageToken string `json:"nextPageToken,omitempty"` 916 917 Resources []*Replica `json:"resources,omitempty"` 918 919 // ServerResponse contains the HTTP response code and headers from the 920 // server. 921 googleapi.ServerResponse `json:"-"` 922 923 // ForceSendFields is a list of field names (e.g. "NextPageToken") to 924 // unconditionally include in API requests. By default, fields with 925 // empty values are omitted from API requests. However, any non-pointer, 926 // non-interface field appearing in ForceSendFields will be sent to the 927 // server regardless of whether the field is empty or not. This may be 928 // used to include empty fields in Patch requests. 929 ForceSendFields []string `json:"-"` 930 931 // NullFields is a list of field names (e.g. "NextPageToken") to include 932 // in API requests with the JSON null value. By default, fields with 933 // empty values are omitted from API requests. However, any field with 934 // an empty value appearing in NullFields will be sent to the server as 935 // null. It is an error if a field in this list has a non-empty value. 936 // This may be used to include null fields in Patch requests. 937 NullFields []string `json:"-"` 938 } 939 940 func (s *ReplicasListResponse) MarshalJSON() ([]byte, error) { 941 type NoMethod ReplicasListResponse 942 raw := NoMethod(*s) 943 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 944 } 945 946 // ServiceAccount: A Compute Engine service account, identical to the 947 // Compute Engine resource. 948 type ServiceAccount struct { 949 // Email: The service account email address, for example: 950 // 123845678986@project.gserviceaccount.com 951 Email string `json:"email,omitempty"` 952 953 // Scopes: The list of OAuth2 scopes to obtain for the service account, 954 // for example: https://www.googleapis.com/auth/devstorage.full_control 955 Scopes []string `json:"scopes,omitempty"` 956 957 // ForceSendFields is a list of field names (e.g. "Email") to 958 // unconditionally include in API requests. By default, fields with 959 // empty values are omitted from API requests. However, any non-pointer, 960 // non-interface field appearing in ForceSendFields will be sent to the 961 // server regardless of whether the field is empty or not. This may be 962 // used to include empty fields in Patch requests. 963 ForceSendFields []string `json:"-"` 964 965 // NullFields is a list of field names (e.g. "Email") to include in API 966 // requests with the JSON null value. By default, fields with empty 967 // values are omitted from API requests. However, any field with an 968 // empty value appearing in NullFields will be sent to the server as 969 // null. It is an error if a field in this list has a non-empty value. 970 // This may be used to include null fields in Patch requests. 971 NullFields []string `json:"-"` 972 } 973 974 func (s *ServiceAccount) MarshalJSON() ([]byte, error) { 975 type NoMethod ServiceAccount 976 raw := NoMethod(*s) 977 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 978 } 979 980 // Tag: A Compute Engine Instance tag, identical to the tags on the 981 // corresponding Compute Engine Instance resource. 982 type Tag struct { 983 // FingerPrint: The fingerprint of the tag. Required for updating the 984 // list of tags. 985 FingerPrint string `json:"fingerPrint,omitempty"` 986 987 // Items: Items contained in this tag. 988 Items []string `json:"items,omitempty"` 989 990 // ForceSendFields is a list of field names (e.g. "FingerPrint") to 991 // unconditionally include in API requests. By default, fields with 992 // empty values are omitted from API requests. However, any non-pointer, 993 // non-interface field appearing in ForceSendFields will be sent to the 994 // server regardless of whether the field is empty or not. This may be 995 // used to include empty fields in Patch requests. 996 ForceSendFields []string `json:"-"` 997 998 // NullFields is a list of field names (e.g. "FingerPrint") to include 999 // in API requests with the JSON null value. By default, fields with 1000 // empty values are omitted from API requests. However, any field with 1001 // an empty value appearing in NullFields will be sent to the server as 1002 // null. It is an error if a field in this list has a non-empty value. 1003 // This may be used to include null fields in Patch requests. 1004 NullFields []string `json:"-"` 1005 } 1006 1007 func (s *Tag) MarshalJSON() ([]byte, error) { 1008 type NoMethod Tag 1009 raw := NoMethod(*s) 1010 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1011 } 1012 1013 // Template: The template used for creating replicas in the pool. 1014 type Template struct { 1015 // Action: An action to run during initialization of your replicas. An 1016 // action is run as shell commands which are executed one after the 1017 // other in the same bash shell, so any state established by one command 1018 // is inherited by later commands. 1019 Action *Action `json:"action,omitempty"` 1020 1021 // HealthChecks: A list of HTTP Health Checks to configure for this 1022 // replica pool and all virtual machines in this replica pool. 1023 HealthChecks []*HealthCheck `json:"healthChecks,omitempty"` 1024 1025 // Version: A free-form string describing the version of this template. 1026 // You can provide any versioning string you would like. For example, 1027 // version1 or template-v1. 1028 Version string `json:"version,omitempty"` 1029 1030 // VmParams: The virtual machine parameters to use for creating 1031 // replicas. You can define settings such as the machine type and the 1032 // image of replicas in this pool. This is required if replica type is 1033 // SMART_VM. 1034 VmParams *VmParams `json:"vmParams,omitempty"` 1035 1036 // ForceSendFields is a list of field names (e.g. "Action") to 1037 // unconditionally include in API requests. By default, fields with 1038 // empty values are omitted from API requests. However, any non-pointer, 1039 // non-interface field appearing in ForceSendFields will be sent to the 1040 // server regardless of whether the field is empty or not. This may be 1041 // used to include empty fields in Patch requests. 1042 ForceSendFields []string `json:"-"` 1043 1044 // NullFields is a list of field names (e.g. "Action") to include in API 1045 // requests with the JSON null value. By default, fields with empty 1046 // values are omitted from API requests. However, any field with an 1047 // empty value appearing in NullFields will be sent to the server as 1048 // null. It is an error if a field in this list has a non-empty value. 1049 // This may be used to include null fields in Patch requests. 1050 NullFields []string `json:"-"` 1051 } 1052 1053 func (s *Template) MarshalJSON() ([]byte, error) { 1054 type NoMethod Template 1055 raw := NoMethod(*s) 1056 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1057 } 1058 1059 // VmParams: Parameters for creating a Compute Engine Instance resource. 1060 // Most fields are identical to the corresponding Compute Engine 1061 // resource. 1062 type VmParams struct { 1063 // BaseInstanceName: Deprecated. Please use baseInstanceName instead. 1064 BaseInstanceName string `json:"baseInstanceName,omitempty"` 1065 1066 // CanIpForward: Enables IP Forwarding, which allows this instance to 1067 // receive packets destined for a different IP address, and send packets 1068 // with a different source IP. See IP Forwarding for more information. 1069 CanIpForward bool `json:"canIpForward,omitempty"` 1070 1071 // Description: An optional textual description of the instance. 1072 Description string `json:"description,omitempty"` 1073 1074 // DisksToAttach: A list of existing Persistent Disk resources to attach 1075 // to each replica in the pool. Each disk will be attached in read-only 1076 // mode to every replica. 1077 DisksToAttach []*ExistingDisk `json:"disksToAttach,omitempty"` 1078 1079 // DisksToCreate: A list of Disk resources to create and attach to each 1080 // Replica in the Pool. Currently, you can only define one disk and it 1081 // must be a root persistent disk. Note that Replica Pool will create a 1082 // root persistent disk for each replica. 1083 DisksToCreate []*NewDisk `json:"disksToCreate,omitempty"` 1084 1085 // MachineType: The machine type for this instance. The resource name 1086 // (e.g. n1-standard-1). 1087 MachineType string `json:"machineType,omitempty"` 1088 1089 // Metadata: The metadata key/value pairs assigned to this instance. 1090 Metadata *Metadata `json:"metadata,omitempty"` 1091 1092 // NetworkInterfaces: A list of network interfaces for the instance. 1093 // Currently only one interface is supported by Google Compute Engine, 1094 // ONE_TO_ONE_NAT. 1095 NetworkInterfaces []*NetworkInterface `json:"networkInterfaces,omitempty"` 1096 1097 OnHostMaintenance string `json:"onHostMaintenance,omitempty"` 1098 1099 // ServiceAccounts: A list of Service Accounts to enable for this 1100 // instance. 1101 ServiceAccounts []*ServiceAccount `json:"serviceAccounts,omitempty"` 1102 1103 // Tags: A list of tags to apply to the Google Compute Engine instance 1104 // to identify resources. 1105 Tags *Tag `json:"tags,omitempty"` 1106 1107 // ForceSendFields is a list of field names (e.g. "BaseInstanceName") to 1108 // unconditionally include in API requests. By default, fields with 1109 // empty values are omitted from API requests. However, any non-pointer, 1110 // non-interface field appearing in ForceSendFields will be sent to the 1111 // server regardless of whether the field is empty or not. This may be 1112 // used to include empty fields in Patch requests. 1113 ForceSendFields []string `json:"-"` 1114 1115 // NullFields is a list of field names (e.g. "BaseInstanceName") to 1116 // include in API requests with the JSON null value. By default, fields 1117 // with empty values are omitted from API requests. However, any field 1118 // with an empty value appearing in NullFields will be sent to the 1119 // server as null. It is an error if a field in this list has a 1120 // non-empty value. This may be used to include null fields in Patch 1121 // requests. 1122 NullFields []string `json:"-"` 1123 } 1124 1125 func (s *VmParams) MarshalJSON() ([]byte, error) { 1126 type NoMethod VmParams 1127 raw := NoMethod(*s) 1128 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1129 } 1130 1131 // method id "replicapool.pools.delete": 1132 1133 type PoolsDeleteCall struct { 1134 s *Service 1135 projectName string 1136 zone string 1137 poolName string 1138 poolsdeleterequest *PoolsDeleteRequest 1139 urlParams_ gensupport.URLParams 1140 ctx_ context.Context 1141 header_ http.Header 1142 } 1143 1144 // Delete: Deletes a replica pool. 1145 func (r *PoolsService) Delete(projectName string, zone string, poolName string, poolsdeleterequest *PoolsDeleteRequest) *PoolsDeleteCall { 1146 c := &PoolsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1147 c.projectName = projectName 1148 c.zone = zone 1149 c.poolName = poolName 1150 c.poolsdeleterequest = poolsdeleterequest 1151 return c 1152 } 1153 1154 // Fields allows partial responses to be retrieved. See 1155 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1156 // for more information. 1157 func (c *PoolsDeleteCall) Fields(s ...googleapi.Field) *PoolsDeleteCall { 1158 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1159 return c 1160 } 1161 1162 // Context sets the context to be used in this call's Do method. Any 1163 // pending HTTP request will be aborted if the provided context is 1164 // canceled. 1165 func (c *PoolsDeleteCall) Context(ctx context.Context) *PoolsDeleteCall { 1166 c.ctx_ = ctx 1167 return c 1168 } 1169 1170 // Header returns an http.Header that can be modified by the caller to 1171 // add HTTP headers to the request. 1172 func (c *PoolsDeleteCall) Header() http.Header { 1173 if c.header_ == nil { 1174 c.header_ = make(http.Header) 1175 } 1176 return c.header_ 1177 } 1178 1179 func (c *PoolsDeleteCall) doRequest(alt string) (*http.Response, error) { 1180 reqHeaders := make(http.Header) 1181 reqHeaders.Set("x-goog-api-client", "gl-go/1.13.7 gdcl/20200203") 1182 for k, v := range c.header_ { 1183 reqHeaders[k] = v 1184 } 1185 reqHeaders.Set("User-Agent", c.s.userAgent()) 1186 var body io.Reader = nil 1187 body, err := googleapi.WithoutDataWrapper.JSONReader(c.poolsdeleterequest) 1188 if err != nil { 1189 return nil, err 1190 } 1191 reqHeaders.Set("Content-Type", "application/json") 1192 c.urlParams_.Set("alt", alt) 1193 c.urlParams_.Set("prettyPrint", "false") 1194 urls := googleapi.ResolveRelative(c.s.BasePath, "{projectName}/zones/{zone}/pools/{poolName}") 1195 urls += "?" + c.urlParams_.Encode() 1196 req, err := http.NewRequest("POST", urls, body) 1197 if err != nil { 1198 return nil, err 1199 } 1200 req.Header = reqHeaders 1201 googleapi.Expand(req.URL, map[string]string{ 1202 "projectName": c.projectName, 1203 "zone": c.zone, 1204 "poolName": c.poolName, 1205 }) 1206 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1207 } 1208 1209 // Do executes the "replicapool.pools.delete" call. 1210 func (c *PoolsDeleteCall) Do(opts ...googleapi.CallOption) error { 1211 gensupport.SetOptions(c.urlParams_, opts...) 1212 res, err := c.doRequest("json") 1213 if err != nil { 1214 return err 1215 } 1216 defer googleapi.CloseBody(res) 1217 if err := googleapi.CheckResponse(res); err != nil { 1218 return err 1219 } 1220 return nil 1221 // { 1222 // "description": "Deletes a replica pool.", 1223 // "httpMethod": "POST", 1224 // "id": "replicapool.pools.delete", 1225 // "parameterOrder": [ 1226 // "projectName", 1227 // "zone", 1228 // "poolName" 1229 // ], 1230 // "parameters": { 1231 // "poolName": { 1232 // "description": "The name of the replica pool for this request.", 1233 // "location": "path", 1234 // "required": true, 1235 // "type": "string" 1236 // }, 1237 // "projectName": { 1238 // "description": "The project ID for this replica pool.", 1239 // "location": "path", 1240 // "required": true, 1241 // "type": "string" 1242 // }, 1243 // "zone": { 1244 // "description": "The zone for this replica pool.", 1245 // "location": "path", 1246 // "required": true, 1247 // "type": "string" 1248 // } 1249 // }, 1250 // "path": "{projectName}/zones/{zone}/pools/{poolName}", 1251 // "request": { 1252 // "$ref": "PoolsDeleteRequest" 1253 // }, 1254 // "scopes": [ 1255 // "https://www.googleapis.com/auth/cloud-platform", 1256 // "https://www.googleapis.com/auth/ndev.cloudman", 1257 // "https://www.googleapis.com/auth/replicapool" 1258 // ] 1259 // } 1260 1261 } 1262 1263 // method id "replicapool.pools.get": 1264 1265 type PoolsGetCall struct { 1266 s *Service 1267 projectName string 1268 zone string 1269 poolName string 1270 urlParams_ gensupport.URLParams 1271 ifNoneMatch_ string 1272 ctx_ context.Context 1273 header_ http.Header 1274 } 1275 1276 // Get: Gets information about a single replica pool. 1277 func (r *PoolsService) Get(projectName string, zone string, poolName string) *PoolsGetCall { 1278 c := &PoolsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1279 c.projectName = projectName 1280 c.zone = zone 1281 c.poolName = poolName 1282 return c 1283 } 1284 1285 // Fields allows partial responses to be retrieved. See 1286 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1287 // for more information. 1288 func (c *PoolsGetCall) Fields(s ...googleapi.Field) *PoolsGetCall { 1289 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1290 return c 1291 } 1292 1293 // IfNoneMatch sets the optional parameter which makes the operation 1294 // fail if the object's ETag matches the given value. This is useful for 1295 // getting updates only after the object has changed since the last 1296 // request. Use googleapi.IsNotModified to check whether the response 1297 // error from Do is the result of In-None-Match. 1298 func (c *PoolsGetCall) IfNoneMatch(entityTag string) *PoolsGetCall { 1299 c.ifNoneMatch_ = entityTag 1300 return c 1301 } 1302 1303 // Context sets the context to be used in this call's Do method. Any 1304 // pending HTTP request will be aborted if the provided context is 1305 // canceled. 1306 func (c *PoolsGetCall) Context(ctx context.Context) *PoolsGetCall { 1307 c.ctx_ = ctx 1308 return c 1309 } 1310 1311 // Header returns an http.Header that can be modified by the caller to 1312 // add HTTP headers to the request. 1313 func (c *PoolsGetCall) Header() http.Header { 1314 if c.header_ == nil { 1315 c.header_ = make(http.Header) 1316 } 1317 return c.header_ 1318 } 1319 1320 func (c *PoolsGetCall) doRequest(alt string) (*http.Response, error) { 1321 reqHeaders := make(http.Header) 1322 reqHeaders.Set("x-goog-api-client", "gl-go/1.13.7 gdcl/20200203") 1323 for k, v := range c.header_ { 1324 reqHeaders[k] = v 1325 } 1326 reqHeaders.Set("User-Agent", c.s.userAgent()) 1327 if c.ifNoneMatch_ != "" { 1328 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 1329 } 1330 var body io.Reader = nil 1331 c.urlParams_.Set("alt", alt) 1332 c.urlParams_.Set("prettyPrint", "false") 1333 urls := googleapi.ResolveRelative(c.s.BasePath, "{projectName}/zones/{zone}/pools/{poolName}") 1334 urls += "?" + c.urlParams_.Encode() 1335 req, err := http.NewRequest("GET", urls, body) 1336 if err != nil { 1337 return nil, err 1338 } 1339 req.Header = reqHeaders 1340 googleapi.Expand(req.URL, map[string]string{ 1341 "projectName": c.projectName, 1342 "zone": c.zone, 1343 "poolName": c.poolName, 1344 }) 1345 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1346 } 1347 1348 // Do executes the "replicapool.pools.get" call. 1349 // Exactly one of *Pool or error will be non-nil. Any non-2xx status 1350 // code is an error. Response headers are in either 1351 // *Pool.ServerResponse.Header or (if a response was returned at all) in 1352 // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check 1353 // whether the returned error was because http.StatusNotModified was 1354 // returned. 1355 func (c *PoolsGetCall) Do(opts ...googleapi.CallOption) (*Pool, error) { 1356 gensupport.SetOptions(c.urlParams_, opts...) 1357 res, err := c.doRequest("json") 1358 if res != nil && res.StatusCode == http.StatusNotModified { 1359 if res.Body != nil { 1360 res.Body.Close() 1361 } 1362 return nil, &googleapi.Error{ 1363 Code: res.StatusCode, 1364 Header: res.Header, 1365 } 1366 } 1367 if err != nil { 1368 return nil, err 1369 } 1370 defer googleapi.CloseBody(res) 1371 if err := googleapi.CheckResponse(res); err != nil { 1372 return nil, err 1373 } 1374 ret := &Pool{ 1375 ServerResponse: googleapi.ServerResponse{ 1376 Header: res.Header, 1377 HTTPStatusCode: res.StatusCode, 1378 }, 1379 } 1380 target := &ret 1381 if err := gensupport.DecodeResponse(target, res); err != nil { 1382 return nil, err 1383 } 1384 return ret, nil 1385 // { 1386 // "description": "Gets information about a single replica pool.", 1387 // "httpMethod": "GET", 1388 // "id": "replicapool.pools.get", 1389 // "parameterOrder": [ 1390 // "projectName", 1391 // "zone", 1392 // "poolName" 1393 // ], 1394 // "parameters": { 1395 // "poolName": { 1396 // "description": "The name of the replica pool for this request.", 1397 // "location": "path", 1398 // "required": true, 1399 // "type": "string" 1400 // }, 1401 // "projectName": { 1402 // "description": "The project ID for this replica pool.", 1403 // "location": "path", 1404 // "required": true, 1405 // "type": "string" 1406 // }, 1407 // "zone": { 1408 // "description": "The zone for this replica pool.", 1409 // "location": "path", 1410 // "required": true, 1411 // "type": "string" 1412 // } 1413 // }, 1414 // "path": "{projectName}/zones/{zone}/pools/{poolName}", 1415 // "response": { 1416 // "$ref": "Pool" 1417 // }, 1418 // "scopes": [ 1419 // "https://www.googleapis.com/auth/cloud-platform", 1420 // "https://www.googleapis.com/auth/cloud-platform.read-only", 1421 // "https://www.googleapis.com/auth/ndev.cloudman", 1422 // "https://www.googleapis.com/auth/ndev.cloudman.readonly", 1423 // "https://www.googleapis.com/auth/replicapool", 1424 // "https://www.googleapis.com/auth/replicapool.readonly" 1425 // ] 1426 // } 1427 1428 } 1429 1430 // method id "replicapool.pools.insert": 1431 1432 type PoolsInsertCall struct { 1433 s *Service 1434 projectName string 1435 zone string 1436 pool *Pool 1437 urlParams_ gensupport.URLParams 1438 ctx_ context.Context 1439 header_ http.Header 1440 } 1441 1442 // Insert: Inserts a new replica pool. 1443 func (r *PoolsService) Insert(projectName string, zone string, pool *Pool) *PoolsInsertCall { 1444 c := &PoolsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1445 c.projectName = projectName 1446 c.zone = zone 1447 c.pool = pool 1448 return c 1449 } 1450 1451 // Fields allows partial responses to be retrieved. See 1452 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1453 // for more information. 1454 func (c *PoolsInsertCall) Fields(s ...googleapi.Field) *PoolsInsertCall { 1455 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1456 return c 1457 } 1458 1459 // Context sets the context to be used in this call's Do method. Any 1460 // pending HTTP request will be aborted if the provided context is 1461 // canceled. 1462 func (c *PoolsInsertCall) Context(ctx context.Context) *PoolsInsertCall { 1463 c.ctx_ = ctx 1464 return c 1465 } 1466 1467 // Header returns an http.Header that can be modified by the caller to 1468 // add HTTP headers to the request. 1469 func (c *PoolsInsertCall) Header() http.Header { 1470 if c.header_ == nil { 1471 c.header_ = make(http.Header) 1472 } 1473 return c.header_ 1474 } 1475 1476 func (c *PoolsInsertCall) doRequest(alt string) (*http.Response, error) { 1477 reqHeaders := make(http.Header) 1478 reqHeaders.Set("x-goog-api-client", "gl-go/1.13.7 gdcl/20200203") 1479 for k, v := range c.header_ { 1480 reqHeaders[k] = v 1481 } 1482 reqHeaders.Set("User-Agent", c.s.userAgent()) 1483 var body io.Reader = nil 1484 body, err := googleapi.WithoutDataWrapper.JSONReader(c.pool) 1485 if err != nil { 1486 return nil, err 1487 } 1488 reqHeaders.Set("Content-Type", "application/json") 1489 c.urlParams_.Set("alt", alt) 1490 c.urlParams_.Set("prettyPrint", "false") 1491 urls := googleapi.ResolveRelative(c.s.BasePath, "{projectName}/zones/{zone}/pools") 1492 urls += "?" + c.urlParams_.Encode() 1493 req, err := http.NewRequest("POST", urls, body) 1494 if err != nil { 1495 return nil, err 1496 } 1497 req.Header = reqHeaders 1498 googleapi.Expand(req.URL, map[string]string{ 1499 "projectName": c.projectName, 1500 "zone": c.zone, 1501 }) 1502 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1503 } 1504 1505 // Do executes the "replicapool.pools.insert" call. 1506 // Exactly one of *Pool or error will be non-nil. Any non-2xx status 1507 // code is an error. Response headers are in either 1508 // *Pool.ServerResponse.Header or (if a response was returned at all) in 1509 // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check 1510 // whether the returned error was because http.StatusNotModified was 1511 // returned. 1512 func (c *PoolsInsertCall) Do(opts ...googleapi.CallOption) (*Pool, error) { 1513 gensupport.SetOptions(c.urlParams_, opts...) 1514 res, err := c.doRequest("json") 1515 if res != nil && res.StatusCode == http.StatusNotModified { 1516 if res.Body != nil { 1517 res.Body.Close() 1518 } 1519 return nil, &googleapi.Error{ 1520 Code: res.StatusCode, 1521 Header: res.Header, 1522 } 1523 } 1524 if err != nil { 1525 return nil, err 1526 } 1527 defer googleapi.CloseBody(res) 1528 if err := googleapi.CheckResponse(res); err != nil { 1529 return nil, err 1530 } 1531 ret := &Pool{ 1532 ServerResponse: googleapi.ServerResponse{ 1533 Header: res.Header, 1534 HTTPStatusCode: res.StatusCode, 1535 }, 1536 } 1537 target := &ret 1538 if err := gensupport.DecodeResponse(target, res); err != nil { 1539 return nil, err 1540 } 1541 return ret, nil 1542 // { 1543 // "description": "Inserts a new replica pool.", 1544 // "httpMethod": "POST", 1545 // "id": "replicapool.pools.insert", 1546 // "parameterOrder": [ 1547 // "projectName", 1548 // "zone" 1549 // ], 1550 // "parameters": { 1551 // "projectName": { 1552 // "description": "The project ID for this replica pool.", 1553 // "location": "path", 1554 // "required": true, 1555 // "type": "string" 1556 // }, 1557 // "zone": { 1558 // "description": "The zone for this replica pool.", 1559 // "location": "path", 1560 // "required": true, 1561 // "type": "string" 1562 // } 1563 // }, 1564 // "path": "{projectName}/zones/{zone}/pools", 1565 // "request": { 1566 // "$ref": "Pool" 1567 // }, 1568 // "response": { 1569 // "$ref": "Pool" 1570 // }, 1571 // "scopes": [ 1572 // "https://www.googleapis.com/auth/cloud-platform", 1573 // "https://www.googleapis.com/auth/ndev.cloudman", 1574 // "https://www.googleapis.com/auth/replicapool" 1575 // ] 1576 // } 1577 1578 } 1579 1580 // method id "replicapool.pools.list": 1581 1582 type PoolsListCall struct { 1583 s *Service 1584 projectName string 1585 zone string 1586 urlParams_ gensupport.URLParams 1587 ifNoneMatch_ string 1588 ctx_ context.Context 1589 header_ http.Header 1590 } 1591 1592 // List: List all replica pools. 1593 func (r *PoolsService) List(projectName string, zone string) *PoolsListCall { 1594 c := &PoolsListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1595 c.projectName = projectName 1596 c.zone = zone 1597 return c 1598 } 1599 1600 // MaxResults sets the optional parameter "maxResults": Maximum count of 1601 // results to be returned. Acceptable values are 0 to 100, inclusive. 1602 // (Default: 50) 1603 func (c *PoolsListCall) MaxResults(maxResults int64) *PoolsListCall { 1604 c.urlParams_.Set("maxResults", fmt.Sprint(maxResults)) 1605 return c 1606 } 1607 1608 // PageToken sets the optional parameter "pageToken": Set this to the 1609 // nextPageToken value returned by a previous list request to obtain the 1610 // next page of results from the previous list request. 1611 func (c *PoolsListCall) PageToken(pageToken string) *PoolsListCall { 1612 c.urlParams_.Set("pageToken", pageToken) 1613 return c 1614 } 1615 1616 // Fields allows partial responses to be retrieved. See 1617 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1618 // for more information. 1619 func (c *PoolsListCall) Fields(s ...googleapi.Field) *PoolsListCall { 1620 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1621 return c 1622 } 1623 1624 // IfNoneMatch sets the optional parameter which makes the operation 1625 // fail if the object's ETag matches the given value. This is useful for 1626 // getting updates only after the object has changed since the last 1627 // request. Use googleapi.IsNotModified to check whether the response 1628 // error from Do is the result of In-None-Match. 1629 func (c *PoolsListCall) IfNoneMatch(entityTag string) *PoolsListCall { 1630 c.ifNoneMatch_ = entityTag 1631 return c 1632 } 1633 1634 // Context sets the context to be used in this call's Do method. Any 1635 // pending HTTP request will be aborted if the provided context is 1636 // canceled. 1637 func (c *PoolsListCall) Context(ctx context.Context) *PoolsListCall { 1638 c.ctx_ = ctx 1639 return c 1640 } 1641 1642 // Header returns an http.Header that can be modified by the caller to 1643 // add HTTP headers to the request. 1644 func (c *PoolsListCall) Header() http.Header { 1645 if c.header_ == nil { 1646 c.header_ = make(http.Header) 1647 } 1648 return c.header_ 1649 } 1650 1651 func (c *PoolsListCall) doRequest(alt string) (*http.Response, error) { 1652 reqHeaders := make(http.Header) 1653 reqHeaders.Set("x-goog-api-client", "gl-go/1.13.7 gdcl/20200203") 1654 for k, v := range c.header_ { 1655 reqHeaders[k] = v 1656 } 1657 reqHeaders.Set("User-Agent", c.s.userAgent()) 1658 if c.ifNoneMatch_ != "" { 1659 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 1660 } 1661 var body io.Reader = nil 1662 c.urlParams_.Set("alt", alt) 1663 c.urlParams_.Set("prettyPrint", "false") 1664 urls := googleapi.ResolveRelative(c.s.BasePath, "{projectName}/zones/{zone}/pools") 1665 urls += "?" + c.urlParams_.Encode() 1666 req, err := http.NewRequest("GET", urls, body) 1667 if err != nil { 1668 return nil, err 1669 } 1670 req.Header = reqHeaders 1671 googleapi.Expand(req.URL, map[string]string{ 1672 "projectName": c.projectName, 1673 "zone": c.zone, 1674 }) 1675 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1676 } 1677 1678 // Do executes the "replicapool.pools.list" call. 1679 // Exactly one of *PoolsListResponse or error will be non-nil. Any 1680 // non-2xx status code is an error. Response headers are in either 1681 // *PoolsListResponse.ServerResponse.Header or (if a response was 1682 // returned at all) in error.(*googleapi.Error).Header. Use 1683 // googleapi.IsNotModified to check whether the returned error was 1684 // because http.StatusNotModified was returned. 1685 func (c *PoolsListCall) Do(opts ...googleapi.CallOption) (*PoolsListResponse, error) { 1686 gensupport.SetOptions(c.urlParams_, opts...) 1687 res, err := c.doRequest("json") 1688 if res != nil && res.StatusCode == http.StatusNotModified { 1689 if res.Body != nil { 1690 res.Body.Close() 1691 } 1692 return nil, &googleapi.Error{ 1693 Code: res.StatusCode, 1694 Header: res.Header, 1695 } 1696 } 1697 if err != nil { 1698 return nil, err 1699 } 1700 defer googleapi.CloseBody(res) 1701 if err := googleapi.CheckResponse(res); err != nil { 1702 return nil, err 1703 } 1704 ret := &PoolsListResponse{ 1705 ServerResponse: googleapi.ServerResponse{ 1706 Header: res.Header, 1707 HTTPStatusCode: res.StatusCode, 1708 }, 1709 } 1710 target := &ret 1711 if err := gensupport.DecodeResponse(target, res); err != nil { 1712 return nil, err 1713 } 1714 return ret, nil 1715 // { 1716 // "description": "List all replica pools.", 1717 // "httpMethod": "GET", 1718 // "id": "replicapool.pools.list", 1719 // "parameterOrder": [ 1720 // "projectName", 1721 // "zone" 1722 // ], 1723 // "parameters": { 1724 // "maxResults": { 1725 // "default": "500", 1726 // "description": "Maximum count of results to be returned. Acceptable values are 0 to 100, inclusive. (Default: 50)", 1727 // "format": "int32", 1728 // "location": "query", 1729 // "maximum": "1000", 1730 // "minimum": "0", 1731 // "type": "integer" 1732 // }, 1733 // "pageToken": { 1734 // "description": "Set this to the nextPageToken value returned by a previous list request to obtain the next page of results from the previous list request.", 1735 // "location": "query", 1736 // "type": "string" 1737 // }, 1738 // "projectName": { 1739 // "description": "The project ID for this request.", 1740 // "location": "path", 1741 // "required": true, 1742 // "type": "string" 1743 // }, 1744 // "zone": { 1745 // "description": "The zone for this replica pool.", 1746 // "location": "path", 1747 // "required": true, 1748 // "type": "string" 1749 // } 1750 // }, 1751 // "path": "{projectName}/zones/{zone}/pools", 1752 // "response": { 1753 // "$ref": "PoolsListResponse" 1754 // }, 1755 // "scopes": [ 1756 // "https://www.googleapis.com/auth/cloud-platform", 1757 // "https://www.googleapis.com/auth/cloud-platform.read-only", 1758 // "https://www.googleapis.com/auth/ndev.cloudman", 1759 // "https://www.googleapis.com/auth/ndev.cloudman.readonly", 1760 // "https://www.googleapis.com/auth/replicapool", 1761 // "https://www.googleapis.com/auth/replicapool.readonly" 1762 // ] 1763 // } 1764 1765 } 1766 1767 // Pages invokes f for each page of results. 1768 // A non-nil error returned from f will halt the iteration. 1769 // The provided context supersedes any context provided to the Context method. 1770 func (c *PoolsListCall) Pages(ctx context.Context, f func(*PoolsListResponse) error) error { 1771 c.ctx_ = ctx 1772 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 1773 for { 1774 x, err := c.Do() 1775 if err != nil { 1776 return err 1777 } 1778 if err := f(x); err != nil { 1779 return err 1780 } 1781 if x.NextPageToken == "" { 1782 return nil 1783 } 1784 c.PageToken(x.NextPageToken) 1785 } 1786 } 1787 1788 // method id "replicapool.pools.resize": 1789 1790 type PoolsResizeCall struct { 1791 s *Service 1792 projectName string 1793 zone string 1794 poolName string 1795 urlParams_ gensupport.URLParams 1796 ctx_ context.Context 1797 header_ http.Header 1798 } 1799 1800 // Resize: Resize a pool. This is an asynchronous operation, and 1801 // multiple overlapping resize requests can be made. Replica Pools will 1802 // use the information from the last resize request. 1803 func (r *PoolsService) Resize(projectName string, zone string, poolName string) *PoolsResizeCall { 1804 c := &PoolsResizeCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1805 c.projectName = projectName 1806 c.zone = zone 1807 c.poolName = poolName 1808 return c 1809 } 1810 1811 // NumReplicas sets the optional parameter "numReplicas": The desired 1812 // number of replicas to resize to. If this number is larger than the 1813 // existing number of replicas, new replicas will be added. If the 1814 // number is smaller, then existing replicas will be deleted. 1815 func (c *PoolsResizeCall) NumReplicas(numReplicas int64) *PoolsResizeCall { 1816 c.urlParams_.Set("numReplicas", fmt.Sprint(numReplicas)) 1817 return c 1818 } 1819 1820 // Fields allows partial responses to be retrieved. See 1821 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1822 // for more information. 1823 func (c *PoolsResizeCall) Fields(s ...googleapi.Field) *PoolsResizeCall { 1824 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1825 return c 1826 } 1827 1828 // Context sets the context to be used in this call's Do method. Any 1829 // pending HTTP request will be aborted if the provided context is 1830 // canceled. 1831 func (c *PoolsResizeCall) Context(ctx context.Context) *PoolsResizeCall { 1832 c.ctx_ = ctx 1833 return c 1834 } 1835 1836 // Header returns an http.Header that can be modified by the caller to 1837 // add HTTP headers to the request. 1838 func (c *PoolsResizeCall) Header() http.Header { 1839 if c.header_ == nil { 1840 c.header_ = make(http.Header) 1841 } 1842 return c.header_ 1843 } 1844 1845 func (c *PoolsResizeCall) doRequest(alt string) (*http.Response, error) { 1846 reqHeaders := make(http.Header) 1847 reqHeaders.Set("x-goog-api-client", "gl-go/1.13.7 gdcl/20200203") 1848 for k, v := range c.header_ { 1849 reqHeaders[k] = v 1850 } 1851 reqHeaders.Set("User-Agent", c.s.userAgent()) 1852 var body io.Reader = nil 1853 c.urlParams_.Set("alt", alt) 1854 c.urlParams_.Set("prettyPrint", "false") 1855 urls := googleapi.ResolveRelative(c.s.BasePath, "{projectName}/zones/{zone}/pools/{poolName}/resize") 1856 urls += "?" + c.urlParams_.Encode() 1857 req, err := http.NewRequest("POST", urls, body) 1858 if err != nil { 1859 return nil, err 1860 } 1861 req.Header = reqHeaders 1862 googleapi.Expand(req.URL, map[string]string{ 1863 "projectName": c.projectName, 1864 "zone": c.zone, 1865 "poolName": c.poolName, 1866 }) 1867 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1868 } 1869 1870 // Do executes the "replicapool.pools.resize" call. 1871 // Exactly one of *Pool or error will be non-nil. Any non-2xx status 1872 // code is an error. Response headers are in either 1873 // *Pool.ServerResponse.Header or (if a response was returned at all) in 1874 // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check 1875 // whether the returned error was because http.StatusNotModified was 1876 // returned. 1877 func (c *PoolsResizeCall) Do(opts ...googleapi.CallOption) (*Pool, error) { 1878 gensupport.SetOptions(c.urlParams_, opts...) 1879 res, err := c.doRequest("json") 1880 if res != nil && res.StatusCode == http.StatusNotModified { 1881 if res.Body != nil { 1882 res.Body.Close() 1883 } 1884 return nil, &googleapi.Error{ 1885 Code: res.StatusCode, 1886 Header: res.Header, 1887 } 1888 } 1889 if err != nil { 1890 return nil, err 1891 } 1892 defer googleapi.CloseBody(res) 1893 if err := googleapi.CheckResponse(res); err != nil { 1894 return nil, err 1895 } 1896 ret := &Pool{ 1897 ServerResponse: googleapi.ServerResponse{ 1898 Header: res.Header, 1899 HTTPStatusCode: res.StatusCode, 1900 }, 1901 } 1902 target := &ret 1903 if err := gensupport.DecodeResponse(target, res); err != nil { 1904 return nil, err 1905 } 1906 return ret, nil 1907 // { 1908 // "description": "Resize a pool. This is an asynchronous operation, and multiple overlapping resize requests can be made. Replica Pools will use the information from the last resize request.", 1909 // "httpMethod": "POST", 1910 // "id": "replicapool.pools.resize", 1911 // "parameterOrder": [ 1912 // "projectName", 1913 // "zone", 1914 // "poolName" 1915 // ], 1916 // "parameters": { 1917 // "numReplicas": { 1918 // "description": "The desired number of replicas to resize to. If this number is larger than the existing number of replicas, new replicas will be added. If the number is smaller, then existing replicas will be deleted.", 1919 // "format": "int32", 1920 // "location": "query", 1921 // "type": "integer" 1922 // }, 1923 // "poolName": { 1924 // "description": "The name of the replica pool for this request.", 1925 // "location": "path", 1926 // "required": true, 1927 // "type": "string" 1928 // }, 1929 // "projectName": { 1930 // "description": "The project ID for this replica pool.", 1931 // "location": "path", 1932 // "required": true, 1933 // "type": "string" 1934 // }, 1935 // "zone": { 1936 // "description": "The zone for this replica pool.", 1937 // "location": "path", 1938 // "required": true, 1939 // "type": "string" 1940 // } 1941 // }, 1942 // "path": "{projectName}/zones/{zone}/pools/{poolName}/resize", 1943 // "response": { 1944 // "$ref": "Pool" 1945 // }, 1946 // "scopes": [ 1947 // "https://www.googleapis.com/auth/cloud-platform", 1948 // "https://www.googleapis.com/auth/ndev.cloudman", 1949 // "https://www.googleapis.com/auth/replicapool" 1950 // ] 1951 // } 1952 1953 } 1954 1955 // method id "replicapool.pools.updatetemplate": 1956 1957 type PoolsUpdatetemplateCall struct { 1958 s *Service 1959 projectName string 1960 zone string 1961 poolName string 1962 template *Template 1963 urlParams_ gensupport.URLParams 1964 ctx_ context.Context 1965 header_ http.Header 1966 } 1967 1968 // Updatetemplate: Update the template used by the pool. 1969 func (r *PoolsService) Updatetemplate(projectName string, zone string, poolName string, template *Template) *PoolsUpdatetemplateCall { 1970 c := &PoolsUpdatetemplateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1971 c.projectName = projectName 1972 c.zone = zone 1973 c.poolName = poolName 1974 c.template = template 1975 return c 1976 } 1977 1978 // Fields allows partial responses to be retrieved. See 1979 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1980 // for more information. 1981 func (c *PoolsUpdatetemplateCall) Fields(s ...googleapi.Field) *PoolsUpdatetemplateCall { 1982 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1983 return c 1984 } 1985 1986 // Context sets the context to be used in this call's Do method. Any 1987 // pending HTTP request will be aborted if the provided context is 1988 // canceled. 1989 func (c *PoolsUpdatetemplateCall) Context(ctx context.Context) *PoolsUpdatetemplateCall { 1990 c.ctx_ = ctx 1991 return c 1992 } 1993 1994 // Header returns an http.Header that can be modified by the caller to 1995 // add HTTP headers to the request. 1996 func (c *PoolsUpdatetemplateCall) Header() http.Header { 1997 if c.header_ == nil { 1998 c.header_ = make(http.Header) 1999 } 2000 return c.header_ 2001 } 2002 2003 func (c *PoolsUpdatetemplateCall) doRequest(alt string) (*http.Response, error) { 2004 reqHeaders := make(http.Header) 2005 reqHeaders.Set("x-goog-api-client", "gl-go/1.13.7 gdcl/20200203") 2006 for k, v := range c.header_ { 2007 reqHeaders[k] = v 2008 } 2009 reqHeaders.Set("User-Agent", c.s.userAgent()) 2010 var body io.Reader = nil 2011 body, err := googleapi.WithoutDataWrapper.JSONReader(c.template) 2012 if err != nil { 2013 return nil, err 2014 } 2015 reqHeaders.Set("Content-Type", "application/json") 2016 c.urlParams_.Set("alt", alt) 2017 c.urlParams_.Set("prettyPrint", "false") 2018 urls := googleapi.ResolveRelative(c.s.BasePath, "{projectName}/zones/{zone}/pools/{poolName}/updateTemplate") 2019 urls += "?" + c.urlParams_.Encode() 2020 req, err := http.NewRequest("POST", urls, body) 2021 if err != nil { 2022 return nil, err 2023 } 2024 req.Header = reqHeaders 2025 googleapi.Expand(req.URL, map[string]string{ 2026 "projectName": c.projectName, 2027 "zone": c.zone, 2028 "poolName": c.poolName, 2029 }) 2030 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2031 } 2032 2033 // Do executes the "replicapool.pools.updatetemplate" call. 2034 func (c *PoolsUpdatetemplateCall) Do(opts ...googleapi.CallOption) error { 2035 gensupport.SetOptions(c.urlParams_, opts...) 2036 res, err := c.doRequest("json") 2037 if err != nil { 2038 return err 2039 } 2040 defer googleapi.CloseBody(res) 2041 if err := googleapi.CheckResponse(res); err != nil { 2042 return err 2043 } 2044 return nil 2045 // { 2046 // "description": "Update the template used by the pool.", 2047 // "httpMethod": "POST", 2048 // "id": "replicapool.pools.updatetemplate", 2049 // "parameterOrder": [ 2050 // "projectName", 2051 // "zone", 2052 // "poolName" 2053 // ], 2054 // "parameters": { 2055 // "poolName": { 2056 // "description": "The name of the replica pool for this request.", 2057 // "location": "path", 2058 // "required": true, 2059 // "type": "string" 2060 // }, 2061 // "projectName": { 2062 // "description": "The project ID for this replica pool.", 2063 // "location": "path", 2064 // "required": true, 2065 // "type": "string" 2066 // }, 2067 // "zone": { 2068 // "description": "The zone for this replica pool.", 2069 // "location": "path", 2070 // "required": true, 2071 // "type": "string" 2072 // } 2073 // }, 2074 // "path": "{projectName}/zones/{zone}/pools/{poolName}/updateTemplate", 2075 // "request": { 2076 // "$ref": "Template" 2077 // }, 2078 // "scopes": [ 2079 // "https://www.googleapis.com/auth/cloud-platform", 2080 // "https://www.googleapis.com/auth/ndev.cloudman", 2081 // "https://www.googleapis.com/auth/replicapool" 2082 // ] 2083 // } 2084 2085 } 2086 2087 // method id "replicapool.replicas.delete": 2088 2089 type ReplicasDeleteCall struct { 2090 s *Service 2091 projectName string 2092 zone string 2093 poolName string 2094 replicaName string 2095 replicasdeleterequest *ReplicasDeleteRequest 2096 urlParams_ gensupport.URLParams 2097 ctx_ context.Context 2098 header_ http.Header 2099 } 2100 2101 // Delete: Deletes a replica from the pool. 2102 func (r *ReplicasService) Delete(projectName string, zone string, poolName string, replicaName string, replicasdeleterequest *ReplicasDeleteRequest) *ReplicasDeleteCall { 2103 c := &ReplicasDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2104 c.projectName = projectName 2105 c.zone = zone 2106 c.poolName = poolName 2107 c.replicaName = replicaName 2108 c.replicasdeleterequest = replicasdeleterequest 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 *ReplicasDeleteCall) Fields(s ...googleapi.Field) *ReplicasDeleteCall { 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 *ReplicasDeleteCall) Context(ctx context.Context) *ReplicasDeleteCall { 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 *ReplicasDeleteCall) Header() http.Header { 2131 if c.header_ == nil { 2132 c.header_ = make(http.Header) 2133 } 2134 return c.header_ 2135 } 2136 2137 func (c *ReplicasDeleteCall) 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 body, err := googleapi.WithoutDataWrapper.JSONReader(c.replicasdeleterequest) 2146 if err != nil { 2147 return nil, err 2148 } 2149 reqHeaders.Set("Content-Type", "application/json") 2150 c.urlParams_.Set("alt", alt) 2151 c.urlParams_.Set("prettyPrint", "false") 2152 urls := googleapi.ResolveRelative(c.s.BasePath, "{projectName}/zones/{zone}/pools/{poolName}/replicas/{replicaName}") 2153 urls += "?" + c.urlParams_.Encode() 2154 req, err := http.NewRequest("POST", urls, body) 2155 if err != nil { 2156 return nil, err 2157 } 2158 req.Header = reqHeaders 2159 googleapi.Expand(req.URL, map[string]string{ 2160 "projectName": c.projectName, 2161 "zone": c.zone, 2162 "poolName": c.poolName, 2163 "replicaName": c.replicaName, 2164 }) 2165 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2166 } 2167 2168 // Do executes the "replicapool.replicas.delete" call. 2169 // Exactly one of *Replica or error will be non-nil. Any non-2xx status 2170 // code is an error. Response headers are in either 2171 // *Replica.ServerResponse.Header or (if a response was returned at all) 2172 // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 2173 // check whether the returned error was because http.StatusNotModified 2174 // was returned. 2175 func (c *ReplicasDeleteCall) Do(opts ...googleapi.CallOption) (*Replica, error) { 2176 gensupport.SetOptions(c.urlParams_, opts...) 2177 res, err := c.doRequest("json") 2178 if res != nil && res.StatusCode == http.StatusNotModified { 2179 if res.Body != nil { 2180 res.Body.Close() 2181 } 2182 return nil, &googleapi.Error{ 2183 Code: res.StatusCode, 2184 Header: res.Header, 2185 } 2186 } 2187 if err != nil { 2188 return nil, err 2189 } 2190 defer googleapi.CloseBody(res) 2191 if err := googleapi.CheckResponse(res); err != nil { 2192 return nil, err 2193 } 2194 ret := &Replica{ 2195 ServerResponse: googleapi.ServerResponse{ 2196 Header: res.Header, 2197 HTTPStatusCode: res.StatusCode, 2198 }, 2199 } 2200 target := &ret 2201 if err := gensupport.DecodeResponse(target, res); err != nil { 2202 return nil, err 2203 } 2204 return ret, nil 2205 // { 2206 // "description": "Deletes a replica from the pool.", 2207 // "httpMethod": "POST", 2208 // "id": "replicapool.replicas.delete", 2209 // "parameterOrder": [ 2210 // "projectName", 2211 // "zone", 2212 // "poolName", 2213 // "replicaName" 2214 // ], 2215 // "parameters": { 2216 // "poolName": { 2217 // "description": "The replica pool name for this request.", 2218 // "location": "path", 2219 // "required": true, 2220 // "type": "string" 2221 // }, 2222 // "projectName": { 2223 // "description": "The project ID for this request.", 2224 // "location": "path", 2225 // "required": true, 2226 // "type": "string" 2227 // }, 2228 // "replicaName": { 2229 // "description": "The name of the replica for this request.", 2230 // "location": "path", 2231 // "required": true, 2232 // "type": "string" 2233 // }, 2234 // "zone": { 2235 // "description": "The zone where the replica lives.", 2236 // "location": "path", 2237 // "required": true, 2238 // "type": "string" 2239 // } 2240 // }, 2241 // "path": "{projectName}/zones/{zone}/pools/{poolName}/replicas/{replicaName}", 2242 // "request": { 2243 // "$ref": "ReplicasDeleteRequest" 2244 // }, 2245 // "response": { 2246 // "$ref": "Replica" 2247 // }, 2248 // "scopes": [ 2249 // "https://www.googleapis.com/auth/cloud-platform", 2250 // "https://www.googleapis.com/auth/ndev.cloudman", 2251 // "https://www.googleapis.com/auth/replicapool" 2252 // ] 2253 // } 2254 2255 } 2256 2257 // method id "replicapool.replicas.get": 2258 2259 type ReplicasGetCall struct { 2260 s *Service 2261 projectName string 2262 zone string 2263 poolName string 2264 replicaName string 2265 urlParams_ gensupport.URLParams 2266 ifNoneMatch_ string 2267 ctx_ context.Context 2268 header_ http.Header 2269 } 2270 2271 // Get: Gets information about a specific replica. 2272 func (r *ReplicasService) Get(projectName string, zone string, poolName string, replicaName string) *ReplicasGetCall { 2273 c := &ReplicasGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2274 c.projectName = projectName 2275 c.zone = zone 2276 c.poolName = poolName 2277 c.replicaName = replicaName 2278 return c 2279 } 2280 2281 // Fields allows partial responses to be retrieved. See 2282 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2283 // for more information. 2284 func (c *ReplicasGetCall) Fields(s ...googleapi.Field) *ReplicasGetCall { 2285 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2286 return c 2287 } 2288 2289 // IfNoneMatch sets the optional parameter which makes the operation 2290 // fail if the object's ETag matches the given value. This is useful for 2291 // getting updates only after the object has changed since the last 2292 // request. Use googleapi.IsNotModified to check whether the response 2293 // error from Do is the result of In-None-Match. 2294 func (c *ReplicasGetCall) IfNoneMatch(entityTag string) *ReplicasGetCall { 2295 c.ifNoneMatch_ = entityTag 2296 return c 2297 } 2298 2299 // Context sets the context to be used in this call's Do method. Any 2300 // pending HTTP request will be aborted if the provided context is 2301 // canceled. 2302 func (c *ReplicasGetCall) Context(ctx context.Context) *ReplicasGetCall { 2303 c.ctx_ = ctx 2304 return c 2305 } 2306 2307 // Header returns an http.Header that can be modified by the caller to 2308 // add HTTP headers to the request. 2309 func (c *ReplicasGetCall) Header() http.Header { 2310 if c.header_ == nil { 2311 c.header_ = make(http.Header) 2312 } 2313 return c.header_ 2314 } 2315 2316 func (c *ReplicasGetCall) doRequest(alt string) (*http.Response, error) { 2317 reqHeaders := make(http.Header) 2318 reqHeaders.Set("x-goog-api-client", "gl-go/1.13.7 gdcl/20200203") 2319 for k, v := range c.header_ { 2320 reqHeaders[k] = v 2321 } 2322 reqHeaders.Set("User-Agent", c.s.userAgent()) 2323 if c.ifNoneMatch_ != "" { 2324 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 2325 } 2326 var body io.Reader = nil 2327 c.urlParams_.Set("alt", alt) 2328 c.urlParams_.Set("prettyPrint", "false") 2329 urls := googleapi.ResolveRelative(c.s.BasePath, "{projectName}/zones/{zone}/pools/{poolName}/replicas/{replicaName}") 2330 urls += "?" + c.urlParams_.Encode() 2331 req, err := http.NewRequest("GET", urls, body) 2332 if err != nil { 2333 return nil, err 2334 } 2335 req.Header = reqHeaders 2336 googleapi.Expand(req.URL, map[string]string{ 2337 "projectName": c.projectName, 2338 "zone": c.zone, 2339 "poolName": c.poolName, 2340 "replicaName": c.replicaName, 2341 }) 2342 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2343 } 2344 2345 // Do executes the "replicapool.replicas.get" call. 2346 // Exactly one of *Replica or error will be non-nil. Any non-2xx status 2347 // code is an error. Response headers are in either 2348 // *Replica.ServerResponse.Header or (if a response was returned at all) 2349 // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 2350 // check whether the returned error was because http.StatusNotModified 2351 // was returned. 2352 func (c *ReplicasGetCall) Do(opts ...googleapi.CallOption) (*Replica, error) { 2353 gensupport.SetOptions(c.urlParams_, opts...) 2354 res, err := c.doRequest("json") 2355 if res != nil && res.StatusCode == http.StatusNotModified { 2356 if res.Body != nil { 2357 res.Body.Close() 2358 } 2359 return nil, &googleapi.Error{ 2360 Code: res.StatusCode, 2361 Header: res.Header, 2362 } 2363 } 2364 if err != nil { 2365 return nil, err 2366 } 2367 defer googleapi.CloseBody(res) 2368 if err := googleapi.CheckResponse(res); err != nil { 2369 return nil, err 2370 } 2371 ret := &Replica{ 2372 ServerResponse: googleapi.ServerResponse{ 2373 Header: res.Header, 2374 HTTPStatusCode: res.StatusCode, 2375 }, 2376 } 2377 target := &ret 2378 if err := gensupport.DecodeResponse(target, res); err != nil { 2379 return nil, err 2380 } 2381 return ret, nil 2382 // { 2383 // "description": "Gets information about a specific replica.", 2384 // "httpMethod": "GET", 2385 // "id": "replicapool.replicas.get", 2386 // "parameterOrder": [ 2387 // "projectName", 2388 // "zone", 2389 // "poolName", 2390 // "replicaName" 2391 // ], 2392 // "parameters": { 2393 // "poolName": { 2394 // "description": "The replica pool name for this request.", 2395 // "location": "path", 2396 // "required": true, 2397 // "type": "string" 2398 // }, 2399 // "projectName": { 2400 // "description": "The project ID for this request.", 2401 // "location": "path", 2402 // "required": true, 2403 // "type": "string" 2404 // }, 2405 // "replicaName": { 2406 // "description": "The name of the replica for this request.", 2407 // "location": "path", 2408 // "required": true, 2409 // "type": "string" 2410 // }, 2411 // "zone": { 2412 // "description": "The zone where the replica lives.", 2413 // "location": "path", 2414 // "required": true, 2415 // "type": "string" 2416 // } 2417 // }, 2418 // "path": "{projectName}/zones/{zone}/pools/{poolName}/replicas/{replicaName}", 2419 // "response": { 2420 // "$ref": "Replica" 2421 // }, 2422 // "scopes": [ 2423 // "https://www.googleapis.com/auth/cloud-platform", 2424 // "https://www.googleapis.com/auth/cloud-platform.read-only", 2425 // "https://www.googleapis.com/auth/ndev.cloudman", 2426 // "https://www.googleapis.com/auth/ndev.cloudman.readonly", 2427 // "https://www.googleapis.com/auth/replicapool", 2428 // "https://www.googleapis.com/auth/replicapool.readonly" 2429 // ] 2430 // } 2431 2432 } 2433 2434 // method id "replicapool.replicas.list": 2435 2436 type ReplicasListCall struct { 2437 s *Service 2438 projectName string 2439 zone string 2440 poolName string 2441 urlParams_ gensupport.URLParams 2442 ifNoneMatch_ string 2443 ctx_ context.Context 2444 header_ http.Header 2445 } 2446 2447 // List: Lists all replicas in a pool. 2448 func (r *ReplicasService) List(projectName string, zone string, poolName string) *ReplicasListCall { 2449 c := &ReplicasListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2450 c.projectName = projectName 2451 c.zone = zone 2452 c.poolName = poolName 2453 return c 2454 } 2455 2456 // MaxResults sets the optional parameter "maxResults": Maximum count of 2457 // results to be returned. Acceptable values are 0 to 100, inclusive. 2458 // (Default: 50) 2459 func (c *ReplicasListCall) MaxResults(maxResults int64) *ReplicasListCall { 2460 c.urlParams_.Set("maxResults", fmt.Sprint(maxResults)) 2461 return c 2462 } 2463 2464 // PageToken sets the optional parameter "pageToken": Set this to the 2465 // nextPageToken value returned by a previous list request to obtain the 2466 // next page of results from the previous list request. 2467 func (c *ReplicasListCall) PageToken(pageToken string) *ReplicasListCall { 2468 c.urlParams_.Set("pageToken", pageToken) 2469 return c 2470 } 2471 2472 // Fields allows partial responses to be retrieved. See 2473 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2474 // for more information. 2475 func (c *ReplicasListCall) Fields(s ...googleapi.Field) *ReplicasListCall { 2476 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2477 return c 2478 } 2479 2480 // IfNoneMatch sets the optional parameter which makes the operation 2481 // fail if the object's ETag matches the given value. This is useful for 2482 // getting updates only after the object has changed since the last 2483 // request. Use googleapi.IsNotModified to check whether the response 2484 // error from Do is the result of In-None-Match. 2485 func (c *ReplicasListCall) IfNoneMatch(entityTag string) *ReplicasListCall { 2486 c.ifNoneMatch_ = entityTag 2487 return c 2488 } 2489 2490 // Context sets the context to be used in this call's Do method. Any 2491 // pending HTTP request will be aborted if the provided context is 2492 // canceled. 2493 func (c *ReplicasListCall) Context(ctx context.Context) *ReplicasListCall { 2494 c.ctx_ = ctx 2495 return c 2496 } 2497 2498 // Header returns an http.Header that can be modified by the caller to 2499 // add HTTP headers to the request. 2500 func (c *ReplicasListCall) Header() http.Header { 2501 if c.header_ == nil { 2502 c.header_ = make(http.Header) 2503 } 2504 return c.header_ 2505 } 2506 2507 func (c *ReplicasListCall) doRequest(alt string) (*http.Response, error) { 2508 reqHeaders := make(http.Header) 2509 reqHeaders.Set("x-goog-api-client", "gl-go/1.13.7 gdcl/20200203") 2510 for k, v := range c.header_ { 2511 reqHeaders[k] = v 2512 } 2513 reqHeaders.Set("User-Agent", c.s.userAgent()) 2514 if c.ifNoneMatch_ != "" { 2515 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 2516 } 2517 var body io.Reader = nil 2518 c.urlParams_.Set("alt", alt) 2519 c.urlParams_.Set("prettyPrint", "false") 2520 urls := googleapi.ResolveRelative(c.s.BasePath, "{projectName}/zones/{zone}/pools/{poolName}/replicas") 2521 urls += "?" + c.urlParams_.Encode() 2522 req, err := http.NewRequest("GET", urls, body) 2523 if err != nil { 2524 return nil, err 2525 } 2526 req.Header = reqHeaders 2527 googleapi.Expand(req.URL, map[string]string{ 2528 "projectName": c.projectName, 2529 "zone": c.zone, 2530 "poolName": c.poolName, 2531 }) 2532 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2533 } 2534 2535 // Do executes the "replicapool.replicas.list" call. 2536 // Exactly one of *ReplicasListResponse or error will be non-nil. Any 2537 // non-2xx status code is an error. Response headers are in either 2538 // *ReplicasListResponse.ServerResponse.Header or (if a response was 2539 // returned at all) in error.(*googleapi.Error).Header. Use 2540 // googleapi.IsNotModified to check whether the returned error was 2541 // because http.StatusNotModified was returned. 2542 func (c *ReplicasListCall) Do(opts ...googleapi.CallOption) (*ReplicasListResponse, error) { 2543 gensupport.SetOptions(c.urlParams_, opts...) 2544 res, err := c.doRequest("json") 2545 if res != nil && res.StatusCode == http.StatusNotModified { 2546 if res.Body != nil { 2547 res.Body.Close() 2548 } 2549 return nil, &googleapi.Error{ 2550 Code: res.StatusCode, 2551 Header: res.Header, 2552 } 2553 } 2554 if err != nil { 2555 return nil, err 2556 } 2557 defer googleapi.CloseBody(res) 2558 if err := googleapi.CheckResponse(res); err != nil { 2559 return nil, err 2560 } 2561 ret := &ReplicasListResponse{ 2562 ServerResponse: googleapi.ServerResponse{ 2563 Header: res.Header, 2564 HTTPStatusCode: res.StatusCode, 2565 }, 2566 } 2567 target := &ret 2568 if err := gensupport.DecodeResponse(target, res); err != nil { 2569 return nil, err 2570 } 2571 return ret, nil 2572 // { 2573 // "description": "Lists all replicas in a pool.", 2574 // "httpMethod": "GET", 2575 // "id": "replicapool.replicas.list", 2576 // "parameterOrder": [ 2577 // "projectName", 2578 // "zone", 2579 // "poolName" 2580 // ], 2581 // "parameters": { 2582 // "maxResults": { 2583 // "default": "500", 2584 // "description": "Maximum count of results to be returned. Acceptable values are 0 to 100, inclusive. (Default: 50)", 2585 // "format": "int32", 2586 // "location": "query", 2587 // "maximum": "1000", 2588 // "minimum": "0", 2589 // "type": "integer" 2590 // }, 2591 // "pageToken": { 2592 // "description": "Set this to the nextPageToken value returned by a previous list request to obtain the next page of results from the previous list request.", 2593 // "location": "query", 2594 // "type": "string" 2595 // }, 2596 // "poolName": { 2597 // "description": "The replica pool name for this request.", 2598 // "location": "path", 2599 // "required": true, 2600 // "type": "string" 2601 // }, 2602 // "projectName": { 2603 // "description": "The project ID for this request.", 2604 // "location": "path", 2605 // "required": true, 2606 // "type": "string" 2607 // }, 2608 // "zone": { 2609 // "description": "The zone where the replica pool lives.", 2610 // "location": "path", 2611 // "required": true, 2612 // "type": "string" 2613 // } 2614 // }, 2615 // "path": "{projectName}/zones/{zone}/pools/{poolName}/replicas", 2616 // "response": { 2617 // "$ref": "ReplicasListResponse" 2618 // }, 2619 // "scopes": [ 2620 // "https://www.googleapis.com/auth/cloud-platform", 2621 // "https://www.googleapis.com/auth/cloud-platform.read-only", 2622 // "https://www.googleapis.com/auth/ndev.cloudman", 2623 // "https://www.googleapis.com/auth/ndev.cloudman.readonly", 2624 // "https://www.googleapis.com/auth/replicapool", 2625 // "https://www.googleapis.com/auth/replicapool.readonly" 2626 // ] 2627 // } 2628 2629 } 2630 2631 // Pages invokes f for each page of results. 2632 // A non-nil error returned from f will halt the iteration. 2633 // The provided context supersedes any context provided to the Context method. 2634 func (c *ReplicasListCall) Pages(ctx context.Context, f func(*ReplicasListResponse) error) error { 2635 c.ctx_ = ctx 2636 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 2637 for { 2638 x, err := c.Do() 2639 if err != nil { 2640 return err 2641 } 2642 if err := f(x); err != nil { 2643 return err 2644 } 2645 if x.NextPageToken == "" { 2646 return nil 2647 } 2648 c.PageToken(x.NextPageToken) 2649 } 2650 } 2651 2652 // method id "replicapool.replicas.restart": 2653 2654 type ReplicasRestartCall struct { 2655 s *Service 2656 projectName string 2657 zone string 2658 poolName string 2659 replicaName string 2660 urlParams_ gensupport.URLParams 2661 ctx_ context.Context 2662 header_ http.Header 2663 } 2664 2665 // Restart: Restarts a replica in a pool. 2666 func (r *ReplicasService) Restart(projectName string, zone string, poolName string, replicaName string) *ReplicasRestartCall { 2667 c := &ReplicasRestartCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2668 c.projectName = projectName 2669 c.zone = zone 2670 c.poolName = poolName 2671 c.replicaName = replicaName 2672 return c 2673 } 2674 2675 // Fields allows partial responses to be retrieved. See 2676 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2677 // for more information. 2678 func (c *ReplicasRestartCall) Fields(s ...googleapi.Field) *ReplicasRestartCall { 2679 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2680 return c 2681 } 2682 2683 // Context sets the context to be used in this call's Do method. Any 2684 // pending HTTP request will be aborted if the provided context is 2685 // canceled. 2686 func (c *ReplicasRestartCall) Context(ctx context.Context) *ReplicasRestartCall { 2687 c.ctx_ = ctx 2688 return c 2689 } 2690 2691 // Header returns an http.Header that can be modified by the caller to 2692 // add HTTP headers to the request. 2693 func (c *ReplicasRestartCall) Header() http.Header { 2694 if c.header_ == nil { 2695 c.header_ = make(http.Header) 2696 } 2697 return c.header_ 2698 } 2699 2700 func (c *ReplicasRestartCall) doRequest(alt string) (*http.Response, error) { 2701 reqHeaders := make(http.Header) 2702 reqHeaders.Set("x-goog-api-client", "gl-go/1.13.7 gdcl/20200203") 2703 for k, v := range c.header_ { 2704 reqHeaders[k] = v 2705 } 2706 reqHeaders.Set("User-Agent", c.s.userAgent()) 2707 var body io.Reader = nil 2708 c.urlParams_.Set("alt", alt) 2709 c.urlParams_.Set("prettyPrint", "false") 2710 urls := googleapi.ResolveRelative(c.s.BasePath, "{projectName}/zones/{zone}/pools/{poolName}/replicas/{replicaName}/restart") 2711 urls += "?" + c.urlParams_.Encode() 2712 req, err := http.NewRequest("POST", urls, body) 2713 if err != nil { 2714 return nil, err 2715 } 2716 req.Header = reqHeaders 2717 googleapi.Expand(req.URL, map[string]string{ 2718 "projectName": c.projectName, 2719 "zone": c.zone, 2720 "poolName": c.poolName, 2721 "replicaName": c.replicaName, 2722 }) 2723 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2724 } 2725 2726 // Do executes the "replicapool.replicas.restart" call. 2727 // Exactly one of *Replica or error will be non-nil. Any non-2xx status 2728 // code is an error. Response headers are in either 2729 // *Replica.ServerResponse.Header or (if a response was returned at all) 2730 // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 2731 // check whether the returned error was because http.StatusNotModified 2732 // was returned. 2733 func (c *ReplicasRestartCall) Do(opts ...googleapi.CallOption) (*Replica, error) { 2734 gensupport.SetOptions(c.urlParams_, opts...) 2735 res, err := c.doRequest("json") 2736 if res != nil && res.StatusCode == http.StatusNotModified { 2737 if res.Body != nil { 2738 res.Body.Close() 2739 } 2740 return nil, &googleapi.Error{ 2741 Code: res.StatusCode, 2742 Header: res.Header, 2743 } 2744 } 2745 if err != nil { 2746 return nil, err 2747 } 2748 defer googleapi.CloseBody(res) 2749 if err := googleapi.CheckResponse(res); err != nil { 2750 return nil, err 2751 } 2752 ret := &Replica{ 2753 ServerResponse: googleapi.ServerResponse{ 2754 Header: res.Header, 2755 HTTPStatusCode: res.StatusCode, 2756 }, 2757 } 2758 target := &ret 2759 if err := gensupport.DecodeResponse(target, res); err != nil { 2760 return nil, err 2761 } 2762 return ret, nil 2763 // { 2764 // "description": "Restarts a replica in a pool.", 2765 // "httpMethod": "POST", 2766 // "id": "replicapool.replicas.restart", 2767 // "parameterOrder": [ 2768 // "projectName", 2769 // "zone", 2770 // "poolName", 2771 // "replicaName" 2772 // ], 2773 // "parameters": { 2774 // "poolName": { 2775 // "description": "The replica pool name for this request.", 2776 // "location": "path", 2777 // "required": true, 2778 // "type": "string" 2779 // }, 2780 // "projectName": { 2781 // "description": "The project ID for this request.", 2782 // "location": "path", 2783 // "required": true, 2784 // "type": "string" 2785 // }, 2786 // "replicaName": { 2787 // "description": "The name of the replica for this request.", 2788 // "location": "path", 2789 // "required": true, 2790 // "type": "string" 2791 // }, 2792 // "zone": { 2793 // "description": "The zone where the replica lives.", 2794 // "location": "path", 2795 // "required": true, 2796 // "type": "string" 2797 // } 2798 // }, 2799 // "path": "{projectName}/zones/{zone}/pools/{poolName}/replicas/{replicaName}/restart", 2800 // "response": { 2801 // "$ref": "Replica" 2802 // }, 2803 // "scopes": [ 2804 // "https://www.googleapis.com/auth/cloud-platform", 2805 // "https://www.googleapis.com/auth/ndev.cloudman", 2806 // "https://www.googleapis.com/auth/replicapool" 2807 // ] 2808 // } 2809 2810 } 2811