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.
 
 
 

9222 lines
312 KiB

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