A service that application uses to manipulate triggers and functions. v1
Package
@google-cloud/functionsConstructors
(constructor)(opts)
constructor(opts?: ClientOptions);
Construct an instance of CloudFunctionsServiceClient.
Name | Description |
opts |
ClientOptions
|
Properties
apiEndpoint
static get apiEndpoint(): string;
The DNS address for this API service - same as servicePath(), exists for compatibility reasons.
auth
auth: gax.GoogleAuth;
cloudFunctionsServiceStub
cloudFunctionsServiceStub?: Promise<{
[name: string]: Function;
}>;
descriptors
descriptors: Descriptors;
innerApiCalls
innerApiCalls: {
[name: string]: Function;
};
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.
warn
warn: (code: string, message: string, warnType?: string) => void;
Methods
callFunction(request, options)
callFunction(request?: protos.google.cloud.functions.v1.ICallFunctionRequest, options?: CallOptions): Promise<[protos.google.cloud.functions.v1.ICallFunctionResponse, protos.google.cloud.functions.v1.ICallFunctionRequest | undefined, {} | undefined]>;
Synchronously invokes a deployed Cloud Function. To be used for testing purposes as very limited traffic is allowed. For more information on the actual limits, refer to [Rate Limits](https://cloud.google.com/functions/quotas#rate_limits).
Name | Description |
request |
protos.google.cloud.functions.v1.ICallFunctionRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Type | Description |
Promise<[protos.google.cloud.functions.v1.ICallFunctionResponse, protos.google.cloud.functions.v1.ICallFunctionRequest | undefined, {} | undefined]> | {Promise} - The promise which resolves to an array. The first element of the array is an object representing [CallFunctionResponse]. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) for more details and examples. |
/**
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. The name of the function to be called.
*/
// const name = 'abc123'
/**
* Required. Input to be passed to the function.
*/
// const data = 'abc123'
// Imports the Functions library
const {CloudFunctionsServiceClient} = require('@google-cloud/functions').v1;
// Instantiates a client
const functionsClient = new CloudFunctionsServiceClient();
async function callCallFunction() {
// Construct request
const request = {
name,
data,
};
// Run request
const response = await functionsClient.callFunction(request);
console.log(response);
}
callCallFunction();
callFunction(request, options, callback)
callFunction(request: protos.google.cloud.functions.v1.ICallFunctionRequest, options: CallOptions, callback: Callback<protos.google.cloud.functions.v1.ICallFunctionResponse, protos.google.cloud.functions.v1.ICallFunctionRequest | null | undefined, {} | null | undefined>): void;
Name | Description |
request |
protos.google.cloud.functions.v1.ICallFunctionRequest
|
options |
CallOptions
|
callback |
Callback<protos.google.cloud.functions.v1.ICallFunctionResponse, protos.google.cloud.functions.v1.ICallFunctionRequest | null | undefined, {} | null | undefined>
|
Type | Description |
void |
callFunction(request, callback)
callFunction(request: protos.google.cloud.functions.v1.ICallFunctionRequest, callback: Callback<protos.google.cloud.functions.v1.ICallFunctionResponse, protos.google.cloud.functions.v1.ICallFunctionRequest | null | undefined, {} | null | undefined>): void;
Name | Description |
request |
protos.google.cloud.functions.v1.ICallFunctionRequest
|
callback |
Callback<protos.google.cloud.functions.v1.ICallFunctionResponse, protos.google.cloud.functions.v1.ICallFunctionRequest | null | undefined, {} | null | undefined>
|
Type | Description |
void |
checkCreateFunctionProgress(name)
checkCreateFunctionProgress(name: string): Promise<LROperation<protos.google.cloud.functions.v1.CloudFunction, protos.google.cloud.functions.v1.OperationMetadataV1>>;
Check the status of the long running operation returned by createFunction()
.
Name | Description |
name |
string
The operation name that will be passed. |
Type | Description |
Promise<LROperation<protos.google.cloud.functions.v1.CloudFunction, protos.google.cloud.functions.v1.OperationMetadataV1>> | {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](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) for more details and examples. |
/**
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. The project and location in which the function should be created, specified
* in the format `projects/* /locations/*`
*/
// const location = 'abc123'
/**
* Required. Function to be created.
*/
// const function = {}
// Imports the Functions library
const {CloudFunctionsServiceClient} = require('@google-cloud/functions').v1;
// Instantiates a client
const functionsClient = new CloudFunctionsServiceClient();
async function callCreateFunction() {
// Construct request
const request = {
location,
function1,
};
// Run request
const [operation] = await functionsClient.createFunction(request);
const [response] = await operation.promise();
console.log(response);
}
callCreateFunction();
checkDeleteFunctionProgress(name)
checkDeleteFunctionProgress(name: string): Promise<LROperation<protos.google.protobuf.Empty, protos.google.cloud.functions.v1.OperationMetadataV1>>;
Check the status of the long running operation returned by deleteFunction()
.
Name | Description |
name |
string
The operation name that will be passed. |
Type | Description |
Promise<LROperation<protos.google.protobuf.Empty, protos.google.cloud.functions.v1.OperationMetadataV1>> | {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](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) for more details and examples. |
/**
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. The name of the function which should be deleted.
*/
// const name = 'abc123'
// Imports the Functions library
const {CloudFunctionsServiceClient} = require('@google-cloud/functions').v1;
// Instantiates a client
const functionsClient = new CloudFunctionsServiceClient();
async function callDeleteFunction() {
// Construct request
const request = {
name,
};
// Run request
const [operation] = await functionsClient.deleteFunction(request);
const [response] = await operation.promise();
console.log(response);
}
callDeleteFunction();
checkUpdateFunctionProgress(name)
checkUpdateFunctionProgress(name: string): Promise<LROperation<protos.google.cloud.functions.v1.CloudFunction, protos.google.cloud.functions.v1.OperationMetadataV1>>;
Check the status of the long running operation returned by updateFunction()
.
Name | Description |
name |
string
The operation name that will be passed. |
Type | Description |
Promise<LROperation<protos.google.cloud.functions.v1.CloudFunction, protos.google.cloud.functions.v1.OperationMetadataV1>> | {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](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) for more details and examples. |
/**
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. New version of the function.
*/
// const function = {}
/**
* Required list of fields to be updated in this request.
*/
// const updateMask = {}
// Imports the Functions library
const {CloudFunctionsServiceClient} = require('@google-cloud/functions').v1;
// Instantiates a client
const functionsClient = new CloudFunctionsServiceClient();
async function callUpdateFunction() {
// Construct request
const request = {
function1,
};
// Run request
const [operation] = await functionsClient.updateFunction(request);
const [response] = await operation.promise();
console.log(response);
}
callUpdateFunction();
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.
Type | Description |
Promise<void> | {Promise} A promise that resolves when the client is closed. |
cloudFunctionPath(project, location, function_)
cloudFunctionPath(project: string, location: string, function_: string): string;
Return a fully-qualified cloudFunction resource name string.
Name | Description |
project |
string
|
location |
string
|
function_ |
string
|
Type | Description |
string | {string} Resource name string. |
createFunction(request, options)
createFunction(request?: protos.google.cloud.functions.v1.ICreateFunctionRequest, options?: CallOptions): Promise<[LROperation<protos.google.cloud.functions.v1.ICloudFunction, protos.google.cloud.functions.v1.IOperationMetadataV1>, protos.google.longrunning.IOperation | undefined, {} | undefined]>;
Creates a new function. If a function with the given name already exists in the specified project, the long running operation will return ALREADY_EXISTS
error.
Name | Description |
request |
protos.google.cloud.functions.v1.ICreateFunctionRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Type | Description |
Promise<[LROperation<protos.google.cloud.functions.v1.ICloudFunction, protos.google.cloud.functions.v1.IOperationMetadataV1>, 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 |
/**
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. The project and location in which the function should be created, specified
* in the format `projects/* /locations/*`
*/
// const location = 'abc123'
/**
* Required. Function to be created.
*/
// const function = {}
// Imports the Functions library
const {CloudFunctionsServiceClient} = require('@google-cloud/functions').v1;
// Instantiates a client
const functionsClient = new CloudFunctionsServiceClient();
async function callCreateFunction() {
// Construct request
const request = {
location,
function1,
};
// Run request
const [operation] = await functionsClient.createFunction(request);
const [response] = await operation.promise();
console.log(response);
}
callCreateFunction();
createFunction(request, options, callback)
createFunction(request: protos.google.cloud.functions.v1.ICreateFunctionRequest, options: CallOptions, callback: Callback<LROperation<protos.google.cloud.functions.v1.ICloudFunction, protos.google.cloud.functions.v1.IOperationMetadataV1>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Name | Description |
request |
protos.google.cloud.functions.v1.ICreateFunctionRequest
|
options |
CallOptions
|
callback |
Callback<LROperation<protos.google.cloud.functions.v1.ICloudFunction, protos.google.cloud.functions.v1.IOperationMetadataV1>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
|
Type | Description |
void |
createFunction(request, callback)
createFunction(request: protos.google.cloud.functions.v1.ICreateFunctionRequest, callback: Callback<LROperation<protos.google.cloud.functions.v1.ICloudFunction, protos.google.cloud.functions.v1.IOperationMetadataV1>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Name | Description |
request |
protos.google.cloud.functions.v1.ICreateFunctionRequest
|
callback |
Callback<LROperation<protos.google.cloud.functions.v1.ICloudFunction, protos.google.cloud.functions.v1.IOperationMetadataV1>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
|
Type | Description |
void |
cryptoKeyPath(project, location, keyRing, cryptoKey)
cryptoKeyPath(project: string, location: string, keyRing: string, cryptoKey: string): string;
Return a fully-qualified cryptoKey resource name string.
Name | Description |
project |
string
|
location |
string
|
keyRing |
string
|
cryptoKey |
string
|
Type | Description |
string | {string} Resource name string. |
deleteFunction(request, options)
deleteFunction(request?: protos.google.cloud.functions.v1.IDeleteFunctionRequest, options?: CallOptions): Promise<[LROperation<protos.google.protobuf.IEmpty, protos.google.cloud.functions.v1.IOperationMetadataV1>, protos.google.longrunning.IOperation | undefined, {} | undefined]>;
Deletes a function with the given name from the specified project. If the given function is used by some trigger, the trigger will be updated to remove this function.
Name | Description |
request |
protos.google.cloud.functions.v1.IDeleteFunctionRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Type | Description |
Promise<[LROperation<protos.google.protobuf.IEmpty, protos.google.cloud.functions.v1.IOperationMetadataV1>, 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 |
/**
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. The name of the function which should be deleted.
*/
// const name = 'abc123'
// Imports the Functions library
const {CloudFunctionsServiceClient} = require('@google-cloud/functions').v1;
// Instantiates a client
const functionsClient = new CloudFunctionsServiceClient();
async function callDeleteFunction() {
// Construct request
const request = {
name,
};
// Run request
const [operation] = await functionsClient.deleteFunction(request);
const [response] = await operation.promise();
console.log(response);
}
callDeleteFunction();
deleteFunction(request, options, callback)
deleteFunction(request: protos.google.cloud.functions.v1.IDeleteFunctionRequest, options: CallOptions, callback: Callback<LROperation<protos.google.protobuf.IEmpty, protos.google.cloud.functions.v1.IOperationMetadataV1>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Name | Description |
request |
protos.google.cloud.functions.v1.IDeleteFunctionRequest
|
options |
CallOptions
|
callback |
Callback<LROperation<protos.google.protobuf.IEmpty, protos.google.cloud.functions.v1.IOperationMetadataV1>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
|
Type | Description |
void |
deleteFunction(request, callback)
deleteFunction(request: protos.google.cloud.functions.v1.IDeleteFunctionRequest, callback: Callback<LROperation<protos.google.protobuf.IEmpty, protos.google.cloud.functions.v1.IOperationMetadataV1>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Name | Description |
request |
protos.google.cloud.functions.v1.IDeleteFunctionRequest
|
callback |
Callback<LROperation<protos.google.protobuf.IEmpty, protos.google.cloud.functions.v1.IOperationMetadataV1>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
|
Type | Description |
void |
generateDownloadUrl(request, options)
generateDownloadUrl(request?: protos.google.cloud.functions.v1.IGenerateDownloadUrlRequest, options?: CallOptions): Promise<[protos.google.cloud.functions.v1.IGenerateDownloadUrlResponse, protos.google.cloud.functions.v1.IGenerateDownloadUrlRequest | undefined, {} | undefined]>;
Returns a signed URL for downloading deployed function source code. The URL is only valid for a limited period and should be used within minutes after generation. For more information about the signed URL usage see: https://cloud.google.com/storage/docs/access-control/signed-urls
Name | Description |
request |
protos.google.cloud.functions.v1.IGenerateDownloadUrlRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Type | Description |
Promise<[protos.google.cloud.functions.v1.IGenerateDownloadUrlResponse, protos.google.cloud.functions.v1.IGenerateDownloadUrlRequest | undefined, {} | undefined]> | {Promise} - The promise which resolves to an array. The first element of the array is an object representing [GenerateDownloadUrlResponse]. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) for more details and examples. |
/**
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* The name of function for which source code Google Cloud Storage signed
* URL should be generated.
*/
// const name = 'abc123'
/**
* The optional version of function. If not set, default, current version
* is used.
*/
// const versionId = 1234
// Imports the Functions library
const {CloudFunctionsServiceClient} = require('@google-cloud/functions').v1;
// Instantiates a client
const functionsClient = new CloudFunctionsServiceClient();
async function callGenerateDownloadUrl() {
// Construct request
const request = {};
// Run request
const response = await functionsClient.generateDownloadUrl(request);
console.log(response);
}
callGenerateDownloadUrl();
generateDownloadUrl(request, options, callback)
generateDownloadUrl(request: protos.google.cloud.functions.v1.IGenerateDownloadUrlRequest, options: CallOptions, callback: Callback<protos.google.cloud.functions.v1.IGenerateDownloadUrlResponse, protos.google.cloud.functions.v1.IGenerateDownloadUrlRequest | null | undefined, {} | null | undefined>): void;
Name | Description |
request |
protos.google.cloud.functions.v1.IGenerateDownloadUrlRequest
|
options |
CallOptions
|
callback |
Callback<protos.google.cloud.functions.v1.IGenerateDownloadUrlResponse, protos.google.cloud.functions.v1.IGenerateDownloadUrlRequest | null | undefined, {} | null | undefined>
|
Type | Description |
void |
generateDownloadUrl(request, callback)
generateDownloadUrl(request: protos.google.cloud.functions.v1.IGenerateDownloadUrlRequest, callback: Callback<protos.google.cloud.functions.v1.IGenerateDownloadUrlResponse, protos.google.cloud.functions.v1.IGenerateDownloadUrlRequest | null | undefined, {} | null | undefined>): void;
Name | Description |
request |
protos.google.cloud.functions.v1.IGenerateDownloadUrlRequest
|
callback |
Callback<protos.google.cloud.functions.v1.IGenerateDownloadUrlResponse, protos.google.cloud.functions.v1.IGenerateDownloadUrlRequest | null | undefined, {} | null | undefined>
|
Type | Description |
void |
generateUploadUrl(request, options)
generateUploadUrl(request?: protos.google.cloud.functions.v1.IGenerateUploadUrlRequest, options?: CallOptions): Promise<[protos.google.cloud.functions.v1.IGenerateUploadUrlResponse, protos.google.cloud.functions.v1.IGenerateUploadUrlRequest | undefined, {} | undefined]>;
Returns a signed URL for uploading a function source code. For more information about the signed URL usage see: https://cloud.google.com/storage/docs/access-control/signed-urls. Once the function source code upload is complete, the used signed URL should be provided in CreateFunction or UpdateFunction request as a reference to the function source code.
When uploading source code to the generated signed URL, please follow these restrictions:
* Source file type should be a zip file. * Source file size should not exceed 100MB limit. * No credentials should be attached - the signed URLs provide access to the target bucket using internal service identity; if credentials were attached, the identity from the credentials would be used, but that identity does not have permissions to upload files to the URL.
When making a HTTP PUT request, these two headers need to be specified:
* content-type: application/zip
* x-goog-content-length-range: 0,104857600
And this header SHOULD NOT be specified:
* Authorization: Bearer YOUR_TOKEN
Name | Description |
request |
protos.google.cloud.functions.v1.IGenerateUploadUrlRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Type | Description |
Promise<[protos.google.cloud.functions.v1.IGenerateUploadUrlResponse, protos.google.cloud.functions.v1.IGenerateUploadUrlRequest | undefined, {} | undefined]> | {Promise} - The promise which resolves to an array. The first element of the array is an object representing [GenerateUploadUrlResponse]. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) for more details and examples. |
/**
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* The project and location in which the Google Cloud Storage signed URL
* should be generated, specified in the format `projects/* /locations/*`.
*/
// const parent = 'abc123'
// Imports the Functions library
const {CloudFunctionsServiceClient} = require('@google-cloud/functions').v1;
// Instantiates a client
const functionsClient = new CloudFunctionsServiceClient();
async function callGenerateUploadUrl() {
// Construct request
const request = {};
// Run request
const response = await functionsClient.generateUploadUrl(request);
console.log(response);
}
callGenerateUploadUrl();
generateUploadUrl(request, options, callback)
generateUploadUrl(request: protos.google.cloud.functions.v1.IGenerateUploadUrlRequest, options: CallOptions, callback: Callback<protos.google.cloud.functions.v1.IGenerateUploadUrlResponse, protos.google.cloud.functions.v1.IGenerateUploadUrlRequest | null | undefined, {} | null | undefined>): void;
Name | Description |
request |
protos.google.cloud.functions.v1.IGenerateUploadUrlRequest
|
options |
CallOptions
|
callback |
Callback<protos.google.cloud.functions.v1.IGenerateUploadUrlResponse, protos.google.cloud.functions.v1.IGenerateUploadUrlRequest | null | undefined, {} | null | undefined>
|
Type | Description |
void |
generateUploadUrl(request, callback)
generateUploadUrl(request: protos.google.cloud.functions.v1.IGenerateUploadUrlRequest, callback: Callback<protos.google.cloud.functions.v1.IGenerateUploadUrlResponse, protos.google.cloud.functions.v1.IGenerateUploadUrlRequest | null | undefined, {} | null | undefined>): void;
Name | Description |
request |
protos.google.cloud.functions.v1.IGenerateUploadUrlRequest
|
callback |
Callback<protos.google.cloud.functions.v1.IGenerateUploadUrlResponse, protos.google.cloud.functions.v1.IGenerateUploadUrlRequest | null | undefined, {} | null | undefined>
|
Type | Description |
void |
getFunction(request, options)
getFunction(request?: protos.google.cloud.functions.v1.IGetFunctionRequest, options?: CallOptions): Promise<[protos.google.cloud.functions.v1.ICloudFunction, protos.google.cloud.functions.v1.IGetFunctionRequest | undefined, {} | undefined]>;
Returns a function with the given name from the requested project.
Name | Description |
request |
protos.google.cloud.functions.v1.IGetFunctionRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Type | Description |
Promise<[protos.google.cloud.functions.v1.ICloudFunction, protos.google.cloud.functions.v1.IGetFunctionRequest | undefined, {} | undefined]> | {Promise} - The promise which resolves to an array. The first element of the array is an object representing [CloudFunction]. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) for more details and examples. |
/**
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. The name of the function which details should be obtained.
*/
// const name = 'abc123'
// Imports the Functions library
const {CloudFunctionsServiceClient} = require('@google-cloud/functions').v1;
// Instantiates a client
const functionsClient = new CloudFunctionsServiceClient();
async function callGetFunction() {
// Construct request
const request = {
name,
};
// Run request
const response = await functionsClient.getFunction(request);
console.log(response);
}
callGetFunction();
getFunction(request, options, callback)
getFunction(request: protos.google.cloud.functions.v1.IGetFunctionRequest, options: CallOptions, callback: Callback<protos.google.cloud.functions.v1.ICloudFunction, protos.google.cloud.functions.v1.IGetFunctionRequest | null | undefined, {} | null | undefined>): void;
Name | Description |
request |
protos.google.cloud.functions.v1.IGetFunctionRequest
|
options |
CallOptions
|
callback |
Callback<protos.google.cloud.functions.v1.ICloudFunction, protos.google.cloud.functions.v1.IGetFunctionRequest | null | undefined, {} | null | undefined>
|
Type | Description |
void |
getFunction(request, callback)
getFunction(request: protos.google.cloud.functions.v1.IGetFunctionRequest, callback: Callback<protos.google.cloud.functions.v1.ICloudFunction, protos.google.cloud.functions.v1.IGetFunctionRequest | null | undefined, {} | null | undefined>): void;
Name | Description |
request |
protos.google.cloud.functions.v1.IGetFunctionRequest
|
callback |
Callback<protos.google.cloud.functions.v1.ICloudFunction, protos.google.cloud.functions.v1.IGetFunctionRequest | null | undefined, {} | null | undefined>
|
Type | Description |
void |
getIamPolicy(request, options)
getIamPolicy(request?: protos.google.iam.v1.IGetIamPolicyRequest, options?: CallOptions): Promise<[protos.google.iam.v1.IPolicy, protos.google.iam.v1.IGetIamPolicyRequest | undefined, {} | undefined]>;
Gets the IAM access control policy for a function. Returns an empty policy if the function exists and does not have a policy set.
Name | Description |
request |
protos.google.iam.v1.IGetIamPolicyRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Type | Description |
Promise<[protos.google.iam.v1.IPolicy, protos.google.iam.v1.IGetIamPolicyRequest | undefined, {} | undefined]> | {Promise} - The promise which resolves to an array. The first element of the array is an object representing [Policy]. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) for more details and examples. |
/**
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* REQUIRED: The resource for which the policy is being requested.
* See the operation documentation for the appropriate value for this field.
*/
// const resource = 'abc123'
/**
* OPTIONAL: A `GetPolicyOptions` object for specifying options to
* `GetIamPolicy`. This field is only used by Cloud IAM.
*/
// const options = {}
// Imports the Functions library
const {CloudFunctionsServiceClient} = require('@google-cloud/functions').v1;
// Instantiates a client
const functionsClient = new CloudFunctionsServiceClient();
async function callGetIamPolicy() {
// Construct request
const request = {
resource,
};
// Run request
const response = await functionsClient.getIamPolicy(request);
console.log(response);
}
callGetIamPolicy();
getIamPolicy(request, options, callback)
getIamPolicy(request: protos.google.iam.v1.IGetIamPolicyRequest, options: CallOptions, callback: Callback<protos.google.iam.v1.IPolicy, protos.google.iam.v1.IGetIamPolicyRequest | null | undefined, {} | null | undefined>): void;
Name | Description |
request |
protos.google.iam.v1.IGetIamPolicyRequest
|
options |
CallOptions
|
callback |
Callback<protos.google.iam.v1.IPolicy, protos.google.iam.v1.IGetIamPolicyRequest | null | undefined, {} | null | undefined>
|
Type | Description |
void |
getIamPolicy(request, callback)
getIamPolicy(request: protos.google.iam.v1.IGetIamPolicyRequest, callback: Callback<protos.google.iam.v1.IPolicy, protos.google.iam.v1.IGetIamPolicyRequest | null | undefined, {} | null | undefined>): void;
Name | Description |
request |
protos.google.iam.v1.IGetIamPolicyRequest
|
callback |
Callback<protos.google.iam.v1.IPolicy, protos.google.iam.v1.IGetIamPolicyRequest | null | undefined, {} | null | undefined>
|
Type | Description |
void |
getProjectId()
getProjectId(): Promise<string>;
Type | Description |
Promise<string> |
getProjectId(callback)
getProjectId(callback: Callback<string, undefined, undefined>): void;
Name | Description |
callback |
Callback<string, undefined, undefined>
|
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.
Type | Description |
Promise<{ [name: string]: Function; }> | {Promise} A promise that resolves to an authenticated service stub. |
listFunctions(request, options)
listFunctions(request?: protos.google.cloud.functions.v1.IListFunctionsRequest, options?: CallOptions): Promise<[protos.google.cloud.functions.v1.ICloudFunction[], protos.google.cloud.functions.v1.IListFunctionsRequest | null, protos.google.cloud.functions.v1.IListFunctionsResponse]>;
Returns a list of functions that belong to the requested project.
Name | Description |
request |
protos.google.cloud.functions.v1.IListFunctionsRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Type | Description |
Promise<[protos.google.cloud.functions.v1.ICloudFunction[], protos.google.cloud.functions.v1.IListFunctionsRequest | null, protos.google.cloud.functions.v1.IListFunctionsResponse]> | {Promise} - The promise which resolves to an array. The first element of the array is Array of [CloudFunction]. 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 |
listFunctions(request, options, callback)
listFunctions(request: protos.google.cloud.functions.v1.IListFunctionsRequest, options: CallOptions, callback: PaginationCallback<protos.google.cloud.functions.v1.IListFunctionsRequest, protos.google.cloud.functions.v1.IListFunctionsResponse | null | undefined, protos.google.cloud.functions.v1.ICloudFunction>): void;
Name | Description |
request |
protos.google.cloud.functions.v1.IListFunctionsRequest
|
options |
CallOptions
|
callback |
PaginationCallback<protos.google.cloud.functions.v1.IListFunctionsRequest, protos.google.cloud.functions.v1.IListFunctionsResponse | null | undefined, protos.google.cloud.functions.v1.ICloudFunction>
|
Type | Description |
void |
listFunctions(request, callback)
listFunctions(request: protos.google.cloud.functions.v1.IListFunctionsRequest, callback: PaginationCallback<protos.google.cloud.functions.v1.IListFunctionsRequest, protos.google.cloud.functions.v1.IListFunctionsResponse | null | undefined, protos.google.cloud.functions.v1.ICloudFunction>): void;
Name | Description |
request |
protos.google.cloud.functions.v1.IListFunctionsRequest
|
callback |
PaginationCallback<protos.google.cloud.functions.v1.IListFunctionsRequest, protos.google.cloud.functions.v1.IListFunctionsResponse | null | undefined, protos.google.cloud.functions.v1.ICloudFunction>
|
Type | Description |
void |
listFunctionsAsync(request, options)
listFunctionsAsync(request?: protos.google.cloud.functions.v1.IListFunctionsRequest, options?: CallOptions): AsyncIterable<protos.google.cloud.functions.v1.ICloudFunction>;
Equivalent to listFunctions
, but returns an iterable object.
for
-await
-of
syntax is used with the iterable to get response elements on-demand.
Name | Description |
request |
protos.google.cloud.functions.v1.IListFunctionsRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Type | Description |
AsyncIterable<protos.google.cloud.functions.v1.ICloudFunction> | {Object} An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). When you iterate the returned iterable, each element will be an object representing [CloudFunction]. 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](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) for more details and examples. |
/**
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* The project and location from which the function should be listed,
* specified in the format `projects/* /locations/*`
* If you want to list functions in all locations, use "-" in place of a
* location. When listing functions in all locations, if one or more
* location(s) are unreachable, the response will contain functions from all
* reachable locations along with the names of any unreachable locations.
*/
// const parent = 'abc123'
/**
* Maximum number of functions to return per call.
*/
// const pageSize = 1234
/**
* The value returned by the last
* `ListFunctionsResponse`; indicates that
* this is a continuation of a prior `ListFunctions` call, and that the
* system should return the next page of data.
*/
// const pageToken = 'abc123'
// Imports the Functions library
const {CloudFunctionsServiceClient} = require('@google-cloud/functions').v1;
// Instantiates a client
const functionsClient = new CloudFunctionsServiceClient();
async function callListFunctions() {
// Construct request
const request = {};
// Run request
const iterable = await functionsClient.listFunctionsAsync(request);
for await (const response of iterable) {
console.log(response);
}
}
callListFunctions();
listFunctionsStream(request, options)
listFunctionsStream(request?: protos.google.cloud.functions.v1.IListFunctionsRequest, options?: CallOptions): Transform;
Equivalent to method.name.toCamelCase()
, but returns a NodeJS Stream object.
Name | Description |
request |
protos.google.cloud.functions.v1.IListFunctionsRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Type | Description |
Transform | {Stream} An object stream which emits an object representing [CloudFunction] 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 |
locationPath(project, location)
locationPath(project: string, location: string): string;
Return a fully-qualified location resource name string.
Name | Description |
project |
string
|
location |
string
|
Type | Description |
string | {string} Resource name string. |
matchCryptoKeyFromCryptoKeyName(cryptoKeyName)
matchCryptoKeyFromCryptoKeyName(cryptoKeyName: string): string | number;
Parse the crypto_key from CryptoKey resource.
Name | Description |
cryptoKeyName |
string
A fully-qualified path representing CryptoKey resource. |
Type | Description |
string | number | {string} A string representing the crypto_key. |
matchFunctionFromCloudFunctionName(cloudFunctionName)
matchFunctionFromCloudFunctionName(cloudFunctionName: string): string | number;
Parse the function from CloudFunction resource.
Name | Description |
cloudFunctionName |
string
A fully-qualified path representing CloudFunction resource. |
Type | Description |
string | number | {string} A string representing the function. |
matchKeyRingFromCryptoKeyName(cryptoKeyName)
matchKeyRingFromCryptoKeyName(cryptoKeyName: string): string | number;
Parse the key_ring from CryptoKey resource.
Name | Description |
cryptoKeyName |
string
A fully-qualified path representing CryptoKey resource. |
Type | Description |
string | number | {string} A string representing the key_ring. |
matchLocationFromCloudFunctionName(cloudFunctionName)
matchLocationFromCloudFunctionName(cloudFunctionName: string): string | number;
Parse the location from CloudFunction resource.
Name | Description |
cloudFunctionName |
string
A fully-qualified path representing CloudFunction resource. |
Type | Description |
string | number | {string} A string representing the location. |
matchLocationFromCryptoKeyName(cryptoKeyName)
matchLocationFromCryptoKeyName(cryptoKeyName: string): string | number;
Parse the location from CryptoKey resource.
Name | Description |
cryptoKeyName |
string
A fully-qualified path representing CryptoKey resource. |
Type | Description |
string | number | {string} A string representing the location. |
matchLocationFromLocationName(locationName)
matchLocationFromLocationName(locationName: string): string | number;
Parse the location from Location resource.
Name | Description |
locationName |
string
A fully-qualified path representing Location resource. |
Type | Description |
string | number | {string} A string representing the location. |
matchLocationFromRepositoryName(repositoryName)
matchLocationFromRepositoryName(repositoryName: string): string | number;
Parse the location from Repository resource.
Name | Description |
repositoryName |
string
A fully-qualified path representing Repository resource. |
Type | Description |
string | number | {string} A string representing the location. |
matchProjectFromCloudFunctionName(cloudFunctionName)
matchProjectFromCloudFunctionName(cloudFunctionName: string): string | number;
Parse the project from CloudFunction resource.
Name | Description |
cloudFunctionName |
string
A fully-qualified path representing CloudFunction resource. |
Type | Description |
string | number | {string} A string representing the project. |
matchProjectFromCryptoKeyName(cryptoKeyName)
matchProjectFromCryptoKeyName(cryptoKeyName: string): string | number;
Parse the project from CryptoKey resource.
Name | Description |
cryptoKeyName |
string
A fully-qualified path representing CryptoKey resource. |
Type | Description |
string | number | {string} A string representing the project. |
matchProjectFromLocationName(locationName)
matchProjectFromLocationName(locationName: string): string | number;
Parse the project from Location resource.
Name | Description |
locationName |
string
A fully-qualified path representing Location resource. |
Type | Description |
string | number | {string} A string representing the project. |
matchProjectFromRepositoryName(repositoryName)
matchProjectFromRepositoryName(repositoryName: string): string | number;
Parse the project from Repository resource.
Name | Description |
repositoryName |
string
A fully-qualified path representing Repository resource. |
Type | Description |
string | number | {string} A string representing the project. |
matchRepositoryFromRepositoryName(repositoryName)
matchRepositoryFromRepositoryName(repositoryName: string): string | number;
Parse the repository from Repository resource.
Name | Description |
repositoryName |
string
A fully-qualified path representing Repository resource. |
Type | Description |
string | number | {string} A string representing the repository. |
repositoryPath(project, location, repository)
repositoryPath(project: string, location: string, repository: string): string;
Return a fully-qualified repository resource name string.
Name | Description |
project |
string
|
location |
string
|
repository |
string
|
Type | Description |
string | {string} Resource name string. |
setIamPolicy(request, options)
setIamPolicy(request?: protos.google.iam.v1.ISetIamPolicyRequest, options?: CallOptions): Promise<[protos.google.iam.v1.IPolicy, protos.google.iam.v1.ISetIamPolicyRequest | undefined, {} | undefined]>;
Sets the IAM access control policy on the specified function. Replaces any existing policy.
Name | Description |
request |
protos.google.iam.v1.ISetIamPolicyRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Type | Description |
Promise<[protos.google.iam.v1.IPolicy, protos.google.iam.v1.ISetIamPolicyRequest | undefined, {} | undefined]> | {Promise} - The promise which resolves to an array. The first element of the array is an object representing [Policy]. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) for more details and examples. |
/**
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* REQUIRED: The resource for which the policy is being specified.
* See the operation documentation for the appropriate value for this field.
*/
// const resource = 'abc123'
/**
* REQUIRED: The complete policy to be applied to the `resource`. The size of
* the policy is limited to a few 10s of KB. An empty policy is a
* valid policy but certain Cloud Platform services (such as Projects)
* might reject them.
*/
// const policy = {}
// Imports the Functions library
const {CloudFunctionsServiceClient} = require('@google-cloud/functions').v1;
// Instantiates a client
const functionsClient = new CloudFunctionsServiceClient();
async function callSetIamPolicy() {
// Construct request
const request = {
resource,
policy,
};
// Run request
const response = await functionsClient.setIamPolicy(request);
console.log(response);
}
callSetIamPolicy();
setIamPolicy(request, options, callback)
setIamPolicy(request: protos.google.iam.v1.ISetIamPolicyRequest, options: CallOptions, callback: Callback<protos.google.iam.v1.IPolicy, protos.google.iam.v1.ISetIamPolicyRequest | null | undefined, {} | null | undefined>): void;
Name | Description |
request |
protos.google.iam.v1.ISetIamPolicyRequest
|
options |
CallOptions
|
callback |
Callback<protos.google.iam.v1.IPolicy, protos.google.iam.v1.ISetIamPolicyRequest | null | undefined, {} | null | undefined>
|
Type | Description |
void |
setIamPolicy(request, callback)
setIamPolicy(request: protos.google.iam.v1.ISetIamPolicyRequest, callback: Callback<protos.google.iam.v1.IPolicy, protos.google.iam.v1.ISetIamPolicyRequest | null | undefined, {} | null | undefined>): void;
Name | Description |
request |
protos.google.iam.v1.ISetIamPolicyRequest
|
callback |
Callback<protos.google.iam.v1.IPolicy, protos.google.iam.v1.ISetIamPolicyRequest | null | undefined, {} | null | undefined>
|
Type | Description |
void |
testIamPermissions(request, options)
testIamPermissions(request?: protos.google.iam.v1.ITestIamPermissionsRequest, options?: CallOptions): Promise<[protos.google.iam.v1.ITestIamPermissionsResponse, protos.google.iam.v1.ITestIamPermissionsRequest | undefined, {} | undefined]>;
Tests the specified permissions against the IAM access control policy for a function. If the function does not exist, this will return an empty set of permissions, not a NOT_FOUND error.
Name | Description |
request |
protos.google.iam.v1.ITestIamPermissionsRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Type | Description |
Promise<[protos.google.iam.v1.ITestIamPermissionsResponse, protos.google.iam.v1.ITestIamPermissionsRequest | undefined, {} | undefined]> | {Promise} - The promise which resolves to an array. The first element of the array is an object representing [TestIamPermissionsResponse]. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) for more details and examples. |
/**
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* REQUIRED: The resource for which the policy detail is being requested.
* See the operation documentation for the appropriate value for this field.
*/
// const resource = 'abc123'
/**
* The set of permissions to check for the `resource`. Permissions with
* wildcards (such as '*' or 'storage.*') are not allowed. For more
* information see
* IAM Overview (https://cloud.google.com/iam/docs/overview#permissions).
*/
// const permissions = 'abc123'
// Imports the Functions library
const {CloudFunctionsServiceClient} = require('@google-cloud/functions').v1;
// Instantiates a client
const functionsClient = new CloudFunctionsServiceClient();
async function callTestIamPermissions() {
// Construct request
const request = {
resource,
permissions,
};
// Run request
const response = await functionsClient.testIamPermissions(request);
console.log(response);
}
callTestIamPermissions();
testIamPermissions(request, options, callback)
testIamPermissions(request: protos.google.iam.v1.ITestIamPermissionsRequest, options: CallOptions, callback: Callback<protos.google.iam.v1.ITestIamPermissionsResponse, protos.google.iam.v1.ITestIamPermissionsRequest | null | undefined, {} | null | undefined>): void;
Name | Description |
request |
protos.google.iam.v1.ITestIamPermissionsRequest
|
options |
CallOptions
|
callback |
Callback<protos.google.iam.v1.ITestIamPermissionsResponse, protos.google.iam.v1.ITestIamPermissionsRequest | null | undefined, {} | null | undefined>
|
Type | Description |
void |
testIamPermissions(request, callback)
testIamPermissions(request: protos.google.iam.v1.ITestIamPermissionsRequest, callback: Callback<protos.google.iam.v1.ITestIamPermissionsResponse, protos.google.iam.v1.ITestIamPermissionsRequest | null | undefined, {} | null | undefined>): void;
Name | Description |
request |
protos.google.iam.v1.ITestIamPermissionsRequest
|
callback |
Callback<protos.google.iam.v1.ITestIamPermissionsResponse, protos.google.iam.v1.ITestIamPermissionsRequest | null | undefined, {} | null | undefined>
|
Type | Description |
void |
updateFunction(request, options)
updateFunction(request?: protos.google.cloud.functions.v1.IUpdateFunctionRequest, options?: CallOptions): Promise<[LROperation<protos.google.cloud.functions.v1.ICloudFunction, protos.google.cloud.functions.v1.IOperationMetadataV1>, protos.google.longrunning.IOperation | undefined, {} | undefined]>;
Updates existing function.
Name | Description |
request |
protos.google.cloud.functions.v1.IUpdateFunctionRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Type | Description |
Promise<[LROperation<protos.google.cloud.functions.v1.ICloudFunction, protos.google.cloud.functions.v1.IOperationMetadataV1>, 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 |
/**
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. New version of the function.
*/
// const function = {}
/**
* Required list of fields to be updated in this request.
*/
// const updateMask = {}
// Imports the Functions library
const {CloudFunctionsServiceClient} = require('@google-cloud/functions').v1;
// Instantiates a client
const functionsClient = new CloudFunctionsServiceClient();
async function callUpdateFunction() {
// Construct request
const request = {
function1,
};
// Run request
const [operation] = await functionsClient.updateFunction(request);
const [response] = await operation.promise();
console.log(response);
}
callUpdateFunction();
updateFunction(request, options, callback)
updateFunction(request: protos.google.cloud.functions.v1.IUpdateFunctionRequest, options: CallOptions, callback: Callback<LROperation<protos.google.cloud.functions.v1.ICloudFunction, protos.google.cloud.functions.v1.IOperationMetadataV1>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Name | Description |
request |
protos.google.cloud.functions.v1.IUpdateFunctionRequest
|
options |
CallOptions
|
callback |
Callback<LROperation<protos.google.cloud.functions.v1.ICloudFunction, protos.google.cloud.functions.v1.IOperationMetadataV1>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
|
Type | Description |
void |
updateFunction(request, callback)
updateFunction(request: protos.google.cloud.functions.v1.IUpdateFunctionRequest, callback: Callback<LROperation<protos.google.cloud.functions.v1.ICloudFunction, protos.google.cloud.functions.v1.IOperationMetadataV1>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Name | Description |
request |
protos.google.cloud.functions.v1.IUpdateFunctionRequest
|
callback |
Callback<LROperation<protos.google.cloud.functions.v1.ICloudFunction, protos.google.cloud.functions.v1.IOperationMetadataV1>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
|
Type | Description |
void |