1// Copyright 2019 Google LLC. 2// Use of this source code is governed by a BSD-style 3// license that can be found in the LICENSE file. 4 5// Code generated file. DO NOT EDIT. 6 7// Package sqladmin provides access to the Cloud SQL Admin API. 8// 9// For product documentation, see: https://cloud.google.com/sql/docs/reference/latest 10// 11// Creating a client 12// 13// Usage example: 14// 15// import "google.golang.org/api/sqladmin/v1beta4" 16// ... 17// ctx := context.Background() 18// sqladminService, err := sqladmin.NewService(ctx) 19// 20// In this example, Google Application Default Credentials are used for authentication. 21// 22// For information on how to create and obtain Application Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials. 23// 24// Other authentication options 25// 26// By default, all available scopes (see "Constants") are used to authenticate. To restrict scopes, use option.WithScopes: 27// 28// sqladminService, err := sqladmin.NewService(ctx, option.WithScopes(sqladmin.SqlserviceAdminScope)) 29// 30// To use an API key for authentication (note: some APIs do not support API keys), use option.WithAPIKey: 31// 32// sqladminService, err := sqladmin.NewService(ctx, option.WithAPIKey("AIza...")) 33// 34// To use an OAuth token (e.g., a user token obtained via a three-legged OAuth flow), use option.WithTokenSource: 35// 36// config := &oauth2.Config{...} 37// // ... 38// token, err := config.Exchange(ctx, ...) 39// sqladminService, err := sqladmin.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token))) 40// 41// See https://godoc.org/google.golang.org/api/option/ for details on options. 42package sqladmin // import "google.golang.org/api/sqladmin/v1beta4" 43 44import ( 45 "bytes" 46 "context" 47 "encoding/json" 48 "errors" 49 "fmt" 50 "io" 51 "net/http" 52 "net/url" 53 "strconv" 54 "strings" 55 56 gensupport "google.golang.org/api/gensupport" 57 googleapi "google.golang.org/api/googleapi" 58 option "google.golang.org/api/option" 59 htransport "google.golang.org/api/transport/http" 60) 61 62// Always reference these packages, just in case the auto-generated code 63// below doesn't. 64var _ = bytes.NewBuffer 65var _ = strconv.Itoa 66var _ = fmt.Sprintf 67var _ = json.NewDecoder 68var _ = io.Copy 69var _ = url.Parse 70var _ = gensupport.MarshalJSON 71var _ = googleapi.Version 72var _ = errors.New 73var _ = strings.Replace 74var _ = context.Canceled 75 76const apiId = "sqladmin:v1beta4" 77const apiName = "sqladmin" 78const apiVersion = "v1beta4" 79const basePath = "https://www.googleapis.com/sql/v1beta4/" 80 81// OAuth2 scopes used by this API. 82const ( 83 // View and manage your data across Google Cloud Platform services 84 CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platform" 85 86 // Manage your Google SQL Service instances 87 SqlserviceAdminScope = "https://www.googleapis.com/auth/sqlservice.admin" 88) 89 90// NewService creates a new Service. 91func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) { 92 scopesOption := option.WithScopes( 93 "https://www.googleapis.com/auth/cloud-platform", 94 "https://www.googleapis.com/auth/sqlservice.admin", 95 ) 96 // NOTE: prepend, so we don't override user-specified scopes. 97 opts = append([]option.ClientOption{scopesOption}, opts...) 98 client, endpoint, err := htransport.NewClient(ctx, opts...) 99 if err != nil { 100 return nil, err 101 } 102 s, err := New(client) 103 if err != nil { 104 return nil, err 105 } 106 if endpoint != "" { 107 s.BasePath = endpoint 108 } 109 return s, nil 110} 111 112// New creates a new Service. It uses the provided http.Client for requests. 113// 114// Deprecated: please use NewService instead. 115// To provide a custom HTTP client, use option.WithHTTPClient. 116// If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead. 117func New(client *http.Client) (*Service, error) { 118 if client == nil { 119 return nil, errors.New("client is nil") 120 } 121 s := &Service{client: client, BasePath: basePath} 122 s.BackupRuns = NewBackupRunsService(s) 123 s.Databases = NewDatabasesService(s) 124 s.Flags = NewFlagsService(s) 125 s.Instances = NewInstancesService(s) 126 s.Operations = NewOperationsService(s) 127 s.SslCerts = NewSslCertsService(s) 128 s.Tiers = NewTiersService(s) 129 s.Users = NewUsersService(s) 130 return s, nil 131} 132 133type Service struct { 134 client *http.Client 135 BasePath string // API endpoint base URL 136 UserAgent string // optional additional User-Agent fragment 137 138 BackupRuns *BackupRunsService 139 140 Databases *DatabasesService 141 142 Flags *FlagsService 143 144 Instances *InstancesService 145 146 Operations *OperationsService 147 148 SslCerts *SslCertsService 149 150 Tiers *TiersService 151 152 Users *UsersService 153} 154 155func (s *Service) userAgent() string { 156 if s.UserAgent == "" { 157 return googleapi.UserAgent 158 } 159 return googleapi.UserAgent + " " + s.UserAgent 160} 161 162func NewBackupRunsService(s *Service) *BackupRunsService { 163 rs := &BackupRunsService{s: s} 164 return rs 165} 166 167type BackupRunsService struct { 168 s *Service 169} 170 171func NewDatabasesService(s *Service) *DatabasesService { 172 rs := &DatabasesService{s: s} 173 return rs 174} 175 176type DatabasesService struct { 177 s *Service 178} 179 180func NewFlagsService(s *Service) *FlagsService { 181 rs := &FlagsService{s: s} 182 return rs 183} 184 185type FlagsService struct { 186 s *Service 187} 188 189func NewInstancesService(s *Service) *InstancesService { 190 rs := &InstancesService{s: s} 191 return rs 192} 193 194type InstancesService struct { 195 s *Service 196} 197 198func NewOperationsService(s *Service) *OperationsService { 199 rs := &OperationsService{s: s} 200 return rs 201} 202 203type OperationsService struct { 204 s *Service 205} 206 207func NewSslCertsService(s *Service) *SslCertsService { 208 rs := &SslCertsService{s: s} 209 return rs 210} 211 212type SslCertsService struct { 213 s *Service 214} 215 216func NewTiersService(s *Service) *TiersService { 217 rs := &TiersService{s: s} 218 return rs 219} 220 221type TiersService struct { 222 s *Service 223} 224 225func NewUsersService(s *Service) *UsersService { 226 rs := &UsersService{s: s} 227 return rs 228} 229 230type UsersService struct { 231 s *Service 232} 233 234// AclEntry: An entry for an Access Control list. 235type AclEntry struct { 236 // ExpirationTime: The time when this access control entry expires in 237 // RFC 3339 format, for example 2012-11-15T16:19:00.094Z. 238 ExpirationTime string `json:"expirationTime,omitempty"` 239 240 // Kind: This is always sql#aclEntry. 241 Kind string `json:"kind,omitempty"` 242 243 // Name: An optional label to identify this entry. 244 Name string `json:"name,omitempty"` 245 246 // Value: The whitelisted value for the access control list. 247 Value string `json:"value,omitempty"` 248 249 // ForceSendFields is a list of field names (e.g. "ExpirationTime") to 250 // unconditionally include in API requests. By default, fields with 251 // empty values are omitted from API requests. However, any non-pointer, 252 // non-interface field appearing in ForceSendFields will be sent to the 253 // server regardless of whether the field is empty or not. This may be 254 // used to include empty fields in Patch requests. 255 ForceSendFields []string `json:"-"` 256 257 // NullFields is a list of field names (e.g. "ExpirationTime") to 258 // include in API requests with the JSON null value. By default, fields 259 // with empty values are omitted from API requests. However, any field 260 // with an empty value appearing in NullFields will be sent to the 261 // server as null. It is an error if a field in this list has a 262 // non-empty value. This may be used to include null fields in Patch 263 // requests. 264 NullFields []string `json:"-"` 265} 266 267func (s *AclEntry) MarshalJSON() ([]byte, error) { 268 type NoMethod AclEntry 269 raw := NoMethod(*s) 270 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 271} 272 273// ApiWarning: An Admin API warning message. 274type ApiWarning struct { 275 // Code: Code to uniquely identify the warning type. 276 Code string `json:"code,omitempty"` 277 278 // Message: The warning message. 279 Message string `json:"message,omitempty"` 280 281 // ForceSendFields is a list of field names (e.g. "Code") to 282 // unconditionally include in API requests. By default, fields with 283 // empty values are omitted from API requests. However, any non-pointer, 284 // non-interface field appearing in ForceSendFields will be sent to the 285 // server regardless of whether the field is empty or not. This may be 286 // used to include empty fields in Patch requests. 287 ForceSendFields []string `json:"-"` 288 289 // NullFields is a list of field names (e.g. "Code") to include in API 290 // requests with the JSON null value. By default, fields with empty 291 // values are omitted from API requests. However, any field with an 292 // empty value appearing in NullFields will be sent to the server as 293 // null. It is an error if a field in this list has a non-empty value. 294 // This may be used to include null fields in Patch requests. 295 NullFields []string `json:"-"` 296} 297 298func (s *ApiWarning) MarshalJSON() ([]byte, error) { 299 type NoMethod ApiWarning 300 raw := NoMethod(*s) 301 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 302} 303 304// BackupConfiguration: Database instance backup configuration. 305type BackupConfiguration struct { 306 // BinaryLogEnabled: Whether binary log is enabled. If backup 307 // configuration is disabled, binary log must be disabled as well. 308 BinaryLogEnabled bool `json:"binaryLogEnabled,omitempty"` 309 310 // Enabled: Whether this configuration is enabled. 311 Enabled bool `json:"enabled,omitempty"` 312 313 // Kind: This is always sql#backupConfiguration. 314 Kind string `json:"kind,omitempty"` 315 316 // ReplicationLogArchivingEnabled: Reserved for future use. 317 ReplicationLogArchivingEnabled bool `json:"replicationLogArchivingEnabled,omitempty"` 318 319 // StartTime: Start time for the daily backup configuration in UTC 320 // timezone in the 24 hour format - HH:MM. 321 StartTime string `json:"startTime,omitempty"` 322 323 // ForceSendFields is a list of field names (e.g. "BinaryLogEnabled") to 324 // unconditionally include in API requests. By default, fields with 325 // empty values are omitted from API requests. However, any non-pointer, 326 // non-interface field appearing in ForceSendFields will be sent to the 327 // server regardless of whether the field is empty or not. This may be 328 // used to include empty fields in Patch requests. 329 ForceSendFields []string `json:"-"` 330 331 // NullFields is a list of field names (e.g. "BinaryLogEnabled") to 332 // include in API requests with the JSON null value. By default, fields 333 // with empty values are omitted from API requests. However, any field 334 // with an empty value appearing in NullFields will be sent to the 335 // server as null. It is an error if a field in this list has a 336 // non-empty value. This may be used to include null fields in Patch 337 // requests. 338 NullFields []string `json:"-"` 339} 340 341func (s *BackupConfiguration) MarshalJSON() ([]byte, error) { 342 type NoMethod BackupConfiguration 343 raw := NoMethod(*s) 344 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 345} 346 347// BackupRun: A BackupRun resource. 348type BackupRun struct { 349 // Description: The description of this run, only applicable to 350 // on-demand backups. 351 Description string `json:"description,omitempty"` 352 353 // EndTime: The time the backup operation completed in UTC timezone in 354 // RFC 3339 format, for example 2012-11-15T16:19:00.094Z. 355 EndTime string `json:"endTime,omitempty"` 356 357 // EnqueuedTime: The time the run was enqueued in UTC timezone in RFC 358 // 3339 format, for example 2012-11-15T16:19:00.094Z. 359 EnqueuedTime string `json:"enqueuedTime,omitempty"` 360 361 // Error: Information about why the backup operation failed. This is 362 // only present if the run has the FAILED status. 363 Error *OperationError `json:"error,omitempty"` 364 365 // Id: The identifier for this backup run. Unique only for a specific 366 // Cloud SQL instance. 367 Id int64 `json:"id,omitempty,string"` 368 369 // Instance: Name of the database instance. 370 Instance string `json:"instance,omitempty"` 371 372 // Kind: This is always sql#backupRun. 373 Kind string `json:"kind,omitempty"` 374 375 // SelfLink: The URI of this resource. 376 SelfLink string `json:"selfLink,omitempty"` 377 378 // StartTime: The time the backup operation actually started in UTC 379 // timezone in RFC 3339 format, for example 2012-11-15T16:19:00.094Z. 380 StartTime string `json:"startTime,omitempty"` 381 382 // Status: The status of this run. 383 Status string `json:"status,omitempty"` 384 385 // Type: The type of this run; can be either "AUTOMATED" or "ON_DEMAND". 386 Type string `json:"type,omitempty"` 387 388 // WindowStartTime: The start time of the backup window during which 389 // this the backup was attempted in RFC 3339 format, for example 390 // 2012-11-15T16:19:00.094Z. 391 WindowStartTime string `json:"windowStartTime,omitempty"` 392 393 // ServerResponse contains the HTTP response code and headers from the 394 // server. 395 googleapi.ServerResponse `json:"-"` 396 397 // ForceSendFields is a list of field names (e.g. "Description") to 398 // unconditionally include in API requests. By default, fields with 399 // empty values are omitted from API requests. However, any non-pointer, 400 // non-interface field appearing in ForceSendFields will be sent to the 401 // server regardless of whether the field is empty or not. This may be 402 // used to include empty fields in Patch requests. 403 ForceSendFields []string `json:"-"` 404 405 // NullFields is a list of field names (e.g. "Description") to include 406 // in API requests with the JSON null value. By default, fields with 407 // empty values are omitted from API requests. However, any field with 408 // an empty value appearing in NullFields will be sent to the server as 409 // null. It is an error if a field in this list has a non-empty value. 410 // This may be used to include null fields in Patch requests. 411 NullFields []string `json:"-"` 412} 413 414func (s *BackupRun) MarshalJSON() ([]byte, error) { 415 type NoMethod BackupRun 416 raw := NoMethod(*s) 417 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 418} 419 420// BackupRunsListResponse: Backup run list results. 421type BackupRunsListResponse struct { 422 // Items: A list of backup runs in reverse chronological order of the 423 // enqueued time. 424 Items []*BackupRun `json:"items,omitempty"` 425 426 // Kind: This is always sql#backupRunsList. 427 Kind string `json:"kind,omitempty"` 428 429 // NextPageToken: The continuation token, used to page through large 430 // result sets. Provide this value in a subsequent request to return the 431 // next page of results. 432 NextPageToken string `json:"nextPageToken,omitempty"` 433 434 // ServerResponse contains the HTTP response code and headers from the 435 // server. 436 googleapi.ServerResponse `json:"-"` 437 438 // ForceSendFields is a list of field names (e.g. "Items") to 439 // unconditionally include in API requests. By default, fields with 440 // empty values are omitted from API requests. However, any non-pointer, 441 // non-interface field appearing in ForceSendFields will be sent to the 442 // server regardless of whether the field is empty or not. This may be 443 // used to include empty fields in Patch requests. 444 ForceSendFields []string `json:"-"` 445 446 // NullFields is a list of field names (e.g. "Items") to include in API 447 // requests with the JSON null value. By default, fields with empty 448 // values are omitted from API requests. However, any field with an 449 // empty value appearing in NullFields will be sent to the server as 450 // null. It is an error if a field in this list has a non-empty value. 451 // This may be used to include null fields in Patch requests. 452 NullFields []string `json:"-"` 453} 454 455func (s *BackupRunsListResponse) MarshalJSON() ([]byte, error) { 456 type NoMethod BackupRunsListResponse 457 raw := NoMethod(*s) 458 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 459} 460 461// BinLogCoordinates: Binary log coordinates. 462type BinLogCoordinates struct { 463 // BinLogFileName: Name of the binary log file for a Cloud SQL instance. 464 BinLogFileName string `json:"binLogFileName,omitempty"` 465 466 // BinLogPosition: Position (offset) within the binary log file. 467 BinLogPosition int64 `json:"binLogPosition,omitempty,string"` 468 469 // Kind: This is always sql#binLogCoordinates. 470 Kind string `json:"kind,omitempty"` 471 472 // ForceSendFields is a list of field names (e.g. "BinLogFileName") to 473 // unconditionally include in API requests. By default, fields with 474 // empty values are omitted from API requests. However, any non-pointer, 475 // non-interface field appearing in ForceSendFields will be sent to the 476 // server regardless of whether the field is empty or not. This may be 477 // used to include empty fields in Patch requests. 478 ForceSendFields []string `json:"-"` 479 480 // NullFields is a list of field names (e.g. "BinLogFileName") to 481 // include in API requests with the JSON null value. By default, fields 482 // with empty values are omitted from API requests. However, any field 483 // with an empty value appearing in NullFields will be sent to the 484 // server as null. It is an error if a field in this list has a 485 // non-empty value. This may be used to include null fields in Patch 486 // requests. 487 NullFields []string `json:"-"` 488} 489 490func (s *BinLogCoordinates) MarshalJSON() ([]byte, error) { 491 type NoMethod BinLogCoordinates 492 raw := NoMethod(*s) 493 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 494} 495 496// CloneContext: Database instance clone context. 497type CloneContext struct { 498 // BinLogCoordinates: Binary log coordinates, if specified, identify the 499 // position up to which the source instance should be cloned. If not 500 // specified, the source instance is cloned up to the most recent binary 501 // log coordinates. 502 BinLogCoordinates *BinLogCoordinates `json:"binLogCoordinates,omitempty"` 503 504 // DestinationInstanceName: Name of the Cloud SQL instance to be created 505 // as a clone. 506 DestinationInstanceName string `json:"destinationInstanceName,omitempty"` 507 508 // Kind: This is always sql#cloneContext. 509 Kind string `json:"kind,omitempty"` 510 511 // PitrTimestampMs: Reserved for future use. 512 PitrTimestampMs int64 `json:"pitrTimestampMs,omitempty,string"` 513 514 // ForceSendFields is a list of field names (e.g. "BinLogCoordinates") 515 // to unconditionally include in API requests. By default, fields with 516 // empty values are omitted from API requests. However, any non-pointer, 517 // non-interface field appearing in ForceSendFields will be sent to the 518 // server regardless of whether the field is empty or not. This may be 519 // used to include empty fields in Patch requests. 520 ForceSendFields []string `json:"-"` 521 522 // NullFields is a list of field names (e.g. "BinLogCoordinates") to 523 // include in API requests with the JSON null value. By default, fields 524 // with empty values are omitted from API requests. However, any field 525 // with an empty value appearing in NullFields will be sent to the 526 // server as null. It is an error if a field in this list has a 527 // non-empty value. This may be used to include null fields in Patch 528 // requests. 529 NullFields []string `json:"-"` 530} 531 532func (s *CloneContext) MarshalJSON() ([]byte, error) { 533 type NoMethod CloneContext 534 raw := NoMethod(*s) 535 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 536} 537 538// Database: Represents a SQL database on the Cloud SQL instance. 539type Database struct { 540 // Charset: The MySQL charset value. 541 Charset string `json:"charset,omitempty"` 542 543 // Collation: The MySQL collation value. 544 Collation string `json:"collation,omitempty"` 545 546 // Etag: This field is deprecated and will be removed from a future 547 // version of the API. 548 Etag string `json:"etag,omitempty"` 549 550 // Instance: The name of the Cloud SQL instance. This does not include 551 // the project ID. 552 Instance string `json:"instance,omitempty"` 553 554 // Kind: This is always sql#database. 555 Kind string `json:"kind,omitempty"` 556 557 // Name: The name of the database in the Cloud SQL instance. This does 558 // not include the project ID or instance name. 559 Name string `json:"name,omitempty"` 560 561 // Project: The project ID of the project containing the Cloud SQL 562 // database. The Google apps domain is prefixed if applicable. 563 Project string `json:"project,omitempty"` 564 565 // SelfLink: The URI of this resource. 566 SelfLink string `json:"selfLink,omitempty"` 567 568 // ServerResponse contains the HTTP response code and headers from the 569 // server. 570 googleapi.ServerResponse `json:"-"` 571 572 // ForceSendFields is a list of field names (e.g. "Charset") to 573 // unconditionally include in API requests. By default, fields with 574 // empty values are omitted from API requests. However, any non-pointer, 575 // non-interface field appearing in ForceSendFields will be sent to the 576 // server regardless of whether the field is empty or not. This may be 577 // used to include empty fields in Patch requests. 578 ForceSendFields []string `json:"-"` 579 580 // NullFields is a list of field names (e.g. "Charset") to include in 581 // API requests with the JSON null value. By default, fields with empty 582 // values are omitted from API requests. However, any field with an 583 // empty value appearing in NullFields will be sent to the server as 584 // null. It is an error if a field in this list has a non-empty value. 585 // This may be used to include null fields in Patch requests. 586 NullFields []string `json:"-"` 587} 588 589func (s *Database) MarshalJSON() ([]byte, error) { 590 type NoMethod Database 591 raw := NoMethod(*s) 592 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 593} 594 595// DatabaseFlags: Database flags for Cloud SQL instances. 596type DatabaseFlags struct { 597 // Name: The name of the flag. These flags are passed at instance 598 // startup, so include both server options and system variables for 599 // MySQL. Flags should be specified with underscores, not hyphens. For 600 // more information, see Configuring Database Flags in the Cloud SQL 601 // documentation. 602 Name string `json:"name,omitempty"` 603 604 // Value: The value of the flag. Booleans should be set to on for true 605 // and off for false. This field must be omitted if the flag doesn't 606 // take a value. 607 Value string `json:"value,omitempty"` 608 609 // ForceSendFields is a list of field names (e.g. "Name") to 610 // unconditionally include in API requests. By default, fields with 611 // empty values are omitted from API requests. However, any non-pointer, 612 // non-interface field appearing in ForceSendFields will be sent to the 613 // server regardless of whether the field is empty or not. This may be 614 // used to include empty fields in Patch requests. 615 ForceSendFields []string `json:"-"` 616 617 // NullFields is a list of field names (e.g. "Name") to include in API 618 // requests with the JSON null value. By default, fields with empty 619 // values are omitted from API requests. However, any field with an 620 // empty value appearing in NullFields will be sent to the server as 621 // null. It is an error if a field in this list has a non-empty value. 622 // This may be used to include null fields in Patch requests. 623 NullFields []string `json:"-"` 624} 625 626func (s *DatabaseFlags) MarshalJSON() ([]byte, error) { 627 type NoMethod DatabaseFlags 628 raw := NoMethod(*s) 629 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 630} 631 632// DatabaseInstance: A Cloud SQL instance resource. 633type DatabaseInstance struct { 634 // BackendType: FIRST_GEN: First Generation instance. MySQL 635 // only. 636 // SECOND_GEN: Second Generation instance or PostgreSQL 637 // instance. 638 // EXTERNAL: A database server that is not managed by Google. 639 // This property is read-only; use the tier property in the settings 640 // object to determine the database type and Second or First Generation. 641 BackendType string `json:"backendType,omitempty"` 642 643 // ConnectionName: Connection name of the Cloud SQL instance used in 644 // connection strings. 645 ConnectionName string `json:"connectionName,omitempty"` 646 647 // CurrentDiskSize: The current disk usage of the instance in bytes. 648 // This property has been deprecated. Users should use the 649 // "cloudsql.googleapis.com/database/disk/bytes_used" metric in Cloud 650 // Monitoring API instead. Please see this announcement for details. 651 CurrentDiskSize int64 `json:"currentDiskSize,omitempty,string"` 652 653 // DatabaseVersion: The database engine type and version. The 654 // databaseVersion field can not be changed after instance creation. 655 // MySQL Second Generation instances: MYSQL_5_7 (default) or MYSQL_5_6. 656 // PostgreSQL instances: POSTGRES_9_6 (default) or POSTGRES_11 Beta. 657 // MySQL First Generation instances: MYSQL_5_6 (default) or MYSQL_5_5 658 DatabaseVersion string `json:"databaseVersion,omitempty"` 659 660 // DiskEncryptionConfiguration: Disk encryption configuration specific 661 // to an instance. Applies only to Second Generation instances. 662 DiskEncryptionConfiguration *DiskEncryptionConfiguration `json:"diskEncryptionConfiguration,omitempty"` 663 664 // DiskEncryptionStatus: Disk encryption status specific to an instance. 665 // Applies only to Second Generation instances. 666 DiskEncryptionStatus *DiskEncryptionStatus `json:"diskEncryptionStatus,omitempty"` 667 668 // Etag: This field is deprecated and will be removed from a future 669 // version of the API. Use the settings.settingsVersion field instead. 670 Etag string `json:"etag,omitempty"` 671 672 // FailoverReplica: The name and status of the failover replica. This 673 // property is applicable only to Second Generation instances. 674 FailoverReplica *DatabaseInstanceFailoverReplica `json:"failoverReplica,omitempty"` 675 676 // GceZone: The Compute Engine zone that the instance is currently 677 // serving from. This value could be different from the zone that was 678 // specified when the instance was created if the instance has failed 679 // over to its secondary zone. 680 GceZone string `json:"gceZone,omitempty"` 681 682 // InstanceType: The instance type. This can be one of the 683 // following. 684 // CLOUD_SQL_INSTANCE: A Cloud SQL instance that is not replicating from 685 // a master. 686 // ON_PREMISES_INSTANCE: An instance running on the customer's 687 // premises. 688 // READ_REPLICA_INSTANCE: A Cloud SQL instance configured as a 689 // read-replica. 690 InstanceType string `json:"instanceType,omitempty"` 691 692 // IpAddresses: The assigned IP addresses for the instance. 693 IpAddresses []*IpMapping `json:"ipAddresses,omitempty"` 694 695 // Ipv6Address: The IPv6 address assigned to the instance. This property 696 // is applicable only to First Generation instances. 697 Ipv6Address string `json:"ipv6Address,omitempty"` 698 699 // Kind: This is always sql#instance. 700 Kind string `json:"kind,omitempty"` 701 702 // MasterInstanceName: The name of the instance which will act as master 703 // in the replication setup. 704 MasterInstanceName string `json:"masterInstanceName,omitempty"` 705 706 // MaxDiskSize: The maximum disk size of the instance in bytes. 707 MaxDiskSize int64 `json:"maxDiskSize,omitempty,string"` 708 709 // Name: Name of the Cloud SQL instance. This does not include the 710 // project ID. 711 Name string `json:"name,omitempty"` 712 713 // OnPremisesConfiguration: Configuration specific to on-premises 714 // instances. 715 OnPremisesConfiguration *OnPremisesConfiguration `json:"onPremisesConfiguration,omitempty"` 716 717 // Project: The project ID of the project containing the Cloud SQL 718 // instance. The Google apps domain is prefixed if applicable. 719 Project string `json:"project,omitempty"` 720 721 // Region: The geographical region. Can be us-central (FIRST_GEN 722 // instances only), us-central1 (SECOND_GEN instances only), asia-east1 723 // or europe-west1. Defaults to us-central or us-central1 depending on 724 // the instance type (First Generation or Second Generation). The region 725 // can not be changed after instance creation. 726 Region string `json:"region,omitempty"` 727 728 // ReplicaConfiguration: Configuration specific to failover replicas and 729 // read replicas. 730 ReplicaConfiguration *ReplicaConfiguration `json:"replicaConfiguration,omitempty"` 731 732 // ReplicaNames: The replicas of the instance. 733 ReplicaNames []string `json:"replicaNames,omitempty"` 734 735 // RootPassword: Initial root password. Use only on creation. 736 RootPassword string `json:"rootPassword,omitempty"` 737 738 // SelfLink: The URI of this resource. 739 SelfLink string `json:"selfLink,omitempty"` 740 741 // ServerCaCert: SSL configuration. 742 ServerCaCert *SslCert `json:"serverCaCert,omitempty"` 743 744 // ServiceAccountEmailAddress: The service account email address 745 // assigned to the instance. This property is applicable only to Second 746 // Generation instances. 747 ServiceAccountEmailAddress string `json:"serviceAccountEmailAddress,omitempty"` 748 749 // Settings: The user settings. 750 Settings *Settings `json:"settings,omitempty"` 751 752 // State: The current serving state of the Cloud SQL instance. This can 753 // be one of the following. 754 // RUNNABLE: The instance is running, or is ready to run when 755 // accessed. 756 // SUSPENDED: The instance is not available, for example due to problems 757 // with billing. 758 // PENDING_CREATE: The instance is being created. 759 // MAINTENANCE: The instance is down for maintenance. 760 // FAILED: The instance creation failed. 761 // UNKNOWN_STATE: The state of the instance is unknown. 762 State string `json:"state,omitempty"` 763 764 // SuspensionReason: If the instance state is SUSPENDED, the reason for 765 // the suspension. 766 SuspensionReason []string `json:"suspensionReason,omitempty"` 767 768 // ServerResponse contains the HTTP response code and headers from the 769 // server. 770 googleapi.ServerResponse `json:"-"` 771 772 // ForceSendFields is a list of field names (e.g. "BackendType") to 773 // unconditionally include in API requests. By default, fields with 774 // empty values are omitted from API requests. However, any non-pointer, 775 // non-interface field appearing in ForceSendFields will be sent to the 776 // server regardless of whether the field is empty or not. This may be 777 // used to include empty fields in Patch requests. 778 ForceSendFields []string `json:"-"` 779 780 // NullFields is a list of field names (e.g. "BackendType") to include 781 // in API requests with the JSON null value. By default, fields with 782 // empty values are omitted from API requests. However, any field with 783 // an empty value appearing in NullFields will be sent to the server as 784 // null. It is an error if a field in this list has a non-empty value. 785 // This may be used to include null fields in Patch requests. 786 NullFields []string `json:"-"` 787} 788 789func (s *DatabaseInstance) MarshalJSON() ([]byte, error) { 790 type NoMethod DatabaseInstance 791 raw := NoMethod(*s) 792 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 793} 794 795// DatabaseInstanceFailoverReplica: The name and status of the failover 796// replica. This property is applicable only to Second Generation 797// instances. 798type DatabaseInstanceFailoverReplica struct { 799 // Available: The availability status of the failover replica. A false 800 // status indicates that the failover replica is out of sync. The master 801 // can only failover to the falover replica when the status is true. 802 Available bool `json:"available,omitempty"` 803 804 // Name: The name of the failover replica. If specified at instance 805 // creation, a failover replica is created for the instance. The name 806 // doesn't include the project ID. This property is applicable only to 807 // Second Generation instances. 808 Name string `json:"name,omitempty"` 809 810 // ForceSendFields is a list of field names (e.g. "Available") to 811 // unconditionally include in API requests. By default, fields with 812 // empty values are omitted from API requests. However, any non-pointer, 813 // non-interface field appearing in ForceSendFields will be sent to the 814 // server regardless of whether the field is empty or not. This may be 815 // used to include empty fields in Patch requests. 816 ForceSendFields []string `json:"-"` 817 818 // NullFields is a list of field names (e.g. "Available") to include in 819 // API requests with the JSON null value. By default, fields with empty 820 // values are omitted from API requests. However, any field with an 821 // empty value appearing in NullFields will be sent to the server as 822 // null. It is an error if a field in this list has a non-empty value. 823 // This may be used to include null fields in Patch requests. 824 NullFields []string `json:"-"` 825} 826 827func (s *DatabaseInstanceFailoverReplica) MarshalJSON() ([]byte, error) { 828 type NoMethod DatabaseInstanceFailoverReplica 829 raw := NoMethod(*s) 830 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 831} 832 833// DatabasesListResponse: Database list response. 834type DatabasesListResponse struct { 835 // Items: List of database resources in the instance. 836 Items []*Database `json:"items,omitempty"` 837 838 // Kind: This is always sql#databasesList. 839 Kind string `json:"kind,omitempty"` 840 841 // ServerResponse contains the HTTP response code and headers from the 842 // server. 843 googleapi.ServerResponse `json:"-"` 844 845 // ForceSendFields is a list of field names (e.g. "Items") to 846 // unconditionally include in API requests. By default, fields with 847 // empty values are omitted from API requests. However, any non-pointer, 848 // non-interface field appearing in ForceSendFields will be sent to the 849 // server regardless of whether the field is empty or not. This may be 850 // used to include empty fields in Patch requests. 851 ForceSendFields []string `json:"-"` 852 853 // NullFields is a list of field names (e.g. "Items") to include in API 854 // requests with the JSON null value. By default, fields with empty 855 // values are omitted from API requests. However, any field with an 856 // empty value appearing in NullFields will be sent to the server as 857 // null. It is an error if a field in this list has a non-empty value. 858 // This may be used to include null fields in Patch requests. 859 NullFields []string `json:"-"` 860} 861 862func (s *DatabasesListResponse) MarshalJSON() ([]byte, error) { 863 type NoMethod DatabasesListResponse 864 raw := NoMethod(*s) 865 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 866} 867 868// DemoteMasterConfiguration: Read-replica configuration for connecting 869// to the on-premises master. 870type DemoteMasterConfiguration struct { 871 // Kind: This is always sql#demoteMasterConfiguration. 872 Kind string `json:"kind,omitempty"` 873 874 // MysqlReplicaConfiguration: MySQL specific configuration when 875 // replicating from a MySQL on-premises master. Replication 876 // configuration information such as the username, password, 877 // certificates, and keys are not stored in the instance metadata. The 878 // configuration information is used only to set up the replication 879 // connection and is stored by MySQL in a file named master.info in the 880 // data directory. 881 MysqlReplicaConfiguration *DemoteMasterMySqlReplicaConfiguration `json:"mysqlReplicaConfiguration,omitempty"` 882 883 // ForceSendFields is a list of field names (e.g. "Kind") to 884 // unconditionally include in API requests. By default, fields with 885 // empty values are omitted from API requests. However, any non-pointer, 886 // non-interface field appearing in ForceSendFields will be sent to the 887 // server regardless of whether the field is empty or not. This may be 888 // used to include empty fields in Patch requests. 889 ForceSendFields []string `json:"-"` 890 891 // NullFields is a list of field names (e.g. "Kind") to include in API 892 // requests with the JSON null value. By default, fields with empty 893 // values are omitted from API requests. However, any field with an 894 // empty value appearing in NullFields will be sent to the server as 895 // null. It is an error if a field in this list has a non-empty value. 896 // This may be used to include null fields in Patch requests. 897 NullFields []string `json:"-"` 898} 899 900func (s *DemoteMasterConfiguration) MarshalJSON() ([]byte, error) { 901 type NoMethod DemoteMasterConfiguration 902 raw := NoMethod(*s) 903 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 904} 905 906// DemoteMasterContext: Database instance demote master context. 907type DemoteMasterContext struct { 908 // Kind: This is always sql#demoteMasterContext. 909 Kind string `json:"kind,omitempty"` 910 911 // MasterInstanceName: The name of the instance which will act as 912 // on-premises master in the replication setup. 913 MasterInstanceName string `json:"masterInstanceName,omitempty"` 914 915 // ReplicaConfiguration: Configuration specific to read-replicas 916 // replicating from the on-premises master. 917 ReplicaConfiguration *DemoteMasterConfiguration `json:"replicaConfiguration,omitempty"` 918 919 // VerifyGtidConsistency: Verify GTID consistency for demote operation. 920 // Default value: True. Second Generation instances only. Setting this 921 // flag to false enables you to bypass GTID consistency check between 922 // on-premises master and Cloud SQL instance during the demotion 923 // operation but also exposes you to the risk of future replication 924 // failures. Change the value only if you know the reason for the GTID 925 // divergence and are confident that doing so will not cause any 926 // replication issues. 927 VerifyGtidConsistency bool `json:"verifyGtidConsistency,omitempty"` 928 929 // ForceSendFields is a list of field names (e.g. "Kind") to 930 // unconditionally include in API requests. By default, fields with 931 // empty values are omitted from API requests. However, any non-pointer, 932 // non-interface field appearing in ForceSendFields will be sent to the 933 // server regardless of whether the field is empty or not. This may be 934 // used to include empty fields in Patch requests. 935 ForceSendFields []string `json:"-"` 936 937 // NullFields is a list of field names (e.g. "Kind") to include in API 938 // requests with the JSON null value. By default, fields with empty 939 // values are omitted from API requests. However, any field with an 940 // empty value appearing in NullFields will be sent to the server as 941 // null. It is an error if a field in this list has a non-empty value. 942 // This may be used to include null fields in Patch requests. 943 NullFields []string `json:"-"` 944} 945 946func (s *DemoteMasterContext) MarshalJSON() ([]byte, error) { 947 type NoMethod DemoteMasterContext 948 raw := NoMethod(*s) 949 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 950} 951 952// DemoteMasterMySqlReplicaConfiguration: Read-replica configuration 953// specific to MySQL databases. 954type DemoteMasterMySqlReplicaConfiguration struct { 955 // CaCertificate: PEM representation of the trusted CA's x509 956 // certificate. 957 CaCertificate string `json:"caCertificate,omitempty"` 958 959 // ClientCertificate: PEM representation of the slave's x509 960 // certificate. 961 ClientCertificate string `json:"clientCertificate,omitempty"` 962 963 // ClientKey: PEM representation of the slave's private key. The 964 // corresponsing public key is encoded in the client's certificate. The 965 // format of the slave's private key can be either PKCS #1 or PKCS #8. 966 ClientKey string `json:"clientKey,omitempty"` 967 968 // Kind: This is always sql#demoteMasterMysqlReplicaConfiguration. 969 Kind string `json:"kind,omitempty"` 970 971 // Password: The password for the replication connection. 972 Password string `json:"password,omitempty"` 973 974 // Username: The username for the replication connection. 975 Username string `json:"username,omitempty"` 976 977 // ForceSendFields is a list of field names (e.g. "CaCertificate") to 978 // unconditionally include in API requests. By default, fields with 979 // empty values are omitted from API requests. However, any non-pointer, 980 // non-interface field appearing in ForceSendFields will be sent to the 981 // server regardless of whether the field is empty or not. This may be 982 // used to include empty fields in Patch requests. 983 ForceSendFields []string `json:"-"` 984 985 // NullFields is a list of field names (e.g. "CaCertificate") to include 986 // in API requests with the JSON null value. By default, fields with 987 // empty values are omitted from API requests. However, any field with 988 // an empty value appearing in NullFields will be sent to the server as 989 // null. It is an error if a field in this list has a non-empty value. 990 // This may be used to include null fields in Patch requests. 991 NullFields []string `json:"-"` 992} 993 994func (s *DemoteMasterMySqlReplicaConfiguration) MarshalJSON() ([]byte, error) { 995 type NoMethod DemoteMasterMySqlReplicaConfiguration 996 raw := NoMethod(*s) 997 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 998} 999 1000// DiskEncryptionConfiguration: Disk encryption configuration. 1001type DiskEncryptionConfiguration struct { 1002 // Kind: This is always sql#diskEncryptionConfiguration. 1003 Kind string `json:"kind,omitempty"` 1004 1005 // KmsKeyName: KMS key resource name 1006 KmsKeyName string `json:"kmsKeyName,omitempty"` 1007 1008 // ForceSendFields is a list of field names (e.g. "Kind") to 1009 // unconditionally include in API requests. By default, fields with 1010 // empty values are omitted from API requests. However, any non-pointer, 1011 // non-interface field appearing in ForceSendFields will be sent to the 1012 // server regardless of whether the field is empty or not. This may be 1013 // used to include empty fields in Patch requests. 1014 ForceSendFields []string `json:"-"` 1015 1016 // NullFields is a list of field names (e.g. "Kind") to include in API 1017 // requests with the JSON null value. By default, fields with empty 1018 // values are omitted from API requests. However, any field with an 1019 // empty value appearing in NullFields will be sent to the server as 1020 // null. It is an error if a field in this list has a non-empty value. 1021 // This may be used to include null fields in Patch requests. 1022 NullFields []string `json:"-"` 1023} 1024 1025func (s *DiskEncryptionConfiguration) MarshalJSON() ([]byte, error) { 1026 type NoMethod DiskEncryptionConfiguration 1027 raw := NoMethod(*s) 1028 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1029} 1030 1031// DiskEncryptionStatus: Disk encryption status. 1032type DiskEncryptionStatus struct { 1033 // Kind: This is always sql#diskEncryptionStatus. 1034 Kind string `json:"kind,omitempty"` 1035 1036 // KmsKeyVersionName: KMS key version used to encrypt the Cloud SQL 1037 // instance disk 1038 KmsKeyVersionName string `json:"kmsKeyVersionName,omitempty"` 1039 1040 // ForceSendFields is a list of field names (e.g. "Kind") to 1041 // unconditionally include in API requests. By default, fields with 1042 // empty values are omitted from API requests. However, any non-pointer, 1043 // non-interface field appearing in ForceSendFields will be sent to the 1044 // server regardless of whether the field is empty or not. This may be 1045 // used to include empty fields in Patch requests. 1046 ForceSendFields []string `json:"-"` 1047 1048 // NullFields is a list of field names (e.g. "Kind") to include in API 1049 // requests with the JSON null value. By default, fields with empty 1050 // values are omitted from API requests. However, any field with an 1051 // empty value appearing in NullFields will be sent to the server as 1052 // null. It is an error if a field in this list has a non-empty value. 1053 // This may be used to include null fields in Patch requests. 1054 NullFields []string `json:"-"` 1055} 1056 1057func (s *DiskEncryptionStatus) MarshalJSON() ([]byte, error) { 1058 type NoMethod DiskEncryptionStatus 1059 raw := NoMethod(*s) 1060 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1061} 1062 1063// ExportContext: Database instance export context. 1064type ExportContext struct { 1065 // CsvExportOptions: Options for exporting data as CSV. 1066 CsvExportOptions *ExportContextCsvExportOptions `json:"csvExportOptions,omitempty"` 1067 1068 // Databases: Databases to be exported. 1069 // MySQL instances: If fileType is SQL and no database is specified, all 1070 // databases are exported, except for the mysql system database. If 1071 // fileType is CSV, you can specify one database, either by using this 1072 // property or by using the csvExportOptions.selectQuery property, which 1073 // takes precedence over this property. 1074 // PostgreSQL instances: Specify exactly one database to be exported. If 1075 // fileType is CSV, this database must match the database used in the 1076 // csvExportOptions.selectQuery property. 1077 Databases []string `json:"databases,omitempty"` 1078 1079 // FileType: The file type for the specified uri. 1080 // SQL: The file contains SQL statements. 1081 // CSV: The file contains CSV data. 1082 FileType string `json:"fileType,omitempty"` 1083 1084 // Kind: This is always sql#exportContext. 1085 Kind string `json:"kind,omitempty"` 1086 1087 // SqlExportOptions: Options for exporting data as SQL statements. 1088 SqlExportOptions *ExportContextSqlExportOptions `json:"sqlExportOptions,omitempty"` 1089 1090 // Uri: The path to the file in Google Cloud Storage where the export 1091 // will be stored. The URI is in the form gs://bucketName/fileName. If 1092 // the file already exists, the requests succeeds, but the operation 1093 // fails. If fileType is SQL and the filename ends with .gz, the 1094 // contents are compressed. 1095 Uri string `json:"uri,omitempty"` 1096 1097 // ForceSendFields is a list of field names (e.g. "CsvExportOptions") to 1098 // unconditionally include in API requests. By default, fields with 1099 // empty values are omitted from API requests. However, any non-pointer, 1100 // non-interface field appearing in ForceSendFields will be sent to the 1101 // server regardless of whether the field is empty or not. This may be 1102 // used to include empty fields in Patch requests. 1103 ForceSendFields []string `json:"-"` 1104 1105 // NullFields is a list of field names (e.g. "CsvExportOptions") to 1106 // include in API requests with the JSON null value. By default, fields 1107 // with empty values are omitted from API requests. However, any field 1108 // with an empty value appearing in NullFields will be sent to the 1109 // server as null. It is an error if a field in this list has a 1110 // non-empty value. This may be used to include null fields in Patch 1111 // requests. 1112 NullFields []string `json:"-"` 1113} 1114 1115func (s *ExportContext) MarshalJSON() ([]byte, error) { 1116 type NoMethod ExportContext 1117 raw := NoMethod(*s) 1118 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1119} 1120 1121// ExportContextCsvExportOptions: Options for exporting data as CSV. 1122type ExportContextCsvExportOptions struct { 1123 // SelectQuery: The select query used to extract the data. 1124 SelectQuery string `json:"selectQuery,omitempty"` 1125 1126 // ForceSendFields is a list of field names (e.g. "SelectQuery") to 1127 // unconditionally include in API requests. By default, fields with 1128 // empty values are omitted from API requests. However, any non-pointer, 1129 // non-interface field appearing in ForceSendFields will be sent to the 1130 // server regardless of whether the field is empty or not. This may be 1131 // used to include empty fields in Patch requests. 1132 ForceSendFields []string `json:"-"` 1133 1134 // NullFields is a list of field names (e.g. "SelectQuery") to include 1135 // in API requests with the JSON null value. By default, fields with 1136 // empty values are omitted from API requests. However, any field with 1137 // an empty value appearing in NullFields will be sent to the server as 1138 // null. It is an error if a field in this list has a non-empty value. 1139 // This may be used to include null fields in Patch requests. 1140 NullFields []string `json:"-"` 1141} 1142 1143func (s *ExportContextCsvExportOptions) MarshalJSON() ([]byte, error) { 1144 type NoMethod ExportContextCsvExportOptions 1145 raw := NoMethod(*s) 1146 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1147} 1148 1149// ExportContextSqlExportOptions: Options for exporting data as SQL 1150// statements. 1151type ExportContextSqlExportOptions struct { 1152 // MysqlExportOptions: Options for exporting from MySQL. 1153 MysqlExportOptions *ExportContextSqlExportOptionsMysqlExportOptions `json:"mysqlExportOptions,omitempty"` 1154 1155 // SchemaOnly: Export only schemas. 1156 SchemaOnly bool `json:"schemaOnly,omitempty"` 1157 1158 // Tables: Tables to export, or that were exported, from the specified 1159 // database. If you specify tables, specify one and only one database. 1160 // For PostgreSQL instances, you can specify only one table. 1161 Tables []string `json:"tables,omitempty"` 1162 1163 // ForceSendFields is a list of field names (e.g. "MysqlExportOptions") 1164 // to unconditionally include in API requests. By default, fields with 1165 // empty values are omitted from API requests. However, any non-pointer, 1166 // non-interface field appearing in ForceSendFields will be sent to the 1167 // server regardless of whether the field is empty or not. This may be 1168 // used to include empty fields in Patch requests. 1169 ForceSendFields []string `json:"-"` 1170 1171 // NullFields is a list of field names (e.g. "MysqlExportOptions") to 1172 // include in API requests with the JSON null value. By default, fields 1173 // with empty values are omitted from API requests. However, any field 1174 // with an empty value appearing in NullFields will be sent to the 1175 // server as null. It is an error if a field in this list has a 1176 // non-empty value. This may be used to include null fields in Patch 1177 // requests. 1178 NullFields []string `json:"-"` 1179} 1180 1181func (s *ExportContextSqlExportOptions) MarshalJSON() ([]byte, error) { 1182 type NoMethod ExportContextSqlExportOptions 1183 raw := NoMethod(*s) 1184 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1185} 1186 1187// ExportContextSqlExportOptionsMysqlExportOptions: Options for 1188// exporting from MySQL. 1189type ExportContextSqlExportOptionsMysqlExportOptions struct { 1190 // MasterData: Option to include SQL statement required to set up 1191 // replication. If set to 1, the dump file includes a CHANGE MASTER TO 1192 // statement with the binary log coordinates. If set to 2, the CHANGE 1193 // MASTER TO statement is written as a SQL comment, and has no effect. 1194 // All other values are ignored. 1195 MasterData int64 `json:"masterData,omitempty"` 1196 1197 // ForceSendFields is a list of field names (e.g. "MasterData") to 1198 // unconditionally include in API requests. By default, fields with 1199 // empty values are omitted from API requests. However, any non-pointer, 1200 // non-interface field appearing in ForceSendFields will be sent to the 1201 // server regardless of whether the field is empty or not. This may be 1202 // used to include empty fields in Patch requests. 1203 ForceSendFields []string `json:"-"` 1204 1205 // NullFields is a list of field names (e.g. "MasterData") to include in 1206 // API requests with the JSON null value. By default, fields with empty 1207 // values are omitted from API requests. However, any field with an 1208 // empty value appearing in NullFields will be sent to the server as 1209 // null. It is an error if a field in this list has a non-empty value. 1210 // This may be used to include null fields in Patch requests. 1211 NullFields []string `json:"-"` 1212} 1213 1214func (s *ExportContextSqlExportOptionsMysqlExportOptions) MarshalJSON() ([]byte, error) { 1215 type NoMethod ExportContextSqlExportOptionsMysqlExportOptions 1216 raw := NoMethod(*s) 1217 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1218} 1219 1220// FailoverContext: Database instance failover context. 1221type FailoverContext struct { 1222 // Kind: This is always sql#failoverContext. 1223 Kind string `json:"kind,omitempty"` 1224 1225 // SettingsVersion: The current settings version of this instance. 1226 // Request will be rejected if this version doesn't match the current 1227 // settings version. 1228 SettingsVersion int64 `json:"settingsVersion,omitempty,string"` 1229 1230 // ForceSendFields is a list of field names (e.g. "Kind") to 1231 // unconditionally include in API requests. By default, fields with 1232 // empty values are omitted from API requests. However, any non-pointer, 1233 // non-interface field appearing in ForceSendFields will be sent to the 1234 // server regardless of whether the field is empty or not. This may be 1235 // used to include empty fields in Patch requests. 1236 ForceSendFields []string `json:"-"` 1237 1238 // NullFields is a list of field names (e.g. "Kind") to include in API 1239 // requests with the JSON null value. By default, fields with empty 1240 // values are omitted from API requests. However, any field with an 1241 // empty value appearing in NullFields will be sent to the server as 1242 // null. It is an error if a field in this list has a non-empty value. 1243 // This may be used to include null fields in Patch requests. 1244 NullFields []string `json:"-"` 1245} 1246 1247func (s *FailoverContext) MarshalJSON() ([]byte, error) { 1248 type NoMethod FailoverContext 1249 raw := NoMethod(*s) 1250 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1251} 1252 1253// Flag: A flag resource. 1254type Flag struct { 1255 // AllowedStringValues: For STRING flags, a list of strings that the 1256 // value can be set to. 1257 AllowedStringValues []string `json:"allowedStringValues,omitempty"` 1258 1259 // AppliesTo: The database version this flag applies to. Can be 1260 // MYSQL_5_5, MYSQL_5_6, or MYSQL_5_7. MYSQL_5_7 is applicable only to 1261 // Second Generation instances. 1262 AppliesTo []string `json:"appliesTo,omitempty"` 1263 1264 // InBeta: True if the flag is only released in Beta. 1265 InBeta bool `json:"inBeta,omitempty"` 1266 1267 // Kind: This is always sql#flag. 1268 Kind string `json:"kind,omitempty"` 1269 1270 // MaxValue: For INTEGER flags, the maximum allowed value. 1271 MaxValue int64 `json:"maxValue,omitempty,string"` 1272 1273 // MinValue: For INTEGER flags, the minimum allowed value. 1274 MinValue int64 `json:"minValue,omitempty,string"` 1275 1276 // Name: This is the name of the flag. Flag names always use 1277 // underscores, not hyphens, e.g. max_allowed_packet 1278 Name string `json:"name,omitempty"` 1279 1280 // RequiresRestart: Indicates whether changing this flag will trigger a 1281 // database restart. Only applicable to Second Generation instances. 1282 RequiresRestart bool `json:"requiresRestart,omitempty"` 1283 1284 // Type: The type of the flag. Flags are typed to being BOOLEAN, STRING, 1285 // INTEGER or NONE. NONE is used for flags which do not take a value, 1286 // such as skip_grant_tables. 1287 Type string `json:"type,omitempty"` 1288 1289 // ForceSendFields is a list of field names (e.g. "AllowedStringValues") 1290 // to unconditionally include in API requests. By default, fields with 1291 // empty values are omitted from API requests. However, any non-pointer, 1292 // non-interface field appearing in ForceSendFields will be sent to the 1293 // server regardless of whether the field is empty or not. This may be 1294 // used to include empty fields in Patch requests. 1295 ForceSendFields []string `json:"-"` 1296 1297 // NullFields is a list of field names (e.g. "AllowedStringValues") to 1298 // include in API requests with the JSON null value. By default, fields 1299 // with empty values are omitted from API requests. However, any field 1300 // with an empty value appearing in NullFields will be sent to the 1301 // server as null. It is an error if a field in this list has a 1302 // non-empty value. This may be used to include null fields in Patch 1303 // requests. 1304 NullFields []string `json:"-"` 1305} 1306 1307func (s *Flag) MarshalJSON() ([]byte, error) { 1308 type NoMethod Flag 1309 raw := NoMethod(*s) 1310 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1311} 1312 1313// FlagsListResponse: Flags list response. 1314type FlagsListResponse struct { 1315 // Items: List of flags. 1316 Items []*Flag `json:"items,omitempty"` 1317 1318 // Kind: This is always sql#flagsList. 1319 Kind string `json:"kind,omitempty"` 1320 1321 // ServerResponse contains the HTTP response code and headers from the 1322 // server. 1323 googleapi.ServerResponse `json:"-"` 1324 1325 // ForceSendFields is a list of field names (e.g. "Items") to 1326 // unconditionally include in API requests. By default, fields with 1327 // empty values are omitted from API requests. However, any non-pointer, 1328 // non-interface field appearing in ForceSendFields will be sent to the 1329 // server regardless of whether the field is empty or not. This may be 1330 // used to include empty fields in Patch requests. 1331 ForceSendFields []string `json:"-"` 1332 1333 // NullFields is a list of field names (e.g. "Items") to include in API 1334 // requests with the JSON null value. By default, fields with empty 1335 // values are omitted from API requests. However, any field with an 1336 // empty value appearing in NullFields will be sent to the server as 1337 // null. It is an error if a field in this list has a non-empty value. 1338 // This may be used to include null fields in Patch requests. 1339 NullFields []string `json:"-"` 1340} 1341 1342func (s *FlagsListResponse) MarshalJSON() ([]byte, error) { 1343 type NoMethod FlagsListResponse 1344 raw := NoMethod(*s) 1345 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1346} 1347 1348// ImportContext: Database instance import context. 1349type ImportContext struct { 1350 // CsvImportOptions: Options for importing data as CSV. 1351 CsvImportOptions *ImportContextCsvImportOptions `json:"csvImportOptions,omitempty"` 1352 1353 // Database: The target database for the import. If fileType is SQL, 1354 // this field is required only if the import file does not specify a 1355 // database, and is overridden by any database specification in the 1356 // import file. If fileType is CSV, one database must be specified. 1357 Database string `json:"database,omitempty"` 1358 1359 // FileType: The file type for the specified uri. 1360 // SQL: The file contains SQL statements. 1361 // CSV: The file contains CSV data. 1362 FileType string `json:"fileType,omitempty"` 1363 1364 // ImportUser: The PostgreSQL user for this import operation. PostgreSQL 1365 // instances only. 1366 ImportUser string `json:"importUser,omitempty"` 1367 1368 // Kind: This is always sql#importContext. 1369 Kind string `json:"kind,omitempty"` 1370 1371 // Uri: Path to the import file in Cloud Storage, in the form 1372 // gs://bucketName/fileName. Compressed gzip files (.gz) are supported 1373 // when fileType is SQL. The instance must have write permissions to the 1374 // bucket and read access to the file. 1375 Uri string `json:"uri,omitempty"` 1376 1377 // ForceSendFields is a list of field names (e.g. "CsvImportOptions") to 1378 // unconditionally include in API requests. By default, fields with 1379 // empty values are omitted from API requests. However, any non-pointer, 1380 // non-interface field appearing in ForceSendFields will be sent to the 1381 // server regardless of whether the field is empty or not. This may be 1382 // used to include empty fields in Patch requests. 1383 ForceSendFields []string `json:"-"` 1384 1385 // NullFields is a list of field names (e.g. "CsvImportOptions") to 1386 // include in API requests with the JSON null value. By default, fields 1387 // with empty values are omitted from API requests. However, any field 1388 // with an empty value appearing in NullFields will be sent to the 1389 // server as null. It is an error if a field in this list has a 1390 // non-empty value. This may be used to include null fields in Patch 1391 // requests. 1392 NullFields []string `json:"-"` 1393} 1394 1395func (s *ImportContext) MarshalJSON() ([]byte, error) { 1396 type NoMethod ImportContext 1397 raw := NoMethod(*s) 1398 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1399} 1400 1401// ImportContextCsvImportOptions: Options for importing data as CSV. 1402type ImportContextCsvImportOptions struct { 1403 // Columns: The columns to which CSV data is imported. If not specified, 1404 // all columns of the database table are loaded with CSV data. 1405 Columns []string `json:"columns,omitempty"` 1406 1407 // Table: The table to which CSV data is imported. 1408 Table string `json:"table,omitempty"` 1409 1410 // ForceSendFields is a list of field names (e.g. "Columns") to 1411 // unconditionally include in API requests. By default, fields with 1412 // empty values are omitted from API requests. However, any non-pointer, 1413 // non-interface field appearing in ForceSendFields will be sent to the 1414 // server regardless of whether the field is empty or not. This may be 1415 // used to include empty fields in Patch requests. 1416 ForceSendFields []string `json:"-"` 1417 1418 // NullFields is a list of field names (e.g. "Columns") to include in 1419 // API requests with the JSON null value. By default, fields with empty 1420 // values are omitted from API requests. However, any field with an 1421 // empty value appearing in NullFields will be sent to the server as 1422 // null. It is an error if a field in this list has a non-empty value. 1423 // This may be used to include null fields in Patch requests. 1424 NullFields []string `json:"-"` 1425} 1426 1427func (s *ImportContextCsvImportOptions) MarshalJSON() ([]byte, error) { 1428 type NoMethod ImportContextCsvImportOptions 1429 raw := NoMethod(*s) 1430 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1431} 1432 1433// InstancesCloneRequest: Database instance clone request. 1434type InstancesCloneRequest struct { 1435 // CloneContext: Contains details about the clone operation. 1436 CloneContext *CloneContext `json:"cloneContext,omitempty"` 1437 1438 // ForceSendFields is a list of field names (e.g. "CloneContext") to 1439 // unconditionally include in API requests. By default, fields with 1440 // empty values are omitted from API requests. However, any non-pointer, 1441 // non-interface field appearing in ForceSendFields will be sent to the 1442 // server regardless of whether the field is empty or not. This may be 1443 // used to include empty fields in Patch requests. 1444 ForceSendFields []string `json:"-"` 1445 1446 // NullFields is a list of field names (e.g. "CloneContext") to include 1447 // in API requests with the JSON null value. By default, fields with 1448 // empty values are omitted from API requests. However, any field with 1449 // an empty value appearing in NullFields will be sent to the server as 1450 // null. It is an error if a field in this list has a non-empty value. 1451 // This may be used to include null fields in Patch requests. 1452 NullFields []string `json:"-"` 1453} 1454 1455func (s *InstancesCloneRequest) MarshalJSON() ([]byte, error) { 1456 type NoMethod InstancesCloneRequest 1457 raw := NoMethod(*s) 1458 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1459} 1460 1461// InstancesDemoteMasterRequest: Database demote master request. 1462type InstancesDemoteMasterRequest struct { 1463 // DemoteMasterContext: Contains details about the demoteMaster 1464 // operation. 1465 DemoteMasterContext *DemoteMasterContext `json:"demoteMasterContext,omitempty"` 1466 1467 // ForceSendFields is a list of field names (e.g. "DemoteMasterContext") 1468 // to unconditionally include in API requests. By default, fields with 1469 // empty values are omitted from API requests. However, any non-pointer, 1470 // non-interface field appearing in ForceSendFields will be sent to the 1471 // server regardless of whether the field is empty or not. This may be 1472 // used to include empty fields in Patch requests. 1473 ForceSendFields []string `json:"-"` 1474 1475 // NullFields is a list of field names (e.g. "DemoteMasterContext") to 1476 // include in API requests with the JSON null value. By default, fields 1477 // with empty values are omitted from API requests. However, any field 1478 // with an empty value appearing in NullFields will be sent to the 1479 // server as null. It is an error if a field in this list has a 1480 // non-empty value. This may be used to include null fields in Patch 1481 // requests. 1482 NullFields []string `json:"-"` 1483} 1484 1485func (s *InstancesDemoteMasterRequest) MarshalJSON() ([]byte, error) { 1486 type NoMethod InstancesDemoteMasterRequest 1487 raw := NoMethod(*s) 1488 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1489} 1490 1491// InstancesExportRequest: Database instance export request. 1492type InstancesExportRequest struct { 1493 // ExportContext: Contains details about the export operation. 1494 ExportContext *ExportContext `json:"exportContext,omitempty"` 1495 1496 // ForceSendFields is a list of field names (e.g. "ExportContext") to 1497 // unconditionally include in API requests. By default, fields with 1498 // empty values are omitted from API requests. However, any non-pointer, 1499 // non-interface field appearing in ForceSendFields will be sent to the 1500 // server regardless of whether the field is empty or not. This may be 1501 // used to include empty fields in Patch requests. 1502 ForceSendFields []string `json:"-"` 1503 1504 // NullFields is a list of field names (e.g. "ExportContext") to include 1505 // in API requests with the JSON null value. By default, fields with 1506 // empty values are omitted from API requests. However, any field with 1507 // an empty value appearing in NullFields will be sent to the server as 1508 // null. It is an error if a field in this list has a non-empty value. 1509 // This may be used to include null fields in Patch requests. 1510 NullFields []string `json:"-"` 1511} 1512 1513func (s *InstancesExportRequest) MarshalJSON() ([]byte, error) { 1514 type NoMethod InstancesExportRequest 1515 raw := NoMethod(*s) 1516 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1517} 1518 1519// InstancesFailoverRequest: Instance failover request. 1520type InstancesFailoverRequest struct { 1521 // FailoverContext: Failover Context. 1522 FailoverContext *FailoverContext `json:"failoverContext,omitempty"` 1523 1524 // ForceSendFields is a list of field names (e.g. "FailoverContext") to 1525 // unconditionally include in API requests. By default, fields with 1526 // empty values are omitted from API requests. However, any non-pointer, 1527 // non-interface field appearing in ForceSendFields will be sent to the 1528 // server regardless of whether the field is empty or not. This may be 1529 // used to include empty fields in Patch requests. 1530 ForceSendFields []string `json:"-"` 1531 1532 // NullFields is a list of field names (e.g. "FailoverContext") to 1533 // include in API requests with the JSON null value. By default, fields 1534 // with empty values are omitted from API requests. However, any field 1535 // with an empty value appearing in NullFields will be sent to the 1536 // server as null. It is an error if a field in this list has a 1537 // non-empty value. This may be used to include null fields in Patch 1538 // requests. 1539 NullFields []string `json:"-"` 1540} 1541 1542func (s *InstancesFailoverRequest) MarshalJSON() ([]byte, error) { 1543 type NoMethod InstancesFailoverRequest 1544 raw := NoMethod(*s) 1545 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1546} 1547 1548// InstancesImportRequest: Database instance import request. 1549type InstancesImportRequest struct { 1550 // ImportContext: Contains details about the import operation. 1551 ImportContext *ImportContext `json:"importContext,omitempty"` 1552 1553 // ForceSendFields is a list of field names (e.g. "ImportContext") to 1554 // unconditionally include in API requests. By default, fields with 1555 // empty values are omitted from API requests. However, any non-pointer, 1556 // non-interface field appearing in ForceSendFields will be sent to the 1557 // server regardless of whether the field is empty or not. This may be 1558 // used to include empty fields in Patch requests. 1559 ForceSendFields []string `json:"-"` 1560 1561 // NullFields is a list of field names (e.g. "ImportContext") to include 1562 // in API requests with the JSON null value. By default, fields with 1563 // empty values are omitted from API requests. However, any field with 1564 // an empty value appearing in NullFields will be sent to the server as 1565 // null. It is an error if a field in this list has a non-empty value. 1566 // This may be used to include null fields in Patch requests. 1567 NullFields []string `json:"-"` 1568} 1569 1570func (s *InstancesImportRequest) MarshalJSON() ([]byte, error) { 1571 type NoMethod InstancesImportRequest 1572 raw := NoMethod(*s) 1573 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1574} 1575 1576// InstancesListResponse: Database instances list response. 1577type InstancesListResponse struct { 1578 // Items: List of database instance resources. 1579 Items []*DatabaseInstance `json:"items,omitempty"` 1580 1581 // Kind: This is always sql#instancesList. 1582 Kind string `json:"kind,omitempty"` 1583 1584 // NextPageToken: The continuation token, used to page through large 1585 // result sets. Provide this value in a subsequent request to return the 1586 // next page of results. 1587 NextPageToken string `json:"nextPageToken,omitempty"` 1588 1589 // Warnings: List of warnings that ocurred while handling the request. 1590 Warnings []*ApiWarning `json:"warnings,omitempty"` 1591 1592 // ServerResponse contains the HTTP response code and headers from the 1593 // server. 1594 googleapi.ServerResponse `json:"-"` 1595 1596 // ForceSendFields is a list of field names (e.g. "Items") to 1597 // unconditionally include in API requests. By default, fields with 1598 // empty values are omitted from API requests. However, any non-pointer, 1599 // non-interface field appearing in ForceSendFields will be sent to the 1600 // server regardless of whether the field is empty or not. This may be 1601 // used to include empty fields in Patch requests. 1602 ForceSendFields []string `json:"-"` 1603 1604 // NullFields is a list of field names (e.g. "Items") to include in API 1605 // requests with the JSON null value. By default, fields with empty 1606 // values are omitted from API requests. However, any field with an 1607 // empty value appearing in NullFields will be sent to the server as 1608 // null. It is an error if a field in this list has a non-empty value. 1609 // This may be used to include null fields in Patch requests. 1610 NullFields []string `json:"-"` 1611} 1612 1613func (s *InstancesListResponse) MarshalJSON() ([]byte, error) { 1614 type NoMethod InstancesListResponse 1615 raw := NoMethod(*s) 1616 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1617} 1618 1619// InstancesListServerCasResponse: Instances ListServerCas response. 1620type InstancesListServerCasResponse struct { 1621 ActiveVersion string `json:"activeVersion,omitempty"` 1622 1623 // Certs: List of server CA certificates for the instance. 1624 Certs []*SslCert `json:"certs,omitempty"` 1625 1626 // Kind: This is always sql#instancesListServerCas. 1627 Kind string `json:"kind,omitempty"` 1628 1629 // ServerResponse contains the HTTP response code and headers from the 1630 // server. 1631 googleapi.ServerResponse `json:"-"` 1632 1633 // ForceSendFields is a list of field names (e.g. "ActiveVersion") to 1634 // unconditionally include in API requests. By default, fields with 1635 // empty values are omitted from API requests. However, any non-pointer, 1636 // non-interface field appearing in ForceSendFields will be sent to the 1637 // server regardless of whether the field is empty or not. This may be 1638 // used to include empty fields in Patch requests. 1639 ForceSendFields []string `json:"-"` 1640 1641 // NullFields is a list of field names (e.g. "ActiveVersion") to include 1642 // in API requests with the JSON null value. By default, fields with 1643 // empty values are omitted from API requests. However, any field with 1644 // an empty value appearing in NullFields will be sent to the server as 1645 // null. It is an error if a field in this list has a non-empty value. 1646 // This may be used to include null fields in Patch requests. 1647 NullFields []string `json:"-"` 1648} 1649 1650func (s *InstancesListServerCasResponse) MarshalJSON() ([]byte, error) { 1651 type NoMethod InstancesListServerCasResponse 1652 raw := NoMethod(*s) 1653 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1654} 1655 1656// InstancesRestoreBackupRequest: Database instance restore backup 1657// request. 1658type InstancesRestoreBackupRequest struct { 1659 // RestoreBackupContext: Parameters required to perform the restore 1660 // backup operation. 1661 RestoreBackupContext *RestoreBackupContext `json:"restoreBackupContext,omitempty"` 1662 1663 // ForceSendFields is a list of field names (e.g. 1664 // "RestoreBackupContext") to unconditionally include in API requests. 1665 // By default, fields with empty values are omitted from API requests. 1666 // However, any non-pointer, non-interface field appearing in 1667 // ForceSendFields will be sent to the server regardless of whether the 1668 // field is empty or not. This may be used to include empty fields in 1669 // Patch requests. 1670 ForceSendFields []string `json:"-"` 1671 1672 // NullFields is a list of field names (e.g. "RestoreBackupContext") to 1673 // include in API requests with the JSON null value. By default, fields 1674 // with empty values are omitted from API requests. However, any field 1675 // with an empty value appearing in NullFields will be sent to the 1676 // server as null. It is an error if a field in this list has a 1677 // non-empty value. This may be used to include null fields in Patch 1678 // requests. 1679 NullFields []string `json:"-"` 1680} 1681 1682func (s *InstancesRestoreBackupRequest) MarshalJSON() ([]byte, error) { 1683 type NoMethod InstancesRestoreBackupRequest 1684 raw := NoMethod(*s) 1685 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1686} 1687 1688// InstancesRotateServerCaRequest: Rotate Server CA request. 1689type InstancesRotateServerCaRequest struct { 1690 // RotateServerCaContext: Contains details about the rotate server CA 1691 // operation. 1692 RotateServerCaContext *RotateServerCaContext `json:"rotateServerCaContext,omitempty"` 1693 1694 // ForceSendFields is a list of field names (e.g. 1695 // "RotateServerCaContext") to unconditionally include in API requests. 1696 // By default, fields with empty values are omitted from API requests. 1697 // However, any non-pointer, non-interface field appearing in 1698 // ForceSendFields will be sent to the server regardless of whether the 1699 // field is empty or not. This may be used to include empty fields in 1700 // Patch requests. 1701 ForceSendFields []string `json:"-"` 1702 1703 // NullFields is a list of field names (e.g. "RotateServerCaContext") to 1704 // include in API requests with the JSON null value. By default, fields 1705 // with empty values are omitted from API requests. However, any field 1706 // with an empty value appearing in NullFields will be sent to the 1707 // server as null. It is an error if a field in this list has a 1708 // non-empty value. This may be used to include null fields in Patch 1709 // requests. 1710 NullFields []string `json:"-"` 1711} 1712 1713func (s *InstancesRotateServerCaRequest) MarshalJSON() ([]byte, error) { 1714 type NoMethod InstancesRotateServerCaRequest 1715 raw := NoMethod(*s) 1716 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1717} 1718 1719// InstancesTruncateLogRequest: Instance truncate log request. 1720type InstancesTruncateLogRequest struct { 1721 // TruncateLogContext: Contains details about the truncate log 1722 // operation. 1723 TruncateLogContext *TruncateLogContext `json:"truncateLogContext,omitempty"` 1724 1725 // ForceSendFields is a list of field names (e.g. "TruncateLogContext") 1726 // to unconditionally include in API requests. By default, fields with 1727 // empty values are omitted from API requests. However, any non-pointer, 1728 // non-interface field appearing in ForceSendFields will be sent to the 1729 // server regardless of whether the field is empty or not. This may be 1730 // used to include empty fields in Patch requests. 1731 ForceSendFields []string `json:"-"` 1732 1733 // NullFields is a list of field names (e.g. "TruncateLogContext") to 1734 // include in API requests with the JSON null value. By default, fields 1735 // with empty values are omitted from API requests. However, any field 1736 // with an empty value appearing in NullFields will be sent to the 1737 // server as null. It is an error if a field in this list has a 1738 // non-empty value. This may be used to include null fields in Patch 1739 // requests. 1740 NullFields []string `json:"-"` 1741} 1742 1743func (s *InstancesTruncateLogRequest) MarshalJSON() ([]byte, error) { 1744 type NoMethod InstancesTruncateLogRequest 1745 raw := NoMethod(*s) 1746 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1747} 1748 1749// IpConfiguration: IP Management configuration. 1750type IpConfiguration struct { 1751 // AuthorizedNetworks: The list of external networks that are allowed to 1752 // connect to the instance using the IP. In CIDR notation, also known as 1753 // 'slash' notation (e.g. 192.168.100.0/24). 1754 AuthorizedNetworks []*AclEntry `json:"authorizedNetworks,omitempty"` 1755 1756 // Ipv4Enabled: Whether the instance should be assigned an IP address or 1757 // not. 1758 Ipv4Enabled bool `json:"ipv4Enabled,omitempty"` 1759 1760 // PrivateNetwork: The resource link for the VPC network from which the 1761 // Cloud SQL instance is accessible for private IP. For example, 1762 // /projects/myProject/global/networks/default. This setting can be 1763 // updated, but it cannot be removed after it is set. 1764 PrivateNetwork string `json:"privateNetwork,omitempty"` 1765 1766 // RequireSsl: Whether SSL connections over IP should be enforced or 1767 // not. 1768 RequireSsl bool `json:"requireSsl,omitempty"` 1769 1770 // ForceSendFields is a list of field names (e.g. "AuthorizedNetworks") 1771 // to unconditionally include in API requests. By default, fields with 1772 // empty values are omitted from API requests. However, any non-pointer, 1773 // non-interface field appearing in ForceSendFields will be sent to the 1774 // server regardless of whether the field is empty or not. This may be 1775 // used to include empty fields in Patch requests. 1776 ForceSendFields []string `json:"-"` 1777 1778 // NullFields is a list of field names (e.g. "AuthorizedNetworks") to 1779 // include in API requests with the JSON null value. By default, fields 1780 // with empty values are omitted from API requests. However, any field 1781 // with an empty value appearing in NullFields will be sent to the 1782 // server as null. It is an error if a field in this list has a 1783 // non-empty value. This may be used to include null fields in Patch 1784 // requests. 1785 NullFields []string `json:"-"` 1786} 1787 1788func (s *IpConfiguration) MarshalJSON() ([]byte, error) { 1789 type NoMethod IpConfiguration 1790 raw := NoMethod(*s) 1791 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1792} 1793 1794// IpMapping: Database instance IP Mapping. 1795type IpMapping struct { 1796 // IpAddress: The IP address assigned. 1797 IpAddress string `json:"ipAddress,omitempty"` 1798 1799 // TimeToRetire: The due time for this IP to be retired in RFC 3339 1800 // format, for example 2012-11-15T16:19:00.094Z. This field is only 1801 // available when the IP is scheduled to be retired. 1802 TimeToRetire string `json:"timeToRetire,omitempty"` 1803 1804 // Type: The type of this IP address. A PRIMARY address is an address 1805 // that can accept incoming connections. An OUTGOING address is the 1806 // source address of connections originating from the instance, if 1807 // supported. 1808 Type string `json:"type,omitempty"` 1809 1810 // ForceSendFields is a list of field names (e.g. "IpAddress") to 1811 // unconditionally include in API requests. By default, fields with 1812 // empty values are omitted from API requests. However, any non-pointer, 1813 // non-interface field appearing in ForceSendFields will be sent to the 1814 // server regardless of whether the field is empty or not. This may be 1815 // used to include empty fields in Patch requests. 1816 ForceSendFields []string `json:"-"` 1817 1818 // NullFields is a list of field names (e.g. "IpAddress") to include in 1819 // API requests with the JSON null value. By default, fields with empty 1820 // values are omitted from API requests. However, any field with an 1821 // empty value appearing in NullFields will be sent to the server as 1822 // null. It is an error if a field in this list has a non-empty value. 1823 // This may be used to include null fields in Patch requests. 1824 NullFields []string `json:"-"` 1825} 1826 1827func (s *IpMapping) MarshalJSON() ([]byte, error) { 1828 type NoMethod IpMapping 1829 raw := NoMethod(*s) 1830 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1831} 1832 1833// LocationPreference: Preferred location. This specifies where a Cloud 1834// SQL instance should preferably be located, either in a specific 1835// Compute Engine zone, or co-located with an App Engine application. 1836// Note that if the preferred location is not available, the instance 1837// will be located as close as possible within the region. Only one 1838// location may be specified. 1839type LocationPreference struct { 1840 // FollowGaeApplication: The AppEngine application to follow, it must be 1841 // in the same region as the Cloud SQL instance. 1842 FollowGaeApplication string `json:"followGaeApplication,omitempty"` 1843 1844 // Kind: This is always sql#locationPreference. 1845 Kind string `json:"kind,omitempty"` 1846 1847 // Zone: The preferred Compute Engine zone (e.g. us-central1-a, 1848 // us-central1-b, etc.). 1849 Zone string `json:"zone,omitempty"` 1850 1851 // ForceSendFields is a list of field names (e.g. 1852 // "FollowGaeApplication") to unconditionally include in API requests. 1853 // By default, fields with empty values are omitted from API requests. 1854 // However, any non-pointer, non-interface field appearing in 1855 // ForceSendFields will be sent to the server regardless of whether the 1856 // field is empty or not. This may be used to include empty fields in 1857 // Patch requests. 1858 ForceSendFields []string `json:"-"` 1859 1860 // NullFields is a list of field names (e.g. "FollowGaeApplication") to 1861 // include in API requests with the JSON null value. By default, fields 1862 // with empty values are omitted from API requests. However, any field 1863 // with an empty value appearing in NullFields will be sent to the 1864 // server as null. It is an error if a field in this list has a 1865 // non-empty value. This may be used to include null fields in Patch 1866 // requests. 1867 NullFields []string `json:"-"` 1868} 1869 1870func (s *LocationPreference) MarshalJSON() ([]byte, error) { 1871 type NoMethod LocationPreference 1872 raw := NoMethod(*s) 1873 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1874} 1875 1876// MaintenanceWindow: Maintenance window. This specifies when a v2 Cloud 1877// SQL instance should preferably be restarted for system maintenance 1878// purposes. 1879type MaintenanceWindow struct { 1880 // Day: day of week (1-7), starting on Monday. 1881 Day int64 `json:"day,omitempty"` 1882 1883 // Hour: hour of day - 0 to 23. 1884 Hour int64 `json:"hour,omitempty"` 1885 1886 // Kind: This is always sql#maintenanceWindow. 1887 Kind string `json:"kind,omitempty"` 1888 1889 // UpdateTrack: Maintenance timing setting: canary (Earlier) or stable 1890 // (Later). 1891 // Learn more. 1892 UpdateTrack string `json:"updateTrack,omitempty"` 1893 1894 // ForceSendFields is a list of field names (e.g. "Day") to 1895 // unconditionally include in API requests. By default, fields with 1896 // empty values are omitted from API requests. However, any non-pointer, 1897 // non-interface field appearing in ForceSendFields will be sent to the 1898 // server regardless of whether the field is empty or not. This may be 1899 // used to include empty fields in Patch requests. 1900 ForceSendFields []string `json:"-"` 1901 1902 // NullFields is a list of field names (e.g. "Day") to include in API 1903 // requests with the JSON null value. By default, fields with empty 1904 // values are omitted from API requests. However, any field with an 1905 // empty value appearing in NullFields will be sent to the server as 1906 // null. It is an error if a field in this list has a non-empty value. 1907 // This may be used to include null fields in Patch requests. 1908 NullFields []string `json:"-"` 1909} 1910 1911func (s *MaintenanceWindow) MarshalJSON() ([]byte, error) { 1912 type NoMethod MaintenanceWindow 1913 raw := NoMethod(*s) 1914 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1915} 1916 1917// MySqlReplicaConfiguration: Read-replica configuration specific to 1918// MySQL databases. 1919type MySqlReplicaConfiguration struct { 1920 // CaCertificate: PEM representation of the trusted CA's x509 1921 // certificate. 1922 CaCertificate string `json:"caCertificate,omitempty"` 1923 1924 // ClientCertificate: PEM representation of the slave's x509 1925 // certificate. 1926 ClientCertificate string `json:"clientCertificate,omitempty"` 1927 1928 // ClientKey: PEM representation of the slave's private key. The 1929 // corresponsing public key is encoded in the client's certificate. 1930 ClientKey string `json:"clientKey,omitempty"` 1931 1932 // ConnectRetryInterval: Seconds to wait between connect retries. 1933 // MySQL's default is 60 seconds. 1934 ConnectRetryInterval int64 `json:"connectRetryInterval,omitempty"` 1935 1936 // DumpFilePath: Path to a SQL dump file in Google Cloud Storage from 1937 // which the slave instance is to be created. The URI is in the form 1938 // gs://bucketName/fileName. Compressed gzip files (.gz) are also 1939 // supported. Dumps should have the binlog co-ordinates from which 1940 // replication should begin. This can be accomplished by setting 1941 // --master-data to 1 when using mysqldump. 1942 DumpFilePath string `json:"dumpFilePath,omitempty"` 1943 1944 // Kind: This is always sql#mysqlReplicaConfiguration. 1945 Kind string `json:"kind,omitempty"` 1946 1947 // MasterHeartbeatPeriod: Interval in milliseconds between replication 1948 // heartbeats. 1949 MasterHeartbeatPeriod int64 `json:"masterHeartbeatPeriod,omitempty,string"` 1950 1951 // Password: The password for the replication connection. 1952 Password string `json:"password,omitempty"` 1953 1954 // SslCipher: A list of permissible ciphers to use for SSL encryption. 1955 SslCipher string `json:"sslCipher,omitempty"` 1956 1957 // Username: The username for the replication connection. 1958 Username string `json:"username,omitempty"` 1959 1960 // VerifyServerCertificate: Whether or not to check the master's Common 1961 // Name value in the certificate that it sends during the SSL handshake. 1962 VerifyServerCertificate bool `json:"verifyServerCertificate,omitempty"` 1963 1964 // ForceSendFields is a list of field names (e.g. "CaCertificate") to 1965 // unconditionally include in API requests. By default, fields with 1966 // empty values are omitted from API requests. However, any non-pointer, 1967 // non-interface field appearing in ForceSendFields will be sent to the 1968 // server regardless of whether the field is empty or not. This may be 1969 // used to include empty fields in Patch requests. 1970 ForceSendFields []string `json:"-"` 1971 1972 // NullFields is a list of field names (e.g. "CaCertificate") to include 1973 // in API requests with the JSON null value. By default, fields with 1974 // empty values are omitted from API requests. However, any field with 1975 // an empty value appearing in NullFields will be sent to the server as 1976 // null. It is an error if a field in this list has a non-empty value. 1977 // This may be used to include null fields in Patch requests. 1978 NullFields []string `json:"-"` 1979} 1980 1981func (s *MySqlReplicaConfiguration) MarshalJSON() ([]byte, error) { 1982 type NoMethod MySqlReplicaConfiguration 1983 raw := NoMethod(*s) 1984 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1985} 1986 1987// OnPremisesConfiguration: On-premises instance configuration. 1988type OnPremisesConfiguration struct { 1989 // HostPort: The host and port of the on-premises instance in host:port 1990 // format 1991 HostPort string `json:"hostPort,omitempty"` 1992 1993 // Kind: This is always sql#onPremisesConfiguration. 1994 Kind string `json:"kind,omitempty"` 1995 1996 // ForceSendFields is a list of field names (e.g. "HostPort") to 1997 // unconditionally include in API requests. By default, fields with 1998 // empty values are omitted from API requests. However, any non-pointer, 1999 // non-interface field appearing in ForceSendFields will be sent to the 2000 // server regardless of whether the field is empty or not. This may be 2001 // used to include empty fields in Patch requests. 2002 ForceSendFields []string `json:"-"` 2003 2004 // NullFields is a list of field names (e.g. "HostPort") to include in 2005 // API requests with the JSON null value. By default, fields with empty 2006 // values are omitted from API requests. However, any field with an 2007 // empty value appearing in NullFields will be sent to the server as 2008 // null. It is an error if a field in this list has a non-empty value. 2009 // This may be used to include null fields in Patch requests. 2010 NullFields []string `json:"-"` 2011} 2012 2013func (s *OnPremisesConfiguration) MarshalJSON() ([]byte, error) { 2014 type NoMethod OnPremisesConfiguration 2015 raw := NoMethod(*s) 2016 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2017} 2018 2019// Operation: An Operation resource. For successful operations that 2020// return an Operation resource, only the fields relevant to the 2021// operation are populated in the resource. 2022type Operation struct { 2023 // EndTime: The time this operation finished in UTC timezone in RFC 3339 2024 // format, for example 2012-11-15T16:19:00.094Z. 2025 EndTime string `json:"endTime,omitempty"` 2026 2027 // Error: If errors occurred during processing of this operation, this 2028 // field will be populated. 2029 Error *OperationErrors `json:"error,omitempty"` 2030 2031 // ExportContext: The context for export operation, if applicable. 2032 ExportContext *ExportContext `json:"exportContext,omitempty"` 2033 2034 // ImportContext: The context for import operation, if applicable. 2035 ImportContext *ImportContext `json:"importContext,omitempty"` 2036 2037 // InsertTime: The time this operation was enqueued in UTC timezone in 2038 // RFC 3339 format, for example 2012-11-15T16:19:00.094Z. 2039 InsertTime string `json:"insertTime,omitempty"` 2040 2041 // Kind: This is always sql#operation. 2042 Kind string `json:"kind,omitempty"` 2043 2044 // Name: An identifier that uniquely identifies the operation. You can 2045 // use this identifier to retrieve the Operations resource that has 2046 // information about the operation. 2047 Name string `json:"name,omitempty"` 2048 2049 // OperationType: The type of the operation. Valid values are CREATE, 2050 // DELETE, UPDATE, RESTART, IMPORT, EXPORT, BACKUP_VOLUME, 2051 // RESTORE_VOLUME, CREATE_USER, DELETE_USER, CREATE_DATABASE, 2052 // DELETE_DATABASE . 2053 OperationType string `json:"operationType,omitempty"` 2054 2055 // SelfLink: The URI of this resource. 2056 SelfLink string `json:"selfLink,omitempty"` 2057 2058 // StartTime: The time this operation actually started in UTC timezone 2059 // in RFC 3339 format, for example 2012-11-15T16:19:00.094Z. 2060 StartTime string `json:"startTime,omitempty"` 2061 2062 // Status: The status of an operation. Valid values are PENDING, 2063 // RUNNING, DONE, UNKNOWN. 2064 Status string `json:"status,omitempty"` 2065 2066 // TargetId: Name of the database instance related to this operation. 2067 TargetId string `json:"targetId,omitempty"` 2068 2069 TargetLink string `json:"targetLink,omitempty"` 2070 2071 // TargetProject: The project ID of the target instance related to this 2072 // operation. 2073 TargetProject string `json:"targetProject,omitempty"` 2074 2075 // User: The email address of the user who initiated this operation. 2076 User string `json:"user,omitempty"` 2077 2078 // ServerResponse contains the HTTP response code and headers from the 2079 // server. 2080 googleapi.ServerResponse `json:"-"` 2081 2082 // ForceSendFields is a list of field names (e.g. "EndTime") to 2083 // unconditionally include in API requests. By default, fields with 2084 // empty values are omitted from API requests. However, any non-pointer, 2085 // non-interface field appearing in ForceSendFields will be sent to the 2086 // server regardless of whether the field is empty or not. This may be 2087 // used to include empty fields in Patch requests. 2088 ForceSendFields []string `json:"-"` 2089 2090 // NullFields is a list of field names (e.g. "EndTime") to include in 2091 // API requests with the JSON null value. By default, fields with empty 2092 // values are omitted from API requests. However, any field with an 2093 // empty value appearing in NullFields will be sent to the server as 2094 // null. It is an error if a field in this list has a non-empty value. 2095 // This may be used to include null fields in Patch requests. 2096 NullFields []string `json:"-"` 2097} 2098 2099func (s *Operation) MarshalJSON() ([]byte, error) { 2100 type NoMethod Operation 2101 raw := NoMethod(*s) 2102 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2103} 2104 2105// OperationError: Database instance operation error. 2106type OperationError struct { 2107 // Code: Identifies the specific error that occurred. 2108 Code string `json:"code,omitempty"` 2109 2110 // Kind: This is always sql#operationError. 2111 Kind string `json:"kind,omitempty"` 2112 2113 // Message: Additional information about the error encountered. 2114 Message string `json:"message,omitempty"` 2115 2116 // ForceSendFields is a list of field names (e.g. "Code") to 2117 // unconditionally include in API requests. By default, fields with 2118 // empty values are omitted from API requests. However, any non-pointer, 2119 // non-interface field appearing in ForceSendFields will be sent to the 2120 // server regardless of whether the field is empty or not. This may be 2121 // used to include empty fields in Patch requests. 2122 ForceSendFields []string `json:"-"` 2123 2124 // NullFields is a list of field names (e.g. "Code") to include in API 2125 // requests with the JSON null value. By default, fields with empty 2126 // values are omitted from API requests. However, any field with an 2127 // empty value appearing in NullFields will be sent to the server as 2128 // null. It is an error if a field in this list has a non-empty value. 2129 // This may be used to include null fields in Patch requests. 2130 NullFields []string `json:"-"` 2131} 2132 2133func (s *OperationError) MarshalJSON() ([]byte, error) { 2134 type NoMethod OperationError 2135 raw := NoMethod(*s) 2136 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2137} 2138 2139// OperationErrors: Database instance operation errors list wrapper. 2140type OperationErrors struct { 2141 // Errors: The list of errors encountered while processing this 2142 // operation. 2143 Errors []*OperationError `json:"errors,omitempty"` 2144 2145 // Kind: This is always sql#operationErrors. 2146 Kind string `json:"kind,omitempty"` 2147 2148 // ForceSendFields is a list of field names (e.g. "Errors") to 2149 // unconditionally include in API requests. By default, fields with 2150 // empty values are omitted from API requests. However, any non-pointer, 2151 // non-interface field appearing in ForceSendFields will be sent to the 2152 // server regardless of whether the field is empty or not. This may be 2153 // used to include empty fields in Patch requests. 2154 ForceSendFields []string `json:"-"` 2155 2156 // NullFields is a list of field names (e.g. "Errors") to include in API 2157 // requests with the JSON null value. By default, fields with empty 2158 // values are omitted from API requests. However, any field with an 2159 // empty value appearing in NullFields will be sent to the server as 2160 // null. It is an error if a field in this list has a non-empty value. 2161 // This may be used to include null fields in Patch requests. 2162 NullFields []string `json:"-"` 2163} 2164 2165func (s *OperationErrors) MarshalJSON() ([]byte, error) { 2166 type NoMethod OperationErrors 2167 raw := NoMethod(*s) 2168 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2169} 2170 2171// OperationsListResponse: Database instance list operations response. 2172type OperationsListResponse struct { 2173 // Items: List of operation resources. 2174 Items []*Operation `json:"items,omitempty"` 2175 2176 // Kind: This is always sql#operationsList. 2177 Kind string `json:"kind,omitempty"` 2178 2179 // NextPageToken: The continuation token, used to page through large 2180 // result sets. Provide this value in a subsequent request to return the 2181 // next page of results. 2182 NextPageToken string `json:"nextPageToken,omitempty"` 2183 2184 // ServerResponse contains the HTTP response code and headers from the 2185 // server. 2186 googleapi.ServerResponse `json:"-"` 2187 2188 // ForceSendFields is a list of field names (e.g. "Items") to 2189 // unconditionally include in API requests. By default, fields with 2190 // empty values are omitted from API requests. However, any non-pointer, 2191 // non-interface field appearing in ForceSendFields will be sent to the 2192 // server regardless of whether the field is empty or not. This may be 2193 // used to include empty fields in Patch requests. 2194 ForceSendFields []string `json:"-"` 2195 2196 // NullFields is a list of field names (e.g. "Items") to include in API 2197 // requests with the JSON null value. By default, fields with empty 2198 // values are omitted from API requests. However, any field with an 2199 // empty value appearing in NullFields will be sent to the server as 2200 // null. It is an error if a field in this list has a non-empty value. 2201 // This may be used to include null fields in Patch requests. 2202 NullFields []string `json:"-"` 2203} 2204 2205func (s *OperationsListResponse) MarshalJSON() ([]byte, error) { 2206 type NoMethod OperationsListResponse 2207 raw := NoMethod(*s) 2208 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2209} 2210 2211// ReplicaConfiguration: Read-replica configuration for connecting to 2212// the master. 2213type ReplicaConfiguration struct { 2214 // FailoverTarget: Specifies if the replica is the failover target. If 2215 // the field is set to true the replica will be designated as a failover 2216 // replica. In case the master instance fails, the replica instance will 2217 // be promoted as the new master instance. 2218 // Only one replica can be specified as failover target, and the replica 2219 // has to be in different zone with the master instance. 2220 FailoverTarget bool `json:"failoverTarget,omitempty"` 2221 2222 // Kind: This is always sql#replicaConfiguration. 2223 Kind string `json:"kind,omitempty"` 2224 2225 // MysqlReplicaConfiguration: MySQL specific configuration when 2226 // replicating from a MySQL on-premises master. Replication 2227 // configuration information such as the username, password, 2228 // certificates, and keys are not stored in the instance metadata. The 2229 // configuration information is used only to set up the replication 2230 // connection and is stored by MySQL in a file named master.info in the 2231 // data directory. 2232 MysqlReplicaConfiguration *MySqlReplicaConfiguration `json:"mysqlReplicaConfiguration,omitempty"` 2233 2234 // ForceSendFields is a list of field names (e.g. "FailoverTarget") to 2235 // unconditionally include in API requests. By default, fields with 2236 // empty values are omitted from API requests. However, any non-pointer, 2237 // non-interface field appearing in ForceSendFields will be sent to the 2238 // server regardless of whether the field is empty or not. This may be 2239 // used to include empty fields in Patch requests. 2240 ForceSendFields []string `json:"-"` 2241 2242 // NullFields is a list of field names (e.g. "FailoverTarget") to 2243 // include in API requests with the JSON null value. By default, fields 2244 // with empty values are omitted from API requests. However, any field 2245 // with an empty value appearing in NullFields will be sent to the 2246 // server as null. It is an error if a field in this list has a 2247 // non-empty value. This may be used to include null fields in Patch 2248 // requests. 2249 NullFields []string `json:"-"` 2250} 2251 2252func (s *ReplicaConfiguration) MarshalJSON() ([]byte, error) { 2253 type NoMethod ReplicaConfiguration 2254 raw := NoMethod(*s) 2255 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2256} 2257 2258// RestoreBackupContext: Database instance restore from backup context. 2259type RestoreBackupContext struct { 2260 // BackupRunId: The ID of the backup run to restore from. 2261 BackupRunId int64 `json:"backupRunId,omitempty,string"` 2262 2263 // InstanceId: The ID of the instance that the backup was taken from. 2264 InstanceId string `json:"instanceId,omitempty"` 2265 2266 // Kind: This is always sql#restoreBackupContext. 2267 Kind string `json:"kind,omitempty"` 2268 2269 // ForceSendFields is a list of field names (e.g. "BackupRunId") to 2270 // unconditionally include in API requests. By default, fields with 2271 // empty values are omitted from API requests. However, any non-pointer, 2272 // non-interface field appearing in ForceSendFields will be sent to the 2273 // server regardless of whether the field is empty or not. This may be 2274 // used to include empty fields in Patch requests. 2275 ForceSendFields []string `json:"-"` 2276 2277 // NullFields is a list of field names (e.g. "BackupRunId") to include 2278 // in API requests with the JSON null value. By default, fields with 2279 // empty values are omitted from API requests. However, any field with 2280 // an empty value appearing in NullFields will be sent to the server as 2281 // null. It is an error if a field in this list has a non-empty value. 2282 // This may be used to include null fields in Patch requests. 2283 NullFields []string `json:"-"` 2284} 2285 2286func (s *RestoreBackupContext) MarshalJSON() ([]byte, error) { 2287 type NoMethod RestoreBackupContext 2288 raw := NoMethod(*s) 2289 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2290} 2291 2292// RotateServerCaContext: Instance rotate server CA context. 2293type RotateServerCaContext struct { 2294 // Kind: This is always sql#rotateServerCaContext. 2295 Kind string `json:"kind,omitempty"` 2296 2297 // NextVersion: The fingerprint of the next version to be rotated to. If 2298 // left unspecified, will be rotated to the most recently added server 2299 // CA version. 2300 NextVersion string `json:"nextVersion,omitempty"` 2301 2302 // ForceSendFields is a list of field names (e.g. "Kind") to 2303 // unconditionally include in API requests. By default, fields with 2304 // empty values are omitted from API requests. However, any non-pointer, 2305 // non-interface field appearing in ForceSendFields will be sent to the 2306 // server regardless of whether the field is empty or not. This may be 2307 // used to include empty fields in Patch requests. 2308 ForceSendFields []string `json:"-"` 2309 2310 // NullFields is a list of field names (e.g. "Kind") to include in API 2311 // requests with the JSON null value. By default, fields with empty 2312 // values are omitted from API requests. However, any field with an 2313 // empty value appearing in NullFields will be sent to the server as 2314 // null. It is an error if a field in this list has a non-empty value. 2315 // This may be used to include null fields in Patch requests. 2316 NullFields []string `json:"-"` 2317} 2318 2319func (s *RotateServerCaContext) MarshalJSON() ([]byte, error) { 2320 type NoMethod RotateServerCaContext 2321 raw := NoMethod(*s) 2322 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2323} 2324 2325// Settings: Database instance settings. 2326type Settings struct { 2327 // ActivationPolicy: The activation policy specifies when the instance 2328 // is activated; it is applicable only when the instance state is 2329 // RUNNABLE. Valid values: 2330 // ALWAYS: The instance is on, and remains so even in the absence of 2331 // connection requests. 2332 // NEVER: The instance is off; it is not activated, even if a connection 2333 // request arrives. 2334 // ON_DEMAND: First Generation instances only. The instance responds to 2335 // incoming requests, and turns itself off when not in use. Instances 2336 // with PER_USE pricing turn off after 15 minutes of inactivity. 2337 // Instances with PER_PACKAGE pricing turn off after 12 hours of 2338 // inactivity. 2339 ActivationPolicy string `json:"activationPolicy,omitempty"` 2340 2341 // AuthorizedGaeApplications: The App Engine app IDs that can access 2342 // this instance. First Generation instances only. 2343 AuthorizedGaeApplications []string `json:"authorizedGaeApplications,omitempty"` 2344 2345 // AvailabilityType: Availability type (PostgreSQL instances only). 2346 // Potential values: 2347 // ZONAL: The instance serves data from only one zone. Outages in that 2348 // zone affect data accessibility. 2349 // REGIONAL: The instance can serve data from more than one zone in a 2350 // region (it is highly available). 2351 // For more information, see Overview of the High Availability 2352 // Configuration. 2353 AvailabilityType string `json:"availabilityType,omitempty"` 2354 2355 // BackupConfiguration: The daily backup configuration for the instance. 2356 BackupConfiguration *BackupConfiguration `json:"backupConfiguration,omitempty"` 2357 2358 // CrashSafeReplicationEnabled: Configuration specific to read replica 2359 // instances. Indicates whether database flags for crash-safe 2360 // replication are enabled. This property is only applicable to First 2361 // Generation instances. 2362 CrashSafeReplicationEnabled bool `json:"crashSafeReplicationEnabled,omitempty"` 2363 2364 // DataDiskSizeGb: The size of data disk, in GB. The data disk size 2365 // minimum is 10GB. Not used for First Generation instances. 2366 DataDiskSizeGb int64 `json:"dataDiskSizeGb,omitempty,string"` 2367 2368 // DataDiskType: The type of data disk: PD_SSD (default) or PD_HDD. Not 2369 // used for First Generation instances. 2370 DataDiskType string `json:"dataDiskType,omitempty"` 2371 2372 // DatabaseFlags: The database flags passed to the instance at startup. 2373 DatabaseFlags []*DatabaseFlags `json:"databaseFlags,omitempty"` 2374 2375 // DatabaseReplicationEnabled: Configuration specific to read replica 2376 // instances. Indicates whether replication is enabled or not. 2377 DatabaseReplicationEnabled bool `json:"databaseReplicationEnabled,omitempty"` 2378 2379 // IpConfiguration: The settings for IP Management. This allows to 2380 // enable or disable the instance IP and manage which external networks 2381 // can connect to the instance. The IPv4 address cannot be disabled for 2382 // Second Generation instances. 2383 IpConfiguration *IpConfiguration `json:"ipConfiguration,omitempty"` 2384 2385 // Kind: This is always sql#settings. 2386 Kind string `json:"kind,omitempty"` 2387 2388 // LocationPreference: The location preference settings. This allows the 2389 // instance to be located as near as possible to either an App Engine 2390 // app or Compute Engine zone for better performance. App Engine 2391 // co-location is only applicable to First Generation instances. 2392 LocationPreference *LocationPreference `json:"locationPreference,omitempty"` 2393 2394 // MaintenanceWindow: The maintenance window for this instance. This 2395 // specifies when the instance can be restarted for maintenance 2396 // purposes. Not used for First Generation instances. 2397 MaintenanceWindow *MaintenanceWindow `json:"maintenanceWindow,omitempty"` 2398 2399 // PricingPlan: The pricing plan for this instance. This can be either 2400 // PER_USE or PACKAGE. Only PER_USE is supported for Second Generation 2401 // instances. 2402 PricingPlan string `json:"pricingPlan,omitempty"` 2403 2404 // ReplicationType: The type of replication this instance uses. This can 2405 // be either ASYNCHRONOUS or SYNCHRONOUS. This property is only 2406 // applicable to First Generation instances. 2407 ReplicationType string `json:"replicationType,omitempty"` 2408 2409 // SettingsVersion: The version of instance settings. This is a required 2410 // field for update method to make sure concurrent updates are handled 2411 // properly. During update, use the most recent settingsVersion value 2412 // for this instance and do not try to update this value. 2413 SettingsVersion int64 `json:"settingsVersion,omitempty,string"` 2414 2415 // StorageAutoResize: Configuration to increase storage size 2416 // automatically. The default value is true. Not used for First 2417 // Generation instances. 2418 StorageAutoResize *bool `json:"storageAutoResize,omitempty"` 2419 2420 // StorageAutoResizeLimit: The maximum size to which storage capacity 2421 // can be automatically increased. The default value is 0, which 2422 // specifies that there is no limit. Not used for First Generation 2423 // instances. 2424 StorageAutoResizeLimit int64 `json:"storageAutoResizeLimit,omitempty,string"` 2425 2426 // Tier: The tier (or machine type) for this instance, for example 2427 // db-n1-standard-1 (MySQL instances) or db-custom-1-3840 (PostgreSQL 2428 // instances). For MySQL instances, this property determines whether the 2429 // instance is First or Second Generation. For more information, see 2430 // Instance Settings. 2431 Tier string `json:"tier,omitempty"` 2432 2433 // UserLabels: User-provided labels, represented as a dictionary where 2434 // each label is a single key value pair. 2435 UserLabels map[string]string `json:"userLabels,omitempty"` 2436 2437 // ForceSendFields is a list of field names (e.g. "ActivationPolicy") to 2438 // unconditionally include in API requests. By default, fields with 2439 // empty values are omitted from API requests. However, any non-pointer, 2440 // non-interface field appearing in ForceSendFields will be sent to the 2441 // server regardless of whether the field is empty or not. This may be 2442 // used to include empty fields in Patch requests. 2443 ForceSendFields []string `json:"-"` 2444 2445 // NullFields is a list of field names (e.g. "ActivationPolicy") to 2446 // include in API requests with the JSON null value. By default, fields 2447 // with empty values are omitted from API requests. However, any field 2448 // with an empty value appearing in NullFields will be sent to the 2449 // server as null. It is an error if a field in this list has a 2450 // non-empty value. This may be used to include null fields in Patch 2451 // requests. 2452 NullFields []string `json:"-"` 2453} 2454 2455func (s *Settings) MarshalJSON() ([]byte, error) { 2456 type NoMethod Settings 2457 raw := NoMethod(*s) 2458 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2459} 2460 2461// SslCert: SslCerts Resource 2462type SslCert struct { 2463 // Cert: PEM representation. 2464 Cert string `json:"cert,omitempty"` 2465 2466 // CertSerialNumber: Serial number, as extracted from the certificate. 2467 CertSerialNumber string `json:"certSerialNumber,omitempty"` 2468 2469 // CommonName: User supplied name. Constrained to [a-zA-Z.-_ ]+. 2470 CommonName string `json:"commonName,omitempty"` 2471 2472 // CreateTime: The time when the certificate was created in RFC 3339 2473 // format, for example 2012-11-15T16:19:00.094Z 2474 CreateTime string `json:"createTime,omitempty"` 2475 2476 // ExpirationTime: The time when the certificate expires in RFC 3339 2477 // format, for example 2012-11-15T16:19:00.094Z. 2478 ExpirationTime string `json:"expirationTime,omitempty"` 2479 2480 // Instance: Name of the database instance. 2481 Instance string `json:"instance,omitempty"` 2482 2483 // Kind: This is always sql#sslCert. 2484 Kind string `json:"kind,omitempty"` 2485 2486 // SelfLink: The URI of this resource. 2487 SelfLink string `json:"selfLink,omitempty"` 2488 2489 // Sha1Fingerprint: Sha1 Fingerprint. 2490 Sha1Fingerprint string `json:"sha1Fingerprint,omitempty"` 2491 2492 // ServerResponse contains the HTTP response code and headers from the 2493 // server. 2494 googleapi.ServerResponse `json:"-"` 2495 2496 // ForceSendFields is a list of field names (e.g. "Cert") to 2497 // unconditionally include in API requests. By default, fields with 2498 // empty values are omitted from API requests. However, any non-pointer, 2499 // non-interface field appearing in ForceSendFields will be sent to the 2500 // server regardless of whether the field is empty or not. This may be 2501 // used to include empty fields in Patch requests. 2502 ForceSendFields []string `json:"-"` 2503 2504 // NullFields is a list of field names (e.g. "Cert") to include in API 2505 // requests with the JSON null value. By default, fields with empty 2506 // values are omitted from API requests. However, any field with an 2507 // empty value appearing in NullFields will be sent to the server as 2508 // null. It is an error if a field in this list has a non-empty value. 2509 // This may be used to include null fields in Patch requests. 2510 NullFields []string `json:"-"` 2511} 2512 2513func (s *SslCert) MarshalJSON() ([]byte, error) { 2514 type NoMethod SslCert 2515 raw := NoMethod(*s) 2516 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2517} 2518 2519// SslCertDetail: SslCertDetail. 2520type SslCertDetail struct { 2521 // CertInfo: The public information about the cert. 2522 CertInfo *SslCert `json:"certInfo,omitempty"` 2523 2524 // CertPrivateKey: The private key for the client cert, in pem format. 2525 // Keep private in order to protect your security. 2526 CertPrivateKey string `json:"certPrivateKey,omitempty"` 2527 2528 // ForceSendFields is a list of field names (e.g. "CertInfo") to 2529 // unconditionally include in API requests. By default, fields with 2530 // empty values are omitted from API requests. However, any non-pointer, 2531 // non-interface field appearing in ForceSendFields will be sent to the 2532 // server regardless of whether the field is empty or not. This may be 2533 // used to include empty fields in Patch requests. 2534 ForceSendFields []string `json:"-"` 2535 2536 // NullFields is a list of field names (e.g. "CertInfo") to include in 2537 // API requests with the JSON null value. By default, fields with empty 2538 // values are omitted from API requests. However, any field with an 2539 // empty value appearing in NullFields will be sent to the server as 2540 // null. It is an error if a field in this list has a non-empty value. 2541 // This may be used to include null fields in Patch requests. 2542 NullFields []string `json:"-"` 2543} 2544 2545func (s *SslCertDetail) MarshalJSON() ([]byte, error) { 2546 type NoMethod SslCertDetail 2547 raw := NoMethod(*s) 2548 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2549} 2550 2551// SslCertsCreateEphemeralRequest: SslCerts create ephemeral certificate 2552// request. 2553type SslCertsCreateEphemeralRequest struct { 2554 // PublicKey: PEM encoded public key to include in the signed 2555 // certificate. 2556 PublicKey string `json:"public_key,omitempty"` 2557 2558 // ForceSendFields is a list of field names (e.g. "PublicKey") to 2559 // unconditionally include in API requests. By default, fields with 2560 // empty values are omitted from API requests. However, any non-pointer, 2561 // non-interface field appearing in ForceSendFields will be sent to the 2562 // server regardless of whether the field is empty or not. This may be 2563 // used to include empty fields in Patch requests. 2564 ForceSendFields []string `json:"-"` 2565 2566 // NullFields is a list of field names (e.g. "PublicKey") to include in 2567 // API requests with the JSON null value. By default, fields with empty 2568 // values are omitted from API requests. However, any field with an 2569 // empty value appearing in NullFields will be sent to the server as 2570 // null. It is an error if a field in this list has a non-empty value. 2571 // This may be used to include null fields in Patch requests. 2572 NullFields []string `json:"-"` 2573} 2574 2575func (s *SslCertsCreateEphemeralRequest) MarshalJSON() ([]byte, error) { 2576 type NoMethod SslCertsCreateEphemeralRequest 2577 raw := NoMethod(*s) 2578 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2579} 2580 2581// SslCertsInsertRequest: SslCerts insert request. 2582type SslCertsInsertRequest struct { 2583 // CommonName: User supplied name. Must be a distinct name from the 2584 // other certificates for this instance. 2585 CommonName string `json:"commonName,omitempty"` 2586 2587 // ForceSendFields is a list of field names (e.g. "CommonName") to 2588 // unconditionally include in API requests. By default, fields with 2589 // empty values are omitted from API requests. However, any non-pointer, 2590 // non-interface field appearing in ForceSendFields will be sent to the 2591 // server regardless of whether the field is empty or not. This may be 2592 // used to include empty fields in Patch requests. 2593 ForceSendFields []string `json:"-"` 2594 2595 // NullFields is a list of field names (e.g. "CommonName") to include in 2596 // API requests with the JSON null value. By default, fields with empty 2597 // values are omitted from API requests. However, any field with an 2598 // empty value appearing in NullFields will be sent to the server as 2599 // null. It is an error if a field in this list has a non-empty value. 2600 // This may be used to include null fields in Patch requests. 2601 NullFields []string `json:"-"` 2602} 2603 2604func (s *SslCertsInsertRequest) MarshalJSON() ([]byte, error) { 2605 type NoMethod SslCertsInsertRequest 2606 raw := NoMethod(*s) 2607 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2608} 2609 2610// SslCertsInsertResponse: SslCert insert response. 2611type SslCertsInsertResponse struct { 2612 // ClientCert: The new client certificate and private key. For First 2613 // Generation instances, the new certificate does not take effect until 2614 // the instance is restarted. 2615 ClientCert *SslCertDetail `json:"clientCert,omitempty"` 2616 2617 // Kind: This is always sql#sslCertsInsert. 2618 Kind string `json:"kind,omitempty"` 2619 2620 // Operation: The operation to track the ssl certs insert request. 2621 Operation *Operation `json:"operation,omitempty"` 2622 2623 // ServerCaCert: The server Certificate Authority's certificate. If this 2624 // is missing you can force a new one to be generated by calling 2625 // resetSslConfig method on instances resource. 2626 ServerCaCert *SslCert `json:"serverCaCert,omitempty"` 2627 2628 // ServerResponse contains the HTTP response code and headers from the 2629 // server. 2630 googleapi.ServerResponse `json:"-"` 2631 2632 // ForceSendFields is a list of field names (e.g. "ClientCert") to 2633 // unconditionally include in API requests. By default, fields with 2634 // empty values are omitted from API requests. However, any non-pointer, 2635 // non-interface field appearing in ForceSendFields will be sent to the 2636 // server regardless of whether the field is empty or not. This may be 2637 // used to include empty fields in Patch requests. 2638 ForceSendFields []string `json:"-"` 2639 2640 // NullFields is a list of field names (e.g. "ClientCert") to include in 2641 // API requests with the JSON null value. By default, fields with empty 2642 // values are omitted from API requests. However, any field with an 2643 // empty value appearing in NullFields will be sent to the server as 2644 // null. It is an error if a field in this list has a non-empty value. 2645 // This may be used to include null fields in Patch requests. 2646 NullFields []string `json:"-"` 2647} 2648 2649func (s *SslCertsInsertResponse) MarshalJSON() ([]byte, error) { 2650 type NoMethod SslCertsInsertResponse 2651 raw := NoMethod(*s) 2652 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2653} 2654 2655// SslCertsListResponse: SslCerts list response. 2656type SslCertsListResponse struct { 2657 // Items: List of client certificates for the instance. 2658 Items []*SslCert `json:"items,omitempty"` 2659 2660 // Kind: This is always sql#sslCertsList. 2661 Kind string `json:"kind,omitempty"` 2662 2663 // ServerResponse contains the HTTP response code and headers from the 2664 // server. 2665 googleapi.ServerResponse `json:"-"` 2666 2667 // ForceSendFields is a list of field names (e.g. "Items") to 2668 // unconditionally include in API requests. By default, fields with 2669 // empty values are omitted from API requests. However, any non-pointer, 2670 // non-interface field appearing in ForceSendFields will be sent to the 2671 // server regardless of whether the field is empty or not. This may be 2672 // used to include empty fields in Patch requests. 2673 ForceSendFields []string `json:"-"` 2674 2675 // NullFields is a list of field names (e.g. "Items") to include in API 2676 // requests with the JSON null value. By default, fields with empty 2677 // values are omitted from API requests. However, any field with an 2678 // empty value appearing in NullFields will be sent to the server as 2679 // null. It is an error if a field in this list has a non-empty value. 2680 // This may be used to include null fields in Patch requests. 2681 NullFields []string `json:"-"` 2682} 2683 2684func (s *SslCertsListResponse) MarshalJSON() ([]byte, error) { 2685 type NoMethod SslCertsListResponse 2686 raw := NoMethod(*s) 2687 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2688} 2689 2690// Tier: A Google Cloud SQL service tier resource. 2691type Tier struct { 2692 // DiskQuota: The maximum disk size of this tier in bytes. 2693 DiskQuota int64 `json:"DiskQuota,omitempty,string"` 2694 2695 // RAM: The maximum RAM usage of this tier in bytes. 2696 RAM int64 `json:"RAM,omitempty,string"` 2697 2698 // Kind: This is always sql#tier. 2699 Kind string `json:"kind,omitempty"` 2700 2701 // Region: The applicable regions for this tier. 2702 Region []string `json:"region,omitempty"` 2703 2704 // Tier: An identifier for the machine type, for example, 2705 // db-n1-standard-1. For related information, see Pricing. 2706 Tier string `json:"tier,omitempty"` 2707 2708 // ForceSendFields is a list of field names (e.g. "DiskQuota") to 2709 // unconditionally include in API requests. By default, fields with 2710 // empty values are omitted from API requests. However, any non-pointer, 2711 // non-interface field appearing in ForceSendFields will be sent to the 2712 // server regardless of whether the field is empty or not. This may be 2713 // used to include empty fields in Patch requests. 2714 ForceSendFields []string `json:"-"` 2715 2716 // NullFields is a list of field names (e.g. "DiskQuota") to include in 2717 // API requests with the JSON null value. By default, fields with empty 2718 // values are omitted from API requests. However, any field with an 2719 // empty value appearing in NullFields will be sent to the server as 2720 // null. It is an error if a field in this list has a non-empty value. 2721 // This may be used to include null fields in Patch requests. 2722 NullFields []string `json:"-"` 2723} 2724 2725func (s *Tier) MarshalJSON() ([]byte, error) { 2726 type NoMethod Tier 2727 raw := NoMethod(*s) 2728 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2729} 2730 2731// TiersListResponse: Tiers list response. 2732type TiersListResponse struct { 2733 // Items: List of tiers. 2734 Items []*Tier `json:"items,omitempty"` 2735 2736 // Kind: This is always sql#tiersList. 2737 Kind string `json:"kind,omitempty"` 2738 2739 // ServerResponse contains the HTTP response code and headers from the 2740 // server. 2741 googleapi.ServerResponse `json:"-"` 2742 2743 // ForceSendFields is a list of field names (e.g. "Items") to 2744 // unconditionally include in API requests. By default, fields with 2745 // empty values are omitted from API requests. However, any non-pointer, 2746 // non-interface field appearing in ForceSendFields will be sent to the 2747 // server regardless of whether the field is empty or not. This may be 2748 // used to include empty fields in Patch requests. 2749 ForceSendFields []string `json:"-"` 2750 2751 // NullFields is a list of field names (e.g. "Items") to include in API 2752 // requests with the JSON null value. By default, fields with empty 2753 // values are omitted from API requests. However, any field with an 2754 // empty value appearing in NullFields will be sent to the server as 2755 // null. It is an error if a field in this list has a non-empty value. 2756 // This may be used to include null fields in Patch requests. 2757 NullFields []string `json:"-"` 2758} 2759 2760func (s *TiersListResponse) MarshalJSON() ([]byte, error) { 2761 type NoMethod TiersListResponse 2762 raw := NoMethod(*s) 2763 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2764} 2765 2766// TruncateLogContext: Database Instance truncate log context. 2767type TruncateLogContext struct { 2768 // Kind: This is always sql#truncateLogContext. 2769 Kind string `json:"kind,omitempty"` 2770 2771 // LogType: The type of log to truncate. Valid values are 2772 // MYSQL_GENERAL_TABLE and MYSQL_SLOW_TABLE. 2773 LogType string `json:"logType,omitempty"` 2774 2775 // ForceSendFields is a list of field names (e.g. "Kind") to 2776 // unconditionally include in API requests. By default, fields with 2777 // empty values are omitted from API requests. However, any non-pointer, 2778 // non-interface field appearing in ForceSendFields will be sent to the 2779 // server regardless of whether the field is empty or not. This may be 2780 // used to include empty fields in Patch requests. 2781 ForceSendFields []string `json:"-"` 2782 2783 // NullFields is a list of field names (e.g. "Kind") to include in API 2784 // requests with the JSON null value. By default, fields with empty 2785 // values are omitted from API requests. However, any field with an 2786 // empty value appearing in NullFields will be sent to the server as 2787 // null. It is an error if a field in this list has a non-empty value. 2788 // This may be used to include null fields in Patch requests. 2789 NullFields []string `json:"-"` 2790} 2791 2792func (s *TruncateLogContext) MarshalJSON() ([]byte, error) { 2793 type NoMethod TruncateLogContext 2794 raw := NoMethod(*s) 2795 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2796} 2797 2798// User: A Cloud SQL user resource. 2799type User struct { 2800 // Etag: This field is deprecated and will be removed from a future 2801 // version of the API. 2802 Etag string `json:"etag,omitempty"` 2803 2804 // Host: The host name from which the user can connect. For insert 2805 // operations, host defaults to an empty string. For update operations, 2806 // host is specified as part of the request URL. The host name cannot be 2807 // updated after insertion. 2808 Host string `json:"host,omitempty"` 2809 2810 // Instance: The name of the Cloud SQL instance. This does not include 2811 // the project ID. Can be omitted for update since it is already 2812 // specified on the URL. 2813 Instance string `json:"instance,omitempty"` 2814 2815 // Kind: This is always sql#user. 2816 Kind string `json:"kind,omitempty"` 2817 2818 // Name: The name of the user in the Cloud SQL instance. Can be omitted 2819 // for update since it is already specified in the URL. 2820 Name string `json:"name,omitempty"` 2821 2822 // Password: The password for the user. 2823 Password string `json:"password,omitempty"` 2824 2825 // Project: The project ID of the project containing the Cloud SQL 2826 // database. The Google apps domain is prefixed if applicable. Can be 2827 // omitted for update since it is already specified on the URL. 2828 Project string `json:"project,omitempty"` 2829 2830 // ForceSendFields is a list of field names (e.g. "Etag") to 2831 // unconditionally include in API requests. By default, fields with 2832 // empty values are omitted from API requests. However, any non-pointer, 2833 // non-interface field appearing in ForceSendFields will be sent to the 2834 // server regardless of whether the field is empty or not. This may be 2835 // used to include empty fields in Patch requests. 2836 ForceSendFields []string `json:"-"` 2837 2838 // NullFields is a list of field names (e.g. "Etag") to include in API 2839 // requests with the JSON null value. By default, fields with empty 2840 // values are omitted from API requests. However, any field with an 2841 // empty value appearing in NullFields will be sent to the server as 2842 // null. It is an error if a field in this list has a non-empty value. 2843 // This may be used to include null fields in Patch requests. 2844 NullFields []string `json:"-"` 2845} 2846 2847func (s *User) MarshalJSON() ([]byte, error) { 2848 type NoMethod User 2849 raw := NoMethod(*s) 2850 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2851} 2852 2853// UsersListResponse: User list response. 2854type UsersListResponse struct { 2855 // Items: List of user resources in the instance. 2856 Items []*User `json:"items,omitempty"` 2857 2858 // Kind: This is always sql#usersList. 2859 Kind string `json:"kind,omitempty"` 2860 2861 // NextPageToken: An identifier that uniquely identifies the operation. 2862 // You can use this identifier to retrieve the Operations resource that 2863 // has information about the operation. 2864 NextPageToken string `json:"nextPageToken,omitempty"` 2865 2866 // ServerResponse contains the HTTP response code and headers from the 2867 // server. 2868 googleapi.ServerResponse `json:"-"` 2869 2870 // ForceSendFields is a list of field names (e.g. "Items") to 2871 // unconditionally include in API requests. By default, fields with 2872 // empty values are omitted from API requests. However, any non-pointer, 2873 // non-interface field appearing in ForceSendFields will be sent to the 2874 // server regardless of whether the field is empty or not. This may be 2875 // used to include empty fields in Patch requests. 2876 ForceSendFields []string `json:"-"` 2877 2878 // NullFields is a list of field names (e.g. "Items") to include in API 2879 // requests with the JSON null value. By default, fields with empty 2880 // values are omitted from API requests. However, any field with an 2881 // empty value appearing in NullFields will be sent to the server as 2882 // null. It is an error if a field in this list has a non-empty value. 2883 // This may be used to include null fields in Patch requests. 2884 NullFields []string `json:"-"` 2885} 2886 2887func (s *UsersListResponse) MarshalJSON() ([]byte, error) { 2888 type NoMethod UsersListResponse 2889 raw := NoMethod(*s) 2890 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2891} 2892 2893// method id "sql.backupRuns.delete": 2894 2895type BackupRunsDeleteCall struct { 2896 s *Service 2897 project string 2898 instance string 2899 id int64 2900 urlParams_ gensupport.URLParams 2901 ctx_ context.Context 2902 header_ http.Header 2903} 2904 2905// Delete: Deletes the backup taken by a backup run. 2906func (r *BackupRunsService) Delete(project string, instance string, id int64) *BackupRunsDeleteCall { 2907 c := &BackupRunsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2908 c.project = project 2909 c.instance = instance 2910 c.id = id 2911 return c 2912} 2913 2914// Fields allows partial responses to be retrieved. See 2915// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2916// for more information. 2917func (c *BackupRunsDeleteCall) Fields(s ...googleapi.Field) *BackupRunsDeleteCall { 2918 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2919 return c 2920} 2921 2922// Context sets the context to be used in this call's Do method. Any 2923// pending HTTP request will be aborted if the provided context is 2924// canceled. 2925func (c *BackupRunsDeleteCall) Context(ctx context.Context) *BackupRunsDeleteCall { 2926 c.ctx_ = ctx 2927 return c 2928} 2929 2930// Header returns an http.Header that can be modified by the caller to 2931// add HTTP headers to the request. 2932func (c *BackupRunsDeleteCall) Header() http.Header { 2933 if c.header_ == nil { 2934 c.header_ = make(http.Header) 2935 } 2936 return c.header_ 2937} 2938 2939func (c *BackupRunsDeleteCall) doRequest(alt string) (*http.Response, error) { 2940 reqHeaders := make(http.Header) 2941 for k, v := range c.header_ { 2942 reqHeaders[k] = v 2943 } 2944 reqHeaders.Set("User-Agent", c.s.userAgent()) 2945 var body io.Reader = nil 2946 c.urlParams_.Set("alt", alt) 2947 c.urlParams_.Set("prettyPrint", "false") 2948 urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{project}/instances/{instance}/backupRuns/{id}") 2949 urls += "?" + c.urlParams_.Encode() 2950 req, err := http.NewRequest("DELETE", urls, body) 2951 if err != nil { 2952 return nil, err 2953 } 2954 req.Header = reqHeaders 2955 googleapi.Expand(req.URL, map[string]string{ 2956 "project": c.project, 2957 "instance": c.instance, 2958 "id": strconv.FormatInt(c.id, 10), 2959 }) 2960 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2961} 2962 2963// Do executes the "sql.backupRuns.delete" call. 2964// Exactly one of *Operation or error will be non-nil. Any non-2xx 2965// status code is an error. Response headers are in either 2966// *Operation.ServerResponse.Header or (if a response was returned at 2967// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 2968// to check whether the returned error was because 2969// http.StatusNotModified was returned. 2970func (c *BackupRunsDeleteCall) Do(opts ...googleapi.CallOption) (*Operation, error) { 2971 gensupport.SetOptions(c.urlParams_, opts...) 2972 res, err := c.doRequest("json") 2973 if res != nil && res.StatusCode == http.StatusNotModified { 2974 if res.Body != nil { 2975 res.Body.Close() 2976 } 2977 return nil, &googleapi.Error{ 2978 Code: res.StatusCode, 2979 Header: res.Header, 2980 } 2981 } 2982 if err != nil { 2983 return nil, err 2984 } 2985 defer googleapi.CloseBody(res) 2986 if err := googleapi.CheckResponse(res); err != nil { 2987 return nil, err 2988 } 2989 ret := &Operation{ 2990 ServerResponse: googleapi.ServerResponse{ 2991 Header: res.Header, 2992 HTTPStatusCode: res.StatusCode, 2993 }, 2994 } 2995 target := &ret 2996 if err := gensupport.DecodeResponse(target, res); err != nil { 2997 return nil, err 2998 } 2999 return ret, nil 3000 // { 3001 // "description": "Deletes the backup taken by a backup run.", 3002 // "httpMethod": "DELETE", 3003 // "id": "sql.backupRuns.delete", 3004 // "parameterOrder": [ 3005 // "project", 3006 // "instance", 3007 // "id" 3008 // ], 3009 // "parameters": { 3010 // "id": { 3011 // "description": "The ID of the Backup Run to delete. To find a Backup Run ID, use the list method.", 3012 // "format": "int64", 3013 // "location": "path", 3014 // "required": true, 3015 // "type": "string" 3016 // }, 3017 // "instance": { 3018 // "description": "Cloud SQL instance ID. This does not include the project ID.", 3019 // "location": "path", 3020 // "required": true, 3021 // "type": "string" 3022 // }, 3023 // "project": { 3024 // "description": "Project ID of the project that contains the instance.", 3025 // "location": "path", 3026 // "required": true, 3027 // "type": "string" 3028 // } 3029 // }, 3030 // "path": "projects/{project}/instances/{instance}/backupRuns/{id}", 3031 // "response": { 3032 // "$ref": "Operation" 3033 // }, 3034 // "scopes": [ 3035 // "https://www.googleapis.com/auth/cloud-platform", 3036 // "https://www.googleapis.com/auth/sqlservice.admin" 3037 // ] 3038 // } 3039 3040} 3041 3042// method id "sql.backupRuns.get": 3043 3044type BackupRunsGetCall struct { 3045 s *Service 3046 project string 3047 instance string 3048 id int64 3049 urlParams_ gensupport.URLParams 3050 ifNoneMatch_ string 3051 ctx_ context.Context 3052 header_ http.Header 3053} 3054 3055// Get: Retrieves a resource containing information about a backup run. 3056func (r *BackupRunsService) Get(project string, instance string, id int64) *BackupRunsGetCall { 3057 c := &BackupRunsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 3058 c.project = project 3059 c.instance = instance 3060 c.id = id 3061 return c 3062} 3063 3064// Fields allows partial responses to be retrieved. See 3065// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 3066// for more information. 3067func (c *BackupRunsGetCall) Fields(s ...googleapi.Field) *BackupRunsGetCall { 3068 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 3069 return c 3070} 3071 3072// IfNoneMatch sets the optional parameter which makes the operation 3073// fail if the object's ETag matches the given value. This is useful for 3074// getting updates only after the object has changed since the last 3075// request. Use googleapi.IsNotModified to check whether the response 3076// error from Do is the result of In-None-Match. 3077func (c *BackupRunsGetCall) IfNoneMatch(entityTag string) *BackupRunsGetCall { 3078 c.ifNoneMatch_ = entityTag 3079 return c 3080} 3081 3082// Context sets the context to be used in this call's Do method. Any 3083// pending HTTP request will be aborted if the provided context is 3084// canceled. 3085func (c *BackupRunsGetCall) Context(ctx context.Context) *BackupRunsGetCall { 3086 c.ctx_ = ctx 3087 return c 3088} 3089 3090// Header returns an http.Header that can be modified by the caller to 3091// add HTTP headers to the request. 3092func (c *BackupRunsGetCall) Header() http.Header { 3093 if c.header_ == nil { 3094 c.header_ = make(http.Header) 3095 } 3096 return c.header_ 3097} 3098 3099func (c *BackupRunsGetCall) doRequest(alt string) (*http.Response, error) { 3100 reqHeaders := make(http.Header) 3101 for k, v := range c.header_ { 3102 reqHeaders[k] = v 3103 } 3104 reqHeaders.Set("User-Agent", c.s.userAgent()) 3105 if c.ifNoneMatch_ != "" { 3106 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 3107 } 3108 var body io.Reader = nil 3109 c.urlParams_.Set("alt", alt) 3110 c.urlParams_.Set("prettyPrint", "false") 3111 urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{project}/instances/{instance}/backupRuns/{id}") 3112 urls += "?" + c.urlParams_.Encode() 3113 req, err := http.NewRequest("GET", urls, body) 3114 if err != nil { 3115 return nil, err 3116 } 3117 req.Header = reqHeaders 3118 googleapi.Expand(req.URL, map[string]string{ 3119 "project": c.project, 3120 "instance": c.instance, 3121 "id": strconv.FormatInt(c.id, 10), 3122 }) 3123 return gensupport.SendRequest(c.ctx_, c.s.client, req) 3124} 3125 3126// Do executes the "sql.backupRuns.get" call. 3127// Exactly one of *BackupRun or error will be non-nil. Any non-2xx 3128// status code is an error. Response headers are in either 3129// *BackupRun.ServerResponse.Header or (if a response was returned at 3130// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 3131// to check whether the returned error was because 3132// http.StatusNotModified was returned. 3133func (c *BackupRunsGetCall) Do(opts ...googleapi.CallOption) (*BackupRun, error) { 3134 gensupport.SetOptions(c.urlParams_, opts...) 3135 res, err := c.doRequest("json") 3136 if res != nil && res.StatusCode == http.StatusNotModified { 3137 if res.Body != nil { 3138 res.Body.Close() 3139 } 3140 return nil, &googleapi.Error{ 3141 Code: res.StatusCode, 3142 Header: res.Header, 3143 } 3144 } 3145 if err != nil { 3146 return nil, err 3147 } 3148 defer googleapi.CloseBody(res) 3149 if err := googleapi.CheckResponse(res); err != nil { 3150 return nil, err 3151 } 3152 ret := &BackupRun{ 3153 ServerResponse: googleapi.ServerResponse{ 3154 Header: res.Header, 3155 HTTPStatusCode: res.StatusCode, 3156 }, 3157 } 3158 target := &ret 3159 if err := gensupport.DecodeResponse(target, res); err != nil { 3160 return nil, err 3161 } 3162 return ret, nil 3163 // { 3164 // "description": "Retrieves a resource containing information about a backup run.", 3165 // "httpMethod": "GET", 3166 // "id": "sql.backupRuns.get", 3167 // "parameterOrder": [ 3168 // "project", 3169 // "instance", 3170 // "id" 3171 // ], 3172 // "parameters": { 3173 // "id": { 3174 // "description": "The ID of this Backup Run.", 3175 // "format": "int64", 3176 // "location": "path", 3177 // "required": true, 3178 // "type": "string" 3179 // }, 3180 // "instance": { 3181 // "description": "Cloud SQL instance ID. This does not include the project ID.", 3182 // "location": "path", 3183 // "required": true, 3184 // "type": "string" 3185 // }, 3186 // "project": { 3187 // "description": "Project ID of the project that contains the instance.", 3188 // "location": "path", 3189 // "required": true, 3190 // "type": "string" 3191 // } 3192 // }, 3193 // "path": "projects/{project}/instances/{instance}/backupRuns/{id}", 3194 // "response": { 3195 // "$ref": "BackupRun" 3196 // }, 3197 // "scopes": [ 3198 // "https://www.googleapis.com/auth/cloud-platform", 3199 // "https://www.googleapis.com/auth/sqlservice.admin" 3200 // ] 3201 // } 3202 3203} 3204 3205// method id "sql.backupRuns.insert": 3206 3207type BackupRunsInsertCall struct { 3208 s *Service 3209 project string 3210 instance string 3211 backuprun *BackupRun 3212 urlParams_ gensupport.URLParams 3213 ctx_ context.Context 3214 header_ http.Header 3215} 3216 3217// Insert: Creates a new backup run on demand. This method is applicable 3218// only to Second Generation instances. 3219func (r *BackupRunsService) Insert(project string, instance string, backuprun *BackupRun) *BackupRunsInsertCall { 3220 c := &BackupRunsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)} 3221 c.project = project 3222 c.instance = instance 3223 c.backuprun = backuprun 3224 return c 3225} 3226 3227// Fields allows partial responses to be retrieved. See 3228// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 3229// for more information. 3230func (c *BackupRunsInsertCall) Fields(s ...googleapi.Field) *BackupRunsInsertCall { 3231 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 3232 return c 3233} 3234 3235// Context sets the context to be used in this call's Do method. Any 3236// pending HTTP request will be aborted if the provided context is 3237// canceled. 3238func (c *BackupRunsInsertCall) Context(ctx context.Context) *BackupRunsInsertCall { 3239 c.ctx_ = ctx 3240 return c 3241} 3242 3243// Header returns an http.Header that can be modified by the caller to 3244// add HTTP headers to the request. 3245func (c *BackupRunsInsertCall) Header() http.Header { 3246 if c.header_ == nil { 3247 c.header_ = make(http.Header) 3248 } 3249 return c.header_ 3250} 3251 3252func (c *BackupRunsInsertCall) doRequest(alt string) (*http.Response, error) { 3253 reqHeaders := make(http.Header) 3254 for k, v := range c.header_ { 3255 reqHeaders[k] = v 3256 } 3257 reqHeaders.Set("User-Agent", c.s.userAgent()) 3258 var body io.Reader = nil 3259 body, err := googleapi.WithoutDataWrapper.JSONReader(c.backuprun) 3260 if err != nil { 3261 return nil, err 3262 } 3263 reqHeaders.Set("Content-Type", "application/json") 3264 c.urlParams_.Set("alt", alt) 3265 c.urlParams_.Set("prettyPrint", "false") 3266 urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{project}/instances/{instance}/backupRuns") 3267 urls += "?" + c.urlParams_.Encode() 3268 req, err := http.NewRequest("POST", urls, body) 3269 if err != nil { 3270 return nil, err 3271 } 3272 req.Header = reqHeaders 3273 googleapi.Expand(req.URL, map[string]string{ 3274 "project": c.project, 3275 "instance": c.instance, 3276 }) 3277 return gensupport.SendRequest(c.ctx_, c.s.client, req) 3278} 3279 3280// Do executes the "sql.backupRuns.insert" call. 3281// Exactly one of *Operation or error will be non-nil. Any non-2xx 3282// status code is an error. Response headers are in either 3283// *Operation.ServerResponse.Header or (if a response was returned at 3284// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 3285// to check whether the returned error was because 3286// http.StatusNotModified was returned. 3287func (c *BackupRunsInsertCall) Do(opts ...googleapi.CallOption) (*Operation, error) { 3288 gensupport.SetOptions(c.urlParams_, opts...) 3289 res, err := c.doRequest("json") 3290 if res != nil && res.StatusCode == http.StatusNotModified { 3291 if res.Body != nil { 3292 res.Body.Close() 3293 } 3294 return nil, &googleapi.Error{ 3295 Code: res.StatusCode, 3296 Header: res.Header, 3297 } 3298 } 3299 if err != nil { 3300 return nil, err 3301 } 3302 defer googleapi.CloseBody(res) 3303 if err := googleapi.CheckResponse(res); err != nil { 3304 return nil, err 3305 } 3306 ret := &Operation{ 3307 ServerResponse: googleapi.ServerResponse{ 3308 Header: res.Header, 3309 HTTPStatusCode: res.StatusCode, 3310 }, 3311 } 3312 target := &ret 3313 if err := gensupport.DecodeResponse(target, res); err != nil { 3314 return nil, err 3315 } 3316 return ret, nil 3317 // { 3318 // "description": "Creates a new backup run on demand. This method is applicable only to Second Generation instances.", 3319 // "httpMethod": "POST", 3320 // "id": "sql.backupRuns.insert", 3321 // "parameterOrder": [ 3322 // "project", 3323 // "instance" 3324 // ], 3325 // "parameters": { 3326 // "instance": { 3327 // "description": "Cloud SQL instance ID. This does not include the project ID.", 3328 // "location": "path", 3329 // "required": true, 3330 // "type": "string" 3331 // }, 3332 // "project": { 3333 // "description": "Project ID of the project that contains the instance.", 3334 // "location": "path", 3335 // "required": true, 3336 // "type": "string" 3337 // } 3338 // }, 3339 // "path": "projects/{project}/instances/{instance}/backupRuns", 3340 // "request": { 3341 // "$ref": "BackupRun" 3342 // }, 3343 // "response": { 3344 // "$ref": "Operation" 3345 // }, 3346 // "scopes": [ 3347 // "https://www.googleapis.com/auth/cloud-platform", 3348 // "https://www.googleapis.com/auth/sqlservice.admin" 3349 // ] 3350 // } 3351 3352} 3353 3354// method id "sql.backupRuns.list": 3355 3356type BackupRunsListCall struct { 3357 s *Service 3358 project string 3359 instance string 3360 urlParams_ gensupport.URLParams 3361 ifNoneMatch_ string 3362 ctx_ context.Context 3363 header_ http.Header 3364} 3365 3366// List: Lists all backup runs associated with a given instance and 3367// configuration in the reverse chronological order of the backup 3368// initiation time. 3369func (r *BackupRunsService) List(project string, instance string) *BackupRunsListCall { 3370 c := &BackupRunsListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 3371 c.project = project 3372 c.instance = instance 3373 return c 3374} 3375 3376// MaxResults sets the optional parameter "maxResults": Maximum number 3377// of backup runs per response. 3378func (c *BackupRunsListCall) MaxResults(maxResults int64) *BackupRunsListCall { 3379 c.urlParams_.Set("maxResults", fmt.Sprint(maxResults)) 3380 return c 3381} 3382 3383// PageToken sets the optional parameter "pageToken": A 3384// previously-returned page token representing part of the larger set of 3385// results to view. 3386func (c *BackupRunsListCall) PageToken(pageToken string) *BackupRunsListCall { 3387 c.urlParams_.Set("pageToken", pageToken) 3388 return c 3389} 3390 3391// Fields allows partial responses to be retrieved. See 3392// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 3393// for more information. 3394func (c *BackupRunsListCall) Fields(s ...googleapi.Field) *BackupRunsListCall { 3395 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 3396 return c 3397} 3398 3399// IfNoneMatch sets the optional parameter which makes the operation 3400// fail if the object's ETag matches the given value. This is useful for 3401// getting updates only after the object has changed since the last 3402// request. Use googleapi.IsNotModified to check whether the response 3403// error from Do is the result of In-None-Match. 3404func (c *BackupRunsListCall) IfNoneMatch(entityTag string) *BackupRunsListCall { 3405 c.ifNoneMatch_ = entityTag 3406 return c 3407} 3408 3409// Context sets the context to be used in this call's Do method. Any 3410// pending HTTP request will be aborted if the provided context is 3411// canceled. 3412func (c *BackupRunsListCall) Context(ctx context.Context) *BackupRunsListCall { 3413 c.ctx_ = ctx 3414 return c 3415} 3416 3417// Header returns an http.Header that can be modified by the caller to 3418// add HTTP headers to the request. 3419func (c *BackupRunsListCall) Header() http.Header { 3420 if c.header_ == nil { 3421 c.header_ = make(http.Header) 3422 } 3423 return c.header_ 3424} 3425 3426func (c *BackupRunsListCall) doRequest(alt string) (*http.Response, error) { 3427 reqHeaders := make(http.Header) 3428 for k, v := range c.header_ { 3429 reqHeaders[k] = v 3430 } 3431 reqHeaders.Set("User-Agent", c.s.userAgent()) 3432 if c.ifNoneMatch_ != "" { 3433 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 3434 } 3435 var body io.Reader = nil 3436 c.urlParams_.Set("alt", alt) 3437 c.urlParams_.Set("prettyPrint", "false") 3438 urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{project}/instances/{instance}/backupRuns") 3439 urls += "?" + c.urlParams_.Encode() 3440 req, err := http.NewRequest("GET", urls, body) 3441 if err != nil { 3442 return nil, err 3443 } 3444 req.Header = reqHeaders 3445 googleapi.Expand(req.URL, map[string]string{ 3446 "project": c.project, 3447 "instance": c.instance, 3448 }) 3449 return gensupport.SendRequest(c.ctx_, c.s.client, req) 3450} 3451 3452// Do executes the "sql.backupRuns.list" call. 3453// Exactly one of *BackupRunsListResponse or error will be non-nil. Any 3454// non-2xx status code is an error. Response headers are in either 3455// *BackupRunsListResponse.ServerResponse.Header or (if a response was 3456// returned at all) in error.(*googleapi.Error).Header. Use 3457// googleapi.IsNotModified to check whether the returned error was 3458// because http.StatusNotModified was returned. 3459func (c *BackupRunsListCall) Do(opts ...googleapi.CallOption) (*BackupRunsListResponse, error) { 3460 gensupport.SetOptions(c.urlParams_, opts...) 3461 res, err := c.doRequest("json") 3462 if res != nil && res.StatusCode == http.StatusNotModified { 3463 if res.Body != nil { 3464 res.Body.Close() 3465 } 3466 return nil, &googleapi.Error{ 3467 Code: res.StatusCode, 3468 Header: res.Header, 3469 } 3470 } 3471 if err != nil { 3472 return nil, err 3473 } 3474 defer googleapi.CloseBody(res) 3475 if err := googleapi.CheckResponse(res); err != nil { 3476 return nil, err 3477 } 3478 ret := &BackupRunsListResponse{ 3479 ServerResponse: googleapi.ServerResponse{ 3480 Header: res.Header, 3481 HTTPStatusCode: res.StatusCode, 3482 }, 3483 } 3484 target := &ret 3485 if err := gensupport.DecodeResponse(target, res); err != nil { 3486 return nil, err 3487 } 3488 return ret, nil 3489 // { 3490 // "description": "Lists all backup runs associated with a given instance and configuration in the reverse chronological order of the backup initiation time.", 3491 // "httpMethod": "GET", 3492 // "id": "sql.backupRuns.list", 3493 // "parameterOrder": [ 3494 // "project", 3495 // "instance" 3496 // ], 3497 // "parameters": { 3498 // "instance": { 3499 // "description": "Cloud SQL instance ID. This does not include the project ID.", 3500 // "location": "path", 3501 // "required": true, 3502 // "type": "string" 3503 // }, 3504 // "maxResults": { 3505 // "description": "Maximum number of backup runs per response.", 3506 // "format": "int32", 3507 // "location": "query", 3508 // "type": "integer" 3509 // }, 3510 // "pageToken": { 3511 // "description": "A previously-returned page token representing part of the larger set of results to view.", 3512 // "location": "query", 3513 // "type": "string" 3514 // }, 3515 // "project": { 3516 // "description": "Project ID of the project that contains the instance.", 3517 // "location": "path", 3518 // "required": true, 3519 // "type": "string" 3520 // } 3521 // }, 3522 // "path": "projects/{project}/instances/{instance}/backupRuns", 3523 // "response": { 3524 // "$ref": "BackupRunsListResponse" 3525 // }, 3526 // "scopes": [ 3527 // "https://www.googleapis.com/auth/cloud-platform", 3528 // "https://www.googleapis.com/auth/sqlservice.admin" 3529 // ] 3530 // } 3531 3532} 3533 3534// Pages invokes f for each page of results. 3535// A non-nil error returned from f will halt the iteration. 3536// The provided context supersedes any context provided to the Context method. 3537func (c *BackupRunsListCall) Pages(ctx context.Context, f func(*BackupRunsListResponse) error) error { 3538 c.ctx_ = ctx 3539 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 3540 for { 3541 x, err := c.Do() 3542 if err != nil { 3543 return err 3544 } 3545 if err := f(x); err != nil { 3546 return err 3547 } 3548 if x.NextPageToken == "" { 3549 return nil 3550 } 3551 c.PageToken(x.NextPageToken) 3552 } 3553} 3554 3555// method id "sql.databases.delete": 3556 3557type DatabasesDeleteCall struct { 3558 s *Service 3559 project string 3560 instance string 3561 database string 3562 urlParams_ gensupport.URLParams 3563 ctx_ context.Context 3564 header_ http.Header 3565} 3566 3567// Delete: Deletes a database from a Cloud SQL instance. 3568func (r *DatabasesService) Delete(project string, instance string, database string) *DatabasesDeleteCall { 3569 c := &DatabasesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 3570 c.project = project 3571 c.instance = instance 3572 c.database = database 3573 return c 3574} 3575 3576// Fields allows partial responses to be retrieved. See 3577// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 3578// for more information. 3579func (c *DatabasesDeleteCall) Fields(s ...googleapi.Field) *DatabasesDeleteCall { 3580 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 3581 return c 3582} 3583 3584// Context sets the context to be used in this call's Do method. Any 3585// pending HTTP request will be aborted if the provided context is 3586// canceled. 3587func (c *DatabasesDeleteCall) Context(ctx context.Context) *DatabasesDeleteCall { 3588 c.ctx_ = ctx 3589 return c 3590} 3591 3592// Header returns an http.Header that can be modified by the caller to 3593// add HTTP headers to the request. 3594func (c *DatabasesDeleteCall) Header() http.Header { 3595 if c.header_ == nil { 3596 c.header_ = make(http.Header) 3597 } 3598 return c.header_ 3599} 3600 3601func (c *DatabasesDeleteCall) doRequest(alt string) (*http.Response, error) { 3602 reqHeaders := make(http.Header) 3603 for k, v := range c.header_ { 3604 reqHeaders[k] = v 3605 } 3606 reqHeaders.Set("User-Agent", c.s.userAgent()) 3607 var body io.Reader = nil 3608 c.urlParams_.Set("alt", alt) 3609 c.urlParams_.Set("prettyPrint", "false") 3610 urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{project}/instances/{instance}/databases/{database}") 3611 urls += "?" + c.urlParams_.Encode() 3612 req, err := http.NewRequest("DELETE", urls, body) 3613 if err != nil { 3614 return nil, err 3615 } 3616 req.Header = reqHeaders 3617 googleapi.Expand(req.URL, map[string]string{ 3618 "project": c.project, 3619 "instance": c.instance, 3620 "database": c.database, 3621 }) 3622 return gensupport.SendRequest(c.ctx_, c.s.client, req) 3623} 3624 3625// Do executes the "sql.databases.delete" call. 3626// Exactly one of *Operation or error will be non-nil. Any non-2xx 3627// status code is an error. Response headers are in either 3628// *Operation.ServerResponse.Header or (if a response was returned at 3629// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 3630// to check whether the returned error was because 3631// http.StatusNotModified was returned. 3632func (c *DatabasesDeleteCall) Do(opts ...googleapi.CallOption) (*Operation, error) { 3633 gensupport.SetOptions(c.urlParams_, opts...) 3634 res, err := c.doRequest("json") 3635 if res != nil && res.StatusCode == http.StatusNotModified { 3636 if res.Body != nil { 3637 res.Body.Close() 3638 } 3639 return nil, &googleapi.Error{ 3640 Code: res.StatusCode, 3641 Header: res.Header, 3642 } 3643 } 3644 if err != nil { 3645 return nil, err 3646 } 3647 defer googleapi.CloseBody(res) 3648 if err := googleapi.CheckResponse(res); err != nil { 3649 return nil, err 3650 } 3651 ret := &Operation{ 3652 ServerResponse: googleapi.ServerResponse{ 3653 Header: res.Header, 3654 HTTPStatusCode: res.StatusCode, 3655 }, 3656 } 3657 target := &ret 3658 if err := gensupport.DecodeResponse(target, res); err != nil { 3659 return nil, err 3660 } 3661 return ret, nil 3662 // { 3663 // "description": "Deletes a database from a Cloud SQL instance.", 3664 // "httpMethod": "DELETE", 3665 // "id": "sql.databases.delete", 3666 // "parameterOrder": [ 3667 // "project", 3668 // "instance", 3669 // "database" 3670 // ], 3671 // "parameters": { 3672 // "database": { 3673 // "description": "Name of the database to be deleted in the instance.", 3674 // "location": "path", 3675 // "required": true, 3676 // "type": "string" 3677 // }, 3678 // "instance": { 3679 // "description": "Database instance ID. This does not include the project ID.", 3680 // "location": "path", 3681 // "required": true, 3682 // "type": "string" 3683 // }, 3684 // "project": { 3685 // "description": "Project ID of the project that contains the instance.", 3686 // "location": "path", 3687 // "required": true, 3688 // "type": "string" 3689 // } 3690 // }, 3691 // "path": "projects/{project}/instances/{instance}/databases/{database}", 3692 // "response": { 3693 // "$ref": "Operation" 3694 // }, 3695 // "scopes": [ 3696 // "https://www.googleapis.com/auth/cloud-platform", 3697 // "https://www.googleapis.com/auth/sqlservice.admin" 3698 // ] 3699 // } 3700 3701} 3702 3703// method id "sql.databases.get": 3704 3705type DatabasesGetCall struct { 3706 s *Service 3707 project string 3708 instance string 3709 database string 3710 urlParams_ gensupport.URLParams 3711 ifNoneMatch_ string 3712 ctx_ context.Context 3713 header_ http.Header 3714} 3715 3716// Get: Retrieves a resource containing information about a database 3717// inside a Cloud SQL instance. 3718func (r *DatabasesService) Get(project string, instance string, database string) *DatabasesGetCall { 3719 c := &DatabasesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 3720 c.project = project 3721 c.instance = instance 3722 c.database = database 3723 return c 3724} 3725 3726// Fields allows partial responses to be retrieved. See 3727// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 3728// for more information. 3729func (c *DatabasesGetCall) Fields(s ...googleapi.Field) *DatabasesGetCall { 3730 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 3731 return c 3732} 3733 3734// IfNoneMatch sets the optional parameter which makes the operation 3735// fail if the object's ETag matches the given value. This is useful for 3736// getting updates only after the object has changed since the last 3737// request. Use googleapi.IsNotModified to check whether the response 3738// error from Do is the result of In-None-Match. 3739func (c *DatabasesGetCall) IfNoneMatch(entityTag string) *DatabasesGetCall { 3740 c.ifNoneMatch_ = entityTag 3741 return c 3742} 3743 3744// Context sets the context to be used in this call's Do method. Any 3745// pending HTTP request will be aborted if the provided context is 3746// canceled. 3747func (c *DatabasesGetCall) Context(ctx context.Context) *DatabasesGetCall { 3748 c.ctx_ = ctx 3749 return c 3750} 3751 3752// Header returns an http.Header that can be modified by the caller to 3753// add HTTP headers to the request. 3754func (c *DatabasesGetCall) Header() http.Header { 3755 if c.header_ == nil { 3756 c.header_ = make(http.Header) 3757 } 3758 return c.header_ 3759} 3760 3761func (c *DatabasesGetCall) doRequest(alt string) (*http.Response, error) { 3762 reqHeaders := make(http.Header) 3763 for k, v := range c.header_ { 3764 reqHeaders[k] = v 3765 } 3766 reqHeaders.Set("User-Agent", c.s.userAgent()) 3767 if c.ifNoneMatch_ != "" { 3768 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 3769 } 3770 var body io.Reader = nil 3771 c.urlParams_.Set("alt", alt) 3772 c.urlParams_.Set("prettyPrint", "false") 3773 urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{project}/instances/{instance}/databases/{database}") 3774 urls += "?" + c.urlParams_.Encode() 3775 req, err := http.NewRequest("GET", urls, body) 3776 if err != nil { 3777 return nil, err 3778 } 3779 req.Header = reqHeaders 3780 googleapi.Expand(req.URL, map[string]string{ 3781 "project": c.project, 3782 "instance": c.instance, 3783 "database": c.database, 3784 }) 3785 return gensupport.SendRequest(c.ctx_, c.s.client, req) 3786} 3787 3788// Do executes the "sql.databases.get" call. 3789// Exactly one of *Database or error will be non-nil. Any non-2xx status 3790// code is an error. Response headers are in either 3791// *Database.ServerResponse.Header or (if a response was returned at 3792// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 3793// to check whether the returned error was because 3794// http.StatusNotModified was returned. 3795func (c *DatabasesGetCall) Do(opts ...googleapi.CallOption) (*Database, error) { 3796 gensupport.SetOptions(c.urlParams_, opts...) 3797 res, err := c.doRequest("json") 3798 if res != nil && res.StatusCode == http.StatusNotModified { 3799 if res.Body != nil { 3800 res.Body.Close() 3801 } 3802 return nil, &googleapi.Error{ 3803 Code: res.StatusCode, 3804 Header: res.Header, 3805 } 3806 } 3807 if err != nil { 3808 return nil, err 3809 } 3810 defer googleapi.CloseBody(res) 3811 if err := googleapi.CheckResponse(res); err != nil { 3812 return nil, err 3813 } 3814 ret := &Database{ 3815 ServerResponse: googleapi.ServerResponse{ 3816 Header: res.Header, 3817 HTTPStatusCode: res.StatusCode, 3818 }, 3819 } 3820 target := &ret 3821 if err := gensupport.DecodeResponse(target, res); err != nil { 3822 return nil, err 3823 } 3824 return ret, nil 3825 // { 3826 // "description": "Retrieves a resource containing information about a database inside a Cloud SQL instance.", 3827 // "httpMethod": "GET", 3828 // "id": "sql.databases.get", 3829 // "parameterOrder": [ 3830 // "project", 3831 // "instance", 3832 // "database" 3833 // ], 3834 // "parameters": { 3835 // "database": { 3836 // "description": "Name of the database in the instance.", 3837 // "location": "path", 3838 // "required": true, 3839 // "type": "string" 3840 // }, 3841 // "instance": { 3842 // "description": "Database instance ID. This does not include the project ID.", 3843 // "location": "path", 3844 // "required": true, 3845 // "type": "string" 3846 // }, 3847 // "project": { 3848 // "description": "Project ID of the project that contains the instance.", 3849 // "location": "path", 3850 // "required": true, 3851 // "type": "string" 3852 // } 3853 // }, 3854 // "path": "projects/{project}/instances/{instance}/databases/{database}", 3855 // "response": { 3856 // "$ref": "Database" 3857 // }, 3858 // "scopes": [ 3859 // "https://www.googleapis.com/auth/cloud-platform", 3860 // "https://www.googleapis.com/auth/sqlservice.admin" 3861 // ] 3862 // } 3863 3864} 3865 3866// method id "sql.databases.insert": 3867 3868type DatabasesInsertCall struct { 3869 s *Service 3870 project string 3871 instance string 3872 database *Database 3873 urlParams_ gensupport.URLParams 3874 ctx_ context.Context 3875 header_ http.Header 3876} 3877 3878// Insert: Inserts a resource containing information about a database 3879// inside a Cloud SQL instance. 3880func (r *DatabasesService) Insert(project string, instance string, database *Database) *DatabasesInsertCall { 3881 c := &DatabasesInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)} 3882 c.project = project 3883 c.instance = instance 3884 c.database = database 3885 return c 3886} 3887 3888// Fields allows partial responses to be retrieved. See 3889// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 3890// for more information. 3891func (c *DatabasesInsertCall) Fields(s ...googleapi.Field) *DatabasesInsertCall { 3892 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 3893 return c 3894} 3895 3896// Context sets the context to be used in this call's Do method. Any 3897// pending HTTP request will be aborted if the provided context is 3898// canceled. 3899func (c *DatabasesInsertCall) Context(ctx context.Context) *DatabasesInsertCall { 3900 c.ctx_ = ctx 3901 return c 3902} 3903 3904// Header returns an http.Header that can be modified by the caller to 3905// add HTTP headers to the request. 3906func (c *DatabasesInsertCall) Header() http.Header { 3907 if c.header_ == nil { 3908 c.header_ = make(http.Header) 3909 } 3910 return c.header_ 3911} 3912 3913func (c *DatabasesInsertCall) doRequest(alt string) (*http.Response, error) { 3914 reqHeaders := make(http.Header) 3915 for k, v := range c.header_ { 3916 reqHeaders[k] = v 3917 } 3918 reqHeaders.Set("User-Agent", c.s.userAgent()) 3919 var body io.Reader = nil 3920 body, err := googleapi.WithoutDataWrapper.JSONReader(c.database) 3921 if err != nil { 3922 return nil, err 3923 } 3924 reqHeaders.Set("Content-Type", "application/json") 3925 c.urlParams_.Set("alt", alt) 3926 c.urlParams_.Set("prettyPrint", "false") 3927 urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{project}/instances/{instance}/databases") 3928 urls += "?" + c.urlParams_.Encode() 3929 req, err := http.NewRequest("POST", urls, body) 3930 if err != nil { 3931 return nil, err 3932 } 3933 req.Header = reqHeaders 3934 googleapi.Expand(req.URL, map[string]string{ 3935 "project": c.project, 3936 "instance": c.instance, 3937 }) 3938 return gensupport.SendRequest(c.ctx_, c.s.client, req) 3939} 3940 3941// Do executes the "sql.databases.insert" call. 3942// Exactly one of *Operation or error will be non-nil. Any non-2xx 3943// status code is an error. Response headers are in either 3944// *Operation.ServerResponse.Header or (if a response was returned at 3945// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 3946// to check whether the returned error was because 3947// http.StatusNotModified was returned. 3948func (c *DatabasesInsertCall) Do(opts ...googleapi.CallOption) (*Operation, error) { 3949 gensupport.SetOptions(c.urlParams_, opts...) 3950 res, err := c.doRequest("json") 3951 if res != nil && res.StatusCode == http.StatusNotModified { 3952 if res.Body != nil { 3953 res.Body.Close() 3954 } 3955 return nil, &googleapi.Error{ 3956 Code: res.StatusCode, 3957 Header: res.Header, 3958 } 3959 } 3960 if err != nil { 3961 return nil, err 3962 } 3963 defer googleapi.CloseBody(res) 3964 if err := googleapi.CheckResponse(res); err != nil { 3965 return nil, err 3966 } 3967 ret := &Operation{ 3968 ServerResponse: googleapi.ServerResponse{ 3969 Header: res.Header, 3970 HTTPStatusCode: res.StatusCode, 3971 }, 3972 } 3973 target := &ret 3974 if err := gensupport.DecodeResponse(target, res); err != nil { 3975 return nil, err 3976 } 3977 return ret, nil 3978 // { 3979 // "description": "Inserts a resource containing information about a database inside a Cloud SQL instance.", 3980 // "httpMethod": "POST", 3981 // "id": "sql.databases.insert", 3982 // "parameterOrder": [ 3983 // "project", 3984 // "instance" 3985 // ], 3986 // "parameters": { 3987 // "instance": { 3988 // "description": "Database instance ID. This does not include the project ID.", 3989 // "location": "path", 3990 // "required": true, 3991 // "type": "string" 3992 // }, 3993 // "project": { 3994 // "description": "Project ID of the project that contains the instance.", 3995 // "location": "path", 3996 // "required": true, 3997 // "type": "string" 3998 // } 3999 // }, 4000 // "path": "projects/{project}/instances/{instance}/databases", 4001 // "request": { 4002 // "$ref": "Database" 4003 // }, 4004 // "response": { 4005 // "$ref": "Operation" 4006 // }, 4007 // "scopes": [ 4008 // "https://www.googleapis.com/auth/cloud-platform", 4009 // "https://www.googleapis.com/auth/sqlservice.admin" 4010 // ] 4011 // } 4012 4013} 4014 4015// method id "sql.databases.list": 4016 4017type DatabasesListCall struct { 4018 s *Service 4019 project string 4020 instance string 4021 urlParams_ gensupport.URLParams 4022 ifNoneMatch_ string 4023 ctx_ context.Context 4024 header_ http.Header 4025} 4026 4027// List: Lists databases in the specified Cloud SQL instance. 4028func (r *DatabasesService) List(project string, instance string) *DatabasesListCall { 4029 c := &DatabasesListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 4030 c.project = project 4031 c.instance = instance 4032 return c 4033} 4034 4035// Fields allows partial responses to be retrieved. See 4036// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 4037// for more information. 4038func (c *DatabasesListCall) Fields(s ...googleapi.Field) *DatabasesListCall { 4039 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 4040 return c 4041} 4042 4043// IfNoneMatch sets the optional parameter which makes the operation 4044// fail if the object's ETag matches the given value. This is useful for 4045// getting updates only after the object has changed since the last 4046// request. Use googleapi.IsNotModified to check whether the response 4047// error from Do is the result of In-None-Match. 4048func (c *DatabasesListCall) IfNoneMatch(entityTag string) *DatabasesListCall { 4049 c.ifNoneMatch_ = entityTag 4050 return c 4051} 4052 4053// Context sets the context to be used in this call's Do method. Any 4054// pending HTTP request will be aborted if the provided context is 4055// canceled. 4056func (c *DatabasesListCall) Context(ctx context.Context) *DatabasesListCall { 4057 c.ctx_ = ctx 4058 return c 4059} 4060 4061// Header returns an http.Header that can be modified by the caller to 4062// add HTTP headers to the request. 4063func (c *DatabasesListCall) Header() http.Header { 4064 if c.header_ == nil { 4065 c.header_ = make(http.Header) 4066 } 4067 return c.header_ 4068} 4069 4070func (c *DatabasesListCall) doRequest(alt string) (*http.Response, error) { 4071 reqHeaders := make(http.Header) 4072 for k, v := range c.header_ { 4073 reqHeaders[k] = v 4074 } 4075 reqHeaders.Set("User-Agent", c.s.userAgent()) 4076 if c.ifNoneMatch_ != "" { 4077 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 4078 } 4079 var body io.Reader = nil 4080 c.urlParams_.Set("alt", alt) 4081 c.urlParams_.Set("prettyPrint", "false") 4082 urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{project}/instances/{instance}/databases") 4083 urls += "?" + c.urlParams_.Encode() 4084 req, err := http.NewRequest("GET", urls, body) 4085 if err != nil { 4086 return nil, err 4087 } 4088 req.Header = reqHeaders 4089 googleapi.Expand(req.URL, map[string]string{ 4090 "project": c.project, 4091 "instance": c.instance, 4092 }) 4093 return gensupport.SendRequest(c.ctx_, c.s.client, req) 4094} 4095 4096// Do executes the "sql.databases.list" call. 4097// Exactly one of *DatabasesListResponse or error will be non-nil. Any 4098// non-2xx status code is an error. Response headers are in either 4099// *DatabasesListResponse.ServerResponse.Header or (if a response was 4100// returned at all) in error.(*googleapi.Error).Header. Use 4101// googleapi.IsNotModified to check whether the returned error was 4102// because http.StatusNotModified was returned. 4103func (c *DatabasesListCall) Do(opts ...googleapi.CallOption) (*DatabasesListResponse, error) { 4104 gensupport.SetOptions(c.urlParams_, opts...) 4105 res, err := c.doRequest("json") 4106 if res != nil && res.StatusCode == http.StatusNotModified { 4107 if res.Body != nil { 4108 res.Body.Close() 4109 } 4110 return nil, &googleapi.Error{ 4111 Code: res.StatusCode, 4112 Header: res.Header, 4113 } 4114 } 4115 if err != nil { 4116 return nil, err 4117 } 4118 defer googleapi.CloseBody(res) 4119 if err := googleapi.CheckResponse(res); err != nil { 4120 return nil, err 4121 } 4122 ret := &DatabasesListResponse{ 4123 ServerResponse: googleapi.ServerResponse{ 4124 Header: res.Header, 4125 HTTPStatusCode: res.StatusCode, 4126 }, 4127 } 4128 target := &ret 4129 if err := gensupport.DecodeResponse(target, res); err != nil { 4130 return nil, err 4131 } 4132 return ret, nil 4133 // { 4134 // "description": "Lists databases in the specified Cloud SQL instance.", 4135 // "httpMethod": "GET", 4136 // "id": "sql.databases.list", 4137 // "parameterOrder": [ 4138 // "project", 4139 // "instance" 4140 // ], 4141 // "parameters": { 4142 // "instance": { 4143 // "description": "Cloud SQL instance ID. This does not include the project ID.", 4144 // "location": "path", 4145 // "required": true, 4146 // "type": "string" 4147 // }, 4148 // "project": { 4149 // "description": "Project ID of the project that contains the instance.", 4150 // "location": "path", 4151 // "required": true, 4152 // "type": "string" 4153 // } 4154 // }, 4155 // "path": "projects/{project}/instances/{instance}/databases", 4156 // "response": { 4157 // "$ref": "DatabasesListResponse" 4158 // }, 4159 // "scopes": [ 4160 // "https://www.googleapis.com/auth/cloud-platform", 4161 // "https://www.googleapis.com/auth/sqlservice.admin" 4162 // ] 4163 // } 4164 4165} 4166 4167// method id "sql.databases.patch": 4168 4169type DatabasesPatchCall struct { 4170 s *Service 4171 project string 4172 instance string 4173 database string 4174 database2 *Database 4175 urlParams_ gensupport.URLParams 4176 ctx_ context.Context 4177 header_ http.Header 4178} 4179 4180// Patch: Updates a resource containing information about a database 4181// inside a Cloud SQL instance. This method supports patch semantics. 4182func (r *DatabasesService) Patch(project string, instance string, database string, database2 *Database) *DatabasesPatchCall { 4183 c := &DatabasesPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)} 4184 c.project = project 4185 c.instance = instance 4186 c.database = database 4187 c.database2 = database2 4188 return c 4189} 4190 4191// Fields allows partial responses to be retrieved. See 4192// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 4193// for more information. 4194func (c *DatabasesPatchCall) Fields(s ...googleapi.Field) *DatabasesPatchCall { 4195 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 4196 return c 4197} 4198 4199// Context sets the context to be used in this call's Do method. Any 4200// pending HTTP request will be aborted if the provided context is 4201// canceled. 4202func (c *DatabasesPatchCall) Context(ctx context.Context) *DatabasesPatchCall { 4203 c.ctx_ = ctx 4204 return c 4205} 4206 4207// Header returns an http.Header that can be modified by the caller to 4208// add HTTP headers to the request. 4209func (c *DatabasesPatchCall) Header() http.Header { 4210 if c.header_ == nil { 4211 c.header_ = make(http.Header) 4212 } 4213 return c.header_ 4214} 4215 4216func (c *DatabasesPatchCall) doRequest(alt string) (*http.Response, error) { 4217 reqHeaders := make(http.Header) 4218 for k, v := range c.header_ { 4219 reqHeaders[k] = v 4220 } 4221 reqHeaders.Set("User-Agent", c.s.userAgent()) 4222 var body io.Reader = nil 4223 body, err := googleapi.WithoutDataWrapper.JSONReader(c.database2) 4224 if err != nil { 4225 return nil, err 4226 } 4227 reqHeaders.Set("Content-Type", "application/json") 4228 c.urlParams_.Set("alt", alt) 4229 c.urlParams_.Set("prettyPrint", "false") 4230 urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{project}/instances/{instance}/databases/{database}") 4231 urls += "?" + c.urlParams_.Encode() 4232 req, err := http.NewRequest("PATCH", urls, body) 4233 if err != nil { 4234 return nil, err 4235 } 4236 req.Header = reqHeaders 4237 googleapi.Expand(req.URL, map[string]string{ 4238 "project": c.project, 4239 "instance": c.instance, 4240 "database": c.database, 4241 }) 4242 return gensupport.SendRequest(c.ctx_, c.s.client, req) 4243} 4244 4245// Do executes the "sql.databases.patch" call. 4246// Exactly one of *Operation or error will be non-nil. Any non-2xx 4247// status code is an error. Response headers are in either 4248// *Operation.ServerResponse.Header or (if a response was returned at 4249// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 4250// to check whether the returned error was because 4251// http.StatusNotModified was returned. 4252func (c *DatabasesPatchCall) Do(opts ...googleapi.CallOption) (*Operation, error) { 4253 gensupport.SetOptions(c.urlParams_, opts...) 4254 res, err := c.doRequest("json") 4255 if res != nil && res.StatusCode == http.StatusNotModified { 4256 if res.Body != nil { 4257 res.Body.Close() 4258 } 4259 return nil, &googleapi.Error{ 4260 Code: res.StatusCode, 4261 Header: res.Header, 4262 } 4263 } 4264 if err != nil { 4265 return nil, err 4266 } 4267 defer googleapi.CloseBody(res) 4268 if err := googleapi.CheckResponse(res); err != nil { 4269 return nil, err 4270 } 4271 ret := &Operation{ 4272 ServerResponse: googleapi.ServerResponse{ 4273 Header: res.Header, 4274 HTTPStatusCode: res.StatusCode, 4275 }, 4276 } 4277 target := &ret 4278 if err := gensupport.DecodeResponse(target, res); err != nil { 4279 return nil, err 4280 } 4281 return ret, nil 4282 // { 4283 // "description": "Updates a resource containing information about a database inside a Cloud SQL instance. This method supports patch semantics.", 4284 // "httpMethod": "PATCH", 4285 // "id": "sql.databases.patch", 4286 // "parameterOrder": [ 4287 // "project", 4288 // "instance", 4289 // "database" 4290 // ], 4291 // "parameters": { 4292 // "database": { 4293 // "description": "Name of the database to be updated in the instance.", 4294 // "location": "path", 4295 // "required": true, 4296 // "type": "string" 4297 // }, 4298 // "instance": { 4299 // "description": "Database instance ID. This does not include the project ID.", 4300 // "location": "path", 4301 // "required": true, 4302 // "type": "string" 4303 // }, 4304 // "project": { 4305 // "description": "Project ID of the project that contains the instance.", 4306 // "location": "path", 4307 // "required": true, 4308 // "type": "string" 4309 // } 4310 // }, 4311 // "path": "projects/{project}/instances/{instance}/databases/{database}", 4312 // "request": { 4313 // "$ref": "Database" 4314 // }, 4315 // "response": { 4316 // "$ref": "Operation" 4317 // }, 4318 // "scopes": [ 4319 // "https://www.googleapis.com/auth/cloud-platform", 4320 // "https://www.googleapis.com/auth/sqlservice.admin" 4321 // ] 4322 // } 4323 4324} 4325 4326// method id "sql.databases.update": 4327 4328type DatabasesUpdateCall struct { 4329 s *Service 4330 project string 4331 instance string 4332 database string 4333 database2 *Database 4334 urlParams_ gensupport.URLParams 4335 ctx_ context.Context 4336 header_ http.Header 4337} 4338 4339// Update: Updates a resource containing information about a database 4340// inside a Cloud SQL instance. 4341func (r *DatabasesService) Update(project string, instance string, database string, database2 *Database) *DatabasesUpdateCall { 4342 c := &DatabasesUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 4343 c.project = project 4344 c.instance = instance 4345 c.database = database 4346 c.database2 = database2 4347 return c 4348} 4349 4350// Fields allows partial responses to be retrieved. See 4351// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 4352// for more information. 4353func (c *DatabasesUpdateCall) Fields(s ...googleapi.Field) *DatabasesUpdateCall { 4354 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 4355 return c 4356} 4357 4358// Context sets the context to be used in this call's Do method. Any 4359// pending HTTP request will be aborted if the provided context is 4360// canceled. 4361func (c *DatabasesUpdateCall) Context(ctx context.Context) *DatabasesUpdateCall { 4362 c.ctx_ = ctx 4363 return c 4364} 4365 4366// Header returns an http.Header that can be modified by the caller to 4367// add HTTP headers to the request. 4368func (c *DatabasesUpdateCall) Header() http.Header { 4369 if c.header_ == nil { 4370 c.header_ = make(http.Header) 4371 } 4372 return c.header_ 4373} 4374 4375func (c *DatabasesUpdateCall) doRequest(alt string) (*http.Response, error) { 4376 reqHeaders := make(http.Header) 4377 for k, v := range c.header_ { 4378 reqHeaders[k] = v 4379 } 4380 reqHeaders.Set("User-Agent", c.s.userAgent()) 4381 var body io.Reader = nil 4382 body, err := googleapi.WithoutDataWrapper.JSONReader(c.database2) 4383 if err != nil { 4384 return nil, err 4385 } 4386 reqHeaders.Set("Content-Type", "application/json") 4387 c.urlParams_.Set("alt", alt) 4388 c.urlParams_.Set("prettyPrint", "false") 4389 urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{project}/instances/{instance}/databases/{database}") 4390 urls += "?" + c.urlParams_.Encode() 4391 req, err := http.NewRequest("PUT", urls, body) 4392 if err != nil { 4393 return nil, err 4394 } 4395 req.Header = reqHeaders 4396 googleapi.Expand(req.URL, map[string]string{ 4397 "project": c.project, 4398 "instance": c.instance, 4399 "database": c.database, 4400 }) 4401 return gensupport.SendRequest(c.ctx_, c.s.client, req) 4402} 4403 4404// Do executes the "sql.databases.update" call. 4405// Exactly one of *Operation or error will be non-nil. Any non-2xx 4406// status code is an error. Response headers are in either 4407// *Operation.ServerResponse.Header or (if a response was returned at 4408// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 4409// to check whether the returned error was because 4410// http.StatusNotModified was returned. 4411func (c *DatabasesUpdateCall) Do(opts ...googleapi.CallOption) (*Operation, error) { 4412 gensupport.SetOptions(c.urlParams_, opts...) 4413 res, err := c.doRequest("json") 4414 if res != nil && res.StatusCode == http.StatusNotModified { 4415 if res.Body != nil { 4416 res.Body.Close() 4417 } 4418 return nil, &googleapi.Error{ 4419 Code: res.StatusCode, 4420 Header: res.Header, 4421 } 4422 } 4423 if err != nil { 4424 return nil, err 4425 } 4426 defer googleapi.CloseBody(res) 4427 if err := googleapi.CheckResponse(res); err != nil { 4428 return nil, err 4429 } 4430 ret := &Operation{ 4431 ServerResponse: googleapi.ServerResponse{ 4432 Header: res.Header, 4433 HTTPStatusCode: res.StatusCode, 4434 }, 4435 } 4436 target := &ret 4437 if err := gensupport.DecodeResponse(target, res); err != nil { 4438 return nil, err 4439 } 4440 return ret, nil 4441 // { 4442 // "description": "Updates a resource containing information about a database inside a Cloud SQL instance.", 4443 // "httpMethod": "PUT", 4444 // "id": "sql.databases.update", 4445 // "parameterOrder": [ 4446 // "project", 4447 // "instance", 4448 // "database" 4449 // ], 4450 // "parameters": { 4451 // "database": { 4452 // "description": "Name of the database to be updated in the instance.", 4453 // "location": "path", 4454 // "required": true, 4455 // "type": "string" 4456 // }, 4457 // "instance": { 4458 // "description": "Database instance ID. This does not include the project ID.", 4459 // "location": "path", 4460 // "required": true, 4461 // "type": "string" 4462 // }, 4463 // "project": { 4464 // "description": "Project ID of the project that contains the instance.", 4465 // "location": "path", 4466 // "required": true, 4467 // "type": "string" 4468 // } 4469 // }, 4470 // "path": "projects/{project}/instances/{instance}/databases/{database}", 4471 // "request": { 4472 // "$ref": "Database" 4473 // }, 4474 // "response": { 4475 // "$ref": "Operation" 4476 // }, 4477 // "scopes": [ 4478 // "https://www.googleapis.com/auth/cloud-platform", 4479 // "https://www.googleapis.com/auth/sqlservice.admin" 4480 // ] 4481 // } 4482 4483} 4484 4485// method id "sql.flags.list": 4486 4487type FlagsListCall struct { 4488 s *Service 4489 urlParams_ gensupport.URLParams 4490 ifNoneMatch_ string 4491 ctx_ context.Context 4492 header_ http.Header 4493} 4494 4495// List: List all available database flags for Cloud SQL instances. 4496func (r *FlagsService) List() *FlagsListCall { 4497 c := &FlagsListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 4498 return c 4499} 4500 4501// DatabaseVersion sets the optional parameter "databaseVersion": 4502// Database type and version you want to retrieve flags for. By default, 4503// this method returns flags for all database types and versions. 4504func (c *FlagsListCall) DatabaseVersion(databaseVersion string) *FlagsListCall { 4505 c.urlParams_.Set("databaseVersion", databaseVersion) 4506 return c 4507} 4508 4509// Fields allows partial responses to be retrieved. See 4510// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 4511// for more information. 4512func (c *FlagsListCall) Fields(s ...googleapi.Field) *FlagsListCall { 4513 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 4514 return c 4515} 4516 4517// IfNoneMatch sets the optional parameter which makes the operation 4518// fail if the object's ETag matches the given value. This is useful for 4519// getting updates only after the object has changed since the last 4520// request. Use googleapi.IsNotModified to check whether the response 4521// error from Do is the result of In-None-Match. 4522func (c *FlagsListCall) IfNoneMatch(entityTag string) *FlagsListCall { 4523 c.ifNoneMatch_ = entityTag 4524 return c 4525} 4526 4527// Context sets the context to be used in this call's Do method. Any 4528// pending HTTP request will be aborted if the provided context is 4529// canceled. 4530func (c *FlagsListCall) Context(ctx context.Context) *FlagsListCall { 4531 c.ctx_ = ctx 4532 return c 4533} 4534 4535// Header returns an http.Header that can be modified by the caller to 4536// add HTTP headers to the request. 4537func (c *FlagsListCall) Header() http.Header { 4538 if c.header_ == nil { 4539 c.header_ = make(http.Header) 4540 } 4541 return c.header_ 4542} 4543 4544func (c *FlagsListCall) doRequest(alt string) (*http.Response, error) { 4545 reqHeaders := make(http.Header) 4546 for k, v := range c.header_ { 4547 reqHeaders[k] = v 4548 } 4549 reqHeaders.Set("User-Agent", c.s.userAgent()) 4550 if c.ifNoneMatch_ != "" { 4551 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 4552 } 4553 var body io.Reader = nil 4554 c.urlParams_.Set("alt", alt) 4555 c.urlParams_.Set("prettyPrint", "false") 4556 urls := googleapi.ResolveRelative(c.s.BasePath, "flags") 4557 urls += "?" + c.urlParams_.Encode() 4558 req, err := http.NewRequest("GET", urls, body) 4559 if err != nil { 4560 return nil, err 4561 } 4562 req.Header = reqHeaders 4563 return gensupport.SendRequest(c.ctx_, c.s.client, req) 4564} 4565 4566// Do executes the "sql.flags.list" call. 4567// Exactly one of *FlagsListResponse or error will be non-nil. Any 4568// non-2xx status code is an error. Response headers are in either 4569// *FlagsListResponse.ServerResponse.Header or (if a response was 4570// returned at all) in error.(*googleapi.Error).Header. Use 4571// googleapi.IsNotModified to check whether the returned error was 4572// because http.StatusNotModified was returned. 4573func (c *FlagsListCall) Do(opts ...googleapi.CallOption) (*FlagsListResponse, error) { 4574 gensupport.SetOptions(c.urlParams_, opts...) 4575 res, err := c.doRequest("json") 4576 if res != nil && res.StatusCode == http.StatusNotModified { 4577 if res.Body != nil { 4578 res.Body.Close() 4579 } 4580 return nil, &googleapi.Error{ 4581 Code: res.StatusCode, 4582 Header: res.Header, 4583 } 4584 } 4585 if err != nil { 4586 return nil, err 4587 } 4588 defer googleapi.CloseBody(res) 4589 if err := googleapi.CheckResponse(res); err != nil { 4590 return nil, err 4591 } 4592 ret := &FlagsListResponse{ 4593 ServerResponse: googleapi.ServerResponse{ 4594 Header: res.Header, 4595 HTTPStatusCode: res.StatusCode, 4596 }, 4597 } 4598 target := &ret 4599 if err := gensupport.DecodeResponse(target, res); err != nil { 4600 return nil, err 4601 } 4602 return ret, nil 4603 // { 4604 // "description": "List all available database flags for Cloud SQL instances.", 4605 // "httpMethod": "GET", 4606 // "id": "sql.flags.list", 4607 // "parameters": { 4608 // "databaseVersion": { 4609 // "description": "Database type and version you want to retrieve flags for. By default, this method returns flags for all database types and versions.", 4610 // "location": "query", 4611 // "type": "string" 4612 // } 4613 // }, 4614 // "path": "flags", 4615 // "response": { 4616 // "$ref": "FlagsListResponse" 4617 // }, 4618 // "scopes": [ 4619 // "https://www.googleapis.com/auth/cloud-platform", 4620 // "https://www.googleapis.com/auth/sqlservice.admin" 4621 // ] 4622 // } 4623 4624} 4625 4626// method id "sql.instances.addServerCa": 4627 4628type InstancesAddServerCaCall struct { 4629 s *Service 4630 project string 4631 instance string 4632 urlParams_ gensupport.URLParams 4633 ctx_ context.Context 4634 header_ http.Header 4635} 4636 4637// AddServerCa: Add a new trusted Certificate Authority (CA) version for 4638// the specified instance. Required to prepare for a certificate 4639// rotation. If a CA version was previously added but never used in a 4640// certificate rotation, this operation replaces that version. There 4641// cannot be more than one CA version waiting to be rotated in. 4642func (r *InstancesService) AddServerCa(project string, instance string) *InstancesAddServerCaCall { 4643 c := &InstancesAddServerCaCall{s: r.s, urlParams_: make(gensupport.URLParams)} 4644 c.project = project 4645 c.instance = instance 4646 return c 4647} 4648 4649// Fields allows partial responses to be retrieved. See 4650// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 4651// for more information. 4652func (c *InstancesAddServerCaCall) Fields(s ...googleapi.Field) *InstancesAddServerCaCall { 4653 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 4654 return c 4655} 4656 4657// Context sets the context to be used in this call's Do method. Any 4658// pending HTTP request will be aborted if the provided context is 4659// canceled. 4660func (c *InstancesAddServerCaCall) Context(ctx context.Context) *InstancesAddServerCaCall { 4661 c.ctx_ = ctx 4662 return c 4663} 4664 4665// Header returns an http.Header that can be modified by the caller to 4666// add HTTP headers to the request. 4667func (c *InstancesAddServerCaCall) Header() http.Header { 4668 if c.header_ == nil { 4669 c.header_ = make(http.Header) 4670 } 4671 return c.header_ 4672} 4673 4674func (c *InstancesAddServerCaCall) doRequest(alt string) (*http.Response, error) { 4675 reqHeaders := make(http.Header) 4676 for k, v := range c.header_ { 4677 reqHeaders[k] = v 4678 } 4679 reqHeaders.Set("User-Agent", c.s.userAgent()) 4680 var body io.Reader = nil 4681 c.urlParams_.Set("alt", alt) 4682 c.urlParams_.Set("prettyPrint", "false") 4683 urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{project}/instances/{instance}/addServerCa") 4684 urls += "?" + c.urlParams_.Encode() 4685 req, err := http.NewRequest("POST", urls, body) 4686 if err != nil { 4687 return nil, err 4688 } 4689 req.Header = reqHeaders 4690 googleapi.Expand(req.URL, map[string]string{ 4691 "project": c.project, 4692 "instance": c.instance, 4693 }) 4694 return gensupport.SendRequest(c.ctx_, c.s.client, req) 4695} 4696 4697// Do executes the "sql.instances.addServerCa" call. 4698// Exactly one of *Operation or error will be non-nil. Any non-2xx 4699// status code is an error. Response headers are in either 4700// *Operation.ServerResponse.Header or (if a response was returned at 4701// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 4702// to check whether the returned error was because 4703// http.StatusNotModified was returned. 4704func (c *InstancesAddServerCaCall) Do(opts ...googleapi.CallOption) (*Operation, error) { 4705 gensupport.SetOptions(c.urlParams_, opts...) 4706 res, err := c.doRequest("json") 4707 if res != nil && res.StatusCode == http.StatusNotModified { 4708 if res.Body != nil { 4709 res.Body.Close() 4710 } 4711 return nil, &googleapi.Error{ 4712 Code: res.StatusCode, 4713 Header: res.Header, 4714 } 4715 } 4716 if err != nil { 4717 return nil, err 4718 } 4719 defer googleapi.CloseBody(res) 4720 if err := googleapi.CheckResponse(res); err != nil { 4721 return nil, err 4722 } 4723 ret := &Operation{ 4724 ServerResponse: googleapi.ServerResponse{ 4725 Header: res.Header, 4726 HTTPStatusCode: res.StatusCode, 4727 }, 4728 } 4729 target := &ret 4730 if err := gensupport.DecodeResponse(target, res); err != nil { 4731 return nil, err 4732 } 4733 return ret, nil 4734 // { 4735 // "description": "Add a new trusted Certificate Authority (CA) version for the specified instance. Required to prepare for a certificate rotation. If a CA version was previously added but never used in a certificate rotation, this operation replaces that version. There cannot be more than one CA version waiting to be rotated in.", 4736 // "httpMethod": "POST", 4737 // "id": "sql.instances.addServerCa", 4738 // "parameterOrder": [ 4739 // "project", 4740 // "instance" 4741 // ], 4742 // "parameters": { 4743 // "instance": { 4744 // "description": "Cloud SQL instance ID. This does not include the project ID.", 4745 // "location": "path", 4746 // "required": true, 4747 // "type": "string" 4748 // }, 4749 // "project": { 4750 // "description": "Project ID of the project that contains the instance.", 4751 // "location": "path", 4752 // "required": true, 4753 // "type": "string" 4754 // } 4755 // }, 4756 // "path": "projects/{project}/instances/{instance}/addServerCa", 4757 // "response": { 4758 // "$ref": "Operation" 4759 // }, 4760 // "scopes": [ 4761 // "https://www.googleapis.com/auth/cloud-platform", 4762 // "https://www.googleapis.com/auth/sqlservice.admin" 4763 // ] 4764 // } 4765 4766} 4767 4768// method id "sql.instances.clone": 4769 4770type InstancesCloneCall struct { 4771 s *Service 4772 project string 4773 instance string 4774 instancesclonerequest *InstancesCloneRequest 4775 urlParams_ gensupport.URLParams 4776 ctx_ context.Context 4777 header_ http.Header 4778} 4779 4780// Clone: Creates a Cloud SQL instance as a clone of the source 4781// instance. 4782func (r *InstancesService) Clone(project string, instance string, instancesclonerequest *InstancesCloneRequest) *InstancesCloneCall { 4783 c := &InstancesCloneCall{s: r.s, urlParams_: make(gensupport.URLParams)} 4784 c.project = project 4785 c.instance = instance 4786 c.instancesclonerequest = instancesclonerequest 4787 return c 4788} 4789 4790// Fields allows partial responses to be retrieved. See 4791// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 4792// for more information. 4793func (c *InstancesCloneCall) Fields(s ...googleapi.Field) *InstancesCloneCall { 4794 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 4795 return c 4796} 4797 4798// Context sets the context to be used in this call's Do method. Any 4799// pending HTTP request will be aborted if the provided context is 4800// canceled. 4801func (c *InstancesCloneCall) Context(ctx context.Context) *InstancesCloneCall { 4802 c.ctx_ = ctx 4803 return c 4804} 4805 4806// Header returns an http.Header that can be modified by the caller to 4807// add HTTP headers to the request. 4808func (c *InstancesCloneCall) Header() http.Header { 4809 if c.header_ == nil { 4810 c.header_ = make(http.Header) 4811 } 4812 return c.header_ 4813} 4814 4815func (c *InstancesCloneCall) doRequest(alt string) (*http.Response, error) { 4816 reqHeaders := make(http.Header) 4817 for k, v := range c.header_ { 4818 reqHeaders[k] = v 4819 } 4820 reqHeaders.Set("User-Agent", c.s.userAgent()) 4821 var body io.Reader = nil 4822 body, err := googleapi.WithoutDataWrapper.JSONReader(c.instancesclonerequest) 4823 if err != nil { 4824 return nil, err 4825 } 4826 reqHeaders.Set("Content-Type", "application/json") 4827 c.urlParams_.Set("alt", alt) 4828 c.urlParams_.Set("prettyPrint", "false") 4829 urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{project}/instances/{instance}/clone") 4830 urls += "?" + c.urlParams_.Encode() 4831 req, err := http.NewRequest("POST", urls, body) 4832 if err != nil { 4833 return nil, err 4834 } 4835 req.Header = reqHeaders 4836 googleapi.Expand(req.URL, map[string]string{ 4837 "project": c.project, 4838 "instance": c.instance, 4839 }) 4840 return gensupport.SendRequest(c.ctx_, c.s.client, req) 4841} 4842 4843// Do executes the "sql.instances.clone" call. 4844// Exactly one of *Operation or error will be non-nil. Any non-2xx 4845// status code is an error. Response headers are in either 4846// *Operation.ServerResponse.Header or (if a response was returned at 4847// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 4848// to check whether the returned error was because 4849// http.StatusNotModified was returned. 4850func (c *InstancesCloneCall) Do(opts ...googleapi.CallOption) (*Operation, error) { 4851 gensupport.SetOptions(c.urlParams_, opts...) 4852 res, err := c.doRequest("json") 4853 if res != nil && res.StatusCode == http.StatusNotModified { 4854 if res.Body != nil { 4855 res.Body.Close() 4856 } 4857 return nil, &googleapi.Error{ 4858 Code: res.StatusCode, 4859 Header: res.Header, 4860 } 4861 } 4862 if err != nil { 4863 return nil, err 4864 } 4865 defer googleapi.CloseBody(res) 4866 if err := googleapi.CheckResponse(res); err != nil { 4867 return nil, err 4868 } 4869 ret := &Operation{ 4870 ServerResponse: googleapi.ServerResponse{ 4871 Header: res.Header, 4872 HTTPStatusCode: res.StatusCode, 4873 }, 4874 } 4875 target := &ret 4876 if err := gensupport.DecodeResponse(target, res); err != nil { 4877 return nil, err 4878 } 4879 return ret, nil 4880 // { 4881 // "description": "Creates a Cloud SQL instance as a clone of the source instance.", 4882 // "httpMethod": "POST", 4883 // "id": "sql.instances.clone", 4884 // "parameterOrder": [ 4885 // "project", 4886 // "instance" 4887 // ], 4888 // "parameters": { 4889 // "instance": { 4890 // "description": "The ID of the Cloud SQL instance to be cloned (source). This does not include the project ID.", 4891 // "location": "path", 4892 // "required": true, 4893 // "type": "string" 4894 // }, 4895 // "project": { 4896 // "description": "Project ID of the source as well as the clone Cloud SQL instance.", 4897 // "location": "path", 4898 // "required": true, 4899 // "type": "string" 4900 // } 4901 // }, 4902 // "path": "projects/{project}/instances/{instance}/clone", 4903 // "request": { 4904 // "$ref": "InstancesCloneRequest" 4905 // }, 4906 // "response": { 4907 // "$ref": "Operation" 4908 // }, 4909 // "scopes": [ 4910 // "https://www.googleapis.com/auth/cloud-platform", 4911 // "https://www.googleapis.com/auth/sqlservice.admin" 4912 // ] 4913 // } 4914 4915} 4916 4917// method id "sql.instances.delete": 4918 4919type InstancesDeleteCall struct { 4920 s *Service 4921 project string 4922 instance string 4923 urlParams_ gensupport.URLParams 4924 ctx_ context.Context 4925 header_ http.Header 4926} 4927 4928// Delete: Deletes a Cloud SQL instance. 4929func (r *InstancesService) Delete(project string, instance string) *InstancesDeleteCall { 4930 c := &InstancesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 4931 c.project = project 4932 c.instance = instance 4933 return c 4934} 4935 4936// Fields allows partial responses to be retrieved. See 4937// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 4938// for more information. 4939func (c *InstancesDeleteCall) Fields(s ...googleapi.Field) *InstancesDeleteCall { 4940 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 4941 return c 4942} 4943 4944// Context sets the context to be used in this call's Do method. Any 4945// pending HTTP request will be aborted if the provided context is 4946// canceled. 4947func (c *InstancesDeleteCall) Context(ctx context.Context) *InstancesDeleteCall { 4948 c.ctx_ = ctx 4949 return c 4950} 4951 4952// Header returns an http.Header that can be modified by the caller to 4953// add HTTP headers to the request. 4954func (c *InstancesDeleteCall) Header() http.Header { 4955 if c.header_ == nil { 4956 c.header_ = make(http.Header) 4957 } 4958 return c.header_ 4959} 4960 4961func (c *InstancesDeleteCall) doRequest(alt string) (*http.Response, error) { 4962 reqHeaders := make(http.Header) 4963 for k, v := range c.header_ { 4964 reqHeaders[k] = v 4965 } 4966 reqHeaders.Set("User-Agent", c.s.userAgent()) 4967 var body io.Reader = nil 4968 c.urlParams_.Set("alt", alt) 4969 c.urlParams_.Set("prettyPrint", "false") 4970 urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{project}/instances/{instance}") 4971 urls += "?" + c.urlParams_.Encode() 4972 req, err := http.NewRequest("DELETE", urls, body) 4973 if err != nil { 4974 return nil, err 4975 } 4976 req.Header = reqHeaders 4977 googleapi.Expand(req.URL, map[string]string{ 4978 "project": c.project, 4979 "instance": c.instance, 4980 }) 4981 return gensupport.SendRequest(c.ctx_, c.s.client, req) 4982} 4983 4984// Do executes the "sql.instances.delete" call. 4985// Exactly one of *Operation or error will be non-nil. Any non-2xx 4986// status code is an error. Response headers are in either 4987// *Operation.ServerResponse.Header or (if a response was returned at 4988// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 4989// to check whether the returned error was because 4990// http.StatusNotModified was returned. 4991func (c *InstancesDeleteCall) Do(opts ...googleapi.CallOption) (*Operation, error) { 4992 gensupport.SetOptions(c.urlParams_, opts...) 4993 res, err := c.doRequest("json") 4994 if res != nil && res.StatusCode == http.StatusNotModified { 4995 if res.Body != nil { 4996 res.Body.Close() 4997 } 4998 return nil, &googleapi.Error{ 4999 Code: res.StatusCode, 5000 Header: res.Header, 5001 } 5002 } 5003 if err != nil { 5004 return nil, err 5005 } 5006 defer googleapi.CloseBody(res) 5007 if err := googleapi.CheckResponse(res); err != nil { 5008 return nil, err 5009 } 5010 ret := &Operation{ 5011 ServerResponse: googleapi.ServerResponse{ 5012 Header: res.Header, 5013 HTTPStatusCode: res.StatusCode, 5014 }, 5015 } 5016 target := &ret 5017 if err := gensupport.DecodeResponse(target, res); err != nil { 5018 return nil, err 5019 } 5020 return ret, nil 5021 // { 5022 // "description": "Deletes a Cloud SQL instance.", 5023 // "httpMethod": "DELETE", 5024 // "id": "sql.instances.delete", 5025 // "parameterOrder": [ 5026 // "project", 5027 // "instance" 5028 // ], 5029 // "parameters": { 5030 // "instance": { 5031 // "description": "Cloud SQL instance ID. This does not include the project ID.", 5032 // "location": "path", 5033 // "required": true, 5034 // "type": "string" 5035 // }, 5036 // "project": { 5037 // "description": "Project ID of the project that contains the instance to be deleted.", 5038 // "location": "path", 5039 // "required": true, 5040 // "type": "string" 5041 // } 5042 // }, 5043 // "path": "projects/{project}/instances/{instance}", 5044 // "response": { 5045 // "$ref": "Operation" 5046 // }, 5047 // "scopes": [ 5048 // "https://www.googleapis.com/auth/cloud-platform", 5049 // "https://www.googleapis.com/auth/sqlservice.admin" 5050 // ] 5051 // } 5052 5053} 5054 5055// method id "sql.instances.demoteMaster": 5056 5057type InstancesDemoteMasterCall struct { 5058 s *Service 5059 project string 5060 instance string 5061 instancesdemotemasterrequest *InstancesDemoteMasterRequest 5062 urlParams_ gensupport.URLParams 5063 ctx_ context.Context 5064 header_ http.Header 5065} 5066 5067// DemoteMaster: Demotes the stand-alone instance to be a Cloud SQL read 5068// replica for an external database server. 5069func (r *InstancesService) DemoteMaster(project string, instance string, instancesdemotemasterrequest *InstancesDemoteMasterRequest) *InstancesDemoteMasterCall { 5070 c := &InstancesDemoteMasterCall{s: r.s, urlParams_: make(gensupport.URLParams)} 5071 c.project = project 5072 c.instance = instance 5073 c.instancesdemotemasterrequest = instancesdemotemasterrequest 5074 return c 5075} 5076 5077// Fields allows partial responses to be retrieved. See 5078// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 5079// for more information. 5080func (c *InstancesDemoteMasterCall) Fields(s ...googleapi.Field) *InstancesDemoteMasterCall { 5081 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 5082 return c 5083} 5084 5085// Context sets the context to be used in this call's Do method. Any 5086// pending HTTP request will be aborted if the provided context is 5087// canceled. 5088func (c *InstancesDemoteMasterCall) Context(ctx context.Context) *InstancesDemoteMasterCall { 5089 c.ctx_ = ctx 5090 return c 5091} 5092 5093// Header returns an http.Header that can be modified by the caller to 5094// add HTTP headers to the request. 5095func (c *InstancesDemoteMasterCall) Header() http.Header { 5096 if c.header_ == nil { 5097 c.header_ = make(http.Header) 5098 } 5099 return c.header_ 5100} 5101 5102func (c *InstancesDemoteMasterCall) doRequest(alt string) (*http.Response, error) { 5103 reqHeaders := make(http.Header) 5104 for k, v := range c.header_ { 5105 reqHeaders[k] = v 5106 } 5107 reqHeaders.Set("User-Agent", c.s.userAgent()) 5108 var body io.Reader = nil 5109 body, err := googleapi.WithoutDataWrapper.JSONReader(c.instancesdemotemasterrequest) 5110 if err != nil { 5111 return nil, err 5112 } 5113 reqHeaders.Set("Content-Type", "application/json") 5114 c.urlParams_.Set("alt", alt) 5115 c.urlParams_.Set("prettyPrint", "false") 5116 urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{project}/instances/{instance}/demoteMaster") 5117 urls += "?" + c.urlParams_.Encode() 5118 req, err := http.NewRequest("POST", urls, body) 5119 if err != nil { 5120 return nil, err 5121 } 5122 req.Header = reqHeaders 5123 googleapi.Expand(req.URL, map[string]string{ 5124 "project": c.project, 5125 "instance": c.instance, 5126 }) 5127 return gensupport.SendRequest(c.ctx_, c.s.client, req) 5128} 5129 5130// Do executes the "sql.instances.demoteMaster" call. 5131// Exactly one of *Operation or error will be non-nil. Any non-2xx 5132// status code is an error. Response headers are in either 5133// *Operation.ServerResponse.Header or (if a response was returned at 5134// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 5135// to check whether the returned error was because 5136// http.StatusNotModified was returned. 5137func (c *InstancesDemoteMasterCall) Do(opts ...googleapi.CallOption) (*Operation, error) { 5138 gensupport.SetOptions(c.urlParams_, opts...) 5139 res, err := c.doRequest("json") 5140 if res != nil && res.StatusCode == http.StatusNotModified { 5141 if res.Body != nil { 5142 res.Body.Close() 5143 } 5144 return nil, &googleapi.Error{ 5145 Code: res.StatusCode, 5146 Header: res.Header, 5147 } 5148 } 5149 if err != nil { 5150 return nil, err 5151 } 5152 defer googleapi.CloseBody(res) 5153 if err := googleapi.CheckResponse(res); err != nil { 5154 return nil, err 5155 } 5156 ret := &Operation{ 5157 ServerResponse: googleapi.ServerResponse{ 5158 Header: res.Header, 5159 HTTPStatusCode: res.StatusCode, 5160 }, 5161 } 5162 target := &ret 5163 if err := gensupport.DecodeResponse(target, res); err != nil { 5164 return nil, err 5165 } 5166 return ret, nil 5167 // { 5168 // "description": "Demotes the stand-alone instance to be a Cloud SQL read replica for an external database server.", 5169 // "httpMethod": "POST", 5170 // "id": "sql.instances.demoteMaster", 5171 // "parameterOrder": [ 5172 // "project", 5173 // "instance" 5174 // ], 5175 // "parameters": { 5176 // "instance": { 5177 // "description": "Cloud SQL instance name.", 5178 // "location": "path", 5179 // "required": true, 5180 // "type": "string" 5181 // }, 5182 // "project": { 5183 // "description": "ID of the project that contains the instance.", 5184 // "location": "path", 5185 // "required": true, 5186 // "type": "string" 5187 // } 5188 // }, 5189 // "path": "projects/{project}/instances/{instance}/demoteMaster", 5190 // "request": { 5191 // "$ref": "InstancesDemoteMasterRequest" 5192 // }, 5193 // "response": { 5194 // "$ref": "Operation" 5195 // }, 5196 // "scopes": [ 5197 // "https://www.googleapis.com/auth/cloud-platform", 5198 // "https://www.googleapis.com/auth/sqlservice.admin" 5199 // ] 5200 // } 5201 5202} 5203 5204// method id "sql.instances.export": 5205 5206type InstancesExportCall struct { 5207 s *Service 5208 project string 5209 instance string 5210 instancesexportrequest *InstancesExportRequest 5211 urlParams_ gensupport.URLParams 5212 ctx_ context.Context 5213 header_ http.Header 5214} 5215 5216// Export: Exports data from a Cloud SQL instance to a Cloud Storage 5217// bucket as a SQL dump or CSV file. 5218func (r *InstancesService) Export(project string, instance string, instancesexportrequest *InstancesExportRequest) *InstancesExportCall { 5219 c := &InstancesExportCall{s: r.s, urlParams_: make(gensupport.URLParams)} 5220 c.project = project 5221 c.instance = instance 5222 c.instancesexportrequest = instancesexportrequest 5223 return c 5224} 5225 5226// Fields allows partial responses to be retrieved. See 5227// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 5228// for more information. 5229func (c *InstancesExportCall) Fields(s ...googleapi.Field) *InstancesExportCall { 5230 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 5231 return c 5232} 5233 5234// Context sets the context to be used in this call's Do method. Any 5235// pending HTTP request will be aborted if the provided context is 5236// canceled. 5237func (c *InstancesExportCall) Context(ctx context.Context) *InstancesExportCall { 5238 c.ctx_ = ctx 5239 return c 5240} 5241 5242// Header returns an http.Header that can be modified by the caller to 5243// add HTTP headers to the request. 5244func (c *InstancesExportCall) Header() http.Header { 5245 if c.header_ == nil { 5246 c.header_ = make(http.Header) 5247 } 5248 return c.header_ 5249} 5250 5251func (c *InstancesExportCall) doRequest(alt string) (*http.Response, error) { 5252 reqHeaders := make(http.Header) 5253 for k, v := range c.header_ { 5254 reqHeaders[k] = v 5255 } 5256 reqHeaders.Set("User-Agent", c.s.userAgent()) 5257 var body io.Reader = nil 5258 body, err := googleapi.WithoutDataWrapper.JSONReader(c.instancesexportrequest) 5259 if err != nil { 5260 return nil, err 5261 } 5262 reqHeaders.Set("Content-Type", "application/json") 5263 c.urlParams_.Set("alt", alt) 5264 c.urlParams_.Set("prettyPrint", "false") 5265 urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{project}/instances/{instance}/export") 5266 urls += "?" + c.urlParams_.Encode() 5267 req, err := http.NewRequest("POST", urls, body) 5268 if err != nil { 5269 return nil, err 5270 } 5271 req.Header = reqHeaders 5272 googleapi.Expand(req.URL, map[string]string{ 5273 "project": c.project, 5274 "instance": c.instance, 5275 }) 5276 return gensupport.SendRequest(c.ctx_, c.s.client, req) 5277} 5278 5279// Do executes the "sql.instances.export" call. 5280// Exactly one of *Operation or error will be non-nil. Any non-2xx 5281// status code is an error. Response headers are in either 5282// *Operation.ServerResponse.Header or (if a response was returned at 5283// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 5284// to check whether the returned error was because 5285// http.StatusNotModified was returned. 5286func (c *InstancesExportCall) Do(opts ...googleapi.CallOption) (*Operation, error) { 5287 gensupport.SetOptions(c.urlParams_, opts...) 5288 res, err := c.doRequest("json") 5289 if res != nil && res.StatusCode == http.StatusNotModified { 5290 if res.Body != nil { 5291 res.Body.Close() 5292 } 5293 return nil, &googleapi.Error{ 5294 Code: res.StatusCode, 5295 Header: res.Header, 5296 } 5297 } 5298 if err != nil { 5299 return nil, err 5300 } 5301 defer googleapi.CloseBody(res) 5302 if err := googleapi.CheckResponse(res); err != nil { 5303 return nil, err 5304 } 5305 ret := &Operation{ 5306 ServerResponse: googleapi.ServerResponse{ 5307 Header: res.Header, 5308 HTTPStatusCode: res.StatusCode, 5309 }, 5310 } 5311 target := &ret 5312 if err := gensupport.DecodeResponse(target, res); err != nil { 5313 return nil, err 5314 } 5315 return ret, nil 5316 // { 5317 // "description": "Exports data from a Cloud SQL instance to a Cloud Storage bucket as a SQL dump or CSV file.", 5318 // "httpMethod": "POST", 5319 // "id": "sql.instances.export", 5320 // "parameterOrder": [ 5321 // "project", 5322 // "instance" 5323 // ], 5324 // "parameters": { 5325 // "instance": { 5326 // "description": "Cloud SQL instance ID. This does not include the project ID.", 5327 // "location": "path", 5328 // "required": true, 5329 // "type": "string" 5330 // }, 5331 // "project": { 5332 // "description": "Project ID of the project that contains the instance to be exported.", 5333 // "location": "path", 5334 // "required": true, 5335 // "type": "string" 5336 // } 5337 // }, 5338 // "path": "projects/{project}/instances/{instance}/export", 5339 // "request": { 5340 // "$ref": "InstancesExportRequest" 5341 // }, 5342 // "response": { 5343 // "$ref": "Operation" 5344 // }, 5345 // "scopes": [ 5346 // "https://www.googleapis.com/auth/cloud-platform" 5347 // ] 5348 // } 5349 5350} 5351 5352// method id "sql.instances.failover": 5353 5354type InstancesFailoverCall struct { 5355 s *Service 5356 project string 5357 instance string 5358 instancesfailoverrequest *InstancesFailoverRequest 5359 urlParams_ gensupport.URLParams 5360 ctx_ context.Context 5361 header_ http.Header 5362} 5363 5364// Failover: Failover the instance to its failover replica instance. 5365func (r *InstancesService) Failover(project string, instance string, instancesfailoverrequest *InstancesFailoverRequest) *InstancesFailoverCall { 5366 c := &InstancesFailoverCall{s: r.s, urlParams_: make(gensupport.URLParams)} 5367 c.project = project 5368 c.instance = instance 5369 c.instancesfailoverrequest = instancesfailoverrequest 5370 return c 5371} 5372 5373// Fields allows partial responses to be retrieved. See 5374// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 5375// for more information. 5376func (c *InstancesFailoverCall) Fields(s ...googleapi.Field) *InstancesFailoverCall { 5377 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 5378 return c 5379} 5380 5381// Context sets the context to be used in this call's Do method. Any 5382// pending HTTP request will be aborted if the provided context is 5383// canceled. 5384func (c *InstancesFailoverCall) Context(ctx context.Context) *InstancesFailoverCall { 5385 c.ctx_ = ctx 5386 return c 5387} 5388 5389// Header returns an http.Header that can be modified by the caller to 5390// add HTTP headers to the request. 5391func (c *InstancesFailoverCall) Header() http.Header { 5392 if c.header_ == nil { 5393 c.header_ = make(http.Header) 5394 } 5395 return c.header_ 5396} 5397 5398func (c *InstancesFailoverCall) doRequest(alt string) (*http.Response, error) { 5399 reqHeaders := make(http.Header) 5400 for k, v := range c.header_ { 5401 reqHeaders[k] = v 5402 } 5403 reqHeaders.Set("User-Agent", c.s.userAgent()) 5404 var body io.Reader = nil 5405 body, err := googleapi.WithoutDataWrapper.JSONReader(c.instancesfailoverrequest) 5406 if err != nil { 5407 return nil, err 5408 } 5409 reqHeaders.Set("Content-Type", "application/json") 5410 c.urlParams_.Set("alt", alt) 5411 c.urlParams_.Set("prettyPrint", "false") 5412 urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{project}/instances/{instance}/failover") 5413 urls += "?" + c.urlParams_.Encode() 5414 req, err := http.NewRequest("POST", urls, body) 5415 if err != nil { 5416 return nil, err 5417 } 5418 req.Header = reqHeaders 5419 googleapi.Expand(req.URL, map[string]string{ 5420 "project": c.project, 5421 "instance": c.instance, 5422 }) 5423 return gensupport.SendRequest(c.ctx_, c.s.client, req) 5424} 5425 5426// Do executes the "sql.instances.failover" call. 5427// Exactly one of *Operation or error will be non-nil. Any non-2xx 5428// status code is an error. Response headers are in either 5429// *Operation.ServerResponse.Header or (if a response was returned at 5430// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 5431// to check whether the returned error was because 5432// http.StatusNotModified was returned. 5433func (c *InstancesFailoverCall) Do(opts ...googleapi.CallOption) (*Operation, error) { 5434 gensupport.SetOptions(c.urlParams_, opts...) 5435 res, err := c.doRequest("json") 5436 if res != nil && res.StatusCode == http.StatusNotModified { 5437 if res.Body != nil { 5438 res.Body.Close() 5439 } 5440 return nil, &googleapi.Error{ 5441 Code: res.StatusCode, 5442 Header: res.Header, 5443 } 5444 } 5445 if err != nil { 5446 return nil, err 5447 } 5448 defer googleapi.CloseBody(res) 5449 if err := googleapi.CheckResponse(res); err != nil { 5450 return nil, err 5451 } 5452 ret := &Operation{ 5453 ServerResponse: googleapi.ServerResponse{ 5454 Header: res.Header, 5455 HTTPStatusCode: res.StatusCode, 5456 }, 5457 } 5458 target := &ret 5459 if err := gensupport.DecodeResponse(target, res); err != nil { 5460 return nil, err 5461 } 5462 return ret, nil 5463 // { 5464 // "description": "Failover the instance to its failover replica instance.", 5465 // "httpMethod": "POST", 5466 // "id": "sql.instances.failover", 5467 // "parameterOrder": [ 5468 // "project", 5469 // "instance" 5470 // ], 5471 // "parameters": { 5472 // "instance": { 5473 // "description": "Cloud SQL instance ID. This does not include the project ID.", 5474 // "location": "path", 5475 // "required": true, 5476 // "type": "string" 5477 // }, 5478 // "project": { 5479 // "description": "ID of the project that contains the read replica.", 5480 // "location": "path", 5481 // "required": true, 5482 // "type": "string" 5483 // } 5484 // }, 5485 // "path": "projects/{project}/instances/{instance}/failover", 5486 // "request": { 5487 // "$ref": "InstancesFailoverRequest" 5488 // }, 5489 // "response": { 5490 // "$ref": "Operation" 5491 // }, 5492 // "scopes": [ 5493 // "https://www.googleapis.com/auth/cloud-platform", 5494 // "https://www.googleapis.com/auth/sqlservice.admin" 5495 // ] 5496 // } 5497 5498} 5499 5500// method id "sql.instances.get": 5501 5502type InstancesGetCall struct { 5503 s *Service 5504 project string 5505 instance string 5506 urlParams_ gensupport.URLParams 5507 ifNoneMatch_ string 5508 ctx_ context.Context 5509 header_ http.Header 5510} 5511 5512// Get: Retrieves a resource containing information about a Cloud SQL 5513// instance. 5514func (r *InstancesService) Get(project string, instance string) *InstancesGetCall { 5515 c := &InstancesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 5516 c.project = project 5517 c.instance = instance 5518 return c 5519} 5520 5521// Fields allows partial responses to be retrieved. See 5522// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 5523// for more information. 5524func (c *InstancesGetCall) Fields(s ...googleapi.Field) *InstancesGetCall { 5525 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 5526 return c 5527} 5528 5529// IfNoneMatch sets the optional parameter which makes the operation 5530// fail if the object's ETag matches the given value. This is useful for 5531// getting updates only after the object has changed since the last 5532// request. Use googleapi.IsNotModified to check whether the response 5533// error from Do is the result of In-None-Match. 5534func (c *InstancesGetCall) IfNoneMatch(entityTag string) *InstancesGetCall { 5535 c.ifNoneMatch_ = entityTag 5536 return c 5537} 5538 5539// Context sets the context to be used in this call's Do method. Any 5540// pending HTTP request will be aborted if the provided context is 5541// canceled. 5542func (c *InstancesGetCall) Context(ctx context.Context) *InstancesGetCall { 5543 c.ctx_ = ctx 5544 return c 5545} 5546 5547// Header returns an http.Header that can be modified by the caller to 5548// add HTTP headers to the request. 5549func (c *InstancesGetCall) Header() http.Header { 5550 if c.header_ == nil { 5551 c.header_ = make(http.Header) 5552 } 5553 return c.header_ 5554} 5555 5556func (c *InstancesGetCall) doRequest(alt string) (*http.Response, error) { 5557 reqHeaders := make(http.Header) 5558 for k, v := range c.header_ { 5559 reqHeaders[k] = v 5560 } 5561 reqHeaders.Set("User-Agent", c.s.userAgent()) 5562 if c.ifNoneMatch_ != "" { 5563 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 5564 } 5565 var body io.Reader = nil 5566 c.urlParams_.Set("alt", alt) 5567 c.urlParams_.Set("prettyPrint", "false") 5568 urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{project}/instances/{instance}") 5569 urls += "?" + c.urlParams_.Encode() 5570 req, err := http.NewRequest("GET", urls, body) 5571 if err != nil { 5572 return nil, err 5573 } 5574 req.Header = reqHeaders 5575 googleapi.Expand(req.URL, map[string]string{ 5576 "project": c.project, 5577 "instance": c.instance, 5578 }) 5579 return gensupport.SendRequest(c.ctx_, c.s.client, req) 5580} 5581 5582// Do executes the "sql.instances.get" call. 5583// Exactly one of *DatabaseInstance or error will be non-nil. Any 5584// non-2xx status code is an error. Response headers are in either 5585// *DatabaseInstance.ServerResponse.Header or (if a response was 5586// returned at all) in error.(*googleapi.Error).Header. Use 5587// googleapi.IsNotModified to check whether the returned error was 5588// because http.StatusNotModified was returned. 5589func (c *InstancesGetCall) Do(opts ...googleapi.CallOption) (*DatabaseInstance, error) { 5590 gensupport.SetOptions(c.urlParams_, opts...) 5591 res, err := c.doRequest("json") 5592 if res != nil && res.StatusCode == http.StatusNotModified { 5593 if res.Body != nil { 5594 res.Body.Close() 5595 } 5596 return nil, &googleapi.Error{ 5597 Code: res.StatusCode, 5598 Header: res.Header, 5599 } 5600 } 5601 if err != nil { 5602 return nil, err 5603 } 5604 defer googleapi.CloseBody(res) 5605 if err := googleapi.CheckResponse(res); err != nil { 5606 return nil, err 5607 } 5608 ret := &DatabaseInstance{ 5609 ServerResponse: googleapi.ServerResponse{ 5610 Header: res.Header, 5611 HTTPStatusCode: res.StatusCode, 5612 }, 5613 } 5614 target := &ret 5615 if err := gensupport.DecodeResponse(target, res); err != nil { 5616 return nil, err 5617 } 5618 return ret, nil 5619 // { 5620 // "description": "Retrieves a resource containing information about a Cloud SQL instance.", 5621 // "httpMethod": "GET", 5622 // "id": "sql.instances.get", 5623 // "parameterOrder": [ 5624 // "project", 5625 // "instance" 5626 // ], 5627 // "parameters": { 5628 // "instance": { 5629 // "description": "Database instance ID. This does not include the project ID.", 5630 // "location": "path", 5631 // "required": true, 5632 // "type": "string" 5633 // }, 5634 // "project": { 5635 // "description": "Project ID of the project that contains the instance.", 5636 // "location": "path", 5637 // "required": true, 5638 // "type": "string" 5639 // } 5640 // }, 5641 // "path": "projects/{project}/instances/{instance}", 5642 // "response": { 5643 // "$ref": "DatabaseInstance" 5644 // }, 5645 // "scopes": [ 5646 // "https://www.googleapis.com/auth/cloud-platform", 5647 // "https://www.googleapis.com/auth/sqlservice.admin" 5648 // ] 5649 // } 5650 5651} 5652 5653// method id "sql.instances.import": 5654 5655type InstancesImportCall struct { 5656 s *Service 5657 project string 5658 instance string 5659 instancesimportrequest *InstancesImportRequest 5660 urlParams_ gensupport.URLParams 5661 ctx_ context.Context 5662 header_ http.Header 5663} 5664 5665// Import: Imports data into a Cloud SQL instance from a SQL dump or CSV 5666// file in Cloud Storage. 5667func (r *InstancesService) Import(project string, instance string, instancesimportrequest *InstancesImportRequest) *InstancesImportCall { 5668 c := &InstancesImportCall{s: r.s, urlParams_: make(gensupport.URLParams)} 5669 c.project = project 5670 c.instance = instance 5671 c.instancesimportrequest = instancesimportrequest 5672 return c 5673} 5674 5675// Fields allows partial responses to be retrieved. See 5676// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 5677// for more information. 5678func (c *InstancesImportCall) Fields(s ...googleapi.Field) *InstancesImportCall { 5679 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 5680 return c 5681} 5682 5683// Context sets the context to be used in this call's Do method. Any 5684// pending HTTP request will be aborted if the provided context is 5685// canceled. 5686func (c *InstancesImportCall) Context(ctx context.Context) *InstancesImportCall { 5687 c.ctx_ = ctx 5688 return c 5689} 5690 5691// Header returns an http.Header that can be modified by the caller to 5692// add HTTP headers to the request. 5693func (c *InstancesImportCall) Header() http.Header { 5694 if c.header_ == nil { 5695 c.header_ = make(http.Header) 5696 } 5697 return c.header_ 5698} 5699 5700func (c *InstancesImportCall) doRequest(alt string) (*http.Response, error) { 5701 reqHeaders := make(http.Header) 5702 for k, v := range c.header_ { 5703 reqHeaders[k] = v 5704 } 5705 reqHeaders.Set("User-Agent", c.s.userAgent()) 5706 var body io.Reader = nil 5707 body, err := googleapi.WithoutDataWrapper.JSONReader(c.instancesimportrequest) 5708 if err != nil { 5709 return nil, err 5710 } 5711 reqHeaders.Set("Content-Type", "application/json") 5712 c.urlParams_.Set("alt", alt) 5713 c.urlParams_.Set("prettyPrint", "false") 5714 urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{project}/instances/{instance}/import") 5715 urls += "?" + c.urlParams_.Encode() 5716 req, err := http.NewRequest("POST", urls, body) 5717 if err != nil { 5718 return nil, err 5719 } 5720 req.Header = reqHeaders 5721 googleapi.Expand(req.URL, map[string]string{ 5722 "project": c.project, 5723 "instance": c.instance, 5724 }) 5725 return gensupport.SendRequest(c.ctx_, c.s.client, req) 5726} 5727 5728// Do executes the "sql.instances.import" call. 5729// Exactly one of *Operation or error will be non-nil. Any non-2xx 5730// status code is an error. Response headers are in either 5731// *Operation.ServerResponse.Header or (if a response was returned at 5732// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 5733// to check whether the returned error was because 5734// http.StatusNotModified was returned. 5735func (c *InstancesImportCall) Do(opts ...googleapi.CallOption) (*Operation, error) { 5736 gensupport.SetOptions(c.urlParams_, opts...) 5737 res, err := c.doRequest("json") 5738 if res != nil && res.StatusCode == http.StatusNotModified { 5739 if res.Body != nil { 5740 res.Body.Close() 5741 } 5742 return nil, &googleapi.Error{ 5743 Code: res.StatusCode, 5744 Header: res.Header, 5745 } 5746 } 5747 if err != nil { 5748 return nil, err 5749 } 5750 defer googleapi.CloseBody(res) 5751 if err := googleapi.CheckResponse(res); err != nil { 5752 return nil, err 5753 } 5754 ret := &Operation{ 5755 ServerResponse: googleapi.ServerResponse{ 5756 Header: res.Header, 5757 HTTPStatusCode: res.StatusCode, 5758 }, 5759 } 5760 target := &ret 5761 if err := gensupport.DecodeResponse(target, res); err != nil { 5762 return nil, err 5763 } 5764 return ret, nil 5765 // { 5766 // "description": "Imports data into a Cloud SQL instance from a SQL dump or CSV file in Cloud Storage.", 5767 // "httpMethod": "POST", 5768 // "id": "sql.instances.import", 5769 // "parameterOrder": [ 5770 // "project", 5771 // "instance" 5772 // ], 5773 // "parameters": { 5774 // "instance": { 5775 // "description": "Cloud SQL instance ID. This does not include the project ID.", 5776 // "location": "path", 5777 // "required": true, 5778 // "type": "string" 5779 // }, 5780 // "project": { 5781 // "description": "Project ID of the project that contains the instance.", 5782 // "location": "path", 5783 // "required": true, 5784 // "type": "string" 5785 // } 5786 // }, 5787 // "path": "projects/{project}/instances/{instance}/import", 5788 // "request": { 5789 // "$ref": "InstancesImportRequest" 5790 // }, 5791 // "response": { 5792 // "$ref": "Operation" 5793 // }, 5794 // "scopes": [ 5795 // "https://www.googleapis.com/auth/cloud-platform" 5796 // ] 5797 // } 5798 5799} 5800 5801// method id "sql.instances.insert": 5802 5803type InstancesInsertCall struct { 5804 s *Service 5805 project string 5806 databaseinstance *DatabaseInstance 5807 urlParams_ gensupport.URLParams 5808 ctx_ context.Context 5809 header_ http.Header 5810} 5811 5812// Insert: Creates a new Cloud SQL instance. 5813func (r *InstancesService) Insert(project string, databaseinstance *DatabaseInstance) *InstancesInsertCall { 5814 c := &InstancesInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)} 5815 c.project = project 5816 c.databaseinstance = databaseinstance 5817 return c 5818} 5819 5820// Fields allows partial responses to be retrieved. See 5821// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 5822// for more information. 5823func (c *InstancesInsertCall) Fields(s ...googleapi.Field) *InstancesInsertCall { 5824 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 5825 return c 5826} 5827 5828// Context sets the context to be used in this call's Do method. Any 5829// pending HTTP request will be aborted if the provided context is 5830// canceled. 5831func (c *InstancesInsertCall) Context(ctx context.Context) *InstancesInsertCall { 5832 c.ctx_ = ctx 5833 return c 5834} 5835 5836// Header returns an http.Header that can be modified by the caller to 5837// add HTTP headers to the request. 5838func (c *InstancesInsertCall) Header() http.Header { 5839 if c.header_ == nil { 5840 c.header_ = make(http.Header) 5841 } 5842 return c.header_ 5843} 5844 5845func (c *InstancesInsertCall) doRequest(alt string) (*http.Response, error) { 5846 reqHeaders := make(http.Header) 5847 for k, v := range c.header_ { 5848 reqHeaders[k] = v 5849 } 5850 reqHeaders.Set("User-Agent", c.s.userAgent()) 5851 var body io.Reader = nil 5852 body, err := googleapi.WithoutDataWrapper.JSONReader(c.databaseinstance) 5853 if err != nil { 5854 return nil, err 5855 } 5856 reqHeaders.Set("Content-Type", "application/json") 5857 c.urlParams_.Set("alt", alt) 5858 c.urlParams_.Set("prettyPrint", "false") 5859 urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{project}/instances") 5860 urls += "?" + c.urlParams_.Encode() 5861 req, err := http.NewRequest("POST", urls, body) 5862 if err != nil { 5863 return nil, err 5864 } 5865 req.Header = reqHeaders 5866 googleapi.Expand(req.URL, map[string]string{ 5867 "project": c.project, 5868 }) 5869 return gensupport.SendRequest(c.ctx_, c.s.client, req) 5870} 5871 5872// Do executes the "sql.instances.insert" call. 5873// Exactly one of *Operation or error will be non-nil. Any non-2xx 5874// status code is an error. Response headers are in either 5875// *Operation.ServerResponse.Header or (if a response was returned at 5876// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 5877// to check whether the returned error was because 5878// http.StatusNotModified was returned. 5879func (c *InstancesInsertCall) Do(opts ...googleapi.CallOption) (*Operation, error) { 5880 gensupport.SetOptions(c.urlParams_, opts...) 5881 res, err := c.doRequest("json") 5882 if res != nil && res.StatusCode == http.StatusNotModified { 5883 if res.Body != nil { 5884 res.Body.Close() 5885 } 5886 return nil, &googleapi.Error{ 5887 Code: res.StatusCode, 5888 Header: res.Header, 5889 } 5890 } 5891 if err != nil { 5892 return nil, err 5893 } 5894 defer googleapi.CloseBody(res) 5895 if err := googleapi.CheckResponse(res); err != nil { 5896 return nil, err 5897 } 5898 ret := &Operation{ 5899 ServerResponse: googleapi.ServerResponse{ 5900 Header: res.Header, 5901 HTTPStatusCode: res.StatusCode, 5902 }, 5903 } 5904 target := &ret 5905 if err := gensupport.DecodeResponse(target, res); err != nil { 5906 return nil, err 5907 } 5908 return ret, nil 5909 // { 5910 // "description": "Creates a new Cloud SQL instance.", 5911 // "httpMethod": "POST", 5912 // "id": "sql.instances.insert", 5913 // "parameterOrder": [ 5914 // "project" 5915 // ], 5916 // "parameters": { 5917 // "project": { 5918 // "description": "Project ID of the project to which the newly created Cloud SQL instances should belong.", 5919 // "location": "path", 5920 // "required": true, 5921 // "type": "string" 5922 // } 5923 // }, 5924 // "path": "projects/{project}/instances", 5925 // "request": { 5926 // "$ref": "DatabaseInstance" 5927 // }, 5928 // "response": { 5929 // "$ref": "Operation" 5930 // }, 5931 // "scopes": [ 5932 // "https://www.googleapis.com/auth/cloud-platform", 5933 // "https://www.googleapis.com/auth/sqlservice.admin" 5934 // ] 5935 // } 5936 5937} 5938 5939// method id "sql.instances.list": 5940 5941type InstancesListCall struct { 5942 s *Service 5943 project string 5944 urlParams_ gensupport.URLParams 5945 ifNoneMatch_ string 5946 ctx_ context.Context 5947 header_ http.Header 5948} 5949 5950// List: Lists instances under a given project in the alphabetical order 5951// of the instance name. 5952func (r *InstancesService) List(project string) *InstancesListCall { 5953 c := &InstancesListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 5954 c.project = project 5955 return c 5956} 5957 5958// Filter sets the optional parameter "filter": An expression for 5959// filtering the results of the request, such as by name or label. 5960func (c *InstancesListCall) Filter(filter string) *InstancesListCall { 5961 c.urlParams_.Set("filter", filter) 5962 return c 5963} 5964 5965// MaxResults sets the optional parameter "maxResults": The maximum 5966// number of results to return per response. 5967func (c *InstancesListCall) MaxResults(maxResults int64) *InstancesListCall { 5968 c.urlParams_.Set("maxResults", fmt.Sprint(maxResults)) 5969 return c 5970} 5971 5972// PageToken sets the optional parameter "pageToken": A 5973// previously-returned page token representing part of the larger set of 5974// results to view. 5975func (c *InstancesListCall) PageToken(pageToken string) *InstancesListCall { 5976 c.urlParams_.Set("pageToken", pageToken) 5977 return c 5978} 5979 5980// Fields allows partial responses to be retrieved. See 5981// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 5982// for more information. 5983func (c *InstancesListCall) Fields(s ...googleapi.Field) *InstancesListCall { 5984 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 5985 return c 5986} 5987 5988// IfNoneMatch sets the optional parameter which makes the operation 5989// fail if the object's ETag matches the given value. This is useful for 5990// getting updates only after the object has changed since the last 5991// request. Use googleapi.IsNotModified to check whether the response 5992// error from Do is the result of In-None-Match. 5993func (c *InstancesListCall) IfNoneMatch(entityTag string) *InstancesListCall { 5994 c.ifNoneMatch_ = entityTag 5995 return c 5996} 5997 5998// Context sets the context to be used in this call's Do method. Any 5999// pending HTTP request will be aborted if the provided context is 6000// canceled. 6001func (c *InstancesListCall) Context(ctx context.Context) *InstancesListCall { 6002 c.ctx_ = ctx 6003 return c 6004} 6005 6006// Header returns an http.Header that can be modified by the caller to 6007// add HTTP headers to the request. 6008func (c *InstancesListCall) Header() http.Header { 6009 if c.header_ == nil { 6010 c.header_ = make(http.Header) 6011 } 6012 return c.header_ 6013} 6014 6015func (c *InstancesListCall) doRequest(alt string) (*http.Response, error) { 6016 reqHeaders := make(http.Header) 6017 for k, v := range c.header_ { 6018 reqHeaders[k] = v 6019 } 6020 reqHeaders.Set("User-Agent", c.s.userAgent()) 6021 if c.ifNoneMatch_ != "" { 6022 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 6023 } 6024 var body io.Reader = nil 6025 c.urlParams_.Set("alt", alt) 6026 c.urlParams_.Set("prettyPrint", "false") 6027 urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{project}/instances") 6028 urls += "?" + c.urlParams_.Encode() 6029 req, err := http.NewRequest("GET", urls, body) 6030 if err != nil { 6031 return nil, err 6032 } 6033 req.Header = reqHeaders 6034 googleapi.Expand(req.URL, map[string]string{ 6035 "project": c.project, 6036 }) 6037 return gensupport.SendRequest(c.ctx_, c.s.client, req) 6038} 6039 6040// Do executes the "sql.instances.list" call. 6041// Exactly one of *InstancesListResponse or error will be non-nil. Any 6042// non-2xx status code is an error. Response headers are in either 6043// *InstancesListResponse.ServerResponse.Header or (if a response was 6044// returned at all) in error.(*googleapi.Error).Header. Use 6045// googleapi.IsNotModified to check whether the returned error was 6046// because http.StatusNotModified was returned. 6047func (c *InstancesListCall) Do(opts ...googleapi.CallOption) (*InstancesListResponse, error) { 6048 gensupport.SetOptions(c.urlParams_, opts...) 6049 res, err := c.doRequest("json") 6050 if res != nil && res.StatusCode == http.StatusNotModified { 6051 if res.Body != nil { 6052 res.Body.Close() 6053 } 6054 return nil, &googleapi.Error{ 6055 Code: res.StatusCode, 6056 Header: res.Header, 6057 } 6058 } 6059 if err != nil { 6060 return nil, err 6061 } 6062 defer googleapi.CloseBody(res) 6063 if err := googleapi.CheckResponse(res); err != nil { 6064 return nil, err 6065 } 6066 ret := &InstancesListResponse{ 6067 ServerResponse: googleapi.ServerResponse{ 6068 Header: res.Header, 6069 HTTPStatusCode: res.StatusCode, 6070 }, 6071 } 6072 target := &ret 6073 if err := gensupport.DecodeResponse(target, res); err != nil { 6074 return nil, err 6075 } 6076 return ret, nil 6077 // { 6078 // "description": "Lists instances under a given project in the alphabetical order of the instance name.", 6079 // "httpMethod": "GET", 6080 // "id": "sql.instances.list", 6081 // "parameterOrder": [ 6082 // "project" 6083 // ], 6084 // "parameters": { 6085 // "filter": { 6086 // "description": "An expression for filtering the results of the request, such as by name or label.", 6087 // "location": "query", 6088 // "type": "string" 6089 // }, 6090 // "maxResults": { 6091 // "description": "The maximum number of results to return per response.", 6092 // "format": "uint32", 6093 // "location": "query", 6094 // "type": "integer" 6095 // }, 6096 // "pageToken": { 6097 // "description": "A previously-returned page token representing part of the larger set of results to view.", 6098 // "location": "query", 6099 // "type": "string" 6100 // }, 6101 // "project": { 6102 // "description": "Project ID of the project for which to list Cloud SQL instances.", 6103 // "location": "path", 6104 // "required": true, 6105 // "type": "string" 6106 // } 6107 // }, 6108 // "path": "projects/{project}/instances", 6109 // "response": { 6110 // "$ref": "InstancesListResponse" 6111 // }, 6112 // "scopes": [ 6113 // "https://www.googleapis.com/auth/cloud-platform", 6114 // "https://www.googleapis.com/auth/sqlservice.admin" 6115 // ] 6116 // } 6117 6118} 6119 6120// Pages invokes f for each page of results. 6121// A non-nil error returned from f will halt the iteration. 6122// The provided context supersedes any context provided to the Context method. 6123func (c *InstancesListCall) Pages(ctx context.Context, f func(*InstancesListResponse) error) error { 6124 c.ctx_ = ctx 6125 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 6126 for { 6127 x, err := c.Do() 6128 if err != nil { 6129 return err 6130 } 6131 if err := f(x); err != nil { 6132 return err 6133 } 6134 if x.NextPageToken == "" { 6135 return nil 6136 } 6137 c.PageToken(x.NextPageToken) 6138 } 6139} 6140 6141// method id "sql.instances.listServerCas": 6142 6143type InstancesListServerCasCall struct { 6144 s *Service 6145 project string 6146 instance string 6147 urlParams_ gensupport.URLParams 6148 ifNoneMatch_ string 6149 ctx_ context.Context 6150 header_ http.Header 6151} 6152 6153// ListServerCas: Lists all of the trusted Certificate Authorities (CAs) 6154// for the specified instance. There can be up to three CAs listed: the 6155// CA that was used to sign the certificate that is currently in use, a 6156// CA that has been added but not yet used to sign a certificate, and a 6157// CA used to sign a certificate that has previously rotated out. 6158func (r *InstancesService) ListServerCas(project string, instance string) *InstancesListServerCasCall { 6159 c := &InstancesListServerCasCall{s: r.s, urlParams_: make(gensupport.URLParams)} 6160 c.project = project 6161 c.instance = instance 6162 return c 6163} 6164 6165// Fields allows partial responses to be retrieved. See 6166// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 6167// for more information. 6168func (c *InstancesListServerCasCall) Fields(s ...googleapi.Field) *InstancesListServerCasCall { 6169 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 6170 return c 6171} 6172 6173// IfNoneMatch sets the optional parameter which makes the operation 6174// fail if the object's ETag matches the given value. This is useful for 6175// getting updates only after the object has changed since the last 6176// request. Use googleapi.IsNotModified to check whether the response 6177// error from Do is the result of In-None-Match. 6178func (c *InstancesListServerCasCall) IfNoneMatch(entityTag string) *InstancesListServerCasCall { 6179 c.ifNoneMatch_ = entityTag 6180 return c 6181} 6182 6183// Context sets the context to be used in this call's Do method. Any 6184// pending HTTP request will be aborted if the provided context is 6185// canceled. 6186func (c *InstancesListServerCasCall) Context(ctx context.Context) *InstancesListServerCasCall { 6187 c.ctx_ = ctx 6188 return c 6189} 6190 6191// Header returns an http.Header that can be modified by the caller to 6192// add HTTP headers to the request. 6193func (c *InstancesListServerCasCall) Header() http.Header { 6194 if c.header_ == nil { 6195 c.header_ = make(http.Header) 6196 } 6197 return c.header_ 6198} 6199 6200func (c *InstancesListServerCasCall) doRequest(alt string) (*http.Response, error) { 6201 reqHeaders := make(http.Header) 6202 for k, v := range c.header_ { 6203 reqHeaders[k] = v 6204 } 6205 reqHeaders.Set("User-Agent", c.s.userAgent()) 6206 if c.ifNoneMatch_ != "" { 6207 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 6208 } 6209 var body io.Reader = nil 6210 c.urlParams_.Set("alt", alt) 6211 c.urlParams_.Set("prettyPrint", "false") 6212 urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{project}/instances/{instance}/listServerCas") 6213 urls += "?" + c.urlParams_.Encode() 6214 req, err := http.NewRequest("GET", urls, body) 6215 if err != nil { 6216 return nil, err 6217 } 6218 req.Header = reqHeaders 6219 googleapi.Expand(req.URL, map[string]string{ 6220 "project": c.project, 6221 "instance": c.instance, 6222 }) 6223 return gensupport.SendRequest(c.ctx_, c.s.client, req) 6224} 6225 6226// Do executes the "sql.instances.listServerCas" call. 6227// Exactly one of *InstancesListServerCasResponse or error will be 6228// non-nil. Any non-2xx status code is an error. Response headers are in 6229// either *InstancesListServerCasResponse.ServerResponse.Header or (if a 6230// response was returned at all) in error.(*googleapi.Error).Header. Use 6231// googleapi.IsNotModified to check whether the returned error was 6232// because http.StatusNotModified was returned. 6233func (c *InstancesListServerCasCall) Do(opts ...googleapi.CallOption) (*InstancesListServerCasResponse, error) { 6234 gensupport.SetOptions(c.urlParams_, opts...) 6235 res, err := c.doRequest("json") 6236 if res != nil && res.StatusCode == http.StatusNotModified { 6237 if res.Body != nil { 6238 res.Body.Close() 6239 } 6240 return nil, &googleapi.Error{ 6241 Code: res.StatusCode, 6242 Header: res.Header, 6243 } 6244 } 6245 if err != nil { 6246 return nil, err 6247 } 6248 defer googleapi.CloseBody(res) 6249 if err := googleapi.CheckResponse(res); err != nil { 6250 return nil, err 6251 } 6252 ret := &InstancesListServerCasResponse{ 6253 ServerResponse: googleapi.ServerResponse{ 6254 Header: res.Header, 6255 HTTPStatusCode: res.StatusCode, 6256 }, 6257 } 6258 target := &ret 6259 if err := gensupport.DecodeResponse(target, res); err != nil { 6260 return nil, err 6261 } 6262 return ret, nil 6263 // { 6264 // "description": "Lists all of the trusted Certificate Authorities (CAs) for the specified instance. There can be up to three CAs listed: the CA that was used to sign the certificate that is currently in use, a CA that has been added but not yet used to sign a certificate, and a CA used to sign a certificate that has previously rotated out.", 6265 // "httpMethod": "GET", 6266 // "id": "sql.instances.listServerCas", 6267 // "parameterOrder": [ 6268 // "project", 6269 // "instance" 6270 // ], 6271 // "parameters": { 6272 // "instance": { 6273 // "description": "Cloud SQL instance ID. This does not include the project ID.", 6274 // "location": "path", 6275 // "required": true, 6276 // "type": "string" 6277 // }, 6278 // "project": { 6279 // "description": "Project ID of the project that contains the instance.", 6280 // "location": "path", 6281 // "required": true, 6282 // "type": "string" 6283 // } 6284 // }, 6285 // "path": "projects/{project}/instances/{instance}/listServerCas", 6286 // "response": { 6287 // "$ref": "InstancesListServerCasResponse" 6288 // }, 6289 // "scopes": [ 6290 // "https://www.googleapis.com/auth/cloud-platform", 6291 // "https://www.googleapis.com/auth/sqlservice.admin" 6292 // ] 6293 // } 6294 6295} 6296 6297// method id "sql.instances.patch": 6298 6299type InstancesPatchCall struct { 6300 s *Service 6301 project string 6302 instance string 6303 databaseinstance *DatabaseInstance 6304 urlParams_ gensupport.URLParams 6305 ctx_ context.Context 6306 header_ http.Header 6307} 6308 6309// Patch: Updates settings of a Cloud SQL instance. Caution: This is not 6310// a partial update, so you must include values for all the settings 6311// that you want to retain. For partial updates, use patch.. This method 6312// supports patch semantics. 6313func (r *InstancesService) Patch(project string, instance string, databaseinstance *DatabaseInstance) *InstancesPatchCall { 6314 c := &InstancesPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)} 6315 c.project = project 6316 c.instance = instance 6317 c.databaseinstance = databaseinstance 6318 return c 6319} 6320 6321// Fields allows partial responses to be retrieved. See 6322// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 6323// for more information. 6324func (c *InstancesPatchCall) Fields(s ...googleapi.Field) *InstancesPatchCall { 6325 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 6326 return c 6327} 6328 6329// Context sets the context to be used in this call's Do method. Any 6330// pending HTTP request will be aborted if the provided context is 6331// canceled. 6332func (c *InstancesPatchCall) Context(ctx context.Context) *InstancesPatchCall { 6333 c.ctx_ = ctx 6334 return c 6335} 6336 6337// Header returns an http.Header that can be modified by the caller to 6338// add HTTP headers to the request. 6339func (c *InstancesPatchCall) Header() http.Header { 6340 if c.header_ == nil { 6341 c.header_ = make(http.Header) 6342 } 6343 return c.header_ 6344} 6345 6346func (c *InstancesPatchCall) doRequest(alt string) (*http.Response, error) { 6347 reqHeaders := make(http.Header) 6348 for k, v := range c.header_ { 6349 reqHeaders[k] = v 6350 } 6351 reqHeaders.Set("User-Agent", c.s.userAgent()) 6352 var body io.Reader = nil 6353 body, err := googleapi.WithoutDataWrapper.JSONReader(c.databaseinstance) 6354 if err != nil { 6355 return nil, err 6356 } 6357 reqHeaders.Set("Content-Type", "application/json") 6358 c.urlParams_.Set("alt", alt) 6359 c.urlParams_.Set("prettyPrint", "false") 6360 urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{project}/instances/{instance}") 6361 urls += "?" + c.urlParams_.Encode() 6362 req, err := http.NewRequest("PATCH", urls, body) 6363 if err != nil { 6364 return nil, err 6365 } 6366 req.Header = reqHeaders 6367 googleapi.Expand(req.URL, map[string]string{ 6368 "project": c.project, 6369 "instance": c.instance, 6370 }) 6371 return gensupport.SendRequest(c.ctx_, c.s.client, req) 6372} 6373 6374// Do executes the "sql.instances.patch" call. 6375// Exactly one of *Operation or error will be non-nil. Any non-2xx 6376// status code is an error. Response headers are in either 6377// *Operation.ServerResponse.Header or (if a response was returned at 6378// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 6379// to check whether the returned error was because 6380// http.StatusNotModified was returned. 6381func (c *InstancesPatchCall) Do(opts ...googleapi.CallOption) (*Operation, error) { 6382 gensupport.SetOptions(c.urlParams_, opts...) 6383 res, err := c.doRequest("json") 6384 if res != nil && res.StatusCode == http.StatusNotModified { 6385 if res.Body != nil { 6386 res.Body.Close() 6387 } 6388 return nil, &googleapi.Error{ 6389 Code: res.StatusCode, 6390 Header: res.Header, 6391 } 6392 } 6393 if err != nil { 6394 return nil, err 6395 } 6396 defer googleapi.CloseBody(res) 6397 if err := googleapi.CheckResponse(res); err != nil { 6398 return nil, err 6399 } 6400 ret := &Operation{ 6401 ServerResponse: googleapi.ServerResponse{ 6402 Header: res.Header, 6403 HTTPStatusCode: res.StatusCode, 6404 }, 6405 } 6406 target := &ret 6407 if err := gensupport.DecodeResponse(target, res); err != nil { 6408 return nil, err 6409 } 6410 return ret, nil 6411 // { 6412 // "description": "Updates settings of a Cloud SQL instance. Caution: This is not a partial update, so you must include values for all the settings that you want to retain. For partial updates, use patch.. This method supports patch semantics.", 6413 // "httpMethod": "PATCH", 6414 // "id": "sql.instances.patch", 6415 // "parameterOrder": [ 6416 // "project", 6417 // "instance" 6418 // ], 6419 // "parameters": { 6420 // "instance": { 6421 // "description": "Cloud SQL instance ID. This does not include the project ID.", 6422 // "location": "path", 6423 // "required": true, 6424 // "type": "string" 6425 // }, 6426 // "project": { 6427 // "description": "Project ID of the project that contains the instance.", 6428 // "location": "path", 6429 // "required": true, 6430 // "type": "string" 6431 // } 6432 // }, 6433 // "path": "projects/{project}/instances/{instance}", 6434 // "request": { 6435 // "$ref": "DatabaseInstance" 6436 // }, 6437 // "response": { 6438 // "$ref": "Operation" 6439 // }, 6440 // "scopes": [ 6441 // "https://www.googleapis.com/auth/cloud-platform", 6442 // "https://www.googleapis.com/auth/sqlservice.admin" 6443 // ] 6444 // } 6445 6446} 6447 6448// method id "sql.instances.promoteReplica": 6449 6450type InstancesPromoteReplicaCall struct { 6451 s *Service 6452 project string 6453 instance string 6454 urlParams_ gensupport.URLParams 6455 ctx_ context.Context 6456 header_ http.Header 6457} 6458 6459// PromoteReplica: Promotes the read replica instance to be a 6460// stand-alone Cloud SQL instance. 6461func (r *InstancesService) PromoteReplica(project string, instance string) *InstancesPromoteReplicaCall { 6462 c := &InstancesPromoteReplicaCall{s: r.s, urlParams_: make(gensupport.URLParams)} 6463 c.project = project 6464 c.instance = instance 6465 return c 6466} 6467 6468// Fields allows partial responses to be retrieved. See 6469// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 6470// for more information. 6471func (c *InstancesPromoteReplicaCall) Fields(s ...googleapi.Field) *InstancesPromoteReplicaCall { 6472 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 6473 return c 6474} 6475 6476// Context sets the context to be used in this call's Do method. Any 6477// pending HTTP request will be aborted if the provided context is 6478// canceled. 6479func (c *InstancesPromoteReplicaCall) Context(ctx context.Context) *InstancesPromoteReplicaCall { 6480 c.ctx_ = ctx 6481 return c 6482} 6483 6484// Header returns an http.Header that can be modified by the caller to 6485// add HTTP headers to the request. 6486func (c *InstancesPromoteReplicaCall) Header() http.Header { 6487 if c.header_ == nil { 6488 c.header_ = make(http.Header) 6489 } 6490 return c.header_ 6491} 6492 6493func (c *InstancesPromoteReplicaCall) doRequest(alt string) (*http.Response, error) { 6494 reqHeaders := make(http.Header) 6495 for k, v := range c.header_ { 6496 reqHeaders[k] = v 6497 } 6498 reqHeaders.Set("User-Agent", c.s.userAgent()) 6499 var body io.Reader = nil 6500 c.urlParams_.Set("alt", alt) 6501 c.urlParams_.Set("prettyPrint", "false") 6502 urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{project}/instances/{instance}/promoteReplica") 6503 urls += "?" + c.urlParams_.Encode() 6504 req, err := http.NewRequest("POST", urls, body) 6505 if err != nil { 6506 return nil, err 6507 } 6508 req.Header = reqHeaders 6509 googleapi.Expand(req.URL, map[string]string{ 6510 "project": c.project, 6511 "instance": c.instance, 6512 }) 6513 return gensupport.SendRequest(c.ctx_, c.s.client, req) 6514} 6515 6516// Do executes the "sql.instances.promoteReplica" call. 6517// Exactly one of *Operation or error will be non-nil. Any non-2xx 6518// status code is an error. Response headers are in either 6519// *Operation.ServerResponse.Header or (if a response was returned at 6520// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 6521// to check whether the returned error was because 6522// http.StatusNotModified was returned. 6523func (c *InstancesPromoteReplicaCall) Do(opts ...googleapi.CallOption) (*Operation, error) { 6524 gensupport.SetOptions(c.urlParams_, opts...) 6525 res, err := c.doRequest("json") 6526 if res != nil && res.StatusCode == http.StatusNotModified { 6527 if res.Body != nil { 6528 res.Body.Close() 6529 } 6530 return nil, &googleapi.Error{ 6531 Code: res.StatusCode, 6532 Header: res.Header, 6533 } 6534 } 6535 if err != nil { 6536 return nil, err 6537 } 6538 defer googleapi.CloseBody(res) 6539 if err := googleapi.CheckResponse(res); err != nil { 6540 return nil, err 6541 } 6542 ret := &Operation{ 6543 ServerResponse: googleapi.ServerResponse{ 6544 Header: res.Header, 6545 HTTPStatusCode: res.StatusCode, 6546 }, 6547 } 6548 target := &ret 6549 if err := gensupport.DecodeResponse(target, res); err != nil { 6550 return nil, err 6551 } 6552 return ret, nil 6553 // { 6554 // "description": "Promotes the read replica instance to be a stand-alone Cloud SQL instance.", 6555 // "httpMethod": "POST", 6556 // "id": "sql.instances.promoteReplica", 6557 // "parameterOrder": [ 6558 // "project", 6559 // "instance" 6560 // ], 6561 // "parameters": { 6562 // "instance": { 6563 // "description": "Cloud SQL read replica instance name.", 6564 // "location": "path", 6565 // "required": true, 6566 // "type": "string" 6567 // }, 6568 // "project": { 6569 // "description": "ID of the project that contains the read replica.", 6570 // "location": "path", 6571 // "required": true, 6572 // "type": "string" 6573 // } 6574 // }, 6575 // "path": "projects/{project}/instances/{instance}/promoteReplica", 6576 // "response": { 6577 // "$ref": "Operation" 6578 // }, 6579 // "scopes": [ 6580 // "https://www.googleapis.com/auth/cloud-platform", 6581 // "https://www.googleapis.com/auth/sqlservice.admin" 6582 // ] 6583 // } 6584 6585} 6586 6587// method id "sql.instances.resetSslConfig": 6588 6589type InstancesResetSslConfigCall struct { 6590 s *Service 6591 project string 6592 instance string 6593 urlParams_ gensupport.URLParams 6594 ctx_ context.Context 6595 header_ http.Header 6596} 6597 6598// ResetSslConfig: Deletes all client certificates and generates a new 6599// server SSL certificate for the instance. 6600func (r *InstancesService) ResetSslConfig(project string, instance string) *InstancesResetSslConfigCall { 6601 c := &InstancesResetSslConfigCall{s: r.s, urlParams_: make(gensupport.URLParams)} 6602 c.project = project 6603 c.instance = instance 6604 return c 6605} 6606 6607// Fields allows partial responses to be retrieved. See 6608// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 6609// for more information. 6610func (c *InstancesResetSslConfigCall) Fields(s ...googleapi.Field) *InstancesResetSslConfigCall { 6611 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 6612 return c 6613} 6614 6615// Context sets the context to be used in this call's Do method. Any 6616// pending HTTP request will be aborted if the provided context is 6617// canceled. 6618func (c *InstancesResetSslConfigCall) Context(ctx context.Context) *InstancesResetSslConfigCall { 6619 c.ctx_ = ctx 6620 return c 6621} 6622 6623// Header returns an http.Header that can be modified by the caller to 6624// add HTTP headers to the request. 6625func (c *InstancesResetSslConfigCall) Header() http.Header { 6626 if c.header_ == nil { 6627 c.header_ = make(http.Header) 6628 } 6629 return c.header_ 6630} 6631 6632func (c *InstancesResetSslConfigCall) doRequest(alt string) (*http.Response, error) { 6633 reqHeaders := make(http.Header) 6634 for k, v := range c.header_ { 6635 reqHeaders[k] = v 6636 } 6637 reqHeaders.Set("User-Agent", c.s.userAgent()) 6638 var body io.Reader = nil 6639 c.urlParams_.Set("alt", alt) 6640 c.urlParams_.Set("prettyPrint", "false") 6641 urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{project}/instances/{instance}/resetSslConfig") 6642 urls += "?" + c.urlParams_.Encode() 6643 req, err := http.NewRequest("POST", urls, body) 6644 if err != nil { 6645 return nil, err 6646 } 6647 req.Header = reqHeaders 6648 googleapi.Expand(req.URL, map[string]string{ 6649 "project": c.project, 6650 "instance": c.instance, 6651 }) 6652 return gensupport.SendRequest(c.ctx_, c.s.client, req) 6653} 6654 6655// Do executes the "sql.instances.resetSslConfig" call. 6656// Exactly one of *Operation or error will be non-nil. Any non-2xx 6657// status code is an error. Response headers are in either 6658// *Operation.ServerResponse.Header or (if a response was returned at 6659// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 6660// to check whether the returned error was because 6661// http.StatusNotModified was returned. 6662func (c *InstancesResetSslConfigCall) Do(opts ...googleapi.CallOption) (*Operation, error) { 6663 gensupport.SetOptions(c.urlParams_, opts...) 6664 res, err := c.doRequest("json") 6665 if res != nil && res.StatusCode == http.StatusNotModified { 6666 if res.Body != nil { 6667 res.Body.Close() 6668 } 6669 return nil, &googleapi.Error{ 6670 Code: res.StatusCode, 6671 Header: res.Header, 6672 } 6673 } 6674 if err != nil { 6675 return nil, err 6676 } 6677 defer googleapi.CloseBody(res) 6678 if err := googleapi.CheckResponse(res); err != nil { 6679 return nil, err 6680 } 6681 ret := &Operation{ 6682 ServerResponse: googleapi.ServerResponse{ 6683 Header: res.Header, 6684 HTTPStatusCode: res.StatusCode, 6685 }, 6686 } 6687 target := &ret 6688 if err := gensupport.DecodeResponse(target, res); err != nil { 6689 return nil, err 6690 } 6691 return ret, nil 6692 // { 6693 // "description": "Deletes all client certificates and generates a new server SSL certificate for the instance.", 6694 // "httpMethod": "POST", 6695 // "id": "sql.instances.resetSslConfig", 6696 // "parameterOrder": [ 6697 // "project", 6698 // "instance" 6699 // ], 6700 // "parameters": { 6701 // "instance": { 6702 // "description": "Cloud SQL instance ID. This does not include the project ID.", 6703 // "location": "path", 6704 // "required": true, 6705 // "type": "string" 6706 // }, 6707 // "project": { 6708 // "description": "Project ID of the project that contains the instance.", 6709 // "location": "path", 6710 // "required": true, 6711 // "type": "string" 6712 // } 6713 // }, 6714 // "path": "projects/{project}/instances/{instance}/resetSslConfig", 6715 // "response": { 6716 // "$ref": "Operation" 6717 // }, 6718 // "scopes": [ 6719 // "https://www.googleapis.com/auth/cloud-platform", 6720 // "https://www.googleapis.com/auth/sqlservice.admin" 6721 // ] 6722 // } 6723 6724} 6725 6726// method id "sql.instances.restart": 6727 6728type InstancesRestartCall struct { 6729 s *Service 6730 project string 6731 instance string 6732 urlParams_ gensupport.URLParams 6733 ctx_ context.Context 6734 header_ http.Header 6735} 6736 6737// Restart: Restarts a Cloud SQL instance. 6738func (r *InstancesService) Restart(project string, instance string) *InstancesRestartCall { 6739 c := &InstancesRestartCall{s: r.s, urlParams_: make(gensupport.URLParams)} 6740 c.project = project 6741 c.instance = instance 6742 return c 6743} 6744 6745// Fields allows partial responses to be retrieved. See 6746// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 6747// for more information. 6748func (c *InstancesRestartCall) Fields(s ...googleapi.Field) *InstancesRestartCall { 6749 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 6750 return c 6751} 6752 6753// Context sets the context to be used in this call's Do method. Any 6754// pending HTTP request will be aborted if the provided context is 6755// canceled. 6756func (c *InstancesRestartCall) Context(ctx context.Context) *InstancesRestartCall { 6757 c.ctx_ = ctx 6758 return c 6759} 6760 6761// Header returns an http.Header that can be modified by the caller to 6762// add HTTP headers to the request. 6763func (c *InstancesRestartCall) Header() http.Header { 6764 if c.header_ == nil { 6765 c.header_ = make(http.Header) 6766 } 6767 return c.header_ 6768} 6769 6770func (c *InstancesRestartCall) doRequest(alt string) (*http.Response, error) { 6771 reqHeaders := make(http.Header) 6772 for k, v := range c.header_ { 6773 reqHeaders[k] = v 6774 } 6775 reqHeaders.Set("User-Agent", c.s.userAgent()) 6776 var body io.Reader = nil 6777 c.urlParams_.Set("alt", alt) 6778 c.urlParams_.Set("prettyPrint", "false") 6779 urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{project}/instances/{instance}/restart") 6780 urls += "?" + c.urlParams_.Encode() 6781 req, err := http.NewRequest("POST", urls, body) 6782 if err != nil { 6783 return nil, err 6784 } 6785 req.Header = reqHeaders 6786 googleapi.Expand(req.URL, map[string]string{ 6787 "project": c.project, 6788 "instance": c.instance, 6789 }) 6790 return gensupport.SendRequest(c.ctx_, c.s.client, req) 6791} 6792 6793// Do executes the "sql.instances.restart" call. 6794// Exactly one of *Operation or error will be non-nil. Any non-2xx 6795// status code is an error. Response headers are in either 6796// *Operation.ServerResponse.Header or (if a response was returned at 6797// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 6798// to check whether the returned error was because 6799// http.StatusNotModified was returned. 6800func (c *InstancesRestartCall) Do(opts ...googleapi.CallOption) (*Operation, error) { 6801 gensupport.SetOptions(c.urlParams_, opts...) 6802 res, err := c.doRequest("json") 6803 if res != nil && res.StatusCode == http.StatusNotModified { 6804 if res.Body != nil { 6805 res.Body.Close() 6806 } 6807 return nil, &googleapi.Error{ 6808 Code: res.StatusCode, 6809 Header: res.Header, 6810 } 6811 } 6812 if err != nil { 6813 return nil, err 6814 } 6815 defer googleapi.CloseBody(res) 6816 if err := googleapi.CheckResponse(res); err != nil { 6817 return nil, err 6818 } 6819 ret := &Operation{ 6820 ServerResponse: googleapi.ServerResponse{ 6821 Header: res.Header, 6822 HTTPStatusCode: res.StatusCode, 6823 }, 6824 } 6825 target := &ret 6826 if err := gensupport.DecodeResponse(target, res); err != nil { 6827 return nil, err 6828 } 6829 return ret, nil 6830 // { 6831 // "description": "Restarts a Cloud SQL instance.", 6832 // "httpMethod": "POST", 6833 // "id": "sql.instances.restart", 6834 // "parameterOrder": [ 6835 // "project", 6836 // "instance" 6837 // ], 6838 // "parameters": { 6839 // "instance": { 6840 // "description": "Cloud SQL instance ID. This does not include the project ID.", 6841 // "location": "path", 6842 // "required": true, 6843 // "type": "string" 6844 // }, 6845 // "project": { 6846 // "description": "Project ID of the project that contains the instance to be restarted.", 6847 // "location": "path", 6848 // "required": true, 6849 // "type": "string" 6850 // } 6851 // }, 6852 // "path": "projects/{project}/instances/{instance}/restart", 6853 // "response": { 6854 // "$ref": "Operation" 6855 // }, 6856 // "scopes": [ 6857 // "https://www.googleapis.com/auth/cloud-platform", 6858 // "https://www.googleapis.com/auth/sqlservice.admin" 6859 // ] 6860 // } 6861 6862} 6863 6864// method id "sql.instances.restoreBackup": 6865 6866type InstancesRestoreBackupCall struct { 6867 s *Service 6868 project string 6869 instance string 6870 instancesrestorebackuprequest *InstancesRestoreBackupRequest 6871 urlParams_ gensupport.URLParams 6872 ctx_ context.Context 6873 header_ http.Header 6874} 6875 6876// RestoreBackup: Restores a backup of a Cloud SQL instance. 6877func (r *InstancesService) RestoreBackup(project string, instance string, instancesrestorebackuprequest *InstancesRestoreBackupRequest) *InstancesRestoreBackupCall { 6878 c := &InstancesRestoreBackupCall{s: r.s, urlParams_: make(gensupport.URLParams)} 6879 c.project = project 6880 c.instance = instance 6881 c.instancesrestorebackuprequest = instancesrestorebackuprequest 6882 return c 6883} 6884 6885// Fields allows partial responses to be retrieved. See 6886// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 6887// for more information. 6888func (c *InstancesRestoreBackupCall) Fields(s ...googleapi.Field) *InstancesRestoreBackupCall { 6889 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 6890 return c 6891} 6892 6893// Context sets the context to be used in this call's Do method. Any 6894// pending HTTP request will be aborted if the provided context is 6895// canceled. 6896func (c *InstancesRestoreBackupCall) Context(ctx context.Context) *InstancesRestoreBackupCall { 6897 c.ctx_ = ctx 6898 return c 6899} 6900 6901// Header returns an http.Header that can be modified by the caller to 6902// add HTTP headers to the request. 6903func (c *InstancesRestoreBackupCall) Header() http.Header { 6904 if c.header_ == nil { 6905 c.header_ = make(http.Header) 6906 } 6907 return c.header_ 6908} 6909 6910func (c *InstancesRestoreBackupCall) doRequest(alt string) (*http.Response, error) { 6911 reqHeaders := make(http.Header) 6912 for k, v := range c.header_ { 6913 reqHeaders[k] = v 6914 } 6915 reqHeaders.Set("User-Agent", c.s.userAgent()) 6916 var body io.Reader = nil 6917 body, err := googleapi.WithoutDataWrapper.JSONReader(c.instancesrestorebackuprequest) 6918 if err != nil { 6919 return nil, err 6920 } 6921 reqHeaders.Set("Content-Type", "application/json") 6922 c.urlParams_.Set("alt", alt) 6923 c.urlParams_.Set("prettyPrint", "false") 6924 urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{project}/instances/{instance}/restoreBackup") 6925 urls += "?" + c.urlParams_.Encode() 6926 req, err := http.NewRequest("POST", urls, body) 6927 if err != nil { 6928 return nil, err 6929 } 6930 req.Header = reqHeaders 6931 googleapi.Expand(req.URL, map[string]string{ 6932 "project": c.project, 6933 "instance": c.instance, 6934 }) 6935 return gensupport.SendRequest(c.ctx_, c.s.client, req) 6936} 6937 6938// Do executes the "sql.instances.restoreBackup" call. 6939// Exactly one of *Operation or error will be non-nil. Any non-2xx 6940// status code is an error. Response headers are in either 6941// *Operation.ServerResponse.Header or (if a response was returned at 6942// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 6943// to check whether the returned error was because 6944// http.StatusNotModified was returned. 6945func (c *InstancesRestoreBackupCall) Do(opts ...googleapi.CallOption) (*Operation, error) { 6946 gensupport.SetOptions(c.urlParams_, opts...) 6947 res, err := c.doRequest("json") 6948 if res != nil && res.StatusCode == http.StatusNotModified { 6949 if res.Body != nil { 6950 res.Body.Close() 6951 } 6952 return nil, &googleapi.Error{ 6953 Code: res.StatusCode, 6954 Header: res.Header, 6955 } 6956 } 6957 if err != nil { 6958 return nil, err 6959 } 6960 defer googleapi.CloseBody(res) 6961 if err := googleapi.CheckResponse(res); err != nil { 6962 return nil, err 6963 } 6964 ret := &Operation{ 6965 ServerResponse: googleapi.ServerResponse{ 6966 Header: res.Header, 6967 HTTPStatusCode: res.StatusCode, 6968 }, 6969 } 6970 target := &ret 6971 if err := gensupport.DecodeResponse(target, res); err != nil { 6972 return nil, err 6973 } 6974 return ret, nil 6975 // { 6976 // "description": "Restores a backup of a Cloud SQL instance.", 6977 // "httpMethod": "POST", 6978 // "id": "sql.instances.restoreBackup", 6979 // "parameterOrder": [ 6980 // "project", 6981 // "instance" 6982 // ], 6983 // "parameters": { 6984 // "instance": { 6985 // "description": "Cloud SQL instance ID. This does not include the project ID.", 6986 // "location": "path", 6987 // "required": true, 6988 // "type": "string" 6989 // }, 6990 // "project": { 6991 // "description": "Project ID of the project that contains the instance.", 6992 // "location": "path", 6993 // "required": true, 6994 // "type": "string" 6995 // } 6996 // }, 6997 // "path": "projects/{project}/instances/{instance}/restoreBackup", 6998 // "request": { 6999 // "$ref": "InstancesRestoreBackupRequest" 7000 // }, 7001 // "response": { 7002 // "$ref": "Operation" 7003 // }, 7004 // "scopes": [ 7005 // "https://www.googleapis.com/auth/cloud-platform", 7006 // "https://www.googleapis.com/auth/sqlservice.admin" 7007 // ] 7008 // } 7009 7010} 7011 7012// method id "sql.instances.rotateServerCa": 7013 7014type InstancesRotateServerCaCall struct { 7015 s *Service 7016 project string 7017 instance string 7018 instancesrotateservercarequest *InstancesRotateServerCaRequest 7019 urlParams_ gensupport.URLParams 7020 ctx_ context.Context 7021 header_ http.Header 7022} 7023 7024// RotateServerCa: Rotates the server certificate to one signed by the 7025// Certificate Authority (CA) version previously added with the 7026// addServerCA method. 7027func (r *InstancesService) RotateServerCa(project string, instance string, instancesrotateservercarequest *InstancesRotateServerCaRequest) *InstancesRotateServerCaCall { 7028 c := &InstancesRotateServerCaCall{s: r.s, urlParams_: make(gensupport.URLParams)} 7029 c.project = project 7030 c.instance = instance 7031 c.instancesrotateservercarequest = instancesrotateservercarequest 7032 return c 7033} 7034 7035// Fields allows partial responses to be retrieved. See 7036// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 7037// for more information. 7038func (c *InstancesRotateServerCaCall) Fields(s ...googleapi.Field) *InstancesRotateServerCaCall { 7039 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 7040 return c 7041} 7042 7043// Context sets the context to be used in this call's Do method. Any 7044// pending HTTP request will be aborted if the provided context is 7045// canceled. 7046func (c *InstancesRotateServerCaCall) Context(ctx context.Context) *InstancesRotateServerCaCall { 7047 c.ctx_ = ctx 7048 return c 7049} 7050 7051// Header returns an http.Header that can be modified by the caller to 7052// add HTTP headers to the request. 7053func (c *InstancesRotateServerCaCall) Header() http.Header { 7054 if c.header_ == nil { 7055 c.header_ = make(http.Header) 7056 } 7057 return c.header_ 7058} 7059 7060func (c *InstancesRotateServerCaCall) doRequest(alt string) (*http.Response, error) { 7061 reqHeaders := make(http.Header) 7062 for k, v := range c.header_ { 7063 reqHeaders[k] = v 7064 } 7065 reqHeaders.Set("User-Agent", c.s.userAgent()) 7066 var body io.Reader = nil 7067 body, err := googleapi.WithoutDataWrapper.JSONReader(c.instancesrotateservercarequest) 7068 if err != nil { 7069 return nil, err 7070 } 7071 reqHeaders.Set("Content-Type", "application/json") 7072 c.urlParams_.Set("alt", alt) 7073 c.urlParams_.Set("prettyPrint", "false") 7074 urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{project}/instances/{instance}/rotateServerCa") 7075 urls += "?" + c.urlParams_.Encode() 7076 req, err := http.NewRequest("POST", urls, body) 7077 if err != nil { 7078 return nil, err 7079 } 7080 req.Header = reqHeaders 7081 googleapi.Expand(req.URL, map[string]string{ 7082 "project": c.project, 7083 "instance": c.instance, 7084 }) 7085 return gensupport.SendRequest(c.ctx_, c.s.client, req) 7086} 7087 7088// Do executes the "sql.instances.rotateServerCa" call. 7089// Exactly one of *Operation or error will be non-nil. Any non-2xx 7090// status code is an error. Response headers are in either 7091// *Operation.ServerResponse.Header or (if a response was returned at 7092// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 7093// to check whether the returned error was because 7094// http.StatusNotModified was returned. 7095func (c *InstancesRotateServerCaCall) Do(opts ...googleapi.CallOption) (*Operation, error) { 7096 gensupport.SetOptions(c.urlParams_, opts...) 7097 res, err := c.doRequest("json") 7098 if res != nil && res.StatusCode == http.StatusNotModified { 7099 if res.Body != nil { 7100 res.Body.Close() 7101 } 7102 return nil, &googleapi.Error{ 7103 Code: res.StatusCode, 7104 Header: res.Header, 7105 } 7106 } 7107 if err != nil { 7108 return nil, err 7109 } 7110 defer googleapi.CloseBody(res) 7111 if err := googleapi.CheckResponse(res); err != nil { 7112 return nil, err 7113 } 7114 ret := &Operation{ 7115 ServerResponse: googleapi.ServerResponse{ 7116 Header: res.Header, 7117 HTTPStatusCode: res.StatusCode, 7118 }, 7119 } 7120 target := &ret 7121 if err := gensupport.DecodeResponse(target, res); err != nil { 7122 return nil, err 7123 } 7124 return ret, nil 7125 // { 7126 // "description": "Rotates the server certificate to one signed by the Certificate Authority (CA) version previously added with the addServerCA method.", 7127 // "httpMethod": "POST", 7128 // "id": "sql.instances.rotateServerCa", 7129 // "parameterOrder": [ 7130 // "project", 7131 // "instance" 7132 // ], 7133 // "parameters": { 7134 // "instance": { 7135 // "description": "Cloud SQL instance ID. This does not include the project ID.", 7136 // "location": "path", 7137 // "required": true, 7138 // "type": "string" 7139 // }, 7140 // "project": { 7141 // "description": "Project ID of the project that contains the instance.", 7142 // "location": "path", 7143 // "required": true, 7144 // "type": "string" 7145 // } 7146 // }, 7147 // "path": "projects/{project}/instances/{instance}/rotateServerCa", 7148 // "request": { 7149 // "$ref": "InstancesRotateServerCaRequest" 7150 // }, 7151 // "response": { 7152 // "$ref": "Operation" 7153 // }, 7154 // "scopes": [ 7155 // "https://www.googleapis.com/auth/cloud-platform", 7156 // "https://www.googleapis.com/auth/sqlservice.admin" 7157 // ] 7158 // } 7159 7160} 7161 7162// method id "sql.instances.startReplica": 7163 7164type InstancesStartReplicaCall struct { 7165 s *Service 7166 project string 7167 instance string 7168 urlParams_ gensupport.URLParams 7169 ctx_ context.Context 7170 header_ http.Header 7171} 7172 7173// StartReplica: Starts the replication in the read replica instance. 7174func (r *InstancesService) StartReplica(project string, instance string) *InstancesStartReplicaCall { 7175 c := &InstancesStartReplicaCall{s: r.s, urlParams_: make(gensupport.URLParams)} 7176 c.project = project 7177 c.instance = instance 7178 return c 7179} 7180 7181// Fields allows partial responses to be retrieved. See 7182// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 7183// for more information. 7184func (c *InstancesStartReplicaCall) Fields(s ...googleapi.Field) *InstancesStartReplicaCall { 7185 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 7186 return c 7187} 7188 7189// Context sets the context to be used in this call's Do method. Any 7190// pending HTTP request will be aborted if the provided context is 7191// canceled. 7192func (c *InstancesStartReplicaCall) Context(ctx context.Context) *InstancesStartReplicaCall { 7193 c.ctx_ = ctx 7194 return c 7195} 7196 7197// Header returns an http.Header that can be modified by the caller to 7198// add HTTP headers to the request. 7199func (c *InstancesStartReplicaCall) Header() http.Header { 7200 if c.header_ == nil { 7201 c.header_ = make(http.Header) 7202 } 7203 return c.header_ 7204} 7205 7206func (c *InstancesStartReplicaCall) doRequest(alt string) (*http.Response, error) { 7207 reqHeaders := make(http.Header) 7208 for k, v := range c.header_ { 7209 reqHeaders[k] = v 7210 } 7211 reqHeaders.Set("User-Agent", c.s.userAgent()) 7212 var body io.Reader = nil 7213 c.urlParams_.Set("alt", alt) 7214 c.urlParams_.Set("prettyPrint", "false") 7215 urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{project}/instances/{instance}/startReplica") 7216 urls += "?" + c.urlParams_.Encode() 7217 req, err := http.NewRequest("POST", urls, body) 7218 if err != nil { 7219 return nil, err 7220 } 7221 req.Header = reqHeaders 7222 googleapi.Expand(req.URL, map[string]string{ 7223 "project": c.project, 7224 "instance": c.instance, 7225 }) 7226 return gensupport.SendRequest(c.ctx_, c.s.client, req) 7227} 7228 7229// Do executes the "sql.instances.startReplica" call. 7230// Exactly one of *Operation or error will be non-nil. Any non-2xx 7231// status code is an error. Response headers are in either 7232// *Operation.ServerResponse.Header or (if a response was returned at 7233// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 7234// to check whether the returned error was because 7235// http.StatusNotModified was returned. 7236func (c *InstancesStartReplicaCall) Do(opts ...googleapi.CallOption) (*Operation, error) { 7237 gensupport.SetOptions(c.urlParams_, opts...) 7238 res, err := c.doRequest("json") 7239 if res != nil && res.StatusCode == http.StatusNotModified { 7240 if res.Body != nil { 7241 res.Body.Close() 7242 } 7243 return nil, &googleapi.Error{ 7244 Code: res.StatusCode, 7245 Header: res.Header, 7246 } 7247 } 7248 if err != nil { 7249 return nil, err 7250 } 7251 defer googleapi.CloseBody(res) 7252 if err := googleapi.CheckResponse(res); err != nil { 7253 return nil, err 7254 } 7255 ret := &Operation{ 7256 ServerResponse: googleapi.ServerResponse{ 7257 Header: res.Header, 7258 HTTPStatusCode: res.StatusCode, 7259 }, 7260 } 7261 target := &ret 7262 if err := gensupport.DecodeResponse(target, res); err != nil { 7263 return nil, err 7264 } 7265 return ret, nil 7266 // { 7267 // "description": "Starts the replication in the read replica instance.", 7268 // "httpMethod": "POST", 7269 // "id": "sql.instances.startReplica", 7270 // "parameterOrder": [ 7271 // "project", 7272 // "instance" 7273 // ], 7274 // "parameters": { 7275 // "instance": { 7276 // "description": "Cloud SQL read replica instance name.", 7277 // "location": "path", 7278 // "required": true, 7279 // "type": "string" 7280 // }, 7281 // "project": { 7282 // "description": "ID of the project that contains the read replica.", 7283 // "location": "path", 7284 // "required": true, 7285 // "type": "string" 7286 // } 7287 // }, 7288 // "path": "projects/{project}/instances/{instance}/startReplica", 7289 // "response": { 7290 // "$ref": "Operation" 7291 // }, 7292 // "scopes": [ 7293 // "https://www.googleapis.com/auth/cloud-platform", 7294 // "https://www.googleapis.com/auth/sqlservice.admin" 7295 // ] 7296 // } 7297 7298} 7299 7300// method id "sql.instances.stopReplica": 7301 7302type InstancesStopReplicaCall struct { 7303 s *Service 7304 project string 7305 instance string 7306 urlParams_ gensupport.URLParams 7307 ctx_ context.Context 7308 header_ http.Header 7309} 7310 7311// StopReplica: Stops the replication in the read replica instance. 7312func (r *InstancesService) StopReplica(project string, instance string) *InstancesStopReplicaCall { 7313 c := &InstancesStopReplicaCall{s: r.s, urlParams_: make(gensupport.URLParams)} 7314 c.project = project 7315 c.instance = instance 7316 return c 7317} 7318 7319// Fields allows partial responses to be retrieved. See 7320// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 7321// for more information. 7322func (c *InstancesStopReplicaCall) Fields(s ...googleapi.Field) *InstancesStopReplicaCall { 7323 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 7324 return c 7325} 7326 7327// Context sets the context to be used in this call's Do method. Any 7328// pending HTTP request will be aborted if the provided context is 7329// canceled. 7330func (c *InstancesStopReplicaCall) Context(ctx context.Context) *InstancesStopReplicaCall { 7331 c.ctx_ = ctx 7332 return c 7333} 7334 7335// Header returns an http.Header that can be modified by the caller to 7336// add HTTP headers to the request. 7337func (c *InstancesStopReplicaCall) Header() http.Header { 7338 if c.header_ == nil { 7339 c.header_ = make(http.Header) 7340 } 7341 return c.header_ 7342} 7343 7344func (c *InstancesStopReplicaCall) doRequest(alt string) (*http.Response, error) { 7345 reqHeaders := make(http.Header) 7346 for k, v := range c.header_ { 7347 reqHeaders[k] = v 7348 } 7349 reqHeaders.Set("User-Agent", c.s.userAgent()) 7350 var body io.Reader = nil 7351 c.urlParams_.Set("alt", alt) 7352 c.urlParams_.Set("prettyPrint", "false") 7353 urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{project}/instances/{instance}/stopReplica") 7354 urls += "?" + c.urlParams_.Encode() 7355 req, err := http.NewRequest("POST", urls, body) 7356 if err != nil { 7357 return nil, err 7358 } 7359 req.Header = reqHeaders 7360 googleapi.Expand(req.URL, map[string]string{ 7361 "project": c.project, 7362 "instance": c.instance, 7363 }) 7364 return gensupport.SendRequest(c.ctx_, c.s.client, req) 7365} 7366 7367// Do executes the "sql.instances.stopReplica" call. 7368// Exactly one of *Operation or error will be non-nil. Any non-2xx 7369// status code is an error. Response headers are in either 7370// *Operation.ServerResponse.Header or (if a response was returned at 7371// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 7372// to check whether the returned error was because 7373// http.StatusNotModified was returned. 7374func (c *InstancesStopReplicaCall) Do(opts ...googleapi.CallOption) (*Operation, error) { 7375 gensupport.SetOptions(c.urlParams_, opts...) 7376 res, err := c.doRequest("json") 7377 if res != nil && res.StatusCode == http.StatusNotModified { 7378 if res.Body != nil { 7379 res.Body.Close() 7380 } 7381 return nil, &googleapi.Error{ 7382 Code: res.StatusCode, 7383 Header: res.Header, 7384 } 7385 } 7386 if err != nil { 7387 return nil, err 7388 } 7389 defer googleapi.CloseBody(res) 7390 if err := googleapi.CheckResponse(res); err != nil { 7391 return nil, err 7392 } 7393 ret := &Operation{ 7394 ServerResponse: googleapi.ServerResponse{ 7395 Header: res.Header, 7396 HTTPStatusCode: res.StatusCode, 7397 }, 7398 } 7399 target := &ret 7400 if err := gensupport.DecodeResponse(target, res); err != nil { 7401 return nil, err 7402 } 7403 return ret, nil 7404 // { 7405 // "description": "Stops the replication in the read replica instance.", 7406 // "httpMethod": "POST", 7407 // "id": "sql.instances.stopReplica", 7408 // "parameterOrder": [ 7409 // "project", 7410 // "instance" 7411 // ], 7412 // "parameters": { 7413 // "instance": { 7414 // "description": "Cloud SQL read replica instance name.", 7415 // "location": "path", 7416 // "required": true, 7417 // "type": "string" 7418 // }, 7419 // "project": { 7420 // "description": "ID of the project that contains the read replica.", 7421 // "location": "path", 7422 // "required": true, 7423 // "type": "string" 7424 // } 7425 // }, 7426 // "path": "projects/{project}/instances/{instance}/stopReplica", 7427 // "response": { 7428 // "$ref": "Operation" 7429 // }, 7430 // "scopes": [ 7431 // "https://www.googleapis.com/auth/cloud-platform", 7432 // "https://www.googleapis.com/auth/sqlservice.admin" 7433 // ] 7434 // } 7435 7436} 7437 7438// method id "sql.instances.truncateLog": 7439 7440type InstancesTruncateLogCall struct { 7441 s *Service 7442 project string 7443 instance string 7444 instancestruncatelogrequest *InstancesTruncateLogRequest 7445 urlParams_ gensupport.URLParams 7446 ctx_ context.Context 7447 header_ http.Header 7448} 7449 7450// TruncateLog: Truncate MySQL general and slow query log tables 7451func (r *InstancesService) TruncateLog(project string, instance string, instancestruncatelogrequest *InstancesTruncateLogRequest) *InstancesTruncateLogCall { 7452 c := &InstancesTruncateLogCall{s: r.s, urlParams_: make(gensupport.URLParams)} 7453 c.project = project 7454 c.instance = instance 7455 c.instancestruncatelogrequest = instancestruncatelogrequest 7456 return c 7457} 7458 7459// Fields allows partial responses to be retrieved. See 7460// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 7461// for more information. 7462func (c *InstancesTruncateLogCall) Fields(s ...googleapi.Field) *InstancesTruncateLogCall { 7463 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 7464 return c 7465} 7466 7467// Context sets the context to be used in this call's Do method. Any 7468// pending HTTP request will be aborted if the provided context is 7469// canceled. 7470func (c *InstancesTruncateLogCall) Context(ctx context.Context) *InstancesTruncateLogCall { 7471 c.ctx_ = ctx 7472 return c 7473} 7474 7475// Header returns an http.Header that can be modified by the caller to 7476// add HTTP headers to the request. 7477func (c *InstancesTruncateLogCall) Header() http.Header { 7478 if c.header_ == nil { 7479 c.header_ = make(http.Header) 7480 } 7481 return c.header_ 7482} 7483 7484func (c *InstancesTruncateLogCall) doRequest(alt string) (*http.Response, error) { 7485 reqHeaders := make(http.Header) 7486 for k, v := range c.header_ { 7487 reqHeaders[k] = v 7488 } 7489 reqHeaders.Set("User-Agent", c.s.userAgent()) 7490 var body io.Reader = nil 7491 body, err := googleapi.WithoutDataWrapper.JSONReader(c.instancestruncatelogrequest) 7492 if err != nil { 7493 return nil, err 7494 } 7495 reqHeaders.Set("Content-Type", "application/json") 7496 c.urlParams_.Set("alt", alt) 7497 c.urlParams_.Set("prettyPrint", "false") 7498 urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{project}/instances/{instance}/truncateLog") 7499 urls += "?" + c.urlParams_.Encode() 7500 req, err := http.NewRequest("POST", urls, body) 7501 if err != nil { 7502 return nil, err 7503 } 7504 req.Header = reqHeaders 7505 googleapi.Expand(req.URL, map[string]string{ 7506 "project": c.project, 7507 "instance": c.instance, 7508 }) 7509 return gensupport.SendRequest(c.ctx_, c.s.client, req) 7510} 7511 7512// Do executes the "sql.instances.truncateLog" call. 7513// Exactly one of *Operation or error will be non-nil. Any non-2xx 7514// status code is an error. Response headers are in either 7515// *Operation.ServerResponse.Header or (if a response was returned at 7516// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 7517// to check whether the returned error was because 7518// http.StatusNotModified was returned. 7519func (c *InstancesTruncateLogCall) Do(opts ...googleapi.CallOption) (*Operation, error) { 7520 gensupport.SetOptions(c.urlParams_, opts...) 7521 res, err := c.doRequest("json") 7522 if res != nil && res.StatusCode == http.StatusNotModified { 7523 if res.Body != nil { 7524 res.Body.Close() 7525 } 7526 return nil, &googleapi.Error{ 7527 Code: res.StatusCode, 7528 Header: res.Header, 7529 } 7530 } 7531 if err != nil { 7532 return nil, err 7533 } 7534 defer googleapi.CloseBody(res) 7535 if err := googleapi.CheckResponse(res); err != nil { 7536 return nil, err 7537 } 7538 ret := &Operation{ 7539 ServerResponse: googleapi.ServerResponse{ 7540 Header: res.Header, 7541 HTTPStatusCode: res.StatusCode, 7542 }, 7543 } 7544 target := &ret 7545 if err := gensupport.DecodeResponse(target, res); err != nil { 7546 return nil, err 7547 } 7548 return ret, nil 7549 // { 7550 // "description": "Truncate MySQL general and slow query log tables", 7551 // "httpMethod": "POST", 7552 // "id": "sql.instances.truncateLog", 7553 // "parameterOrder": [ 7554 // "project", 7555 // "instance" 7556 // ], 7557 // "parameters": { 7558 // "instance": { 7559 // "description": "Cloud SQL instance ID. This does not include the project ID.", 7560 // "location": "path", 7561 // "required": true, 7562 // "type": "string" 7563 // }, 7564 // "project": { 7565 // "description": "Project ID of the Cloud SQL project.", 7566 // "location": "path", 7567 // "required": true, 7568 // "type": "string" 7569 // } 7570 // }, 7571 // "path": "projects/{project}/instances/{instance}/truncateLog", 7572 // "request": { 7573 // "$ref": "InstancesTruncateLogRequest" 7574 // }, 7575 // "response": { 7576 // "$ref": "Operation" 7577 // }, 7578 // "scopes": [ 7579 // "https://www.googleapis.com/auth/cloud-platform", 7580 // "https://www.googleapis.com/auth/sqlservice.admin" 7581 // ] 7582 // } 7583 7584} 7585 7586// method id "sql.instances.update": 7587 7588type InstancesUpdateCall struct { 7589 s *Service 7590 project string 7591 instance string 7592 databaseinstance *DatabaseInstance 7593 urlParams_ gensupport.URLParams 7594 ctx_ context.Context 7595 header_ http.Header 7596} 7597 7598// Update: Updates settings of a Cloud SQL instance. Caution: This is 7599// not a partial update, so you must include values for all the settings 7600// that you want to retain. For partial updates, use patch. 7601func (r *InstancesService) Update(project string, instance string, databaseinstance *DatabaseInstance) *InstancesUpdateCall { 7602 c := &InstancesUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 7603 c.project = project 7604 c.instance = instance 7605 c.databaseinstance = databaseinstance 7606 return c 7607} 7608 7609// Fields allows partial responses to be retrieved. See 7610// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 7611// for more information. 7612func (c *InstancesUpdateCall) Fields(s ...googleapi.Field) *InstancesUpdateCall { 7613 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 7614 return c 7615} 7616 7617// Context sets the context to be used in this call's Do method. Any 7618// pending HTTP request will be aborted if the provided context is 7619// canceled. 7620func (c *InstancesUpdateCall) Context(ctx context.Context) *InstancesUpdateCall { 7621 c.ctx_ = ctx 7622 return c 7623} 7624 7625// Header returns an http.Header that can be modified by the caller to 7626// add HTTP headers to the request. 7627func (c *InstancesUpdateCall) Header() http.Header { 7628 if c.header_ == nil { 7629 c.header_ = make(http.Header) 7630 } 7631 return c.header_ 7632} 7633 7634func (c *InstancesUpdateCall) doRequest(alt string) (*http.Response, error) { 7635 reqHeaders := make(http.Header) 7636 for k, v := range c.header_ { 7637 reqHeaders[k] = v 7638 } 7639 reqHeaders.Set("User-Agent", c.s.userAgent()) 7640 var body io.Reader = nil 7641 body, err := googleapi.WithoutDataWrapper.JSONReader(c.databaseinstance) 7642 if err != nil { 7643 return nil, err 7644 } 7645 reqHeaders.Set("Content-Type", "application/json") 7646 c.urlParams_.Set("alt", alt) 7647 c.urlParams_.Set("prettyPrint", "false") 7648 urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{project}/instances/{instance}") 7649 urls += "?" + c.urlParams_.Encode() 7650 req, err := http.NewRequest("PUT", urls, body) 7651 if err != nil { 7652 return nil, err 7653 } 7654 req.Header = reqHeaders 7655 googleapi.Expand(req.URL, map[string]string{ 7656 "project": c.project, 7657 "instance": c.instance, 7658 }) 7659 return gensupport.SendRequest(c.ctx_, c.s.client, req) 7660} 7661 7662// Do executes the "sql.instances.update" call. 7663// Exactly one of *Operation or error will be non-nil. Any non-2xx 7664// status code is an error. Response headers are in either 7665// *Operation.ServerResponse.Header or (if a response was returned at 7666// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 7667// to check whether the returned error was because 7668// http.StatusNotModified was returned. 7669func (c *InstancesUpdateCall) Do(opts ...googleapi.CallOption) (*Operation, error) { 7670 gensupport.SetOptions(c.urlParams_, opts...) 7671 res, err := c.doRequest("json") 7672 if res != nil && res.StatusCode == http.StatusNotModified { 7673 if res.Body != nil { 7674 res.Body.Close() 7675 } 7676 return nil, &googleapi.Error{ 7677 Code: res.StatusCode, 7678 Header: res.Header, 7679 } 7680 } 7681 if err != nil { 7682 return nil, err 7683 } 7684 defer googleapi.CloseBody(res) 7685 if err := googleapi.CheckResponse(res); err != nil { 7686 return nil, err 7687 } 7688 ret := &Operation{ 7689 ServerResponse: googleapi.ServerResponse{ 7690 Header: res.Header, 7691 HTTPStatusCode: res.StatusCode, 7692 }, 7693 } 7694 target := &ret 7695 if err := gensupport.DecodeResponse(target, res); err != nil { 7696 return nil, err 7697 } 7698 return ret, nil 7699 // { 7700 // "description": "Updates settings of a Cloud SQL instance. Caution: This is not a partial update, so you must include values for all the settings that you want to retain. For partial updates, use patch.", 7701 // "httpMethod": "PUT", 7702 // "id": "sql.instances.update", 7703 // "parameterOrder": [ 7704 // "project", 7705 // "instance" 7706 // ], 7707 // "parameters": { 7708 // "instance": { 7709 // "description": "Cloud SQL instance ID. This does not include the project ID.", 7710 // "location": "path", 7711 // "required": true, 7712 // "type": "string" 7713 // }, 7714 // "project": { 7715 // "description": "Project ID of the project that contains the instance.", 7716 // "location": "path", 7717 // "required": true, 7718 // "type": "string" 7719 // } 7720 // }, 7721 // "path": "projects/{project}/instances/{instance}", 7722 // "request": { 7723 // "$ref": "DatabaseInstance" 7724 // }, 7725 // "response": { 7726 // "$ref": "Operation" 7727 // }, 7728 // "scopes": [ 7729 // "https://www.googleapis.com/auth/cloud-platform", 7730 // "https://www.googleapis.com/auth/sqlservice.admin" 7731 // ] 7732 // } 7733 7734} 7735 7736// method id "sql.operations.get": 7737 7738type OperationsGetCall struct { 7739 s *Service 7740 project string 7741 operation string 7742 urlParams_ gensupport.URLParams 7743 ifNoneMatch_ string 7744 ctx_ context.Context 7745 header_ http.Header 7746} 7747 7748// Get: Retrieves an instance operation that has been performed on an 7749// instance. 7750func (r *OperationsService) Get(project string, operation string) *OperationsGetCall { 7751 c := &OperationsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 7752 c.project = project 7753 c.operation = operation 7754 return c 7755} 7756 7757// Fields allows partial responses to be retrieved. See 7758// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 7759// for more information. 7760func (c *OperationsGetCall) Fields(s ...googleapi.Field) *OperationsGetCall { 7761 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 7762 return c 7763} 7764 7765// IfNoneMatch sets the optional parameter which makes the operation 7766// fail if the object's ETag matches the given value. This is useful for 7767// getting updates only after the object has changed since the last 7768// request. Use googleapi.IsNotModified to check whether the response 7769// error from Do is the result of In-None-Match. 7770func (c *OperationsGetCall) IfNoneMatch(entityTag string) *OperationsGetCall { 7771 c.ifNoneMatch_ = entityTag 7772 return c 7773} 7774 7775// Context sets the context to be used in this call's Do method. Any 7776// pending HTTP request will be aborted if the provided context is 7777// canceled. 7778func (c *OperationsGetCall) Context(ctx context.Context) *OperationsGetCall { 7779 c.ctx_ = ctx 7780 return c 7781} 7782 7783// Header returns an http.Header that can be modified by the caller to 7784// add HTTP headers to the request. 7785func (c *OperationsGetCall) Header() http.Header { 7786 if c.header_ == nil { 7787 c.header_ = make(http.Header) 7788 } 7789 return c.header_ 7790} 7791 7792func (c *OperationsGetCall) doRequest(alt string) (*http.Response, error) { 7793 reqHeaders := make(http.Header) 7794 for k, v := range c.header_ { 7795 reqHeaders[k] = v 7796 } 7797 reqHeaders.Set("User-Agent", c.s.userAgent()) 7798 if c.ifNoneMatch_ != "" { 7799 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 7800 } 7801 var body io.Reader = nil 7802 c.urlParams_.Set("alt", alt) 7803 c.urlParams_.Set("prettyPrint", "false") 7804 urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{project}/operations/{operation}") 7805 urls += "?" + c.urlParams_.Encode() 7806 req, err := http.NewRequest("GET", urls, body) 7807 if err != nil { 7808 return nil, err 7809 } 7810 req.Header = reqHeaders 7811 googleapi.Expand(req.URL, map[string]string{ 7812 "project": c.project, 7813 "operation": c.operation, 7814 }) 7815 return gensupport.SendRequest(c.ctx_, c.s.client, req) 7816} 7817 7818// Do executes the "sql.operations.get" call. 7819// Exactly one of *Operation or error will be non-nil. Any non-2xx 7820// status code is an error. Response headers are in either 7821// *Operation.ServerResponse.Header or (if a response was returned at 7822// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 7823// to check whether the returned error was because 7824// http.StatusNotModified was returned. 7825func (c *OperationsGetCall) Do(opts ...googleapi.CallOption) (*Operation, error) { 7826 gensupport.SetOptions(c.urlParams_, opts...) 7827 res, err := c.doRequest("json") 7828 if res != nil && res.StatusCode == http.StatusNotModified { 7829 if res.Body != nil { 7830 res.Body.Close() 7831 } 7832 return nil, &googleapi.Error{ 7833 Code: res.StatusCode, 7834 Header: res.Header, 7835 } 7836 } 7837 if err != nil { 7838 return nil, err 7839 } 7840 defer googleapi.CloseBody(res) 7841 if err := googleapi.CheckResponse(res); err != nil { 7842 return nil, err 7843 } 7844 ret := &Operation{ 7845 ServerResponse: googleapi.ServerResponse{ 7846 Header: res.Header, 7847 HTTPStatusCode: res.StatusCode, 7848 }, 7849 } 7850 target := &ret 7851 if err := gensupport.DecodeResponse(target, res); err != nil { 7852 return nil, err 7853 } 7854 return ret, nil 7855 // { 7856 // "description": "Retrieves an instance operation that has been performed on an instance.", 7857 // "httpMethod": "GET", 7858 // "id": "sql.operations.get", 7859 // "parameterOrder": [ 7860 // "project", 7861 // "operation" 7862 // ], 7863 // "parameters": { 7864 // "operation": { 7865 // "description": "Instance operation ID.", 7866 // "location": "path", 7867 // "required": true, 7868 // "type": "string" 7869 // }, 7870 // "project": { 7871 // "description": "Project ID of the project that contains the instance.", 7872 // "location": "path", 7873 // "required": true, 7874 // "type": "string" 7875 // } 7876 // }, 7877 // "path": "projects/{project}/operations/{operation}", 7878 // "response": { 7879 // "$ref": "Operation" 7880 // }, 7881 // "scopes": [ 7882 // "https://www.googleapis.com/auth/cloud-platform", 7883 // "https://www.googleapis.com/auth/sqlservice.admin" 7884 // ] 7885 // } 7886 7887} 7888 7889// method id "sql.operations.list": 7890 7891type OperationsListCall struct { 7892 s *Service 7893 project string 7894 urlParams_ gensupport.URLParams 7895 ifNoneMatch_ string 7896 ctx_ context.Context 7897 header_ http.Header 7898} 7899 7900// List: Lists all instance operations that have been performed on the 7901// given Cloud SQL instance in the reverse chronological order of the 7902// start time. 7903func (r *OperationsService) List(project string, instance string) *OperationsListCall { 7904 c := &OperationsListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 7905 c.project = project 7906 c.urlParams_.Set("instance", instance) 7907 return c 7908} 7909 7910// MaxResults sets the optional parameter "maxResults": Maximum number 7911// of operations per response. 7912func (c *OperationsListCall) MaxResults(maxResults int64) *OperationsListCall { 7913 c.urlParams_.Set("maxResults", fmt.Sprint(maxResults)) 7914 return c 7915} 7916 7917// PageToken sets the optional parameter "pageToken": A 7918// previously-returned page token representing part of the larger set of 7919// results to view. 7920func (c *OperationsListCall) PageToken(pageToken string) *OperationsListCall { 7921 c.urlParams_.Set("pageToken", pageToken) 7922 return c 7923} 7924 7925// Fields allows partial responses to be retrieved. See 7926// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 7927// for more information. 7928func (c *OperationsListCall) Fields(s ...googleapi.Field) *OperationsListCall { 7929 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 7930 return c 7931} 7932 7933// IfNoneMatch sets the optional parameter which makes the operation 7934// fail if the object's ETag matches the given value. This is useful for 7935// getting updates only after the object has changed since the last 7936// request. Use googleapi.IsNotModified to check whether the response 7937// error from Do is the result of In-None-Match. 7938func (c *OperationsListCall) IfNoneMatch(entityTag string) *OperationsListCall { 7939 c.ifNoneMatch_ = entityTag 7940 return c 7941} 7942 7943// Context sets the context to be used in this call's Do method. Any 7944// pending HTTP request will be aborted if the provided context is 7945// canceled. 7946func (c *OperationsListCall) Context(ctx context.Context) *OperationsListCall { 7947 c.ctx_ = ctx 7948 return c 7949} 7950 7951// Header returns an http.Header that can be modified by the caller to 7952// add HTTP headers to the request. 7953func (c *OperationsListCall) Header() http.Header { 7954 if c.header_ == nil { 7955 c.header_ = make(http.Header) 7956 } 7957 return c.header_ 7958} 7959 7960func (c *OperationsListCall) doRequest(alt string) (*http.Response, error) { 7961 reqHeaders := make(http.Header) 7962 for k, v := range c.header_ { 7963 reqHeaders[k] = v 7964 } 7965 reqHeaders.Set("User-Agent", c.s.userAgent()) 7966 if c.ifNoneMatch_ != "" { 7967 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 7968 } 7969 var body io.Reader = nil 7970 c.urlParams_.Set("alt", alt) 7971 c.urlParams_.Set("prettyPrint", "false") 7972 urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{project}/operations") 7973 urls += "?" + c.urlParams_.Encode() 7974 req, err := http.NewRequest("GET", urls, body) 7975 if err != nil { 7976 return nil, err 7977 } 7978 req.Header = reqHeaders 7979 googleapi.Expand(req.URL, map[string]string{ 7980 "project": c.project, 7981 }) 7982 return gensupport.SendRequest(c.ctx_, c.s.client, req) 7983} 7984 7985// Do executes the "sql.operations.list" call. 7986// Exactly one of *OperationsListResponse or error will be non-nil. Any 7987// non-2xx status code is an error. Response headers are in either 7988// *OperationsListResponse.ServerResponse.Header or (if a response was 7989// returned at all) in error.(*googleapi.Error).Header. Use 7990// googleapi.IsNotModified to check whether the returned error was 7991// because http.StatusNotModified was returned. 7992func (c *OperationsListCall) Do(opts ...googleapi.CallOption) (*OperationsListResponse, error) { 7993 gensupport.SetOptions(c.urlParams_, opts...) 7994 res, err := c.doRequest("json") 7995 if res != nil && res.StatusCode == http.StatusNotModified { 7996 if res.Body != nil { 7997 res.Body.Close() 7998 } 7999 return nil, &googleapi.Error{ 8000 Code: res.StatusCode, 8001 Header: res.Header, 8002 } 8003 } 8004 if err != nil { 8005 return nil, err 8006 } 8007 defer googleapi.CloseBody(res) 8008 if err := googleapi.CheckResponse(res); err != nil { 8009 return nil, err 8010 } 8011 ret := &OperationsListResponse{ 8012 ServerResponse: googleapi.ServerResponse{ 8013 Header: res.Header, 8014 HTTPStatusCode: res.StatusCode, 8015 }, 8016 } 8017 target := &ret 8018 if err := gensupport.DecodeResponse(target, res); err != nil { 8019 return nil, err 8020 } 8021 return ret, nil 8022 // { 8023 // "description": "Lists all instance operations that have been performed on the given Cloud SQL instance in the reverse chronological order of the start time.", 8024 // "httpMethod": "GET", 8025 // "id": "sql.operations.list", 8026 // "parameterOrder": [ 8027 // "project", 8028 // "instance" 8029 // ], 8030 // "parameters": { 8031 // "instance": { 8032 // "description": "Cloud SQL instance ID. This does not include the project ID.", 8033 // "location": "query", 8034 // "required": true, 8035 // "type": "string" 8036 // }, 8037 // "maxResults": { 8038 // "description": "Maximum number of operations per response.", 8039 // "format": "uint32", 8040 // "location": "query", 8041 // "type": "integer" 8042 // }, 8043 // "pageToken": { 8044 // "description": "A previously-returned page token representing part of the larger set of results to view.", 8045 // "location": "query", 8046 // "type": "string" 8047 // }, 8048 // "project": { 8049 // "description": "Project ID of the project that contains the instance.", 8050 // "location": "path", 8051 // "required": true, 8052 // "type": "string" 8053 // } 8054 // }, 8055 // "path": "projects/{project}/operations", 8056 // "response": { 8057 // "$ref": "OperationsListResponse" 8058 // }, 8059 // "scopes": [ 8060 // "https://www.googleapis.com/auth/cloud-platform", 8061 // "https://www.googleapis.com/auth/sqlservice.admin" 8062 // ] 8063 // } 8064 8065} 8066 8067// Pages invokes f for each page of results. 8068// A non-nil error returned from f will halt the iteration. 8069// The provided context supersedes any context provided to the Context method. 8070func (c *OperationsListCall) Pages(ctx context.Context, f func(*OperationsListResponse) error) error { 8071 c.ctx_ = ctx 8072 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 8073 for { 8074 x, err := c.Do() 8075 if err != nil { 8076 return err 8077 } 8078 if err := f(x); err != nil { 8079 return err 8080 } 8081 if x.NextPageToken == "" { 8082 return nil 8083 } 8084 c.PageToken(x.NextPageToken) 8085 } 8086} 8087 8088// method id "sql.sslCerts.createEphemeral": 8089 8090type SslCertsCreateEphemeralCall struct { 8091 s *Service 8092 project string 8093 instance string 8094 sslcertscreateephemeralrequest *SslCertsCreateEphemeralRequest 8095 urlParams_ gensupport.URLParams 8096 ctx_ context.Context 8097 header_ http.Header 8098} 8099 8100// CreateEphemeral: Generates a short-lived X509 certificate containing 8101// the provided public key and signed by a private key specific to the 8102// target instance. Users may use the certificate to authenticate as 8103// themselves when connecting to the database. 8104func (r *SslCertsService) CreateEphemeral(project string, instance string, sslcertscreateephemeralrequest *SslCertsCreateEphemeralRequest) *SslCertsCreateEphemeralCall { 8105 c := &SslCertsCreateEphemeralCall{s: r.s, urlParams_: make(gensupport.URLParams)} 8106 c.project = project 8107 c.instance = instance 8108 c.sslcertscreateephemeralrequest = sslcertscreateephemeralrequest 8109 return c 8110} 8111 8112// Fields allows partial responses to be retrieved. See 8113// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 8114// for more information. 8115func (c *SslCertsCreateEphemeralCall) Fields(s ...googleapi.Field) *SslCertsCreateEphemeralCall { 8116 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 8117 return c 8118} 8119 8120// Context sets the context to be used in this call's Do method. Any 8121// pending HTTP request will be aborted if the provided context is 8122// canceled. 8123func (c *SslCertsCreateEphemeralCall) Context(ctx context.Context) *SslCertsCreateEphemeralCall { 8124 c.ctx_ = ctx 8125 return c 8126} 8127 8128// Header returns an http.Header that can be modified by the caller to 8129// add HTTP headers to the request. 8130func (c *SslCertsCreateEphemeralCall) Header() http.Header { 8131 if c.header_ == nil { 8132 c.header_ = make(http.Header) 8133 } 8134 return c.header_ 8135} 8136 8137func (c *SslCertsCreateEphemeralCall) doRequest(alt string) (*http.Response, error) { 8138 reqHeaders := make(http.Header) 8139 for k, v := range c.header_ { 8140 reqHeaders[k] = v 8141 } 8142 reqHeaders.Set("User-Agent", c.s.userAgent()) 8143 var body io.Reader = nil 8144 body, err := googleapi.WithoutDataWrapper.JSONReader(c.sslcertscreateephemeralrequest) 8145 if err != nil { 8146 return nil, err 8147 } 8148 reqHeaders.Set("Content-Type", "application/json") 8149 c.urlParams_.Set("alt", alt) 8150 c.urlParams_.Set("prettyPrint", "false") 8151 urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{project}/instances/{instance}/createEphemeral") 8152 urls += "?" + c.urlParams_.Encode() 8153 req, err := http.NewRequest("POST", urls, body) 8154 if err != nil { 8155 return nil, err 8156 } 8157 req.Header = reqHeaders 8158 googleapi.Expand(req.URL, map[string]string{ 8159 "project": c.project, 8160 "instance": c.instance, 8161 }) 8162 return gensupport.SendRequest(c.ctx_, c.s.client, req) 8163} 8164 8165// Do executes the "sql.sslCerts.createEphemeral" call. 8166// Exactly one of *SslCert or error will be non-nil. Any non-2xx status 8167// code is an error. Response headers are in either 8168// *SslCert.ServerResponse.Header or (if a response was returned at all) 8169// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 8170// check whether the returned error was because http.StatusNotModified 8171// was returned. 8172func (c *SslCertsCreateEphemeralCall) Do(opts ...googleapi.CallOption) (*SslCert, error) { 8173 gensupport.SetOptions(c.urlParams_, opts...) 8174 res, err := c.doRequest("json") 8175 if res != nil && res.StatusCode == http.StatusNotModified { 8176 if res.Body != nil { 8177 res.Body.Close() 8178 } 8179 return nil, &googleapi.Error{ 8180 Code: res.StatusCode, 8181 Header: res.Header, 8182 } 8183 } 8184 if err != nil { 8185 return nil, err 8186 } 8187 defer googleapi.CloseBody(res) 8188 if err := googleapi.CheckResponse(res); err != nil { 8189 return nil, err 8190 } 8191 ret := &SslCert{ 8192 ServerResponse: googleapi.ServerResponse{ 8193 Header: res.Header, 8194 HTTPStatusCode: res.StatusCode, 8195 }, 8196 } 8197 target := &ret 8198 if err := gensupport.DecodeResponse(target, res); err != nil { 8199 return nil, err 8200 } 8201 return ret, nil 8202 // { 8203 // "description": "Generates a short-lived X509 certificate containing the provided public key and signed by a private key specific to the target instance. Users may use the certificate to authenticate as themselves when connecting to the database.", 8204 // "httpMethod": "POST", 8205 // "id": "sql.sslCerts.createEphemeral", 8206 // "parameterOrder": [ 8207 // "project", 8208 // "instance" 8209 // ], 8210 // "parameters": { 8211 // "instance": { 8212 // "description": "Cloud SQL instance ID. This does not include the project ID.", 8213 // "location": "path", 8214 // "required": true, 8215 // "type": "string" 8216 // }, 8217 // "project": { 8218 // "description": "Project ID of the Cloud SQL project.", 8219 // "location": "path", 8220 // "required": true, 8221 // "type": "string" 8222 // } 8223 // }, 8224 // "path": "projects/{project}/instances/{instance}/createEphemeral", 8225 // "request": { 8226 // "$ref": "SslCertsCreateEphemeralRequest" 8227 // }, 8228 // "response": { 8229 // "$ref": "SslCert" 8230 // }, 8231 // "scopes": [ 8232 // "https://www.googleapis.com/auth/cloud-platform", 8233 // "https://www.googleapis.com/auth/sqlservice.admin" 8234 // ] 8235 // } 8236 8237} 8238 8239// method id "sql.sslCerts.delete": 8240 8241type SslCertsDeleteCall struct { 8242 s *Service 8243 project string 8244 instance string 8245 sha1Fingerprint string 8246 urlParams_ gensupport.URLParams 8247 ctx_ context.Context 8248 header_ http.Header 8249} 8250 8251// Delete: Deletes the SSL certificate. For First Generation instances, 8252// the certificate remains valid until the instance is restarted. 8253func (r *SslCertsService) Delete(project string, instance string, sha1Fingerprint string) *SslCertsDeleteCall { 8254 c := &SslCertsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 8255 c.project = project 8256 c.instance = instance 8257 c.sha1Fingerprint = sha1Fingerprint 8258 return c 8259} 8260 8261// Fields allows partial responses to be retrieved. See 8262// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 8263// for more information. 8264func (c *SslCertsDeleteCall) Fields(s ...googleapi.Field) *SslCertsDeleteCall { 8265 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 8266 return c 8267} 8268 8269// Context sets the context to be used in this call's Do method. Any 8270// pending HTTP request will be aborted if the provided context is 8271// canceled. 8272func (c *SslCertsDeleteCall) Context(ctx context.Context) *SslCertsDeleteCall { 8273 c.ctx_ = ctx 8274 return c 8275} 8276 8277// Header returns an http.Header that can be modified by the caller to 8278// add HTTP headers to the request. 8279func (c *SslCertsDeleteCall) Header() http.Header { 8280 if c.header_ == nil { 8281 c.header_ = make(http.Header) 8282 } 8283 return c.header_ 8284} 8285 8286func (c *SslCertsDeleteCall) doRequest(alt string) (*http.Response, error) { 8287 reqHeaders := make(http.Header) 8288 for k, v := range c.header_ { 8289 reqHeaders[k] = v 8290 } 8291 reqHeaders.Set("User-Agent", c.s.userAgent()) 8292 var body io.Reader = nil 8293 c.urlParams_.Set("alt", alt) 8294 c.urlParams_.Set("prettyPrint", "false") 8295 urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{project}/instances/{instance}/sslCerts/{sha1Fingerprint}") 8296 urls += "?" + c.urlParams_.Encode() 8297 req, err := http.NewRequest("DELETE", urls, body) 8298 if err != nil { 8299 return nil, err 8300 } 8301 req.Header = reqHeaders 8302 googleapi.Expand(req.URL, map[string]string{ 8303 "project": c.project, 8304 "instance": c.instance, 8305 "sha1Fingerprint": c.sha1Fingerprint, 8306 }) 8307 return gensupport.SendRequest(c.ctx_, c.s.client, req) 8308} 8309 8310// Do executes the "sql.sslCerts.delete" call. 8311// Exactly one of *Operation or error will be non-nil. Any non-2xx 8312// status code is an error. Response headers are in either 8313// *Operation.ServerResponse.Header or (if a response was returned at 8314// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 8315// to check whether the returned error was because 8316// http.StatusNotModified was returned. 8317func (c *SslCertsDeleteCall) Do(opts ...googleapi.CallOption) (*Operation, error) { 8318 gensupport.SetOptions(c.urlParams_, opts...) 8319 res, err := c.doRequest("json") 8320 if res != nil && res.StatusCode == http.StatusNotModified { 8321 if res.Body != nil { 8322 res.Body.Close() 8323 } 8324 return nil, &googleapi.Error{ 8325 Code: res.StatusCode, 8326 Header: res.Header, 8327 } 8328 } 8329 if err != nil { 8330 return nil, err 8331 } 8332 defer googleapi.CloseBody(res) 8333 if err := googleapi.CheckResponse(res); err != nil { 8334 return nil, err 8335 } 8336 ret := &Operation{ 8337 ServerResponse: googleapi.ServerResponse{ 8338 Header: res.Header, 8339 HTTPStatusCode: res.StatusCode, 8340 }, 8341 } 8342 target := &ret 8343 if err := gensupport.DecodeResponse(target, res); err != nil { 8344 return nil, err 8345 } 8346 return ret, nil 8347 // { 8348 // "description": "Deletes the SSL certificate. For First Generation instances, the certificate remains valid until the instance is restarted.", 8349 // "httpMethod": "DELETE", 8350 // "id": "sql.sslCerts.delete", 8351 // "parameterOrder": [ 8352 // "project", 8353 // "instance", 8354 // "sha1Fingerprint" 8355 // ], 8356 // "parameters": { 8357 // "instance": { 8358 // "description": "Cloud SQL instance ID. This does not include the project ID.", 8359 // "location": "path", 8360 // "required": true, 8361 // "type": "string" 8362 // }, 8363 // "project": { 8364 // "description": "Project ID of the project that contains the instance.", 8365 // "location": "path", 8366 // "required": true, 8367 // "type": "string" 8368 // }, 8369 // "sha1Fingerprint": { 8370 // "description": "Sha1 FingerPrint.", 8371 // "location": "path", 8372 // "required": true, 8373 // "type": "string" 8374 // } 8375 // }, 8376 // "path": "projects/{project}/instances/{instance}/sslCerts/{sha1Fingerprint}", 8377 // "response": { 8378 // "$ref": "Operation" 8379 // }, 8380 // "scopes": [ 8381 // "https://www.googleapis.com/auth/cloud-platform", 8382 // "https://www.googleapis.com/auth/sqlservice.admin" 8383 // ] 8384 // } 8385 8386} 8387 8388// method id "sql.sslCerts.get": 8389 8390type SslCertsGetCall struct { 8391 s *Service 8392 project string 8393 instance string 8394 sha1Fingerprint string 8395 urlParams_ gensupport.URLParams 8396 ifNoneMatch_ string 8397 ctx_ context.Context 8398 header_ http.Header 8399} 8400 8401// Get: Retrieves a particular SSL certificate. Does not include the 8402// private key (required for usage). The private key must be saved from 8403// the response to initial creation. 8404func (r *SslCertsService) Get(project string, instance string, sha1Fingerprint string) *SslCertsGetCall { 8405 c := &SslCertsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 8406 c.project = project 8407 c.instance = instance 8408 c.sha1Fingerprint = sha1Fingerprint 8409 return c 8410} 8411 8412// Fields allows partial responses to be retrieved. See 8413// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 8414// for more information. 8415func (c *SslCertsGetCall) Fields(s ...googleapi.Field) *SslCertsGetCall { 8416 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 8417 return c 8418} 8419 8420// IfNoneMatch sets the optional parameter which makes the operation 8421// fail if the object's ETag matches the given value. This is useful for 8422// getting updates only after the object has changed since the last 8423// request. Use googleapi.IsNotModified to check whether the response 8424// error from Do is the result of In-None-Match. 8425func (c *SslCertsGetCall) IfNoneMatch(entityTag string) *SslCertsGetCall { 8426 c.ifNoneMatch_ = entityTag 8427 return c 8428} 8429 8430// Context sets the context to be used in this call's Do method. Any 8431// pending HTTP request will be aborted if the provided context is 8432// canceled. 8433func (c *SslCertsGetCall) Context(ctx context.Context) *SslCertsGetCall { 8434 c.ctx_ = ctx 8435 return c 8436} 8437 8438// Header returns an http.Header that can be modified by the caller to 8439// add HTTP headers to the request. 8440func (c *SslCertsGetCall) Header() http.Header { 8441 if c.header_ == nil { 8442 c.header_ = make(http.Header) 8443 } 8444 return c.header_ 8445} 8446 8447func (c *SslCertsGetCall) doRequest(alt string) (*http.Response, error) { 8448 reqHeaders := make(http.Header) 8449 for k, v := range c.header_ { 8450 reqHeaders[k] = v 8451 } 8452 reqHeaders.Set("User-Agent", c.s.userAgent()) 8453 if c.ifNoneMatch_ != "" { 8454 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 8455 } 8456 var body io.Reader = nil 8457 c.urlParams_.Set("alt", alt) 8458 c.urlParams_.Set("prettyPrint", "false") 8459 urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{project}/instances/{instance}/sslCerts/{sha1Fingerprint}") 8460 urls += "?" + c.urlParams_.Encode() 8461 req, err := http.NewRequest("GET", urls, body) 8462 if err != nil { 8463 return nil, err 8464 } 8465 req.Header = reqHeaders 8466 googleapi.Expand(req.URL, map[string]string{ 8467 "project": c.project, 8468 "instance": c.instance, 8469 "sha1Fingerprint": c.sha1Fingerprint, 8470 }) 8471 return gensupport.SendRequest(c.ctx_, c.s.client, req) 8472} 8473 8474// Do executes the "sql.sslCerts.get" call. 8475// Exactly one of *SslCert or error will be non-nil. Any non-2xx status 8476// code is an error. Response headers are in either 8477// *SslCert.ServerResponse.Header or (if a response was returned at all) 8478// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 8479// check whether the returned error was because http.StatusNotModified 8480// was returned. 8481func (c *SslCertsGetCall) Do(opts ...googleapi.CallOption) (*SslCert, error) { 8482 gensupport.SetOptions(c.urlParams_, opts...) 8483 res, err := c.doRequest("json") 8484 if res != nil && res.StatusCode == http.StatusNotModified { 8485 if res.Body != nil { 8486 res.Body.Close() 8487 } 8488 return nil, &googleapi.Error{ 8489 Code: res.StatusCode, 8490 Header: res.Header, 8491 } 8492 } 8493 if err != nil { 8494 return nil, err 8495 } 8496 defer googleapi.CloseBody(res) 8497 if err := googleapi.CheckResponse(res); err != nil { 8498 return nil, err 8499 } 8500 ret := &SslCert{ 8501 ServerResponse: googleapi.ServerResponse{ 8502 Header: res.Header, 8503 HTTPStatusCode: res.StatusCode, 8504 }, 8505 } 8506 target := &ret 8507 if err := gensupport.DecodeResponse(target, res); err != nil { 8508 return nil, err 8509 } 8510 return ret, nil 8511 // { 8512 // "description": "Retrieves a particular SSL certificate. Does not include the private key (required for usage). The private key must be saved from the response to initial creation.", 8513 // "httpMethod": "GET", 8514 // "id": "sql.sslCerts.get", 8515 // "parameterOrder": [ 8516 // "project", 8517 // "instance", 8518 // "sha1Fingerprint" 8519 // ], 8520 // "parameters": { 8521 // "instance": { 8522 // "description": "Cloud SQL instance ID. This does not include the project ID.", 8523 // "location": "path", 8524 // "required": true, 8525 // "type": "string" 8526 // }, 8527 // "project": { 8528 // "description": "Project ID of the project that contains the instance.", 8529 // "location": "path", 8530 // "required": true, 8531 // "type": "string" 8532 // }, 8533 // "sha1Fingerprint": { 8534 // "description": "Sha1 FingerPrint.", 8535 // "location": "path", 8536 // "required": true, 8537 // "type": "string" 8538 // } 8539 // }, 8540 // "path": "projects/{project}/instances/{instance}/sslCerts/{sha1Fingerprint}", 8541 // "response": { 8542 // "$ref": "SslCert" 8543 // }, 8544 // "scopes": [ 8545 // "https://www.googleapis.com/auth/cloud-platform", 8546 // "https://www.googleapis.com/auth/sqlservice.admin" 8547 // ] 8548 // } 8549 8550} 8551 8552// method id "sql.sslCerts.insert": 8553 8554type SslCertsInsertCall struct { 8555 s *Service 8556 project string 8557 instance string 8558 sslcertsinsertrequest *SslCertsInsertRequest 8559 urlParams_ gensupport.URLParams 8560 ctx_ context.Context 8561 header_ http.Header 8562} 8563 8564// Insert: Creates an SSL certificate and returns it along with the 8565// private key and server certificate authority. The new certificate 8566// will not be usable until the instance is restarted. 8567func (r *SslCertsService) Insert(project string, instance string, sslcertsinsertrequest *SslCertsInsertRequest) *SslCertsInsertCall { 8568 c := &SslCertsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)} 8569 c.project = project 8570 c.instance = instance 8571 c.sslcertsinsertrequest = sslcertsinsertrequest 8572 return c 8573} 8574 8575// Fields allows partial responses to be retrieved. See 8576// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 8577// for more information. 8578func (c *SslCertsInsertCall) Fields(s ...googleapi.Field) *SslCertsInsertCall { 8579 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 8580 return c 8581} 8582 8583// Context sets the context to be used in this call's Do method. Any 8584// pending HTTP request will be aborted if the provided context is 8585// canceled. 8586func (c *SslCertsInsertCall) Context(ctx context.Context) *SslCertsInsertCall { 8587 c.ctx_ = ctx 8588 return c 8589} 8590 8591// Header returns an http.Header that can be modified by the caller to 8592// add HTTP headers to the request. 8593func (c *SslCertsInsertCall) Header() http.Header { 8594 if c.header_ == nil { 8595 c.header_ = make(http.Header) 8596 } 8597 return c.header_ 8598} 8599 8600func (c *SslCertsInsertCall) doRequest(alt string) (*http.Response, error) { 8601 reqHeaders := make(http.Header) 8602 for k, v := range c.header_ { 8603 reqHeaders[k] = v 8604 } 8605 reqHeaders.Set("User-Agent", c.s.userAgent()) 8606 var body io.Reader = nil 8607 body, err := googleapi.WithoutDataWrapper.JSONReader(c.sslcertsinsertrequest) 8608 if err != nil { 8609 return nil, err 8610 } 8611 reqHeaders.Set("Content-Type", "application/json") 8612 c.urlParams_.Set("alt", alt) 8613 c.urlParams_.Set("prettyPrint", "false") 8614 urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{project}/instances/{instance}/sslCerts") 8615 urls += "?" + c.urlParams_.Encode() 8616 req, err := http.NewRequest("POST", urls, body) 8617 if err != nil { 8618 return nil, err 8619 } 8620 req.Header = reqHeaders 8621 googleapi.Expand(req.URL, map[string]string{ 8622 "project": c.project, 8623 "instance": c.instance, 8624 }) 8625 return gensupport.SendRequest(c.ctx_, c.s.client, req) 8626} 8627 8628// Do executes the "sql.sslCerts.insert" call. 8629// Exactly one of *SslCertsInsertResponse or error will be non-nil. Any 8630// non-2xx status code is an error. Response headers are in either 8631// *SslCertsInsertResponse.ServerResponse.Header or (if a response was 8632// returned at all) in error.(*googleapi.Error).Header. Use 8633// googleapi.IsNotModified to check whether the returned error was 8634// because http.StatusNotModified was returned. 8635func (c *SslCertsInsertCall) Do(opts ...googleapi.CallOption) (*SslCertsInsertResponse, error) { 8636 gensupport.SetOptions(c.urlParams_, opts...) 8637 res, err := c.doRequest("json") 8638 if res != nil && res.StatusCode == http.StatusNotModified { 8639 if res.Body != nil { 8640 res.Body.Close() 8641 } 8642 return nil, &googleapi.Error{ 8643 Code: res.StatusCode, 8644 Header: res.Header, 8645 } 8646 } 8647 if err != nil { 8648 return nil, err 8649 } 8650 defer googleapi.CloseBody(res) 8651 if err := googleapi.CheckResponse(res); err != nil { 8652 return nil, err 8653 } 8654 ret := &SslCertsInsertResponse{ 8655 ServerResponse: googleapi.ServerResponse{ 8656 Header: res.Header, 8657 HTTPStatusCode: res.StatusCode, 8658 }, 8659 } 8660 target := &ret 8661 if err := gensupport.DecodeResponse(target, res); err != nil { 8662 return nil, err 8663 } 8664 return ret, nil 8665 // { 8666 // "description": "Creates an SSL certificate and returns it along with the private key and server certificate authority. The new certificate will not be usable until the instance is restarted.", 8667 // "httpMethod": "POST", 8668 // "id": "sql.sslCerts.insert", 8669 // "parameterOrder": [ 8670 // "project", 8671 // "instance" 8672 // ], 8673 // "parameters": { 8674 // "instance": { 8675 // "description": "Cloud SQL instance ID. This does not include the project ID.", 8676 // "location": "path", 8677 // "required": true, 8678 // "type": "string" 8679 // }, 8680 // "project": { 8681 // "description": "Project ID of the project that contains the instance.", 8682 // "location": "path", 8683 // "required": true, 8684 // "type": "string" 8685 // } 8686 // }, 8687 // "path": "projects/{project}/instances/{instance}/sslCerts", 8688 // "request": { 8689 // "$ref": "SslCertsInsertRequest" 8690 // }, 8691 // "response": { 8692 // "$ref": "SslCertsInsertResponse" 8693 // }, 8694 // "scopes": [ 8695 // "https://www.googleapis.com/auth/cloud-platform", 8696 // "https://www.googleapis.com/auth/sqlservice.admin" 8697 // ] 8698 // } 8699 8700} 8701 8702// method id "sql.sslCerts.list": 8703 8704type SslCertsListCall struct { 8705 s *Service 8706 project string 8707 instance string 8708 urlParams_ gensupport.URLParams 8709 ifNoneMatch_ string 8710 ctx_ context.Context 8711 header_ http.Header 8712} 8713 8714// List: Lists all of the current SSL certificates for the instance. 8715func (r *SslCertsService) List(project string, instance string) *SslCertsListCall { 8716 c := &SslCertsListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 8717 c.project = project 8718 c.instance = instance 8719 return c 8720} 8721 8722// Fields allows partial responses to be retrieved. See 8723// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 8724// for more information. 8725func (c *SslCertsListCall) Fields(s ...googleapi.Field) *SslCertsListCall { 8726 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 8727 return c 8728} 8729 8730// IfNoneMatch sets the optional parameter which makes the operation 8731// fail if the object's ETag matches the given value. This is useful for 8732// getting updates only after the object has changed since the last 8733// request. Use googleapi.IsNotModified to check whether the response 8734// error from Do is the result of In-None-Match. 8735func (c *SslCertsListCall) IfNoneMatch(entityTag string) *SslCertsListCall { 8736 c.ifNoneMatch_ = entityTag 8737 return c 8738} 8739 8740// Context sets the context to be used in this call's Do method. Any 8741// pending HTTP request will be aborted if the provided context is 8742// canceled. 8743func (c *SslCertsListCall) Context(ctx context.Context) *SslCertsListCall { 8744 c.ctx_ = ctx 8745 return c 8746} 8747 8748// Header returns an http.Header that can be modified by the caller to 8749// add HTTP headers to the request. 8750func (c *SslCertsListCall) Header() http.Header { 8751 if c.header_ == nil { 8752 c.header_ = make(http.Header) 8753 } 8754 return c.header_ 8755} 8756 8757func (c *SslCertsListCall) doRequest(alt string) (*http.Response, error) { 8758 reqHeaders := make(http.Header) 8759 for k, v := range c.header_ { 8760 reqHeaders[k] = v 8761 } 8762 reqHeaders.Set("User-Agent", c.s.userAgent()) 8763 if c.ifNoneMatch_ != "" { 8764 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 8765 } 8766 var body io.Reader = nil 8767 c.urlParams_.Set("alt", alt) 8768 c.urlParams_.Set("prettyPrint", "false") 8769 urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{project}/instances/{instance}/sslCerts") 8770 urls += "?" + c.urlParams_.Encode() 8771 req, err := http.NewRequest("GET", urls, body) 8772 if err != nil { 8773 return nil, err 8774 } 8775 req.Header = reqHeaders 8776 googleapi.Expand(req.URL, map[string]string{ 8777 "project": c.project, 8778 "instance": c.instance, 8779 }) 8780 return gensupport.SendRequest(c.ctx_, c.s.client, req) 8781} 8782 8783// Do executes the "sql.sslCerts.list" call. 8784// Exactly one of *SslCertsListResponse or error will be non-nil. Any 8785// non-2xx status code is an error. Response headers are in either 8786// *SslCertsListResponse.ServerResponse.Header or (if a response was 8787// returned at all) in error.(*googleapi.Error).Header. Use 8788// googleapi.IsNotModified to check whether the returned error was 8789// because http.StatusNotModified was returned. 8790func (c *SslCertsListCall) Do(opts ...googleapi.CallOption) (*SslCertsListResponse, error) { 8791 gensupport.SetOptions(c.urlParams_, opts...) 8792 res, err := c.doRequest("json") 8793 if res != nil && res.StatusCode == http.StatusNotModified { 8794 if res.Body != nil { 8795 res.Body.Close() 8796 } 8797 return nil, &googleapi.Error{ 8798 Code: res.StatusCode, 8799 Header: res.Header, 8800 } 8801 } 8802 if err != nil { 8803 return nil, err 8804 } 8805 defer googleapi.CloseBody(res) 8806 if err := googleapi.CheckResponse(res); err != nil { 8807 return nil, err 8808 } 8809 ret := &SslCertsListResponse{ 8810 ServerResponse: googleapi.ServerResponse{ 8811 Header: res.Header, 8812 HTTPStatusCode: res.StatusCode, 8813 }, 8814 } 8815 target := &ret 8816 if err := gensupport.DecodeResponse(target, res); err != nil { 8817 return nil, err 8818 } 8819 return ret, nil 8820 // { 8821 // "description": "Lists all of the current SSL certificates for the instance.", 8822 // "httpMethod": "GET", 8823 // "id": "sql.sslCerts.list", 8824 // "parameterOrder": [ 8825 // "project", 8826 // "instance" 8827 // ], 8828 // "parameters": { 8829 // "instance": { 8830 // "description": "Cloud SQL instance ID. This does not include the project ID.", 8831 // "location": "path", 8832 // "required": true, 8833 // "type": "string" 8834 // }, 8835 // "project": { 8836 // "description": "Project ID of the project that contains the instance.", 8837 // "location": "path", 8838 // "required": true, 8839 // "type": "string" 8840 // } 8841 // }, 8842 // "path": "projects/{project}/instances/{instance}/sslCerts", 8843 // "response": { 8844 // "$ref": "SslCertsListResponse" 8845 // }, 8846 // "scopes": [ 8847 // "https://www.googleapis.com/auth/cloud-platform", 8848 // "https://www.googleapis.com/auth/sqlservice.admin" 8849 // ] 8850 // } 8851 8852} 8853 8854// method id "sql.tiers.list": 8855 8856type TiersListCall struct { 8857 s *Service 8858 project string 8859 urlParams_ gensupport.URLParams 8860 ifNoneMatch_ string 8861 ctx_ context.Context 8862 header_ http.Header 8863} 8864 8865// List: Lists all available machine types (tiers) for Cloud SQL, for 8866// example, db-n1-standard-1. For related information, see Pricing. 8867func (r *TiersService) List(project string) *TiersListCall { 8868 c := &TiersListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 8869 c.project = project 8870 return c 8871} 8872 8873// Fields allows partial responses to be retrieved. See 8874// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 8875// for more information. 8876func (c *TiersListCall) Fields(s ...googleapi.Field) *TiersListCall { 8877 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 8878 return c 8879} 8880 8881// IfNoneMatch sets the optional parameter which makes the operation 8882// fail if the object's ETag matches the given value. This is useful for 8883// getting updates only after the object has changed since the last 8884// request. Use googleapi.IsNotModified to check whether the response 8885// error from Do is the result of In-None-Match. 8886func (c *TiersListCall) IfNoneMatch(entityTag string) *TiersListCall { 8887 c.ifNoneMatch_ = entityTag 8888 return c 8889} 8890 8891// Context sets the context to be used in this call's Do method. Any 8892// pending HTTP request will be aborted if the provided context is 8893// canceled. 8894func (c *TiersListCall) Context(ctx context.Context) *TiersListCall { 8895 c.ctx_ = ctx 8896 return c 8897} 8898 8899// Header returns an http.Header that can be modified by the caller to 8900// add HTTP headers to the request. 8901func (c *TiersListCall) Header() http.Header { 8902 if c.header_ == nil { 8903 c.header_ = make(http.Header) 8904 } 8905 return c.header_ 8906} 8907 8908func (c *TiersListCall) doRequest(alt string) (*http.Response, error) { 8909 reqHeaders := make(http.Header) 8910 for k, v := range c.header_ { 8911 reqHeaders[k] = v 8912 } 8913 reqHeaders.Set("User-Agent", c.s.userAgent()) 8914 if c.ifNoneMatch_ != "" { 8915 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 8916 } 8917 var body io.Reader = nil 8918 c.urlParams_.Set("alt", alt) 8919 c.urlParams_.Set("prettyPrint", "false") 8920 urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{project}/tiers") 8921 urls += "?" + c.urlParams_.Encode() 8922 req, err := http.NewRequest("GET", urls, body) 8923 if err != nil { 8924 return nil, err 8925 } 8926 req.Header = reqHeaders 8927 googleapi.Expand(req.URL, map[string]string{ 8928 "project": c.project, 8929 }) 8930 return gensupport.SendRequest(c.ctx_, c.s.client, req) 8931} 8932 8933// Do executes the "sql.tiers.list" call. 8934// Exactly one of *TiersListResponse or error will be non-nil. Any 8935// non-2xx status code is an error. Response headers are in either 8936// *TiersListResponse.ServerResponse.Header or (if a response was 8937// returned at all) in error.(*googleapi.Error).Header. Use 8938// googleapi.IsNotModified to check whether the returned error was 8939// because http.StatusNotModified was returned. 8940func (c *TiersListCall) Do(opts ...googleapi.CallOption) (*TiersListResponse, error) { 8941 gensupport.SetOptions(c.urlParams_, opts...) 8942 res, err := c.doRequest("json") 8943 if res != nil && res.StatusCode == http.StatusNotModified { 8944 if res.Body != nil { 8945 res.Body.Close() 8946 } 8947 return nil, &googleapi.Error{ 8948 Code: res.StatusCode, 8949 Header: res.Header, 8950 } 8951 } 8952 if err != nil { 8953 return nil, err 8954 } 8955 defer googleapi.CloseBody(res) 8956 if err := googleapi.CheckResponse(res); err != nil { 8957 return nil, err 8958 } 8959 ret := &TiersListResponse{ 8960 ServerResponse: googleapi.ServerResponse{ 8961 Header: res.Header, 8962 HTTPStatusCode: res.StatusCode, 8963 }, 8964 } 8965 target := &ret 8966 if err := gensupport.DecodeResponse(target, res); err != nil { 8967 return nil, err 8968 } 8969 return ret, nil 8970 // { 8971 // "description": "Lists all available machine types (tiers) for Cloud SQL, for example, db-n1-standard-1. For related information, see Pricing.", 8972 // "httpMethod": "GET", 8973 // "id": "sql.tiers.list", 8974 // "parameterOrder": [ 8975 // "project" 8976 // ], 8977 // "parameters": { 8978 // "project": { 8979 // "description": "Project ID of the project for which to list tiers.", 8980 // "location": "path", 8981 // "required": true, 8982 // "type": "string" 8983 // } 8984 // }, 8985 // "path": "projects/{project}/tiers", 8986 // "response": { 8987 // "$ref": "TiersListResponse" 8988 // }, 8989 // "scopes": [ 8990 // "https://www.googleapis.com/auth/cloud-platform", 8991 // "https://www.googleapis.com/auth/sqlservice.admin" 8992 // ] 8993 // } 8994 8995} 8996 8997// method id "sql.users.delete": 8998 8999type UsersDeleteCall struct { 9000 s *Service 9001 project string 9002 instance string 9003 urlParams_ gensupport.URLParams 9004 ctx_ context.Context 9005 header_ http.Header 9006} 9007 9008// Delete: Deletes a user from a Cloud SQL instance. 9009func (r *UsersService) Delete(project string, instance string, host string, name string) *UsersDeleteCall { 9010 c := &UsersDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 9011 c.project = project 9012 c.instance = instance 9013 c.urlParams_.Set("host", host) 9014 c.urlParams_.Set("name", name) 9015 return c 9016} 9017 9018// Fields allows partial responses to be retrieved. See 9019// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 9020// for more information. 9021func (c *UsersDeleteCall) Fields(s ...googleapi.Field) *UsersDeleteCall { 9022 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 9023 return c 9024} 9025 9026// Context sets the context to be used in this call's Do method. Any 9027// pending HTTP request will be aborted if the provided context is 9028// canceled. 9029func (c *UsersDeleteCall) Context(ctx context.Context) *UsersDeleteCall { 9030 c.ctx_ = ctx 9031 return c 9032} 9033 9034// Header returns an http.Header that can be modified by the caller to 9035// add HTTP headers to the request. 9036func (c *UsersDeleteCall) Header() http.Header { 9037 if c.header_ == nil { 9038 c.header_ = make(http.Header) 9039 } 9040 return c.header_ 9041} 9042 9043func (c *UsersDeleteCall) doRequest(alt string) (*http.Response, error) { 9044 reqHeaders := make(http.Header) 9045 for k, v := range c.header_ { 9046 reqHeaders[k] = v 9047 } 9048 reqHeaders.Set("User-Agent", c.s.userAgent()) 9049 var body io.Reader = nil 9050 c.urlParams_.Set("alt", alt) 9051 c.urlParams_.Set("prettyPrint", "false") 9052 urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{project}/instances/{instance}/users") 9053 urls += "?" + c.urlParams_.Encode() 9054 req, err := http.NewRequest("DELETE", urls, body) 9055 if err != nil { 9056 return nil, err 9057 } 9058 req.Header = reqHeaders 9059 googleapi.Expand(req.URL, map[string]string{ 9060 "project": c.project, 9061 "instance": c.instance, 9062 }) 9063 return gensupport.SendRequest(c.ctx_, c.s.client, req) 9064} 9065 9066// Do executes the "sql.users.delete" call. 9067// Exactly one of *Operation or error will be non-nil. Any non-2xx 9068// status code is an error. Response headers are in either 9069// *Operation.ServerResponse.Header or (if a response was returned at 9070// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 9071// to check whether the returned error was because 9072// http.StatusNotModified was returned. 9073func (c *UsersDeleteCall) Do(opts ...googleapi.CallOption) (*Operation, error) { 9074 gensupport.SetOptions(c.urlParams_, opts...) 9075 res, err := c.doRequest("json") 9076 if res != nil && res.StatusCode == http.StatusNotModified { 9077 if res.Body != nil { 9078 res.Body.Close() 9079 } 9080 return nil, &googleapi.Error{ 9081 Code: res.StatusCode, 9082 Header: res.Header, 9083 } 9084 } 9085 if err != nil { 9086 return nil, err 9087 } 9088 defer googleapi.CloseBody(res) 9089 if err := googleapi.CheckResponse(res); err != nil { 9090 return nil, err 9091 } 9092 ret := &Operation{ 9093 ServerResponse: googleapi.ServerResponse{ 9094 Header: res.Header, 9095 HTTPStatusCode: res.StatusCode, 9096 }, 9097 } 9098 target := &ret 9099 if err := gensupport.DecodeResponse(target, res); err != nil { 9100 return nil, err 9101 } 9102 return ret, nil 9103 // { 9104 // "description": "Deletes a user from a Cloud SQL instance.", 9105 // "httpMethod": "DELETE", 9106 // "id": "sql.users.delete", 9107 // "parameterOrder": [ 9108 // "project", 9109 // "instance", 9110 // "host", 9111 // "name" 9112 // ], 9113 // "parameters": { 9114 // "host": { 9115 // "description": "Host of the user in the instance.", 9116 // "location": "query", 9117 // "required": true, 9118 // "type": "string" 9119 // }, 9120 // "instance": { 9121 // "description": "Database instance ID. This does not include the project ID.", 9122 // "location": "path", 9123 // "required": true, 9124 // "type": "string" 9125 // }, 9126 // "name": { 9127 // "description": "Name of the user in the instance.", 9128 // "location": "query", 9129 // "required": true, 9130 // "type": "string" 9131 // }, 9132 // "project": { 9133 // "description": "Project ID of the project that contains the instance.", 9134 // "location": "path", 9135 // "required": true, 9136 // "type": "string" 9137 // } 9138 // }, 9139 // "path": "projects/{project}/instances/{instance}/users", 9140 // "response": { 9141 // "$ref": "Operation" 9142 // }, 9143 // "scopes": [ 9144 // "https://www.googleapis.com/auth/cloud-platform", 9145 // "https://www.googleapis.com/auth/sqlservice.admin" 9146 // ] 9147 // } 9148 9149} 9150 9151// method id "sql.users.insert": 9152 9153type UsersInsertCall struct { 9154 s *Service 9155 project string 9156 instance string 9157 user *User 9158 urlParams_ gensupport.URLParams 9159 ctx_ context.Context 9160 header_ http.Header 9161} 9162 9163// Insert: Creates a new user in a Cloud SQL instance. 9164func (r *UsersService) Insert(project string, instance string, user *User) *UsersInsertCall { 9165 c := &UsersInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)} 9166 c.project = project 9167 c.instance = instance 9168 c.user = user 9169 return c 9170} 9171 9172// Fields allows partial responses to be retrieved. See 9173// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 9174// for more information. 9175func (c *UsersInsertCall) Fields(s ...googleapi.Field) *UsersInsertCall { 9176 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 9177 return c 9178} 9179 9180// Context sets the context to be used in this call's Do method. Any 9181// pending HTTP request will be aborted if the provided context is 9182// canceled. 9183func (c *UsersInsertCall) Context(ctx context.Context) *UsersInsertCall { 9184 c.ctx_ = ctx 9185 return c 9186} 9187 9188// Header returns an http.Header that can be modified by the caller to 9189// add HTTP headers to the request. 9190func (c *UsersInsertCall) Header() http.Header { 9191 if c.header_ == nil { 9192 c.header_ = make(http.Header) 9193 } 9194 return c.header_ 9195} 9196 9197func (c *UsersInsertCall) doRequest(alt string) (*http.Response, error) { 9198 reqHeaders := make(http.Header) 9199 for k, v := range c.header_ { 9200 reqHeaders[k] = v 9201 } 9202 reqHeaders.Set("User-Agent", c.s.userAgent()) 9203 var body io.Reader = nil 9204 body, err := googleapi.WithoutDataWrapper.JSONReader(c.user) 9205 if err != nil { 9206 return nil, err 9207 } 9208 reqHeaders.Set("Content-Type", "application/json") 9209 c.urlParams_.Set("alt", alt) 9210 c.urlParams_.Set("prettyPrint", "false") 9211 urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{project}/instances/{instance}/users") 9212 urls += "?" + c.urlParams_.Encode() 9213 req, err := http.NewRequest("POST", urls, body) 9214 if err != nil { 9215 return nil, err 9216 } 9217 req.Header = reqHeaders 9218 googleapi.Expand(req.URL, map[string]string{ 9219 "project": c.project, 9220 "instance": c.instance, 9221 }) 9222 return gensupport.SendRequest(c.ctx_, c.s.client, req) 9223} 9224 9225// Do executes the "sql.users.insert" call. 9226// Exactly one of *Operation or error will be non-nil. Any non-2xx 9227// status code is an error. Response headers are in either 9228// *Operation.ServerResponse.Header or (if a response was returned at 9229// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 9230// to check whether the returned error was because 9231// http.StatusNotModified was returned. 9232func (c *UsersInsertCall) Do(opts ...googleapi.CallOption) (*Operation, error) { 9233 gensupport.SetOptions(c.urlParams_, opts...) 9234 res, err := c.doRequest("json") 9235 if res != nil && res.StatusCode == http.StatusNotModified { 9236 if res.Body != nil { 9237 res.Body.Close() 9238 } 9239 return nil, &googleapi.Error{ 9240 Code: res.StatusCode, 9241 Header: res.Header, 9242 } 9243 } 9244 if err != nil { 9245 return nil, err 9246 } 9247 defer googleapi.CloseBody(res) 9248 if err := googleapi.CheckResponse(res); err != nil { 9249 return nil, err 9250 } 9251 ret := &Operation{ 9252 ServerResponse: googleapi.ServerResponse{ 9253 Header: res.Header, 9254 HTTPStatusCode: res.StatusCode, 9255 }, 9256 } 9257 target := &ret 9258 if err := gensupport.DecodeResponse(target, res); err != nil { 9259 return nil, err 9260 } 9261 return ret, nil 9262 // { 9263 // "description": "Creates a new user in a Cloud SQL instance.", 9264 // "httpMethod": "POST", 9265 // "id": "sql.users.insert", 9266 // "parameterOrder": [ 9267 // "project", 9268 // "instance" 9269 // ], 9270 // "parameters": { 9271 // "instance": { 9272 // "description": "Database instance ID. This does not include the project ID.", 9273 // "location": "path", 9274 // "required": true, 9275 // "type": "string" 9276 // }, 9277 // "project": { 9278 // "description": "Project ID of the project that contains the instance.", 9279 // "location": "path", 9280 // "required": true, 9281 // "type": "string" 9282 // } 9283 // }, 9284 // "path": "projects/{project}/instances/{instance}/users", 9285 // "request": { 9286 // "$ref": "User" 9287 // }, 9288 // "response": { 9289 // "$ref": "Operation" 9290 // }, 9291 // "scopes": [ 9292 // "https://www.googleapis.com/auth/cloud-platform", 9293 // "https://www.googleapis.com/auth/sqlservice.admin" 9294 // ] 9295 // } 9296 9297} 9298 9299// method id "sql.users.list": 9300 9301type UsersListCall struct { 9302 s *Service 9303 project string 9304 instance string 9305 urlParams_ gensupport.URLParams 9306 ifNoneMatch_ string 9307 ctx_ context.Context 9308 header_ http.Header 9309} 9310 9311// List: Lists users in the specified Cloud SQL instance. 9312func (r *UsersService) List(project string, instance string) *UsersListCall { 9313 c := &UsersListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 9314 c.project = project 9315 c.instance = instance 9316 return c 9317} 9318 9319// Fields allows partial responses to be retrieved. See 9320// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 9321// for more information. 9322func (c *UsersListCall) Fields(s ...googleapi.Field) *UsersListCall { 9323 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 9324 return c 9325} 9326 9327// IfNoneMatch sets the optional parameter which makes the operation 9328// fail if the object's ETag matches the given value. This is useful for 9329// getting updates only after the object has changed since the last 9330// request. Use googleapi.IsNotModified to check whether the response 9331// error from Do is the result of In-None-Match. 9332func (c *UsersListCall) IfNoneMatch(entityTag string) *UsersListCall { 9333 c.ifNoneMatch_ = entityTag 9334 return c 9335} 9336 9337// Context sets the context to be used in this call's Do method. Any 9338// pending HTTP request will be aborted if the provided context is 9339// canceled. 9340func (c *UsersListCall) Context(ctx context.Context) *UsersListCall { 9341 c.ctx_ = ctx 9342 return c 9343} 9344 9345// Header returns an http.Header that can be modified by the caller to 9346// add HTTP headers to the request. 9347func (c *UsersListCall) Header() http.Header { 9348 if c.header_ == nil { 9349 c.header_ = make(http.Header) 9350 } 9351 return c.header_ 9352} 9353 9354func (c *UsersListCall) doRequest(alt string) (*http.Response, error) { 9355 reqHeaders := make(http.Header) 9356 for k, v := range c.header_ { 9357 reqHeaders[k] = v 9358 } 9359 reqHeaders.Set("User-Agent", c.s.userAgent()) 9360 if c.ifNoneMatch_ != "" { 9361 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 9362 } 9363 var body io.Reader = nil 9364 c.urlParams_.Set("alt", alt) 9365 c.urlParams_.Set("prettyPrint", "false") 9366 urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{project}/instances/{instance}/users") 9367 urls += "?" + c.urlParams_.Encode() 9368 req, err := http.NewRequest("GET", urls, body) 9369 if err != nil { 9370 return nil, err 9371 } 9372 req.Header = reqHeaders 9373 googleapi.Expand(req.URL, map[string]string{ 9374 "project": c.project, 9375 "instance": c.instance, 9376 }) 9377 return gensupport.SendRequest(c.ctx_, c.s.client, req) 9378} 9379 9380// Do executes the "sql.users.list" call. 9381// Exactly one of *UsersListResponse or error will be non-nil. Any 9382// non-2xx status code is an error. Response headers are in either 9383// *UsersListResponse.ServerResponse.Header or (if a response was 9384// returned at all) in error.(*googleapi.Error).Header. Use 9385// googleapi.IsNotModified to check whether the returned error was 9386// because http.StatusNotModified was returned. 9387func (c *UsersListCall) Do(opts ...googleapi.CallOption) (*UsersListResponse, error) { 9388 gensupport.SetOptions(c.urlParams_, opts...) 9389 res, err := c.doRequest("json") 9390 if res != nil && res.StatusCode == http.StatusNotModified { 9391 if res.Body != nil { 9392 res.Body.Close() 9393 } 9394 return nil, &googleapi.Error{ 9395 Code: res.StatusCode, 9396 Header: res.Header, 9397 } 9398 } 9399 if err != nil { 9400 return nil, err 9401 } 9402 defer googleapi.CloseBody(res) 9403 if err := googleapi.CheckResponse(res); err != nil { 9404 return nil, err 9405 } 9406 ret := &UsersListResponse{ 9407 ServerResponse: googleapi.ServerResponse{ 9408 Header: res.Header, 9409 HTTPStatusCode: res.StatusCode, 9410 }, 9411 } 9412 target := &ret 9413 if err := gensupport.DecodeResponse(target, res); err != nil { 9414 return nil, err 9415 } 9416 return ret, nil 9417 // { 9418 // "description": "Lists users in the specified Cloud SQL instance.", 9419 // "httpMethod": "GET", 9420 // "id": "sql.users.list", 9421 // "parameterOrder": [ 9422 // "project", 9423 // "instance" 9424 // ], 9425 // "parameters": { 9426 // "instance": { 9427 // "description": "Database instance ID. This does not include the project ID.", 9428 // "location": "path", 9429 // "required": true, 9430 // "type": "string" 9431 // }, 9432 // "project": { 9433 // "description": "Project ID of the project that contains the instance.", 9434 // "location": "path", 9435 // "required": true, 9436 // "type": "string" 9437 // } 9438 // }, 9439 // "path": "projects/{project}/instances/{instance}/users", 9440 // "response": { 9441 // "$ref": "UsersListResponse" 9442 // }, 9443 // "scopes": [ 9444 // "https://www.googleapis.com/auth/cloud-platform", 9445 // "https://www.googleapis.com/auth/sqlservice.admin" 9446 // ] 9447 // } 9448 9449} 9450 9451// method id "sql.users.update": 9452 9453type UsersUpdateCall struct { 9454 s *Service 9455 project string 9456 instance string 9457 user *User 9458 urlParams_ gensupport.URLParams 9459 ctx_ context.Context 9460 header_ http.Header 9461} 9462 9463// Update: Updates an existing user in a Cloud SQL instance. 9464func (r *UsersService) Update(project string, instance string, name string, user *User) *UsersUpdateCall { 9465 c := &UsersUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 9466 c.project = project 9467 c.instance = instance 9468 c.urlParams_.Set("name", name) 9469 c.user = user 9470 return c 9471} 9472 9473// Host sets the optional parameter "host": Host of the user in the 9474// instance. 9475func (c *UsersUpdateCall) Host(host string) *UsersUpdateCall { 9476 c.urlParams_.Set("host", host) 9477 return c 9478} 9479 9480// Fields allows partial responses to be retrieved. See 9481// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 9482// for more information. 9483func (c *UsersUpdateCall) Fields(s ...googleapi.Field) *UsersUpdateCall { 9484 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 9485 return c 9486} 9487 9488// Context sets the context to be used in this call's Do method. Any 9489// pending HTTP request will be aborted if the provided context is 9490// canceled. 9491func (c *UsersUpdateCall) Context(ctx context.Context) *UsersUpdateCall { 9492 c.ctx_ = ctx 9493 return c 9494} 9495 9496// Header returns an http.Header that can be modified by the caller to 9497// add HTTP headers to the request. 9498func (c *UsersUpdateCall) Header() http.Header { 9499 if c.header_ == nil { 9500 c.header_ = make(http.Header) 9501 } 9502 return c.header_ 9503} 9504 9505func (c *UsersUpdateCall) doRequest(alt string) (*http.Response, error) { 9506 reqHeaders := make(http.Header) 9507 for k, v := range c.header_ { 9508 reqHeaders[k] = v 9509 } 9510 reqHeaders.Set("User-Agent", c.s.userAgent()) 9511 var body io.Reader = nil 9512 body, err := googleapi.WithoutDataWrapper.JSONReader(c.user) 9513 if err != nil { 9514 return nil, err 9515 } 9516 reqHeaders.Set("Content-Type", "application/json") 9517 c.urlParams_.Set("alt", alt) 9518 c.urlParams_.Set("prettyPrint", "false") 9519 urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{project}/instances/{instance}/users") 9520 urls += "?" + c.urlParams_.Encode() 9521 req, err := http.NewRequest("PUT", urls, body) 9522 if err != nil { 9523 return nil, err 9524 } 9525 req.Header = reqHeaders 9526 googleapi.Expand(req.URL, map[string]string{ 9527 "project": c.project, 9528 "instance": c.instance, 9529 }) 9530 return gensupport.SendRequest(c.ctx_, c.s.client, req) 9531} 9532 9533// Do executes the "sql.users.update" call. 9534// Exactly one of *Operation or error will be non-nil. Any non-2xx 9535// status code is an error. Response headers are in either 9536// *Operation.ServerResponse.Header or (if a response was returned at 9537// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 9538// to check whether the returned error was because 9539// http.StatusNotModified was returned. 9540func (c *UsersUpdateCall) Do(opts ...googleapi.CallOption) (*Operation, error) { 9541 gensupport.SetOptions(c.urlParams_, opts...) 9542 res, err := c.doRequest("json") 9543 if res != nil && res.StatusCode == http.StatusNotModified { 9544 if res.Body != nil { 9545 res.Body.Close() 9546 } 9547 return nil, &googleapi.Error{ 9548 Code: res.StatusCode, 9549 Header: res.Header, 9550 } 9551 } 9552 if err != nil { 9553 return nil, err 9554 } 9555 defer googleapi.CloseBody(res) 9556 if err := googleapi.CheckResponse(res); err != nil { 9557 return nil, err 9558 } 9559 ret := &Operation{ 9560 ServerResponse: googleapi.ServerResponse{ 9561 Header: res.Header, 9562 HTTPStatusCode: res.StatusCode, 9563 }, 9564 } 9565 target := &ret 9566 if err := gensupport.DecodeResponse(target, res); err != nil { 9567 return nil, err 9568 } 9569 return ret, nil 9570 // { 9571 // "description": "Updates an existing user in a Cloud SQL instance.", 9572 // "httpMethod": "PUT", 9573 // "id": "sql.users.update", 9574 // "parameterOrder": [ 9575 // "project", 9576 // "instance", 9577 // "name" 9578 // ], 9579 // "parameters": { 9580 // "host": { 9581 // "description": "Host of the user in the instance.", 9582 // "location": "query", 9583 // "type": "string" 9584 // }, 9585 // "instance": { 9586 // "description": "Database instance ID. This does not include the project ID.", 9587 // "location": "path", 9588 // "required": true, 9589 // "type": "string" 9590 // }, 9591 // "name": { 9592 // "description": "Name of the user in the instance.", 9593 // "location": "query", 9594 // "required": true, 9595 // "type": "string" 9596 // }, 9597 // "project": { 9598 // "description": "Project ID of the project that contains the instance.", 9599 // "location": "path", 9600 // "required": true, 9601 // "type": "string" 9602 // } 9603 // }, 9604 // "path": "projects/{project}/instances/{instance}/users", 9605 // "request": { 9606 // "$ref": "User" 9607 // }, 9608 // "response": { 9609 // "$ref": "Operation" 9610 // }, 9611 // "scopes": [ 9612 // "https://www.googleapis.com/auth/cloud-platform", 9613 // "https://www.googleapis.com/auth/sqlservice.admin" 9614 // ] 9615 // } 9616 9617} 9618