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.
 
 
 

2555 lines
89 KiB

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