You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2724 lines
92 KiB

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