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.
 
 
 

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