Configures and manages Cloud Memorystore for Redis instances
Google Cloud Memorystore for Redis v1
The redis.googleapis.com
service implements the Google Cloud Memorystore for Redis API and defines the following resource model for managing Redis instances: * The service works with a collection of cloud projects, named: /projects/*
* Each project has a collection of available locations, named: /locations/*
* Each location has a collection of Redis instances, named: /instances/*
* As such, Redis instances are resources of the form: /projects/{project_id}/locations/{location_id}/instances/{instance_id}
Note that location_id must be referring to a GCP region
; for example: * projects/redpepper-1290/locations/us-central1/instances/my-redis
v1
Package
@google-cloud/redisConstructors
(constructor)(opts, gaxInstance)
constructor
(
opts
?:
ClientOptions
,
gaxInstance
?:
typeof
gax
|
typeof
gax
.
fallback
);
Construct an instance of CloudRedisClient.
opts
ClientOptions
gaxInstance
typeof gax
| typeof fallback
: loaded instance of google-gax
. Useful if you need to avoid loading the default gRPC version and want to use the fallback HTTP implementation. Load only fallback version and pass it to the constructor: ``` const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC const client = new CloudRedisClient({fallback: true}, gax); ```
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
;
cloudRedisStub
cloudRedisStub
?:
Promise
< {
[
name
:
string
]
:
Function
;
}>;
descriptors
descriptors
:
Descriptors
;
innerApiCalls
innerApiCalls
:
{
[
name
:
string
]
:
Function
;
};
locationsClient
locationsClient
:
LocationsClient
;
operationsClient
operationsClient
:
gax
.
OperationsClient
;
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.
universeDomain
get
universeDomain
()
:
string
;
warn
warn
:
(
code
:
string
,
message
:
string
,
warnType
?:
string
)
=
>
void
;
Methods
cancelOperation(request, optionsOrCallback, callback)
cancelOperation
(
request
:
protos
.
google
.
longrunning
.
CancelOperationRequest
,
optionsOrCallback
?:
gax
.
CallOptions
|
Callback<protos
.
google
.
longrunning
.
CancelOperationRequest
,
protos
.
google
.
protobuf
.
Empty
,
{}
|
undefined
|
null
> ,
callback
?:
Callback<protos
.
google
.
longrunning
.
CancelOperationRequest
,
protos
.
google
.
protobuf
.
Empty
,
{}
|
undefined
|
null
> )
:
Promise<protos
.
google
.
protobuf
.
Empty
> ;
Starts asynchronous cancellation on a long-running operation. The server makes a best effort to cancel the operation, but success is not guaranteed. If the server doesn't support this method, it returns google.rpc.Code.UNIMPLEMENTED
. Clients can use or other methods to check whether the cancellation succeeded or whether the operation completed despite cancellation. On successful cancellation, the operation is not deleted; instead, it becomes an operation with an value with a of 1, corresponding to Code.CANCELLED
.
request
optionsOrCallback
CallOptions
| Callback
< protos.google.longrunning.CancelOperationRequest
, protos.google.protobuf.Empty
, {} | undefined | null>
callback
Callback
< protos.google.longrunning.CancelOperationRequest
, protos.google.protobuf.Empty
, {} | undefined | null>
The function which will be called with the result of the API call. {Promise} - The promise which resolves when API call finishes. The promise has a method named "cancel" which cancels the ongoing API call.
const
client
=
longrunning
.
operationsClient
();
await
client
.
cancelOperation
({
name
:
''
});
checkCreateInstanceProgress(name)
checkCreateInstanceProgress
(
name
:
string
)
:
Promise<LROperation<protos
.
google
.
cloud
.
redis
.
v1
.
Instance
,
protos
.
google
.
cloud
.
redis
.
v1
.
OperationMetadata
>> ;
Check the status of the long running operation returned by createInstance()
.
name
string
The operation name that will be passed.
Promise
< LROperation
< protos.google.cloud.redis.v1.Instance
, protos.google.cloud.redis.v1.OperationMetadata
>>
{Promise} - The promise which resolves to an object. The decoded operation object has result and metadata field to get information from. 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 resource name of the instance location using the form:
* `projects/{project_id}/locations/{location_id}`
* where `location_id` refers to a GCP region.
*/
// const parent = 'abc123'
/**
* Required. The logical name of the Redis instance in the customer project
* with the following restrictions:
* * Must contain only lowercase letters, numbers, and hyphens.
* * Must start with a letter.
* * Must be between 1-40 characters.
* * Must end with a number or a letter.
* * Must be unique within the customer project / location
*/
// const instanceId = 'abc123'
/**
* Required. A Redis Instance resource
*/
// const instance = {}
// Imports the Redis library
const
{
CloudRedisClient
}
=
require
(
' @google-cloud/redis
'
).
v1
;
// Instantiates a client
const
redisClient
=
new
CloudRedisClient
();
async
function
callCreateInstance
()
{
// Construct request
const
request
=
{
parent
,
instanceId
,
instance
,
};
// Run request
const
[
operation
]
=
await
redisClient
.
createInstance
(
request
);
const
[
response
]
=
await
operation
.
promise
();
console
.
log
(
response
);
}
callCreateInstance
();
checkDeleteInstanceProgress(name)
checkDeleteInstanceProgress
(
name
:
string
)
:
Promise<LROperation<protos
.
google
.
protobuf
.
Empty
,
protos
.
google
.
cloud
.
redis
.
v1
.
OperationMetadata
>> ;
Check the status of the long running operation returned by deleteInstance()
.
name
string
The operation name that will be passed.
Promise
< LROperation
< protos.google.protobuf.Empty
, protos.google.cloud.redis.v1.OperationMetadata
>>
{Promise} - The promise which resolves to an object. The decoded operation object has result and metadata field to get information from. 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. Redis instance resource name using the form:
* `projects/{project_id}/locations/{location_id}/instances/{instance_id}`
* where `location_id` refers to a GCP region.
*/
// const name = 'abc123'
// Imports the Redis library
const
{
CloudRedisClient
}
=
require
(
' @google-cloud/redis
'
).
v1
;
// Instantiates a client
const
redisClient
=
new
CloudRedisClient
();
async
function
callDeleteInstance
()
{
// Construct request
const
request
=
{
name
,
};
// Run request
const
[
operation
]
=
await
redisClient
.
deleteInstance
(
request
);
const
[
response
]
=
await
operation
.
promise
();
console
.
log
(
response
);
}
callDeleteInstance
();
checkExportInstanceProgress(name)
checkExportInstanceProgress
(
name
:
string
)
:
Promise<LROperation<protos
.
google
.
cloud
.
redis
.
v1
.
Instance
,
protos
.
google
.
cloud
.
redis
.
v1
.
OperationMetadata
>> ;
Check the status of the long running operation returned by exportInstance()
.
name
string
The operation name that will be passed.
Promise
< LROperation
< protos.google.cloud.redis.v1.Instance
, protos.google.cloud.redis.v1.OperationMetadata
>>
{Promise} - The promise which resolves to an object. The decoded operation object has result and metadata field to get information from. 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. Redis instance resource name using the form:
* `projects/{project_id}/locations/{location_id}/instances/{instance_id}`
* where `location_id` refers to a GCP region.
*/
// const name = 'abc123'
/**
* Required. Specify data to be exported.
*/
// const outputConfig = {}
// Imports the Redis library
const
{
CloudRedisClient
}
=
require
(
' @google-cloud/redis
'
).
v1
;
// Instantiates a client
const
redisClient
=
new
CloudRedisClient
();
async
function
callExportInstance
()
{
// Construct request
const
request
=
{
name
,
outputConfig
,
};
// Run request
const
[
operation
]
=
await
redisClient
.
exportInstance
(
request
);
const
[
response
]
=
await
operation
.
promise
();
console
.
log
(
response
);
}
callExportInstance
();
checkFailoverInstanceProgress(name)
checkFailoverInstanceProgress
(
name
:
string
)
:
Promise<LROperation<protos
.
google
.
cloud
.
redis
.
v1
.
Instance
,
protos
.
google
.
cloud
.
redis
.
v1
.
OperationMetadata
>> ;
Check the status of the long running operation returned by failoverInstance()
.
name
string
The operation name that will be passed.
Promise
< LROperation
< protos.google.cloud.redis.v1.Instance
, protos.google.cloud.redis.v1.OperationMetadata
>>
{Promise} - The promise which resolves to an object. The decoded operation object has result and metadata field to get information from. 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. Redis instance resource name using the form:
* `projects/{project_id}/locations/{location_id}/instances/{instance_id}`
* where `location_id` refers to a GCP region.
*/
// const name = 'abc123'
/**
* Optional. Available data protection modes that the user can choose. If it's
* unspecified, data protection mode will be LIMITED_DATA_LOSS by default.
*/
// const dataProtectionMode = {}
// Imports the Redis library
const
{
CloudRedisClient
}
=
require
(
' @google-cloud/redis
'
).
v1
;
// Instantiates a client
const
redisClient
=
new
CloudRedisClient
();
async
function
callFailoverInstance
()
{
// Construct request
const
request
=
{
name
,
};
// Run request
const
[
operation
]
=
await
redisClient
.
failoverInstance
(
request
);
const
[
response
]
=
await
operation
.
promise
();
console
.
log
(
response
);
}
callFailoverInstance
();
checkImportInstanceProgress(name)
checkImportInstanceProgress
(
name
:
string
)
:
Promise<LROperation<protos
.
google
.
cloud
.
redis
.
v1
.
Instance
,
protos
.
google
.
cloud
.
redis
.
v1
.
OperationMetadata
>> ;
Check the status of the long running operation returned by importInstance()
.
name
string
The operation name that will be passed.
Promise
< LROperation
< protos.google.cloud.redis.v1.Instance
, protos.google.cloud.redis.v1.OperationMetadata
>>
{Promise} - The promise which resolves to an object. The decoded operation object has result and metadata field to get information from. 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. Redis instance resource name using the form:
* `projects/{project_id}/locations/{location_id}/instances/{instance_id}`
* where `location_id` refers to a GCP region.
*/
// const name = 'abc123'
/**
* Required. Specify data to be imported.
*/
// const inputConfig = {}
// Imports the Redis library
const
{
CloudRedisClient
}
=
require
(
' @google-cloud/redis
'
).
v1
;
// Instantiates a client
const
redisClient
=
new
CloudRedisClient
();
async
function
callImportInstance
()
{
// Construct request
const
request
=
{
name
,
inputConfig
,
};
// Run request
const
[
operation
]
=
await
redisClient
.
importInstance
(
request
);
const
[
response
]
=
await
operation
.
promise
();
console
.
log
(
response
);
}
callImportInstance
();
checkRescheduleMaintenanceProgress(name)
checkRescheduleMaintenanceProgress
(
name
:
string
)
:
Promise<LROperation<protos
.
google
.
cloud
.
redis
.
v1
.
Instance
,
protos
.
google
.
cloud
.
redis
.
v1
.
OperationMetadata
>> ;
Check the status of the long running operation returned by rescheduleMaintenance()
.
name
string
The operation name that will be passed.
Promise
< LROperation
< protos.google.cloud.redis.v1.Instance
, protos.google.cloud.redis.v1.OperationMetadata
>>
{Promise} - The promise which resolves to an object. The decoded operation object has result and metadata field to get information from. 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. Redis instance resource name using the form:
* `projects/{project_id}/locations/{location_id}/instances/{instance_id}`
* where `location_id` refers to a GCP region.
*/
// const name = 'abc123'
/**
* Required. If reschedule type is SPECIFIC_TIME, must set up schedule_time as
* well.
*/
// const rescheduleType = {}
/**
* Optional. Timestamp when the maintenance shall be rescheduled to if
* reschedule_type=SPECIFIC_TIME, in RFC 3339 format, for
* example `2012-11-15T16:19:00.094Z`.
*/
// const scheduleTime = {}
// Imports the Redis library
const
{
CloudRedisClient
}
=
require
(
' @google-cloud/redis
'
).
v1
;
// Instantiates a client
const
redisClient
=
new
CloudRedisClient
();
async
function
callRescheduleMaintenance
()
{
// Construct request
const
request
=
{
name
,
rescheduleType
,
};
// Run request
const
[
operation
]
=
await
redisClient
.
rescheduleMaintenance
(
request
);
const
[
response
]
=
await
operation
.
promise
();
console
.
log
(
response
);
}
callRescheduleMaintenance
();
checkUpdateInstanceProgress(name)
checkUpdateInstanceProgress
(
name
:
string
)
:
Promise<LROperation<protos
.
google
.
cloud
.
redis
.
v1
.
Instance
,
protos
.
google
.
cloud
.
redis
.
v1
.
OperationMetadata
>> ;
Check the status of the long running operation returned by updateInstance()
.
name
string
The operation name that will be passed.
Promise
< LROperation
< protos.google.cloud.redis.v1.Instance
, protos.google.cloud.redis.v1.OperationMetadata
>>
{Promise} - The promise which resolves to an object. The decoded operation object has result and metadata field to get information from. 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. Mask of fields to update. At least one path must be supplied in
* this field. The elements of the repeated paths field may only include these
* fields from Instance google.cloud.redis.v1.Instance:
* * `displayName`
* * `labels`
* * `memorySizeGb`
* * `redisConfig`
* * `replica_count`
*/
// const updateMask = {}
/**
* Required. Update description.
* Only fields specified in update_mask are updated.
*/
// const instance = {}
// Imports the Redis library
const
{
CloudRedisClient
}
=
require
(
' @google-cloud/redis
'
).
v1
;
// Instantiates a client
const
redisClient
=
new
CloudRedisClient
();
async
function
callUpdateInstance
()
{
// Construct request
const
request
=
{
updateMask
,
instance
,
};
// Run request
const
[
operation
]
=
await
redisClient
.
updateInstance
(
request
);
const
[
response
]
=
await
operation
.
promise
();
console
.
log
(
response
);
}
callUpdateInstance
();
checkUpgradeInstanceProgress(name)
checkUpgradeInstanceProgress
(
name
:
string
)
:
Promise<LROperation<protos
.
google
.
cloud
.
redis
.
v1
.
Instance
,
protos
.
google
.
cloud
.
redis
.
v1
.
OperationMetadata
>> ;
Check the status of the long running operation returned by upgradeInstance()
.
name
string
The operation name that will be passed.
Promise
< LROperation
< protos.google.cloud.redis.v1.Instance
, protos.google.cloud.redis.v1.OperationMetadata
>>
{Promise} - The promise which resolves to an object. The decoded operation object has result and metadata field to get information from. 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. Redis instance resource name using the form:
* `projects/{project_id}/locations/{location_id}/instances/{instance_id}`
* where `location_id` refers to a GCP region.
*/
// const name = 'abc123'
/**
* Required. Specifies the target version of Redis software to upgrade to.
*/
// const redisVersion = 'abc123'
// Imports the Redis library
const
{
CloudRedisClient
}
=
require
(
' @google-cloud/redis
'
).
v1
;
// Instantiates a client
const
redisClient
=
new
CloudRedisClient
();
async
function
callUpgradeInstance
()
{
// Construct request
const
request
=
{
name
,
redisVersion
,
};
// Run request
const
[
operation
]
=
await
redisClient
.
upgradeInstance
(
request
);
const
[
response
]
=
await
operation
.
promise
();
console
.
log
(
response
);
}
callUpgradeInstance
();
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.
Promise
<void>
{Promise} A promise that resolves when the client is closed.
createInstance(request, options)
createInstance
(
request
?:
protos
.
google
.
cloud
.
redis
.
v1
.
ICreateInstanceRequest
,
options
?:
CallOptions
)
:
Promise
< [
LROperation<protos
.
google
.
cloud
.
redis
.
v1
.
IInstance
,
protos
.
google
.
cloud
.
redis
.
v1
.
IOperationMetadata
> ,
protos
.
google
.
longrunning
.
IOperation
|
undefined
,
{}
|
undefined
]>;
Creates a Redis instance based on the specified tier and memory size.
By default, the instance is accessible from the project's [default network]( https://cloud.google.com/vpc/docs/vpc ).
The creation is executed asynchronously and callers may check the returned operation to track its progress. Once the operation is completed the Redis instance will be fully functional. Completed longrunning.Operation will contain the new instance object in the response field.
The returned operation is automatically deleted after a few hours, so there is no need to call DeleteOperation.
request
options
Promise
<[ LROperation
< protos.google.cloud.redis.v1.IInstance
, protos.google.cloud.redis.v1.IOperationMetadata
>, protos.google.longrunning.IOperation
| undefined,
{} | undefined
]>
{Promise} - The promise which resolves to an array. The first element of the array is an object representing a long running operation. Its promise()
method returns a promise you can await
for. 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 resource name of the instance location using the form:
* `projects/{project_id}/locations/{location_id}`
* where `location_id` refers to a GCP region.
*/
// const parent = 'abc123'
/**
* Required. The logical name of the Redis instance in the customer project
* with the following restrictions:
* * Must contain only lowercase letters, numbers, and hyphens.
* * Must start with a letter.
* * Must be between 1-40 characters.
* * Must end with a number or a letter.
* * Must be unique within the customer project / location
*/
// const instanceId = 'abc123'
/**
* Required. A Redis Instance resource
*/
// const instance = {}
// Imports the Redis library
const
{
CloudRedisClient
}
=
require
(
' @google-cloud/redis
'
).
v1
;
// Instantiates a client
const
redisClient
=
new
CloudRedisClient
();
async
function
callCreateInstance
()
{
// Construct request
const
request
=
{
parent
,
instanceId
,
instance
,
};
// Run request
const
[
operation
]
=
await
redisClient
.
createInstance
(
request
);
const
[
response
]
=
await
operation
.
promise
();
console
.
log
(
response
);
}
callCreateInstance
();
createInstance(request, options, callback)
createInstance
(
request
:
protos
.
google
.
cloud
.
redis
.
v1
.
ICreateInstanceRequest
,
options
:
CallOptions
,
callback
:
Callback<LROperation<protos
.
google
.
cloud
.
redis
.
v1
.
IInstance
,
protos
.
google
.
cloud
.
redis
.
v1
.
IOperationMetadata
> ,
protos
.
google
.
longrunning
.
IOperation
|
null
|
undefined
,
{}
|
null
|
undefined
> )
:
void
;
request
options
CallOptions
callback
Callback
< LROperation
< protos.google.cloud.redis.v1.IInstance
, protos.google.cloud.redis.v1.IOperationMetadata
>, protos.google.longrunning.IOperation
| null | undefined, {} | null | undefined>
void
createInstance(request, callback)
createInstance
(
request
:
protos
.
google
.
cloud
.
redis
.
v1
.
ICreateInstanceRequest
,
callback
:
Callback<LROperation<protos
.
google
.
cloud
.
redis
.
v1
.
IInstance
,
protos
.
google
.
cloud
.
redis
.
v1
.
IOperationMetadata
> ,
protos
.
google
.
longrunning
.
IOperation
|
null
|
undefined
,
{}
|
null
|
undefined
> )
:
void
;
request
callback
Callback
< LROperation
< protos.google.cloud.redis.v1.IInstance
, protos.google.cloud.redis.v1.IOperationMetadata
>, protos.google.longrunning.IOperation
| null | undefined, {} | null | undefined>
void
deleteInstance(request, options)
deleteInstance
(
request
?:
protos
.
google
.
cloud
.
redis
.
v1
.
IDeleteInstanceRequest
,
options
?:
CallOptions
)
:
Promise
< [
LROperation<protos
.
google
.
protobuf
.
IEmpty
,
protos
.
google
.
cloud
.
redis
.
v1
.
IOperationMetadata
> ,
protos
.
google
.
longrunning
.
IOperation
|
undefined
,
{}
|
undefined
]>;
Deletes a specific Redis instance. Instance stops serving and data is deleted.
request
options
Promise
<[ LROperation
< protos.google.protobuf.IEmpty
, protos.google.cloud.redis.v1.IOperationMetadata
>, protos.google.longrunning.IOperation
| undefined,
{} | undefined
]>
{Promise} - The promise which resolves to an array. The first element of the array is an object representing a long running operation. Its promise()
method returns a promise you can await
for. 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. Redis instance resource name using the form:
* `projects/{project_id}/locations/{location_id}/instances/{instance_id}`
* where `location_id` refers to a GCP region.
*/
// const name = 'abc123'
// Imports the Redis library
const
{
CloudRedisClient
}
=
require
(
' @google-cloud/redis
'
).
v1
;
// Instantiates a client
const
redisClient
=
new
CloudRedisClient
();
async
function
callDeleteInstance
()
{
// Construct request
const
request
=
{
name
,
};
// Run request
const
[
operation
]
=
await
redisClient
.
deleteInstance
(
request
);
const
[
response
]
=
await
operation
.
promise
();
console
.
log
(
response
);
}
callDeleteInstance
();
deleteInstance(request, options, callback)
deleteInstance
(
request
:
protos
.
google
.
cloud
.
redis
.
v1
.
IDeleteInstanceRequest
,
options
:
CallOptions
,
callback
:
Callback<LROperation<protos
.
google
.
protobuf
.
IEmpty
,
protos
.
google
.
cloud
.
redis
.
v1
.
IOperationMetadata
> ,
protos
.
google
.
longrunning
.
IOperation
|
null
|
undefined
,
{}
|
null
|
undefined
> )
:
void
;
request
options
CallOptions
callback
Callback
< LROperation
< protos.google.protobuf.IEmpty
, protos.google.cloud.redis.v1.IOperationMetadata
>, protos.google.longrunning.IOperation
| null | undefined, {} | null | undefined>
void
deleteInstance(request, callback)
deleteInstance
(
request
:
protos
.
google
.
cloud
.
redis
.
v1
.
IDeleteInstanceRequest
,
callback
:
Callback<LROperation<protos
.
google
.
protobuf
.
IEmpty
,
protos
.
google
.
cloud
.
redis
.
v1
.
IOperationMetadata
> ,
protos
.
google
.
longrunning
.
IOperation
|
null
|
undefined
,
{}
|
null
|
undefined
> )
:
void
;
request
callback
Callback
< LROperation
< protos.google.protobuf.IEmpty
, protos.google.cloud.redis.v1.IOperationMetadata
>, protos.google.longrunning.IOperation
| null | undefined, {} | null | undefined>
void
deleteOperation(request, optionsOrCallback, callback)
deleteOperation
(
request
:
protos
.
google
.
longrunning
.
DeleteOperationRequest
,
optionsOrCallback
?:
gax
.
CallOptions
|
Callback<protos
.
google
.
protobuf
.
Empty
,
protos
.
google
.
longrunning
.
DeleteOperationRequest
,
{}
|
null
|
undefined
> ,
callback
?:
Callback<protos
.
google
.
protobuf
.
Empty
,
protos
.
google
.
longrunning
.
DeleteOperationRequest
,
{}
|
null
|
undefined
> )
:
Promise<protos
.
google
.
protobuf
.
Empty
> ;
Deletes a long-running operation. This method indicates that the client is no longer interested in the operation result. It does not cancel the operation. If the server doesn't support this method, it returns google.rpc.Code.UNIMPLEMENTED
.
request
optionsOrCallback
CallOptions
| Callback
< protos.google.protobuf.Empty
, protos.google.longrunning.DeleteOperationRequest
, {} | null | undefined>
callback
Callback
< protos.google.protobuf.Empty
, protos.google.longrunning.DeleteOperationRequest
, {} | null | undefined>
The function which will be called with the result of the API call. {Promise} - The promise which resolves when API call finishes. The promise has a method named "cancel" which cancels the ongoing API call.
const
client
=
longrunning
.
operationsClient
();
await
client
.
deleteOperation
({
name
:
''
});
exportInstance(request, options)
exportInstance
(
request
?:
protos
.
google
.
cloud
.
redis
.
v1
.
IExportInstanceRequest
,
options
?:
CallOptions
)
:
Promise
< [
LROperation<protos
.
google
.
cloud
.
redis
.
v1
.
IInstance
,
protos
.
google
.
cloud
.
redis
.
v1
.
IOperationMetadata
> ,
protos
.
google
.
longrunning
.
IOperation
|
undefined
,
{}
|
undefined
]>;
Export Redis instance data into a Redis RDB format file in Cloud Storage.
Redis will continue serving during this operation.
The returned operation is automatically deleted after a few hours, so there is no need to call DeleteOperation.
request
options
Promise
<[ LROperation
< protos.google.cloud.redis.v1.IInstance
, protos.google.cloud.redis.v1.IOperationMetadata
>, protos.google.longrunning.IOperation
| undefined,
{} | undefined
]>
{Promise} - The promise which resolves to an array. The first element of the array is an object representing a long running operation. Its promise()
method returns a promise you can await
for. 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. Redis instance resource name using the form:
* `projects/{project_id}/locations/{location_id}/instances/{instance_id}`
* where `location_id` refers to a GCP region.
*/
// const name = 'abc123'
/**
* Required. Specify data to be exported.
*/
// const outputConfig = {}
// Imports the Redis library
const
{
CloudRedisClient
}
=
require
(
' @google-cloud/redis
'
).
v1
;
// Instantiates a client
const
redisClient
=
new
CloudRedisClient
();
async
function
callExportInstance
()
{
// Construct request
const
request
=
{
name
,
outputConfig
,
};
// Run request
const
[
operation
]
=
await
redisClient
.
exportInstance
(
request
);
const
[
response
]
=
await
operation
.
promise
();
console
.
log
(
response
);
}
callExportInstance
();
exportInstance(request, options, callback)
exportInstance
(
request
:
protos
.
google
.
cloud
.
redis
.
v1
.
IExportInstanceRequest
,
options
:
CallOptions
,
callback
:
Callback<LROperation<protos
.
google
.
cloud
.
redis
.
v1
.
IInstance
,
protos
.
google
.
cloud
.
redis
.
v1
.
IOperationMetadata
> ,
protos
.
google
.
longrunning
.
IOperation
|
null
|
undefined
,
{}
|
null
|
undefined
> )
:
void
;
request
options
CallOptions
callback
Callback
< LROperation
< protos.google.cloud.redis.v1.IInstance
, protos.google.cloud.redis.v1.IOperationMetadata
>, protos.google.longrunning.IOperation
| null | undefined, {} | null | undefined>
void
exportInstance(request, callback)
exportInstance
(
request
:
protos
.
google
.
cloud
.
redis
.
v1
.
IExportInstanceRequest
,
callback
:
Callback<LROperation<protos
.
google
.
cloud
.
redis
.
v1
.
IInstance
,
protos
.
google
.
cloud
.
redis
.
v1
.
IOperationMetadata
> ,
protos
.
google
.
longrunning
.
IOperation
|
null
|
undefined
,
{}
|
null
|
undefined
> )
:
void
;
request
callback
Callback
< LROperation
< protos.google.cloud.redis.v1.IInstance
, protos.google.cloud.redis.v1.IOperationMetadata
>, protos.google.longrunning.IOperation
| null | undefined, {} | null | undefined>
void
failoverInstance(request, options)
failoverInstance
(
request
?:
protos
.
google
.
cloud
.
redis
.
v1
.
IFailoverInstanceRequest
,
options
?:
CallOptions
)
:
Promise
< [
LROperation<protos
.
google
.
cloud
.
redis
.
v1
.
IInstance
,
protos
.
google
.
cloud
.
redis
.
v1
.
IOperationMetadata
> ,
protos
.
google
.
longrunning
.
IOperation
|
undefined
,
{}
|
undefined
]>;
Initiates a failover of the primary node to current replica node for a specific STANDARD tier Cloud Memorystore for Redis instance.
request
options
Promise
<[ LROperation
< protos.google.cloud.redis.v1.IInstance
, protos.google.cloud.redis.v1.IOperationMetadata
>, protos.google.longrunning.IOperation
| undefined,
{} | undefined
]>
{Promise} - The promise which resolves to an array. The first element of the array is an object representing a long running operation. Its promise()
method returns a promise you can await
for. 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. Redis instance resource name using the form:
* `projects/{project_id}/locations/{location_id}/instances/{instance_id}`
* where `location_id` refers to a GCP region.
*/
// const name = 'abc123'
/**
* Optional. Available data protection modes that the user can choose. If it's
* unspecified, data protection mode will be LIMITED_DATA_LOSS by default.
*/
// const dataProtectionMode = {}
// Imports the Redis library
const
{
CloudRedisClient
}
=
require
(
' @google-cloud/redis
'
).
v1
;
// Instantiates a client
const
redisClient
=
new
CloudRedisClient
();
async
function
callFailoverInstance
()
{
// Construct request
const
request
=
{
name
,
};
// Run request
const
[
operation
]
=
await
redisClient
.
failoverInstance
(
request
);
const
[
response
]
=
await
operation
.
promise
();
console
.
log
(
response
);
}
callFailoverInstance
();
failoverInstance(request, options, callback)
failoverInstance
(
request
:
protos
.
google
.
cloud
.
redis
.
v1
.
IFailoverInstanceRequest
,
options
:
CallOptions
,
callback
:
Callback<LROperation<protos
.
google
.
cloud
.
redis
.
v1
.
IInstance
,
protos
.
google
.
cloud
.
redis
.
v1
.
IOperationMetadata
> ,
protos
.
google
.
longrunning
.
IOperation
|
null
|
undefined
,
{}
|
null
|
undefined
> )
:
void
;
request
options
CallOptions
callback
Callback
< LROperation
< protos.google.cloud.redis.v1.IInstance
, protos.google.cloud.redis.v1.IOperationMetadata
>, protos.google.longrunning.IOperation
| null | undefined, {} | null | undefined>
void
failoverInstance(request, callback)
failoverInstance
(
request
:
protos
.
google
.
cloud
.
redis
.
v1
.
IFailoverInstanceRequest
,
callback
:
Callback<LROperation<protos
.
google
.
cloud
.
redis
.
v1
.
IInstance
,
protos
.
google
.
cloud
.
redis
.
v1
.
IOperationMetadata
> ,
protos
.
google
.
longrunning
.
IOperation
|
null
|
undefined
,
{}
|
null
|
undefined
> )
:
void
;
request
callback
Callback
< LROperation
< protos.google.cloud.redis.v1.IInstance
, protos.google.cloud.redis.v1.IOperationMetadata
>, protos.google.longrunning.IOperation
| null | undefined, {} | null | undefined>
void
getInstance(request, options)
getInstance
(
request
?:
protos
.
google
.
cloud
.
redis
.
v1
.
IGetInstanceRequest
,
options
?:
CallOptions
)
:
Promise
< [
protos
.
google
.
cloud
.
redis
.
v1
.
IInstance
,
protos
.
google
.
cloud
.
redis
.
v1
.
IGetInstanceRequest
|
undefined
,
{}
|
undefined
]>;
Gets the details of a specific Redis instance.
request
options
Promise
<[ protos.google.cloud.redis.v1.IInstance
, protos.google.cloud.redis.v1.IGetInstanceRequest
| 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. Redis instance resource name using the form:
* `projects/{project_id}/locations/{location_id}/instances/{instance_id}`
* where `location_id` refers to a GCP region.
*/
// const name = 'abc123'
// Imports the Redis library
const
{
CloudRedisClient
}
=
require
(
' @google-cloud/redis
'
).
v1
;
// Instantiates a client
const
redisClient
=
new
CloudRedisClient
();
async
function
callGetInstance
()
{
// Construct request
const
request
=
{
name
,
};
// Run request
const
response
=
await
redisClient
.
getInstance
(
request
);
console
.
log
(
response
);
}
callGetInstance
();
getInstance(request, options, callback)
getInstance
(
request
:
protos
.
google
.
cloud
.
redis
.
v1
.
IGetInstanceRequest
,
options
:
CallOptions
,
callback
:
Callback<protos
.
google
.
cloud
.
redis
.
v1
.
IInstance
,
protos
.
google
.
cloud
.
redis
.
v1
.
IGetInstanceRequest
|
null
|
undefined
,
{}
|
null
|
undefined
> )
:
void
;
request
options
CallOptions
callback
Callback
< protos.google.cloud.redis.v1.IInstance
, protos.google.cloud.redis.v1.IGetInstanceRequest
| null | undefined, {} | null | undefined>
void
getInstance(request, callback)
getInstance
(
request
:
protos
.
google
.
cloud
.
redis
.
v1
.
IGetInstanceRequest
,
callback
:
Callback<protos
.
google
.
cloud
.
redis
.
v1
.
IInstance
,
protos
.
google
.
cloud
.
redis
.
v1
.
IGetInstanceRequest
|
null
|
undefined
,
{}
|
null
|
undefined
> )
:
void
;
request
callback
Callback
< protos.google.cloud.redis.v1.IInstance
, protos.google.cloud.redis.v1.IGetInstanceRequest
| null | undefined, {} | null | undefined>
void
getInstanceAuthString(request, options)
getInstanceAuthString
(
request
?:
protos
.
google
.
cloud
.
redis
.
v1
.
IGetInstanceAuthStringRequest
,
options
?:
CallOptions
)
:
Promise
< [
protos
.
google
.
cloud
.
redis
.
v1
.
IInstanceAuthString
,
protos
.
google
.
cloud
.
redis
.
v1
.
IGetInstanceAuthStringRequest
|
undefined
,
{}
|
undefined
]>;
Gets the AUTH string for a Redis instance. If AUTH is not enabled for the instance the response will be empty. This information is not included in the details returned to GetInstance.
request
options
Promise
<[ protos.google.cloud.redis.v1.IInstanceAuthString
, protos.google.cloud.redis.v1.IGetInstanceAuthStringRequest
| undefined,
{} | undefined
]>
{Promise} - The promise which resolves to an array. The first element of the array is an object representing InstanceAuthString . 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. Redis instance resource name using the form:
* `projects/{project_id}/locations/{location_id}/instances/{instance_id}`
* where `location_id` refers to a GCP region.
*/
// const name = 'abc123'
// Imports the Redis library
const
{
CloudRedisClient
}
=
require
(
' @google-cloud/redis
'
).
v1
;
// Instantiates a client
const
redisClient
=
new
CloudRedisClient
();
async
function
callGetInstanceAuthString
()
{
// Construct request
const
request
=
{
name
,
};
// Run request
const
response
=
await
redisClient
.
getInstanceAuthString
(
request
);
console
.
log
(
response
);
}
callGetInstanceAuthString
();
getInstanceAuthString(request, options, callback)
getInstanceAuthString
(
request
:
protos
.
google
.
cloud
.
redis
.
v1
.
IGetInstanceAuthStringRequest
,
options
:
CallOptions
,
callback
:
Callback<protos
.
google
.
cloud
.
redis
.
v1
.
IInstanceAuthString
,
protos
.
google
.
cloud
.
redis
.
v1
.
IGetInstanceAuthStringRequest
|
null
|
undefined
,
{}
|
null
|
undefined
> )
:
void
;
request
options
CallOptions
callback
Callback
< protos.google.cloud.redis.v1.IInstanceAuthString
, protos.google.cloud.redis.v1.IGetInstanceAuthStringRequest
| null | undefined, {} | null | undefined>
void
getInstanceAuthString(request, callback)
getInstanceAuthString
(
request
:
protos
.
google
.
cloud
.
redis
.
v1
.
IGetInstanceAuthStringRequest
,
callback
:
Callback<protos
.
google
.
cloud
.
redis
.
v1
.
IInstanceAuthString
,
protos
.
google
.
cloud
.
redis
.
v1
.
IGetInstanceAuthStringRequest
|
null
|
undefined
,
{}
|
null
|
undefined
> )
:
void
;
request
callback
Callback
< protos.google.cloud.redis.v1.IInstanceAuthString
, protos.google.cloud.redis.v1.IGetInstanceAuthStringRequest
| null | undefined, {} | null | undefined>
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.
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>
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
);
getOperation(request, optionsOrCallback, callback)
getOperation
(
request
:
protos
.
google
.
longrunning
.
GetOperationRequest
,
optionsOrCallback
?:
gax
.
CallOptions
|
Callback<protos
.
google
.
longrunning
.
Operation
,
protos
.
google
.
longrunning
.
GetOperationRequest
,
{}
|
null
|
undefined
> ,
callback
?:
Callback<protos
.
google
.
longrunning
.
Operation
,
protos
.
google
.
longrunning
.
GetOperationRequest
,
{}
|
null
|
undefined
> )
:
Promise
< [
protos
.
google
.
longrunning
.
Operation
]>;
Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service.
request
optionsOrCallback
CallOptions
| Callback
< protos.google.longrunning.Operation
, protos.google.longrunning.GetOperationRequest
, {} | null | undefined>
callback
Callback
< protos.google.longrunning.Operation
, protos.google.longrunning.GetOperationRequest
, {} | null | undefined>
The function which will be called with the result of the API call.
The second parameter to the callback is an object representing . {Promise} - The promise which resolves to an array. The first element of the array is an object representing . The promise has a method named "cancel" which cancels the ongoing API call.
const
client
=
longrunning
.
operationsClient
();
const
name
=
''
;
const
[
response
]
=
await
client
.
getOperation
({
name
});
// doThingsWith(response)
getProjectId()
getProjectId
()
:
Promise<string>
;
Promise
<string>
getProjectId(callback)
getProjectId
(
callback
:
Callback<string
,
undefined
,
undefined
> )
:
void
;
callback
Callback
<string, undefined, undefined>
void
importInstance(request, options)
importInstance
(
request
?:
protos
.
google
.
cloud
.
redis
.
v1
.
IImportInstanceRequest
,
options
?:
CallOptions
)
:
Promise
< [
LROperation<protos
.
google
.
cloud
.
redis
.
v1
.
IInstance
,
protos
.
google
.
cloud
.
redis
.
v1
.
IOperationMetadata
> ,
protos
.
google
.
longrunning
.
IOperation
|
undefined
,
{}
|
undefined
]>;
Import a Redis RDB snapshot file from Cloud Storage into a Redis instance.
Redis may stop serving during this operation. Instance state will be IMPORTING for entire operation. When complete, the instance will contain only data from the imported file.
The returned operation is automatically deleted after a few hours, so there is no need to call DeleteOperation.
request
options
Promise
<[ LROperation
< protos.google.cloud.redis.v1.IInstance
, protos.google.cloud.redis.v1.IOperationMetadata
>, protos.google.longrunning.IOperation
| undefined,
{} | undefined
]>
{Promise} - The promise which resolves to an array. The first element of the array is an object representing a long running operation. Its promise()
method returns a promise you can await
for. 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. Redis instance resource name using the form:
* `projects/{project_id}/locations/{location_id}/instances/{instance_id}`
* where `location_id` refers to a GCP region.
*/
// const name = 'abc123'
/**
* Required. Specify data to be imported.
*/
// const inputConfig = {}
// Imports the Redis library
const
{
CloudRedisClient
}
=
require
(
' @google-cloud/redis
'
).
v1
;
// Instantiates a client
const
redisClient
=
new
CloudRedisClient
();
async
function
callImportInstance
()
{
// Construct request
const
request
=
{
name
,
inputConfig
,
};
// Run request
const
[
operation
]
=
await
redisClient
.
importInstance
(
request
);
const
[
response
]
=
await
operation
.
promise
();
console
.
log
(
response
);
}
callImportInstance
();
importInstance(request, options, callback)
importInstance
(
request
:
protos
.
google
.
cloud
.
redis
.
v1
.
IImportInstanceRequest
,
options
:
CallOptions
,
callback
:
Callback<LROperation<protos
.
google
.
cloud
.
redis
.
v1
.
IInstance
,
protos
.
google
.
cloud
.
redis
.
v1
.
IOperationMetadata
> ,
protos
.
google
.
longrunning
.
IOperation
|
null
|
undefined
,
{}
|
null
|
undefined
> )
:
void
;
request
options
CallOptions
callback
Callback
< LROperation
< protos.google.cloud.redis.v1.IInstance
, protos.google.cloud.redis.v1.IOperationMetadata
>, protos.google.longrunning.IOperation
| null | undefined, {} | null | undefined>
void
importInstance(request, callback)
importInstance
(
request
:
protos
.
google
.
cloud
.
redis
.
v1
.
IImportInstanceRequest
,
callback
:
Callback<LROperation<protos
.
google
.
cloud
.
redis
.
v1
.
IInstance
,
protos
.
google
.
cloud
.
redis
.
v1
.
IOperationMetadata
> ,
protos
.
google
.
longrunning
.
IOperation
|
null
|
undefined
,
{}
|
null
|
undefined
> )
:
void
;
request
callback
Callback
< LROperation
< protos.google.cloud.redis.v1.IInstance
, protos.google.cloud.redis.v1.IOperationMetadata
>, protos.google.longrunning.IOperation
| null | undefined, {} | null | undefined>
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.
Promise
<{
[name: string]: Function
;
}>
{Promise} A promise that resolves to an authenticated service stub.
instancePath(project, location, instance)
instancePath
(
project
:
string
,
location
:
string
,
instance
:
string
)
:
string
;
Return a fully-qualified instance resource name string.
project
string
location
string
instance
string
string
{string} Resource name string.
listInstances(request, options)
listInstances
(
request
?:
protos
.
google
.
cloud
.
redis
.
v1
.
IListInstancesRequest
,
options
?:
CallOptions
)
:
Promise
< [
protos
.
google
.
cloud
.
redis
.
v1
.
IInstance
[],
protos
.
google
.
cloud
.
redis
.
v1
.
IListInstancesRequest
|
null
,
protos
.
google
.
cloud
.
redis
.
v1
.
IListInstancesResponse
]>;
Lists all Redis instances owned by a project in either the specified location (region) or all locations.
The location should have the following format:
* projects/{project_id}/locations/{location_id}
If location_id
is specified as -
(wildcard), then all regions available to the project are queried, and the results are aggregated.
request
options
Promise
<[ protos.google.cloud.redis.v1.IInstance
[], protos.google.cloud.redis.v1.IListInstancesRequest
| null, protos.google.cloud.redis.v1.IListInstancesResponse
]>
{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 listInstancesAsync()
method described below for async iteration which you can stop as needed. Please see the documentation
for more details and examples.
listInstances(request, options, callback)
listInstances
(
request
:
protos
.
google
.
cloud
.
redis
.
v1
.
IListInstancesRequest
,
options
:
CallOptions
,
callback
:
PaginationCallback<protos
.
google
.
cloud
.
redis
.
v1
.
IListInstancesRequest
,
protos
.
google
.
cloud
.
redis
.
v1
.
IListInstancesResponse
|
null
|
undefined
,
protos
.
google
.
cloud
.
redis
.
v1
.
IInstance
> )
:
void
;
request
options
CallOptions
callback
PaginationCallback
< protos.google.cloud.redis.v1.IListInstancesRequest
, protos.google.cloud.redis.v1.IListInstancesResponse
| null | undefined, protos.google.cloud.redis.v1.IInstance
>
void
listInstances(request, callback)
listInstances
(
request
:
protos
.
google
.
cloud
.
redis
.
v1
.
IListInstancesRequest
,
callback
:
PaginationCallback<protos
.
google
.
cloud
.
redis
.
v1
.
IListInstancesRequest
,
protos
.
google
.
cloud
.
redis
.
v1
.
IListInstancesResponse
|
null
|
undefined
,
protos
.
google
.
cloud
.
redis
.
v1
.
IInstance
> )
:
void
;
request
callback
PaginationCallback
< protos.google.cloud.redis.v1.IListInstancesRequest
, protos.google.cloud.redis.v1.IListInstancesResponse
| null | undefined, protos.google.cloud.redis.v1.IInstance
>
void
listInstancesAsync(request, options)
listInstancesAsync
(
request
?:
protos
.
google
.
cloud
.
redis
.
v1
.
IListInstancesRequest
,
options
?:
CallOptions
)
:
AsyncIterable<protos
.
google
.
cloud
.
redis
.
v1
.
IInstance
> ;
Equivalent to listInstances
, but returns an iterable object.
for
- await
- of
syntax is used with the iterable to get response elements on-demand.
request
options
AsyncIterable
< protos.google.cloud.redis.v1.IInstance
>
{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 resource name of the instance location using the form:
* `projects/{project_id}/locations/{location_id}`
* where `location_id` refers to a GCP region.
*/
// const parent = 'abc123'
/**
* The maximum number of items to return.
* If not specified, a default value of 1000 will be used by the service.
* Regardless of the page_size value, the response may include a partial list
* and a caller should only rely on response's
* `next_page_token` google.cloud.redis.v1.ListInstancesResponse.next_page_token
* to determine if there are more instances left to be queried.
*/
// const pageSize = 1234
/**
* The `next_page_token` value returned from a previous
* ListInstances google.cloud.redis.v1.CloudRedis.ListInstances request, if
* any.
*/
// const pageToken = 'abc123'
// Imports the Redis library
const
{
CloudRedisClient
}
=
require
(
' @google-cloud/redis
'
).
v1
;
// Instantiates a client
const
redisClient
=
new
CloudRedisClient
();
async
function
callListInstances
()
{
// Construct request
const
request
=
{
parent
,
};
// Run request
const
iterable
=
redisClient
.
listInstancesAsync
(
request
);
for
await
(
const
response
of
iterable
)
{
console
.
log
(
response
);
}
}
callListInstances
();
listInstancesStream(request, options)
listInstancesStream
(
request
?:
protos
.
google
.
cloud
.
redis
.
v1
.
IListInstancesRequest
,
options
?:
CallOptions
)
:
Transform
;
Equivalent to listInstances
, but returns a NodeJS Stream object.
request
options
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 listInstancesAsync()
method described below for async iteration which you can stop as needed. Please see the documentation
for more details and examples.
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.
request
LocationProtos.google.cloud.location.IListLocationsRequest
The request object that will be sent.
options
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
}
listOperationsAsync(request, options)
listOperationsAsync
(
request
:
protos
.
google
.
longrunning
.
ListOperationsRequest
,
options
?:
gax
.
CallOptions
)
:
AsyncIterable<protos
.
google
.
longrunning
.
IOperation
> ;
Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns UNIMPLEMENTED
. Returns an iterable object.
For-await-of syntax is used with the iterable to recursively get response element on-demand.
request
options
CallOptions
Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details.
AsyncIterable
< protos.google.longrunning.IOperation
>
{Object} An iterable Object that conforms to iteration protocols .
const
client
=
longrunning
.
operationsClient
();
for
await
(
const
response
of
client
.
listOperationsAsync
(
request
));
// doThingsWith(response)
locationPath(project, location)
locationPath
(
project
:
string
,
location
:
string
)
:
string
;
Return a fully-qualified location resource name string.
project
string
location
string
string
{string} Resource name string.
matchInstanceFromInstanceName(instanceName)
matchInstanceFromInstanceName
(
instanceName
:
string
)
:
string
|
number
;
Parse the instance from Instance resource.
instanceName
string
A fully-qualified path representing Instance resource.
string | number
{string} A string representing the instance.
matchLocationFromInstanceName(instanceName)
matchLocationFromInstanceName
(
instanceName
:
string
)
:
string
|
number
;
Parse the location from Instance resource.
instanceName
string
A fully-qualified path representing Instance resource.
string | number
{string} A string representing the location.
matchLocationFromLocationName(locationName)
matchLocationFromLocationName
(
locationName
:
string
)
:
string
|
number
;
Parse the location from Location resource.
locationName
string
A fully-qualified path representing Location resource.
string | number
{string} A string representing the location.
matchProjectFromInstanceName(instanceName)
matchProjectFromInstanceName
(
instanceName
:
string
)
:
string
|
number
;
Parse the project from Instance resource.
instanceName
string
A fully-qualified path representing Instance resource.
string | number
{string} A string representing the project.
matchProjectFromLocationName(locationName)
matchProjectFromLocationName
(
locationName
:
string
)
:
string
|
number
;
Parse the project from Location resource.
locationName
string
A fully-qualified path representing Location resource.
string | number
{string} A string representing the project.
rescheduleMaintenance(request, options)
rescheduleMaintenance
(
request
?:
protos
.
google
.
cloud
.
redis
.
v1
.
IRescheduleMaintenanceRequest
,
options
?:
CallOptions
)
:
Promise
< [
LROperation<protos
.
google
.
cloud
.
redis
.
v1
.
IInstance
,
protos
.
google
.
cloud
.
redis
.
v1
.
IOperationMetadata
> ,
protos
.
google
.
longrunning
.
IOperation
|
undefined
,
{}
|
undefined
]>;
Reschedule maintenance for a given instance in a given project and location.
request
options
Promise
<[ LROperation
< protos.google.cloud.redis.v1.IInstance
, protos.google.cloud.redis.v1.IOperationMetadata
>, protos.google.longrunning.IOperation
| undefined,
{} | undefined
]>
{Promise} - The promise which resolves to an array. The first element of the array is an object representing a long running operation. Its promise()
method returns a promise you can await
for. 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. Redis instance resource name using the form:
* `projects/{project_id}/locations/{location_id}/instances/{instance_id}`
* where `location_id` refers to a GCP region.
*/
// const name = 'abc123'
/**
* Required. If reschedule type is SPECIFIC_TIME, must set up schedule_time as
* well.
*/
// const rescheduleType = {}
/**
* Optional. Timestamp when the maintenance shall be rescheduled to if
* reschedule_type=SPECIFIC_TIME, in RFC 3339 format, for
* example `2012-11-15T16:19:00.094Z`.
*/
// const scheduleTime = {}
// Imports the Redis library
const
{
CloudRedisClient
}
=
require
(
' @google-cloud/redis
'
).
v1
;
// Instantiates a client
const
redisClient
=
new
CloudRedisClient
();
async
function
callRescheduleMaintenance
()
{
// Construct request
const
request
=
{
name
,
rescheduleType
,
};
// Run request
const
[
operation
]
=
await
redisClient
.
rescheduleMaintenance
(
request
);
const
[
response
]
=
await
operation
.
promise
();
console
.
log
(
response
);
}
callRescheduleMaintenance
();
rescheduleMaintenance(request, options, callback)
rescheduleMaintenance
(
request
:
protos
.
google
.
cloud
.
redis
.
v1
.
IRescheduleMaintenanceRequest
,
options
:
CallOptions
,
callback
:
Callback<LROperation<protos
.
google
.
cloud
.
redis
.
v1
.
IInstance
,
protos
.
google
.
cloud
.
redis
.
v1
.
IOperationMetadata
> ,
protos
.
google
.
longrunning
.
IOperation
|
null
|
undefined
,
{}
|
null
|
undefined
> )
:
void
;
request
options
CallOptions
callback
Callback
< LROperation
< protos.google.cloud.redis.v1.IInstance
, protos.google.cloud.redis.v1.IOperationMetadata
>, protos.google.longrunning.IOperation
| null | undefined, {} | null | undefined>
void
rescheduleMaintenance(request, callback)
rescheduleMaintenance
(
request
:
protos
.
google
.
cloud
.
redis
.
v1
.
IRescheduleMaintenanceRequest
,
callback
:
Callback<LROperation<protos
.
google
.
cloud
.
redis
.
v1
.
IInstance
,
protos
.
google
.
cloud
.
redis
.
v1
.
IOperationMetadata
> ,
protos
.
google
.
longrunning
.
IOperation
|
null
|
undefined
,
{}
|
null
|
undefined
> )
:
void
;
request
callback
Callback
< LROperation
< protos.google.cloud.redis.v1.IInstance
, protos.google.cloud.redis.v1.IOperationMetadata
>, protos.google.longrunning.IOperation
| null | undefined, {} | null | undefined>
void
updateInstance(request, options)
updateInstance
(
request
?:
protos
.
google
.
cloud
.
redis
.
v1
.
IUpdateInstanceRequest
,
options
?:
CallOptions
)
:
Promise
< [
LROperation<protos
.
google
.
cloud
.
redis
.
v1
.
IInstance
,
protos
.
google
.
cloud
.
redis
.
v1
.
IOperationMetadata
> ,
protos
.
google
.
longrunning
.
IOperation
|
undefined
,
{}
|
undefined
]>;
Updates the metadata and configuration of a specific Redis instance.
Completed longrunning.Operation will contain the new instance object in the response field. The returned operation is automatically deleted after a few hours, so there is no need to call DeleteOperation.
request
options
Promise
<[ LROperation
< protos.google.cloud.redis.v1.IInstance
, protos.google.cloud.redis.v1.IOperationMetadata
>, protos.google.longrunning.IOperation
| undefined,
{} | undefined
]>
{Promise} - The promise which resolves to an array. The first element of the array is an object representing a long running operation. Its promise()
method returns a promise you can await
for. 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. Mask of fields to update. At least one path must be supplied in
* this field. The elements of the repeated paths field may only include these
* fields from Instance google.cloud.redis.v1.Instance:
* * `displayName`
* * `labels`
* * `memorySizeGb`
* * `redisConfig`
* * `replica_count`
*/
// const updateMask = {}
/**
* Required. Update description.
* Only fields specified in update_mask are updated.
*/
// const instance = {}
// Imports the Redis library
const
{
CloudRedisClient
}
=
require
(
' @google-cloud/redis
'
).
v1
;
// Instantiates a client
const
redisClient
=
new
CloudRedisClient
();
async
function
callUpdateInstance
()
{
// Construct request
const
request
=
{
updateMask
,
instance
,
};
// Run request
const
[
operation
]
=
await
redisClient
.
updateInstance
(
request
);
const
[
response
]
=
await
operation
.
promise
();
console
.
log
(
response
);
}
callUpdateInstance
();
updateInstance(request, options, callback)
updateInstance
(
request
:
protos
.
google
.
cloud
.
redis
.
v1
.
IUpdateInstanceRequest
,
options
:
CallOptions
,
callback
:
Callback<LROperation<protos
.
google
.
cloud
.
redis
.
v1
.
IInstance
,
protos
.
google
.
cloud
.
redis
.
v1
.
IOperationMetadata
> ,
protos
.
google
.
longrunning
.
IOperation
|
null
|
undefined
,
{}
|
null
|
undefined
> )
:
void
;
request
options
CallOptions
callback
Callback
< LROperation
< protos.google.cloud.redis.v1.IInstance
, protos.google.cloud.redis.v1.IOperationMetadata
>, protos.google.longrunning.IOperation
| null | undefined, {} | null | undefined>
void
updateInstance(request, callback)
updateInstance
(
request
:
protos
.
google
.
cloud
.
redis
.
v1
.
IUpdateInstanceRequest
,
callback
:
Callback<LROperation<protos
.
google
.
cloud
.
redis
.
v1
.
IInstance
,
protos
.
google
.
cloud
.
redis
.
v1
.
IOperationMetadata
> ,
protos
.
google
.
longrunning
.
IOperation
|
null
|
undefined
,
{}
|
null
|
undefined
> )
:
void
;
request
callback
Callback
< LROperation
< protos.google.cloud.redis.v1.IInstance
, protos.google.cloud.redis.v1.IOperationMetadata
>, protos.google.longrunning.IOperation
| null | undefined, {} | null | undefined>
void
upgradeInstance(request, options)
upgradeInstance
(
request
?:
protos
.
google
.
cloud
.
redis
.
v1
.
IUpgradeInstanceRequest
,
options
?:
CallOptions
)
:
Promise
< [
LROperation<protos
.
google
.
cloud
.
redis
.
v1
.
IInstance
,
protos
.
google
.
cloud
.
redis
.
v1
.
IOperationMetadata
> ,
protos
.
google
.
longrunning
.
IOperation
|
undefined
,
{}
|
undefined
]>;
Upgrades Redis instance to the newer Redis version specified in the request.
request
options
Promise
<[ LROperation
< protos.google.cloud.redis.v1.IInstance
, protos.google.cloud.redis.v1.IOperationMetadata
>, protos.google.longrunning.IOperation
| undefined,
{} | undefined
]>
{Promise} - The promise which resolves to an array. The first element of the array is an object representing a long running operation. Its promise()
method returns a promise you can await
for. 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. Redis instance resource name using the form:
* `projects/{project_id}/locations/{location_id}/instances/{instance_id}`
* where `location_id` refers to a GCP region.
*/
// const name = 'abc123'
/**
* Required. Specifies the target version of Redis software to upgrade to.
*/
// const redisVersion = 'abc123'
// Imports the Redis library
const
{
CloudRedisClient
}
=
require
(
' @google-cloud/redis
'
).
v1
;
// Instantiates a client
const
redisClient
=
new
CloudRedisClient
();
async
function
callUpgradeInstance
()
{
// Construct request
const
request
=
{
name
,
redisVersion
,
};
// Run request
const
[
operation
]
=
await
redisClient
.
upgradeInstance
(
request
);
const
[
response
]
=
await
operation
.
promise
();
console
.
log
(
response
);
}
callUpgradeInstance
();
upgradeInstance(request, options, callback)
upgradeInstance
(
request
:
protos
.
google
.
cloud
.
redis
.
v1
.
IUpgradeInstanceRequest
,
options
:
CallOptions
,
callback
:
Callback<LROperation<protos
.
google
.
cloud
.
redis
.
v1
.
IInstance
,
protos
.
google
.
cloud
.
redis
.
v1
.
IOperationMetadata
> ,
protos
.
google
.
longrunning
.
IOperation
|
null
|
undefined
,
{}
|
null
|
undefined
> )
:
void
;
request
options
CallOptions
callback
Callback
< LROperation
< protos.google.cloud.redis.v1.IInstance
, protos.google.cloud.redis.v1.IOperationMetadata
>, protos.google.longrunning.IOperation
| null | undefined, {} | null | undefined>
void
upgradeInstance(request, callback)
upgradeInstance
(
request
:
protos
.
google
.
cloud
.
redis
.
v1
.
IUpgradeInstanceRequest
,
callback
:
Callback<LROperation<protos
.
google
.
cloud
.
redis
.
v1
.
IInstance
,
protos
.
google
.
cloud
.
redis
.
v1
.
IOperationMetadata
> ,
protos
.
google
.
longrunning
.
IOperation
|
null
|
undefined
,
{}
|
null
|
undefined
> )
:
void
;
request
callback
Callback
< LROperation
< protos.google.cloud.redis.v1.IInstance
, protos.google.cloud.redis.v1.IOperationMetadata
>, protos.google.longrunning.IOperation
| null | undefined, {} | null | undefined>
void