class ProjectsLocationsFunctions extends Resource (View source)

The "functions" collection of methods.

Typical usage is:

 $cloudfunctionsService = new Google\Service\CloudFunctions(...);
 $functions = $cloudfunctionsService->projects_locations_functions;

Methods

abortFunctionUpgrade(string $name, AbortFunctionUpgradeRequest $postBody, array $optParams = [])

Aborts generation upgrade process for a function with the given name from the specified project. Deletes all 2nd Gen copy related configuration and resources which were created during the upgrade process.

commitFunctionUpgrade(string $name, CommitFunctionUpgradeRequest $postBody, array $optParams = [])

Finalizes the upgrade after which function upgrade can not be rolled back.

create(string $parent, CloudfunctionsFunction $postBody, array $optParams = [])

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. (functions.create)

delete(string $name, array $optParams = [])

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. (functions.delete)

generateDownloadUrl(string $name, GenerateDownloadUrlRequest $postBody, array $optParams = [])

Returns a signed URL for downloading deployed function source code. The URL is only valid for a limited period and should be used within 30 minutes of generation. For more information about the signed URL usage see: https://cloud.google.com/storage/docs/access-control/signed-urls (functions.generateDownloadUrl)

generateUploadUrl(string $parent, GenerateUploadUrlRequest $postBody, array $optParams = [])

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. 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, specify this header: content-type: application/zip Do not specify this header: Authorization: Bearer YOUR_TOKEN (functions.generateUploadUrl)

get(string $name, array $optParams = [])

Returns a function with the given name from the requested project.

getIamPolicy(string $resource, array $optParams = [])

Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set. (functions.getIamPolicy)

listProjectsLocationsFunctions(string $parent, array $optParams = [])

Returns a list of functions that belong to the requested project.

patch(string $name, CloudfunctionsFunction $postBody, array $optParams = [])

Updates existing function. (functions.patch)

redirectFunctionUpgradeTraffic(string $name, RedirectFunctionUpgradeTrafficRequest $postBody, array $optParams = [])

Changes the traffic target of a function from the original 1st Gen function to the 2nd Gen copy. This is the second step of the multi step process to upgrade 1st Gen functions to 2nd Gen. After this operation, all new traffic will be served by 2nd Gen copy. (functions.redirectFunctionUpgradeTraffic)

rollbackFunctionUpgradeTraffic(string $name, RollbackFunctionUpgradeTrafficRequest $postBody, array $optParams = [])

Reverts the traffic target of a function from the 2nd Gen copy to the original 1st Gen function. After this operation, all new traffic would be served by the 1st Gen. (functions.rollbackFunctionUpgradeTraffic)

setIamPolicy(string $resource, SetIamPolicyRequest $postBody, array $optParams = [])

Sets the access control policy on the specified resource. Replaces any existing policy. Can return NOT_FOUND, INVALID_ARGUMENT, and PERMISSION_DENIED errors. (functions.setIamPolicy)

setupFunctionUpgradeConfig(string $name, SetupFunctionUpgradeConfigRequest $postBody, array $optParams = [])

Creates a 2nd Gen copy of the function configuration based on the 1st Gen function with the given name. This is the first step of the multi step process to upgrade 1st Gen functions to 2nd Gen. Only 2nd Gen configuration is setup as part of this request and traffic continues to be served by 1st Gen. (functions.setupFunctionUpgradeConfig)

testIamPermissions(string $resource, TestIamPermissionsRequest $postBody, array $optParams = [])

Returns permissions that a caller has on the specified resource. If the resource does not exist, this will return an empty set of permissions, not a NOT_FOUND error. Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking.

Details

Operation abortFunctionUpgrade(string $name, AbortFunctionUpgradeRequest $postBody, array $optParams = [])

Aborts generation upgrade process for a function with the given name from the specified project. Deletes all 2nd Gen copy related configuration and resources which were created during the upgrade process.

(functions.abortFunctionUpgrade)

Parameters

string $name

Required. The name of the function for which upgrade should be aborted.

AbortFunctionUpgradeRequest $postBody
array $optParams

Optional parameters.

Return Value

Operation

Exceptions

Exception

Operation commitFunctionUpgrade(string $name, CommitFunctionUpgradeRequest $postBody, array $optParams = [])

Finalizes the upgrade after which function upgrade can not be rolled back.

This is the last step of the multi step process to upgrade 1st Gen functions to 2nd Gen. Deletes all original 1st Gen related configuration and resources. (functions.commitFunctionUpgrade)

Parameters

string $name

Required. The name of the function for which upgrade should be finalized.

CommitFunctionUpgradeRequest $postBody
array $optParams

Optional parameters.

Return Value

Operation

Exceptions

Exception

Operation create(string $parent, CloudfunctionsFunction $postBody, array $optParams = [])

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. (functions.create)

Parameters

string $parent

Required. The project and location in which the function should be created, specified in the format projects/locations

CloudfunctionsFunction $postBody
array $optParams

Optional parameters.

Return Value

Operation

Exceptions

Exception

Operation delete(string $name, array $optParams = [])

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. (functions.delete)

Parameters

string $name

Required. The name of the function which should be deleted.

array $optParams

Optional parameters.

Return Value

Operation

Exceptions

Exception

GenerateDownloadUrlResponse generateDownloadUrl(string $name, GenerateDownloadUrlRequest $postBody, array $optParams = [])

