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