1// Copyright 2021 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 5// Code generated file. DO NOT EDIT. 6 7// Package redis provides access to the Google Cloud Memorystore for Redis API. 8// 9// This package is DEPRECATED. Use package cloud.google.com/go/redis/apiv1 instead. 10// 11// For product documentation, see: https://cloud.google.com/memorystore/docs/redis/ 12// 13// Creating a client 14// 15// Usage example: 16// 17// import "google.golang.org/api/redis/v1" 18// ... 19// ctx := context.Background() 20// redisService, err := redis.NewService(ctx) 21// 22// In this example, Google Application Default Credentials are used for authentication. 23// 24// For information on how to create and obtain Application Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials. 25// 26// Other authentication options 27// 28// To use an API key for authentication (note: some APIs do not support API keys), use option.WithAPIKey: 29// 30// redisService, err := redis.NewService(ctx, option.WithAPIKey("AIza...")) 31// 32// To use an OAuth token (e.g., a user token obtained via a three-legged OAuth flow), use option.WithTokenSource: 33// 34// config := &oauth2.Config{...} 35// // ... 36// token, err := config.Exchange(ctx, ...) 37// redisService, err := redis.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token))) 38// 39// See https://godoc.org/google.golang.org/api/option/ for details on options. 40package redis // import "google.golang.org/api/redis/v1" 41 42import ( 43 "bytes" 44 "context" 45 "encoding/json" 46 "errors" 47 "fmt" 48 "io" 49 "net/http" 50 "net/url" 51 "strconv" 52 "strings" 53 54 googleapi "google.golang.org/api/googleapi" 55 gensupport "google.golang.org/api/internal/gensupport" 56 option "google.golang.org/api/option" 57 internaloption "google.golang.org/api/option/internaloption" 58 htransport "google.golang.org/api/transport/http" 59) 60 61// Always reference these packages, just in case the auto-generated code 62// below doesn't. 63var _ = bytes.NewBuffer 64var _ = strconv.Itoa 65var _ = fmt.Sprintf 66var _ = json.NewDecoder 67var _ = io.Copy 68var _ = url.Parse 69var _ = gensupport.MarshalJSON 70var _ = googleapi.Version 71var _ = errors.New 72var _ = strings.Replace 73var _ = context.Canceled 74var _ = internaloption.WithDefaultEndpoint 75 76const apiId = "redis:v1" 77const apiName = "redis" 78const apiVersion = "v1" 79const basePath = "https://redis.googleapis.com/" 80const mtlsBasePath = "https://redis.mtls.googleapis.com/" 81 82// OAuth2 scopes used by this API. 83const ( 84 // See, edit, configure, and delete your Google Cloud Platform data 85 CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platform" 86) 87 88// NewService creates a new Service. 89func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) { 90 scopesOption := option.WithScopes( 91 "https://www.googleapis.com/auth/cloud-platform", 92 ) 93 // NOTE: prepend, so we don't override user-specified scopes. 94 opts = append([]option.ClientOption{scopesOption}, opts...) 95 opts = append(opts, internaloption.WithDefaultEndpoint(basePath)) 96 opts = append(opts, internaloption.WithDefaultMTLSEndpoint(mtlsBasePath)) 97 client, endpoint, err := htransport.NewClient(ctx, opts...) 98 if err != nil { 99 return nil, err 100 } 101 s, err := New(client) 102 if err != nil { 103 return nil, err 104 } 105 if endpoint != "" { 106 s.BasePath = endpoint 107 } 108 return s, nil 109} 110 111// New creates a new Service. It uses the provided http.Client for requests. 112// 113// Deprecated: please use NewService instead. 114// To provide a custom HTTP client, use option.WithHTTPClient. 115// If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead. 116func New(client *http.Client) (*Service, error) { 117 if client == nil { 118 return nil, errors.New("client is nil") 119 } 120 s := &Service{client: client, BasePath: basePath} 121 s.Projects = NewProjectsService(s) 122 return s, nil 123} 124 125type Service struct { 126 client *http.Client 127 BasePath string // API endpoint base URL 128 UserAgent string // optional additional User-Agent fragment 129 130 Projects *ProjectsService 131} 132 133func (s *Service) userAgent() string { 134 if s.UserAgent == "" { 135 return googleapi.UserAgent 136 } 137 return googleapi.UserAgent + " " + s.UserAgent 138} 139 140func NewProjectsService(s *Service) *ProjectsService { 141 rs := &ProjectsService{s: s} 142 rs.Locations = NewProjectsLocationsService(s) 143 return rs 144} 145 146type ProjectsService struct { 147 s *Service 148 149 Locations *ProjectsLocationsService 150} 151 152func NewProjectsLocationsService(s *Service) *ProjectsLocationsService { 153 rs := &ProjectsLocationsService{s: s} 154 rs.Instances = NewProjectsLocationsInstancesService(s) 155 rs.Operations = NewProjectsLocationsOperationsService(s) 156 return rs 157} 158 159type ProjectsLocationsService struct { 160 s *Service 161 162 Instances *ProjectsLocationsInstancesService 163 164 Operations *ProjectsLocationsOperationsService 165} 166 167func NewProjectsLocationsInstancesService(s *Service) *ProjectsLocationsInstancesService { 168 rs := &ProjectsLocationsInstancesService{s: s} 169 return rs 170} 171 172type ProjectsLocationsInstancesService struct { 173 s *Service 174} 175 176func NewProjectsLocationsOperationsService(s *Service) *ProjectsLocationsOperationsService { 177 rs := &ProjectsLocationsOperationsService{s: s} 178 return rs 179} 180 181type ProjectsLocationsOperationsService struct { 182 s *Service 183} 184 185// Empty: A generic empty message that you can re-use to avoid defining 186// duplicated empty messages in your APIs. A typical example is to use 187// it as the request or the response type of an API method. For 188// instance: service Foo { rpc Bar(google.protobuf.Empty) returns 189// (google.protobuf.Empty); } The JSON representation for `Empty` is 190// empty JSON object `{}`. 191type Empty struct { 192 // ServerResponse contains the HTTP response code and headers from the 193 // server. 194 googleapi.ServerResponse `json:"-"` 195} 196 197// ExportInstanceRequest: Request for Export. 198type ExportInstanceRequest struct { 199 // OutputConfig: Required. Specify data to be exported. 200 OutputConfig *OutputConfig `json:"outputConfig,omitempty"` 201 202 // ForceSendFields is a list of field names (e.g. "OutputConfig") to 203 // unconditionally include in API requests. By default, fields with 204 // empty values are omitted from API requests. However, any non-pointer, 205 // non-interface field appearing in ForceSendFields will be sent to the 206 // server regardless of whether the field is empty or not. This may be 207 // used to include empty fields in Patch requests. 208 ForceSendFields []string `json:"-"` 209 210 // NullFields is a list of field names (e.g. "OutputConfig") to include 211 // in API requests with the JSON null value. By default, fields with 212 // empty values are omitted from API requests. However, any field with 213 // an empty value appearing in NullFields will be sent to the server as 214 // null. It is an error if a field in this list has a non-empty value. 215 // This may be used to include null fields in Patch requests. 216 NullFields []string `json:"-"` 217} 218 219func (s *ExportInstanceRequest) MarshalJSON() ([]byte, error) { 220 type NoMethod ExportInstanceRequest 221 raw := NoMethod(*s) 222 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 223} 224 225// FailoverInstanceRequest: Request for Failover. 226type FailoverInstanceRequest struct { 227 // DataProtectionMode: Optional. Available data protection modes that 228 // the user can choose. If it's unspecified, data protection mode will 229 // be LIMITED_DATA_LOSS by default. 230 // 231 // Possible values: 232 // "DATA_PROTECTION_MODE_UNSPECIFIED" - Defaults to LIMITED_DATA_LOSS 233 // if a data protection mode is not specified. 234 // "LIMITED_DATA_LOSS" - Instance failover will be protected with data 235 // loss control. More specifically, the failover will only be performed 236 // if the current replication offset diff between primary and replica is 237 // under a certain threshold. 238 // "FORCE_DATA_LOSS" - Instance failover will be performed without 239 // data loss control. 240 DataProtectionMode string `json:"dataProtectionMode,omitempty"` 241 242 // ForceSendFields is a list of field names (e.g. "DataProtectionMode") 243 // to unconditionally include in API requests. By default, fields with 244 // empty values are omitted from API requests. However, any non-pointer, 245 // non-interface field appearing in ForceSendFields will be sent to the 246 // server regardless of whether the field is empty or not. This may be 247 // used to include empty fields in Patch requests. 248 ForceSendFields []string `json:"-"` 249 250 // NullFields is a list of field names (e.g. "DataProtectionMode") to 251 // include in API requests with the JSON null value. By default, fields 252 // with empty values are omitted from API requests. However, any field 253 // with an empty value appearing in NullFields will be sent to the 254 // server as null. It is an error if a field in this list has a 255 // non-empty value. This may be used to include null fields in Patch 256 // requests. 257 NullFields []string `json:"-"` 258} 259 260func (s *FailoverInstanceRequest) MarshalJSON() ([]byte, error) { 261 type NoMethod FailoverInstanceRequest 262 raw := NoMethod(*s) 263 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 264} 265 266// GcsDestination: The Cloud Storage location for the output content 267type GcsDestination struct { 268 // Uri: Required. Data destination URI (e.g. 269 // 'gs://my_bucket/my_object'). Existing files will be overwritten. 270 Uri string `json:"uri,omitempty"` 271 272 // ForceSendFields is a list of field names (e.g. "Uri") to 273 // unconditionally include in API requests. By default, fields with 274 // empty values are omitted from API requests. However, any non-pointer, 275 // non-interface field appearing in ForceSendFields will be sent to the 276 // server regardless of whether the field is empty or not. This may be 277 // used to include empty fields in Patch requests. 278 ForceSendFields []string `json:"-"` 279 280 // NullFields is a list of field names (e.g. "Uri") to include in API 281 // requests with the JSON null value. By default, fields with empty 282 // values are omitted from API requests. However, any field with an 283 // empty value appearing in NullFields will be sent to the server as 284 // null. It is an error if a field in this list has a non-empty value. 285 // This may be used to include null fields in Patch requests. 286 NullFields []string `json:"-"` 287} 288 289func (s *GcsDestination) MarshalJSON() ([]byte, error) { 290 type NoMethod GcsDestination 291 raw := NoMethod(*s) 292 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 293} 294 295// GcsSource: The Cloud Storage location for the input content 296type GcsSource struct { 297 // Uri: Required. Source data URI. (e.g. 'gs://my_bucket/my_object'). 298 Uri string `json:"uri,omitempty"` 299 300 // ForceSendFields is a list of field names (e.g. "Uri") to 301 // unconditionally include in API requests. By default, fields with 302 // empty values are omitted from API requests. However, any non-pointer, 303 // non-interface field appearing in ForceSendFields will be sent to the 304 // server regardless of whether the field is empty or not. This may be 305 // used to include empty fields in Patch requests. 306 ForceSendFields []string `json:"-"` 307 308 // NullFields is a list of field names (e.g. "Uri") to include in API 309 // requests with the JSON null value. By default, fields with empty 310 // values are omitted from API requests. However, any field with an 311 // empty value appearing in NullFields will be sent to the server as 312 // null. It is an error if a field in this list has a non-empty value. 313 // This may be used to include null fields in Patch requests. 314 NullFields []string `json:"-"` 315} 316 317func (s *GcsSource) MarshalJSON() ([]byte, error) { 318 type NoMethod GcsSource 319 raw := NoMethod(*s) 320 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 321} 322 323// GoogleCloudRedisV1LocationMetadata: This location metadata represents 324// additional configuration options for a given location where a Redis 325// instance may be created. All fields are output only. It is returned 326// as content of the `google.cloud.location.Location.metadata` field. 327type GoogleCloudRedisV1LocationMetadata struct { 328 // AvailableZones: Output only. The set of available zones in the 329 // location. The map is keyed by the lowercase ID of each zone, as 330 // defined by GCE. These keys can be specified in `location_id` or 331 // `alternative_location_id` fields when creating a Redis instance. 332 AvailableZones map[string]GoogleCloudRedisV1ZoneMetadata `json:"availableZones,omitempty"` 333 334 // ForceSendFields is a list of field names (e.g. "AvailableZones") to 335 // unconditionally include in API requests. By default, fields with 336 // empty values are omitted from API requests. However, any non-pointer, 337 // non-interface field appearing in ForceSendFields will be sent to the 338 // server regardless of whether the field is empty or not. This may be 339 // used to include empty fields in Patch requests. 340 ForceSendFields []string `json:"-"` 341 342 // NullFields is a list of field names (e.g. "AvailableZones") to 343 // include in API requests with the JSON null value. By default, fields 344 // with empty values are omitted from API requests. However, any field 345 // with an empty value appearing in NullFields will be sent to the 346 // server as null. It is an error if a field in this list has a 347 // non-empty value. This may be used to include null fields in Patch 348 // requests. 349 NullFields []string `json:"-"` 350} 351 352func (s *GoogleCloudRedisV1LocationMetadata) MarshalJSON() ([]byte, error) { 353 type NoMethod GoogleCloudRedisV1LocationMetadata 354 raw := NoMethod(*s) 355 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 356} 357 358// GoogleCloudRedisV1OperationMetadata: Represents the v1 metadata of 359// the long-running operation. 360type GoogleCloudRedisV1OperationMetadata struct { 361 // ApiVersion: API version. 362 ApiVersion string `json:"apiVersion,omitempty"` 363 364 // CancelRequested: Specifies if cancellation was requested for the 365 // operation. 366 CancelRequested bool `json:"cancelRequested,omitempty"` 367 368 // CreateTime: Creation timestamp. 369 CreateTime string `json:"createTime,omitempty"` 370 371 // EndTime: End timestamp. 372 EndTime string `json:"endTime,omitempty"` 373 374 // StatusDetail: Operation status details. 375 StatusDetail string `json:"statusDetail,omitempty"` 376 377 // Target: Operation target. 378 Target string `json:"target,omitempty"` 379 380 // Verb: Operation verb. 381 Verb string `json:"verb,omitempty"` 382 383 // ForceSendFields is a list of field names (e.g. "ApiVersion") to 384 // unconditionally include in API requests. By default, fields with 385 // empty values are omitted from API requests. However, any non-pointer, 386 // non-interface field appearing in ForceSendFields will be sent to the 387 // server regardless of whether the field is empty or not. This may be 388 // used to include empty fields in Patch requests. 389 ForceSendFields []string `json:"-"` 390 391 // NullFields is a list of field names (e.g. "ApiVersion") to include in 392 // API requests with the JSON null value. By default, fields with empty 393 // values are omitted from API requests. However, any field with an 394 // empty value appearing in NullFields will be sent to the server as 395 // null. It is an error if a field in this list has a non-empty value. 396 // This may be used to include null fields in Patch requests. 397 NullFields []string `json:"-"` 398} 399 400func (s *GoogleCloudRedisV1OperationMetadata) MarshalJSON() ([]byte, error) { 401 type NoMethod GoogleCloudRedisV1OperationMetadata 402 raw := NoMethod(*s) 403 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 404} 405 406// GoogleCloudRedisV1ZoneMetadata: Defines specific information for a 407// particular zone. Currently empty and reserved for future use only. 408type GoogleCloudRedisV1ZoneMetadata struct { 409} 410 411// ImportInstanceRequest: Request for Import. 412type ImportInstanceRequest struct { 413 // InputConfig: Required. Specify data to be imported. 414 InputConfig *InputConfig `json:"inputConfig,omitempty"` 415 416 // ForceSendFields is a list of field names (e.g. "InputConfig") to 417 // unconditionally include in API requests. By default, fields with 418 // empty values are omitted from API requests. However, any non-pointer, 419 // non-interface field appearing in ForceSendFields will be sent to the 420 // server regardless of whether the field is empty or not. This may be 421 // used to include empty fields in Patch requests. 422 ForceSendFields []string `json:"-"` 423 424 // NullFields is a list of field names (e.g. "InputConfig") to include 425 // in API requests with the JSON null value. By default, fields with 426 // empty values are omitted from API requests. However, any field with 427 // an empty value appearing in NullFields will be sent to the server as 428 // null. It is an error if a field in this list has a non-empty value. 429 // This may be used to include null fields in Patch requests. 430 NullFields []string `json:"-"` 431} 432 433func (s *ImportInstanceRequest) MarshalJSON() ([]byte, error) { 434 type NoMethod ImportInstanceRequest 435 raw := NoMethod(*s) 436 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 437} 438 439// InputConfig: The input content 440type InputConfig struct { 441 // GcsSource: Google Cloud Storage location where input content is 442 // located. 443 GcsSource *GcsSource `json:"gcsSource,omitempty"` 444 445 // ForceSendFields is a list of field names (e.g. "GcsSource") to 446 // unconditionally include in API requests. By default, fields with 447 // empty values are omitted from API requests. However, any non-pointer, 448 // non-interface field appearing in ForceSendFields will be sent to the 449 // server regardless of whether the field is empty or not. This may be 450 // used to include empty fields in Patch requests. 451 ForceSendFields []string `json:"-"` 452 453 // NullFields is a list of field names (e.g. "GcsSource") 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 462func (s *InputConfig) MarshalJSON() ([]byte, error) { 463 type NoMethod InputConfig 464 raw := NoMethod(*s) 465 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 466} 467 468// Instance: A Google Cloud Redis instance. 469type Instance struct { 470 // AlternativeLocationId: Optional. Only applicable to STANDARD_HA tier 471 // which protects the instance against zonal failures by provisioning it 472 // across two zones. If provided, it must be a different zone from the 473 // one provided in location_id. 474 AlternativeLocationId string `json:"alternativeLocationId,omitempty"` 475 476 // AuthEnabled: Optional. Indicates whether OSS Redis AUTH is enabled 477 // for the instance. If set to "true" AUTH is enabled on the instance. 478 // Default value is "false" meaning AUTH is disabled. 479 AuthEnabled bool `json:"authEnabled,omitempty"` 480 481 // AuthorizedNetwork: Optional. The full name of the Google Compute 482 // Engine network (https://cloud.google.com/vpc/docs/vpc) to which the 483 // instance is connected. If left unspecified, the `default` network 484 // will be used. 485 AuthorizedNetwork string `json:"authorizedNetwork,omitempty"` 486 487 // ConnectMode: Optional. The network connect mode of the Redis 488 // instance. If not provided, the connect mode defaults to 489 // DIRECT_PEERING. 490 // 491 // Possible values: 492 // "CONNECT_MODE_UNSPECIFIED" - Not set. 493 // "DIRECT_PEERING" - Connect via direct peering to the Memorystore 494 // for Redis hosted service. 495 // "PRIVATE_SERVICE_ACCESS" - Connect your Memorystore for Redis 496 // instance using Private Service Access. Private services access 497 // provides an IP address range for multiple Google Cloud services, 498 // including Memorystore. 499 ConnectMode string `json:"connectMode,omitempty"` 500 501 // CreateTime: Output only. The time the instance was created. 502 CreateTime string `json:"createTime,omitempty"` 503 504 // CurrentLocationId: Output only. The current zone where the Redis 505 // endpoint is placed. For Basic Tier instances, this will always be the 506 // same as the location_id provided by the user at creation time. For 507 // Standard Tier instances, this can be either location_id or 508 // alternative_location_id and can change after a failover event. 509 CurrentLocationId string `json:"currentLocationId,omitempty"` 510 511 // DisplayName: An arbitrary and optional user-provided name for the 512 // instance. 513 DisplayName string `json:"displayName,omitempty"` 514 515 // Host: Output only. Hostname or IP address of the exposed Redis 516 // endpoint used by clients to connect to the service. 517 Host string `json:"host,omitempty"` 518 519 // Labels: Resource labels to represent user provided metadata 520 Labels map[string]string `json:"labels,omitempty"` 521 522 // LocationId: Optional. The zone where the instance will be 523 // provisioned. If not provided, the service will choose a zone for the 524 // instance. For STANDARD_HA tier, instances will be created across two 525 // zones for protection against zonal failures. If 526 // alternative_location_id is also provided, it must be different from 527 // location_id. 528 LocationId string `json:"locationId,omitempty"` 529 530 // MemorySizeGb: Required. Redis memory size in GiB. 531 MemorySizeGb int64 `json:"memorySizeGb,omitempty"` 532 533 // Name: Required. Unique name of the resource in this scope including 534 // project and location using the form: 535 // `projects/{project_id}/locations/{location_id}/instances/{instance_id} 536 // ` Note: Redis instances are managed and addressed at regional level 537 // so location_id here refers to a GCP region; however, users may choose 538 // which specific zone (or collection of zones for cross-zone instances) 539 // an instance should be provisioned in. Refer to location_id and 540 // alternative_location_id fields for more details. 541 Name string `json:"name,omitempty"` 542 543 // PersistenceIamIdentity: Output only. Cloud IAM identity used by 544 // import / export operations to transfer data to/from Cloud Storage. 545 // Format is "serviceAccount:". The value may change over time for a 546 // given instance so should be checked before each import/export 547 // operation. 548 PersistenceIamIdentity string `json:"persistenceIamIdentity,omitempty"` 549 550 // Port: Output only. The port number of the exposed Redis endpoint. 551 Port int64 `json:"port,omitempty"` 552 553 // RedisConfigs: Optional. Redis configuration parameters, according to 554 // http://redis.io/topics/config. Currently, the only supported 555 // parameters are: Redis version 3.2 and newer: * maxmemory-policy * 556 // notify-keyspace-events Redis version 4.0 and newer: * activedefrag * 557 // lfu-decay-time * lfu-log-factor * maxmemory-gb Redis version 5.0 and 558 // newer: * stream-node-max-bytes * stream-node-max-entries 559 RedisConfigs map[string]string `json:"redisConfigs,omitempty"` 560 561 // RedisVersion: Optional. The version of Redis software. If not 562 // provided, latest supported version will be used. Currently, the 563 // supported values are: * `REDIS_3_2` for Redis 3.2 compatibility * 564 // `REDIS_4_0` for Redis 4.0 compatibility (default) * `REDIS_5_0` for 565 // Redis 5.0 compatibility * `REDIS_6_X` for Redis 6.x compatibility 566 RedisVersion string `json:"redisVersion,omitempty"` 567 568 // ReservedIpRange: Optional. For DIRECT_PEERING mode, the CIDR range of 569 // internal addresses that are reserved for this instance. Range must be 570 // unique and non-overlapping with existing subnets in an authorized 571 // network. For PRIVATE_SERVICE_ACCESS mode, the name of one allocated 572 // IP address ranges associated with this private service access 573 // connection. If not provided, the service will choose an unused /29 574 // block, for example, 10.0.0.0/29 or 192.168.0.0/29. 575 ReservedIpRange string `json:"reservedIpRange,omitempty"` 576 577 // ServerCaCerts: Output only. List of server CA certificates for the 578 // instance. 579 ServerCaCerts []*TlsCertificate `json:"serverCaCerts,omitempty"` 580 581 // State: Output only. The current state of this instance. 582 // 583 // Possible values: 584 // "STATE_UNSPECIFIED" - Not set. 585 // "CREATING" - Redis instance is being created. 586 // "READY" - Redis instance has been created and is fully usable. 587 // "UPDATING" - Redis instance configuration is being updated. Certain 588 // kinds of updates may cause the instance to become unusable while the 589 // update is in progress. 590 // "DELETING" - Redis instance is being deleted. 591 // "REPAIRING" - Redis instance is being repaired and may be unusable. 592 // "MAINTENANCE" - Maintenance is being performed on this Redis 593 // instance. 594 // "IMPORTING" - Redis instance is importing data (availability may be 595 // affected). 596 // "FAILING_OVER" - Redis instance is failing over (availability may 597 // be affected). 598 State string `json:"state,omitempty"` 599 600 // StatusMessage: Output only. Additional information about the current 601 // status of this instance, if available. 602 StatusMessage string `json:"statusMessage,omitempty"` 603 604 // Tier: Required. The service tier of the instance. 605 // 606 // Possible values: 607 // "TIER_UNSPECIFIED" - Not set. 608 // "BASIC" - BASIC tier: standalone instance 609 // "STANDARD_HA" - STANDARD_HA tier: highly available primary/replica 610 // instances 611 Tier string `json:"tier,omitempty"` 612 613 // TransitEncryptionMode: Optional. The TLS mode of the Redis instance. 614 // If not provided, TLS is disabled for the instance. 615 // 616 // Possible values: 617 // "TRANSIT_ENCRYPTION_MODE_UNSPECIFIED" - Not set. 618 // "SERVER_AUTHENTICATION" - Client to Server traffic encryption 619 // enabled with server authentication. 620 // "DISABLED" - TLS is disabled for the instance. 621 TransitEncryptionMode string `json:"transitEncryptionMode,omitempty"` 622 623 // ServerResponse contains the HTTP response code and headers from the 624 // server. 625 googleapi.ServerResponse `json:"-"` 626 627 // ForceSendFields is a list of field names (e.g. 628 // "AlternativeLocationId") to unconditionally include in API requests. 629 // By default, fields with empty values are omitted from API requests. 630 // However, any non-pointer, non-interface field appearing in 631 // ForceSendFields will be sent to the server regardless of whether the 632 // field is empty or not. This may be used to include empty fields in 633 // Patch requests. 634 ForceSendFields []string `json:"-"` 635 636 // NullFields is a list of field names (e.g. "AlternativeLocationId") to 637 // include in API requests with the JSON null value. By default, fields 638 // with empty values are omitted from API requests. However, any field 639 // with an empty value appearing in NullFields will be sent to the 640 // server as null. It is an error if a field in this list has a 641 // non-empty value. This may be used to include null fields in Patch 642 // requests. 643 NullFields []string `json:"-"` 644} 645 646func (s *Instance) MarshalJSON() ([]byte, error) { 647 type NoMethod Instance 648 raw := NoMethod(*s) 649 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 650} 651 652// InstanceAuthString: Instance AUTH string details. 653type InstanceAuthString struct { 654 // AuthString: AUTH string set on the instance. 655 AuthString string `json:"authString,omitempty"` 656 657 // ServerResponse contains the HTTP response code and headers from the 658 // server. 659 googleapi.ServerResponse `json:"-"` 660 661 // ForceSendFields is a list of field names (e.g. "AuthString") to 662 // unconditionally include in API requests. By default, fields with 663 // empty values are omitted from API requests. However, any non-pointer, 664 // non-interface field appearing in ForceSendFields will be sent to the 665 // server regardless of whether the field is empty or not. This may be 666 // used to include empty fields in Patch requests. 667 ForceSendFields []string `json:"-"` 668 669 // NullFields is a list of field names (e.g. "AuthString") to include in 670 // API requests with the JSON null value. By default, fields with empty 671 // values are omitted from API requests. However, any field with an 672 // empty value appearing in NullFields will be sent to the server as 673 // null. It is an error if a field in this list has a non-empty value. 674 // This may be used to include null fields in Patch requests. 675 NullFields []string `json:"-"` 676} 677 678func (s *InstanceAuthString) MarshalJSON() ([]byte, error) { 679 type NoMethod InstanceAuthString 680 raw := NoMethod(*s) 681 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 682} 683 684// ListInstancesResponse: Response for ListInstances. 685type ListInstancesResponse struct { 686 // Instances: A list of Redis instances in the project in the specified 687 // location, or across all locations. If the `location_id` in the parent 688 // field of the request is "-", all regions available to the project are 689 // queried, and the results aggregated. If in such an aggregated query a 690 // location is unavailable, a placeholder Redis entry is included in the 691 // response with the `name` field set to a value of the form 692 // `projects/{project_id}/locations/{location_id}/instances/`- and the 693 // `status` field set to ERROR and `status_message` field set to 694 // "location not available for ListInstances". 695 Instances []*Instance `json:"instances,omitempty"` 696 697 // NextPageToken: Token to retrieve the next page of results, or empty 698 // if there are no more results in the list. 699 NextPageToken string `json:"nextPageToken,omitempty"` 700 701 // Unreachable: Locations that could not be reached. 702 Unreachable []string `json:"unreachable,omitempty"` 703 704 // ServerResponse contains the HTTP response code and headers from the 705 // server. 706 googleapi.ServerResponse `json:"-"` 707 708 // ForceSendFields is a list of field names (e.g. "Instances") to 709 // unconditionally include in API requests. By default, fields with 710 // empty values are omitted from API requests. However, any non-pointer, 711 // non-interface field appearing in ForceSendFields will be sent to the 712 // server regardless of whether the field is empty or not. This may be 713 // used to include empty fields in Patch requests. 714 ForceSendFields []string `json:"-"` 715 716 // NullFields is a list of field names (e.g. "Instances") to include in 717 // API requests with the JSON null value. By default, fields with empty 718 // values are omitted from API requests. However, any field with an 719 // empty value appearing in NullFields will be sent to the server as 720 // null. It is an error if a field in this list has a non-empty value. 721 // This may be used to include null fields in Patch requests. 722 NullFields []string `json:"-"` 723} 724 725func (s *ListInstancesResponse) MarshalJSON() ([]byte, error) { 726 type NoMethod ListInstancesResponse 727 raw := NoMethod(*s) 728 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 729} 730 731// ListLocationsResponse: The response message for 732// Locations.ListLocations. 733type ListLocationsResponse struct { 734 // Locations: A list of locations that matches the specified filter in 735 // the request. 736 Locations []*Location `json:"locations,omitempty"` 737 738 // NextPageToken: The standard List next-page token. 739 NextPageToken string `json:"nextPageToken,omitempty"` 740 741 // ServerResponse contains the HTTP response code and headers from the 742 // server. 743 googleapi.ServerResponse `json:"-"` 744 745 // ForceSendFields is a list of field names (e.g. "Locations") 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 753 // NullFields is a list of field names (e.g. "Locations") to include in 754 // API requests with the JSON null value. By default, fields with empty 755 // values are omitted from API requests. However, any field with an 756 // empty value appearing in NullFields will be sent to the server as 757 // null. It is an error if a field in this list has a non-empty value. 758 // This may be used to include null fields in Patch requests. 759 NullFields []string `json:"-"` 760} 761 762func (s *ListLocationsResponse) MarshalJSON() ([]byte, error) { 763 type NoMethod ListLocationsResponse 764 raw := NoMethod(*s) 765 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 766} 767 768// ListOperationsResponse: The response message for 769// Operations.ListOperations. 770type ListOperationsResponse struct { 771 // NextPageToken: The standard List next-page token. 772 NextPageToken string `json:"nextPageToken,omitempty"` 773 774 // Operations: A list of operations that matches the specified filter in 775 // the request. 776 Operations []*Operation `json:"operations,omitempty"` 777 778 // ServerResponse contains the HTTP response code and headers from the 779 // server. 780 googleapi.ServerResponse `json:"-"` 781 782 // ForceSendFields is a list of field names (e.g. "NextPageToken") to 783 // unconditionally include in API requests. By default, fields with 784 // empty values are omitted from API requests. However, any non-pointer, 785 // non-interface field appearing in ForceSendFields will be sent to the 786 // server regardless of whether the field is empty or not. This may be 787 // used to include empty fields in Patch requests. 788 ForceSendFields []string `json:"-"` 789 790 // NullFields is a list of field names (e.g. "NextPageToken") to include 791 // in API requests with the JSON null value. By default, fields with 792 // empty values are omitted from API requests. However, any field with 793 // an empty value appearing in NullFields will be sent to the server as 794 // null. It is an error if a field in this list has a non-empty value. 795 // This may be used to include null fields in Patch requests. 796 NullFields []string `json:"-"` 797} 798 799func (s *ListOperationsResponse) MarshalJSON() ([]byte, error) { 800 type NoMethod ListOperationsResponse 801 raw := NoMethod(*s) 802 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 803} 804 805// Location: A resource that represents Google Cloud Platform location. 806type Location struct { 807 // DisplayName: The friendly name for this location, typically a nearby 808 // city name. For example, "Tokyo". 809 DisplayName string `json:"displayName,omitempty"` 810 811 // Labels: Cross-service attributes for the location. For example 812 // {"cloud.googleapis.com/region": "us-east1"} 813 Labels map[string]string `json:"labels,omitempty"` 814 815 // LocationId: Resource ID for the region. For example: "us-east1". 816 LocationId string `json:"locationId,omitempty"` 817 818 // Metadata: Output only. The set of available zones in the location. 819 // The map is keyed by the lowercase ID of each zone, as defined by 820 // Compute Engine. These keys can be specified in `location_id` or 821 // `alternative_location_id` fields when creating a Redis instance. 822 Metadata googleapi.RawMessage `json:"metadata,omitempty"` 823 824 // Name: Full resource name for the region. For example: 825 // "projects/example-project/locations/us-east1". 826 Name string `json:"name,omitempty"` 827 828 // ServerResponse contains the HTTP response code and headers from the 829 // server. 830 googleapi.ServerResponse `json:"-"` 831 832 // ForceSendFields is a list of field names (e.g. "DisplayName") to 833 // unconditionally include in API requests. By default, fields with 834 // empty values are omitted from API requests. However, any non-pointer, 835 // non-interface field appearing in ForceSendFields will be sent to the 836 // server regardless of whether the field is empty or not. This may be 837 // used to include empty fields in Patch requests. 838 ForceSendFields []string `json:"-"` 839 840 // NullFields is a list of field names (e.g. "DisplayName") to include 841 // in API requests with the JSON null value. By default, fields with 842 // empty values are omitted from API requests. However, any field with 843 // an empty value appearing in NullFields will be sent to the server as 844 // null. It is an error if a field in this list has a non-empty value. 845 // This may be used to include null fields in Patch requests. 846 NullFields []string `json:"-"` 847} 848 849func (s *Location) MarshalJSON() ([]byte, error) { 850 type NoMethod Location 851 raw := NoMethod(*s) 852 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 853} 854 855// Operation: This resource represents a long-running operation that is 856// the result of a network API call. 857type Operation struct { 858 // Done: If the value is `false`, it means the operation is still in 859 // progress. If `true`, the operation is completed, and either `error` 860 // or `response` is available. 861 Done bool `json:"done,omitempty"` 862 863 // Error: The error result of the operation in case of failure or 864 // cancellation. 865 Error *Status `json:"error,omitempty"` 866 867 // Metadata: { `createTime`: The time the operation was created. 868 // `endTime`: The time the operation finished running. `target`: 869 // Server-defined resource path for the target of the operation. `verb`: 870 // Name of the verb executed by the operation. `statusDetail`: 871 // Human-readable status of the operation, if any. `cancelRequested`: 872 // Identifies whether the user has requested cancellation of the 873 // operation. Operations that have successfully been cancelled have 874 // Operation.error value with a google.rpc.Status.code of 1, 875 // corresponding to `Code.CANCELLED`. `apiVersion`: API version used to 876 // start the operation. } 877 Metadata googleapi.RawMessage `json:"metadata,omitempty"` 878 879 // Name: The server-assigned name, which is only unique within the same 880 // service that originally returns it. If you use the default HTTP 881 // mapping, the `name` should be a resource name ending with 882 // `operations/{unique_id}`. 883 Name string `json:"name,omitempty"` 884 885 // Response: The normal response of the operation in case of success. If 886 // the original method returns no data on success, such as `Delete`, the 887 // response is `google.protobuf.Empty`. If the original method is 888 // standard `Get`/`Create`/`Update`, the response should be the 889 // resource. For other methods, the response should have the type 890 // `XxxResponse`, where `Xxx` is the original method name. For example, 891 // if the original method name is `TakeSnapshot()`, the inferred 892 // response type is `TakeSnapshotResponse`. 893 Response googleapi.RawMessage `json:"response,omitempty"` 894 895 // ServerResponse contains the HTTP response code and headers from the 896 // server. 897 googleapi.ServerResponse `json:"-"` 898 899 // ForceSendFields is a list of field names (e.g. "Done") to 900 // unconditionally include in API requests. By default, fields with 901 // empty values are omitted from API requests. However, any non-pointer, 902 // non-interface field appearing in ForceSendFields will be sent to the 903 // server regardless of whether the field is empty or not. This may be 904 // used to include empty fields in Patch requests. 905 ForceSendFields []string `json:"-"` 906 907 // NullFields is a list of field names (e.g. "Done") to include in API 908 // requests with the JSON null value. By default, fields with empty 909 // values are omitted from API requests. However, any field with an 910 // empty value appearing in NullFields will be sent to the server as 911 // null. It is an error if a field in this list has a non-empty value. 912 // This may be used to include null fields in Patch requests. 913 NullFields []string `json:"-"` 914} 915 916func (s *Operation) MarshalJSON() ([]byte, error) { 917 type NoMethod Operation 918 raw := NoMethod(*s) 919 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 920} 921 922// OutputConfig: The output content 923type OutputConfig struct { 924 // GcsDestination: Google Cloud Storage destination for output content. 925 GcsDestination *GcsDestination `json:"gcsDestination,omitempty"` 926 927 // ForceSendFields is a list of field names (e.g. "GcsDestination") to 928 // unconditionally include in API requests. By default, fields with 929 // empty values are omitted from API requests. However, any non-pointer, 930 // non-interface field appearing in ForceSendFields will be sent to the 931 // server regardless of whether the field is empty or not. This may be 932 // used to include empty fields in Patch requests. 933 ForceSendFields []string `json:"-"` 934 935 // NullFields is a list of field names (e.g. "GcsDestination") to 936 // include in API requests with the JSON null value. By default, fields 937 // with empty values are omitted from API requests. However, any field 938 // with an empty value appearing in NullFields will be sent to the 939 // server as null. It is an error if a field in this list has a 940 // non-empty value. This may be used to include null fields in Patch 941 // requests. 942 NullFields []string `json:"-"` 943} 944 945func (s *OutputConfig) MarshalJSON() ([]byte, error) { 946 type NoMethod OutputConfig 947 raw := NoMethod(*s) 948 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 949} 950 951// Status: The `Status` type defines a logical error model that is 952// suitable for different programming environments, including REST APIs 953// and RPC APIs. It is used by gRPC (https://github.com/grpc). Each 954// `Status` message contains three pieces of data: error code, error 955// message, and error details. You can find out more about this error 956// model and how to work with it in the API Design Guide 957// (https://cloud.google.com/apis/design/errors). 958type Status struct { 959 // Code: The status code, which should be an enum value of 960 // google.rpc.Code. 961 Code int64 `json:"code,omitempty"` 962 963 // Details: A list of messages that carry the error details. There is a 964 // common set of message types for APIs to use. 965 Details []googleapi.RawMessage `json:"details,omitempty"` 966 967 // Message: A developer-facing error message, which should be in 968 // English. Any user-facing error message should be localized and sent 969 // in the google.rpc.Status.details field, or localized by the client. 970 Message string `json:"message,omitempty"` 971 972 // ForceSendFields is a list of field names (e.g. "Code") to 973 // unconditionally include in API requests. By default, fields with 974 // empty values are omitted from API requests. However, any non-pointer, 975 // non-interface field appearing in ForceSendFields will be sent to the 976 // server regardless of whether the field is empty or not. This may be 977 // used to include empty fields in Patch requests. 978 ForceSendFields []string `json:"-"` 979 980 // NullFields is a list of field names (e.g. "Code") to include in API 981 // requests with the JSON null value. By default, fields with empty 982 // values are omitted from API requests. However, any field with an 983 // empty value appearing in NullFields will be sent to the server as 984 // null. It is an error if a field in this list has a non-empty value. 985 // This may be used to include null fields in Patch requests. 986 NullFields []string `json:"-"` 987} 988 989func (s *Status) MarshalJSON() ([]byte, error) { 990 type NoMethod Status 991 raw := NoMethod(*s) 992 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 993} 994 995// TlsCertificate: TlsCertificate Resource 996type TlsCertificate struct { 997 // Cert: PEM representation. 998 Cert string `json:"cert,omitempty"` 999 1000 // CreateTime: Output only. The time when the certificate was created in 1001 // RFC 3339 (https://tools.ietf.org/html/rfc3339) format, for example 1002 // `2020-05-18T00:00:00.094Z`. 1003 CreateTime string `json:"createTime,omitempty"` 1004 1005 // ExpireTime: Output only. The time when the certificate expires in RFC 1006 // 3339 (https://tools.ietf.org/html/rfc3339) format, for example 1007 // `2020-05-18T00:00:00.094Z`. 1008 ExpireTime string `json:"expireTime,omitempty"` 1009 1010 // SerialNumber: Serial number, as extracted from the certificate. 1011 SerialNumber string `json:"serialNumber,omitempty"` 1012 1013 // Sha1Fingerprint: Sha1 Fingerprint of the certificate. 1014 Sha1Fingerprint string `json:"sha1Fingerprint,omitempty"` 1015 1016 // ForceSendFields is a list of field names (e.g. "Cert") to 1017 // unconditionally include in API requests. By default, fields with 1018 // empty values are omitted from API requests. However, any non-pointer, 1019 // non-interface field appearing in ForceSendFields will be sent to the 1020 // server regardless of whether the field is empty or not. This may be 1021 // used to include empty fields in Patch requests. 1022 ForceSendFields []string `json:"-"` 1023 1024 // NullFields is a list of field names (e.g. "Cert") to include in API 1025 // requests with the JSON null value. By default, fields with empty 1026 // values are omitted from API requests. However, any field with an 1027 // empty value appearing in NullFields will be sent to the server as 1028 // null. It is an error if a field in this list has a non-empty value. 1029 // This may be used to include null fields in Patch requests. 1030 NullFields []string `json:"-"` 1031} 1032 1033func (s *TlsCertificate) MarshalJSON() ([]byte, error) { 1034 type NoMethod TlsCertificate 1035 raw := NoMethod(*s) 1036 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1037} 1038 1039// UpgradeInstanceRequest: Request for UpgradeInstance. 1040type UpgradeInstanceRequest struct { 1041 // RedisVersion: Required. Specifies the target version of Redis 1042 // software to upgrade to. 1043 RedisVersion string `json:"redisVersion,omitempty"` 1044 1045 // ForceSendFields is a list of field names (e.g. "RedisVersion") to 1046 // unconditionally include in API requests. By default, fields with 1047 // empty values are omitted from API requests. However, any non-pointer, 1048 // non-interface field appearing in ForceSendFields will be sent to the 1049 // server regardless of whether the field is empty or not. This may be 1050 // used to include empty fields in Patch requests. 1051 ForceSendFields []string `json:"-"` 1052 1053 // NullFields is a list of field names (e.g. "RedisVersion") to include 1054 // in API requests with the JSON null value. By default, fields with 1055 // empty values are omitted from API requests. However, any field with 1056 // an empty value appearing in NullFields will be sent to the server as 1057 // null. It is an error if a field in this list has a non-empty value. 1058 // This may be used to include null fields in Patch requests. 1059 NullFields []string `json:"-"` 1060} 1061 1062func (s *UpgradeInstanceRequest) MarshalJSON() ([]byte, error) { 1063 type NoMethod UpgradeInstanceRequest 1064 raw := NoMethod(*s) 1065 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1066} 1067 1068// method id "redis.projects.locations.get": 1069 1070type ProjectsLocationsGetCall struct { 1071 s *Service 1072 name string 1073 urlParams_ gensupport.URLParams 1074 ifNoneMatch_ string 1075 ctx_ context.Context 1076 header_ http.Header 1077} 1078 1079// Get: Gets information about a location. 1080// 1081// - name: Resource name for the location. 1082func (r *ProjectsLocationsService) Get(name string) *ProjectsLocationsGetCall { 1083 c := &ProjectsLocationsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1084 c.name = name 1085 return c 1086} 1087 1088// Fields allows partial responses to be retrieved. See 1089// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1090// for more information. 1091func (c *ProjectsLocationsGetCall) Fields(s ...googleapi.Field) *ProjectsLocationsGetCall { 1092 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1093 return c 1094} 1095 1096// IfNoneMatch sets the optional parameter which makes the operation 1097// fail if the object's ETag matches the given value. This is useful for 1098// getting updates only after the object has changed since the last 1099// request. Use googleapi.IsNotModified to check whether the response 1100// error from Do is the result of In-None-Match. 1101func (c *ProjectsLocationsGetCall) IfNoneMatch(entityTag string) *ProjectsLocationsGetCall { 1102 c.ifNoneMatch_ = entityTag 1103 return c 1104} 1105 1106// Context sets the context to be used in this call's Do method. Any 1107// pending HTTP request will be aborted if the provided context is 1108// canceled. 1109func (c *ProjectsLocationsGetCall) Context(ctx context.Context) *ProjectsLocationsGetCall { 1110 c.ctx_ = ctx 1111 return c 1112} 1113 1114// Header returns an http.Header that can be modified by the caller to 1115// add HTTP headers to the request. 1116func (c *ProjectsLocationsGetCall) Header() http.Header { 1117 if c.header_ == nil { 1118 c.header_ = make(http.Header) 1119 } 1120 return c.header_ 1121} 1122 1123func (c *ProjectsLocationsGetCall) doRequest(alt string) (*http.Response, error) { 1124 reqHeaders := make(http.Header) 1125 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210502") 1126 for k, v := range c.header_ { 1127 reqHeaders[k] = v 1128 } 1129 reqHeaders.Set("User-Agent", c.s.userAgent()) 1130 if c.ifNoneMatch_ != "" { 1131 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 1132 } 1133 var body io.Reader = nil 1134 c.urlParams_.Set("alt", alt) 1135 c.urlParams_.Set("prettyPrint", "false") 1136 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}") 1137 urls += "?" + c.urlParams_.Encode() 1138 req, err := http.NewRequest("GET", urls, body) 1139 if err != nil { 1140 return nil, err 1141 } 1142 req.Header = reqHeaders 1143 googleapi.Expand(req.URL, map[string]string{ 1144 "name": c.name, 1145 }) 1146 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1147} 1148 1149// Do executes the "redis.projects.locations.get" call. 1150// Exactly one of *Location or error will be non-nil. Any non-2xx status 1151// code is an error. Response headers are in either 1152// *Location.ServerResponse.Header or (if a response was returned at 1153// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 1154// to check whether the returned error was because 1155// http.StatusNotModified was returned. 1156func (c *ProjectsLocationsGetCall) Do(opts ...googleapi.CallOption) (*Location, error) { 1157 gensupport.SetOptions(c.urlParams_, opts...) 1158 res, err := c.doRequest("json") 1159 if res != nil && res.StatusCode == http.StatusNotModified { 1160 if res.Body != nil { 1161 res.Body.Close() 1162 } 1163 return nil, &googleapi.Error{ 1164 Code: res.StatusCode, 1165 Header: res.Header, 1166 } 1167 } 1168 if err != nil { 1169 return nil, err 1170 } 1171 defer googleapi.CloseBody(res) 1172 if err := googleapi.CheckResponse(res); err != nil { 1173 return nil, err 1174 } 1175 ret := &Location{ 1176 ServerResponse: googleapi.ServerResponse{ 1177 Header: res.Header, 1178 HTTPStatusCode: res.StatusCode, 1179 }, 1180 } 1181 target := &ret 1182 if err := gensupport.DecodeResponse(target, res); err != nil { 1183 return nil, err 1184 } 1185 return ret, nil 1186 // { 1187 // "description": "Gets information about a location.", 1188 // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}", 1189 // "httpMethod": "GET", 1190 // "id": "redis.projects.locations.get", 1191 // "parameterOrder": [ 1192 // "name" 1193 // ], 1194 // "parameters": { 1195 // "name": { 1196 // "description": "Resource name for the location.", 1197 // "location": "path", 1198 // "pattern": "^projects/[^/]+/locations/[^/]+$", 1199 // "required": true, 1200 // "type": "string" 1201 // } 1202 // }, 1203 // "path": "v1/{+name}", 1204 // "response": { 1205 // "$ref": "Location" 1206 // }, 1207 // "scopes": [ 1208 // "https://www.googleapis.com/auth/cloud-platform" 1209 // ] 1210 // } 1211 1212} 1213 1214// method id "redis.projects.locations.list": 1215 1216type ProjectsLocationsListCall struct { 1217 s *Service 1218 name string 1219 urlParams_ gensupport.URLParams 1220 ifNoneMatch_ string 1221 ctx_ context.Context 1222 header_ http.Header 1223} 1224 1225// List: Lists information about the supported locations for this 1226// service. 1227// 1228// - name: The resource that owns the locations collection, if 1229// applicable. 1230func (r *ProjectsLocationsService) List(name string) *ProjectsLocationsListCall { 1231 c := &ProjectsLocationsListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1232 c.name = name 1233 return c 1234} 1235 1236// Filter sets the optional parameter "filter": A filter to narrow down 1237// results to a preferred subset. The filtering language accepts strings 1238// like "displayName=tokyo", and is documented in more detail in AIP-160 1239// (https://google.aip.dev/160). 1240func (c *ProjectsLocationsListCall) Filter(filter string) *ProjectsLocationsListCall { 1241 c.urlParams_.Set("filter", filter) 1242 return c 1243} 1244 1245// PageSize sets the optional parameter "pageSize": The maximum number 1246// of results to return. If not set, the service selects a default. 1247func (c *ProjectsLocationsListCall) PageSize(pageSize int64) *ProjectsLocationsListCall { 1248 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 1249 return c 1250} 1251 1252// PageToken sets the optional parameter "pageToken": A page token 1253// received from the `next_page_token` field in the response. Send that 1254// page token to receive the subsequent page. 1255func (c *ProjectsLocationsListCall) PageToken(pageToken string) *ProjectsLocationsListCall { 1256 c.urlParams_.Set("pageToken", pageToken) 1257 return c 1258} 1259 1260// Fields allows partial responses to be retrieved. See 1261// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1262// for more information. 1263func (c *ProjectsLocationsListCall) Fields(s ...googleapi.Field) *ProjectsLocationsListCall { 1264 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1265 return c 1266} 1267 1268// IfNoneMatch sets the optional parameter which makes the operation 1269// fail if the object's ETag matches the given value. This is useful for 1270// getting updates only after the object has changed since the last 1271// request. Use googleapi.IsNotModified to check whether the response 1272// error from Do is the result of In-None-Match. 1273func (c *ProjectsLocationsListCall) IfNoneMatch(entityTag string) *ProjectsLocationsListCall { 1274 c.ifNoneMatch_ = entityTag 1275 return c 1276} 1277 1278// Context sets the context to be used in this call's Do method. Any 1279// pending HTTP request will be aborted if the provided context is 1280// canceled. 1281func (c *ProjectsLocationsListCall) Context(ctx context.Context) *ProjectsLocationsListCall { 1282 c.ctx_ = ctx 1283 return c 1284} 1285 1286// Header returns an http.Header that can be modified by the caller to 1287// add HTTP headers to the request. 1288func (c *ProjectsLocationsListCall) Header() http.Header { 1289 if c.header_ == nil { 1290 c.header_ = make(http.Header) 1291 } 1292 return c.header_ 1293} 1294 1295func (c *ProjectsLocationsListCall) doRequest(alt string) (*http.Response, error) { 1296 reqHeaders := make(http.Header) 1297 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210502") 1298 for k, v := range c.header_ { 1299 reqHeaders[k] = v 1300 } 1301 reqHeaders.Set("User-Agent", c.s.userAgent()) 1302 if c.ifNoneMatch_ != "" { 1303 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 1304 } 1305 var body io.Reader = nil 1306 c.urlParams_.Set("alt", alt) 1307 c.urlParams_.Set("prettyPrint", "false") 1308 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}/locations") 1309 urls += "?" + c.urlParams_.Encode() 1310 req, err := http.NewRequest("GET", urls, body) 1311 if err != nil { 1312 return nil, err 1313 } 1314 req.Header = reqHeaders 1315 googleapi.Expand(req.URL, map[string]string{ 1316 "name": c.name, 1317 }) 1318 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1319} 1320 1321// Do executes the "redis.projects.locations.list" call. 1322// Exactly one of *ListLocationsResponse or error will be non-nil. Any 1323// non-2xx status code is an error. Response headers are in either 1324// *ListLocationsResponse.ServerResponse.Header or (if a response was 1325// returned at all) in error.(*googleapi.Error).Header. Use 1326// googleapi.IsNotModified to check whether the returned error was 1327// because http.StatusNotModified was returned. 1328func (c *ProjectsLocationsListCall) Do(opts ...googleapi.CallOption) (*ListLocationsResponse, error) { 1329 gensupport.SetOptions(c.urlParams_, opts...) 1330 res, err := c.doRequest("json") 1331 if res != nil && res.StatusCode == http.StatusNotModified { 1332 if res.Body != nil { 1333 res.Body.Close() 1334 } 1335 return nil, &googleapi.Error{ 1336 Code: res.StatusCode, 1337 Header: res.Header, 1338 } 1339 } 1340 if err != nil { 1341 return nil, err 1342 } 1343 defer googleapi.CloseBody(res) 1344 if err := googleapi.CheckResponse(res); err != nil { 1345 return nil, err 1346 } 1347 ret := &ListLocationsResponse{ 1348 ServerResponse: googleapi.ServerResponse{ 1349 Header: res.Header, 1350 HTTPStatusCode: res.StatusCode, 1351 }, 1352 } 1353 target := &ret 1354 if err := gensupport.DecodeResponse(target, res); err != nil { 1355 return nil, err 1356 } 1357 return ret, nil 1358 // { 1359 // "description": "Lists information about the supported locations for this service.", 1360 // "flatPath": "v1/projects/{projectsId}/locations", 1361 // "httpMethod": "GET", 1362 // "id": "redis.projects.locations.list", 1363 // "parameterOrder": [ 1364 // "name" 1365 // ], 1366 // "parameters": { 1367 // "filter": { 1368 // "description": "A filter to narrow down results to a preferred subset. The filtering language accepts strings like \"displayName=tokyo\", and is documented in more detail in [AIP-160](https://google.aip.dev/160).", 1369 // "location": "query", 1370 // "type": "string" 1371 // }, 1372 // "name": { 1373 // "description": "The resource that owns the locations collection, if applicable.", 1374 // "location": "path", 1375 // "pattern": "^projects/[^/]+$", 1376 // "required": true, 1377 // "type": "string" 1378 // }, 1379 // "pageSize": { 1380 // "description": "The maximum number of results to return. If not set, the service selects a default.", 1381 // "format": "int32", 1382 // "location": "query", 1383 // "type": "integer" 1384 // }, 1385 // "pageToken": { 1386 // "description": "A page token received from the `next_page_token` field in the response. Send that page token to receive the subsequent page.", 1387 // "location": "query", 1388 // "type": "string" 1389 // } 1390 // }, 1391 // "path": "v1/{+name}/locations", 1392 // "response": { 1393 // "$ref": "ListLocationsResponse" 1394 // }, 1395 // "scopes": [ 1396 // "https://www.googleapis.com/auth/cloud-platform" 1397 // ] 1398 // } 1399 1400} 1401 1402// Pages invokes f for each page of results. 1403// A non-nil error returned from f will halt the iteration. 1404// The provided context supersedes any context provided to the Context method. 1405func (c *ProjectsLocationsListCall) Pages(ctx context.Context, f func(*ListLocationsResponse) error) error { 1406 c.ctx_ = ctx 1407 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 1408 for { 1409 x, err := c.Do() 1410 if err != nil { 1411 return err 1412 } 1413 if err := f(x); err != nil { 1414 return err 1415 } 1416 if x.NextPageToken == "" { 1417 return nil 1418 } 1419 c.PageToken(x.NextPageToken) 1420 } 1421} 1422 1423// method id "redis.projects.locations.instances.create": 1424 1425type ProjectsLocationsInstancesCreateCall struct { 1426 s *Service 1427 parent string 1428 instance *Instance 1429 urlParams_ gensupport.URLParams 1430 ctx_ context.Context 1431 header_ http.Header 1432} 1433 1434// Create: Creates a Redis instance based on the specified tier and 1435// memory size. By default, the instance is accessible from the 1436// project's default network (https://cloud.google.com/vpc/docs/vpc). 1437// The creation is executed asynchronously and callers may check the 1438// returned operation to track its progress. Once the operation is 1439// completed the Redis instance will be fully functional. Completed 1440// longrunning.Operation will contain the new instance object in the 1441// response field. The returned operation is automatically deleted after 1442// a few hours, so there is no need to call DeleteOperation. 1443// 1444// - parent: The resource name of the instance location using the form: 1445// `projects/{project_id}/locations/{location_id}` where `location_id` 1446// refers to a GCP region. 1447func (r *ProjectsLocationsInstancesService) Create(parent string, instance *Instance) *ProjectsLocationsInstancesCreateCall { 1448 c := &ProjectsLocationsInstancesCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1449 c.parent = parent 1450 c.instance = instance 1451 return c 1452} 1453 1454// InstanceId sets the optional parameter "instanceId": Required. The 1455// logical name of the Redis instance in the customer project with the 1456// following restrictions: * Must contain only lowercase letters, 1457// numbers, and hyphens. * Must start with a letter. * Must be between 1458// 1-40 characters. * Must end with a number or a letter. * Must be 1459// unique within the customer project / location 1460func (c *ProjectsLocationsInstancesCreateCall) InstanceId(instanceId string) *ProjectsLocationsInstancesCreateCall { 1461 c.urlParams_.Set("instanceId", instanceId) 1462 return c 1463} 1464 1465// Fields allows partial responses to be retrieved. See 1466// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1467// for more information. 1468func (c *ProjectsLocationsInstancesCreateCall) Fields(s ...googleapi.Field) *ProjectsLocationsInstancesCreateCall { 1469 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1470 return c 1471} 1472 1473// Context sets the context to be used in this call's Do method. Any 1474// pending HTTP request will be aborted if the provided context is 1475// canceled. 1476func (c *ProjectsLocationsInstancesCreateCall) Context(ctx context.Context) *ProjectsLocationsInstancesCreateCall { 1477 c.ctx_ = ctx 1478 return c 1479} 1480 1481// Header returns an http.Header that can be modified by the caller to 1482// add HTTP headers to the request. 1483func (c *ProjectsLocationsInstancesCreateCall) Header() http.Header { 1484 if c.header_ == nil { 1485 c.header_ = make(http.Header) 1486 } 1487 return c.header_ 1488} 1489 1490func (c *ProjectsLocationsInstancesCreateCall) doRequest(alt string) (*http.Response, error) { 1491 reqHeaders := make(http.Header) 1492 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210502") 1493 for k, v := range c.header_ { 1494 reqHeaders[k] = v 1495 } 1496 reqHeaders.Set("User-Agent", c.s.userAgent()) 1497 var body io.Reader = nil 1498 body, err := googleapi.WithoutDataWrapper.JSONReader(c.instance) 1499 if err != nil { 1500 return nil, err 1501 } 1502 reqHeaders.Set("Content-Type", "application/json") 1503 c.urlParams_.Set("alt", alt) 1504 c.urlParams_.Set("prettyPrint", "false") 1505 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/instances") 1506 urls += "?" + c.urlParams_.Encode() 1507 req, err := http.NewRequest("POST", urls, body) 1508 if err != nil { 1509 return nil, err 1510 } 1511 req.Header = reqHeaders 1512 googleapi.Expand(req.URL, map[string]string{ 1513 "parent": c.parent, 1514 }) 1515 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1516} 1517 1518// Do executes the "redis.projects.locations.instances.create" call. 1519// Exactly one of *Operation or error will be non-nil. Any non-2xx 1520// status code is an error. Response headers are in either 1521// *Operation.ServerResponse.Header or (if a response was returned at 1522// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 1523// to check whether the returned error was because 1524// http.StatusNotModified was returned. 1525func (c *ProjectsLocationsInstancesCreateCall) Do(opts ...googleapi.CallOption) (*Operation, error) { 1526 gensupport.SetOptions(c.urlParams_, opts...) 1527 res, err := c.doRequest("json") 1528 if res != nil && res.StatusCode == http.StatusNotModified { 1529 if res.Body != nil { 1530 res.Body.Close() 1531 } 1532 return nil, &googleapi.Error{ 1533 Code: res.StatusCode, 1534 Header: res.Header, 1535 } 1536 } 1537 if err != nil { 1538 return nil, err 1539 } 1540 defer googleapi.CloseBody(res) 1541 if err := googleapi.CheckResponse(res); err != nil { 1542 return nil, err 1543 } 1544 ret := &Operation{ 1545 ServerResponse: googleapi.ServerResponse{ 1546 Header: res.Header, 1547 HTTPStatusCode: res.StatusCode, 1548 }, 1549 } 1550 target := &ret 1551 if err := gensupport.DecodeResponse(target, res); err != nil { 1552 return nil, err 1553 } 1554 return ret, nil 1555 // { 1556 // "description": "Creates a Redis instance based on the specified tier and memory size. By default, the instance is accessible from the project's [default network](https://cloud.google.com/vpc/docs/vpc). The creation is executed asynchronously and callers may check the returned operation to track its progress. Once the operation is completed the Redis instance will be fully functional. Completed longrunning.Operation will contain the new instance object in the response field. The returned operation is automatically deleted after a few hours, so there is no need to call DeleteOperation.", 1557 // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/instances", 1558 // "httpMethod": "POST", 1559 // "id": "redis.projects.locations.instances.create", 1560 // "parameterOrder": [ 1561 // "parent" 1562 // ], 1563 // "parameters": { 1564 // "instanceId": { 1565 // "description": "Required. The logical name of the Redis instance in the customer project with the following restrictions: * Must contain only lowercase letters, numbers, and hyphens. * Must start with a letter. * Must be between 1-40 characters. * Must end with a number or a letter. * Must be unique within the customer project / location", 1566 // "location": "query", 1567 // "type": "string" 1568 // }, 1569 // "parent": { 1570 // "description": "Required. The resource name of the instance location using the form: `projects/{project_id}/locations/{location_id}` where `location_id` refers to a GCP region.", 1571 // "location": "path", 1572 // "pattern": "^projects/[^/]+/locations/[^/]+$", 1573 // "required": true, 1574 // "type": "string" 1575 // } 1576 // }, 1577 // "path": "v1/{+parent}/instances", 1578 // "request": { 1579 // "$ref": "Instance" 1580 // }, 1581 // "response": { 1582 // "$ref": "Operation" 1583 // }, 1584 // "scopes": [ 1585 // "https://www.googleapis.com/auth/cloud-platform" 1586 // ] 1587 // } 1588 1589} 1590 1591// method id "redis.projects.locations.instances.delete": 1592 1593type ProjectsLocationsInstancesDeleteCall struct { 1594 s *Service 1595 name string 1596 urlParams_ gensupport.URLParams 1597 ctx_ context.Context 1598 header_ http.Header 1599} 1600 1601// Delete: Deletes a specific Redis instance. Instance stops serving and 1602// data is deleted. 1603// 1604// - name: Redis instance resource name using the form: 1605// `projects/{project_id}/locations/{location_id}/instances/{instance_i 1606// d}` where `location_id` refers to a GCP region. 1607func (r *ProjectsLocationsInstancesService) Delete(name string) *ProjectsLocationsInstancesDeleteCall { 1608 c := &ProjectsLocationsInstancesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1609 c.name = name 1610 return c 1611} 1612 1613// Fields allows partial responses to be retrieved. See 1614// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1615// for more information. 1616func (c *ProjectsLocationsInstancesDeleteCall) Fields(s ...googleapi.Field) *ProjectsLocationsInstancesDeleteCall { 1617 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1618 return c 1619} 1620 1621// Context sets the context to be used in this call's Do method. Any 1622// pending HTTP request will be aborted if the provided context is 1623// canceled. 1624func (c *ProjectsLocationsInstancesDeleteCall) Context(ctx context.Context) *ProjectsLocationsInstancesDeleteCall { 1625 c.ctx_ = ctx 1626 return c 1627} 1628 1629// Header returns an http.Header that can be modified by the caller to 1630// add HTTP headers to the request. 1631func (c *ProjectsLocationsInstancesDeleteCall) Header() http.Header { 1632 if c.header_ == nil { 1633 c.header_ = make(http.Header) 1634 } 1635 return c.header_ 1636} 1637 1638func (c *ProjectsLocationsInstancesDeleteCall) doRequest(alt string) (*http.Response, error) { 1639 reqHeaders := make(http.Header) 1640 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210502") 1641 for k, v := range c.header_ { 1642 reqHeaders[k] = v 1643 } 1644 reqHeaders.Set("User-Agent", c.s.userAgent()) 1645 var body io.Reader = nil 1646 c.urlParams_.Set("alt", alt) 1647 c.urlParams_.Set("prettyPrint", "false") 1648 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}") 1649 urls += "?" + c.urlParams_.Encode() 1650 req, err := http.NewRequest("DELETE", urls, body) 1651 if err != nil { 1652 return nil, err 1653 } 1654 req.Header = reqHeaders 1655 googleapi.Expand(req.URL, map[string]string{ 1656 "name": c.name, 1657 }) 1658 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1659} 1660 1661// Do executes the "redis.projects.locations.instances.delete" call. 1662// Exactly one of *Operation or error will be non-nil. Any non-2xx 1663// status code is an error. Response headers are in either 1664// *Operation.ServerResponse.Header or (if a response was returned at 1665// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 1666// to check whether the returned error was because 1667// http.StatusNotModified was returned. 1668func (c *ProjectsLocationsInstancesDeleteCall) Do(opts ...googleapi.CallOption) (*Operation, error) { 1669 gensupport.SetOptions(c.urlParams_, opts...) 1670 res, err := c.doRequest("json") 1671 if res != nil && res.StatusCode == http.StatusNotModified { 1672 if res.Body != nil { 1673 res.Body.Close() 1674 } 1675 return nil, &googleapi.Error{ 1676 Code: res.StatusCode, 1677 Header: res.Header, 1678 } 1679 } 1680 if err != nil { 1681 return nil, err 1682 } 1683 defer googleapi.CloseBody(res) 1684 if err := googleapi.CheckResponse(res); err != nil { 1685 return nil, err 1686 } 1687 ret := &Operation{ 1688 ServerResponse: googleapi.ServerResponse{ 1689 Header: res.Header, 1690 HTTPStatusCode: res.StatusCode, 1691 }, 1692 } 1693 target := &ret 1694 if err := gensupport.DecodeResponse(target, res); err != nil { 1695 return nil, err 1696 } 1697 return ret, nil 1698 // { 1699 // "description": "Deletes a specific Redis instance. Instance stops serving and data is deleted.", 1700 // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/instances/{instancesId}", 1701 // "httpMethod": "DELETE", 1702 // "id": "redis.projects.locations.instances.delete", 1703 // "parameterOrder": [ 1704 // "name" 1705 // ], 1706 // "parameters": { 1707 // "name": { 1708 // "description": "Required. Redis instance resource name using the form: `projects/{project_id}/locations/{location_id}/instances/{instance_id}` where `location_id` refers to a GCP region.", 1709 // "location": "path", 1710 // "pattern": "^projects/[^/]+/locations/[^/]+/instances/[^/]+$", 1711 // "required": true, 1712 // "type": "string" 1713 // } 1714 // }, 1715 // "path": "v1/{+name}", 1716 // "response": { 1717 // "$ref": "Operation" 1718 // }, 1719 // "scopes": [ 1720 // "https://www.googleapis.com/auth/cloud-platform" 1721 // ] 1722 // } 1723 1724} 1725 1726// method id "redis.projects.locations.instances.export": 1727 1728type ProjectsLocationsInstancesExportCall struct { 1729 s *Service 1730 name string 1731 exportinstancerequest *ExportInstanceRequest 1732 urlParams_ gensupport.URLParams 1733 ctx_ context.Context 1734 header_ http.Header 1735} 1736 1737// Export: Export Redis instance data into a Redis RDB format file in 1738// Cloud Storage. Redis will continue serving during this operation. The 1739// returned operation is automatically deleted after a few hours, so 1740// there is no need to call DeleteOperation. 1741// 1742// - name: Redis instance resource name using the form: 1743// `projects/{project_id}/locations/{location_id}/instances/{instance_i 1744// d}` where `location_id` refers to a GCP region. 1745func (r *ProjectsLocationsInstancesService) Export(name string, exportinstancerequest *ExportInstanceRequest) *ProjectsLocationsInstancesExportCall { 1746 c := &ProjectsLocationsInstancesExportCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1747 c.name = name 1748 c.exportinstancerequest = exportinstancerequest 1749 return c 1750} 1751 1752// Fields allows partial responses to be retrieved. See 1753// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1754// for more information. 1755func (c *ProjectsLocationsInstancesExportCall) Fields(s ...googleapi.Field) *ProjectsLocationsInstancesExportCall { 1756 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1757 return c 1758} 1759 1760// Context sets the context to be used in this call's Do method. Any 1761// pending HTTP request will be aborted if the provided context is 1762// canceled. 1763func (c *ProjectsLocationsInstancesExportCall) Context(ctx context.Context) *ProjectsLocationsInstancesExportCall { 1764 c.ctx_ = ctx 1765 return c 1766} 1767 1768// Header returns an http.Header that can be modified by the caller to 1769// add HTTP headers to the request. 1770func (c *ProjectsLocationsInstancesExportCall) Header() http.Header { 1771 if c.header_ == nil { 1772 c.header_ = make(http.Header) 1773 } 1774 return c.header_ 1775} 1776 1777func (c *ProjectsLocationsInstancesExportCall) doRequest(alt string) (*http.Response, error) { 1778 reqHeaders := make(http.Header) 1779 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210502") 1780 for k, v := range c.header_ { 1781 reqHeaders[k] = v 1782 } 1783 reqHeaders.Set("User-Agent", c.s.userAgent()) 1784 var body io.Reader = nil 1785 body, err := googleapi.WithoutDataWrapper.JSONReader(c.exportinstancerequest) 1786 if err != nil { 1787 return nil, err 1788 } 1789 reqHeaders.Set("Content-Type", "application/json") 1790 c.urlParams_.Set("alt", alt) 1791 c.urlParams_.Set("prettyPrint", "false") 1792 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}:export") 1793 urls += "?" + c.urlParams_.Encode() 1794 req, err := http.NewRequest("POST", urls, body) 1795 if err != nil { 1796 return nil, err 1797 } 1798 req.Header = reqHeaders 1799 googleapi.Expand(req.URL, map[string]string{ 1800 "name": c.name, 1801 }) 1802 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1803} 1804 1805// Do executes the "redis.projects.locations.instances.export" call. 1806// Exactly one of *Operation or error will be non-nil. Any non-2xx 1807// status code is an error. Response headers are in either 1808// *Operation.ServerResponse.Header or (if a response was returned at 1809// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 1810// to check whether the returned error was because 1811// http.StatusNotModified was returned. 1812func (c *ProjectsLocationsInstancesExportCall) Do(opts ...googleapi.CallOption) (*Operation, error) { 1813 gensupport.SetOptions(c.urlParams_, opts...) 1814 res, err := c.doRequest("json") 1815 if res != nil && res.StatusCode == http.StatusNotModified { 1816 if res.Body != nil { 1817 res.Body.Close() 1818 } 1819 return nil, &googleapi.Error{ 1820 Code: res.StatusCode, 1821 Header: res.Header, 1822 } 1823 } 1824 if err != nil { 1825 return nil, err 1826 } 1827 defer googleapi.CloseBody(res) 1828 if err := googleapi.CheckResponse(res); err != nil { 1829 return nil, err 1830 } 1831 ret := &Operation{ 1832 ServerResponse: googleapi.ServerResponse{ 1833 Header: res.Header, 1834 HTTPStatusCode: res.StatusCode, 1835 }, 1836 } 1837 target := &ret 1838 if err := gensupport.DecodeResponse(target, res); err != nil { 1839 return nil, err 1840 } 1841 return ret, nil 1842 // { 1843 // "description": "Export Redis instance data into a Redis RDB format file in Cloud Storage. Redis will continue serving during this operation. The returned operation is automatically deleted after a few hours, so there is no need to call DeleteOperation.", 1844 // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/instances/{instancesId}:export", 1845 // "httpMethod": "POST", 1846 // "id": "redis.projects.locations.instances.export", 1847 // "parameterOrder": [ 1848 // "name" 1849 // ], 1850 // "parameters": { 1851 // "name": { 1852 // "description": "Required. Redis instance resource name using the form: `projects/{project_id}/locations/{location_id}/instances/{instance_id}` where `location_id` refers to a GCP region.", 1853 // "location": "path", 1854 // "pattern": "^projects/[^/]+/locations/[^/]+/instances/[^/]+$", 1855 // "required": true, 1856 // "type": "string" 1857 // } 1858 // }, 1859 // "path": "v1/{+name}:export", 1860 // "request": { 1861 // "$ref": "ExportInstanceRequest" 1862 // }, 1863 // "response": { 1864 // "$ref": "Operation" 1865 // }, 1866 // "scopes": [ 1867 // "https://www.googleapis.com/auth/cloud-platform" 1868 // ] 1869 // } 1870 1871} 1872 1873// method id "redis.projects.locations.instances.failover": 1874 1875type ProjectsLocationsInstancesFailoverCall struct { 1876 s *Service 1877 name string 1878 failoverinstancerequest *FailoverInstanceRequest 1879 urlParams_ gensupport.URLParams 1880 ctx_ context.Context 1881 header_ http.Header 1882} 1883 1884// Failover: Initiates a failover of the primary node to current replica 1885// node for a specific STANDARD tier Cloud Memorystore for Redis 1886// instance. 1887// 1888// - name: Redis instance resource name using the form: 1889// `projects/{project_id}/locations/{location_id}/instances/{instance_i 1890// d}` where `location_id` refers to a GCP region. 1891func (r *ProjectsLocationsInstancesService) Failover(name string, failoverinstancerequest *FailoverInstanceRequest) *ProjectsLocationsInstancesFailoverCall { 1892 c := &ProjectsLocationsInstancesFailoverCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1893 c.name = name 1894 c.failoverinstancerequest = failoverinstancerequest 1895 return c 1896} 1897 1898// Fields allows partial responses to be retrieved. See 1899// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1900// for more information. 1901func (c *ProjectsLocationsInstancesFailoverCall) Fields(s ...googleapi.Field) *ProjectsLocationsInstancesFailoverCall { 1902 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1903 return c 1904} 1905 1906// Context sets the context to be used in this call's Do method. Any 1907// pending HTTP request will be aborted if the provided context is 1908// canceled. 1909func (c *ProjectsLocationsInstancesFailoverCall) Context(ctx context.Context) *ProjectsLocationsInstancesFailoverCall { 1910 c.ctx_ = ctx 1911 return c 1912} 1913 1914// Header returns an http.Header that can be modified by the caller to 1915// add HTTP headers to the request. 1916func (c *ProjectsLocationsInstancesFailoverCall) Header() http.Header { 1917 if c.header_ == nil { 1918 c.header_ = make(http.Header) 1919 } 1920 return c.header_ 1921} 1922 1923func (c *ProjectsLocationsInstancesFailoverCall) doRequest(alt string) (*http.Response, error) { 1924 reqHeaders := make(http.Header) 1925 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210502") 1926 for k, v := range c.header_ { 1927 reqHeaders[k] = v 1928 } 1929 reqHeaders.Set("User-Agent", c.s.userAgent()) 1930 var body io.Reader = nil 1931 body, err := googleapi.WithoutDataWrapper.JSONReader(c.failoverinstancerequest) 1932 if err != nil { 1933 return nil, err 1934 } 1935 reqHeaders.Set("Content-Type", "application/json") 1936 c.urlParams_.Set("alt", alt) 1937 c.urlParams_.Set("prettyPrint", "false") 1938 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}:failover") 1939 urls += "?" + c.urlParams_.Encode() 1940 req, err := http.NewRequest("POST", urls, body) 1941 if err != nil { 1942 return nil, err 1943 } 1944 req.Header = reqHeaders 1945 googleapi.Expand(req.URL, map[string]string{ 1946 "name": c.name, 1947 }) 1948 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1949} 1950 1951// Do executes the "redis.projects.locations.instances.failover" call. 1952// Exactly one of *Operation or error will be non-nil. Any non-2xx 1953// status code is an error. Response headers are in either 1954// *Operation.ServerResponse.Header or (if a response was returned at 1955// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 1956// to check whether the returned error was because 1957// http.StatusNotModified was returned. 1958func (c *ProjectsLocationsInstancesFailoverCall) Do(opts ...googleapi.CallOption) (*Operation, error) { 1959 gensupport.SetOptions(c.urlParams_, opts...) 1960 res, err := c.doRequest("json") 1961 if res != nil && res.StatusCode == http.StatusNotModified { 1962 if res.Body != nil { 1963 res.Body.Close() 1964 } 1965 return nil, &googleapi.Error{ 1966 Code: res.StatusCode, 1967 Header: res.Header, 1968 } 1969 } 1970 if err != nil { 1971 return nil, err 1972 } 1973 defer googleapi.CloseBody(res) 1974 if err := googleapi.CheckResponse(res); err != nil { 1975 return nil, err 1976 } 1977 ret := &Operation{ 1978 ServerResponse: googleapi.ServerResponse{ 1979 Header: res.Header, 1980 HTTPStatusCode: res.StatusCode, 1981 }, 1982 } 1983 target := &ret 1984 if err := gensupport.DecodeResponse(target, res); err != nil { 1985 return nil, err 1986 } 1987 return ret, nil 1988 // { 1989 // "description": "Initiates a failover of the primary node to current replica node for a specific STANDARD tier Cloud Memorystore for Redis instance.", 1990 // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/instances/{instancesId}:failover", 1991 // "httpMethod": "POST", 1992 // "id": "redis.projects.locations.instances.failover", 1993 // "parameterOrder": [ 1994 // "name" 1995 // ], 1996 // "parameters": { 1997 // "name": { 1998 // "description": "Required. Redis instance resource name using the form: `projects/{project_id}/locations/{location_id}/instances/{instance_id}` where `location_id` refers to a GCP region.", 1999 // "location": "path", 2000 // "pattern": "^projects/[^/]+/locations/[^/]+/instances/[^/]+$", 2001 // "required": true, 2002 // "type": "string" 2003 // } 2004 // }, 2005 // "path": "v1/{+name}:failover", 2006 // "request": { 2007 // "$ref": "FailoverInstanceRequest" 2008 // }, 2009 // "response": { 2010 // "$ref": "Operation" 2011 // }, 2012 // "scopes": [ 2013 // "https://www.googleapis.com/auth/cloud-platform" 2014 // ] 2015 // } 2016 2017} 2018 2019// method id "redis.projects.locations.instances.get": 2020 2021type ProjectsLocationsInstancesGetCall struct { 2022 s *Service 2023 name string 2024 urlParams_ gensupport.URLParams 2025 ifNoneMatch_ string 2026 ctx_ context.Context 2027 header_ http.Header 2028} 2029 2030// Get: Gets the details of a specific Redis instance. 2031// 2032// - name: Redis instance resource name using the form: 2033// `projects/{project_id}/locations/{location_id}/instances/{instance_i 2034// d}` where `location_id` refers to a GCP region. 2035func (r *ProjectsLocationsInstancesService) Get(name string) *ProjectsLocationsInstancesGetCall { 2036 c := &ProjectsLocationsInstancesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2037 c.name = name 2038 return c 2039} 2040 2041// Fields allows partial responses to be retrieved. See 2042// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2043// for more information. 2044func (c *ProjectsLocationsInstancesGetCall) Fields(s ...googleapi.Field) *ProjectsLocationsInstancesGetCall { 2045 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2046 return c 2047} 2048 2049// IfNoneMatch sets the optional parameter which makes the operation 2050// fail if the object's ETag matches the given value. This is useful for 2051// getting updates only after the object has changed since the last 2052// request. Use googleapi.IsNotModified to check whether the response 2053// error from Do is the result of In-None-Match. 2054func (c *ProjectsLocationsInstancesGetCall) IfNoneMatch(entityTag string) *ProjectsLocationsInstancesGetCall { 2055 c.ifNoneMatch_ = entityTag 2056 return c 2057} 2058 2059// Context sets the context to be used in this call's Do method. Any 2060// pending HTTP request will be aborted if the provided context is 2061// canceled. 2062func (c *ProjectsLocationsInstancesGetCall) Context(ctx context.Context) *ProjectsLocationsInstancesGetCall { 2063 c.ctx_ = ctx 2064 return c 2065} 2066 2067// Header returns an http.Header that can be modified by the caller to 2068// add HTTP headers to the request. 2069func (c *ProjectsLocationsInstancesGetCall) Header() http.Header { 2070 if c.header_ == nil { 2071 c.header_ = make(http.Header) 2072 } 2073 return c.header_ 2074} 2075 2076func (c *ProjectsLocationsInstancesGetCall) doRequest(alt string) (*http.Response, error) { 2077 reqHeaders := make(http.Header) 2078 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210502") 2079 for k, v := range c.header_ { 2080 reqHeaders[k] = v 2081 } 2082 reqHeaders.Set("User-Agent", c.s.userAgent()) 2083 if c.ifNoneMatch_ != "" { 2084 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 2085 } 2086 var body io.Reader = nil 2087 c.urlParams_.Set("alt", alt) 2088 c.urlParams_.Set("prettyPrint", "false") 2089 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}") 2090 urls += "?" + c.urlParams_.Encode() 2091 req, err := http.NewRequest("GET", urls, body) 2092 if err != nil { 2093 return nil, err 2094 } 2095 req.Header = reqHeaders 2096 googleapi.Expand(req.URL, map[string]string{ 2097 "name": c.name, 2098 }) 2099 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2100} 2101 2102// Do executes the "redis.projects.locations.instances.get" call. 2103// Exactly one of *Instance or error will be non-nil. Any non-2xx status 2104// code is an error. Response headers are in either 2105// *Instance.ServerResponse.Header or (if a response was returned at 2106// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 2107// to check whether the returned error was because 2108// http.StatusNotModified was returned. 2109func (c *ProjectsLocationsInstancesGetCall) Do(opts ...googleapi.CallOption) (*Instance, error) { 2110 gensupport.SetOptions(c.urlParams_, opts...) 2111 res, err := c.doRequest("json") 2112 if res != nil && res.StatusCode == http.StatusNotModified { 2113 if res.Body != nil { 2114 res.Body.Close() 2115 } 2116 return nil, &googleapi.Error{ 2117 Code: res.StatusCode, 2118 Header: res.Header, 2119 } 2120 } 2121 if err != nil { 2122 return nil, err 2123 } 2124 defer googleapi.CloseBody(res) 2125 if err := googleapi.CheckResponse(res); err != nil { 2126 return nil, err 2127 } 2128 ret := &Instance{ 2129 ServerResponse: googleapi.ServerResponse{ 2130 Header: res.Header, 2131 HTTPStatusCode: res.StatusCode, 2132 }, 2133 } 2134 target := &ret 2135 if err := gensupport.DecodeResponse(target, res); err != nil { 2136 return nil, err 2137 } 2138 return ret, nil 2139 // { 2140 // "description": "Gets the details of a specific Redis instance.", 2141 // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/instances/{instancesId}", 2142 // "httpMethod": "GET", 2143 // "id": "redis.projects.locations.instances.get", 2144 // "parameterOrder": [ 2145 // "name" 2146 // ], 2147 // "parameters": { 2148 // "name": { 2149 // "description": "Required. Redis instance resource name using the form: `projects/{project_id}/locations/{location_id}/instances/{instance_id}` where `location_id` refers to a GCP region.", 2150 // "location": "path", 2151 // "pattern": "^projects/[^/]+/locations/[^/]+/instances/[^/]+$", 2152 // "required": true, 2153 // "type": "string" 2154 // } 2155 // }, 2156 // "path": "v1/{+name}", 2157 // "response": { 2158 // "$ref": "Instance" 2159 // }, 2160 // "scopes": [ 2161 // "https://www.googleapis.com/auth/cloud-platform" 2162 // ] 2163 // } 2164 2165} 2166 2167// method id "redis.projects.locations.instances.getAuthString": 2168 2169type ProjectsLocationsInstancesGetAuthStringCall struct { 2170 s *Service 2171 name string 2172 urlParams_ gensupport.URLParams 2173 ifNoneMatch_ string 2174 ctx_ context.Context 2175 header_ http.Header 2176} 2177 2178// GetAuthString: Gets the AUTH string for a Redis instance. If AUTH is 2179// not enabled for the instance the response will be empty. This 2180// information is not included in the details returned to GetInstance. 2181// 2182// - name: Redis instance resource name using the form: 2183// `projects/{project_id}/locations/{location_id}/instances/{instance_i 2184// d}` where `location_id` refers to a GCP region. 2185func (r *ProjectsLocationsInstancesService) GetAuthString(name string) *ProjectsLocationsInstancesGetAuthStringCall { 2186 c := &ProjectsLocationsInstancesGetAuthStringCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2187 c.name = name 2188 return c 2189} 2190 2191// Fields allows partial responses to be retrieved. See 2192// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2193// for more information. 2194func (c *ProjectsLocationsInstancesGetAuthStringCall) Fields(s ...googleapi.Field) *ProjectsLocationsInstancesGetAuthStringCall { 2195 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2196 return c 2197} 2198 2199// IfNoneMatch sets the optional parameter which makes the operation 2200// fail if the object's ETag matches the given value. This is useful for 2201// getting updates only after the object has changed since the last 2202// request. Use googleapi.IsNotModified to check whether the response 2203// error from Do is the result of In-None-Match. 2204func (c *ProjectsLocationsInstancesGetAuthStringCall) IfNoneMatch(entityTag string) *ProjectsLocationsInstancesGetAuthStringCall { 2205 c.ifNoneMatch_ = entityTag 2206 return c 2207} 2208 2209// Context sets the context to be used in this call's Do method. Any 2210// pending HTTP request will be aborted if the provided context is 2211// canceled. 2212func (c *ProjectsLocationsInstancesGetAuthStringCall) Context(ctx context.Context) *ProjectsLocationsInstancesGetAuthStringCall { 2213 c.ctx_ = ctx 2214 return c 2215} 2216 2217// Header returns an http.Header that can be modified by the caller to 2218// add HTTP headers to the request. 2219func (c *ProjectsLocationsInstancesGetAuthStringCall) Header() http.Header { 2220 if c.header_ == nil { 2221 c.header_ = make(http.Header) 2222 } 2223 return c.header_ 2224} 2225 2226func (c *ProjectsLocationsInstancesGetAuthStringCall) doRequest(alt string) (*http.Response, error) { 2227 reqHeaders := make(http.Header) 2228 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210502") 2229 for k, v := range c.header_ { 2230 reqHeaders[k] = v 2231 } 2232 reqHeaders.Set("User-Agent", c.s.userAgent()) 2233 if c.ifNoneMatch_ != "" { 2234 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 2235 } 2236 var body io.Reader = nil 2237 c.urlParams_.Set("alt", alt) 2238 c.urlParams_.Set("prettyPrint", "false") 2239 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}/authString") 2240 urls += "?" + c.urlParams_.Encode() 2241 req, err := http.NewRequest("GET", urls, body) 2242 if err != nil { 2243 return nil, err 2244 } 2245 req.Header = reqHeaders 2246 googleapi.Expand(req.URL, map[string]string{ 2247 "name": c.name, 2248 }) 2249 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2250} 2251 2252// Do executes the "redis.projects.locations.instances.getAuthString" call. 2253// Exactly one of *InstanceAuthString or error will be non-nil. Any 2254// non-2xx status code is an error. Response headers are in either 2255// *InstanceAuthString.ServerResponse.Header or (if a response was 2256// returned at all) in error.(*googleapi.Error).Header. Use 2257// googleapi.IsNotModified to check whether the returned error was 2258// because http.StatusNotModified was returned. 2259func (c *ProjectsLocationsInstancesGetAuthStringCall) Do(opts ...googleapi.CallOption) (*InstanceAuthString, error) { 2260 gensupport.SetOptions(c.urlParams_, opts...) 2261 res, err := c.doRequest("json") 2262 if res != nil && res.StatusCode == http.StatusNotModified { 2263 if res.Body != nil { 2264 res.Body.Close() 2265 } 2266 return nil, &googleapi.Error{ 2267 Code: res.StatusCode, 2268 Header: res.Header, 2269 } 2270 } 2271 if err != nil { 2272 return nil, err 2273 } 2274 defer googleapi.CloseBody(res) 2275 if err := googleapi.CheckResponse(res); err != nil { 2276 return nil, err 2277 } 2278 ret := &InstanceAuthString{ 2279 ServerResponse: googleapi.ServerResponse{ 2280 Header: res.Header, 2281 HTTPStatusCode: res.StatusCode, 2282 }, 2283 } 2284 target := &ret 2285 if err := gensupport.DecodeResponse(target, res); err != nil { 2286 return nil, err 2287 } 2288 return ret, nil 2289 // { 2290 // "description": "Gets the AUTH string for a Redis instance. If AUTH is not enabled for the instance the response will be empty. This information is not included in the details returned to GetInstance.", 2291 // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/instances/{instancesId}/authString", 2292 // "httpMethod": "GET", 2293 // "id": "redis.projects.locations.instances.getAuthString", 2294 // "parameterOrder": [ 2295 // "name" 2296 // ], 2297 // "parameters": { 2298 // "name": { 2299 // "description": "Required. Redis instance resource name using the form: `projects/{project_id}/locations/{location_id}/instances/{instance_id}` where `location_id` refers to a GCP region.", 2300 // "location": "path", 2301 // "pattern": "^projects/[^/]+/locations/[^/]+/instances/[^/]+$", 2302 // "required": true, 2303 // "type": "string" 2304 // } 2305 // }, 2306 // "path": "v1/{+name}/authString", 2307 // "response": { 2308 // "$ref": "InstanceAuthString" 2309 // }, 2310 // "scopes": [ 2311 // "https://www.googleapis.com/auth/cloud-platform" 2312 // ] 2313 // } 2314 2315} 2316 2317// method id "redis.projects.locations.instances.import": 2318 2319type ProjectsLocationsInstancesImportCall struct { 2320 s *Service 2321 name string 2322 importinstancerequest *ImportInstanceRequest 2323 urlParams_ gensupport.URLParams 2324 ctx_ context.Context 2325 header_ http.Header 2326} 2327 2328// Import: Import a Redis RDB snapshot file from Cloud Storage into a 2329// Redis instance. Redis may stop serving during this operation. 2330// Instance state will be IMPORTING for entire operation. When complete, 2331// the instance will contain only data from the imported file. The 2332// returned operation is automatically deleted after a few hours, so 2333// there is no need to call DeleteOperation. 2334// 2335// - name: Redis instance resource name using the form: 2336// `projects/{project_id}/locations/{location_id}/instances/{instance_i 2337// d}` where `location_id` refers to a GCP region. 2338func (r *ProjectsLocationsInstancesService) Import(name string, importinstancerequest *ImportInstanceRequest) *ProjectsLocationsInstancesImportCall { 2339 c := &ProjectsLocationsInstancesImportCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2340 c.name = name 2341 c.importinstancerequest = importinstancerequest 2342 return c 2343} 2344 2345// Fields allows partial responses to be retrieved. See 2346// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2347// for more information. 2348func (c *ProjectsLocationsInstancesImportCall) Fields(s ...googleapi.Field) *ProjectsLocationsInstancesImportCall { 2349 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2350 return c 2351} 2352 2353// Context sets the context to be used in this call's Do method. Any 2354// pending HTTP request will be aborted if the provided context is 2355// canceled. 2356func (c *ProjectsLocationsInstancesImportCall) Context(ctx context.Context) *ProjectsLocationsInstancesImportCall { 2357 c.ctx_ = ctx 2358 return c 2359} 2360 2361// Header returns an http.Header that can be modified by the caller to 2362// add HTTP headers to the request. 2363func (c *ProjectsLocationsInstancesImportCall) Header() http.Header { 2364 if c.header_ == nil { 2365 c.header_ = make(http.Header) 2366 } 2367 return c.header_ 2368} 2369 2370func (c *ProjectsLocationsInstancesImportCall) doRequest(alt string) (*http.Response, error) { 2371 reqHeaders := make(http.Header) 2372 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210502") 2373 for k, v := range c.header_ { 2374 reqHeaders[k] = v 2375 } 2376 reqHeaders.Set("User-Agent", c.s.userAgent()) 2377 var body io.Reader = nil 2378 body, err := googleapi.WithoutDataWrapper.JSONReader(c.importinstancerequest) 2379 if err != nil { 2380 return nil, err 2381 } 2382 reqHeaders.Set("Content-Type", "application/json") 2383 c.urlParams_.Set("alt", alt) 2384 c.urlParams_.Set("prettyPrint", "false") 2385 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}:import") 2386 urls += "?" + c.urlParams_.Encode() 2387 req, err := http.NewRequest("POST", urls, body) 2388 if err != nil { 2389 return nil, err 2390 } 2391 req.Header = reqHeaders 2392 googleapi.Expand(req.URL, map[string]string{ 2393 "name": c.name, 2394 }) 2395 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2396} 2397 2398// Do executes the "redis.projects.locations.instances.import" call. 2399// Exactly one of *Operation or error will be non-nil. Any non-2xx 2400// status code is an error. Response headers are in either 2401// *Operation.ServerResponse.Header or (if a response was returned at 2402// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 2403// to check whether the returned error was because 2404// http.StatusNotModified was returned. 2405func (c *ProjectsLocationsInstancesImportCall) Do(opts ...googleapi.CallOption) (*Operation, error) { 2406 gensupport.SetOptions(c.urlParams_, opts...) 2407 res, err := c.doRequest("json") 2408 if res != nil && res.StatusCode == http.StatusNotModified { 2409 if res.Body != nil { 2410 res.Body.Close() 2411 } 2412 return nil, &googleapi.Error{ 2413 Code: res.StatusCode, 2414 Header: res.Header, 2415 } 2416 } 2417 if err != nil { 2418 return nil, err 2419 } 2420 defer googleapi.CloseBody(res) 2421 if err := googleapi.CheckResponse(res); err != nil { 2422 return nil, err 2423 } 2424 ret := &Operation{ 2425 ServerResponse: googleapi.ServerResponse{ 2426 Header: res.Header, 2427 HTTPStatusCode: res.StatusCode, 2428 }, 2429 } 2430 target := &ret 2431 if err := gensupport.DecodeResponse(target, res); err != nil { 2432 return nil, err 2433 } 2434 return ret, nil 2435 // { 2436 // "description": "Import a Redis RDB snapshot file from Cloud Storage into a Redis instance. Redis may stop serving during this operation. Instance state will be IMPORTING for entire operation. When complete, the instance will contain only data from the imported file. The returned operation is automatically deleted after a few hours, so there is no need to call DeleteOperation.", 2437 // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/instances/{instancesId}:import", 2438 // "httpMethod": "POST", 2439 // "id": "redis.projects.locations.instances.import", 2440 // "parameterOrder": [ 2441 // "name" 2442 // ], 2443 // "parameters": { 2444 // "name": { 2445 // "description": "Required. Redis instance resource name using the form: `projects/{project_id}/locations/{location_id}/instances/{instance_id}` where `location_id` refers to a GCP region.", 2446 // "location": "path", 2447 // "pattern": "^projects/[^/]+/locations/[^/]+/instances/[^/]+$", 2448 // "required": true, 2449 // "type": "string" 2450 // } 2451 // }, 2452 // "path": "v1/{+name}:import", 2453 // "request": { 2454 // "$ref": "ImportInstanceRequest" 2455 // }, 2456 // "response": { 2457 // "$ref": "Operation" 2458 // }, 2459 // "scopes": [ 2460 // "https://www.googleapis.com/auth/cloud-platform" 2461 // ] 2462 // } 2463 2464} 2465 2466// method id "redis.projects.locations.instances.list": 2467 2468type ProjectsLocationsInstancesListCall struct { 2469 s *Service 2470 parent string 2471 urlParams_ gensupport.URLParams 2472 ifNoneMatch_ string 2473 ctx_ context.Context 2474 header_ http.Header 2475} 2476 2477// List: Lists all Redis instances owned by a project in either the 2478// specified location (region) or all locations. The location should 2479// have the following format: * 2480// `projects/{project_id}/locations/{location_id}` If `location_id` is 2481// specified as `-` (wildcard), then all regions available to the 2482// project are queried, and the results are aggregated. 2483// 2484// - parent: The resource name of the instance location using the form: 2485// `projects/{project_id}/locations/{location_id}` where `location_id` 2486// refers to a GCP region. 2487func (r *ProjectsLocationsInstancesService) List(parent string) *ProjectsLocationsInstancesListCall { 2488 c := &ProjectsLocationsInstancesListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2489 c.parent = parent 2490 return c 2491} 2492 2493// PageSize sets the optional parameter "pageSize": The maximum number 2494// of items to return. If not specified, a default value of 1000 will be 2495// used by the service. Regardless of the page_size value, the response 2496// may include a partial list and a caller should only rely on 2497// response's `next_page_token` to determine if there are more instances 2498// left to be queried. 2499func (c *ProjectsLocationsInstancesListCall) PageSize(pageSize int64) *ProjectsLocationsInstancesListCall { 2500 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 2501 return c 2502} 2503 2504// PageToken sets the optional parameter "pageToken": The 2505// `next_page_token` value returned from a previous ListInstances 2506// request, if any. 2507func (c *ProjectsLocationsInstancesListCall) PageToken(pageToken string) *ProjectsLocationsInstancesListCall { 2508 c.urlParams_.Set("pageToken", pageToken) 2509 return c 2510} 2511 2512// Fields allows partial responses to be retrieved. See 2513// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2514// for more information. 2515func (c *ProjectsLocationsInstancesListCall) Fields(s ...googleapi.Field) *ProjectsLocationsInstancesListCall { 2516 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2517 return c 2518} 2519 2520// IfNoneMatch sets the optional parameter which makes the operation 2521// fail if the object's ETag matches the given value. This is useful for 2522// getting updates only after the object has changed since the last 2523// request. Use googleapi.IsNotModified to check whether the response 2524// error from Do is the result of In-None-Match. 2525func (c *ProjectsLocationsInstancesListCall) IfNoneMatch(entityTag string) *ProjectsLocationsInstancesListCall { 2526 c.ifNoneMatch_ = entityTag 2527 return c 2528} 2529 2530// Context sets the context to be used in this call's Do method. Any 2531// pending HTTP request will be aborted if the provided context is 2532// canceled. 2533func (c *ProjectsLocationsInstancesListCall) Context(ctx context.Context) *ProjectsLocationsInstancesListCall { 2534 c.ctx_ = ctx 2535 return c 2536} 2537 2538// Header returns an http.Header that can be modified by the caller to 2539// add HTTP headers to the request. 2540func (c *ProjectsLocationsInstancesListCall) Header() http.Header { 2541 if c.header_ == nil { 2542 c.header_ = make(http.Header) 2543 } 2544 return c.header_ 2545} 2546 2547func (c *ProjectsLocationsInstancesListCall) doRequest(alt string) (*http.Response, error) { 2548 reqHeaders := make(http.Header) 2549 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210502") 2550 for k, v := range c.header_ { 2551 reqHeaders[k] = v 2552 } 2553 reqHeaders.Set("User-Agent", c.s.userAgent()) 2554 if c.ifNoneMatch_ != "" { 2555 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 2556 } 2557 var body io.Reader = nil 2558 c.urlParams_.Set("alt", alt) 2559 c.urlParams_.Set("prettyPrint", "false") 2560 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/instances") 2561 urls += "?" + c.urlParams_.Encode() 2562 req, err := http.NewRequest("GET", urls, body) 2563 if err != nil { 2564 return nil, err 2565 } 2566 req.Header = reqHeaders 2567 googleapi.Expand(req.URL, map[string]string{ 2568 "parent": c.parent, 2569 }) 2570 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2571} 2572 2573// Do executes the "redis.projects.locations.instances.list" call. 2574// Exactly one of *ListInstancesResponse or error will be non-nil. Any 2575// non-2xx status code is an error. Response headers are in either 2576// *ListInstancesResponse.ServerResponse.Header or (if a response was 2577// returned at all) in error.(*googleapi.Error).Header. Use 2578// googleapi.IsNotModified to check whether the returned error was 2579// because http.StatusNotModified was returned. 2580func (c *ProjectsLocationsInstancesListCall) Do(opts ...googleapi.CallOption) (*ListInstancesResponse, error) { 2581 gensupport.SetOptions(c.urlParams_, opts...) 2582 res, err := c.doRequest("json") 2583 if res != nil && res.StatusCode == http.StatusNotModified { 2584 if res.Body != nil { 2585 res.Body.Close() 2586 } 2587 return nil, &googleapi.Error{ 2588 Code: res.StatusCode, 2589 Header: res.Header, 2590 } 2591 } 2592 if err != nil { 2593 return nil, err 2594 } 2595 defer googleapi.CloseBody(res) 2596 if err := googleapi.CheckResponse(res); err != nil { 2597 return nil, err 2598 } 2599 ret := &ListInstancesResponse{ 2600 ServerResponse: googleapi.ServerResponse{ 2601 Header: res.Header, 2602 HTTPStatusCode: res.StatusCode, 2603 }, 2604 } 2605 target := &ret 2606 if err := gensupport.DecodeResponse(target, res); err != nil { 2607 return nil, err 2608 } 2609 return ret, nil 2610 // { 2611 // "description": "Lists all Redis instances owned by a project in either the specified location (region) or all locations. The location should have the following format: * `projects/{project_id}/locations/{location_id}` If `location_id` is specified as `-` (wildcard), then all regions available to the project are queried, and the results are aggregated.", 2612 // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/instances", 2613 // "httpMethod": "GET", 2614 // "id": "redis.projects.locations.instances.list", 2615 // "parameterOrder": [ 2616 // "parent" 2617 // ], 2618 // "parameters": { 2619 // "pageSize": { 2620 // "description": "The maximum number of items to return. If not specified, a default value of 1000 will be used by the service. Regardless of the page_size value, the response may include a partial list and a caller should only rely on response's `next_page_token` to determine if there are more instances left to be queried.", 2621 // "format": "int32", 2622 // "location": "query", 2623 // "type": "integer" 2624 // }, 2625 // "pageToken": { 2626 // "description": "The `next_page_token` value returned from a previous ListInstances request, if any.", 2627 // "location": "query", 2628 // "type": "string" 2629 // }, 2630 // "parent": { 2631 // "description": "Required. The resource name of the instance location using the form: `projects/{project_id}/locations/{location_id}` where `location_id` refers to a GCP region.", 2632 // "location": "path", 2633 // "pattern": "^projects/[^/]+/locations/[^/]+$", 2634 // "required": true, 2635 // "type": "string" 2636 // } 2637 // }, 2638 // "path": "v1/{+parent}/instances", 2639 // "response": { 2640 // "$ref": "ListInstancesResponse" 2641 // }, 2642 // "scopes": [ 2643 // "https://www.googleapis.com/auth/cloud-platform" 2644 // ] 2645 // } 2646 2647} 2648 2649// Pages invokes f for each page of results. 2650// A non-nil error returned from f will halt the iteration. 2651// The provided context supersedes any context provided to the Context method. 2652func (c *ProjectsLocationsInstancesListCall) Pages(ctx context.Context, f func(*ListInstancesResponse) error) error { 2653 c.ctx_ = ctx 2654 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 2655 for { 2656 x, err := c.Do() 2657 if err != nil { 2658 return err 2659 } 2660 if err := f(x); err != nil { 2661 return err 2662 } 2663 if x.NextPageToken == "" { 2664 return nil 2665 } 2666 c.PageToken(x.NextPageToken) 2667 } 2668} 2669 2670// method id "redis.projects.locations.instances.patch": 2671 2672type ProjectsLocationsInstancesPatchCall struct { 2673 s *Service 2674 name string 2675 instance *Instance 2676 urlParams_ gensupport.URLParams 2677 ctx_ context.Context 2678 header_ http.Header 2679} 2680 2681// Patch: Updates the metadata and configuration of a specific Redis 2682// instance. Completed longrunning.Operation will contain the new 2683// instance object in the response field. The returned operation is 2684// automatically deleted after a few hours, so there is no need to call 2685// DeleteOperation. 2686// 2687// - name: Unique name of the resource in this scope including project 2688// and location using the form: 2689// `projects/{project_id}/locations/{location_id}/instances/{instance_i 2690// d}` Note: Redis instances are managed and addressed at regional 2691// level so location_id here refers to a GCP region; however, users 2692// may choose which specific zone (or collection of zones for 2693// cross-zone instances) an instance should be provisioned in. Refer 2694// to location_id and alternative_location_id fields for more details. 2695func (r *ProjectsLocationsInstancesService) Patch(name string, instance *Instance) *ProjectsLocationsInstancesPatchCall { 2696 c := &ProjectsLocationsInstancesPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2697 c.name = name 2698 c.instance = instance 2699 return c 2700} 2701 2702// UpdateMask sets the optional parameter "updateMask": Required. Mask 2703// of fields to update. At least one path must be supplied in this 2704// field. The elements of the repeated paths field may only include 2705// these fields from Instance: * `displayName` * `labels` * 2706// `memorySizeGb` * `redisConfig` 2707func (c *ProjectsLocationsInstancesPatchCall) UpdateMask(updateMask string) *ProjectsLocationsInstancesPatchCall { 2708 c.urlParams_.Set("updateMask", updateMask) 2709 return c 2710} 2711 2712// Fields allows partial responses to be retrieved. See 2713// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2714// for more information. 2715func (c *ProjectsLocationsInstancesPatchCall) Fields(s ...googleapi.Field) *ProjectsLocationsInstancesPatchCall { 2716 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2717 return c 2718} 2719 2720// Context sets the context to be used in this call's Do method. Any 2721// pending HTTP request will be aborted if the provided context is 2722// canceled. 2723func (c *ProjectsLocationsInstancesPatchCall) Context(ctx context.Context) *ProjectsLocationsInstancesPatchCall { 2724 c.ctx_ = ctx 2725 return c 2726} 2727 2728// Header returns an http.Header that can be modified by the caller to 2729// add HTTP headers to the request. 2730func (c *ProjectsLocationsInstancesPatchCall) Header() http.Header { 2731 if c.header_ == nil { 2732 c.header_ = make(http.Header) 2733 } 2734 return c.header_ 2735} 2736 2737func (c *ProjectsLocationsInstancesPatchCall) doRequest(alt string) (*http.Response, error) { 2738 reqHeaders := make(http.Header) 2739 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210502") 2740 for k, v := range c.header_ { 2741 reqHeaders[k] = v 2742 } 2743 reqHeaders.Set("User-Agent", c.s.userAgent()) 2744 var body io.Reader = nil 2745 body, err := googleapi.WithoutDataWrapper.JSONReader(c.instance) 2746 if err != nil { 2747 return nil, err 2748 } 2749 reqHeaders.Set("Content-Type", "application/json") 2750 c.urlParams_.Set("alt", alt) 2751 c.urlParams_.Set("prettyPrint", "false") 2752 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}") 2753 urls += "?" + c.urlParams_.Encode() 2754 req, err := http.NewRequest("PATCH", urls, body) 2755 if err != nil { 2756 return nil, err 2757 } 2758 req.Header = reqHeaders 2759 googleapi.Expand(req.URL, map[string]string{ 2760 "name": c.name, 2761 }) 2762 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2763} 2764 2765// Do executes the "redis.projects.locations.instances.patch" call. 2766// Exactly one of *Operation or error will be non-nil. Any non-2xx 2767// status code is an error. Response headers are in either 2768// *Operation.ServerResponse.Header or (if a response was returned at 2769// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 2770// to check whether the returned error was because 2771// http.StatusNotModified was returned. 2772func (c *ProjectsLocationsInstancesPatchCall) Do(opts ...googleapi.CallOption) (*Operation, error) { 2773 gensupport.SetOptions(c.urlParams_, opts...) 2774 res, err := c.doRequest("json") 2775 if res != nil && res.StatusCode == http.StatusNotModified { 2776 if res.Body != nil { 2777 res.Body.Close() 2778 } 2779 return nil, &googleapi.Error{ 2780 Code: res.StatusCode, 2781 Header: res.Header, 2782 } 2783 } 2784 if err != nil { 2785 return nil, err 2786 } 2787 defer googleapi.CloseBody(res) 2788 if err := googleapi.CheckResponse(res); err != nil { 2789 return nil, err 2790 } 2791 ret := &Operation{ 2792 ServerResponse: googleapi.ServerResponse{ 2793 Header: res.Header, 2794 HTTPStatusCode: res.StatusCode, 2795 }, 2796 } 2797 target := &ret 2798 if err := gensupport.DecodeResponse(target, res); err != nil { 2799 return nil, err 2800 } 2801 return ret, nil 2802 // { 2803 // "description": "Updates the metadata and configuration of a specific Redis instance. Completed longrunning.Operation will contain the new instance object in the response field. The returned operation is automatically deleted after a few hours, so there is no need to call DeleteOperation.", 2804 // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/instances/{instancesId}", 2805 // "httpMethod": "PATCH", 2806 // "id": "redis.projects.locations.instances.patch", 2807 // "parameterOrder": [ 2808 // "name" 2809 // ], 2810 // "parameters": { 2811 // "name": { 2812 // "description": "Required. Unique name of the resource in this scope including project and location using the form: `projects/{project_id}/locations/{location_id}/instances/{instance_id}` Note: Redis instances are managed and addressed at regional level so location_id here refers to a GCP region; however, users may choose which specific zone (or collection of zones for cross-zone instances) an instance should be provisioned in. Refer to location_id and alternative_location_id fields for more details.", 2813 // "location": "path", 2814 // "pattern": "^projects/[^/]+/locations/[^/]+/instances/[^/]+$", 2815 // "required": true, 2816 // "type": "string" 2817 // }, 2818 // "updateMask": { 2819 // "description": "Required. Mask of fields to update. At least one path must be supplied in this field. The elements of the repeated paths field may only include these fields from Instance: * `displayName` * `labels` * `memorySizeGb` * `redisConfig`", 2820 // "format": "google-fieldmask", 2821 // "location": "query", 2822 // "type": "string" 2823 // } 2824 // }, 2825 // "path": "v1/{+name}", 2826 // "request": { 2827 // "$ref": "Instance" 2828 // }, 2829 // "response": { 2830 // "$ref": "Operation" 2831 // }, 2832 // "scopes": [ 2833 // "https://www.googleapis.com/auth/cloud-platform" 2834 // ] 2835 // } 2836 2837} 2838 2839// method id "redis.projects.locations.instances.upgrade": 2840 2841type ProjectsLocationsInstancesUpgradeCall struct { 2842 s *Service 2843 name string 2844 upgradeinstancerequest *UpgradeInstanceRequest 2845 urlParams_ gensupport.URLParams 2846 ctx_ context.Context 2847 header_ http.Header 2848} 2849 2850// Upgrade: Upgrades Redis instance to the newer Redis version specified 2851// in the request. 2852// 2853// - name: Redis instance resource name using the form: 2854// `projects/{project_id}/locations/{location_id}/instances/{instance_i 2855// d}` where `location_id` refers to a GCP region. 2856func (r *ProjectsLocationsInstancesService) Upgrade(name string, upgradeinstancerequest *UpgradeInstanceRequest) *ProjectsLocationsInstancesUpgradeCall { 2857 c := &ProjectsLocationsInstancesUpgradeCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2858 c.name = name 2859 c.upgradeinstancerequest = upgradeinstancerequest 2860 return c 2861} 2862 2863// Fields allows partial responses to be retrieved. See 2864// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2865// for more information. 2866func (c *ProjectsLocationsInstancesUpgradeCall) Fields(s ...googleapi.Field) *ProjectsLocationsInstancesUpgradeCall { 2867 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2868 return c 2869} 2870 2871// Context sets the context to be used in this call's Do method. Any 2872// pending HTTP request will be aborted if the provided context is 2873// canceled. 2874func (c *ProjectsLocationsInstancesUpgradeCall) Context(ctx context.Context) *ProjectsLocationsInstancesUpgradeCall { 2875 c.ctx_ = ctx 2876 return c 2877} 2878 2879// Header returns an http.Header that can be modified by the caller to 2880// add HTTP headers to the request. 2881func (c *ProjectsLocationsInstancesUpgradeCall) Header() http.Header { 2882 if c.header_ == nil { 2883 c.header_ = make(http.Header) 2884 } 2885 return c.header_ 2886} 2887 2888func (c *ProjectsLocationsInstancesUpgradeCall) doRequest(alt string) (*http.Response, error) { 2889 reqHeaders := make(http.Header) 2890 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210502") 2891 for k, v := range c.header_ { 2892 reqHeaders[k] = v 2893 } 2894 reqHeaders.Set("User-Agent", c.s.userAgent()) 2895 var body io.Reader = nil 2896 body, err := googleapi.WithoutDataWrapper.JSONReader(c.upgradeinstancerequest) 2897 if err != nil { 2898 return nil, err 2899 } 2900 reqHeaders.Set("Content-Type", "application/json") 2901 c.urlParams_.Set("alt", alt) 2902 c.urlParams_.Set("prettyPrint", "false") 2903 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}:upgrade") 2904 urls += "?" + c.urlParams_.Encode() 2905 req, err := http.NewRequest("POST", urls, body) 2906 if err != nil { 2907 return nil, err 2908 } 2909 req.Header = reqHeaders 2910 googleapi.Expand(req.URL, map[string]string{ 2911 "name": c.name, 2912 }) 2913 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2914} 2915 2916// Do executes the "redis.projects.locations.instances.upgrade" call. 2917// Exactly one of *Operation or error will be non-nil. Any non-2xx 2918// status code is an error. Response headers are in either 2919// *Operation.ServerResponse.Header or (if a response was returned at 2920// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 2921// to check whether the returned error was because 2922// http.StatusNotModified was returned. 2923func (c *ProjectsLocationsInstancesUpgradeCall) Do(opts ...googleapi.CallOption) (*Operation, error) { 2924 gensupport.SetOptions(c.urlParams_, opts...) 2925 res, err := c.doRequest("json") 2926 if res != nil && res.StatusCode == http.StatusNotModified { 2927 if res.Body != nil { 2928 res.Body.Close() 2929 } 2930 return nil, &googleapi.Error{ 2931 Code: res.StatusCode, 2932 Header: res.Header, 2933 } 2934 } 2935 if err != nil { 2936 return nil, err 2937 } 2938 defer googleapi.CloseBody(res) 2939 if err := googleapi.CheckResponse(res); err != nil { 2940 return nil, err 2941 } 2942 ret := &Operation{ 2943 ServerResponse: googleapi.ServerResponse{ 2944 Header: res.Header, 2945 HTTPStatusCode: res.StatusCode, 2946 }, 2947 } 2948 target := &ret 2949 if err := gensupport.DecodeResponse(target, res); err != nil { 2950 return nil, err 2951 } 2952 return ret, nil 2953 // { 2954 // "description": "Upgrades Redis instance to the newer Redis version specified in the request.", 2955 // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/instances/{instancesId}:upgrade", 2956 // "httpMethod": "POST", 2957 // "id": "redis.projects.locations.instances.upgrade", 2958 // "parameterOrder": [ 2959 // "name" 2960 // ], 2961 // "parameters": { 2962 // "name": { 2963 // "description": "Required. Redis instance resource name using the form: `projects/{project_id}/locations/{location_id}/instances/{instance_id}` where `location_id` refers to a GCP region.", 2964 // "location": "path", 2965 // "pattern": "^projects/[^/]+/locations/[^/]+/instances/[^/]+$", 2966 // "required": true, 2967 // "type": "string" 2968 // } 2969 // }, 2970 // "path": "v1/{+name}:upgrade", 2971 // "request": { 2972 // "$ref": "UpgradeInstanceRequest" 2973 // }, 2974 // "response": { 2975 // "$ref": "Operation" 2976 // }, 2977 // "scopes": [ 2978 // "https://www.googleapis.com/auth/cloud-platform" 2979 // ] 2980 // } 2981 2982} 2983 2984// method id "redis.projects.locations.operations.cancel": 2985 2986type ProjectsLocationsOperationsCancelCall struct { 2987 s *Service 2988 name string 2989 urlParams_ gensupport.URLParams 2990 ctx_ context.Context 2991 header_ http.Header 2992} 2993 2994// Cancel: Starts asynchronous cancellation on a long-running operation. 2995// The server makes a best effort to cancel the operation, but success 2996// is not guaranteed. If the server doesn't support this method, it 2997// returns `google.rpc.Code.UNIMPLEMENTED`. Clients can use 2998// Operations.GetOperation or other methods to check whether the 2999// cancellation succeeded or whether the operation completed despite 3000// cancellation. On successful cancellation, the operation is not 3001// deleted; instead, it becomes an operation with an Operation.error 3002// value with a google.rpc.Status.code of 1, corresponding to 3003// `Code.CANCELLED`. 3004// 3005// - name: The name of the operation resource to be cancelled. 3006func (r *ProjectsLocationsOperationsService) Cancel(name string) *ProjectsLocationsOperationsCancelCall { 3007 c := &ProjectsLocationsOperationsCancelCall{s: r.s, urlParams_: make(gensupport.URLParams)} 3008 c.name = name 3009 return c 3010} 3011 3012// Fields allows partial responses to be retrieved. See 3013// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 3014// for more information. 3015func (c *ProjectsLocationsOperationsCancelCall) Fields(s ...googleapi.Field) *ProjectsLocationsOperationsCancelCall { 3016 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 3017 return c 3018} 3019 3020// Context sets the context to be used in this call's Do method. Any 3021// pending HTTP request will be aborted if the provided context is 3022// canceled. 3023func (c *ProjectsLocationsOperationsCancelCall) Context(ctx context.Context) *ProjectsLocationsOperationsCancelCall { 3024 c.ctx_ = ctx 3025 return c 3026} 3027 3028// Header returns an http.Header that can be modified by the caller to 3029// add HTTP headers to the request. 3030func (c *ProjectsLocationsOperationsCancelCall) Header() http.Header { 3031 if c.header_ == nil { 3032 c.header_ = make(http.Header) 3033 } 3034 return c.header_ 3035} 3036 3037func (c *ProjectsLocationsOperationsCancelCall) doRequest(alt string) (*http.Response, error) { 3038 reqHeaders := make(http.Header) 3039 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210502") 3040 for k, v := range c.header_ { 3041 reqHeaders[k] = v 3042 } 3043 reqHeaders.Set("User-Agent", c.s.userAgent()) 3044 var body io.Reader = nil 3045 c.urlParams_.Set("alt", alt) 3046 c.urlParams_.Set("prettyPrint", "false") 3047 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}:cancel") 3048 urls += "?" + c.urlParams_.Encode() 3049 req, err := http.NewRequest("POST", urls, body) 3050 if err != nil { 3051 return nil, err 3052 } 3053 req.Header = reqHeaders 3054 googleapi.Expand(req.URL, map[string]string{ 3055 "name": c.name, 3056 }) 3057 return gensupport.SendRequest(c.ctx_, c.s.client, req) 3058} 3059 3060// Do executes the "redis.projects.locations.operations.cancel" call. 3061// Exactly one of *Empty or error will be non-nil. Any non-2xx status 3062// code is an error. Response headers are in either 3063// *Empty.ServerResponse.Header or (if a response was returned at all) 3064// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 3065// check whether the returned error was because http.StatusNotModified 3066// was returned. 3067func (c *ProjectsLocationsOperationsCancelCall) Do(opts ...googleapi.CallOption) (*Empty, error) { 3068 gensupport.SetOptions(c.urlParams_, opts...) 3069 res, err := c.doRequest("json") 3070 if res != nil && res.StatusCode == http.StatusNotModified { 3071 if res.Body != nil { 3072 res.Body.Close() 3073 } 3074 return nil, &googleapi.Error{ 3075 Code: res.StatusCode, 3076 Header: res.Header, 3077 } 3078 } 3079 if err != nil { 3080 return nil, err 3081 } 3082 defer googleapi.CloseBody(res) 3083 if err := googleapi.CheckResponse(res); err != nil { 3084 return nil, err 3085 } 3086 ret := &Empty{ 3087 ServerResponse: googleapi.ServerResponse{ 3088 Header: res.Header, 3089 HTTPStatusCode: res.StatusCode, 3090 }, 3091 } 3092 target := &ret 3093 if err := gensupport.DecodeResponse(target, res); err != nil { 3094 return nil, err 3095 } 3096 return ret, nil 3097 // { 3098 // "description": "Starts asynchronous cancellation on a long-running operation. The server makes a best effort to cancel the operation, but success is not guaranteed. If the server doesn't support this method, it returns `google.rpc.Code.UNIMPLEMENTED`. Clients can use Operations.GetOperation or other methods to check whether the cancellation succeeded or whether the operation completed despite cancellation. On successful cancellation, the operation is not deleted; instead, it becomes an operation with an Operation.error value with a google.rpc.Status.code of 1, corresponding to `Code.CANCELLED`.", 3099 // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/operations/{operationsId}:cancel", 3100 // "httpMethod": "POST", 3101 // "id": "redis.projects.locations.operations.cancel", 3102 // "parameterOrder": [ 3103 // "name" 3104 // ], 3105 // "parameters": { 3106 // "name": { 3107 // "description": "The name of the operation resource to be cancelled.", 3108 // "location": "path", 3109 // "pattern": "^projects/[^/]+/locations/[^/]+/operations/[^/]+$", 3110 // "required": true, 3111 // "type": "string" 3112 // } 3113 // }, 3114 // "path": "v1/{+name}:cancel", 3115 // "response": { 3116 // "$ref": "Empty" 3117 // }, 3118 // "scopes": [ 3119 // "https://www.googleapis.com/auth/cloud-platform" 3120 // ] 3121 // } 3122 3123} 3124 3125// method id "redis.projects.locations.operations.delete": 3126 3127type ProjectsLocationsOperationsDeleteCall struct { 3128 s *Service 3129 name string 3130 urlParams_ gensupport.URLParams 3131 ctx_ context.Context 3132 header_ http.Header 3133} 3134 3135// Delete: Deletes a long-running operation. This method indicates that 3136// the client is no longer interested in the operation result. It does 3137// not cancel the operation. If the server doesn't support this method, 3138// it returns `google.rpc.Code.UNIMPLEMENTED`. 3139// 3140// - name: The name of the operation resource to be deleted. 3141func (r *ProjectsLocationsOperationsService) Delete(name string) *ProjectsLocationsOperationsDeleteCall { 3142 c := &ProjectsLocationsOperationsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 3143 c.name = name 3144 return c 3145} 3146 3147// Fields allows partial responses to be retrieved. See 3148// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 3149// for more information. 3150func (c *ProjectsLocationsOperationsDeleteCall) Fields(s ...googleapi.Field) *ProjectsLocationsOperationsDeleteCall { 3151 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 3152 return c 3153} 3154 3155// Context sets the context to be used in this call's Do method. Any 3156// pending HTTP request will be aborted if the provided context is 3157// canceled. 3158func (c *ProjectsLocationsOperationsDeleteCall) Context(ctx context.Context) *ProjectsLocationsOperationsDeleteCall { 3159 c.ctx_ = ctx 3160 return c 3161} 3162 3163// Header returns an http.Header that can be modified by the caller to 3164// add HTTP headers to the request. 3165func (c *ProjectsLocationsOperationsDeleteCall) Header() http.Header { 3166 if c.header_ == nil { 3167 c.header_ = make(http.Header) 3168 } 3169 return c.header_ 3170} 3171 3172func (c *ProjectsLocationsOperationsDeleteCall) doRequest(alt string) (*http.Response, error) { 3173 reqHeaders := make(http.Header) 3174 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210502") 3175 for k, v := range c.header_ { 3176 reqHeaders[k] = v 3177 } 3178 reqHeaders.Set("User-Agent", c.s.userAgent()) 3179 var body io.Reader = nil 3180 c.urlParams_.Set("alt", alt) 3181 c.urlParams_.Set("prettyPrint", "false") 3182 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}") 3183 urls += "?" + c.urlParams_.Encode() 3184 req, err := http.NewRequest("DELETE", urls, body) 3185 if err != nil { 3186 return nil, err 3187 } 3188 req.Header = reqHeaders 3189 googleapi.Expand(req.URL, map[string]string{ 3190 "name": c.name, 3191 }) 3192 return gensupport.SendRequest(c.ctx_, c.s.client, req) 3193} 3194 3195// Do executes the "redis.projects.locations.operations.delete" call. 3196// Exactly one of *Empty or error will be non-nil. Any non-2xx status 3197// code is an error. Response headers are in either 3198// *Empty.ServerResponse.Header or (if a response was returned at all) 3199// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 3200// check whether the returned error was because http.StatusNotModified 3201// was returned. 3202func (c *ProjectsLocationsOperationsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) { 3203 gensupport.SetOptions(c.urlParams_, opts...) 3204 res, err := c.doRequest("json") 3205 if res != nil && res.StatusCode == http.StatusNotModified { 3206 if res.Body != nil { 3207 res.Body.Close() 3208 } 3209 return nil, &googleapi.Error{ 3210 Code: res.StatusCode, 3211 Header: res.Header, 3212 } 3213 } 3214 if err != nil { 3215 return nil, err 3216 } 3217 defer googleapi.CloseBody(res) 3218 if err := googleapi.CheckResponse(res); err != nil { 3219 return nil, err 3220 } 3221 ret := &Empty{ 3222 ServerResponse: googleapi.ServerResponse{ 3223 Header: res.Header, 3224 HTTPStatusCode: res.StatusCode, 3225 }, 3226 } 3227 target := &ret 3228 if err := gensupport.DecodeResponse(target, res); err != nil { 3229 return nil, err 3230 } 3231 return ret, nil 3232 // { 3233 // "description": "Deletes a long-running operation. This method indicates that the client is no longer interested in the operation result. It does not cancel the operation. If the server doesn't support this method, it returns `google.rpc.Code.UNIMPLEMENTED`.", 3234 // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/operations/{operationsId}", 3235 // "httpMethod": "DELETE", 3236 // "id": "redis.projects.locations.operations.delete", 3237 // "parameterOrder": [ 3238 // "name" 3239 // ], 3240 // "parameters": { 3241 // "name": { 3242 // "description": "The name of the operation resource to be deleted.", 3243 // "location": "path", 3244 // "pattern": "^projects/[^/]+/locations/[^/]+/operations/[^/]+$", 3245 // "required": true, 3246 // "type": "string" 3247 // } 3248 // }, 3249 // "path": "v1/{+name}", 3250 // "response": { 3251 // "$ref": "Empty" 3252 // }, 3253 // "scopes": [ 3254 // "https://www.googleapis.com/auth/cloud-platform" 3255 // ] 3256 // } 3257 3258} 3259 3260// method id "redis.projects.locations.operations.get": 3261 3262type ProjectsLocationsOperationsGetCall struct { 3263 s *Service 3264 name string 3265 urlParams_ gensupport.URLParams 3266 ifNoneMatch_ string 3267 ctx_ context.Context 3268 header_ http.Header 3269} 3270 3271// Get: Gets the latest state of a long-running operation. Clients can 3272// use this method to poll the operation result at intervals as 3273// recommended by the API service. 3274// 3275// - name: The name of the operation resource. 3276func (r *ProjectsLocationsOperationsService) Get(name string) *ProjectsLocationsOperationsGetCall { 3277 c := &ProjectsLocationsOperationsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 3278 c.name = name 3279 return c 3280} 3281 3282// Fields allows partial responses to be retrieved. See 3283// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 3284// for more information. 3285func (c *ProjectsLocationsOperationsGetCall) Fields(s ...googleapi.Field) *ProjectsLocationsOperationsGetCall { 3286 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 3287 return c 3288} 3289 3290// IfNoneMatch sets the optional parameter which makes the operation 3291// fail if the object's ETag matches the given value. This is useful for 3292// getting updates only after the object has changed since the last 3293// request. Use googleapi.IsNotModified to check whether the response 3294// error from Do is the result of In-None-Match. 3295func (c *ProjectsLocationsOperationsGetCall) IfNoneMatch(entityTag string) *ProjectsLocationsOperationsGetCall { 3296 c.ifNoneMatch_ = entityTag 3297 return c 3298} 3299 3300// Context sets the context to be used in this call's Do method. Any 3301// pending HTTP request will be aborted if the provided context is 3302// canceled. 3303func (c *ProjectsLocationsOperationsGetCall) Context(ctx context.Context) *ProjectsLocationsOperationsGetCall { 3304 c.ctx_ = ctx 3305 return c 3306} 3307 3308// Header returns an http.Header that can be modified by the caller to 3309// add HTTP headers to the request. 3310func (c *ProjectsLocationsOperationsGetCall) Header() http.Header { 3311 if c.header_ == nil { 3312 c.header_ = make(http.Header) 3313 } 3314 return c.header_ 3315} 3316 3317func (c *ProjectsLocationsOperationsGetCall) doRequest(alt string) (*http.Response, error) { 3318 reqHeaders := make(http.Header) 3319 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210502") 3320 for k, v := range c.header_ { 3321 reqHeaders[k] = v 3322 } 3323 reqHeaders.Set("User-Agent", c.s.userAgent()) 3324 if c.ifNoneMatch_ != "" { 3325 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 3326 } 3327 var body io.Reader = nil 3328 c.urlParams_.Set("alt", alt) 3329 c.urlParams_.Set("prettyPrint", "false") 3330 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}") 3331 urls += "?" + c.urlParams_.Encode() 3332 req, err := http.NewRequest("GET", urls, body) 3333 if err != nil { 3334 return nil, err 3335 } 3336 req.Header = reqHeaders 3337 googleapi.Expand(req.URL, map[string]string{ 3338 "name": c.name, 3339 }) 3340 return gensupport.SendRequest(c.ctx_, c.s.client, req) 3341} 3342 3343// Do executes the "redis.projects.locations.operations.get" call. 3344// Exactly one of *Operation or error will be non-nil. Any non-2xx 3345// status code is an error. Response headers are in either 3346// *Operation.ServerResponse.Header or (if a response was returned at 3347// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 3348// to check whether the returned error was because 3349// http.StatusNotModified was returned. 3350func (c *ProjectsLocationsOperationsGetCall) Do(opts ...googleapi.CallOption) (*Operation, error) { 3351 gensupport.SetOptions(c.urlParams_, opts...) 3352 res, err := c.doRequest("json") 3353 if res != nil && res.StatusCode == http.StatusNotModified { 3354 if res.Body != nil { 3355 res.Body.Close() 3356 } 3357 return nil, &googleapi.Error{ 3358 Code: res.StatusCode, 3359 Header: res.Header, 3360 } 3361 } 3362 if err != nil { 3363 return nil, err 3364 } 3365 defer googleapi.CloseBody(res) 3366 if err := googleapi.CheckResponse(res); err != nil { 3367 return nil, err 3368 } 3369 ret := &Operation{ 3370 ServerResponse: googleapi.ServerResponse{ 3371 Header: res.Header, 3372 HTTPStatusCode: res.StatusCode, 3373 }, 3374 } 3375 target := &ret 3376 if err := gensupport.DecodeResponse(target, res); err != nil { 3377 return nil, err 3378 } 3379 return ret, nil 3380 // { 3381 // "description": "Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service.", 3382 // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/operations/{operationsId}", 3383 // "httpMethod": "GET", 3384 // "id": "redis.projects.locations.operations.get", 3385 // "parameterOrder": [ 3386 // "name" 3387 // ], 3388 // "parameters": { 3389 // "name": { 3390 // "description": "The name of the operation resource.", 3391 // "location": "path", 3392 // "pattern": "^projects/[^/]+/locations/[^/]+/operations/[^/]+$", 3393 // "required": true, 3394 // "type": "string" 3395 // } 3396 // }, 3397 // "path": "v1/{+name}", 3398 // "response": { 3399 // "$ref": "Operation" 3400 // }, 3401 // "scopes": [ 3402 // "https://www.googleapis.com/auth/cloud-platform" 3403 // ] 3404 // } 3405 3406} 3407 3408// method id "redis.projects.locations.operations.list": 3409 3410type ProjectsLocationsOperationsListCall struct { 3411 s *Service 3412 name string 3413 urlParams_ gensupport.URLParams 3414 ifNoneMatch_ string 3415 ctx_ context.Context 3416 header_ http.Header 3417} 3418 3419// List: Lists operations that match the specified filter in the 3420// request. If the server doesn't support this method, it returns 3421// `UNIMPLEMENTED`. NOTE: the `name` binding allows API services to 3422// override the binding to use different resource name schemes, such as 3423// `users/*/operations`. To override the binding, API services can add a 3424// binding such as "/v1/{name=users/*}/operations" to their service 3425// configuration. For backwards compatibility, the default name includes 3426// the operations collection id, however overriding users must ensure 3427// the name binding is the parent resource, without the operations 3428// collection id. 3429// 3430// - name: The name of the operation's parent resource. 3431func (r *ProjectsLocationsOperationsService) List(name string) *ProjectsLocationsOperationsListCall { 3432 c := &ProjectsLocationsOperationsListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 3433 c.name = name 3434 return c 3435} 3436 3437// Filter sets the optional parameter "filter": The standard list 3438// filter. 3439func (c *ProjectsLocationsOperationsListCall) Filter(filter string) *ProjectsLocationsOperationsListCall { 3440 c.urlParams_.Set("filter", filter) 3441 return c 3442} 3443 3444// PageSize sets the optional parameter "pageSize": The standard list 3445// page size. 3446func (c *ProjectsLocationsOperationsListCall) PageSize(pageSize int64) *ProjectsLocationsOperationsListCall { 3447 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 3448 return c 3449} 3450 3451// PageToken sets the optional parameter "pageToken": The standard list 3452// page token. 3453func (c *ProjectsLocationsOperationsListCall) PageToken(pageToken string) *ProjectsLocationsOperationsListCall { 3454 c.urlParams_.Set("pageToken", pageToken) 3455 return c 3456} 3457 3458// Fields allows partial responses to be retrieved. See 3459// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 3460// for more information. 3461func (c *ProjectsLocationsOperationsListCall) Fields(s ...googleapi.Field) *ProjectsLocationsOperationsListCall { 3462 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 3463 return c 3464} 3465 3466// IfNoneMatch sets the optional parameter which makes the operation 3467// fail if the object's ETag matches the given value. This is useful for 3468// getting updates only after the object has changed since the last 3469// request. Use googleapi.IsNotModified to check whether the response 3470// error from Do is the result of In-None-Match. 3471func (c *ProjectsLocationsOperationsListCall) IfNoneMatch(entityTag string) *ProjectsLocationsOperationsListCall { 3472 c.ifNoneMatch_ = entityTag 3473 return c 3474} 3475 3476// Context sets the context to be used in this call's Do method. Any 3477// pending HTTP request will be aborted if the provided context is 3478// canceled. 3479func (c *ProjectsLocationsOperationsListCall) Context(ctx context.Context) *ProjectsLocationsOperationsListCall { 3480 c.ctx_ = ctx 3481 return c 3482} 3483 3484// Header returns an http.Header that can be modified by the caller to 3485// add HTTP headers to the request. 3486func (c *ProjectsLocationsOperationsListCall) Header() http.Header { 3487 if c.header_ == nil { 3488 c.header_ = make(http.Header) 3489 } 3490 return c.header_ 3491} 3492 3493func (c *ProjectsLocationsOperationsListCall) doRequest(alt string) (*http.Response, error) { 3494 reqHeaders := make(http.Header) 3495 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210502") 3496 for k, v := range c.header_ { 3497 reqHeaders[k] = v 3498 } 3499 reqHeaders.Set("User-Agent", c.s.userAgent()) 3500 if c.ifNoneMatch_ != "" { 3501 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 3502 } 3503 var body io.Reader = nil 3504 c.urlParams_.Set("alt", alt) 3505 c.urlParams_.Set("prettyPrint", "false") 3506 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}/operations") 3507 urls += "?" + c.urlParams_.Encode() 3508 req, err := http.NewRequest("GET", urls, body) 3509 if err != nil { 3510 return nil, err 3511 } 3512 req.Header = reqHeaders 3513 googleapi.Expand(req.URL, map[string]string{ 3514 "name": c.name, 3515 }) 3516 return gensupport.SendRequest(c.ctx_, c.s.client, req) 3517} 3518 3519// Do executes the "redis.projects.locations.operations.list" call. 3520// Exactly one of *ListOperationsResponse or error will be non-nil. Any 3521// non-2xx status code is an error. Response headers are in either 3522// *ListOperationsResponse.ServerResponse.Header or (if a response was 3523// returned at all) in error.(*googleapi.Error).Header. Use 3524// googleapi.IsNotModified to check whether the returned error was 3525// because http.StatusNotModified was returned. 3526func (c *ProjectsLocationsOperationsListCall) Do(opts ...googleapi.CallOption) (*ListOperationsResponse, error) { 3527 gensupport.SetOptions(c.urlParams_, opts...) 3528 res, err := c.doRequest("json") 3529 if res != nil && res.StatusCode == http.StatusNotModified { 3530 if res.Body != nil { 3531 res.Body.Close() 3532 } 3533 return nil, &googleapi.Error{ 3534 Code: res.StatusCode, 3535 Header: res.Header, 3536 } 3537 } 3538 if err != nil { 3539 return nil, err 3540 } 3541 defer googleapi.CloseBody(res) 3542 if err := googleapi.CheckResponse(res); err != nil { 3543 return nil, err 3544 } 3545 ret := &ListOperationsResponse{ 3546 ServerResponse: googleapi.ServerResponse{ 3547 Header: res.Header, 3548 HTTPStatusCode: res.StatusCode, 3549 }, 3550 } 3551 target := &ret 3552 if err := gensupport.DecodeResponse(target, res); err != nil { 3553 return nil, err 3554 } 3555 return ret, nil 3556 // { 3557 // "description": "Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns `UNIMPLEMENTED`. NOTE: the `name` binding allows API services to override the binding to use different resource name schemes, such as `users/*/operations`. To override the binding, API services can add a binding such as `\"/v1/{name=users/*}/operations\"` to their service configuration. For backwards compatibility, the default name includes the operations collection id, however overriding users must ensure the name binding is the parent resource, without the operations collection id.", 3558 // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/operations", 3559 // "httpMethod": "GET", 3560 // "id": "redis.projects.locations.operations.list", 3561 // "parameterOrder": [ 3562 // "name" 3563 // ], 3564 // "parameters": { 3565 // "filter": { 3566 // "description": "The standard list filter.", 3567 // "location": "query", 3568 // "type": "string" 3569 // }, 3570 // "name": { 3571 // "description": "The name of the operation's parent resource.", 3572 // "location": "path", 3573 // "pattern": "^projects/[^/]+/locations/[^/]+$", 3574 // "required": true, 3575 // "type": "string" 3576 // }, 3577 // "pageSize": { 3578 // "description": "The standard list page size.", 3579 // "format": "int32", 3580 // "location": "query", 3581 // "type": "integer" 3582 // }, 3583 // "pageToken": { 3584 // "description": "The standard list page token.", 3585 // "location": "query", 3586 // "type": "string" 3587 // } 3588 // }, 3589 // "path": "v1/{+name}/operations", 3590 // "response": { 3591 // "$ref": "ListOperationsResponse" 3592 // }, 3593 // "scopes": [ 3594 // "https://www.googleapis.com/auth/cloud-platform" 3595 // ] 3596 // } 3597 3598} 3599 3600// Pages invokes f for each page of results. 3601// A non-nil error returned from f will halt the iteration. 3602// The provided context supersedes any context provided to the Context method. 3603func (c *ProjectsLocationsOperationsListCall) Pages(ctx context.Context, f func(*ListOperationsResponse) error) error { 3604 c.ctx_ = ctx 3605 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 3606 for { 3607 x, err := c.Do() 3608 if err != nil { 3609 return err 3610 } 3611 if err := f(x); err != nil { 3612 return err 3613 } 3614 if x.NextPageToken == "" { 3615 return nil 3616 } 3617 c.PageToken(x.NextPageToken) 3618 } 3619} 3620