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.
 
 
 

2510 line
88 KiB

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