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

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