Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 
 

2603 linhas
87 KiB

  1. // Copyright 2019 Google LLC.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. // Code generated file. DO NOT EDIT.
  5. // Package file provides access to the Cloud Filestore API.
  6. //
  7. // For product documentation, see: https://cloud.google.com/filestore/
  8. //
  9. // Creating a client
  10. //
  11. // Usage example:
  12. //
  13. // import "google.golang.org/api/file/v1"
  14. // ...
  15. // ctx := context.Background()
  16. // fileService, err := file.NewService(ctx)
  17. //
  18. // In this example, Google Application Default Credentials are used for authentication.
  19. //
  20. // For information on how to create and obtain Application Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials.
  21. //
  22. // Other authentication options
  23. //
  24. // To use an API key for authentication (note: some APIs do not support API keys), use option.WithAPIKey:
  25. //
  26. // fileService, err := file.NewService(ctx, option.WithAPIKey("AIza..."))
  27. //
  28. // To use an OAuth token (e.g., a user token obtained via a three-legged OAuth flow), use option.WithTokenSource:
  29. //
  30. // config := &oauth2.Config{...}
  31. // // ...
  32. // token, err := config.Exchange(ctx, ...)
  33. // fileService, err := file.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token)))
  34. //
  35. // See https://godoc.org/google.golang.org/api/option/ for details on options.
  36. package file // import "google.golang.org/api/file/v1"
  37. import (
  38. "bytes"
  39. "context"
  40. "encoding/json"
  41. "errors"
  42. "fmt"
  43. "io"
  44. "net/http"
  45. "net/url"
  46. "strconv"
  47. "strings"
  48. gensupport "google.golang.org/api/gensupport"
  49. googleapi "google.golang.org/api/googleapi"
  50. option "google.golang.org/api/option"
  51. htransport "google.golang.org/api/transport/http"
  52. )
  53. // Always reference these packages, just in case the auto-generated code
  54. // below doesn't.
  55. var _ = bytes.NewBuffer
  56. var _ = strconv.Itoa
  57. var _ = fmt.Sprintf
  58. var _ = json.NewDecoder
  59. var _ = io.Copy
  60. var _ = url.Parse
  61. var _ = gensupport.MarshalJSON
  62. var _ = googleapi.Version
  63. var _ = errors.New
  64. var _ = strings.Replace
  65. var _ = context.Canceled
  66. const apiId = "file:v1"
  67. const apiName = "file"
  68. const apiVersion = "v1"
  69. const basePath = "https://file.googleapis.com/"
  70. // OAuth2 scopes used by this API.
  71. const (
  72. // View and manage your data across Google Cloud Platform services
  73. CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platform"
  74. )
  75. // NewService creates a new Service.
  76. func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
  77. scopesOption := option.WithScopes(
  78. "https://www.googleapis.com/auth/cloud-platform",
  79. )
  80. // NOTE: prepend, so we don't override user-specified scopes.
  81. opts = append([]option.ClientOption{scopesOption}, opts...)
  82. client, endpoint, err := htransport.NewClient(ctx, opts...)
  83. if err != nil {
  84. return nil, err
  85. }
  86. s, err := New(client)
  87. if err != nil {
  88. return nil, err
  89. }
  90. if endpoint != "" {
  91. s.BasePath = endpoint
  92. }
  93. return s, nil
  94. }
  95. // New creates a new Service. It uses the provided http.Client for requests.
  96. //
  97. // Deprecated: please use NewService instead.
  98. // To provide a custom HTTP client, use option.WithHTTPClient.
  99. // If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead.
  100. func New(client *http.Client) (*Service, error) {
  101. if client == nil {
  102. return nil, errors.New("client is nil")
  103. }
  104. s := &Service{client: client, BasePath: basePath}
  105. s.Projects = NewProjectsService(s)
  106. return s, nil
  107. }
  108. type Service struct {
  109. client *http.Client
  110. BasePath string // API endpoint base URL
  111. UserAgent string // optional additional User-Agent fragment
  112. Projects *ProjectsService
  113. }
  114. func (s *Service) userAgent() string {
  115. if s.UserAgent == "" {
  116. return googleapi.UserAgent
  117. }
  118. return googleapi.UserAgent + " " + s.UserAgent
  119. }
  120. func NewProjectsService(s *Service) *ProjectsService {
  121. rs := &ProjectsService{s: s}
  122. rs.Locations = NewProjectsLocationsService(s)
  123. return rs
  124. }
  125. type ProjectsService struct {
  126. s *Service
  127. Locations *ProjectsLocationsService
  128. }
  129. func NewProjectsLocationsService(s *Service) *ProjectsLocationsService {
  130. rs := &ProjectsLocationsService{s: s}
  131. rs.Instances = NewProjectsLocationsInstancesService(s)
  132. rs.Operations = NewProjectsLocationsOperationsService(s)
  133. return rs
  134. }
  135. type ProjectsLocationsService struct {
  136. s *Service
  137. Instances *ProjectsLocationsInstancesService
  138. Operations *ProjectsLocationsOperationsService
  139. }
  140. func NewProjectsLocationsInstancesService(s *Service) *ProjectsLocationsInstancesService {
  141. rs := &ProjectsLocationsInstancesService{s: s}
  142. return rs
  143. }
  144. type ProjectsLocationsInstancesService struct {
  145. s *Service
  146. }
  147. func NewProjectsLocationsOperationsService(s *Service) *ProjectsLocationsOperationsService {
  148. rs := &ProjectsLocationsOperationsService{s: s}
  149. return rs
  150. }
  151. type ProjectsLocationsOperationsService struct {
  152. s *Service
  153. }
  154. // CancelOperationRequest: The request message for
  155. // Operations.CancelOperation.
  156. type CancelOperationRequest struct {
  157. }
  158. // Empty: A generic empty message that you can re-use to avoid defining
  159. // duplicated
  160. // empty messages in your APIs. A typical example is to use it as the
  161. // request
  162. // or the response type of an API method. For instance:
  163. //
  164. // service Foo {
  165. // rpc Bar(google.protobuf.Empty) returns
  166. // (google.protobuf.Empty);
  167. // }
  168. //
  169. // The JSON representation for `Empty` is empty JSON object `{}`.
  170. type Empty struct {
  171. // ServerResponse contains the HTTP response code and headers from the
  172. // server.
  173. googleapi.ServerResponse `json:"-"`
  174. }
  175. // FileShareConfig: File share configuration for the instance.
  176. type FileShareConfig struct {
  177. // CapacityGb: File share capacity in gigabytes (GB).
  178. // Cloud Filestore defines 1 GB as 1024^3 bytes.
  179. CapacityGb int64 `json:"capacityGb,omitempty,string"`
  180. // Name: The name of the file share (must be 16 characters or less).
  181. Name string `json:"name,omitempty"`
  182. // ForceSendFields is a list of field names (e.g. "CapacityGb") to
  183. // unconditionally include in API requests. By default, fields with
  184. // empty values are omitted from API requests. However, any non-pointer,
  185. // non-interface field appearing in ForceSendFields will be sent to the
  186. // server regardless of whether the field is empty or not. This may be
  187. // used to include empty fields in Patch requests.
  188. ForceSendFields []string `json:"-"`
  189. // NullFields is a list of field names (e.g. "CapacityGb") to include in
  190. // API requests with the JSON null value. By default, fields with empty
  191. // values are omitted from API requests. However, any field with an
  192. // empty value appearing in NullFields will be sent to the server as
  193. // null. It is an error if a field in this list has a non-empty value.
  194. // This may be used to include null fields in Patch requests.
  195. NullFields []string `json:"-"`
  196. }
  197. func (s *FileShareConfig) MarshalJSON() ([]byte, error) {
  198. type NoMethod FileShareConfig
  199. raw := NoMethod(*s)
  200. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  201. }
  202. // Instance: A Cloud Filestore instance.
  203. type Instance struct {
  204. // CreateTime: Output only.
  205. // The time when the instance was created.
  206. CreateTime string `json:"createTime,omitempty"`
  207. // Description: Optional. A description of the instance (2048 characters
  208. // or less).
  209. Description string `json:"description,omitempty"`
  210. // Etag: Server-specified ETag for the instance resource to prevent
  211. // simultaneous
  212. // updates from overwriting each other.
  213. Etag string `json:"etag,omitempty"`
  214. // FileShares: File system shares on the instance.
  215. // For this version, only a single file share is supported.
  216. FileShares []*FileShareConfig `json:"fileShares,omitempty"`
  217. // Labels: Resource labels to represent user provided metadata.
  218. Labels map[string]string `json:"labels,omitempty"`
  219. // Name: Output only.
  220. // The resource name of the instance, in the
  221. // format
  222. // projects/{project_id}/locations/{location_id}/instances/{instan
  223. // ce_id}.
  224. Name string `json:"name,omitempty"`
  225. // Networks: VPC networks to which the instance is connected.
  226. // For this version, only a single network is supported.
  227. Networks []*NetworkConfig `json:"networks,omitempty"`
  228. // State: Output only.
  229. // The instance state.
  230. //
  231. // Possible values:
  232. // "STATE_UNSPECIFIED" - State not set.
  233. // "CREATING" - The instance is being created.
  234. // "READY" - The instance is available for use.
  235. // "REPAIRING" - Work is being done on the instance. You can get
  236. // further details from the
  237. // `statusMessage` field of the `Instance` resource.
  238. // "DELETING" - The instance is shutting down.
  239. // "ERROR" - The instance is experiencing an issue and might be
  240. // unusable. You can get
  241. // further details from the `statusMessage` field of the
  242. // `Instance`
  243. // resource.
  244. State string `json:"state,omitempty"`
  245. // StatusMessage: Output only.
  246. // Additional information about the instance state, if available.
  247. StatusMessage string `json:"statusMessage,omitempty"`
  248. // Tier: The service tier of the instance.
  249. //
  250. // Possible values:
  251. // "TIER_UNSPECIFIED" - Not set.
  252. // "STANDARD" - STANDARD tier.
  253. // "PREMIUM" - PREMIUM tier.
  254. Tier string `json:"tier,omitempty"`
  255. // ServerResponse contains the HTTP response code and headers from the
  256. // server.
  257. googleapi.ServerResponse `json:"-"`
  258. // ForceSendFields is a list of field names (e.g. "CreateTime") to
  259. // unconditionally include in API requests. By default, fields with
  260. // empty values are omitted from API requests. However, any non-pointer,
  261. // non-interface field appearing in ForceSendFields will be sent to the
  262. // server regardless of whether the field is empty or not. This may be
  263. // used to include empty fields in Patch requests.
  264. ForceSendFields []string `json:"-"`
  265. // NullFields is a list of field names (e.g. "CreateTime") to include in
  266. // API requests with the JSON null value. By default, fields with empty
  267. // values are omitted from API requests. However, any field with an
  268. // empty value appearing in NullFields will be sent to the server as
  269. // null. It is an error if a field in this list has a non-empty value.
  270. // This may be used to include null fields in Patch requests.
  271. NullFields []string `json:"-"`
  272. }
  273. func (s *Instance) MarshalJSON() ([]byte, error) {
  274. type NoMethod Instance
  275. raw := NoMethod(*s)
  276. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  277. }
  278. // ListInstancesResponse: ListInstancesResponse is the result of
  279. // ListInstancesRequest.
  280. type ListInstancesResponse struct {
  281. // Instances: A list of instances in the project for the specified
  282. // location.
  283. //
  284. // If the {location} value in the request is "-", the response contains
  285. // a list
  286. // of instances from all locations. If any location is unreachable,
  287. // the
  288. // response will only return instances in reachable locations and
  289. // the
  290. // "unreachable" field will be populated with a list of unreachable
  291. // locations.
  292. Instances []*Instance `json:"instances,omitempty"`
  293. // NextPageToken: The token you can use to retrieve the next page of
  294. // results. Not returned
  295. // if there are no more results in the list.
  296. NextPageToken string `json:"nextPageToken,omitempty"`
  297. // Unreachable: Locations that could not be reached.
  298. Unreachable []string `json:"unreachable,omitempty"`
  299. // ServerResponse contains the HTTP response code and headers from the
  300. // server.
  301. googleapi.ServerResponse `json:"-"`
  302. // ForceSendFields is a list of field names (e.g. "Instances") to
  303. // unconditionally include in API requests. By default, fields with
  304. // empty values are omitted from API requests. However, any non-pointer,
  305. // non-interface field appearing in ForceSendFields will be sent to the
  306. // server regardless of whether the field is empty or not. This may be
  307. // used to include empty fields in Patch requests.
  308. ForceSendFields []string `json:"-"`
  309. // NullFields is a list of field names (e.g. "Instances") to include in
  310. // API requests with the JSON null value. By default, fields with empty
  311. // values are omitted from API requests. However, any field with an
  312. // empty value appearing in NullFields will be sent to the server as
  313. // null. It is an error if a field in this list has a non-empty value.
  314. // This may be used to include null fields in Patch requests.
  315. NullFields []string `json:"-"`
  316. }
  317. func (s *ListInstancesResponse) MarshalJSON() ([]byte, error) {
  318. type NoMethod ListInstancesResponse
  319. raw := NoMethod(*s)
  320. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  321. }
  322. // ListLocationsResponse: The response message for
  323. // Locations.ListLocations.
  324. type ListLocationsResponse struct {
  325. // Locations: A list of locations that matches the specified filter in
  326. // the request.
  327. Locations []*Location `json:"locations,omitempty"`
  328. // NextPageToken: The standard List next-page token.
  329. NextPageToken string `json:"nextPageToken,omitempty"`
  330. // ServerResponse contains the HTTP response code and headers from the
  331. // server.
  332. googleapi.ServerResponse `json:"-"`
  333. // ForceSendFields is a list of field names (e.g. "Locations") to
  334. // unconditionally include in API requests. By default, fields with
  335. // empty values are omitted from API requests. However, any non-pointer,
  336. // non-interface field appearing in ForceSendFields will be sent to the
  337. // server regardless of whether the field is empty or not. This may be
  338. // used to include empty fields in Patch requests.
  339. ForceSendFields []string `json:"-"`
  340. // NullFields is a list of field names (e.g. "Locations") to include in
  341. // API requests with the JSON null value. By default, fields with empty
  342. // values are omitted from API requests. However, any field with an
  343. // empty value appearing in NullFields will be sent to the server as
  344. // null. It is an error if a field in this list has a non-empty value.
  345. // This may be used to include null fields in Patch requests.
  346. NullFields []string `json:"-"`
  347. }
  348. func (s *ListLocationsResponse) MarshalJSON() ([]byte, error) {
  349. type NoMethod ListLocationsResponse
  350. raw := NoMethod(*s)
  351. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  352. }
  353. // ListOperationsResponse: The response message for
  354. // Operations.ListOperations.
  355. type ListOperationsResponse struct {
  356. // NextPageToken: The standard List next-page token.
  357. NextPageToken string `json:"nextPageToken,omitempty"`
  358. // Operations: A list of operations that matches the specified filter in
  359. // the request.
  360. Operations []*Operation `json:"operations,omitempty"`
  361. // ServerResponse contains the HTTP response code and headers from the
  362. // server.
  363. googleapi.ServerResponse `json:"-"`
  364. // ForceSendFields is a list of field names (e.g. "NextPageToken") to
  365. // unconditionally include in API requests. By default, fields with
  366. // empty values are omitted from API requests. However, any non-pointer,
  367. // non-interface field appearing in ForceSendFields will be sent to the
  368. // server regardless of whether the field is empty or not. This may be
  369. // used to include empty fields in Patch requests.
  370. ForceSendFields []string `json:"-"`
  371. // NullFields is a list of field names (e.g. "NextPageToken") to include
  372. // in API requests with the JSON null value. By default, fields with
  373. // empty values are omitted from API requests. However, any field with
  374. // an empty value appearing in NullFields will be sent to the server as
  375. // null. It is an error if a field in this list has a non-empty value.
  376. // This may be used to include null fields in Patch requests.
  377. NullFields []string `json:"-"`
  378. }
  379. func (s *ListOperationsResponse) MarshalJSON() ([]byte, error) {
  380. type NoMethod ListOperationsResponse
  381. raw := NoMethod(*s)
  382. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  383. }
  384. // Location: A resource that represents Google Cloud Platform location.
  385. type Location struct {
  386. // DisplayName: The friendly name for this location, typically a nearby
  387. // city name.
  388. // For example, "Tokyo".
  389. DisplayName string `json:"displayName,omitempty"`
  390. // Labels: Cross-service attributes for the location. For example
  391. //
  392. // {"cloud.googleapis.com/region": "us-east1"}
  393. Labels map[string]string `json:"labels,omitempty"`
  394. // LocationId: The canonical id for this location. For example:
  395. // "us-east1".
  396. LocationId string `json:"locationId,omitempty"`
  397. // Metadata: Service-specific metadata. For example the available
  398. // capacity at the given
  399. // location.
  400. Metadata googleapi.RawMessage `json:"metadata,omitempty"`
  401. // Name: Resource name for the location, which may vary between
  402. // implementations.
  403. // For example: "projects/example-project/locations/us-east1"
  404. Name string `json:"name,omitempty"`
  405. // ServerResponse contains the HTTP response code and headers from the
  406. // server.
  407. googleapi.ServerResponse `json:"-"`
  408. // ForceSendFields is a list of field names (e.g. "DisplayName") to
  409. // unconditionally include in API requests. By default, fields with
  410. // empty values are omitted from API requests. However, any non-pointer,
  411. // non-interface field appearing in ForceSendFields will be sent to the
  412. // server regardless of whether the field is empty or not. This may be
  413. // used to include empty fields in Patch requests.
  414. ForceSendFields []string `json:"-"`
  415. // NullFields is a list of field names (e.g. "DisplayName") to include
  416. // in API requests with the JSON null value. By default, fields with
  417. // empty values are omitted from API requests. However, any field with
  418. // an empty value appearing in NullFields will be sent to the server as
  419. // null. It is an error if a field in this list has a non-empty value.
  420. // This may be used to include null fields in Patch requests.
  421. NullFields []string `json:"-"`
  422. }
  423. func (s *Location) MarshalJSON() ([]byte, error) {
  424. type NoMethod Location
  425. raw := NoMethod(*s)
  426. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  427. }
  428. // NetworkConfig: Network configuration for the instance.
  429. type NetworkConfig struct {
  430. // IpAddresses: Output only.
  431. // IPv4 addresses in the format
  432. // {octet 1}.{octet 2}.{octet 3}.{octet 4} or IPv6 addresses in the
  433. // format
  434. // {block 1}:{block 2}:{block 3}:{block 4}:{block 5}:{block 6}:{block
  435. // 7}:{block 8}.
  436. IpAddresses []string `json:"ipAddresses,omitempty"`
  437. // Modes: Internet protocol versions for which the instance has IP
  438. // addresses
  439. // assigned. For this version, only MODE_IPV4 is supported.
  440. //
  441. // Possible values:
  442. // "ADDRESS_MODE_UNSPECIFIED" - Internet protocol not set.
  443. // "MODE_IPV4" - Use the IPv4 internet protocol.
  444. Modes []string `json:"modes,omitempty"`
  445. // Network: The name of the Google Compute Engine
  446. // [VPC network](/compute/docs/networks-and-firewalls#networks) to which
  447. // the
  448. // instance is connected.
  449. Network string `json:"network,omitempty"`
  450. // ReservedIpRange: A /29 CIDR block in one of the
  451. // [internal IP address
  452. // ranges](https://www.arin.net/knowledge/address_filters.html)
  453. // that identifies the range of IP addresses reserved for this
  454. // instance. For example, 10.0.0.0/29 or 192.168.0.0/29. The range you
  455. // specify
  456. // can't overlap with either existing subnets or assigned IP address
  457. // ranges
  458. // for other Cloud Filestore instances in the selected VPC network.
  459. ReservedIpRange string `json:"reservedIpRange,omitempty"`
  460. // ForceSendFields is a list of field names (e.g. "IpAddresses") to
  461. // unconditionally include in API requests. By default, fields with
  462. // empty values are omitted from API requests. However, any non-pointer,
  463. // non-interface field appearing in ForceSendFields will be sent to the
  464. // server regardless of whether the field is empty or not. This may be
  465. // used to include empty fields in Patch requests.
  466. ForceSendFields []string `json:"-"`
  467. // NullFields is a list of field names (e.g. "IpAddresses") to include
  468. // in API requests with the JSON null value. By default, fields with
  469. // empty values are omitted from API requests. However, any field with
  470. // an empty value appearing in NullFields will be sent to the server as
  471. // null. It is an error if a field in this list has a non-empty value.
  472. // This may be used to include null fields in Patch requests.
  473. NullFields []string `json:"-"`
  474. }
  475. func (s *NetworkConfig) MarshalJSON() ([]byte, error) {
  476. type NoMethod NetworkConfig
  477. raw := NoMethod(*s)
  478. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  479. }
  480. // Operation: This resource represents a long-running operation that is
  481. // the result of a
  482. // network API call.
  483. type Operation struct {
  484. // Done: If the value is `false`, it means the operation is still in
  485. // progress.
  486. // If `true`, the operation is completed, and either `error` or
  487. // `response` is
  488. // available.
  489. Done bool `json:"done,omitempty"`
  490. // Error: The error result of the operation in case of failure or
  491. // cancellation.
  492. Error *Status `json:"error,omitempty"`
  493. // Metadata: Service-specific metadata associated with the operation.
  494. // It typically
  495. // contains progress information and common metadata such as create
  496. // time.
  497. // Some services might not provide such metadata. Any method that
  498. // returns a
  499. // long-running operation should document the metadata type, if any.
  500. Metadata googleapi.RawMessage `json:"metadata,omitempty"`
  501. // Name: The server-assigned name, which is only unique within the same
  502. // service that
  503. // originally returns it. If you use the default HTTP mapping,
  504. // the
  505. // `name` should have the format of `operations/some/unique/name`.
  506. Name string `json:"name,omitempty"`
  507. // Response: The normal response of the operation in case of success.
  508. // If the original
  509. // method returns no data on success, such as `Delete`, the response
  510. // is
  511. // `google.protobuf.Empty`. If the original method is
  512. // standard
  513. // `Get`/`Create`/`Update`, the response should be the resource. For
  514. // other
  515. // methods, the response should have the type `XxxResponse`, where
  516. // `Xxx`
  517. // is the original method name. For example, if the original method
  518. // name
  519. // is `TakeSnapshot()`, the inferred response type
  520. // is
  521. // `TakeSnapshotResponse`.
  522. Response googleapi.RawMessage `json:"response,omitempty"`
  523. // ServerResponse contains the HTTP response code and headers from the
  524. // server.
  525. googleapi.ServerResponse `json:"-"`
  526. // ForceSendFields is a list of field names (e.g. "Done") to
  527. // unconditionally include in API requests. By default, fields with
  528. // empty values are omitted from API requests. However, any non-pointer,
  529. // non-interface field appearing in ForceSendFields will be sent to the
  530. // server regardless of whether the field is empty or not. This may be
  531. // used to include empty fields in Patch requests.
  532. ForceSendFields []string `json:"-"`
  533. // NullFields is a list of field names (e.g. "Done") to include in API
  534. // requests with the JSON null value. By default, fields with empty
  535. // values are omitted from API requests. However, any field with an
  536. // empty value appearing in NullFields will be sent to the server as
  537. // null. It is an error if a field in this list has a non-empty value.
  538. // This may be used to include null fields in Patch requests.
  539. NullFields []string `json:"-"`
  540. }
  541. func (s *Operation) MarshalJSON() ([]byte, error) {
  542. type NoMethod Operation
  543. raw := NoMethod(*s)
  544. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  545. }
  546. // OperationMetadata: Represents the metadata of the long-running
  547. // operation.
  548. type OperationMetadata struct {
  549. // ApiVersion: [Output only] API version used to start the operation.
  550. ApiVersion string `json:"apiVersion,omitempty"`
  551. // CancelRequested: [Output only] Identifies whether the user has
  552. // requested cancellation
  553. // of the operation. Operations that have successfully been
  554. // cancelled
  555. // have Operation.error value with a google.rpc.Status.code of
  556. // 1,
  557. // corresponding to `Code.CANCELLED`.
  558. CancelRequested bool `json:"cancelRequested,omitempty"`
  559. // CreateTime: [Output only] The time the operation was created.
  560. CreateTime string `json:"createTime,omitempty"`
  561. // EndTime: [Output only] The time the operation finished running.
  562. EndTime string `json:"endTime,omitempty"`
  563. // StatusDetail: [Output only] Human-readable status of the operation,
  564. // if any.
  565. StatusDetail string `json:"statusDetail,omitempty"`
  566. // Target: [Output only] Server-defined resource path for the target of
  567. // the operation.
  568. Target string `json:"target,omitempty"`
  569. // Verb: [Output only] Name of the verb executed by the operation.
  570. Verb string `json:"verb,omitempty"`
  571. // ForceSendFields is a list of field names (e.g. "ApiVersion") to
  572. // unconditionally include in API requests. By default, fields with
  573. // empty values are omitted from API requests. However, any non-pointer,
  574. // non-interface field appearing in ForceSendFields will be sent to the
  575. // server regardless of whether the field is empty or not. This may be
  576. // used to include empty fields in Patch requests.
  577. ForceSendFields []string `json:"-"`
  578. // NullFields is a list of field names (e.g. "ApiVersion") to include in
  579. // API requests with the JSON null value. By default, fields with empty
  580. // values are omitted from API requests. However, any field with an
  581. // empty value appearing in NullFields will be sent to the server as
  582. // null. It is an error if a field in this list has a non-empty value.
  583. // This may be used to include null fields in Patch requests.
  584. NullFields []string `json:"-"`
  585. }
  586. func (s *OperationMetadata) MarshalJSON() ([]byte, error) {
  587. type NoMethod OperationMetadata
  588. raw := NoMethod(*s)
  589. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  590. }
  591. // Status: The `Status` type defines a logical error model that is
  592. // suitable for
  593. // different programming environments, including REST APIs and RPC APIs.
  594. // It is
  595. // used by [gRPC](https://github.com/grpc). The error model is designed
  596. // to be:
  597. //
  598. // - Simple to use and understand for most users
  599. // - Flexible enough to meet unexpected needs
  600. //
  601. // # Overview
  602. //
  603. // The `Status` message contains three pieces of data: error code,
  604. // error
  605. // message, and error details. The error code should be an enum value
  606. // of
  607. // google.rpc.Code, but it may accept additional error codes if needed.
  608. // The
  609. // error message should be a developer-facing English message that
  610. // helps
  611. // developers *understand* and *resolve* the error. If a localized
  612. // user-facing
  613. // error message is needed, put the localized message in the error
  614. // details or
  615. // localize it in the client. The optional error details may contain
  616. // arbitrary
  617. // information about the error. There is a predefined set of error
  618. // detail types
  619. // in the package `google.rpc` that can be used for common error
  620. // conditions.
  621. //
  622. // # Language mapping
  623. //
  624. // The `Status` message is the logical representation of the error
  625. // model, but it
  626. // is not necessarily the actual wire format. When the `Status` message
  627. // is
  628. // exposed in different client libraries and different wire protocols,
  629. // it can be
  630. // mapped differently. For example, it will likely be mapped to some
  631. // exceptions
  632. // in Java, but more likely mapped to some error codes in C.
  633. //
  634. // # Other uses
  635. //
  636. // The error model and the `Status` message can be used in a variety
  637. // of
  638. // environments, either with or without APIs, to provide a
  639. // consistent developer experience across different
  640. // environments.
  641. //
  642. // Example uses of this error model include:
  643. //
  644. // - Partial errors. If a service needs to return partial errors to the
  645. // client,
  646. // it may embed the `Status` in the normal response to indicate the
  647. // partial
  648. // errors.
  649. //
  650. // - Workflow errors. A typical workflow has multiple steps. Each step
  651. // may
  652. // have a `Status` message for error reporting.
  653. //
  654. // - Batch operations. If a client uses batch request and batch
  655. // response, the
  656. // `Status` message should be used directly inside batch response,
  657. // one for
  658. // each error sub-response.
  659. //
  660. // - Asynchronous operations. If an API call embeds asynchronous
  661. // operation
  662. // results in its response, the status of those operations should
  663. // be
  664. // represented directly using the `Status` message.
  665. //
  666. // - Logging. If some API errors are stored in logs, the message
  667. // `Status` could
  668. // be used directly after any stripping needed for security/privacy
  669. // reasons.
  670. type Status struct {
  671. // Code: The status code, which should be an enum value of
  672. // google.rpc.Code.
  673. Code int64 `json:"code,omitempty"`
  674. // Details: A list of messages that carry the error details. There is a
  675. // common set of
  676. // message types for APIs to use.
  677. Details []googleapi.RawMessage `json:"details,omitempty"`
  678. // Message: A developer-facing error message, which should be in
  679. // English. Any
  680. // user-facing error message should be localized and sent in
  681. // the
  682. // google.rpc.Status.details field, or localized by the client.
  683. Message string `json:"message,omitempty"`
  684. // ForceSendFields is a list of field names (e.g. "Code") to
  685. // unconditionally include in API requests. By default, fields with
  686. // empty values are omitted from API requests. However, any non-pointer,
  687. // non-interface field appearing in ForceSendFields will be sent to the
  688. // server regardless of whether the field is empty or not. This may be
  689. // used to include empty fields in Patch requests.
  690. ForceSendFields []string `json:"-"`
  691. // NullFields is a list of field names (e.g. "Code") to include in API
  692. // requests with the JSON null value. By default, fields with empty
  693. // values are omitted from API requests. However, any field with an
  694. // empty value appearing in NullFields will be sent to the server as
  695. // null. It is an error if a field in this list has a non-empty value.
  696. // This may be used to include null fields in Patch requests.
  697. NullFields []string `json:"-"`
  698. }
  699. func (s *Status) MarshalJSON() ([]byte, error) {
  700. type NoMethod Status
  701. raw := NoMethod(*s)
  702. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  703. }
  704. // method id "file.projects.locations.get":
  705. type ProjectsLocationsGetCall struct {
  706. s *Service
  707. name string
  708. urlParams_ gensupport.URLParams
  709. ifNoneMatch_ string
  710. ctx_ context.Context
  711. header_ http.Header
  712. }
  713. // Get: Gets information about a location.
  714. func (r *ProjectsLocationsService) Get(name string) *ProjectsLocationsGetCall {
  715. c := &ProjectsLocationsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  716. c.name = name
  717. return c
  718. }
  719. // Fields allows partial responses to be retrieved. See
  720. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  721. // for more information.
  722. func (c *ProjectsLocationsGetCall) Fields(s ...googleapi.Field) *ProjectsLocationsGetCall {
  723. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  724. return c
  725. }
  726. // IfNoneMatch sets the optional parameter which makes the operation
  727. // fail if the object's ETag matches the given value. This is useful for
  728. // getting updates only after the object has changed since the last
  729. // request. Use googleapi.IsNotModified to check whether the response
  730. // error from Do is the result of In-None-Match.
  731. func (c *ProjectsLocationsGetCall) IfNoneMatch(entityTag string) *ProjectsLocationsGetCall {
  732. c.ifNoneMatch_ = entityTag
  733. return c
  734. }
  735. // Context sets the context to be used in this call's Do method. Any
  736. // pending HTTP request will be aborted if the provided context is
  737. // canceled.
  738. func (c *ProjectsLocationsGetCall) Context(ctx context.Context) *ProjectsLocationsGetCall {
  739. c.ctx_ = ctx
  740. return c
  741. }
  742. // Header returns an http.Header that can be modified by the caller to
  743. // add HTTP headers to the request.
  744. func (c *ProjectsLocationsGetCall) Header() http.Header {
  745. if c.header_ == nil {
  746. c.header_ = make(http.Header)
  747. }
  748. return c.header_
  749. }
  750. func (c *ProjectsLocationsGetCall) doRequest(alt string) (*http.Response, error) {
  751. reqHeaders := make(http.Header)
  752. for k, v := range c.header_ {
  753. reqHeaders[k] = v
  754. }
  755. reqHeaders.Set("User-Agent", c.s.userAgent())
  756. if c.ifNoneMatch_ != "" {
  757. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  758. }
  759. var body io.Reader = nil
  760. c.urlParams_.Set("alt", alt)
  761. c.urlParams_.Set("prettyPrint", "false")
  762. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  763. urls += "?" + c.urlParams_.Encode()
  764. req, err := http.NewRequest("GET", urls, body)
  765. if err != nil {
  766. return nil, err
  767. }
  768. req.Header = reqHeaders
  769. googleapi.Expand(req.URL, map[string]string{
  770. "name": c.name,
  771. })
  772. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  773. }
  774. // Do executes the "file.projects.locations.get" call.
  775. // Exactly one of *Location or error will be non-nil. Any non-2xx status
  776. // code is an error. Response headers are in either
  777. // *Location.ServerResponse.Header or (if a response was returned at
  778. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  779. // to check whether the returned error was because
  780. // http.StatusNotModified was returned.
  781. func (c *ProjectsLocationsGetCall) Do(opts ...googleapi.CallOption) (*Location, error) {
  782. gensupport.SetOptions(c.urlParams_, opts...)
  783. res, err := c.doRequest("json")
  784. if res != nil && res.StatusCode == http.StatusNotModified {
  785. if res.Body != nil {
  786. res.Body.Close()
  787. }
  788. return nil, &googleapi.Error{
  789. Code: res.StatusCode,
  790. Header: res.Header,
  791. }
  792. }
  793. if err != nil {
  794. return nil, err
  795. }
  796. defer googleapi.CloseBody(res)
  797. if err := googleapi.CheckResponse(res); err != nil {
  798. return nil, err
  799. }
  800. ret := &Location{
  801. ServerResponse: googleapi.ServerResponse{
  802. Header: res.Header,
  803. HTTPStatusCode: res.StatusCode,
  804. },
  805. }
  806. target := &ret
  807. if err := gensupport.DecodeResponse(target, res); err != nil {
  808. return nil, err
  809. }
  810. return ret, nil
  811. // {
  812. // "description": "Gets information about a location.",
  813. // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}",
  814. // "httpMethod": "GET",
  815. // "id": "file.projects.locations.get",
  816. // "parameterOrder": [
  817. // "name"
  818. // ],
  819. // "parameters": {
  820. // "name": {
  821. // "description": "Resource name for the location.",
  822. // "location": "path",
  823. // "pattern": "^projects/[^/]+/locations/[^/]+$",
  824. // "required": true,
  825. // "type": "string"
  826. // }
  827. // },
  828. // "path": "v1/{+name}",
  829. // "response": {
  830. // "$ref": "Location"
  831. // },
  832. // "scopes": [
  833. // "https://www.googleapis.com/auth/cloud-platform"
  834. // ]
  835. // }
  836. }
  837. // method id "file.projects.locations.list":
  838. type ProjectsLocationsListCall struct {
  839. s *Service
  840. name string
  841. urlParams_ gensupport.URLParams
  842. ifNoneMatch_ string
  843. ctx_ context.Context
  844. header_ http.Header
  845. }
  846. // List: Lists information about the supported locations for this
  847. // service.
  848. func (r *ProjectsLocationsService) List(name string) *ProjectsLocationsListCall {
  849. c := &ProjectsLocationsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  850. c.name = name
  851. return c
  852. }
  853. // Filter sets the optional parameter "filter": The standard list
  854. // filter.
  855. func (c *ProjectsLocationsListCall) Filter(filter string) *ProjectsLocationsListCall {
  856. c.urlParams_.Set("filter", filter)
  857. return c
  858. }
  859. // PageSize sets the optional parameter "pageSize": The standard list
  860. // page size.
  861. func (c *ProjectsLocationsListCall) PageSize(pageSize int64) *ProjectsLocationsListCall {
  862. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  863. return c
  864. }
  865. // PageToken sets the optional parameter "pageToken": The standard list
  866. // page token.
  867. func (c *ProjectsLocationsListCall) PageToken(pageToken string) *ProjectsLocationsListCall {
  868. c.urlParams_.Set("pageToken", pageToken)
  869. return c
  870. }
  871. // Fields allows partial responses to be retrieved. See
  872. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  873. // for more information.
  874. func (c *ProjectsLocationsListCall) Fields(s ...googleapi.Field) *ProjectsLocationsListCall {
  875. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  876. return c
  877. }
  878. // IfNoneMatch sets the optional parameter which makes the operation
  879. // fail if the object's ETag matches the given value. This is useful for
  880. // getting updates only after the object has changed since the last
  881. // request. Use googleapi.IsNotModified to check whether the response
  882. // error from Do is the result of In-None-Match.
  883. func (c *ProjectsLocationsListCall) IfNoneMatch(entityTag string) *ProjectsLocationsListCall {
  884. c.ifNoneMatch_ = entityTag
  885. return c
  886. }
  887. // Context sets the context to be used in this call's Do method. Any
  888. // pending HTTP request will be aborted if the provided context is
  889. // canceled.
  890. func (c *ProjectsLocationsListCall) Context(ctx context.Context) *ProjectsLocationsListCall {
  891. c.ctx_ = ctx
  892. return c
  893. }
  894. // Header returns an http.Header that can be modified by the caller to
  895. // add HTTP headers to the request.
  896. func (c *ProjectsLocationsListCall) Header() http.Header {
  897. if c.header_ == nil {
  898. c.header_ = make(http.Header)
  899. }
  900. return c.header_
  901. }
  902. func (c *ProjectsLocationsListCall) doRequest(alt string) (*http.Response, error) {
  903. reqHeaders := make(http.Header)
  904. for k, v := range c.header_ {
  905. reqHeaders[k] = v
  906. }
  907. reqHeaders.Set("User-Agent", c.s.userAgent())
  908. if c.ifNoneMatch_ != "" {
  909. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  910. }
  911. var body io.Reader = nil
  912. c.urlParams_.Set("alt", alt)
  913. c.urlParams_.Set("prettyPrint", "false")
  914. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}/locations")
  915. urls += "?" + c.urlParams_.Encode()
  916. req, err := http.NewRequest("GET", urls, body)
  917. if err != nil {
  918. return nil, err
  919. }
  920. req.Header = reqHeaders
  921. googleapi.Expand(req.URL, map[string]string{
  922. "name": c.name,
  923. })
  924. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  925. }
  926. // Do executes the "file.projects.locations.list" call.
  927. // Exactly one of *ListLocationsResponse or error will be non-nil. Any
  928. // non-2xx status code is an error. Response headers are in either
  929. // *ListLocationsResponse.ServerResponse.Header or (if a response was
  930. // returned at all) in error.(*googleapi.Error).Header. Use
  931. // googleapi.IsNotModified to check whether the returned error was
  932. // because http.StatusNotModified was returned.
  933. func (c *ProjectsLocationsListCall) Do(opts ...googleapi.CallOption) (*ListLocationsResponse, error) {
  934. gensupport.SetOptions(c.urlParams_, opts...)
  935. res, err := c.doRequest("json")
  936. if res != nil && res.StatusCode == http.StatusNotModified {
  937. if res.Body != nil {
  938. res.Body.Close()
  939. }
  940. return nil, &googleapi.Error{
  941. Code: res.StatusCode,
  942. Header: res.Header,
  943. }
  944. }
  945. if err != nil {
  946. return nil, err
  947. }
  948. defer googleapi.CloseBody(res)
  949. if err := googleapi.CheckResponse(res); err != nil {
  950. return nil, err
  951. }
  952. ret := &ListLocationsResponse{
  953. ServerResponse: googleapi.ServerResponse{
  954. Header: res.Header,
  955. HTTPStatusCode: res.StatusCode,
  956. },
  957. }
  958. target := &ret
  959. if err := gensupport.DecodeResponse(target, res); err != nil {
  960. return nil, err
  961. }
  962. return ret, nil
  963. // {
  964. // "description": "Lists information about the supported locations for this service.",
  965. // "flatPath": "v1/projects/{projectsId}/locations",
  966. // "httpMethod": "GET",
  967. // "id": "file.projects.locations.list",
  968. // "parameterOrder": [
  969. // "name"
  970. // ],
  971. // "parameters": {
  972. // "filter": {
  973. // "description": "The standard list filter.",
  974. // "location": "query",
  975. // "type": "string"
  976. // },
  977. // "name": {
  978. // "description": "The resource that owns the locations collection, if applicable.",
  979. // "location": "path",
  980. // "pattern": "^projects/[^/]+$",
  981. // "required": true,
  982. // "type": "string"
  983. // },
  984. // "pageSize": {
  985. // "description": "The standard list page size.",
  986. // "format": "int32",
  987. // "location": "query",
  988. // "type": "integer"
  989. // },
  990. // "pageToken": {
  991. // "description": "The standard list page token.",
  992. // "location": "query",
  993. // "type": "string"
  994. // }
  995. // },
  996. // "path": "v1/{+name}/locations",
  997. // "response": {
  998. // "$ref": "ListLocationsResponse"
  999. // },
  1000. // "scopes": [
  1001. // "https://www.googleapis.com/auth/cloud-platform"
  1002. // ]
  1003. // }
  1004. }
  1005. // Pages invokes f for each page of results.
  1006. // A non-nil error returned from f will halt the iteration.
  1007. // The provided context supersedes any context provided to the Context method.
  1008. func (c *ProjectsLocationsListCall) Pages(ctx context.Context, f func(*ListLocationsResponse) error) error {
  1009. c.ctx_ = ctx
  1010. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  1011. for {
  1012. x, err := c.Do()
  1013. if err != nil {
  1014. return err
  1015. }
  1016. if err := f(x); err != nil {
  1017. return err
  1018. }
  1019. if x.NextPageToken == "" {
  1020. return nil
  1021. }
  1022. c.PageToken(x.NextPageToken)
  1023. }
  1024. }
  1025. // method id "file.projects.locations.instances.create":
  1026. type ProjectsLocationsInstancesCreateCall struct {
  1027. s *Service
  1028. parent string
  1029. instance *Instance
  1030. urlParams_ gensupport.URLParams
  1031. ctx_ context.Context
  1032. header_ http.Header
  1033. }
  1034. // Create: Creates an instance.
  1035. func (r *ProjectsLocationsInstancesService) Create(parent string, instance *Instance) *ProjectsLocationsInstancesCreateCall {
  1036. c := &ProjectsLocationsInstancesCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1037. c.parent = parent
  1038. c.instance = instance
  1039. return c
  1040. }
  1041. // InstanceId sets the optional parameter "instanceId": The name of the
  1042. // instance to create.
  1043. // The name must be unique for the specified project and location.
  1044. func (c *ProjectsLocationsInstancesCreateCall) InstanceId(instanceId string) *ProjectsLocationsInstancesCreateCall {
  1045. c.urlParams_.Set("instanceId", instanceId)
  1046. return c
  1047. }
  1048. // Fields allows partial responses to be retrieved. See
  1049. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1050. // for more information.
  1051. func (c *ProjectsLocationsInstancesCreateCall) Fields(s ...googleapi.Field) *ProjectsLocationsInstancesCreateCall {
  1052. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1053. return c
  1054. }
  1055. // Context sets the context to be used in this call's Do method. Any
  1056. // pending HTTP request will be aborted if the provided context is
  1057. // canceled.
  1058. func (c *ProjectsLocationsInstancesCreateCall) Context(ctx context.Context) *ProjectsLocationsInstancesCreateCall {
  1059. c.ctx_ = ctx
  1060. return c
  1061. }
  1062. // Header returns an http.Header that can be modified by the caller to
  1063. // add HTTP headers to the request.
  1064. func (c *ProjectsLocationsInstancesCreateCall) Header() http.Header {
  1065. if c.header_ == nil {
  1066. c.header_ = make(http.Header)
  1067. }
  1068. return c.header_
  1069. }
  1070. func (c *ProjectsLocationsInstancesCreateCall) doRequest(alt string) (*http.Response, error) {
  1071. reqHeaders := make(http.Header)
  1072. for k, v := range c.header_ {
  1073. reqHeaders[k] = v
  1074. }
  1075. reqHeaders.Set("User-Agent", c.s.userAgent())
  1076. var body io.Reader = nil
  1077. body, err := googleapi.WithoutDataWrapper.JSONReader(c.instance)
  1078. if err != nil {
  1079. return nil, err
  1080. }
  1081. reqHeaders.Set("Content-Type", "application/json")
  1082. c.urlParams_.Set("alt", alt)
  1083. c.urlParams_.Set("prettyPrint", "false")
  1084. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/instances")
  1085. urls += "?" + c.urlParams_.Encode()
  1086. req, err := http.NewRequest("POST", urls, body)
  1087. if err != nil {
  1088. return nil, err
  1089. }
  1090. req.Header = reqHeaders
  1091. googleapi.Expand(req.URL, map[string]string{
  1092. "parent": c.parent,
  1093. })
  1094. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1095. }
  1096. // Do executes the "file.projects.locations.instances.create" call.
  1097. // Exactly one of *Operation or error will be non-nil. Any non-2xx
  1098. // status code is an error. Response headers are in either
  1099. // *Operation.ServerResponse.Header or (if a response was returned at
  1100. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  1101. // to check whether the returned error was because
  1102. // http.StatusNotModified was returned.
  1103. func (c *ProjectsLocationsInstancesCreateCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
  1104. gensupport.SetOptions(c.urlParams_, opts...)
  1105. res, err := c.doRequest("json")
  1106. if res != nil && res.StatusCode == http.StatusNotModified {
  1107. if res.Body != nil {
  1108. res.Body.Close()
  1109. }
  1110. return nil, &googleapi.Error{
  1111. Code: res.StatusCode,
  1112. Header: res.Header,
  1113. }
  1114. }
  1115. if err != nil {
  1116. return nil, err
  1117. }
  1118. defer googleapi.CloseBody(res)
  1119. if err := googleapi.CheckResponse(res); err != nil {
  1120. return nil, err
  1121. }
  1122. ret := &Operation{
  1123. ServerResponse: googleapi.ServerResponse{
  1124. Header: res.Header,
  1125. HTTPStatusCode: res.StatusCode,
  1126. },
  1127. }
  1128. target := &ret
  1129. if err := gensupport.DecodeResponse(target, res); err != nil {
  1130. return nil, err
  1131. }
  1132. return ret, nil
  1133. // {
  1134. // "description": "Creates an instance.",
  1135. // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/instances",
  1136. // "httpMethod": "POST",
  1137. // "id": "file.projects.locations.instances.create",
  1138. // "parameterOrder": [
  1139. // "parent"
  1140. // ],
  1141. // "parameters": {
  1142. // "instanceId": {
  1143. // "description": "The name of the instance to create.\nThe name must be unique for the specified project and location.",
  1144. // "location": "query",
  1145. // "type": "string"
  1146. // },
  1147. // "parent": {
  1148. // "description": "The instance's project and location, in the format\nprojects/{project_id}/locations/{location}. In Cloud Filestore,\nlocations map to GCP zones, for example **us-west1-b**.",
  1149. // "location": "path",
  1150. // "pattern": "^projects/[^/]+/locations/[^/]+$",
  1151. // "required": true,
  1152. // "type": "string"
  1153. // }
  1154. // },
  1155. // "path": "v1/{+parent}/instances",
  1156. // "request": {
  1157. // "$ref": "Instance"
  1158. // },
  1159. // "response": {
  1160. // "$ref": "Operation"
  1161. // },
  1162. // "scopes": [
  1163. // "https://www.googleapis.com/auth/cloud-platform"
  1164. // ]
  1165. // }
  1166. }
  1167. // method id "file.projects.locations.instances.delete":
  1168. type ProjectsLocationsInstancesDeleteCall struct {
  1169. s *Service
  1170. name string
  1171. urlParams_ gensupport.URLParams
  1172. ctx_ context.Context
  1173. header_ http.Header
  1174. }
  1175. // Delete: Deletes an instance.
  1176. func (r *ProjectsLocationsInstancesService) Delete(name string) *ProjectsLocationsInstancesDeleteCall {
  1177. c := &ProjectsLocationsInstancesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1178. c.name = name
  1179. return c
  1180. }
  1181. // Fields allows partial responses to be retrieved. See
  1182. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1183. // for more information.
  1184. func (c *ProjectsLocationsInstancesDeleteCall) Fields(s ...googleapi.Field) *ProjectsLocationsInstancesDeleteCall {
  1185. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1186. return c
  1187. }
  1188. // Context sets the context to be used in this call's Do method. Any
  1189. // pending HTTP request will be aborted if the provided context is
  1190. // canceled.
  1191. func (c *ProjectsLocationsInstancesDeleteCall) Context(ctx context.Context) *ProjectsLocationsInstancesDeleteCall {
  1192. c.ctx_ = ctx
  1193. return c
  1194. }
  1195. // Header returns an http.Header that can be modified by the caller to
  1196. // add HTTP headers to the request.
  1197. func (c *ProjectsLocationsInstancesDeleteCall) Header() http.Header {
  1198. if c.header_ == nil {
  1199. c.header_ = make(http.Header)
  1200. }
  1201. return c.header_
  1202. }
  1203. func (c *ProjectsLocationsInstancesDeleteCall) doRequest(alt string) (*http.Response, error) {
  1204. reqHeaders := make(http.Header)
  1205. for k, v := range c.header_ {
  1206. reqHeaders[k] = v
  1207. }
  1208. reqHeaders.Set("User-Agent", c.s.userAgent())
  1209. var body io.Reader = nil
  1210. c.urlParams_.Set("alt", alt)
  1211. c.urlParams_.Set("prettyPrint", "false")
  1212. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  1213. urls += "?" + c.urlParams_.Encode()
  1214. req, err := http.NewRequest("DELETE", urls, body)
  1215. if err != nil {
  1216. return nil, err
  1217. }
  1218. req.Header = reqHeaders
  1219. googleapi.Expand(req.URL, map[string]string{
  1220. "name": c.name,
  1221. })
  1222. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1223. }
  1224. // Do executes the "file.projects.locations.instances.delete" call.
  1225. // Exactly one of *Operation or error will be non-nil. Any non-2xx
  1226. // status code is an error. Response headers are in either
  1227. // *Operation.ServerResponse.Header or (if a response was returned at
  1228. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  1229. // to check whether the returned error was because
  1230. // http.StatusNotModified was returned.
  1231. func (c *ProjectsLocationsInstancesDeleteCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
  1232. gensupport.SetOptions(c.urlParams_, opts...)
  1233. res, err := c.doRequest("json")
  1234. if res != nil && res.StatusCode == http.StatusNotModified {
  1235. if res.Body != nil {
  1236. res.Body.Close()
  1237. }
  1238. return nil, &googleapi.Error{
  1239. Code: res.StatusCode,
  1240. Header: res.Header,
  1241. }
  1242. }
  1243. if err != nil {
  1244. return nil, err
  1245. }
  1246. defer googleapi.CloseBody(res)
  1247. if err := googleapi.CheckResponse(res); err != nil {
  1248. return nil, err
  1249. }
  1250. ret := &Operation{
  1251. ServerResponse: googleapi.ServerResponse{
  1252. Header: res.Header,
  1253. HTTPStatusCode: res.StatusCode,
  1254. },
  1255. }
  1256. target := &ret
  1257. if err := gensupport.DecodeResponse(target, res); err != nil {
  1258. return nil, err
  1259. }
  1260. return ret, nil
  1261. // {
  1262. // "description": "Deletes an instance.",
  1263. // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/instances/{instancesId}",
  1264. // "httpMethod": "DELETE",
  1265. // "id": "file.projects.locations.instances.delete",
  1266. // "parameterOrder": [
  1267. // "name"
  1268. // ],
  1269. // "parameters": {
  1270. // "name": {
  1271. // "description": "The instance resource name, in the format\nprojects/{project_id}/locations/{location}/instances/{instance_id}",
  1272. // "location": "path",
  1273. // "pattern": "^projects/[^/]+/locations/[^/]+/instances/[^/]+$",
  1274. // "required": true,
  1275. // "type": "string"
  1276. // }
  1277. // },
  1278. // "path": "v1/{+name}",
  1279. // "response": {
  1280. // "$ref": "Operation"
  1281. // },
  1282. // "scopes": [
  1283. // "https://www.googleapis.com/auth/cloud-platform"
  1284. // ]
  1285. // }
  1286. }
  1287. // method id "file.projects.locations.instances.get":
  1288. type ProjectsLocationsInstancesGetCall struct {
  1289. s *Service
  1290. name string
  1291. urlParams_ gensupport.URLParams
  1292. ifNoneMatch_ string
  1293. ctx_ context.Context
  1294. header_ http.Header
  1295. }
  1296. // Get: Gets the details of a specific instance.
  1297. func (r *ProjectsLocationsInstancesService) Get(name string) *ProjectsLocationsInstancesGetCall {
  1298. c := &ProjectsLocationsInstancesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1299. c.name = name
  1300. return c
  1301. }
  1302. // Fields allows partial responses to be retrieved. See
  1303. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1304. // for more information.
  1305. func (c *ProjectsLocationsInstancesGetCall) Fields(s ...googleapi.Field) *ProjectsLocationsInstancesGetCall {
  1306. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1307. return c
  1308. }
  1309. // IfNoneMatch sets the optional parameter which makes the operation
  1310. // fail if the object's ETag matches the given value. This is useful for
  1311. // getting updates only after the object has changed since the last
  1312. // request. Use googleapi.IsNotModified to check whether the response
  1313. // error from Do is the result of In-None-Match.
  1314. func (c *ProjectsLocationsInstancesGetCall) IfNoneMatch(entityTag string) *ProjectsLocationsInstancesGetCall {
  1315. c.ifNoneMatch_ = entityTag
  1316. return c
  1317. }
  1318. // Context sets the context to be used in this call's Do method. Any
  1319. // pending HTTP request will be aborted if the provided context is
  1320. // canceled.
  1321. func (c *ProjectsLocationsInstancesGetCall) Context(ctx context.Context) *ProjectsLocationsInstancesGetCall {
  1322. c.ctx_ = ctx
  1323. return c
  1324. }
  1325. // Header returns an http.Header that can be modified by the caller to
  1326. // add HTTP headers to the request.
  1327. func (c *ProjectsLocationsInstancesGetCall) Header() http.Header {
  1328. if c.header_ == nil {
  1329. c.header_ = make(http.Header)
  1330. }
  1331. return c.header_
  1332. }
  1333. func (c *ProjectsLocationsInstancesGetCall) doRequest(alt string) (*http.Response, error) {
  1334. reqHeaders := make(http.Header)
  1335. for k, v := range c.header_ {
  1336. reqHeaders[k] = v
  1337. }
  1338. reqHeaders.Set("User-Agent", c.s.userAgent())
  1339. if c.ifNoneMatch_ != "" {
  1340. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1341. }
  1342. var body io.Reader = nil
  1343. c.urlParams_.Set("alt", alt)
  1344. c.urlParams_.Set("prettyPrint", "false")
  1345. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  1346. urls += "?" + c.urlParams_.Encode()
  1347. req, err := http.NewRequest("GET", urls, body)
  1348. if err != nil {
  1349. return nil, err
  1350. }
  1351. req.Header = reqHeaders
  1352. googleapi.Expand(req.URL, map[string]string{
  1353. "name": c.name,
  1354. })
  1355. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1356. }
  1357. // Do executes the "file.projects.locations.instances.get" call.
  1358. // Exactly one of *Instance or error will be non-nil. Any non-2xx status
  1359. // code is an error. Response headers are in either
  1360. // *Instance.ServerResponse.Header or (if a response was returned at
  1361. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  1362. // to check whether the returned error was because
  1363. // http.StatusNotModified was returned.
  1364. func (c *ProjectsLocationsInstancesGetCall) Do(opts ...googleapi.CallOption) (*Instance, error) {
  1365. gensupport.SetOptions(c.urlParams_, opts...)
  1366. res, err := c.doRequest("json")
  1367. if res != nil && res.StatusCode == http.StatusNotModified {
  1368. if res.Body != nil {
  1369. res.Body.Close()
  1370. }
  1371. return nil, &googleapi.Error{
  1372. Code: res.StatusCode,
  1373. Header: res.Header,
  1374. }
  1375. }
  1376. if err != nil {
  1377. return nil, err
  1378. }
  1379. defer googleapi.CloseBody(res)
  1380. if err := googleapi.CheckResponse(res); err != nil {
  1381. return nil, err
  1382. }
  1383. ret := &Instance{
  1384. ServerResponse: googleapi.ServerResponse{
  1385. Header: res.Header,
  1386. HTTPStatusCode: res.StatusCode,
  1387. },
  1388. }
  1389. target := &ret
  1390. if err := gensupport.DecodeResponse(target, res); err != nil {
  1391. return nil, err
  1392. }
  1393. return ret, nil
  1394. // {
  1395. // "description": "Gets the details of a specific instance.",
  1396. // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/instances/{instancesId}",
  1397. // "httpMethod": "GET",
  1398. // "id": "file.projects.locations.instances.get",
  1399. // "parameterOrder": [
  1400. // "name"
  1401. // ],
  1402. // "parameters": {
  1403. // "name": {
  1404. // "description": "The instance resource name, in the format\nprojects/{project_id}/locations/{location}/instances/{instance_id}.",
  1405. // "location": "path",
  1406. // "pattern": "^projects/[^/]+/locations/[^/]+/instances/[^/]+$",
  1407. // "required": true,
  1408. // "type": "string"
  1409. // }
  1410. // },
  1411. // "path": "v1/{+name}",
  1412. // "response": {
  1413. // "$ref": "Instance"
  1414. // },
  1415. // "scopes": [
  1416. // "https://www.googleapis.com/auth/cloud-platform"
  1417. // ]
  1418. // }
  1419. }
  1420. // method id "file.projects.locations.instances.list":
  1421. type ProjectsLocationsInstancesListCall struct {
  1422. s *Service
  1423. parent string
  1424. urlParams_ gensupport.URLParams
  1425. ifNoneMatch_ string
  1426. ctx_ context.Context
  1427. header_ http.Header
  1428. }
  1429. // List: Lists all instances in a project for either a specified
  1430. // location
  1431. // or for all locations.
  1432. func (r *ProjectsLocationsInstancesService) List(parent string) *ProjectsLocationsInstancesListCall {
  1433. c := &ProjectsLocationsInstancesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1434. c.parent = parent
  1435. return c
  1436. }
  1437. // Filter sets the optional parameter "filter": List filter.
  1438. func (c *ProjectsLocationsInstancesListCall) Filter(filter string) *ProjectsLocationsInstancesListCall {
  1439. c.urlParams_.Set("filter", filter)
  1440. return c
  1441. }
  1442. // OrderBy sets the optional parameter "orderBy": Sort results.
  1443. // Supported values are "name", "name desc" or "" (unsorted).
  1444. func (c *ProjectsLocationsInstancesListCall) OrderBy(orderBy string) *ProjectsLocationsInstancesListCall {
  1445. c.urlParams_.Set("orderBy", orderBy)
  1446. return c
  1447. }
  1448. // PageSize sets the optional parameter "pageSize": The maximum number
  1449. // of items to return.
  1450. func (c *ProjectsLocationsInstancesListCall) PageSize(pageSize int64) *ProjectsLocationsInstancesListCall {
  1451. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  1452. return c
  1453. }
  1454. // PageToken sets the optional parameter "pageToken": The
  1455. // next_page_token value to use if there are additional
  1456. // results to retrieve for this list request.
  1457. func (c *ProjectsLocationsInstancesListCall) PageToken(pageToken string) *ProjectsLocationsInstancesListCall {
  1458. c.urlParams_.Set("pageToken", pageToken)
  1459. return c
  1460. }
  1461. // Fields allows partial responses to be retrieved. See
  1462. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1463. // for more information.
  1464. func (c *ProjectsLocationsInstancesListCall) Fields(s ...googleapi.Field) *ProjectsLocationsInstancesListCall {
  1465. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1466. return c
  1467. }
  1468. // IfNoneMatch sets the optional parameter which makes the operation
  1469. // fail if the object's ETag matches the given value. This is useful for
  1470. // getting updates only after the object has changed since the last
  1471. // request. Use googleapi.IsNotModified to check whether the response
  1472. // error from Do is the result of In-None-Match.
  1473. func (c *ProjectsLocationsInstancesListCall) IfNoneMatch(entityTag string) *ProjectsLocationsInstancesListCall {
  1474. c.ifNoneMatch_ = entityTag
  1475. return c
  1476. }
  1477. // Context sets the context to be used in this call's Do method. Any
  1478. // pending HTTP request will be aborted if the provided context is
  1479. // canceled.
  1480. func (c *ProjectsLocationsInstancesListCall) Context(ctx context.Context) *ProjectsLocationsInstancesListCall {
  1481. c.ctx_ = ctx
  1482. return c
  1483. }
  1484. // Header returns an http.Header that can be modified by the caller to
  1485. // add HTTP headers to the request.
  1486. func (c *ProjectsLocationsInstancesListCall) Header() http.Header {
  1487. if c.header_ == nil {
  1488. c.header_ = make(http.Header)
  1489. }
  1490. return c.header_
  1491. }
  1492. func (c *ProjectsLocationsInstancesListCall) doRequest(alt string) (*http.Response, error) {
  1493. reqHeaders := make(http.Header)
  1494. for k, v := range c.header_ {
  1495. reqHeaders[k] = v
  1496. }
  1497. reqHeaders.Set("User-Agent", c.s.userAgent())
  1498. if c.ifNoneMatch_ != "" {
  1499. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1500. }
  1501. var body io.Reader = nil
  1502. c.urlParams_.Set("alt", alt)
  1503. c.urlParams_.Set("prettyPrint", "false")
  1504. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/instances")
  1505. urls += "?" + c.urlParams_.Encode()
  1506. req, err := http.NewRequest("GET", urls, body)
  1507. if err != nil {
  1508. return nil, err
  1509. }
  1510. req.Header = reqHeaders
  1511. googleapi.Expand(req.URL, map[string]string{
  1512. "parent": c.parent,
  1513. })
  1514. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1515. }
  1516. // Do executes the "file.projects.locations.instances.list" call.
  1517. // Exactly one of *ListInstancesResponse or error will be non-nil. Any
  1518. // non-2xx status code is an error. Response headers are in either
  1519. // *ListInstancesResponse.ServerResponse.Header or (if a response was
  1520. // returned at all) in error.(*googleapi.Error).Header. Use
  1521. // googleapi.IsNotModified to check whether the returned error was
  1522. // because http.StatusNotModified was returned.
  1523. func (c *ProjectsLocationsInstancesListCall) Do(opts ...googleapi.CallOption) (*ListInstancesResponse, error) {
  1524. gensupport.SetOptions(c.urlParams_, opts...)
  1525. res, err := c.doRequest("json")
  1526. if res != nil && res.StatusCode == http.StatusNotModified {
  1527. if res.Body != nil {
  1528. res.Body.Close()
  1529. }
  1530. return nil, &googleapi.Error{
  1531. Code: res.StatusCode,
  1532. Header: res.Header,
  1533. }
  1534. }
  1535. if err != nil {
  1536. return nil, err
  1537. }
  1538. defer googleapi.CloseBody(res)
  1539. if err := googleapi.CheckResponse(res); err != nil {
  1540. return nil, err
  1541. }
  1542. ret := &ListInstancesResponse{
  1543. ServerResponse: googleapi.ServerResponse{
  1544. Header: res.Header,
  1545. HTTPStatusCode: res.StatusCode,
  1546. },
  1547. }
  1548. target := &ret
  1549. if err := gensupport.DecodeResponse(target, res); err != nil {
  1550. return nil, err
  1551. }
  1552. return ret, nil
  1553. // {
  1554. // "description": "Lists all instances in a project for either a specified location\nor for all locations.",
  1555. // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/instances",
  1556. // "httpMethod": "GET",
  1557. // "id": "file.projects.locations.instances.list",
  1558. // "parameterOrder": [
  1559. // "parent"
  1560. // ],
  1561. // "parameters": {
  1562. // "filter": {
  1563. // "description": "List filter.",
  1564. // "location": "query",
  1565. // "type": "string"
  1566. // },
  1567. // "orderBy": {
  1568. // "description": "Sort results. Supported values are \"name\", \"name desc\" or \"\" (unsorted).",
  1569. // "location": "query",
  1570. // "type": "string"
  1571. // },
  1572. // "pageSize": {
  1573. // "description": "The maximum number of items to return.",
  1574. // "format": "int32",
  1575. // "location": "query",
  1576. // "type": "integer"
  1577. // },
  1578. // "pageToken": {
  1579. // "description": "The next_page_token value to use if there are additional\nresults to retrieve for this list request.",
  1580. // "location": "query",
  1581. // "type": "string"
  1582. // },
  1583. // "parent": {
  1584. // "description": "The project and location for which to retrieve instance information,\nin the format projects/{project_id}/locations/{location}. In Cloud\nFilestore, locations map to GCP zones, for example **us-west1-b**. To\nretrieve instance information for all locations, use \"-\" for the {location}\nvalue.",
  1585. // "location": "path",
  1586. // "pattern": "^projects/[^/]+/locations/[^/]+$",
  1587. // "required": true,
  1588. // "type": "string"
  1589. // }
  1590. // },
  1591. // "path": "v1/{+parent}/instances",
  1592. // "response": {
  1593. // "$ref": "ListInstancesResponse"
  1594. // },
  1595. // "scopes": [
  1596. // "https://www.googleapis.com/auth/cloud-platform"
  1597. // ]
  1598. // }
  1599. }
  1600. // Pages invokes f for each page of results.
  1601. // A non-nil error returned from f will halt the iteration.
  1602. // The provided context supersedes any context provided to the Context method.
  1603. func (c *ProjectsLocationsInstancesListCall) Pages(ctx context.Context, f func(*ListInstancesResponse) error) error {
  1604. c.ctx_ = ctx
  1605. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  1606. for {
  1607. x, err := c.Do()
  1608. if err != nil {
  1609. return err
  1610. }
  1611. if err := f(x); err != nil {
  1612. return err
  1613. }
  1614. if x.NextPageToken == "" {
  1615. return nil
  1616. }
  1617. c.PageToken(x.NextPageToken)
  1618. }
  1619. }
  1620. // method id "file.projects.locations.instances.patch":
  1621. type ProjectsLocationsInstancesPatchCall struct {
  1622. s *Service
  1623. name string
  1624. instance *Instance
  1625. urlParams_ gensupport.URLParams
  1626. ctx_ context.Context
  1627. header_ http.Header
  1628. }
  1629. // Patch: Updates the settings of a specific instance.
  1630. func (r *ProjectsLocationsInstancesService) Patch(name string, instance *Instance) *ProjectsLocationsInstancesPatchCall {
  1631. c := &ProjectsLocationsInstancesPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1632. c.name = name
  1633. c.instance = instance
  1634. return c
  1635. }
  1636. // UpdateMask sets the optional parameter "updateMask": Mask of fields
  1637. // to update. At least one path must be supplied in this
  1638. // field. The elements of the repeated paths field may only include
  1639. // these
  1640. // fields:
  1641. // "description"
  1642. func (c *ProjectsLocationsInstancesPatchCall) UpdateMask(updateMask string) *ProjectsLocationsInstancesPatchCall {
  1643. c.urlParams_.Set("updateMask", updateMask)
  1644. return c
  1645. }
  1646. // Fields allows partial responses to be retrieved. See
  1647. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1648. // for more information.
  1649. func (c *ProjectsLocationsInstancesPatchCall) Fields(s ...googleapi.Field) *ProjectsLocationsInstancesPatchCall {
  1650. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1651. return c
  1652. }
  1653. // Context sets the context to be used in this call's Do method. Any
  1654. // pending HTTP request will be aborted if the provided context is
  1655. // canceled.
  1656. func (c *ProjectsLocationsInstancesPatchCall) Context(ctx context.Context) *ProjectsLocationsInstancesPatchCall {
  1657. c.ctx_ = ctx
  1658. return c
  1659. }
  1660. // Header returns an http.Header that can be modified by the caller to
  1661. // add HTTP headers to the request.
  1662. func (c *ProjectsLocationsInstancesPatchCall) Header() http.Header {
  1663. if c.header_ == nil {
  1664. c.header_ = make(http.Header)
  1665. }
  1666. return c.header_
  1667. }
  1668. func (c *ProjectsLocationsInstancesPatchCall) doRequest(alt string) (*http.Response, error) {
  1669. reqHeaders := make(http.Header)
  1670. for k, v := range c.header_ {
  1671. reqHeaders[k] = v
  1672. }
  1673. reqHeaders.Set("User-Agent", c.s.userAgent())
  1674. var body io.Reader = nil
  1675. body, err := googleapi.WithoutDataWrapper.JSONReader(c.instance)
  1676. if err != nil {
  1677. return nil, err
  1678. }
  1679. reqHeaders.Set("Content-Type", "application/json")
  1680. c.urlParams_.Set("alt", alt)
  1681. c.urlParams_.Set("prettyPrint", "false")
  1682. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  1683. urls += "?" + c.urlParams_.Encode()
  1684. req, err := http.NewRequest("PATCH", urls, body)
  1685. if err != nil {
  1686. return nil, err
  1687. }
  1688. req.Header = reqHeaders
  1689. googleapi.Expand(req.URL, map[string]string{
  1690. "name": c.name,
  1691. })
  1692. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1693. }
  1694. // Do executes the "file.projects.locations.instances.patch" call.
  1695. // Exactly one of *Operation or error will be non-nil. Any non-2xx
  1696. // status code is an error. Response headers are in either
  1697. // *Operation.ServerResponse.Header or (if a response was returned at
  1698. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  1699. // to check whether the returned error was because
  1700. // http.StatusNotModified was returned.
  1701. func (c *ProjectsLocationsInstancesPatchCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
  1702. gensupport.SetOptions(c.urlParams_, opts...)
  1703. res, err := c.doRequest("json")
  1704. if res != nil && res.StatusCode == http.StatusNotModified {
  1705. if res.Body != nil {
  1706. res.Body.Close()
  1707. }
  1708. return nil, &googleapi.Error{
  1709. Code: res.StatusCode,
  1710. Header: res.Header,
  1711. }
  1712. }
  1713. if err != nil {
  1714. return nil, err
  1715. }
  1716. defer googleapi.CloseBody(res)
  1717. if err := googleapi.CheckResponse(res); err != nil {
  1718. return nil, err
  1719. }
  1720. ret := &Operation{
  1721. ServerResponse: googleapi.ServerResponse{
  1722. Header: res.Header,
  1723. HTTPStatusCode: res.StatusCode,
  1724. },
  1725. }
  1726. target := &ret
  1727. if err := gensupport.DecodeResponse(target, res); err != nil {
  1728. return nil, err
  1729. }
  1730. return ret, nil
  1731. // {
  1732. // "description": "Updates the settings of a specific instance.",
  1733. // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/instances/{instancesId}",
  1734. // "httpMethod": "PATCH",
  1735. // "id": "file.projects.locations.instances.patch",
  1736. // "parameterOrder": [
  1737. // "name"
  1738. // ],
  1739. // "parameters": {
  1740. // "name": {
  1741. // "description": "Output only.\nThe resource name of the instance, in the format\nprojects/{project_id}/locations/{location_id}/instances/{instance_id}.",
  1742. // "location": "path",
  1743. // "pattern": "^projects/[^/]+/locations/[^/]+/instances/[^/]+$",
  1744. // "required": true,
  1745. // "type": "string"
  1746. // },
  1747. // "updateMask": {
  1748. // "description": "Mask of fields to update. At least one path must be supplied in this\nfield. The elements of the repeated paths field may only include these\nfields:\n\"description\"",
  1749. // "format": "google-fieldmask",
  1750. // "location": "query",
  1751. // "type": "string"
  1752. // }
  1753. // },
  1754. // "path": "v1/{+name}",
  1755. // "request": {
  1756. // "$ref": "Instance"
  1757. // },
  1758. // "response": {
  1759. // "$ref": "Operation"
  1760. // },
  1761. // "scopes": [
  1762. // "https://www.googleapis.com/auth/cloud-platform"
  1763. // ]
  1764. // }
  1765. }
  1766. // method id "file.projects.locations.operations.cancel":
  1767. type ProjectsLocationsOperationsCancelCall struct {
  1768. s *Service
  1769. name string
  1770. canceloperationrequest *CancelOperationRequest
  1771. urlParams_ gensupport.URLParams
  1772. ctx_ context.Context
  1773. header_ http.Header
  1774. }
  1775. // Cancel: Starts asynchronous cancellation on a long-running operation.
  1776. // The server
  1777. // makes a best effort to cancel the operation, but success is
  1778. // not
  1779. // guaranteed. If the server doesn't support this method, it
  1780. // returns
  1781. // `google.rpc.Code.UNIMPLEMENTED`. Clients can
  1782. // use
  1783. // Operations.GetOperation or
  1784. // other methods to check whether the cancellation succeeded or whether
  1785. // the
  1786. // operation completed despite cancellation. On successful
  1787. // cancellation,
  1788. // the operation is not deleted; instead, it becomes an operation
  1789. // with
  1790. // an Operation.error value with a google.rpc.Status.code of
  1791. // 1,
  1792. // corresponding to `Code.CANCELLED`.
  1793. func (r *ProjectsLocationsOperationsService) Cancel(name string, canceloperationrequest *CancelOperationRequest) *ProjectsLocationsOperationsCancelCall {
  1794. c := &ProjectsLocationsOperationsCancelCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1795. c.name = name
  1796. c.canceloperationrequest = canceloperationrequest
  1797. return c
  1798. }
  1799. // Fields allows partial responses to be retrieved. See
  1800. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1801. // for more information.
  1802. func (c *ProjectsLocationsOperationsCancelCall) Fields(s ...googleapi.Field) *ProjectsLocationsOperationsCancelCall {
  1803. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1804. return c
  1805. }
  1806. // Context sets the context to be used in this call's Do method. Any
  1807. // pending HTTP request will be aborted if the provided context is
  1808. // canceled.
  1809. func (c *ProjectsLocationsOperationsCancelCall) Context(ctx context.Context) *ProjectsLocationsOperationsCancelCall {
  1810. c.ctx_ = ctx
  1811. return c
  1812. }
  1813. // Header returns an http.Header that can be modified by the caller to
  1814. // add HTTP headers to the request.
  1815. func (c *ProjectsLocationsOperationsCancelCall) Header() http.Header {
  1816. if c.header_ == nil {
  1817. c.header_ = make(http.Header)
  1818. }
  1819. return c.header_
  1820. }
  1821. func (c *ProjectsLocationsOperationsCancelCall) doRequest(alt string) (*http.Response, error) {
  1822. reqHeaders := make(http.Header)
  1823. for k, v := range c.header_ {
  1824. reqHeaders[k] = v
  1825. }
  1826. reqHeaders.Set("User-Agent", c.s.userAgent())
  1827. var body io.Reader = nil
  1828. body, err := googleapi.WithoutDataWrapper.JSONReader(c.canceloperationrequest)
  1829. if err != nil {
  1830. return nil, err
  1831. }
  1832. reqHeaders.Set("Content-Type", "application/json")
  1833. c.urlParams_.Set("alt", alt)
  1834. c.urlParams_.Set("prettyPrint", "false")
  1835. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}:cancel")
  1836. urls += "?" + c.urlParams_.Encode()
  1837. req, err := http.NewRequest("POST", urls, body)
  1838. if err != nil {
  1839. return nil, err
  1840. }
  1841. req.Header = reqHeaders
  1842. googleapi.Expand(req.URL, map[string]string{
  1843. "name": c.name,
  1844. })
  1845. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1846. }
  1847. // Do executes the "file.projects.locations.operations.cancel" call.
  1848. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  1849. // code is an error. Response headers are in either
  1850. // *Empty.ServerResponse.Header or (if a response was returned at all)
  1851. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  1852. // check whether the returned error was because http.StatusNotModified
  1853. // was returned.
  1854. func (c *ProjectsLocationsOperationsCancelCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  1855. gensupport.SetOptions(c.urlParams_, opts...)
  1856. res, err := c.doRequest("json")
  1857. if res != nil && res.StatusCode == http.StatusNotModified {
  1858. if res.Body != nil {
  1859. res.Body.Close()
  1860. }
  1861. return nil, &googleapi.Error{
  1862. Code: res.StatusCode,
  1863. Header: res.Header,
  1864. }
  1865. }
  1866. if err != nil {
  1867. return nil, err
  1868. }
  1869. defer googleapi.CloseBody(res)
  1870. if err := googleapi.CheckResponse(res); err != nil {
  1871. return nil, err
  1872. }
  1873. ret := &Empty{
  1874. ServerResponse: googleapi.ServerResponse{
  1875. Header: res.Header,
  1876. HTTPStatusCode: res.StatusCode,
  1877. },
  1878. }
  1879. target := &ret
  1880. if err := gensupport.DecodeResponse(target, res); err != nil {
  1881. return nil, err
  1882. }
  1883. return ret, nil
  1884. // {
  1885. // "description": "Starts asynchronous cancellation on a long-running operation. The server\nmakes a best effort to cancel the operation, but success is not\nguaranteed. If the server doesn't support this method, it returns\n`google.rpc.Code.UNIMPLEMENTED`. Clients can use\nOperations.GetOperation or\nother methods to check whether the cancellation succeeded or whether the\noperation completed despite cancellation. On successful cancellation,\nthe operation is not deleted; instead, it becomes an operation with\nan Operation.error value with a google.rpc.Status.code of 1,\ncorresponding to `Code.CANCELLED`.",
  1886. // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/operations/{operationsId}:cancel",
  1887. // "httpMethod": "POST",
  1888. // "id": "file.projects.locations.operations.cancel",
  1889. // "parameterOrder": [
  1890. // "name"
  1891. // ],
  1892. // "parameters": {
  1893. // "name": {
  1894. // "description": "The name of the operation resource to be cancelled.",
  1895. // "location": "path",
  1896. // "pattern": "^projects/[^/]+/locations/[^/]+/operations/[^/]+$",
  1897. // "required": true,
  1898. // "type": "string"
  1899. // }
  1900. // },
  1901. // "path": "v1/{+name}:cancel",
  1902. // "request": {
  1903. // "$ref": "CancelOperationRequest"
  1904. // },
  1905. // "response": {
  1906. // "$ref": "Empty"
  1907. // },
  1908. // "scopes": [
  1909. // "https://www.googleapis.com/auth/cloud-platform"
  1910. // ]
  1911. // }
  1912. }
  1913. // method id "file.projects.locations.operations.delete":
  1914. type ProjectsLocationsOperationsDeleteCall struct {
  1915. s *Service
  1916. name string
  1917. urlParams_ gensupport.URLParams
  1918. ctx_ context.Context
  1919. header_ http.Header
  1920. }
  1921. // Delete: Deletes a long-running operation. This method indicates that
  1922. // the client is
  1923. // no longer interested in the operation result. It does not cancel
  1924. // the
  1925. // operation. If the server doesn't support this method, it
  1926. // returns
  1927. // `google.rpc.Code.UNIMPLEMENTED`.
  1928. func (r *ProjectsLocationsOperationsService) Delete(name string) *ProjectsLocationsOperationsDeleteCall {
  1929. c := &ProjectsLocationsOperationsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1930. c.name = name
  1931. return c
  1932. }
  1933. // Fields allows partial responses to be retrieved. See
  1934. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1935. // for more information.
  1936. func (c *ProjectsLocationsOperationsDeleteCall) Fields(s ...googleapi.Field) *ProjectsLocationsOperationsDeleteCall {
  1937. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1938. return c
  1939. }
  1940. // Context sets the context to be used in this call's Do method. Any
  1941. // pending HTTP request will be aborted if the provided context is
  1942. // canceled.
  1943. func (c *ProjectsLocationsOperationsDeleteCall) Context(ctx context.Context) *ProjectsLocationsOperationsDeleteCall {
  1944. c.ctx_ = ctx
  1945. return c
  1946. }
  1947. // Header returns an http.Header that can be modified by the caller to
  1948. // add HTTP headers to the request.
  1949. func (c *ProjectsLocationsOperationsDeleteCall) Header() http.Header {
  1950. if c.header_ == nil {
  1951. c.header_ = make(http.Header)
  1952. }
  1953. return c.header_
  1954. }
  1955. func (c *ProjectsLocationsOperationsDeleteCall) doRequest(alt string) (*http.Response, error) {
  1956. reqHeaders := make(http.Header)
  1957. for k, v := range c.header_ {
  1958. reqHeaders[k] = v
  1959. }
  1960. reqHeaders.Set("User-Agent", c.s.userAgent())
  1961. var body io.Reader = nil
  1962. c.urlParams_.Set("alt", alt)
  1963. c.urlParams_.Set("prettyPrint", "false")
  1964. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  1965. urls += "?" + c.urlParams_.Encode()
  1966. req, err := http.NewRequest("DELETE", urls, body)
  1967. if err != nil {
  1968. return nil, err
  1969. }
  1970. req.Header = reqHeaders
  1971. googleapi.Expand(req.URL, map[string]string{
  1972. "name": c.name,
  1973. })
  1974. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1975. }
  1976. // Do executes the "file.projects.locations.operations.delete" call.
  1977. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  1978. // code is an error. Response headers are in either
  1979. // *Empty.ServerResponse.Header or (if a response was returned at all)
  1980. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  1981. // check whether the returned error was because http.StatusNotModified
  1982. // was returned.
  1983. func (c *ProjectsLocationsOperationsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  1984. gensupport.SetOptions(c.urlParams_, opts...)
  1985. res, err := c.doRequest("json")
  1986. if res != nil && res.StatusCode == http.StatusNotModified {
  1987. if res.Body != nil {
  1988. res.Body.Close()
  1989. }
  1990. return nil, &googleapi.Error{
  1991. Code: res.StatusCode,
  1992. Header: res.Header,
  1993. }
  1994. }
  1995. if err != nil {
  1996. return nil, err
  1997. }
  1998. defer googleapi.CloseBody(res)
  1999. if err := googleapi.CheckResponse(res); err != nil {
  2000. return nil, err
  2001. }
  2002. ret := &Empty{
  2003. ServerResponse: googleapi.ServerResponse{
  2004. Header: res.Header,
  2005. HTTPStatusCode: res.StatusCode,
  2006. },
  2007. }
  2008. target := &ret
  2009. if err := gensupport.DecodeResponse(target, res); err != nil {
  2010. return nil, err
  2011. }
  2012. return ret, nil
  2013. // {
  2014. // "description": "Deletes a long-running operation. This method indicates that the client is\nno longer interested in the operation result. It does not cancel the\noperation. If the server doesn't support this method, it returns\n`google.rpc.Code.UNIMPLEMENTED`.",
  2015. // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/operations/{operationsId}",
  2016. // "httpMethod": "DELETE",
  2017. // "id": "file.projects.locations.operations.delete",
  2018. // "parameterOrder": [
  2019. // "name"
  2020. // ],
  2021. // "parameters": {
  2022. // "name": {
  2023. // "description": "The name of the operation resource to be deleted.",
  2024. // "location": "path",
  2025. // "pattern": "^projects/[^/]+/locations/[^/]+/operations/[^/]+$",
  2026. // "required": true,
  2027. // "type": "string"
  2028. // }
  2029. // },
  2030. // "path": "v1/{+name}",
  2031. // "response": {
  2032. // "$ref": "Empty"
  2033. // },
  2034. // "scopes": [
  2035. // "https://www.googleapis.com/auth/cloud-platform"
  2036. // ]
  2037. // }
  2038. }
  2039. // method id "file.projects.locations.operations.get":
  2040. type ProjectsLocationsOperationsGetCall struct {
  2041. s *Service
  2042. name string
  2043. urlParams_ gensupport.URLParams
  2044. ifNoneMatch_ string
  2045. ctx_ context.Context
  2046. header_ http.Header
  2047. }
  2048. // Get: Gets the latest state of a long-running operation. Clients can
  2049. // use this
  2050. // method to poll the operation result at intervals as recommended by
  2051. // the API
  2052. // service.
  2053. func (r *ProjectsLocationsOperationsService) Get(name string) *ProjectsLocationsOperationsGetCall {
  2054. c := &ProjectsLocationsOperationsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2055. c.name = name
  2056. return c
  2057. }
  2058. // Fields allows partial responses to be retrieved. See
  2059. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2060. // for more information.
  2061. func (c *ProjectsLocationsOperationsGetCall) Fields(s ...googleapi.Field) *ProjectsLocationsOperationsGetCall {
  2062. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2063. return c
  2064. }
  2065. // IfNoneMatch sets the optional parameter which makes the operation
  2066. // fail if the object's ETag matches the given value. This is useful for
  2067. // getting updates only after the object has changed since the last
  2068. // request. Use googleapi.IsNotModified to check whether the response
  2069. // error from Do is the result of In-None-Match.
  2070. func (c *ProjectsLocationsOperationsGetCall) IfNoneMatch(entityTag string) *ProjectsLocationsOperationsGetCall {
  2071. c.ifNoneMatch_ = entityTag
  2072. return c
  2073. }
  2074. // Context sets the context to be used in this call's Do method. Any
  2075. // pending HTTP request will be aborted if the provided context is
  2076. // canceled.
  2077. func (c *ProjectsLocationsOperationsGetCall) Context(ctx context.Context) *ProjectsLocationsOperationsGetCall {
  2078. c.ctx_ = ctx
  2079. return c
  2080. }
  2081. // Header returns an http.Header that can be modified by the caller to
  2082. // add HTTP headers to the request.
  2083. func (c *ProjectsLocationsOperationsGetCall) Header() http.Header {
  2084. if c.header_ == nil {
  2085. c.header_ = make(http.Header)
  2086. }
  2087. return c.header_
  2088. }
  2089. func (c *ProjectsLocationsOperationsGetCall) doRequest(alt string) (*http.Response, error) {
  2090. reqHeaders := make(http.Header)
  2091. for k, v := range c.header_ {
  2092. reqHeaders[k] = v
  2093. }
  2094. reqHeaders.Set("User-Agent", c.s.userAgent())
  2095. if c.ifNoneMatch_ != "" {
  2096. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2097. }
  2098. var body io.Reader = nil
  2099. c.urlParams_.Set("alt", alt)
  2100. c.urlParams_.Set("prettyPrint", "false")
  2101. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  2102. urls += "?" + c.urlParams_.Encode()
  2103. req, err := http.NewRequest("GET", urls, body)
  2104. if err != nil {
  2105. return nil, err
  2106. }
  2107. req.Header = reqHeaders
  2108. googleapi.Expand(req.URL, map[string]string{
  2109. "name": c.name,
  2110. })
  2111. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2112. }
  2113. // Do executes the "file.projects.locations.operations.get" call.
  2114. // Exactly one of *Operation or error will be non-nil. Any non-2xx
  2115. // status code is an error. Response headers are in either
  2116. // *Operation.ServerResponse.Header or (if a response was returned at
  2117. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  2118. // to check whether the returned error was because
  2119. // http.StatusNotModified was returned.
  2120. func (c *ProjectsLocationsOperationsGetCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
  2121. gensupport.SetOptions(c.urlParams_, opts...)
  2122. res, err := c.doRequest("json")
  2123. if res != nil && res.StatusCode == http.StatusNotModified {
  2124. if res.Body != nil {
  2125. res.Body.Close()
  2126. }
  2127. return nil, &googleapi.Error{
  2128. Code: res.StatusCode,
  2129. Header: res.Header,
  2130. }
  2131. }
  2132. if err != nil {
  2133. return nil, err
  2134. }
  2135. defer googleapi.CloseBody(res)
  2136. if err := googleapi.CheckResponse(res); err != nil {
  2137. return nil, err
  2138. }
  2139. ret := &Operation{
  2140. ServerResponse: googleapi.ServerResponse{
  2141. Header: res.Header,
  2142. HTTPStatusCode: res.StatusCode,
  2143. },
  2144. }
  2145. target := &ret
  2146. if err := gensupport.DecodeResponse(target, res); err != nil {
  2147. return nil, err
  2148. }
  2149. return ret, nil
  2150. // {
  2151. // "description": "Gets the latest state of a long-running operation. Clients can use this\nmethod to poll the operation result at intervals as recommended by the API\nservice.",
  2152. // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/operations/{operationsId}",
  2153. // "httpMethod": "GET",
  2154. // "id": "file.projects.locations.operations.get",
  2155. // "parameterOrder": [
  2156. // "name"
  2157. // ],
  2158. // "parameters": {
  2159. // "name": {
  2160. // "description": "The name of the operation resource.",
  2161. // "location": "path",
  2162. // "pattern": "^projects/[^/]+/locations/[^/]+/operations/[^/]+$",
  2163. // "required": true,
  2164. // "type": "string"
  2165. // }
  2166. // },
  2167. // "path": "v1/{+name}",
  2168. // "response": {
  2169. // "$ref": "Operation"
  2170. // },
  2171. // "scopes": [
  2172. // "https://www.googleapis.com/auth/cloud-platform"
  2173. // ]
  2174. // }
  2175. }
  2176. // method id "file.projects.locations.operations.list":
  2177. type ProjectsLocationsOperationsListCall struct {
  2178. s *Service
  2179. name string
  2180. urlParams_ gensupport.URLParams
  2181. ifNoneMatch_ string
  2182. ctx_ context.Context
  2183. header_ http.Header
  2184. }
  2185. // List: Lists operations that match the specified filter in the
  2186. // request. If the
  2187. // server doesn't support this method, it returns
  2188. // `UNIMPLEMENTED`.
  2189. //
  2190. // NOTE: the `name` binding allows API services to override the
  2191. // binding
  2192. // to use different resource name schemes, such as `users/*/operations`.
  2193. // To
  2194. // override the binding, API services can add a binding such
  2195. // as
  2196. // "/v1/{name=users/*}/operations" to their service configuration.
  2197. // For backwards compatibility, the default name includes the
  2198. // operations
  2199. // collection id, however overriding users must ensure the name
  2200. // binding
  2201. // is the parent resource, without the operations collection id.
  2202. func (r *ProjectsLocationsOperationsService) List(name string) *ProjectsLocationsOperationsListCall {
  2203. c := &ProjectsLocationsOperationsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2204. c.name = name
  2205. return c
  2206. }
  2207. // Filter sets the optional parameter "filter": The standard list
  2208. // filter.
  2209. func (c *ProjectsLocationsOperationsListCall) Filter(filter string) *ProjectsLocationsOperationsListCall {
  2210. c.urlParams_.Set("filter", filter)
  2211. return c
  2212. }
  2213. // PageSize sets the optional parameter "pageSize": The standard list
  2214. // page size.
  2215. func (c *ProjectsLocationsOperationsListCall) PageSize(pageSize int64) *ProjectsLocationsOperationsListCall {
  2216. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  2217. return c
  2218. }
  2219. // PageToken sets the optional parameter "pageToken": The standard list
  2220. // page token.
  2221. func (c *ProjectsLocationsOperationsListCall) PageToken(pageToken string) *ProjectsLocationsOperationsListCall {
  2222. c.urlParams_.Set("pageToken", pageToken)
  2223. return c
  2224. }
  2225. // Fields allows partial responses to be retrieved. See
  2226. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2227. // for more information.
  2228. func (c *ProjectsLocationsOperationsListCall) Fields(s ...googleapi.Field) *ProjectsLocationsOperationsListCall {
  2229. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2230. return c
  2231. }
  2232. // IfNoneMatch sets the optional parameter which makes the operation
  2233. // fail if the object's ETag matches the given value. This is useful for
  2234. // getting updates only after the object has changed since the last
  2235. // request. Use googleapi.IsNotModified to check whether the response
  2236. // error from Do is the result of In-None-Match.
  2237. func (c *ProjectsLocationsOperationsListCall) IfNoneMatch(entityTag string) *ProjectsLocationsOperationsListCall {
  2238. c.ifNoneMatch_ = entityTag
  2239. return c
  2240. }
  2241. // Context sets the context to be used in this call's Do method. Any
  2242. // pending HTTP request will be aborted if the provided context is
  2243. // canceled.
  2244. func (c *ProjectsLocationsOperationsListCall) Context(ctx context.Context) *ProjectsLocationsOperationsListCall {
  2245. c.ctx_ = ctx
  2246. return c
  2247. }
  2248. // Header returns an http.Header that can be modified by the caller to
  2249. // add HTTP headers to the request.
  2250. func (c *ProjectsLocationsOperationsListCall) Header() http.Header {
  2251. if c.header_ == nil {
  2252. c.header_ = make(http.Header)
  2253. }
  2254. return c.header_
  2255. }
  2256. func (c *ProjectsLocationsOperationsListCall) doRequest(alt string) (*http.Response, error) {
  2257. reqHeaders := make(http.Header)
  2258. for k, v := range c.header_ {
  2259. reqHeaders[k] = v
  2260. }
  2261. reqHeaders.Set("User-Agent", c.s.userAgent())
  2262. if c.ifNoneMatch_ != "" {
  2263. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2264. }
  2265. var body io.Reader = nil
  2266. c.urlParams_.Set("alt", alt)
  2267. c.urlParams_.Set("prettyPrint", "false")
  2268. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}/operations")
  2269. urls += "?" + c.urlParams_.Encode()
  2270. req, err := http.NewRequest("GET", urls, body)
  2271. if err != nil {
  2272. return nil, err
  2273. }
  2274. req.Header = reqHeaders
  2275. googleapi.Expand(req.URL, map[string]string{
  2276. "name": c.name,
  2277. })
  2278. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2279. }
  2280. // Do executes the "file.projects.locations.operations.list" call.
  2281. // Exactly one of *ListOperationsResponse or error will be non-nil. Any
  2282. // non-2xx status code is an error. Response headers are in either
  2283. // *ListOperationsResponse.ServerResponse.Header or (if a response was
  2284. // returned at all) in error.(*googleapi.Error).Header. Use
  2285. // googleapi.IsNotModified to check whether the returned error was
  2286. // because http.StatusNotModified was returned.
  2287. func (c *ProjectsLocationsOperationsListCall) Do(opts ...googleapi.CallOption) (*ListOperationsResponse, error) {
  2288. gensupport.SetOptions(c.urlParams_, opts...)
  2289. res, err := c.doRequest("json")
  2290. if res != nil && res.StatusCode == http.StatusNotModified {
  2291. if res.Body != nil {
  2292. res.Body.Close()
  2293. }
  2294. return nil, &googleapi.Error{
  2295. Code: res.StatusCode,
  2296. Header: res.Header,
  2297. }
  2298. }
  2299. if err != nil {
  2300. return nil, err
  2301. }
  2302. defer googleapi.CloseBody(res)
  2303. if err := googleapi.CheckResponse(res); err != nil {
  2304. return nil, err
  2305. }
  2306. ret := &ListOperationsResponse{
  2307. ServerResponse: googleapi.ServerResponse{
  2308. Header: res.Header,
  2309. HTTPStatusCode: res.StatusCode,
  2310. },
  2311. }
  2312. target := &ret
  2313. if err := gensupport.DecodeResponse(target, res); err != nil {
  2314. return nil, err
  2315. }
  2316. return ret, nil
  2317. // {
  2318. // "description": "Lists operations that match the specified filter in the request. If the\nserver doesn't support this method, it returns `UNIMPLEMENTED`.\n\nNOTE: the `name` binding allows API services to override the binding\nto use different resource name schemes, such as `users/*/operations`. To\noverride the binding, API services can add a binding such as\n`\"/v1/{name=users/*}/operations\"` to their service configuration.\nFor backwards compatibility, the default name includes the operations\ncollection id, however overriding users must ensure the name binding\nis the parent resource, without the operations collection id.",
  2319. // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/operations",
  2320. // "httpMethod": "GET",
  2321. // "id": "file.projects.locations.operations.list",
  2322. // "parameterOrder": [
  2323. // "name"
  2324. // ],
  2325. // "parameters": {
  2326. // "filter": {
  2327. // "description": "The standard list filter.",
  2328. // "location": "query",
  2329. // "type": "string"
  2330. // },
  2331. // "name": {
  2332. // "description": "The name of the operation's parent resource.",
  2333. // "location": "path",
  2334. // "pattern": "^projects/[^/]+/locations/[^/]+$",
  2335. // "required": true,
  2336. // "type": "string"
  2337. // },
  2338. // "pageSize": {
  2339. // "description": "The standard list page size.",
  2340. // "format": "int32",
  2341. // "location": "query",
  2342. // "type": "integer"
  2343. // },
  2344. // "pageToken": {
  2345. // "description": "The standard list page token.",
  2346. // "location": "query",
  2347. // "type": "string"
  2348. // }
  2349. // },
  2350. // "path": "v1/{+name}/operations",
  2351. // "response": {
  2352. // "$ref": "ListOperationsResponse"
  2353. // },
  2354. // "scopes": [
  2355. // "https://www.googleapis.com/auth/cloud-platform"
  2356. // ]
  2357. // }
  2358. }
  2359. // Pages invokes f for each page of results.
  2360. // A non-nil error returned from f will halt the iteration.
  2361. // The provided context supersedes any context provided to the Context method.
  2362. func (c *ProjectsLocationsOperationsListCall) Pages(ctx context.Context, f func(*ListOperationsResponse) error) error {
  2363. c.ctx_ = ctx
  2364. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  2365. for {
  2366. x, err := c.Do()
  2367. if err != nil {
  2368. return err
  2369. }
  2370. if err := f(x); err != nil {
  2371. return err
  2372. }
  2373. if x.NextPageToken == "" {
  2374. return nil
  2375. }
  2376. c.PageToken(x.NextPageToken)
  2377. }
  2378. }