autoscaler-gen.go 66 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122
  1. // Package autoscaler provides access to the Google Compute Engine Autoscaler API.
  2. //
  3. // See http://developers.google.com/compute/docs/autoscaler
  4. //
  5. // Usage example:
  6. //
  7. // import "google.golang.org/api/autoscaler/v1beta2"
  8. // ...
  9. // autoscalerService, err := autoscaler.New(oauthHttpClient)
  10. package autoscaler // import "google.golang.org/api/autoscaler/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 = "autoscaler:v1beta2"
  41. const apiName = "autoscaler"
  42. const apiVersion = "v1beta2"
  43. const basePath = "https://www.googleapis.com/autoscaler/v1beta2/"
  44. // OAuth2 scopes used by this API.
  45. const (
  46. // View and manage your Google Compute Engine resources
  47. ComputeScope = "https://www.googleapis.com/auth/compute"
  48. // View your Google Compute Engine resources
  49. ComputeReadonlyScope = "https://www.googleapis.com/auth/compute.readonly"
  50. )
  51. func New(client *http.Client) (*Service, error) {
  52. if client == nil {
  53. return nil, errors.New("client is nil")
  54. }
  55. s := &Service{client: client, BasePath: basePath}
  56. s.Autoscalers = NewAutoscalersService(s)
  57. s.ZoneOperations = NewZoneOperationsService(s)
  58. s.Zones = NewZonesService(s)
  59. return s, nil
  60. }
  61. type Service struct {
  62. client *http.Client
  63. BasePath string // API endpoint base URL
  64. UserAgent string // optional additional User-Agent fragment
  65. Autoscalers *AutoscalersService
  66. ZoneOperations *ZoneOperationsService
  67. Zones *ZonesService
  68. }
  69. func (s *Service) userAgent() string {
  70. if s.UserAgent == "" {
  71. return googleapi.UserAgent
  72. }
  73. return googleapi.UserAgent + " " + s.UserAgent
  74. }
  75. func NewAutoscalersService(s *Service) *AutoscalersService {
  76. rs := &AutoscalersService{s: s}
  77. return rs
  78. }
  79. type AutoscalersService struct {
  80. s *Service
  81. }
  82. func NewZoneOperationsService(s *Service) *ZoneOperationsService {
  83. rs := &ZoneOperationsService{s: s}
  84. return rs
  85. }
  86. type ZoneOperationsService struct {
  87. s *Service
  88. }
  89. func NewZonesService(s *Service) *ZonesService {
  90. rs := &ZonesService{s: s}
  91. return rs
  92. }
  93. type ZonesService struct {
  94. s *Service
  95. }
  96. // Autoscaler: Cloud Autoscaler resource.
  97. type Autoscaler struct {
  98. // AutoscalingPolicy: Configuration parameters for autoscaling
  99. // algorithm.
  100. AutoscalingPolicy *AutoscalingPolicy `json:"autoscalingPolicy,omitempty"`
  101. // CreationTimestamp: [Output Only] Creation timestamp in RFC3339 text
  102. // format.
  103. CreationTimestamp string `json:"creationTimestamp,omitempty"`
  104. // Description: An optional textual description of the resource provided
  105. // by the client.
  106. Description string `json:"description,omitempty"`
  107. // Id: [Output Only] Unique identifier for the resource; defined by the
  108. // server.
  109. Id uint64 `json:"id,omitempty,string"`
  110. // Kind: Type of resource.
  111. Kind string `json:"kind,omitempty"`
  112. // Name: Name of the Autoscaler resource. Must be unique per project and
  113. // zone.
  114. Name string `json:"name,omitempty"`
  115. // SelfLink: [Output Only] A self-link to the Autoscaler configuration
  116. // resource.
  117. SelfLink string `json:"selfLink,omitempty"`
  118. // Target: URL to the entity which will be autoscaled. Currently the
  119. // only supported value is ReplicaPool?s URL. Note: it is illegal to
  120. // specify multiple Autoscalers for the same target.
  121. Target string `json:"target,omitempty"`
  122. // ServerResponse contains the HTTP response code and headers from the
  123. // server.
  124. googleapi.ServerResponse `json:"-"`
  125. // ForceSendFields is a list of field names (e.g. "AutoscalingPolicy")
  126. // to unconditionally include in API requests. By default, fields with
  127. // empty values are omitted from API requests. However, any non-pointer,
  128. // non-interface field appearing in ForceSendFields will be sent to the
  129. // server regardless of whether the field is empty or not. This may be
  130. // used to include empty fields in Patch requests.
  131. ForceSendFields []string `json:"-"`
  132. }
  133. func (s *Autoscaler) MarshalJSON() ([]byte, error) {
  134. type noMethod Autoscaler
  135. raw := noMethod(*s)
  136. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  137. }
  138. type AutoscalerListResponse struct {
  139. // Items: Autoscaler resources.
  140. Items []*Autoscaler `json:"items,omitempty"`
  141. // Kind: Type of resource.
  142. Kind string `json:"kind,omitempty"`
  143. // NextPageToken: [Output only] A token used to continue a truncated
  144. // list request.
  145. NextPageToken string `json:"nextPageToken,omitempty"`
  146. // ServerResponse contains the HTTP response code and headers from the
  147. // server.
  148. googleapi.ServerResponse `json:"-"`
  149. // ForceSendFields is a list of field names (e.g. "Items") to
  150. // unconditionally include in API requests. By default, fields with
  151. // empty values are omitted from API requests. However, any non-pointer,
  152. // non-interface field appearing in ForceSendFields will be sent to the
  153. // server regardless of whether the field is empty or not. This may be
  154. // used to include empty fields in Patch requests.
  155. ForceSendFields []string `json:"-"`
  156. }
  157. func (s *AutoscalerListResponse) MarshalJSON() ([]byte, error) {
  158. type noMethod AutoscalerListResponse
  159. raw := noMethod(*s)
  160. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  161. }
  162. // AutoscalingPolicy: Cloud Autoscaler policy.
  163. type AutoscalingPolicy struct {
  164. // CoolDownPeriodSec: The number of seconds that the Autoscaler should
  165. // wait between two succeeding changes to the number of virtual
  166. // machines. You should define an interval that is at least as long as
  167. // the initialization time of a virtual machine and the time it may take
  168. // for replica pool to create the virtual machine. The default is 60
  169. // seconds.
  170. CoolDownPeriodSec int64 `json:"coolDownPeriodSec,omitempty"`
  171. // CpuUtilization: Exactly one utilization policy should be provided.
  172. // Configuration parameters of CPU based autoscaling policy.
  173. CpuUtilization *AutoscalingPolicyCpuUtilization `json:"cpuUtilization,omitempty"`
  174. // CustomMetricUtilizations: Configuration parameters of autoscaling
  175. // based on custom metric.
  176. CustomMetricUtilizations []*AutoscalingPolicyCustomMetricUtilization `json:"customMetricUtilizations,omitempty"`
  177. // LoadBalancingUtilization: Configuration parameters of autoscaling
  178. // based on load balancer.
  179. LoadBalancingUtilization *AutoscalingPolicyLoadBalancingUtilization `json:"loadBalancingUtilization,omitempty"`
  180. // MaxNumReplicas: The maximum number of replicas that the Autoscaler
  181. // can scale up to.
  182. MaxNumReplicas int64 `json:"maxNumReplicas,omitempty"`
  183. // MinNumReplicas: The minimum number of replicas that the Autoscaler
  184. // can scale down to.
  185. MinNumReplicas int64 `json:"minNumReplicas,omitempty"`
  186. // ForceSendFields is a list of field names (e.g. "CoolDownPeriodSec")
  187. // to unconditionally include in API requests. By default, fields with
  188. // empty values are omitted from API requests. However, any non-pointer,
  189. // non-interface field appearing in ForceSendFields will be sent to the
  190. // server regardless of whether the field is empty or not. This may be
  191. // used to include empty fields in Patch requests.
  192. ForceSendFields []string `json:"-"`
  193. }
  194. func (s *AutoscalingPolicy) MarshalJSON() ([]byte, error) {
  195. type noMethod AutoscalingPolicy
  196. raw := noMethod(*s)
  197. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  198. }
  199. // AutoscalingPolicyCpuUtilization: CPU utilization policy.
  200. type AutoscalingPolicyCpuUtilization struct {
  201. // UtilizationTarget: The target utilization that the Autoscaler should
  202. // maintain. It is represented as a fraction of used cores. For example:
  203. // 6 cores used in 8-core VM are represented here as 0.75. Must be a
  204. // float value between (0, 1]. If not defined, the default is 0.8.
  205. UtilizationTarget float64 `json:"utilizationTarget,omitempty"`
  206. // ForceSendFields is a list of field names (e.g. "UtilizationTarget")
  207. // to unconditionally include in API requests. By default, fields with
  208. // empty values are omitted from API requests. However, any non-pointer,
  209. // non-interface field appearing in ForceSendFields will be sent to the
  210. // server regardless of whether the field is empty or not. This may be
  211. // used to include empty fields in Patch requests.
  212. ForceSendFields []string `json:"-"`
  213. }
  214. func (s *AutoscalingPolicyCpuUtilization) MarshalJSON() ([]byte, error) {
  215. type noMethod AutoscalingPolicyCpuUtilization
  216. raw := noMethod(*s)
  217. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  218. }
  219. // AutoscalingPolicyCustomMetricUtilization: Custom utilization metric
  220. // policy.
  221. type AutoscalingPolicyCustomMetricUtilization struct {
  222. // Metric: Identifier of the metric. It should be a Cloud Monitoring
  223. // metric. The metric can not have negative values. The metric should be
  224. // an utilization metric (increasing number of VMs handling requests x
  225. // times should reduce average value of the metric roughly x times). For
  226. // example you could use:
  227. // compute.googleapis.com/instance/network/received_bytes_count.
  228. Metric string `json:"metric,omitempty"`
  229. // UtilizationTarget: Target value of the metric which Autoscaler should
  230. // maintain. Must be a positive value.
  231. UtilizationTarget float64 `json:"utilizationTarget,omitempty"`
  232. // UtilizationTargetType: Defines type in which utilization_target is
  233. // expressed.
  234. UtilizationTargetType string `json:"utilizationTargetType,omitempty"`
  235. // ForceSendFields is a list of field names (e.g. "Metric") 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. }
  243. func (s *AutoscalingPolicyCustomMetricUtilization) MarshalJSON() ([]byte, error) {
  244. type noMethod AutoscalingPolicyCustomMetricUtilization
  245. raw := noMethod(*s)
  246. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  247. }
  248. // AutoscalingPolicyLoadBalancingUtilization: Load balancing utilization
  249. // policy.
  250. type AutoscalingPolicyLoadBalancingUtilization struct {
  251. // UtilizationTarget: Fraction of backend capacity utilization (set in
  252. // HTTP load balancing configuration) that Autoscaler should maintain.
  253. // Must be a positive float value. If not defined, the default is 0.8.
  254. // For example if your maxRatePerInstance capacity (in HTTP Load
  255. // Balancing configuration) is set at 10 and you would like to keep
  256. // number of instances such that each instance receives 7 QPS on
  257. // average, set this to 0.7.
  258. UtilizationTarget float64 `json:"utilizationTarget,omitempty"`
  259. // ForceSendFields is a list of field names (e.g. "UtilizationTarget")
  260. // to unconditionally include in API requests. By default, fields with
  261. // empty values are omitted from API requests. However, any non-pointer,
  262. // non-interface field appearing in ForceSendFields will be sent to the
  263. // server regardless of whether the field is empty or not. This may be
  264. // used to include empty fields in Patch requests.
  265. ForceSendFields []string `json:"-"`
  266. }
  267. func (s *AutoscalingPolicyLoadBalancingUtilization) MarshalJSON() ([]byte, error) {
  268. type noMethod AutoscalingPolicyLoadBalancingUtilization
  269. raw := noMethod(*s)
  270. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  271. }
  272. type DeprecationStatus struct {
  273. Deleted string `json:"deleted,omitempty"`
  274. Deprecated string `json:"deprecated,omitempty"`
  275. Obsolete string `json:"obsolete,omitempty"`
  276. Replacement string `json:"replacement,omitempty"`
  277. State string `json:"state,omitempty"`
  278. // ForceSendFields is a list of field names (e.g. "Deleted") to
  279. // unconditionally include in API requests. By default, fields with
  280. // empty values are omitted from API requests. However, any non-pointer,
  281. // non-interface field appearing in ForceSendFields will be sent to the
  282. // server regardless of whether the field is empty or not. This may be
  283. // used to include empty fields in Patch requests.
  284. ForceSendFields []string `json:"-"`
  285. }
  286. func (s *DeprecationStatus) MarshalJSON() ([]byte, error) {
  287. type noMethod DeprecationStatus
  288. raw := noMethod(*s)
  289. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  290. }
  291. type Operation struct {
  292. ClientOperationId string `json:"clientOperationId,omitempty"`
  293. CreationTimestamp string `json:"creationTimestamp,omitempty"`
  294. EndTime string `json:"endTime,omitempty"`
  295. Error *OperationError `json:"error,omitempty"`
  296. HttpErrorMessage string `json:"httpErrorMessage,omitempty"`
  297. HttpErrorStatusCode int64 `json:"httpErrorStatusCode,omitempty"`
  298. Id uint64 `json:"id,omitempty,string"`
  299. InsertTime string `json:"insertTime,omitempty"`
  300. // Kind: [Output Only] Type of the resource. Always compute#Operation
  301. // for Operation resources.
  302. Kind string `json:"kind,omitempty"`
  303. Name string `json:"name,omitempty"`
  304. OperationType string `json:"operationType,omitempty"`
  305. Progress int64 `json:"progress,omitempty"`
  306. Region string `json:"region,omitempty"`
  307. SelfLink string `json:"selfLink,omitempty"`
  308. StartTime string `json:"startTime,omitempty"`
  309. Status string `json:"status,omitempty"`
  310. StatusMessage string `json:"statusMessage,omitempty"`
  311. TargetId uint64 `json:"targetId,omitempty,string"`
  312. TargetLink string `json:"targetLink,omitempty"`
  313. User string `json:"user,omitempty"`
  314. Warnings []*OperationWarnings `json:"warnings,omitempty"`
  315. Zone string `json:"zone,omitempty"`
  316. // ServerResponse contains the HTTP response code and headers from the
  317. // server.
  318. googleapi.ServerResponse `json:"-"`
  319. // ForceSendFields is a list of field names (e.g. "ClientOperationId")
  320. // to unconditionally include in API requests. By default, fields with
  321. // empty values are omitted from API requests. However, any non-pointer,
  322. // non-interface field appearing in ForceSendFields will be sent to the
  323. // server regardless of whether the field is empty or not. This may be
  324. // used to include empty fields in Patch requests.
  325. ForceSendFields []string `json:"-"`
  326. }
  327. func (s *Operation) MarshalJSON() ([]byte, error) {
  328. type noMethod Operation
  329. raw := noMethod(*s)
  330. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  331. }
  332. type OperationError struct {
  333. Errors []*OperationErrorErrors `json:"errors,omitempty"`
  334. // ForceSendFields is a list of field names (e.g. "Errors") to
  335. // unconditionally include in API requests. By default, fields with
  336. // empty values are omitted from API requests. However, any non-pointer,
  337. // non-interface field appearing in ForceSendFields will be sent to the
  338. // server regardless of whether the field is empty or not. This may be
  339. // used to include empty fields in Patch requests.
  340. ForceSendFields []string `json:"-"`
  341. }
  342. func (s *OperationError) MarshalJSON() ([]byte, error) {
  343. type noMethod OperationError
  344. raw := noMethod(*s)
  345. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  346. }
  347. type OperationErrorErrors struct {
  348. Code string `json:"code,omitempty"`
  349. Location string `json:"location,omitempty"`
  350. Message string `json:"message,omitempty"`
  351. // ForceSendFields is a list of field names (e.g. "Code") to
  352. // unconditionally include in API requests. By default, fields with
  353. // empty values are omitted from API requests. However, any non-pointer,
  354. // non-interface field appearing in ForceSendFields will be sent to the
  355. // server regardless of whether the field is empty or not. This may be
  356. // used to include empty fields in Patch requests.
  357. ForceSendFields []string `json:"-"`
  358. }
  359. func (s *OperationErrorErrors) MarshalJSON() ([]byte, error) {
  360. type noMethod OperationErrorErrors
  361. raw := noMethod(*s)
  362. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  363. }
  364. type OperationWarnings struct {
  365. Code string `json:"code,omitempty"`
  366. Data []*OperationWarningsData `json:"data,omitempty"`
  367. Message string `json:"message,omitempty"`
  368. // ForceSendFields is a list of field names (e.g. "Code") to
  369. // unconditionally include in API requests. By default, fields with
  370. // empty values are omitted from API requests. However, any non-pointer,
  371. // non-interface field appearing in ForceSendFields will be sent to the
  372. // server regardless of whether the field is empty or not. This may be
  373. // used to include empty fields in Patch requests.
  374. ForceSendFields []string `json:"-"`
  375. }
  376. func (s *OperationWarnings) MarshalJSON() ([]byte, error) {
  377. type noMethod OperationWarnings
  378. raw := noMethod(*s)
  379. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  380. }
  381. type OperationWarningsData struct {
  382. Key string `json:"key,omitempty"`
  383. Value string `json:"value,omitempty"`
  384. // ForceSendFields is a list of field names (e.g. "Key") to
  385. // unconditionally include in API requests. By default, fields with
  386. // empty values are omitted from API requests. However, any non-pointer,
  387. // non-interface field appearing in ForceSendFields will be sent to the
  388. // server regardless of whether the field is empty or not. This may be
  389. // used to include empty fields in Patch requests.
  390. ForceSendFields []string `json:"-"`
  391. }
  392. func (s *OperationWarningsData) MarshalJSON() ([]byte, error) {
  393. type noMethod OperationWarningsData
  394. raw := noMethod(*s)
  395. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  396. }
  397. type OperationList struct {
  398. Id string `json:"id,omitempty"`
  399. Items []*Operation `json:"items,omitempty"`
  400. // Kind: [Output Only] Type of resource. Always compute#operations for
  401. // Operations resource.
  402. Kind string `json:"kind,omitempty"`
  403. NextPageToken string `json:"nextPageToken,omitempty"`
  404. SelfLink string `json:"selfLink,omitempty"`
  405. // ServerResponse contains the HTTP response code and headers from the
  406. // server.
  407. googleapi.ServerResponse `json:"-"`
  408. // ForceSendFields is a list of field names (e.g. "Id") to
  409. // unconditionally include in API requests. By default, fields with
  410. // empty values are omitted from API requests. However, any non-pointer,
  411. // non-interface field appearing in ForceSendFields will be sent to the
  412. // server regardless of whether the field is empty or not. This may be
  413. // used to include empty fields in Patch requests.
  414. ForceSendFields []string `json:"-"`
  415. }
  416. func (s *OperationList) MarshalJSON() ([]byte, error) {
  417. type noMethod OperationList
  418. raw := noMethod(*s)
  419. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  420. }
  421. type Zone struct {
  422. CreationTimestamp string `json:"creationTimestamp,omitempty"`
  423. Deprecated *DeprecationStatus `json:"deprecated,omitempty"`
  424. Description string `json:"description,omitempty"`
  425. Id uint64 `json:"id,omitempty,string"`
  426. // Kind: [Output Only] Type of the resource. Always kind#zone for zones.
  427. Kind string `json:"kind,omitempty"`
  428. MaintenanceWindows []*ZoneMaintenanceWindows `json:"maintenanceWindows,omitempty"`
  429. Name string `json:"name,omitempty"`
  430. Region string `json:"region,omitempty"`
  431. // SelfLink: [Output Only] Server defined URL for the resource.
  432. SelfLink string `json:"selfLink,omitempty"`
  433. Status string `json:"status,omitempty"`
  434. // ForceSendFields is a list of field names (e.g. "CreationTimestamp")
  435. // to unconditionally include in API requests. By default, fields with
  436. // empty values are omitted from API requests. However, any non-pointer,
  437. // non-interface field appearing in ForceSendFields will be sent to the
  438. // server regardless of whether the field is empty or not. This may be
  439. // used to include empty fields in Patch requests.
  440. ForceSendFields []string `json:"-"`
  441. }
  442. func (s *Zone) MarshalJSON() ([]byte, error) {
  443. type noMethod Zone
  444. raw := noMethod(*s)
  445. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  446. }
  447. type ZoneMaintenanceWindows struct {
  448. BeginTime string `json:"beginTime,omitempty"`
  449. Description string `json:"description,omitempty"`
  450. EndTime string `json:"endTime,omitempty"`
  451. Name string `json:"name,omitempty"`
  452. // ForceSendFields is a list of field names (e.g. "BeginTime") to
  453. // unconditionally include in API requests. By default, fields with
  454. // empty values are omitted from API requests. However, any non-pointer,
  455. // non-interface field appearing in ForceSendFields will be sent to the
  456. // server regardless of whether the field is empty or not. This may be
  457. // used to include empty fields in Patch requests.
  458. ForceSendFields []string `json:"-"`
  459. }
  460. func (s *ZoneMaintenanceWindows) MarshalJSON() ([]byte, error) {
  461. type noMethod ZoneMaintenanceWindows
  462. raw := noMethod(*s)
  463. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  464. }
  465. type ZoneList struct {
  466. Id string `json:"id,omitempty"`
  467. Items []*Zone `json:"items,omitempty"`
  468. // Kind: Type of resource.
  469. Kind string `json:"kind,omitempty"`
  470. NextPageToken string `json:"nextPageToken,omitempty"`
  471. // SelfLink: Server defined URL for this resource (output only).
  472. SelfLink string `json:"selfLink,omitempty"`
  473. // ServerResponse contains the HTTP response code and headers from the
  474. // server.
  475. googleapi.ServerResponse `json:"-"`
  476. // ForceSendFields is a list of field names (e.g. "Id") to
  477. // unconditionally include in API requests. By default, fields with
  478. // empty values are omitted from API requests. However, any non-pointer,
  479. // non-interface field appearing in ForceSendFields will be sent to the
  480. // server regardless of whether the field is empty or not. This may be
  481. // used to include empty fields in Patch requests.
  482. ForceSendFields []string `json:"-"`
  483. }
  484. func (s *ZoneList) MarshalJSON() ([]byte, error) {
  485. type noMethod ZoneList
  486. raw := noMethod(*s)
  487. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  488. }
  489. // method id "autoscaler.autoscalers.delete":
  490. type AutoscalersDeleteCall struct {
  491. s *Service
  492. project string
  493. zone string
  494. autoscaler string
  495. urlParams_ gensupport.URLParams
  496. ctx_ context.Context
  497. }
  498. // Delete: Deletes the specified Autoscaler resource.
  499. func (r *AutoscalersService) Delete(project string, zone string, autoscaler string) *AutoscalersDeleteCall {
  500. c := &AutoscalersDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  501. c.project = project
  502. c.zone = zone
  503. c.autoscaler = autoscaler
  504. return c
  505. }
  506. // Fields allows partial responses to be retrieved. See
  507. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  508. // for more information.
  509. func (c *AutoscalersDeleteCall) Fields(s ...googleapi.Field) *AutoscalersDeleteCall {
  510. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  511. return c
  512. }
  513. // Context sets the context to be used in this call's Do method. Any
  514. // pending HTTP request will be aborted if the provided context is
  515. // canceled.
  516. func (c *AutoscalersDeleteCall) Context(ctx context.Context) *AutoscalersDeleteCall {
  517. c.ctx_ = ctx
  518. return c
  519. }
  520. func (c *AutoscalersDeleteCall) doRequest(alt string) (*http.Response, error) {
  521. var body io.Reader = nil
  522. c.urlParams_.Set("alt", alt)
  523. urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{project}/zones/{zone}/autoscalers/{autoscaler}")
  524. urls += "?" + c.urlParams_.Encode()
  525. req, _ := http.NewRequest("DELETE", urls, body)
  526. googleapi.Expand(req.URL, map[string]string{
  527. "project": c.project,
  528. "zone": c.zone,
  529. "autoscaler": c.autoscaler,
  530. })
  531. req.Header.Set("User-Agent", c.s.userAgent())
  532. if c.ctx_ != nil {
  533. return ctxhttp.Do(c.ctx_, c.s.client, req)
  534. }
  535. return c.s.client.Do(req)
  536. }
  537. // Do executes the "autoscaler.autoscalers.delete" call.
  538. // Exactly one of *Operation or error will be non-nil. Any non-2xx
  539. // status code is an error. Response headers are in either
  540. // *Operation.ServerResponse.Header or (if a response was returned at
  541. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  542. // to check whether the returned error was because
  543. // http.StatusNotModified was returned.
  544. func (c *AutoscalersDeleteCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
  545. gensupport.SetOptions(c.urlParams_, opts...)
  546. res, err := c.doRequest("json")
  547. if res != nil && res.StatusCode == http.StatusNotModified {
  548. if res.Body != nil {
  549. res.Body.Close()
  550. }
  551. return nil, &googleapi.Error{
  552. Code: res.StatusCode,
  553. Header: res.Header,
  554. }
  555. }
  556. if err != nil {
  557. return nil, err
  558. }
  559. defer googleapi.CloseBody(res)
  560. if err := googleapi.CheckResponse(res); err != nil {
  561. return nil, err
  562. }
  563. ret := &Operation{
  564. ServerResponse: googleapi.ServerResponse{
  565. Header: res.Header,
  566. HTTPStatusCode: res.StatusCode,
  567. },
  568. }
  569. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  570. return nil, err
  571. }
  572. return ret, nil
  573. // {
  574. // "description": "Deletes the specified Autoscaler resource.",
  575. // "httpMethod": "DELETE",
  576. // "id": "autoscaler.autoscalers.delete",
  577. // "parameterOrder": [
  578. // "project",
  579. // "zone",
  580. // "autoscaler"
  581. // ],
  582. // "parameters": {
  583. // "autoscaler": {
  584. // "description": "Name of the Autoscaler resource.",
  585. // "location": "path",
  586. // "required": true,
  587. // "type": "string"
  588. // },
  589. // "project": {
  590. // "description": "Project ID of Autoscaler resource.",
  591. // "location": "path",
  592. // "required": true,
  593. // "type": "string"
  594. // },
  595. // "zone": {
  596. // "description": "Zone name of Autoscaler resource.",
  597. // "location": "path",
  598. // "required": true,
  599. // "type": "string"
  600. // }
  601. // },
  602. // "path": "projects/{project}/zones/{zone}/autoscalers/{autoscaler}",
  603. // "response": {
  604. // "$ref": "Operation"
  605. // },
  606. // "scopes": [
  607. // "https://www.googleapis.com/auth/compute"
  608. // ]
  609. // }
  610. }
  611. // method id "autoscaler.autoscalers.get":
  612. type AutoscalersGetCall struct {
  613. s *Service
  614. project string
  615. zone string
  616. autoscaler string
  617. urlParams_ gensupport.URLParams
  618. ifNoneMatch_ string
  619. ctx_ context.Context
  620. }
  621. // Get: Gets the specified Autoscaler resource.
  622. func (r *AutoscalersService) Get(project string, zone string, autoscaler string) *AutoscalersGetCall {
  623. c := &AutoscalersGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  624. c.project = project
  625. c.zone = zone
  626. c.autoscaler = autoscaler
  627. return c
  628. }
  629. // Fields allows partial responses to be retrieved. See
  630. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  631. // for more information.
  632. func (c *AutoscalersGetCall) Fields(s ...googleapi.Field) *AutoscalersGetCall {
  633. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  634. return c
  635. }
  636. // IfNoneMatch sets the optional parameter which makes the operation
  637. // fail if the object's ETag matches the given value. This is useful for
  638. // getting updates only after the object has changed since the last
  639. // request. Use googleapi.IsNotModified to check whether the response
  640. // error from Do is the result of In-None-Match.
  641. func (c *AutoscalersGetCall) IfNoneMatch(entityTag string) *AutoscalersGetCall {
  642. c.ifNoneMatch_ = entityTag
  643. return c
  644. }
  645. // Context sets the context to be used in this call's Do method. Any
  646. // pending HTTP request will be aborted if the provided context is
  647. // canceled.
  648. func (c *AutoscalersGetCall) Context(ctx context.Context) *AutoscalersGetCall {
  649. c.ctx_ = ctx
  650. return c
  651. }
  652. func (c *AutoscalersGetCall) doRequest(alt string) (*http.Response, error) {
  653. var body io.Reader = nil
  654. c.urlParams_.Set("alt", alt)
  655. urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{project}/zones/{zone}/autoscalers/{autoscaler}")
  656. urls += "?" + c.urlParams_.Encode()
  657. req, _ := http.NewRequest("GET", urls, body)
  658. googleapi.Expand(req.URL, map[string]string{
  659. "project": c.project,
  660. "zone": c.zone,
  661. "autoscaler": c.autoscaler,
  662. })
  663. req.Header.Set("User-Agent", c.s.userAgent())
  664. if c.ifNoneMatch_ != "" {
  665. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  666. }
  667. if c.ctx_ != nil {
  668. return ctxhttp.Do(c.ctx_, c.s.client, req)
  669. }
  670. return c.s.client.Do(req)
  671. }
  672. // Do executes the "autoscaler.autoscalers.get" call.
  673. // Exactly one of *Autoscaler or error will be non-nil. Any non-2xx
  674. // status code is an error. Response headers are in either
  675. // *Autoscaler.ServerResponse.Header or (if a response was returned at
  676. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  677. // to check whether the returned error was because
  678. // http.StatusNotModified was returned.
  679. func (c *AutoscalersGetCall) Do(opts ...googleapi.CallOption) (*Autoscaler, error) {
  680. gensupport.SetOptions(c.urlParams_, opts...)
  681. res, err := c.doRequest("json")
  682. if res != nil && res.StatusCode == http.StatusNotModified {
  683. if res.Body != nil {
  684. res.Body.Close()
  685. }
  686. return nil, &googleapi.Error{
  687. Code: res.StatusCode,
  688. Header: res.Header,
  689. }
  690. }
  691. if err != nil {
  692. return nil, err
  693. }
  694. defer googleapi.CloseBody(res)
  695. if err := googleapi.CheckResponse(res); err != nil {
  696. return nil, err
  697. }
  698. ret := &Autoscaler{
  699. ServerResponse: googleapi.ServerResponse{
  700. Header: res.Header,
  701. HTTPStatusCode: res.StatusCode,
  702. },
  703. }
  704. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  705. return nil, err
  706. }
  707. return ret, nil
  708. // {
  709. // "description": "Gets the specified Autoscaler resource.",
  710. // "httpMethod": "GET",
  711. // "id": "autoscaler.autoscalers.get",
  712. // "parameterOrder": [
  713. // "project",
  714. // "zone",
  715. // "autoscaler"
  716. // ],
  717. // "parameters": {
  718. // "autoscaler": {
  719. // "description": "Name of the Autoscaler resource.",
  720. // "location": "path",
  721. // "required": true,
  722. // "type": "string"
  723. // },
  724. // "project": {
  725. // "description": "Project ID of Autoscaler resource.",
  726. // "location": "path",
  727. // "required": true,
  728. // "type": "string"
  729. // },
  730. // "zone": {
  731. // "description": "Zone name of Autoscaler resource.",
  732. // "location": "path",
  733. // "required": true,
  734. // "type": "string"
  735. // }
  736. // },
  737. // "path": "projects/{project}/zones/{zone}/autoscalers/{autoscaler}",
  738. // "response": {
  739. // "$ref": "Autoscaler"
  740. // },
  741. // "scopes": [
  742. // "https://www.googleapis.com/auth/compute",
  743. // "https://www.googleapis.com/auth/compute.readonly"
  744. // ]
  745. // }
  746. }
  747. // method id "autoscaler.autoscalers.insert":
  748. type AutoscalersInsertCall struct {
  749. s *Service
  750. project string
  751. zone string
  752. autoscaler *Autoscaler
  753. urlParams_ gensupport.URLParams
  754. ctx_ context.Context
  755. }
  756. // Insert: Adds new Autoscaler resource.
  757. func (r *AutoscalersService) Insert(project string, zone string, autoscaler *Autoscaler) *AutoscalersInsertCall {
  758. c := &AutoscalersInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  759. c.project = project
  760. c.zone = zone
  761. c.autoscaler = autoscaler
  762. return c
  763. }
  764. // Fields allows partial responses to be retrieved. See
  765. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  766. // for more information.
  767. func (c *AutoscalersInsertCall) Fields(s ...googleapi.Field) *AutoscalersInsertCall {
  768. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  769. return c
  770. }
  771. // Context sets the context to be used in this call's Do method. Any
  772. // pending HTTP request will be aborted if the provided context is
  773. // canceled.
  774. func (c *AutoscalersInsertCall) Context(ctx context.Context) *AutoscalersInsertCall {
  775. c.ctx_ = ctx
  776. return c
  777. }
  778. func (c *AutoscalersInsertCall) doRequest(alt string) (*http.Response, error) {
  779. var body io.Reader = nil
  780. body, err := googleapi.WithoutDataWrapper.JSONReader(c.autoscaler)
  781. if err != nil {
  782. return nil, err
  783. }
  784. ctype := "application/json"
  785. c.urlParams_.Set("alt", alt)
  786. urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{project}/zones/{zone}/autoscalers")
  787. urls += "?" + c.urlParams_.Encode()
  788. req, _ := http.NewRequest("POST", urls, body)
  789. googleapi.Expand(req.URL, map[string]string{
  790. "project": c.project,
  791. "zone": c.zone,
  792. })
  793. req.Header.Set("Content-Type", ctype)
  794. req.Header.Set("User-Agent", c.s.userAgent())
  795. if c.ctx_ != nil {
  796. return ctxhttp.Do(c.ctx_, c.s.client, req)
  797. }
  798. return c.s.client.Do(req)
  799. }
  800. // Do executes the "autoscaler.autoscalers.insert" call.
  801. // Exactly one of *Operation or error will be non-nil. Any non-2xx
  802. // status code is an error. Response headers are in either
  803. // *Operation.ServerResponse.Header or (if a response was returned at
  804. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  805. // to check whether the returned error was because
  806. // http.StatusNotModified was returned.
  807. func (c *AutoscalersInsertCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
  808. gensupport.SetOptions(c.urlParams_, opts...)
  809. res, err := c.doRequest("json")
  810. if res != nil && res.StatusCode == http.StatusNotModified {
  811. if res.Body != nil {
  812. res.Body.Close()
  813. }
  814. return nil, &googleapi.Error{
  815. Code: res.StatusCode,
  816. Header: res.Header,
  817. }
  818. }
  819. if err != nil {
  820. return nil, err
  821. }
  822. defer googleapi.CloseBody(res)
  823. if err := googleapi.CheckResponse(res); err != nil {
  824. return nil, err
  825. }
  826. ret := &Operation{
  827. ServerResponse: googleapi.ServerResponse{
  828. Header: res.Header,
  829. HTTPStatusCode: res.StatusCode,
  830. },
  831. }
  832. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  833. return nil, err
  834. }
  835. return ret, nil
  836. // {
  837. // "description": "Adds new Autoscaler resource.",
  838. // "httpMethod": "POST",
  839. // "id": "autoscaler.autoscalers.insert",
  840. // "parameterOrder": [
  841. // "project",
  842. // "zone"
  843. // ],
  844. // "parameters": {
  845. // "project": {
  846. // "description": "Project ID of Autoscaler resource.",
  847. // "location": "path",
  848. // "required": true,
  849. // "type": "string"
  850. // },
  851. // "zone": {
  852. // "description": "Zone name of Autoscaler resource.",
  853. // "location": "path",
  854. // "required": true,
  855. // "type": "string"
  856. // }
  857. // },
  858. // "path": "projects/{project}/zones/{zone}/autoscalers",
  859. // "request": {
  860. // "$ref": "Autoscaler"
  861. // },
  862. // "response": {
  863. // "$ref": "Operation"
  864. // },
  865. // "scopes": [
  866. // "https://www.googleapis.com/auth/compute"
  867. // ]
  868. // }
  869. }
  870. // method id "autoscaler.autoscalers.list":
  871. type AutoscalersListCall struct {
  872. s *Service
  873. project string
  874. zone string
  875. urlParams_ gensupport.URLParams
  876. ifNoneMatch_ string
  877. ctx_ context.Context
  878. }
  879. // List: Lists all Autoscaler resources in this zone.
  880. func (r *AutoscalersService) List(project string, zone string) *AutoscalersListCall {
  881. c := &AutoscalersListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  882. c.project = project
  883. c.zone = zone
  884. return c
  885. }
  886. // Filter sets the optional parameter "filter":
  887. func (c *AutoscalersListCall) Filter(filter string) *AutoscalersListCall {
  888. c.urlParams_.Set("filter", filter)
  889. return c
  890. }
  891. // MaxResults sets the optional parameter "maxResults":
  892. func (c *AutoscalersListCall) MaxResults(maxResults int64) *AutoscalersListCall {
  893. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  894. return c
  895. }
  896. // PageToken sets the optional parameter "pageToken":
  897. func (c *AutoscalersListCall) PageToken(pageToken string) *AutoscalersListCall {
  898. c.urlParams_.Set("pageToken", pageToken)
  899. return c
  900. }
  901. // Fields allows partial responses to be retrieved. See
  902. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  903. // for more information.
  904. func (c *AutoscalersListCall) Fields(s ...googleapi.Field) *AutoscalersListCall {
  905. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  906. return c
  907. }
  908. // IfNoneMatch sets the optional parameter which makes the operation
  909. // fail if the object's ETag matches the given value. This is useful for
  910. // getting updates only after the object has changed since the last
  911. // request. Use googleapi.IsNotModified to check whether the response
  912. // error from Do is the result of In-None-Match.
  913. func (c *AutoscalersListCall) IfNoneMatch(entityTag string) *AutoscalersListCall {
  914. c.ifNoneMatch_ = entityTag
  915. return c
  916. }
  917. // Context sets the context to be used in this call's Do method. Any
  918. // pending HTTP request will be aborted if the provided context is
  919. // canceled.
  920. func (c *AutoscalersListCall) Context(ctx context.Context) *AutoscalersListCall {
  921. c.ctx_ = ctx
  922. return c
  923. }
  924. func (c *AutoscalersListCall) doRequest(alt string) (*http.Response, error) {
  925. var body io.Reader = nil
  926. c.urlParams_.Set("alt", alt)
  927. urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{project}/zones/{zone}/autoscalers")
  928. urls += "?" + c.urlParams_.Encode()
  929. req, _ := http.NewRequest("GET", urls, body)
  930. googleapi.Expand(req.URL, map[string]string{
  931. "project": c.project,
  932. "zone": c.zone,
  933. })
  934. req.Header.Set("User-Agent", c.s.userAgent())
  935. if c.ifNoneMatch_ != "" {
  936. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  937. }
  938. if c.ctx_ != nil {
  939. return ctxhttp.Do(c.ctx_, c.s.client, req)
  940. }
  941. return c.s.client.Do(req)
  942. }
  943. // Do executes the "autoscaler.autoscalers.list" call.
  944. // Exactly one of *AutoscalerListResponse or error will be non-nil. Any
  945. // non-2xx status code is an error. Response headers are in either
  946. // *AutoscalerListResponse.ServerResponse.Header or (if a response was
  947. // returned at all) in error.(*googleapi.Error).Header. Use
  948. // googleapi.IsNotModified to check whether the returned error was
  949. // because http.StatusNotModified was returned.
  950. func (c *AutoscalersListCall) Do(opts ...googleapi.CallOption) (*AutoscalerListResponse, error) {
  951. gensupport.SetOptions(c.urlParams_, opts...)
  952. res, err := c.doRequest("json")
  953. if res != nil && res.StatusCode == http.StatusNotModified {
  954. if res.Body != nil {
  955. res.Body.Close()
  956. }
  957. return nil, &googleapi.Error{
  958. Code: res.StatusCode,
  959. Header: res.Header,
  960. }
  961. }
  962. if err != nil {
  963. return nil, err
  964. }
  965. defer googleapi.CloseBody(res)
  966. if err := googleapi.CheckResponse(res); err != nil {
  967. return nil, err
  968. }
  969. ret := &AutoscalerListResponse{
  970. ServerResponse: googleapi.ServerResponse{
  971. Header: res.Header,
  972. HTTPStatusCode: res.StatusCode,
  973. },
  974. }
  975. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  976. return nil, err
  977. }
  978. return ret, nil
  979. // {
  980. // "description": "Lists all Autoscaler resources in this zone.",
  981. // "httpMethod": "GET",
  982. // "id": "autoscaler.autoscalers.list",
  983. // "parameterOrder": [
  984. // "project",
  985. // "zone"
  986. // ],
  987. // "parameters": {
  988. // "filter": {
  989. // "location": "query",
  990. // "type": "string"
  991. // },
  992. // "maxResults": {
  993. // "default": "500",
  994. // "format": "uint32",
  995. // "location": "query",
  996. // "maximum": "500",
  997. // "minimum": "0",
  998. // "type": "integer"
  999. // },
  1000. // "pageToken": {
  1001. // "location": "query",
  1002. // "type": "string"
  1003. // },
  1004. // "project": {
  1005. // "description": "Project ID of Autoscaler resource.",
  1006. // "location": "path",
  1007. // "required": true,
  1008. // "type": "string"
  1009. // },
  1010. // "zone": {
  1011. // "description": "Zone name of Autoscaler resource.",
  1012. // "location": "path",
  1013. // "required": true,
  1014. // "type": "string"
  1015. // }
  1016. // },
  1017. // "path": "projects/{project}/zones/{zone}/autoscalers",
  1018. // "response": {
  1019. // "$ref": "AutoscalerListResponse"
  1020. // },
  1021. // "scopes": [
  1022. // "https://www.googleapis.com/auth/compute",
  1023. // "https://www.googleapis.com/auth/compute.readonly"
  1024. // ]
  1025. // }
  1026. }
  1027. // Pages invokes f for each page of results.
  1028. // A non-nil error returned from f will halt the iteration.
  1029. // The provided context supersedes any context provided to the Context method.
  1030. func (c *AutoscalersListCall) Pages(ctx context.Context, f func(*AutoscalerListResponse) error) error {
  1031. c.ctx_ = ctx
  1032. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  1033. for {
  1034. x, err := c.Do()
  1035. if err != nil {
  1036. return err
  1037. }
  1038. if err := f(x); err != nil {
  1039. return err
  1040. }
  1041. if x.NextPageToken == "" {
  1042. return nil
  1043. }
  1044. c.PageToken(x.NextPageToken)
  1045. }
  1046. }
  1047. // method id "autoscaler.autoscalers.patch":
  1048. type AutoscalersPatchCall struct {
  1049. s *Service
  1050. project string
  1051. zone string
  1052. autoscaler string
  1053. autoscaler2 *Autoscaler
  1054. urlParams_ gensupport.URLParams
  1055. ctx_ context.Context
  1056. }
  1057. // Patch: Update the entire content of the Autoscaler resource. This
  1058. // method supports patch semantics.
  1059. func (r *AutoscalersService) Patch(project string, zone string, autoscaler string, autoscaler2 *Autoscaler) *AutoscalersPatchCall {
  1060. c := &AutoscalersPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1061. c.project = project
  1062. c.zone = zone
  1063. c.autoscaler = autoscaler
  1064. c.autoscaler2 = autoscaler2
  1065. return c
  1066. }
  1067. // Fields allows partial responses to be retrieved. See
  1068. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1069. // for more information.
  1070. func (c *AutoscalersPatchCall) Fields(s ...googleapi.Field) *AutoscalersPatchCall {
  1071. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1072. return c
  1073. }
  1074. // Context sets the context to be used in this call's Do method. Any
  1075. // pending HTTP request will be aborted if the provided context is
  1076. // canceled.
  1077. func (c *AutoscalersPatchCall) Context(ctx context.Context) *AutoscalersPatchCall {
  1078. c.ctx_ = ctx
  1079. return c
  1080. }
  1081. func (c *AutoscalersPatchCall) doRequest(alt string) (*http.Response, error) {
  1082. var body io.Reader = nil
  1083. body, err := googleapi.WithoutDataWrapper.JSONReader(c.autoscaler2)
  1084. if err != nil {
  1085. return nil, err
  1086. }
  1087. ctype := "application/json"
  1088. c.urlParams_.Set("alt", alt)
  1089. urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{project}/zones/{zone}/autoscalers/{autoscaler}")
  1090. urls += "?" + c.urlParams_.Encode()
  1091. req, _ := http.NewRequest("PATCH", urls, body)
  1092. googleapi.Expand(req.URL, map[string]string{
  1093. "project": c.project,
  1094. "zone": c.zone,
  1095. "autoscaler": c.autoscaler,
  1096. })
  1097. req.Header.Set("Content-Type", ctype)
  1098. req.Header.Set("User-Agent", c.s.userAgent())
  1099. if c.ctx_ != nil {
  1100. return ctxhttp.Do(c.ctx_, c.s.client, req)
  1101. }
  1102. return c.s.client.Do(req)
  1103. }
  1104. // Do executes the "autoscaler.autoscalers.patch" call.
  1105. // Exactly one of *Operation or error will be non-nil. Any non-2xx
  1106. // status code is an error. Response headers are in either
  1107. // *Operation.ServerResponse.Header or (if a response was returned at
  1108. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  1109. // to check whether the returned error was because
  1110. // http.StatusNotModified was returned.
  1111. func (c *AutoscalersPatchCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
  1112. gensupport.SetOptions(c.urlParams_, opts...)
  1113. res, err := c.doRequest("json")
  1114. if res != nil && res.StatusCode == http.StatusNotModified {
  1115. if res.Body != nil {
  1116. res.Body.Close()
  1117. }
  1118. return nil, &googleapi.Error{
  1119. Code: res.StatusCode,
  1120. Header: res.Header,
  1121. }
  1122. }
  1123. if err != nil {
  1124. return nil, err
  1125. }
  1126. defer googleapi.CloseBody(res)
  1127. if err := googleapi.CheckResponse(res); err != nil {
  1128. return nil, err
  1129. }
  1130. ret := &Operation{
  1131. ServerResponse: googleapi.ServerResponse{
  1132. Header: res.Header,
  1133. HTTPStatusCode: res.StatusCode,
  1134. },
  1135. }
  1136. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  1137. return nil, err
  1138. }
  1139. return ret, nil
  1140. // {
  1141. // "description": "Update the entire content of the Autoscaler resource. This method supports patch semantics.",
  1142. // "httpMethod": "PATCH",
  1143. // "id": "autoscaler.autoscalers.patch",
  1144. // "parameterOrder": [
  1145. // "project",
  1146. // "zone",
  1147. // "autoscaler"
  1148. // ],
  1149. // "parameters": {
  1150. // "autoscaler": {
  1151. // "description": "Name of the Autoscaler resource.",
  1152. // "location": "path",
  1153. // "required": true,
  1154. // "type": "string"
  1155. // },
  1156. // "project": {
  1157. // "description": "Project ID of Autoscaler resource.",
  1158. // "location": "path",
  1159. // "required": true,
  1160. // "type": "string"
  1161. // },
  1162. // "zone": {
  1163. // "description": "Zone name of Autoscaler resource.",
  1164. // "location": "path",
  1165. // "required": true,
  1166. // "type": "string"
  1167. // }
  1168. // },
  1169. // "path": "projects/{project}/zones/{zone}/autoscalers/{autoscaler}",
  1170. // "request": {
  1171. // "$ref": "Autoscaler"
  1172. // },
  1173. // "response": {
  1174. // "$ref": "Operation"
  1175. // },
  1176. // "scopes": [
  1177. // "https://www.googleapis.com/auth/compute"
  1178. // ]
  1179. // }
  1180. }
  1181. // method id "autoscaler.autoscalers.update":
  1182. type AutoscalersUpdateCall struct {
  1183. s *Service
  1184. project string
  1185. zone string
  1186. autoscaler string
  1187. autoscaler2 *Autoscaler
  1188. urlParams_ gensupport.URLParams
  1189. ctx_ context.Context
  1190. }
  1191. // Update: Update the entire content of the Autoscaler resource.
  1192. func (r *AutoscalersService) Update(project string, zone string, autoscaler string, autoscaler2 *Autoscaler) *AutoscalersUpdateCall {
  1193. c := &AutoscalersUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1194. c.project = project
  1195. c.zone = zone
  1196. c.autoscaler = autoscaler
  1197. c.autoscaler2 = autoscaler2
  1198. return c
  1199. }
  1200. // Fields allows partial responses to be retrieved. See
  1201. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1202. // for more information.
  1203. func (c *AutoscalersUpdateCall) Fields(s ...googleapi.Field) *AutoscalersUpdateCall {
  1204. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1205. return c
  1206. }
  1207. // Context sets the context to be used in this call's Do method. Any
  1208. // pending HTTP request will be aborted if the provided context is
  1209. // canceled.
  1210. func (c *AutoscalersUpdateCall) Context(ctx context.Context) *AutoscalersUpdateCall {
  1211. c.ctx_ = ctx
  1212. return c
  1213. }
  1214. func (c *AutoscalersUpdateCall) doRequest(alt string) (*http.Response, error) {
  1215. var body io.Reader = nil
  1216. body, err := googleapi.WithoutDataWrapper.JSONReader(c.autoscaler2)
  1217. if err != nil {
  1218. return nil, err
  1219. }
  1220. ctype := "application/json"
  1221. c.urlParams_.Set("alt", alt)
  1222. urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{project}/zones/{zone}/autoscalers/{autoscaler}")
  1223. urls += "?" + c.urlParams_.Encode()
  1224. req, _ := http.NewRequest("PUT", urls, body)
  1225. googleapi.Expand(req.URL, map[string]string{
  1226. "project": c.project,
  1227. "zone": c.zone,
  1228. "autoscaler": c.autoscaler,
  1229. })
  1230. req.Header.Set("Content-Type", ctype)
  1231. req.Header.Set("User-Agent", c.s.userAgent())
  1232. if c.ctx_ != nil {
  1233. return ctxhttp.Do(c.ctx_, c.s.client, req)
  1234. }
  1235. return c.s.client.Do(req)
  1236. }
  1237. // Do executes the "autoscaler.autoscalers.update" call.
  1238. // Exactly one of *Operation or error will be non-nil. Any non-2xx
  1239. // status code is an error. Response headers are in either
  1240. // *Operation.ServerResponse.Header or (if a response was returned at
  1241. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  1242. // to check whether the returned error was because
  1243. // http.StatusNotModified was returned.
  1244. func (c *AutoscalersUpdateCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
  1245. gensupport.SetOptions(c.urlParams_, opts...)
  1246. res, err := c.doRequest("json")
  1247. if res != nil && res.StatusCode == http.StatusNotModified {
  1248. if res.Body != nil {
  1249. res.Body.Close()
  1250. }
  1251. return nil, &googleapi.Error{
  1252. Code: res.StatusCode,
  1253. Header: res.Header,
  1254. }
  1255. }
  1256. if err != nil {
  1257. return nil, err
  1258. }
  1259. defer googleapi.CloseBody(res)
  1260. if err := googleapi.CheckResponse(res); err != nil {
  1261. return nil, err
  1262. }
  1263. ret := &Operation{
  1264. ServerResponse: googleapi.ServerResponse{
  1265. Header: res.Header,
  1266. HTTPStatusCode: res.StatusCode,
  1267. },
  1268. }
  1269. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  1270. return nil, err
  1271. }
  1272. return ret, nil
  1273. // {
  1274. // "description": "Update the entire content of the Autoscaler resource.",
  1275. // "httpMethod": "PUT",
  1276. // "id": "autoscaler.autoscalers.update",
  1277. // "parameterOrder": [
  1278. // "project",
  1279. // "zone",
  1280. // "autoscaler"
  1281. // ],
  1282. // "parameters": {
  1283. // "autoscaler": {
  1284. // "description": "Name of the Autoscaler resource.",
  1285. // "location": "path",
  1286. // "required": true,
  1287. // "type": "string"
  1288. // },
  1289. // "project": {
  1290. // "description": "Project ID of Autoscaler resource.",
  1291. // "location": "path",
  1292. // "required": true,
  1293. // "type": "string"
  1294. // },
  1295. // "zone": {
  1296. // "description": "Zone name of Autoscaler resource.",
  1297. // "location": "path",
  1298. // "required": true,
  1299. // "type": "string"
  1300. // }
  1301. // },
  1302. // "path": "projects/{project}/zones/{zone}/autoscalers/{autoscaler}",
  1303. // "request": {
  1304. // "$ref": "Autoscaler"
  1305. // },
  1306. // "response": {
  1307. // "$ref": "Operation"
  1308. // },
  1309. // "scopes": [
  1310. // "https://www.googleapis.com/auth/compute"
  1311. // ]
  1312. // }
  1313. }
  1314. // method id "autoscaler.zoneOperations.delete":
  1315. type ZoneOperationsDeleteCall struct {
  1316. s *Service
  1317. project string
  1318. zone string
  1319. operation string
  1320. urlParams_ gensupport.URLParams
  1321. ctx_ context.Context
  1322. }
  1323. // Delete: Deletes the specified zone-specific operation resource.
  1324. func (r *ZoneOperationsService) Delete(project string, zone string, operation string) *ZoneOperationsDeleteCall {
  1325. c := &ZoneOperationsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1326. c.project = project
  1327. c.zone = zone
  1328. c.operation = operation
  1329. return c
  1330. }
  1331. // Fields allows partial responses to be retrieved. See
  1332. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1333. // for more information.
  1334. func (c *ZoneOperationsDeleteCall) Fields(s ...googleapi.Field) *ZoneOperationsDeleteCall {
  1335. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1336. return c
  1337. }
  1338. // Context sets the context to be used in this call's Do method. Any
  1339. // pending HTTP request will be aborted if the provided context is
  1340. // canceled.
  1341. func (c *ZoneOperationsDeleteCall) Context(ctx context.Context) *ZoneOperationsDeleteCall {
  1342. c.ctx_ = ctx
  1343. return c
  1344. }
  1345. func (c *ZoneOperationsDeleteCall) doRequest(alt string) (*http.Response, error) {
  1346. var body io.Reader = nil
  1347. c.urlParams_.Set("alt", alt)
  1348. urls := googleapi.ResolveRelative(c.s.BasePath, "{project}/zones/{zone}/operations/{operation}")
  1349. urls += "?" + c.urlParams_.Encode()
  1350. req, _ := http.NewRequest("DELETE", urls, body)
  1351. googleapi.Expand(req.URL, map[string]string{
  1352. "project": c.project,
  1353. "zone": c.zone,
  1354. "operation": c.operation,
  1355. })
  1356. req.Header.Set("User-Agent", c.s.userAgent())
  1357. if c.ctx_ != nil {
  1358. return ctxhttp.Do(c.ctx_, c.s.client, req)
  1359. }
  1360. return c.s.client.Do(req)
  1361. }
  1362. // Do executes the "autoscaler.zoneOperations.delete" call.
  1363. func (c *ZoneOperationsDeleteCall) Do(opts ...googleapi.CallOption) error {
  1364. gensupport.SetOptions(c.urlParams_, opts...)
  1365. res, err := c.doRequest("json")
  1366. if err != nil {
  1367. return err
  1368. }
  1369. defer googleapi.CloseBody(res)
  1370. if err := googleapi.CheckResponse(res); err != nil {
  1371. return err
  1372. }
  1373. return nil
  1374. // {
  1375. // "description": "Deletes the specified zone-specific operation resource.",
  1376. // "httpMethod": "DELETE",
  1377. // "id": "autoscaler.zoneOperations.delete",
  1378. // "parameterOrder": [
  1379. // "project",
  1380. // "zone",
  1381. // "operation"
  1382. // ],
  1383. // "parameters": {
  1384. // "operation": {
  1385. // "location": "path",
  1386. // "pattern": "[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?",
  1387. // "required": true,
  1388. // "type": "string"
  1389. // },
  1390. // "project": {
  1391. // "location": "path",
  1392. // "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])?))",
  1393. // "required": true,
  1394. // "type": "string"
  1395. // },
  1396. // "zone": {
  1397. // "location": "path",
  1398. // "pattern": "[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?",
  1399. // "required": true,
  1400. // "type": "string"
  1401. // }
  1402. // },
  1403. // "path": "{project}/zones/{zone}/operations/{operation}",
  1404. // "scopes": [
  1405. // "https://www.googleapis.com/auth/compute"
  1406. // ]
  1407. // }
  1408. }
  1409. // method id "autoscaler.zoneOperations.get":
  1410. type ZoneOperationsGetCall struct {
  1411. s *Service
  1412. project string
  1413. zone string
  1414. operation string
  1415. urlParams_ gensupport.URLParams
  1416. ifNoneMatch_ string
  1417. ctx_ context.Context
  1418. }
  1419. // Get: Retrieves the specified zone-specific operation resource.
  1420. func (r *ZoneOperationsService) Get(project string, zone string, operation string) *ZoneOperationsGetCall {
  1421. c := &ZoneOperationsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1422. c.project = project
  1423. c.zone = zone
  1424. c.operation = operation
  1425. return c
  1426. }
  1427. // Fields allows partial responses to be retrieved. See
  1428. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1429. // for more information.
  1430. func (c *ZoneOperationsGetCall) Fields(s ...googleapi.Field) *ZoneOperationsGetCall {
  1431. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1432. return c
  1433. }
  1434. // IfNoneMatch sets the optional parameter which makes the operation
  1435. // fail if the object's ETag matches the given value. This is useful for
  1436. // getting updates only after the object has changed since the last
  1437. // request. Use googleapi.IsNotModified to check whether the response
  1438. // error from Do is the result of In-None-Match.
  1439. func (c *ZoneOperationsGetCall) IfNoneMatch(entityTag string) *ZoneOperationsGetCall {
  1440. c.ifNoneMatch_ = entityTag
  1441. return c
  1442. }
  1443. // Context sets the context to be used in this call's Do method. Any
  1444. // pending HTTP request will be aborted if the provided context is
  1445. // canceled.
  1446. func (c *ZoneOperationsGetCall) Context(ctx context.Context) *ZoneOperationsGetCall {
  1447. c.ctx_ = ctx
  1448. return c
  1449. }
  1450. func (c *ZoneOperationsGetCall) doRequest(alt string) (*http.Response, error) {
  1451. var body io.Reader = nil
  1452. c.urlParams_.Set("alt", alt)
  1453. urls := googleapi.ResolveRelative(c.s.BasePath, "{project}/zones/{zone}/operations/{operation}")
  1454. urls += "?" + c.urlParams_.Encode()
  1455. req, _ := http.NewRequest("GET", urls, body)
  1456. googleapi.Expand(req.URL, map[string]string{
  1457. "project": c.project,
  1458. "zone": c.zone,
  1459. "operation": c.operation,
  1460. })
  1461. req.Header.Set("User-Agent", c.s.userAgent())
  1462. if c.ifNoneMatch_ != "" {
  1463. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  1464. }
  1465. if c.ctx_ != nil {
  1466. return ctxhttp.Do(c.ctx_, c.s.client, req)
  1467. }
  1468. return c.s.client.Do(req)
  1469. }
  1470. // Do executes the "autoscaler.zoneOperations.get" call.
  1471. // Exactly one of *Operation or error will be non-nil. Any non-2xx
  1472. // status code is an error. Response headers are in either
  1473. // *Operation.ServerResponse.Header or (if a response was returned at
  1474. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  1475. // to check whether the returned error was because
  1476. // http.StatusNotModified was returned.
  1477. func (c *ZoneOperationsGetCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
  1478. gensupport.SetOptions(c.urlParams_, opts...)
  1479. res, err := c.doRequest("json")
  1480. if res != nil && res.StatusCode == http.StatusNotModified {
  1481. if res.Body != nil {
  1482. res.Body.Close()
  1483. }
  1484. return nil, &googleapi.Error{
  1485. Code: res.StatusCode,
  1486. Header: res.Header,
  1487. }
  1488. }
  1489. if err != nil {
  1490. return nil, err
  1491. }
  1492. defer googleapi.CloseBody(res)
  1493. if err := googleapi.CheckResponse(res); err != nil {
  1494. return nil, err
  1495. }
  1496. ret := &Operation{
  1497. ServerResponse: googleapi.ServerResponse{
  1498. Header: res.Header,
  1499. HTTPStatusCode: res.StatusCode,
  1500. },
  1501. }
  1502. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  1503. return nil, err
  1504. }
  1505. return ret, nil
  1506. // {
  1507. // "description": "Retrieves the specified zone-specific operation resource.",
  1508. // "httpMethod": "GET",
  1509. // "id": "autoscaler.zoneOperations.get",
  1510. // "parameterOrder": [
  1511. // "project",
  1512. // "zone",
  1513. // "operation"
  1514. // ],
  1515. // "parameters": {
  1516. // "operation": {
  1517. // "location": "path",
  1518. // "pattern": "[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?",
  1519. // "required": true,
  1520. // "type": "string"
  1521. // },
  1522. // "project": {
  1523. // "location": "path",
  1524. // "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])?))",
  1525. // "required": true,
  1526. // "type": "string"
  1527. // },
  1528. // "zone": {
  1529. // "location": "path",
  1530. // "pattern": "[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?",
  1531. // "required": true,
  1532. // "type": "string"
  1533. // }
  1534. // },
  1535. // "path": "{project}/zones/{zone}/operations/{operation}",
  1536. // "response": {
  1537. // "$ref": "Operation"
  1538. // },
  1539. // "scopes": [
  1540. // "https://www.googleapis.com/auth/compute",
  1541. // "https://www.googleapis.com/auth/compute.readonly"
  1542. // ]
  1543. // }
  1544. }
  1545. // method id "autoscaler.zoneOperations.list":
  1546. type ZoneOperationsListCall struct {
  1547. s *Service
  1548. project string
  1549. zone string
  1550. urlParams_ gensupport.URLParams
  1551. ifNoneMatch_ string
  1552. ctx_ context.Context
  1553. }
  1554. // List: Retrieves the list of operation resources contained within the
  1555. // specified zone.
  1556. func (r *ZoneOperationsService) List(project string, zone string) *ZoneOperationsListCall {
  1557. c := &ZoneOperationsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1558. c.project = project
  1559. c.zone = zone
  1560. return c
  1561. }
  1562. // Filter sets the optional parameter "filter":
  1563. func (c *ZoneOperationsListCall) Filter(filter string) *ZoneOperationsListCall {
  1564. c.urlParams_.Set("filter", filter)
  1565. return c
  1566. }
  1567. // MaxResults sets the optional parameter "maxResults":
  1568. func (c *ZoneOperationsListCall) MaxResults(maxResults int64) *ZoneOperationsListCall {
  1569. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  1570. return c
  1571. }
  1572. // PageToken sets the optional parameter "pageToken":
  1573. func (c *ZoneOperationsListCall) PageToken(pageToken string) *ZoneOperationsListCall {
  1574. c.urlParams_.Set("pageToken", pageToken)
  1575. return c
  1576. }
  1577. // Fields allows partial responses to be retrieved. See
  1578. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1579. // for more information.
  1580. func (c *ZoneOperationsListCall) Fields(s ...googleapi.Field) *ZoneOperationsListCall {
  1581. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1582. return c
  1583. }
  1584. // IfNoneMatch sets the optional parameter which makes the operation
  1585. // fail if the object's ETag matches the given value. This is useful for
  1586. // getting updates only after the object has changed since the last
  1587. // request. Use googleapi.IsNotModified to check whether the response
  1588. // error from Do is the result of In-None-Match.
  1589. func (c *ZoneOperationsListCall) IfNoneMatch(entityTag string) *ZoneOperationsListCall {
  1590. c.ifNoneMatch_ = entityTag
  1591. return c
  1592. }
  1593. // Context sets the context to be used in this call's Do method. Any
  1594. // pending HTTP request will be aborted if the provided context is
  1595. // canceled.
  1596. func (c *ZoneOperationsListCall) Context(ctx context.Context) *ZoneOperationsListCall {
  1597. c.ctx_ = ctx
  1598. return c
  1599. }
  1600. func (c *ZoneOperationsListCall) doRequest(alt string) (*http.Response, error) {
  1601. var body io.Reader = nil
  1602. c.urlParams_.Set("alt", alt)
  1603. urls := googleapi.ResolveRelative(c.s.BasePath, "{project}/zones/{zone}/operations")
  1604. urls += "?" + c.urlParams_.Encode()
  1605. req, _ := http.NewRequest("GET", urls, body)
  1606. googleapi.Expand(req.URL, map[string]string{
  1607. "project": c.project,
  1608. "zone": c.zone,
  1609. })
  1610. req.Header.Set("User-Agent", c.s.userAgent())
  1611. if c.ifNoneMatch_ != "" {
  1612. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  1613. }
  1614. if c.ctx_ != nil {
  1615. return ctxhttp.Do(c.ctx_, c.s.client, req)
  1616. }
  1617. return c.s.client.Do(req)
  1618. }
  1619. // Do executes the "autoscaler.zoneOperations.list" call.
  1620. // Exactly one of *OperationList or error will be non-nil. Any non-2xx
  1621. // status code is an error. Response headers are in either
  1622. // *OperationList.ServerResponse.Header or (if a response was returned
  1623. // at all) in error.(*googleapi.Error).Header. Use
  1624. // googleapi.IsNotModified to check whether the returned error was
  1625. // because http.StatusNotModified was returned.
  1626. func (c *ZoneOperationsListCall) Do(opts ...googleapi.CallOption) (*OperationList, error) {
  1627. gensupport.SetOptions(c.urlParams_, opts...)
  1628. res, err := c.doRequest("json")
  1629. if res != nil && res.StatusCode == http.StatusNotModified {
  1630. if res.Body != nil {
  1631. res.Body.Close()
  1632. }
  1633. return nil, &googleapi.Error{
  1634. Code: res.StatusCode,
  1635. Header: res.Header,
  1636. }
  1637. }
  1638. if err != nil {
  1639. return nil, err
  1640. }
  1641. defer googleapi.CloseBody(res)
  1642. if err := googleapi.CheckResponse(res); err != nil {
  1643. return nil, err
  1644. }
  1645. ret := &OperationList{
  1646. ServerResponse: googleapi.ServerResponse{
  1647. Header: res.Header,
  1648. HTTPStatusCode: res.StatusCode,
  1649. },
  1650. }
  1651. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  1652. return nil, err
  1653. }
  1654. return ret, nil
  1655. // {
  1656. // "description": "Retrieves the list of operation resources contained within the specified zone.",
  1657. // "httpMethod": "GET",
  1658. // "id": "autoscaler.zoneOperations.list",
  1659. // "parameterOrder": [
  1660. // "project",
  1661. // "zone"
  1662. // ],
  1663. // "parameters": {
  1664. // "filter": {
  1665. // "location": "query",
  1666. // "type": "string"
  1667. // },
  1668. // "maxResults": {
  1669. // "default": "500",
  1670. // "format": "uint32",
  1671. // "location": "query",
  1672. // "maximum": "500",
  1673. // "minimum": "0",
  1674. // "type": "integer"
  1675. // },
  1676. // "pageToken": {
  1677. // "location": "query",
  1678. // "type": "string"
  1679. // },
  1680. // "project": {
  1681. // "location": "path",
  1682. // "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])?))",
  1683. // "required": true,
  1684. // "type": "string"
  1685. // },
  1686. // "zone": {
  1687. // "location": "path",
  1688. // "pattern": "[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?",
  1689. // "required": true,
  1690. // "type": "string"
  1691. // }
  1692. // },
  1693. // "path": "{project}/zones/{zone}/operations",
  1694. // "response": {
  1695. // "$ref": "OperationList"
  1696. // },
  1697. // "scopes": [
  1698. // "https://www.googleapis.com/auth/compute",
  1699. // "https://www.googleapis.com/auth/compute.readonly"
  1700. // ]
  1701. // }
  1702. }
  1703. // Pages invokes f for each page of results.
  1704. // A non-nil error returned from f will halt the iteration.
  1705. // The provided context supersedes any context provided to the Context method.
  1706. func (c *ZoneOperationsListCall) Pages(ctx context.Context, f func(*OperationList) error) error {
  1707. c.ctx_ = ctx
  1708. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  1709. for {
  1710. x, err := c.Do()
  1711. if err != nil {
  1712. return err
  1713. }
  1714. if err := f(x); err != nil {
  1715. return err
  1716. }
  1717. if x.NextPageToken == "" {
  1718. return nil
  1719. }
  1720. c.PageToken(x.NextPageToken)
  1721. }
  1722. }
  1723. // method id "autoscaler.zones.list":
  1724. type ZonesListCall struct {
  1725. s *Service
  1726. project string
  1727. urlParams_ gensupport.URLParams
  1728. ifNoneMatch_ string
  1729. ctx_ context.Context
  1730. }
  1731. // List:
  1732. func (r *ZonesService) List(project string) *ZonesListCall {
  1733. c := &ZonesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1734. c.project = project
  1735. return c
  1736. }
  1737. // Filter sets the optional parameter "filter":
  1738. func (c *ZonesListCall) Filter(filter string) *ZonesListCall {
  1739. c.urlParams_.Set("filter", filter)
  1740. return c
  1741. }
  1742. // MaxResults sets the optional parameter "maxResults":
  1743. func (c *ZonesListCall) MaxResults(maxResults int64) *ZonesListCall {
  1744. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  1745. return c
  1746. }
  1747. // PageToken sets the optional parameter "pageToken":
  1748. func (c *ZonesListCall) PageToken(pageToken string) *ZonesListCall {
  1749. c.urlParams_.Set("pageToken", pageToken)
  1750. return c
  1751. }
  1752. // Fields allows partial responses to be retrieved. See
  1753. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1754. // for more information.
  1755. func (c *ZonesListCall) Fields(s ...googleapi.Field) *ZonesListCall {
  1756. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1757. return c
  1758. }
  1759. // IfNoneMatch sets the optional parameter which makes the operation
  1760. // fail if the object's ETag matches the given value. This is useful for
  1761. // getting updates only after the object has changed since the last
  1762. // request. Use googleapi.IsNotModified to check whether the response
  1763. // error from Do is the result of In-None-Match.
  1764. func (c *ZonesListCall) IfNoneMatch(entityTag string) *ZonesListCall {
  1765. c.ifNoneMatch_ = entityTag
  1766. return c
  1767. }
  1768. // Context sets the context to be used in this call's Do method. Any
  1769. // pending HTTP request will be aborted if the provided context is
  1770. // canceled.
  1771. func (c *ZonesListCall) Context(ctx context.Context) *ZonesListCall {
  1772. c.ctx_ = ctx
  1773. return c
  1774. }
  1775. func (c *ZonesListCall) doRequest(alt string) (*http.Response, error) {
  1776. var body io.Reader = nil
  1777. c.urlParams_.Set("alt", alt)
  1778. urls := googleapi.ResolveRelative(c.s.BasePath, "{project}/zones")
  1779. urls += "?" + c.urlParams_.Encode()
  1780. req, _ := http.NewRequest("GET", urls, body)
  1781. googleapi.Expand(req.URL, map[string]string{
  1782. "project": c.project,
  1783. })
  1784. req.Header.Set("User-Agent", c.s.userAgent())
  1785. if c.ifNoneMatch_ != "" {
  1786. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  1787. }
  1788. if c.ctx_ != nil {
  1789. return ctxhttp.Do(c.ctx_, c.s.client, req)
  1790. }
  1791. return c.s.client.Do(req)
  1792. }
  1793. // Do executes the "autoscaler.zones.list" call.
  1794. // Exactly one of *ZoneList or error will be non-nil. Any non-2xx status
  1795. // code is an error. Response headers are in either
  1796. // *ZoneList.ServerResponse.Header or (if a response was returned at
  1797. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  1798. // to check whether the returned error was because
  1799. // http.StatusNotModified was returned.
  1800. func (c *ZonesListCall) Do(opts ...googleapi.CallOption) (*ZoneList, error) {
  1801. gensupport.SetOptions(c.urlParams_, opts...)
  1802. res, err := c.doRequest("json")
  1803. if res != nil && res.StatusCode == http.StatusNotModified {
  1804. if res.Body != nil {
  1805. res.Body.Close()
  1806. }
  1807. return nil, &googleapi.Error{
  1808. Code: res.StatusCode,
  1809. Header: res.Header,
  1810. }
  1811. }
  1812. if err != nil {
  1813. return nil, err
  1814. }
  1815. defer googleapi.CloseBody(res)
  1816. if err := googleapi.CheckResponse(res); err != nil {
  1817. return nil, err
  1818. }
  1819. ret := &ZoneList{
  1820. ServerResponse: googleapi.ServerResponse{
  1821. Header: res.Header,
  1822. HTTPStatusCode: res.StatusCode,
  1823. },
  1824. }
  1825. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  1826. return nil, err
  1827. }
  1828. return ret, nil
  1829. // {
  1830. // "description": "",
  1831. // "httpMethod": "GET",
  1832. // "id": "autoscaler.zones.list",
  1833. // "parameterOrder": [
  1834. // "project"
  1835. // ],
  1836. // "parameters": {
  1837. // "filter": {
  1838. // "location": "query",
  1839. // "type": "string"
  1840. // },
  1841. // "maxResults": {
  1842. // "default": "500",
  1843. // "format": "uint32",
  1844. // "location": "query",
  1845. // "maximum": "500",
  1846. // "minimum": "0",
  1847. // "type": "integer"
  1848. // },
  1849. // "pageToken": {
  1850. // "location": "query",
  1851. // "type": "string"
  1852. // },
  1853. // "project": {
  1854. // "location": "path",
  1855. // "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])?))",
  1856. // "required": true,
  1857. // "type": "string"
  1858. // }
  1859. // },
  1860. // "path": "{project}/zones",
  1861. // "response": {
  1862. // "$ref": "ZoneList"
  1863. // },
  1864. // "scopes": [
  1865. // "https://www.googleapis.com/auth/compute",
  1866. // "https://www.googleapis.com/auth/compute.readonly"
  1867. // ]
  1868. // }
  1869. }
  1870. // Pages invokes f for each page of results.
  1871. // A non-nil error returned from f will halt the iteration.
  1872. // The provided context supersedes any context provided to the Context method.
  1873. func (c *ZonesListCall) Pages(ctx context.Context, f func(*ZoneList) error) error {
  1874. c.ctx_ = ctx
  1875. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  1876. for {
  1877. x, err := c.Do()
  1878. if err != nil {
  1879. return err
  1880. }
  1881. if err := f(x); err != nil {
  1882. return err
  1883. }
  1884. if x.NextPageToken == "" {
  1885. return nil
  1886. }
  1887. c.PageToken(x.NextPageToken)
  1888. }
  1889. }