Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.
 
 
 

2766 Zeilen
100 KiB

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