You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

2697 lines
93 KiB

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