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.
 
 
 

2801 regels
97 KiB

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