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

9544 lines
322 KiB

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