v1
Package
@google-cloud/sqlConstructors
(constructor)(opts, gaxInstance)
constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback);Construct an instance of SqlBackupsServiceClient.
| Parameters | |
|---|---|
| Name | Description |
opts |
ClientOptions
|
gaxInstance |
typeof gax | typeof fallback
: loaded instance of |
Properties
apiEndpoint
get apiEndpoint(): string;The DNS address for this API service.
apiEndpoint
static get apiEndpoint(): string;The DNS address for this API service - same as servicePath.
auth
auth: gax.GoogleAuth;descriptors
descriptors: Descriptors;innerApiCalls
innerApiCalls: {
[name: string]: Function;
};locationsClient
locationsClient: LocationsClient;pathTemplates
pathTemplates: {
[name: string]: gax.PathTemplate;
};port
static get port(): number;The port for this API service.
scopes
static get scopes(): string[];The scopes needed to make gRPC calls for every method defined in this service.
servicePath
static get servicePath(): string;The DNS address for this API service.
sqlBackupsServiceStub
sqlBackupsServiceStub?: Promise<{
[name: string]: Function;
}>;universeDomain
get universeDomain(): string;warn
warn: (code: string, message: string, warnType?: string) => void;Methods
backupPath(project, backup)
backupPath(project: string, backup: string): string;Return a fully-qualified backup resource name string.
| Parameters | |
|---|---|
| Name | Description |
project |
string
|
backup |
string
|
| Returns | |
|---|---|
| Type | Description |
string |
{string} Resource name string. |
close()
close(): Promise<void>;Terminate the gRPC channel and close the client.
The client will no longer be usable and all future behavior is undefined.
| Returns | |
|---|---|
| Type | Description |
Promise<void> |
{Promise} A promise that resolves when the client is closed. |
createBackup(request, options)
createBackup(request?: protos.google.cloud.sql.v1.ICreateBackupRequest, options?: CallOptions): Promise<[
protos.google.cloud.sql.v1.IOperation,
protos.google.cloud.sql.v1.ICreateBackupRequest | undefined,
{} | undefined
]>;Creates a backup for a Cloud SQL instance. This API can be used only to create on-demand backups.
| Parameters | |
|---|---|
| Name | Description |
request |
ICreateBackupRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
| Returns | |
|---|---|
| Type | Description |
Promise<[
protos.google.cloud.sql.v1.IOperation,
protos.google.cloud.sql.v1.ICreateBackupRequest | undefined,
{} | undefined
]> |
{Promise} - The promise which resolves to an array. The first element of the array is an object representing . Please see the documentation for more details and examples. |
/**
* This snippet has been automatically generated and should be regarded as a code template only.
* It will require modifications to work.
* It may require correct/in-range values for request initialization.
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. The parent resource where this backup is created.
* Format: projects/{project}
*/
// const parent = 'abc123'
/**
* Required. The Backup to create.
*/
// const backup = {}
// Imports the Sql library
const {SqlBackupsServiceClient} = require('@google-cloud/sql').v1;
// Instantiates a client
const sqlClient = new SqlBackupsServiceClient();
async function callCreateBackup() {
// Construct request
const request = {
parent,
backup,
};
// Run request
const response = await sqlClient.createBackup(request);
console.log(response);
}
callCreateBackup();
createBackup(request, options, callback)
createBackup(request: protos.google.cloud.sql.v1.ICreateBackupRequest, options: CallOptions, callback: Callback<protos.google.cloud.sql.v1.IOperation, protos.google.cloud.sql.v1.ICreateBackupRequest | null | undefined, {} | null | undefined>): void;| Parameters | |
|---|---|
| Name | Description |
request |
ICreateBackupRequest
|
options |
CallOptions
|
callback |
Callback<protos.google.cloud.sql.v1.IOperation, protos.google.cloud.sql.v1.ICreateBackupRequest | null | undefined, {} | null | undefined>
|
| Returns | |
|---|---|
| Type | Description |
void |
|
createBackup(request, callback)
createBackup(request: protos.google.cloud.sql.v1.ICreateBackupRequest, callback: Callback<protos.google.cloud.sql.v1.IOperation, protos.google.cloud.sql.v1.ICreateBackupRequest | null | undefined, {} | null | undefined>): void;| Parameters | |
|---|---|
| Name | Description |
request |
ICreateBackupRequest
|
callback |
Callback<protos.google.cloud.sql.v1.IOperation, protos.google.cloud.sql.v1.ICreateBackupRequest | null | undefined, {} | null | undefined>
|
| Returns | |
|---|---|
| Type | Description |
void |
|
deleteBackup(request, options)
deleteBackup(request?: protos.google.cloud.sql.v1.IDeleteBackupRequest, options?: CallOptions): Promise<[
protos.google.cloud.sql.v1.IOperation,
protos.google.cloud.sql.v1.IDeleteBackupRequest | undefined,
{} | undefined
]>;Deletes the backup.
| Parameters | |
|---|---|
| Name | Description |
request |
IDeleteBackupRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
| Returns | |
|---|---|
| Type | Description |
Promise<[
protos.google.cloud.sql.v1.IOperation,
protos.google.cloud.sql.v1.IDeleteBackupRequest | undefined,
{} | undefined
]> |
{Promise} - The promise which resolves to an array. The first element of the array is an object representing . Please see the documentation for more details and examples. |
/**
* This snippet has been automatically generated and should be regarded as a code template only.
* It will require modifications to work.
* It may require correct/in-range values for request initialization.
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. The name of the backup to delete.
* Format: projects/{project}/backups/{backup}
*/
// const name = 'abc123'
// Imports the Sql library
const {SqlBackupsServiceClient} = require('@google-cloud/sql').v1;
// Instantiates a client
const sqlClient = new SqlBackupsServiceClient();
async function callDeleteBackup() {
// Construct request
const request = {
name,
};
// Run request
const response = await sqlClient.deleteBackup(request);
console.log(response);
}
callDeleteBackup();
deleteBackup(request, options, callback)
deleteBackup(request: protos.google.cloud.sql.v1.IDeleteBackupRequest, options: CallOptions, callback: Callback<protos.google.cloud.sql.v1.IOperation, protos.google.cloud.sql.v1.IDeleteBackupRequest | null | undefined, {} | null | undefined>): void;| Parameters | |
|---|---|
| Name | Description |
request |
IDeleteBackupRequest
|
options |
CallOptions
|
callback |
Callback<protos.google.cloud.sql.v1.IOperation, protos.google.cloud.sql.v1.IDeleteBackupRequest | null | undefined, {} | null | undefined>
|
| Returns | |
|---|---|
| Type | Description |
void |
|
deleteBackup(request, callback)
deleteBackup(request: protos.google.cloud.sql.v1.IDeleteBackupRequest, callback: Callback<protos.google.cloud.sql.v1.IOperation, protos.google.cloud.sql.v1.IDeleteBackupRequest | null | undefined, {} | null | undefined>): void;| Parameters | |
|---|---|
| Name | Description |
request |
IDeleteBackupRequest
|
callback |
Callback<protos.google.cloud.sql.v1.IOperation, protos.google.cloud.sql.v1.IDeleteBackupRequest | null | undefined, {} | null | undefined>
|
| Returns | |
|---|---|
| Type | Description |
void |
|
getBackup(request, options)
getBackup(request?: protos.google.cloud.sql.v1.IGetBackupRequest, options?: CallOptions): Promise<[
protos.google.cloud.sql.v1.IBackup,
protos.google.cloud.sql.v1.IGetBackupRequest | undefined,
{} | undefined
]>;Retrieves a resource containing information about a backup.
| Parameters | |
|---|---|
| Name | Description |
request |
IGetBackupRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
| Returns | |
|---|---|
| Type | Description |
Promise<[
protos.google.cloud.sql.v1.IBackup,
protos.google.cloud.sql.v1.IGetBackupRequest | undefined,
{} | undefined
]> |
{Promise} - The promise which resolves to an array. The first element of the array is an object representing . Please see the documentation for more details and examples. |
/**
* This snippet has been automatically generated and should be regarded as a code template only.
* It will require modifications to work.
* It may require correct/in-range values for request initialization.
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. The name of the backup to retrieve.
* Format: projects/{project}/backups/{backup}
*/
// const name = 'abc123'
// Imports the Sql library
const {SqlBackupsServiceClient} = require('@google-cloud/sql').v1;
// Instantiates a client
const sqlClient = new SqlBackupsServiceClient();
async function callGetBackup() {
// Construct request
const request = {
name,
};
// Run request
const response = await sqlClient.getBackup(request);
console.log(response);
}
callGetBackup();
getBackup(request, options, callback)
getBackup(request: protos.google.cloud.sql.v1.IGetBackupRequest, options: CallOptions, callback: Callback<protos.google.cloud.sql.v1.IBackup, protos.google.cloud.sql.v1.IGetBackupRequest | null | undefined, {} | null | undefined>): void;| Parameters | |
|---|---|
| Name | Description |
request |
IGetBackupRequest
|
options |
CallOptions
|
callback |
Callback<protos.google.cloud.sql.v1.IBackup, protos.google.cloud.sql.v1.IGetBackupRequest | null | undefined, {} | null | undefined>
|
| Returns | |
|---|---|
| Type | Description |
void |
|
getBackup(request, callback)
getBackup(request: protos.google.cloud.sql.v1.IGetBackupRequest, callback: Callback<protos.google.cloud.sql.v1.IBackup, protos.google.cloud.sql.v1.IGetBackupRequest | null | undefined, {} | null | undefined>): void;| Parameters | |
|---|---|
| Name | Description |
request |
IGetBackupRequest
|
callback |
Callback<protos.google.cloud.sql.v1.IBackup, protos.google.cloud.sql.v1.IGetBackupRequest | null | undefined, {} | null | undefined>
|
| Returns | |
|---|---|
| Type | Description |
void |
|
getLocation(request, options, callback)
getLocation(request: LocationProtos.google.cloud.location.IGetLocationRequest, options?: gax.CallOptions | Callback<LocationProtos.google.cloud.location.ILocation, LocationProtos.google.cloud.location.IGetLocationRequest | null | undefined, {} | null | undefined>, callback?: Callback<LocationProtos.google.cloud.location.ILocation, LocationProtos.google.cloud.location.IGetLocationRequest | null | undefined, {} | null | undefined>): Promise<LocationProtos.google.cloud.location.ILocation>;Gets information about a location.
| Parameters | |
|---|---|
| Name | Description |
request |
LocationProtos.google.cloud.location.IGetLocationRequest
The request object that will be sent. |
options |
CallOptions | Callback<google.cloud.location.ILocation, google.cloud.location.IGetLocationRequest | null | undefined, {} | null | undefined>
Call options. See CallOptions for more details. |
callback |
Callback<google.cloud.location.ILocation, google.cloud.location.IGetLocationRequest | null | undefined, {} | null | undefined>
|
| Returns | |
|---|---|
| Type | Description |
Promise<google.cloud.location.ILocation> |
{Promise} - The promise which resolves to an array. The first element of the array is an object representing . Please see the documentation for more details and examples. |
const [response] = await client.getLocation(request);
getProjectId()
getProjectId(): Promise<string>;| Returns | |
|---|---|
| Type | Description |
Promise<string> |
|
getProjectId(callback)
getProjectId(callback: Callback<string, undefined, undefined>): void;| Parameter | |
|---|---|
| Name | Description |
callback |
Callback<string, undefined, undefined>
|
| Returns | |
|---|---|
| Type | Description |
void |
|
initialize()
initialize(): Promise<{
[name: string]: Function;
}>;Initialize the client. Performs asynchronous operations (such as authentication) and prepares the client. This function will be called automatically when any class method is called for the first time, but if you need to initialize it before calling an actual method, feel free to call initialize() directly.
You can await on this method if you want to make sure the client is initialized.
| Returns | |
|---|---|
| Type | Description |
Promise<{
[name: string]: Function;
}> |
{Promise} A promise that resolves to an authenticated service stub. |
listBackups(request, options)
listBackups(request?: protos.google.cloud.sql.v1.IListBackupsRequest, options?: CallOptions): Promise<[
protos.google.cloud.sql.v1.IBackup[],
protos.google.cloud.sql.v1.IListBackupsRequest | null,
protos.google.cloud.sql.v1.IListBackupsResponse
]>;Lists all backups associated with the project.
| Parameters | |
|---|---|
| Name | Description |
request |
IListBackupsRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
| Returns | |
|---|---|
| Type | Description |
Promise<[
protos.google.cloud.sql.v1.IBackup[],
protos.google.cloud.sql.v1.IListBackupsRequest | null,
protos.google.cloud.sql.v1.IListBackupsResponse
]> |
{Promise} - The promise which resolves to an array. The first element of the array is Array of . The client library will perform auto-pagination by default: it will call the API as many times as needed and will merge results from all the pages into this array. Note that it can affect your quota. We recommend using |
listBackups(request, options, callback)
listBackups(request: protos.google.cloud.sql.v1.IListBackupsRequest, options: CallOptions, callback: PaginationCallback<protos.google.cloud.sql.v1.IListBackupsRequest, protos.google.cloud.sql.v1.IListBackupsResponse | null | undefined, protos.google.cloud.sql.v1.IBackup>): void;| Parameters | |
|---|---|
| Name | Description |
request |
IListBackupsRequest
|
options |
CallOptions
|
callback |
PaginationCallback<protos.google.cloud.sql.v1.IListBackupsRequest, protos.google.cloud.sql.v1.IListBackupsResponse | null | undefined, protos.google.cloud.sql.v1.IBackup>
|
| Returns | |
|---|---|
| Type | Description |
void |
|
listBackups(request, callback)
listBackups(request: protos.google.cloud.sql.v1.IListBackupsRequest, callback: PaginationCallback<protos.google.cloud.sql.v1.IListBackupsRequest, protos.google.cloud.sql.v1.IListBackupsResponse | null | undefined, protos.google.cloud.sql.v1.IBackup>): void;| Parameters | |
|---|---|
| Name | Description |
request |
IListBackupsRequest
|
callback |
PaginationCallback<protos.google.cloud.sql.v1.IListBackupsRequest, protos.google.cloud.sql.v1.IListBackupsResponse | null | undefined, protos.google.cloud.sql.v1.IBackup>
|
| Returns | |
|---|---|
| Type | Description |
void |
|
listBackupsAsync(request, options)
listBackupsAsync(request?: protos.google.cloud.sql.v1.IListBackupsRequest, options?: CallOptions): AsyncIterable<protos.google.cloud.sql.v1.IBackup>;Equivalent to listBackups, but returns an iterable object.
for-await-of syntax is used with the iterable to get response elements on-demand.
| Parameters | |
|---|---|
| Name | Description |
request |
IListBackupsRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
| Returns | |
|---|---|
| Type | Description |
AsyncIterable<protos.google.cloud.sql.v1.IBackup> |
{Object} An iterable Object that allows async iteration. When you iterate the returned iterable, each element will be an object representing . The API will be called under the hood as needed, once per the page, so you can stop the iteration when you don't need more results. Please see the documentation for more details and examples. |
/**
* This snippet has been automatically generated and should be regarded as a code template only.
* It will require modifications to work.
* It may require correct/in-range values for request initialization.
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. The parent that owns this collection of backups.
* Format: projects/{project}
*/
// const parent = 'abc123'
/**
* The maximum number of backups to return per response. The service might
* return fewer backups than this value. If a value for this parameter isn't
* specified, then, at most, 500 backups are returned. The maximum value is
* 2,000. Any values that you set, which are greater than 2,000, are changed
* to 2,000.
*/
// const pageSize = 1234
/**
* A page token, received from a previous `ListBackups` call.
* Provide this to retrieve the subsequent page.
* When paginating, all other parameters provided to `ListBackups` must match
* the call that provided the page token.
*/
// const pageToken = 'abc123'
/**
* Multiple filter queries are separated by spaces. For example,
* 'instance:abc AND type:FINAL, 'location:us',
* 'backupInterval.startTime>=1950-01-01T01:01:25.771Z'. You can filter by
* type, instance, backupInterval.startTime (creation time), or location.
*/
// const filter = 'abc123'
// Imports the Sql library
const {SqlBackupsServiceClient} = require('@google-cloud/sql').v1;
// Instantiates a client
const sqlClient = new SqlBackupsServiceClient();
async function callListBackups() {
// Construct request
const request = {
parent,
};
// Run request
const iterable = sqlClient.listBackupsAsync(request);
for await (const response of iterable) {
console.log(response);
}
}
callListBackups();
listBackupsStream(request, options)
listBackupsStream(request?: protos.google.cloud.sql.v1.IListBackupsRequest, options?: CallOptions): Transform;Equivalent to listBackups, but returns a NodeJS Stream object.
| Parameters | |
|---|---|
| Name | Description |
request |
IListBackupsRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
| Returns | |
|---|---|
| Type | Description |
Transform |
{Stream} An object stream which emits an object representing on 'data' event. The client library will perform auto-pagination by default: it will call the API as many times as needed. Note that it can affect your quota. We recommend using |
listLocationsAsync(request, options)
listLocationsAsync(request: LocationProtos.google.cloud.location.IListLocationsRequest, options?: CallOptions): AsyncIterable<LocationProtos.google.cloud.location.ILocation>;Lists information about the supported locations for this service. Returns an iterable object.
for-await-of syntax is used with the iterable to get response elements on-demand.
| Parameters | |
|---|---|
| Name | Description |
request |
LocationProtos.google.cloud.location.IListLocationsRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
| Returns | |
|---|---|
| Type | Description |
AsyncIterable<google.cloud.location.ILocation> |
{Object} An iterable Object that allows async iteration. When you iterate the returned iterable, each element will be an object representing . The API will be called under the hood as needed, once per the page, so you can stop the iteration when you don't need more results. Please see the documentation for more details and examples. |
const iterable = client.listLocationsAsync(request);
for await (const response of iterable) {
// process response
}
matchBackupFromBackupName(backupName)
matchBackupFromBackupName(backupName: string): string | number;Parse the backup from Backup resource.
| Parameter | |
|---|---|
| Name | Description |
backupName |
string
A fully-qualified path representing Backup resource. |
| Returns | |
|---|---|
| Type | Description |
string | number |
{string} A string representing the backup. |
matchProjectFromBackupName(backupName)
matchProjectFromBackupName(backupName: string): string | number;Parse the project from Backup resource.
| Parameter | |
|---|---|
| Name | Description |
backupName |
string
A fully-qualified path representing Backup resource. |
| Returns | |
|---|---|
| Type | Description |
string | number |
{string} A string representing the project. |
matchProjectFromProjectName(projectName)
matchProjectFromProjectName(projectName: string): string | number;Parse the project from Project resource.
| Parameter | |
|---|---|
| Name | Description |
projectName |
string
A fully-qualified path representing Project resource. |
| Returns | |
|---|---|
| Type | Description |
string | number |
{string} A string representing the project. |
projectPath(project)
projectPath(project: string): string;Return a fully-qualified project resource name string.
| Parameter | |
|---|---|
| Name | Description |
project |
string
|
| Returns | |
|---|---|
| Type | Description |
string |
{string} Resource name string. |
updateBackup(request, options)
updateBackup(request?: protos.google.cloud.sql.v1.IUpdateBackupRequest, options?: CallOptions): Promise<[
protos.google.cloud.sql.v1.IOperation,
protos.google.cloud.sql.v1.IUpdateBackupRequest | undefined,
{} | undefined
]>;Updates the retention period and description of the backup. You can use this API to update final backups only.
| Parameters | |
|---|---|
| Name | Description |
request |
IUpdateBackupRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
| Returns | |
|---|---|
| Type | Description |
Promise<[
protos.google.cloud.sql.v1.IOperation,
protos.google.cloud.sql.v1.IUpdateBackupRequest | undefined,
{} | undefined
]> |
{Promise} - The promise which resolves to an array. The first element of the array is an object representing . Please see the documentation for more details and examples. |
/**
* This snippet has been automatically generated and should be regarded as a code template only.
* It will require modifications to work.
* It may require correct/in-range values for request initialization.
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. The backup to update.
* The backup’s `name` field is used to identify the backup to update.
* Format: projects/{project}/backups/{backup}
*/
// const backup = {}
/**
* The list of fields that you can update. You can update only the description
* and retention period of the final backup.
*/
// const updateMask = {}
// Imports the Sql library
const {SqlBackupsServiceClient} = require('@google-cloud/sql').v1;
// Instantiates a client
const sqlClient = new SqlBackupsServiceClient();
async function callUpdateBackup() {
// Construct request
const request = {
backup,
};
// Run request
const response = await sqlClient.updateBackup(request);
console.log(response);
}
callUpdateBackup();
updateBackup(request, options, callback)
updateBackup(request: protos.google.cloud.sql.v1.IUpdateBackupRequest, options: CallOptions, callback: Callback<protos.google.cloud.sql.v1.IOperation, protos.google.cloud.sql.v1.IUpdateBackupRequest | null | undefined, {} | null | undefined>): void;| Parameters | |
|---|---|
| Name | Description |
request |
IUpdateBackupRequest
|
options |
CallOptions
|
callback |
Callback<protos.google.cloud.sql.v1.IOperation, protos.google.cloud.sql.v1.IUpdateBackupRequest | null | undefined, {} | null | undefined>
|
| Returns | |
|---|---|
| Type | Description |
void |
|
updateBackup(request, callback)
updateBackup(request: protos.google.cloud.sql.v1.IUpdateBackupRequest, callback: Callback<protos.google.cloud.sql.v1.IOperation, protos.google.cloud.sql.v1.IUpdateBackupRequest | null | undefined, {} | null | undefined>): void;| Parameters | |
|---|---|
| Name | Description |
request |
IUpdateBackupRequest
|
callback |
Callback<protos.google.cloud.sql.v1.IOperation, protos.google.cloud.sql.v1.IUpdateBackupRequest | null | undefined, {} | null | undefined>
|
| Returns | |
|---|---|
| Type | Description |
void |
|