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