Class v1.SqlOperationsServiceClient (0.5.0) Stay organized with collections Save and categorize content based on your preferences.
Service to fetch operations for database instances. v1
Package
@google-cloud/sqlConstructors
(constructor)(opts, gaxInstance)
constructor(opts?:ClientOptions,gaxInstance?:typeofgax|typeofgax.fallback);Construct an instance of SqlOperationsServiceClient.
| Parameters | |
|---|---|
| Name | Description |
opts | ClientOptions |
gaxInstance | typeofgax | typeoffallback: loaded instance of |
Properties
apiEndpoint
staticgetapiEndpoint():string;The DNS address for this API service - same as servicePath(), exists for compatibility reasons.
auth
auth:gax.GoogleAuth;descriptors
descriptors:Descriptors;innerApiCalls
innerApiCalls:{[name:string]:Function;};locationsClient
locationsClient:LocationsClient;port
staticgetport():number;The port for this API service.
scopes
staticgetscopes():string[];The scopes needed to make gRPC calls for every method defined in this service.
servicePath
staticgetservicePath():string;The DNS address for this API service.
sqlOperationsServiceStub
sqlOperationsServiceStub?:Promise<{[name:string]:Function;}>;warn
warn:(code:string,message:string,warnType?:string)=>void;Methods
cancel(request, options)
cancel(request?:protos.google.cloud.sql.v1.ISqlOperationsCancelRequest,options?:CallOptions):Promise<[protos.google.protobuf.IEmpty,protos.google.cloud.sql.v1.ISqlOperationsCancelRequest|undefined,{}|undefined]>;Cancels an instance operation that has been performed on an instance.
| Parameters | |
|---|---|
| Name | Description |
request | ISqlOperationsCancelRequestThe request object that will be sent. |
options | CallOptionsCall options. SeeCallOptions for more details. |
| Returns | |
|---|---|
| Type | Description |
Promise<[protos.google.protobuf.IEmpty,protos.google.cloud.sql.v1.ISqlOperationsCancelRequest | undefined, {} | undefined ]> | {Promise} - The promise which resolves to an array. The first element of the array is an object representingEmpty. Please see thedocumentation 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. *//** * Instance operation ID. */// const operation = 'abc123'/** * Project ID of the project that contains the instance. */// const project = 'my-project'// Imports the Sql libraryconst{SqlOperationsServiceClient}=require('@google-cloud/sql').v1;// Instantiates a clientconstsqlClient=newSqlOperationsServiceClient();asyncfunctioncallCancel(){// Construct requestconstrequest={};// Run requestconstresponse=awaitsqlClient.cancel(request);console.log(response);}callCancel();cancel(request, options, callback)
cancel(request:protos.google.cloud.sql.v1.ISqlOperationsCancelRequest,options:CallOptions,callback:Callback<protos.google.protobuf.IEmpty,protos.google.cloud.sql.v1.ISqlOperationsCancelRequest|null|undefined,{}|null|undefined>):void;| Parameters | |
|---|---|
| Name | Description |
request | ISqlOperationsCancelRequest |
options | CallOptions |
callback | Callback<protos.google.protobuf.IEmpty,protos.google.cloud.sql.v1.ISqlOperationsCancelRequest | null | undefined, {} | null | undefined> |
| Returns | |
|---|---|
| Type | Description |
void | |
cancel(request, callback)
cancel(request:protos.google.cloud.sql.v1.ISqlOperationsCancelRequest,callback:Callback<protos.google.protobuf.IEmpty,protos.google.cloud.sql.v1.ISqlOperationsCancelRequest|null|undefined,{}|null|undefined>):void;| Parameters | |
|---|---|
| Name | Description |
request | ISqlOperationsCancelRequest |
callback | Callback<protos.google.protobuf.IEmpty,protos.google.cloud.sql.v1.ISqlOperationsCancelRequest | null | undefined, {} | null | undefined> |
| Returns | |
|---|---|
| Type | Description |
void | |
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. |
get(request, options)
get(request?:protos.google.cloud.sql.v1.ISqlOperationsGetRequest,options?:CallOptions):Promise<[protos.google.cloud.sql.v1.IOperation,protos.google.cloud.sql.v1.ISqlOperationsGetRequest|undefined,{}|undefined]>;Retrieves an instance operation that has been performed on an instance.
| Parameters | |
|---|---|
| Name | Description |
request | ISqlOperationsGetRequestThe request object that will be sent. |
options | CallOptionsCall options. SeeCallOptions for more details. |
| Returns | |
|---|---|
| Type | Description |
Promise<[protos.google.cloud.sql.v1.IOperation,protos.google.cloud.sql.v1.ISqlOperationsGetRequest | undefined, {} | undefined ]> | {Promise} - The promise which resolves to an array. The first element of the array is an object representing . Please see thedocumentation 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. *//** * Instance operation ID. */// const operation = 'abc123'/** * Project ID of the project that contains the instance. */// const project = 'my-project'// Imports the Sql libraryconst{SqlOperationsServiceClient}=require('@google-cloud/sql').v1;// Instantiates a clientconstsqlClient=newSqlOperationsServiceClient();asyncfunctioncallGet(){// Construct requestconstrequest={};// Run requestconstresponse=awaitsqlClient.get(request);console.log(response);}callGet();get(request, options, callback)
get(request:protos.google.cloud.sql.v1.ISqlOperationsGetRequest,options:CallOptions,callback:Callback<protos.google.cloud.sql.v1.IOperation,protos.google.cloud.sql.v1.ISqlOperationsGetRequest|null|undefined,{}|null|undefined>):void;| Parameters | |
|---|---|
| Name | Description |
request | ISqlOperationsGetRequest |
options | CallOptions |
callback | Callback<protos.google.cloud.sql.v1.IOperation,protos.google.cloud.sql.v1.ISqlOperationsGetRequest | null | undefined, {} | null | undefined> |
| Returns | |
|---|---|
| Type | Description |
void | |
get(request, callback)
get(request:protos.google.cloud.sql.v1.ISqlOperationsGetRequest,callback:Callback<protos.google.cloud.sql.v1.IOperation,protos.google.cloud.sql.v1.ISqlOperationsGetRequest|null|undefined,{}|null|undefined>):void;| Parameters | |
|---|---|
| Name | Description |
request | ISqlOperationsGetRequest |
callback | Callback<protos.google.cloud.sql.v1.IOperation,protos.google.cloud.sql.v1.ISqlOperationsGetRequest | 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.IGetLocationRequestThe request object that will be sent. |
options | CallOptions |Callback<google.cloud.location.ILocation,google.cloud.location.IGetLocationRequest | null | undefined, {} | null | undefined>Call options. SeeCallOptions 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 thedocumentation for more details and examples. |
const[response]=awaitclient.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. |
list(request, options)
list(request?:protos.google.cloud.sql.v1.ISqlOperationsListRequest,options?:CallOptions):Promise<[protos.google.cloud.sql.v1.IOperationsListResponse,protos.google.cloud.sql.v1.ISqlOperationsListRequest|undefined,{}|undefined]>;Lists all instance operations that have been performed on the given Cloud SQL instance in the reverse chronological order of the start time.
| Parameters | |
|---|---|
| Name | Description |
request | ISqlOperationsListRequestThe request object that will be sent. |
options | CallOptionsCall options. SeeCallOptions for more details. |
| Returns | |
|---|---|
| Type | Description |
Promise<[protos.google.cloud.sql.v1.IOperationsListResponse,protos.google.cloud.sql.v1.ISqlOperationsListRequest | undefined, {} | undefined ]> | {Promise} - The promise which resolves to an array. The first element of the array is an object representingOperationsListResponse. Please see thedocumentation 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. *//** * Cloud SQL instance ID. This does not include the project ID. */// const instance = 'abc123'/** * Maximum number of operations per response. */// const maxResults = 1234/** * A previously-returned page token representing part of the larger set of * results to view. */// const pageToken = 'abc123'/** * Project ID of the project that contains the instance. */// const project = 'my-project'// Imports the Sql libraryconst{SqlOperationsServiceClient}=require('@google-cloud/sql').v1;// Instantiates a clientconstsqlClient=newSqlOperationsServiceClient();asyncfunctioncallList(){// Construct requestconstrequest={};// Run requestconstresponse=awaitsqlClient.list(request);console.log(response);}callList();list(request, options, callback)
list(request:protos.google.cloud.sql.v1.ISqlOperationsListRequest,options:CallOptions,callback:Callback<protos.google.cloud.sql.v1.IOperationsListResponse,protos.google.cloud.sql.v1.ISqlOperationsListRequest|null|undefined,{}|null|undefined>):void;| Parameters | |
|---|---|
| Name | Description |
request | ISqlOperationsListRequest |
options | CallOptions |
callback | Callback<protos.google.cloud.sql.v1.IOperationsListResponse,protos.google.cloud.sql.v1.ISqlOperationsListRequest | null | undefined, {} | null | undefined> |
| Returns | |
|---|---|
| Type | Description |
void | |
list(request, callback)
list(request:protos.google.cloud.sql.v1.ISqlOperationsListRequest,callback:Callback<protos.google.cloud.sql.v1.IOperationsListResponse,protos.google.cloud.sql.v1.ISqlOperationsListRequest|null|undefined,{}|null|undefined>):void;| Parameters | |
|---|---|
| Name | Description |
request | ISqlOperationsListRequest |
callback | Callback<protos.google.cloud.sql.v1.IOperationsListResponse,protos.google.cloud.sql.v1.ISqlOperationsListRequest | null | undefined, {} | null | undefined> |
| Returns | |
|---|---|
| Type | Description |
void | |
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.IListLocationsRequestThe request object that will be sent. |
options | CallOptionsCall options. SeeCallOptions for more details. |
| Returns | |
|---|---|
| Type | Description |
AsyncIterable<google.cloud.location.ILocation> | {Object} An iterable Object that allowsasync 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 thedocumentation for more details and examples. |
constiterable=client.listLocationsAsync(request);forawait(constresponseofiterable){// process response}Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-12-03 UTC.