mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-24 05:06:02 +08:00
* Add Google APIs typings * [gapi.cliebt.* ] Add version as part of typings name and fix gapi.client tslint errors * versions should not get their own folders fixing a few typos using /** syntax so comments show up in editors export only actual (last) version for now * export only actual (last) version for now * merge namespaces and remove unnecessary namespace qualifiers * remove namespace qualifier for gapi.client.Request from nested namespaces and change Request base interface to Promise * disable await-promise rule * fix collision between gapi.client.Request and Request from nested namespace disable no-irregular-whitespace rule * sort properties and namespace resources * remove empty comments sort resources amd methods in tests and readme.md * update 'this is autogenerated file' banner to remove this text from gapi.client namespace hint use multiline comments when comment has several lines * implement no-trailing-whitespace, no-padding, max-line-length, await-promise, no-irregular-whitespace rules * add strictFunctionTypes to tsconfig * fix "Whitespace within parentheses is not allowed" rule * fix ts-lint rules * fixes * remove deprecated replicapool and replicapoolupdater api * fix no-irregular-whitespace * fix no-irregular-whitespace
268 lines
11 KiB
TypeScript
268 lines
11 KiB
TypeScript
/* This is stub file for gapi.client.{{=it.name}} definition tests */
|
|
/* IMPORTANT.
|
|
* This file was automatically generated by https://github.com/Bolisov/google-api-typings-generator. Please do not edit it manually.
|
|
* In case of any problems please post issue to https://github.com/Bolisov/google-api-typings-generator
|
|
**/
|
|
gapi.load('client', () => {
|
|
/** now we can use gapi.client */
|
|
gapi.client.load('sqladmin', 'v1beta4', () => {
|
|
/** now we can use gapi.client.sqladmin */
|
|
|
|
/** don't forget to authenticate your client before sending any request to resources: */
|
|
/** declare client_id registered in Google Developers Console */
|
|
const client_id = '<<PUT YOUR CLIENT ID HERE>>';
|
|
const scope = [
|
|
/** View and manage your data across Google Cloud Platform services */
|
|
'https://www.googleapis.com/auth/cloud-platform',
|
|
/** Manage your Google SQL Service instances */
|
|
'https://www.googleapis.com/auth/sqlservice.admin',
|
|
];
|
|
const immediate = true;
|
|
gapi.auth.authorize({ client_id, scope, immediate }, authResult => {
|
|
if (authResult && !authResult.error) {
|
|
/** handle succesfull authorization */
|
|
run();
|
|
} else {
|
|
/** handle authorization error */
|
|
}
|
|
});
|
|
run();
|
|
});
|
|
|
|
async function run() {
|
|
/** Deletes the backup taken by a backup run. */
|
|
await gapi.client.backupRuns.delete({
|
|
id: "id",
|
|
instance: "instance",
|
|
project: "project",
|
|
});
|
|
/** Retrieves a resource containing information about a backup run. */
|
|
await gapi.client.backupRuns.get({
|
|
id: "id",
|
|
instance: "instance",
|
|
project: "project",
|
|
});
|
|
/** Creates a new backup run on demand. This method is applicable only to Second Generation instances. */
|
|
await gapi.client.backupRuns.insert({
|
|
instance: "instance",
|
|
project: "project",
|
|
});
|
|
/** Lists all backup runs associated with a given instance and configuration in the reverse chronological order of the enqueued time. */
|
|
await gapi.client.backupRuns.list({
|
|
instance: "instance",
|
|
maxResults: 2,
|
|
pageToken: "pageToken",
|
|
project: "project",
|
|
});
|
|
/** Deletes a database from a Cloud SQL instance. */
|
|
await gapi.client.databases.delete({
|
|
database: "database",
|
|
instance: "instance",
|
|
project: "project",
|
|
});
|
|
/** Retrieves a resource containing information about a database inside a Cloud SQL instance. */
|
|
await gapi.client.databases.get({
|
|
database: "database",
|
|
instance: "instance",
|
|
project: "project",
|
|
});
|
|
/** Inserts a resource containing information about a database inside a Cloud SQL instance. */
|
|
await gapi.client.databases.insert({
|
|
instance: "instance",
|
|
project: "project",
|
|
});
|
|
/** Lists databases in the specified Cloud SQL instance. */
|
|
await gapi.client.databases.list({
|
|
instance: "instance",
|
|
project: "project",
|
|
});
|
|
/** Updates a resource containing information about a database inside a Cloud SQL instance. This method supports patch semantics. */
|
|
await gapi.client.databases.patch({
|
|
database: "database",
|
|
instance: "instance",
|
|
project: "project",
|
|
});
|
|
/** Updates a resource containing information about a database inside a Cloud SQL instance. */
|
|
await gapi.client.databases.update({
|
|
database: "database",
|
|
instance: "instance",
|
|
project: "project",
|
|
});
|
|
/** List all available database flags for Google Cloud SQL instances. */
|
|
await gapi.client.flags.list({
|
|
databaseVersion: "databaseVersion",
|
|
});
|
|
/** Creates a Cloud SQL instance as a clone of the source instance. The API is not ready for Second Generation instances yet. */
|
|
await gapi.client.instances.clone({
|
|
instance: "instance",
|
|
project: "project",
|
|
});
|
|
/** Deletes a Cloud SQL instance. */
|
|
await gapi.client.instances.delete({
|
|
instance: "instance",
|
|
project: "project",
|
|
});
|
|
/** Exports data from a Cloud SQL instance to a Google Cloud Storage bucket as a MySQL dump file. */
|
|
await gapi.client.instances.export({
|
|
instance: "instance",
|
|
project: "project",
|
|
});
|
|
/** Failover the instance to its failover replica instance. */
|
|
await gapi.client.instances.failover({
|
|
instance: "instance",
|
|
project: "project",
|
|
});
|
|
/** Retrieves a resource containing information about a Cloud SQL instance. */
|
|
await gapi.client.instances.get({
|
|
instance: "instance",
|
|
project: "project",
|
|
});
|
|
/** Imports data into a Cloud SQL instance from a MySQL dump file in Google Cloud Storage. */
|
|
await gapi.client.instances.import({
|
|
instance: "instance",
|
|
project: "project",
|
|
});
|
|
/** Creates a new Cloud SQL instance. */
|
|
await gapi.client.instances.insert({
|
|
project: "project",
|
|
});
|
|
/** Lists instances under a given project in the alphabetical order of the instance name. */
|
|
await gapi.client.instances.list({
|
|
filter: "filter",
|
|
maxResults: 2,
|
|
pageToken: "pageToken",
|
|
project: "project",
|
|
});
|
|
/**
|
|
* 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.
|
|
*/
|
|
await gapi.client.instances.patch({
|
|
instance: "instance",
|
|
project: "project",
|
|
});
|
|
/** Promotes the read replica instance to be a stand-alone Cloud SQL instance. */
|
|
await gapi.client.instances.promoteReplica({
|
|
instance: "instance",
|
|
project: "project",
|
|
});
|
|
/**
|
|
* 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.
|
|
*/
|
|
await gapi.client.instances.resetSslConfig({
|
|
instance: "instance",
|
|
project: "project",
|
|
});
|
|
/** Restarts a Cloud SQL instance. */
|
|
await gapi.client.instances.restart({
|
|
instance: "instance",
|
|
project: "project",
|
|
});
|
|
/** Restores a backup of a Cloud SQL instance. */
|
|
await gapi.client.instances.restoreBackup({
|
|
instance: "instance",
|
|
project: "project",
|
|
});
|
|
/** Starts the replication in the read replica instance. */
|
|
await gapi.client.instances.startReplica({
|
|
instance: "instance",
|
|
project: "project",
|
|
});
|
|
/** Stops the replication in the read replica instance. */
|
|
await gapi.client.instances.stopReplica({
|
|
instance: "instance",
|
|
project: "project",
|
|
});
|
|
/** Truncate MySQL general and slow query log tables */
|
|
await gapi.client.instances.truncateLog({
|
|
instance: "instance",
|
|
project: "project",
|
|
});
|
|
/**
|
|
* 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.
|
|
*/
|
|
await gapi.client.instances.update({
|
|
instance: "instance",
|
|
project: "project",
|
|
});
|
|
/** Retrieves an instance operation that has been performed on an instance. */
|
|
await gapi.client.operations.get({
|
|
operation: "operation",
|
|
project: "project",
|
|
});
|
|
/** Lists all instance operations that have been performed on the given Cloud SQL instance in the reverse chronological order of the start time. */
|
|
await gapi.client.operations.list({
|
|
instance: "instance",
|
|
maxResults: 2,
|
|
pageToken: "pageToken",
|
|
project: "project",
|
|
});
|
|
/**
|
|
* 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.
|
|
*/
|
|
await gapi.client.sslCerts.createEphemeral({
|
|
instance: "instance",
|
|
project: "project",
|
|
});
|
|
/** Deletes the SSL certificate. The change will not take effect until the instance is restarted. */
|
|
await gapi.client.sslCerts.delete({
|
|
instance: "instance",
|
|
project: "project",
|
|
sha1Fingerprint: "sha1Fingerprint",
|
|
});
|
|
/**
|
|
* 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.
|
|
*/
|
|
await gapi.client.sslCerts.get({
|
|
instance: "instance",
|
|
project: "project",
|
|
sha1Fingerprint: "sha1Fingerprint",
|
|
});
|
|
/**
|
|
* 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.
|
|
*/
|
|
await gapi.client.sslCerts.insert({
|
|
instance: "instance",
|
|
project: "project",
|
|
});
|
|
/** Lists all of the current SSL certificates for the instance. */
|
|
await gapi.client.sslCerts.list({
|
|
instance: "instance",
|
|
project: "project",
|
|
});
|
|
/** Lists all available service tiers for Google Cloud SQL, for example D1, D2. For related information, see Pricing. */
|
|
await gapi.client.tiers.list({
|
|
project: "project",
|
|
});
|
|
/** Deletes a user from a Cloud SQL instance. */
|
|
await gapi.client.users.delete({
|
|
host: "host",
|
|
instance: "instance",
|
|
name: "name",
|
|
project: "project",
|
|
});
|
|
/** Creates a new user in a Cloud SQL instance. */
|
|
await gapi.client.users.insert({
|
|
instance: "instance",
|
|
project: "project",
|
|
});
|
|
/** Lists users in the specified Cloud SQL instance. */
|
|
await gapi.client.users.list({
|
|
instance: "instance",
|
|
project: "project",
|
|
});
|
|
/** Updates an existing user in a Cloud SQL instance. */
|
|
await gapi.client.users.update({
|
|
host: "host",
|
|
instance: "instance",
|
|
name: "name",
|
|
project: "project",
|
|
});
|
|
}
|
|
});
|