Returns a signed URL for downloading deployed function source code. The URL is only valid for a limited period and should be used within 30 minutes of generation. For more information about the signed URL usage see: https://cloud.google.com/storage/docs/access-control/signed-urls (functions.generateDownloadUrl)

Parameters

string $name

Required. The name of function for which source code Google Cloud Storage signed URL should be generated.

GenerateDownloadUrlRequest $postBody
array $optParams

Optional parameters.

Return Value

GenerateDownloadUrlResponse

Exceptions

Exception

GenerateUploadUrlResponse generateUploadUrl(string $parent, GenerateUploadUrlRequest $postBody, array $optParams = [])

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. 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, specify this header: content-type: application/zip Do not specify this header: Authorization: Bearer YOUR_TOKEN (functions.generateUploadUrl)

Parameters

string $parent

Required. The project and location in which the Google Cloud Storage signed URL should be generated, specified in the format projects/locations.

GenerateUploadUrlRequest $postBody
array $optParams

Optional parameters.

Return Value

GenerateUploadUrlResponse

Exceptions

Exception

CloudfunctionsFunction get(string $name, array $optParams = [])

Returns a function with the given name from the requested project.

(functions.get)

Parameters

string $name

Required. The name of the function which details should be obtained.

array $optParams

Optional parameters.

Return Value

CloudfunctionsFunction

Exceptions

Exception

Policy getIamPolicy(string $resource, array $optParams = [])

Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set. (functions.getIamPolicy)

Parameters

string $resource

REQUIRED: The resource for which the policy is being requested. See Resource names for the appropriate value for this field.

array $optParams

Optional parameters.

Return Value

Policy

Exceptions

Exception

ListFunctionsResponse listProjectsLocationsFunctions(string $parent, array $optParams = [])

Returns a list of functions that belong to the requested project.

(functions.listProjectsLocationsFunctions)

Parameters

string $parent

Required. 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.

array $optParams

Optional parameters.

Return Value

ListFunctionsResponse

Exceptions

Exception

Operation patch(string $name, CloudfunctionsFunction $postBody, array $optParams = [])

Updates existing function. (functions.patch)

Parameters

string $name

A user-defined name of the function. Function names must be unique globally and match pattern projects/locations/functions

CloudfunctionsFunction $postBody
array $optParams

Optional parameters.

Return Value

Operation

Exceptions

Exception

Operation redirectFunctionUpgradeTraffic(string $name, RedirectFunctionUpgradeTrafficRequest $postBody, array $optParams = [])

Changes the traffic target of a function from the original 1st Gen function to the 2nd Gen copy. This is the second step of the multi step process to upgrade 1st Gen functions to 2nd Gen. After this operation, all new traffic will be served by 2nd Gen copy. (functions.redirectFunctionUpgradeTraffic)

Parameters

string $name

Required. The name of the function for which traffic target should be changed to 2nd Gen from 1st Gen.

RedirectFunctionUpgradeTrafficRequest $postBody
array $optParams

Optional parameters.

Return Value

Operation

Exceptions

Exception

Operation rollbackFunctionUpgradeTraffic(string $name, RollbackFunctionUpgradeTrafficRequest $postBody, array $optParams = [])

Reverts the traffic target of a function from the 2nd Gen copy to the original 1st Gen function. After this operation, all new traffic would be served by the 1st Gen. (functions.rollbackFunctionUpgradeTraffic)

Parameters

string $name

Required. The name of the function for which traffic target should be changed back to 1st Gen from 2nd Gen.

RollbackFunctionUpgradeTrafficRequest $postBody
array $optParams

Optional parameters.

Return Value

Operation

Exceptions

Exception

Policy setIamPolicy(string $resource, SetIamPolicyRequest $postBody, array $optParams = [])

Sets the access control policy on the specified resource. Replaces any existing policy. Can return NOT_FOUND, INVALID_ARGUMENT, and PERMISSION_DENIED errors. (functions.setIamPolicy)

Parameters

string $resource

REQUIRED: The resource for which the policy is being specified. See Resource names for the appropriate value for this field.

SetIamPolicyRequest $postBody
array $optParams

Optional parameters.

Return Value

Policy

Exceptions

Exception

Operation setupFunctionUpgradeConfig(string $name, SetupFunctionUpgradeConfigRequest $postBody, array $optParams = [])

Creates a 2nd Gen copy of the function configuration based on the 1st Gen function with the given name. This is the first step of the multi step process to upgrade 1st Gen functions to 2nd Gen. Only 2nd Gen configuration is setup as part of this request and traffic continues to be served by 1st Gen. (functions.setupFunctionUpgradeConfig)

Parameters

string $name

Required. The name of the function which should have configuration copied for upgrade.

SetupFunctionUpgradeConfigRequest $postBody
array $optParams

Optional parameters.

Return Value

Operation

Exceptions

Exception

TestIamPermissionsResponse testIamPermissions(string $resource, TestIamPermissionsRequest $postBody, array $optParams = [])

Returns permissions that a caller has on the specified resource. If the resource does not exist, this will return an empty set of permissions, not a NOT_FOUND error. Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking.

This operation may "fail open" without warning. (functions.testIamPermissions)

Parameters

string $resource

REQUIRED: The resource for which the policy detail is being requested. See Resource names for the appropriate value for this field.

TestIamPermissionsRequest $postBody
array $optParams

Optional parameters.

Return Value

TestIamPermissionsResponse

Exceptions

Exception