diff --git a/Functions/metadata/V1/Functions.php b/Functions/metadata/V1/Functions.php index d37bd3e582aa..b60a9c84ab58 100644 Binary files a/Functions/metadata/V1/Functions.php and b/Functions/metadata/V1/Functions.php differ diff --git a/Functions/samples/V1/CloudFunctionsServiceClient/create_function.php b/Functions/samples/V1/CloudFunctionsServiceClient/create_function.php index 6989f0f116da..7fc4f215f23f 100644 --- a/Functions/samples/V1/CloudFunctionsServiceClient/create_function.php +++ b/Functions/samples/V1/CloudFunctionsServiceClient/create_function.php @@ -31,11 +31,11 @@ /** * Creates a new function. If a function with the given name already exists in - * the specified project, the long running operation will return + * the specified project, the long running operation returns an * `ALREADY_EXISTS` error. * - * @param string $formattedLocation The project and location in which the function should be created, specified - * in the format `projects/*/locations/*` + * @param string $formattedLocation The project and location in which the function should be created, + * specified in the format `projects/*/locations/*` * Please see {@see CloudFunctionsServiceClient::locationName()} for help formatting this field. */ function create_function_sample(string $formattedLocation): void diff --git a/Functions/samples/V1/CloudFunctionsServiceClient/delete_function.php b/Functions/samples/V1/CloudFunctionsServiceClient/delete_function.php index 08e1b649f859..04db083bbd97 100644 --- a/Functions/samples/V1/CloudFunctionsServiceClient/delete_function.php +++ b/Functions/samples/V1/CloudFunctionsServiceClient/delete_function.php @@ -30,7 +30,7 @@ /** * 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 + * given function is used by some trigger, the trigger is updated to * remove this function. * * @param string $formattedName The name of the function which should be deleted. Please see diff --git a/Functions/samples/V1/CloudFunctionsServiceClient/generate_download_url.php b/Functions/samples/V1/CloudFunctionsServiceClient/generate_download_url.php index 37dd4e46ff28..2a8ca783e42b 100644 --- a/Functions/samples/V1/CloudFunctionsServiceClient/generate_download_url.php +++ b/Functions/samples/V1/CloudFunctionsServiceClient/generate_download_url.php @@ -29,9 +29,9 @@ /** * Returns a signed URL for downloading deployed function source code. - * The URL is only valid for a limited period and should be used within + * The URL is only valid for a limited period and must be used within * minutes after generation. - * For more information about the signed URL usage see: + * For more information about the signed URL usage, see: * https://cloud.google.com/storage/docs/access-control/signed-urls * * This sample has been automatically generated and should be regarded as a code diff --git a/Functions/samples/V1/CloudFunctionsServiceClient/generate_upload_url.php b/Functions/samples/V1/CloudFunctionsServiceClient/generate_upload_url.php index dc957a8616c5..2e936cffd92d 100644 --- a/Functions/samples/V1/CloudFunctionsServiceClient/generate_upload_url.php +++ b/Functions/samples/V1/CloudFunctionsServiceClient/generate_upload_url.php @@ -45,12 +45,12 @@ * 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: + * When making an HTTP PUT request, these two headers must be specified: * * * `content-type: application/zip` * * `x-goog-content-length-range: 0,104857600` * - * And this header SHOULD NOT be specified: + * And this header must NOT be specified: * * * `Authorization: Bearer YOUR_TOKEN` * diff --git a/Functions/samples/V1/CloudFunctionsServiceClient/list_locations.php b/Functions/samples/V1/CloudFunctionsServiceClient/list_locations.php new file mode 100644 index 000000000000..b20fdc6fff24 --- /dev/null +++ b/Functions/samples/V1/CloudFunctionsServiceClient/list_locations.php @@ -0,0 +1,58 @@ +listLocations(); + + /** @var Location $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END cloudfunctions_v1_generated_CloudFunctionsService_ListLocations_sync] diff --git a/Functions/samples/V1/CloudFunctionsServiceClient/test_iam_permissions.php b/Functions/samples/V1/CloudFunctionsServiceClient/test_iam_permissions.php index 369fbf023303..ce8d5fd2b719 100644 --- a/Functions/samples/V1/CloudFunctionsServiceClient/test_iam_permissions.php +++ b/Functions/samples/V1/CloudFunctionsServiceClient/test_iam_permissions.php @@ -30,7 +30,7 @@ /** * 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 + * If the function does not exist, this returns an empty set of * permissions, not a NOT_FOUND error. * * @param string $resource REQUIRED: The resource for which the policy detail is being requested. diff --git a/Functions/src/V1/CloudFunction.php b/Functions/src/V1/CloudFunction.php index 3ad7163a01c1..b450de7f942a 100644 --- a/Functions/src/V1/CloudFunction.php +++ b/Functions/src/V1/CloudFunction.php @@ -10,7 +10,7 @@ /** * Describes a Cloud Function that contains user computation executed in - * response to an event. It encapsulate function and triggers configurations. + * response to an event. It encapsulates function and triggers configurations. * * Generated from protobuf message google.cloud.functions.v1.CloudFunction */ @@ -36,12 +36,12 @@ class CloudFunction extends \Google\Protobuf\Internal\Message */ private $status = 0; /** - * The name of the function (as defined in source code) that will be - * executed. Defaults to the resource name suffix, if not specified. For - * backward compatibility, if function with given name is not found, then the - * system will try to use function named "function". - * For Node.js this is name of a function exported by the module specified - * in `source_location`. + * The name of the function (as defined in source code) that is executed. + * Defaults to the resource name suffix, if not specified. For + * backward compatibility, if function with given name is not found, the + * system tries to use the function named "function". + * For Node.js, this is the name of a function exported by the module + * as specified in `source_location`. * * Generated from protobuf field string entry_point = 8; */ @@ -85,8 +85,8 @@ class CloudFunction extends \Google\Protobuf\Internal\Message */ private $update_time = null; /** - * Output only. The version identifier of the Cloud Function. Each deployment attempt - * results in a new version of a function being created. + * Output only. The version identifier of the Cloud Function. Each deployment + * attempt results in a new version of a function being created. * * Generated from protobuf field int64 version_id = 14 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ @@ -110,11 +110,11 @@ class CloudFunction extends \Google\Protobuf\Internal\Message */ private $build_environment_variables; /** - * The VPC Network that this cloud function can connect to. It can be - * either the fully-qualified URI, or the short name of the network resource. - * If the short network name is used, the network must belong to the same - * project. Otherwise, it must belong to a project within the same - * organization. The format of this field is either + * The Serverless VPC Access connector that this cloud function can connect + * to. It can be either the fully qualified URI, or the short name of the + * connector resource. If the connector name is used, the connector must + * belong to the same project as the function. Otherwise, it must belong to a + * project within the same organization. The format of this field is either * `projects/{project}/global/networks/{network}` or `{network}`, where * `{project}` is a project id where the network is defined, and `{network}` * is the short name of the network. @@ -127,12 +127,12 @@ class CloudFunction extends \Google\Protobuf\Internal\Message */ private $network = ''; /** - * The limit on the maximum number of function instances that may coexist at a + * The limit on the maximum number of function instances that can coexist at a * given time. - * In some cases, such as rapid traffic surges, Cloud Functions may, for a - * short period of time, create more instances than the specified max + * In some cases, such as rapid traffic surges, Cloud Functions can for a + * short period of time create more instances than the specified max * instances limit. If your function cannot tolerate this temporary behavior, - * you may want to factor in a safety margin and set a lower max instances + * you might want to factor in a safety margin and set a lower max instances * value than your function can tolerate. * See the [Max * Instances](https://cloud.google.com/functions/docs/max-instances) Guide for @@ -142,7 +142,7 @@ class CloudFunction extends \Google\Protobuf\Internal\Message */ private $max_instances = 0; /** - * A lower bound for the number function instances that may coexist at a + * A lower bound for the number function instances that can coexist at a * given time. * * Generated from protobuf field int32 min_instances = 32; @@ -150,7 +150,7 @@ class CloudFunction extends \Google\Protobuf\Internal\Message private $min_instances = 0; /** * The VPC Network Connector that this cloud function can connect to. It can - * be either the fully-qualified URI, or the short name of the network + * be either the fully qualified URI, or the short name of the network * connector resource. The format of this field is * `projects/*/locations/*/connectors/*` * This field is mutually exclusive with `network` field and will eventually @@ -247,8 +247,8 @@ class CloudFunction extends \Google\Protobuf\Internal\Message */ private $secret_volumes; /** - * Input only. An identifier for Firebase function sources. Disclaimer: This field is only - * supported for Firebase function deployments. + * Input only. An identifier for Firebase function sources. Disclaimer: This + * field is only supported for Firebase function deployments. * * Generated from protobuf field string source_token = 31 [(.google.api.field_behavior) = INPUT_ONLY]; */ @@ -259,7 +259,7 @@ class CloudFunction extends \Google\Protobuf\Internal\Message * Artifact Registry. If unspecified and the deployment is eligible to use * Artifact Registry, GCF will create and use a repository named * 'gcf-artifacts' for every deployed region. This is the repository to which - * the function docker image will be pushed after it is built by Cloud Build. + * the function docker image is pushed after it is built by Cloud Build. * It must match the pattern * `projects/{project}/locations/{location}/repositories/{repository}`. * Cross-project repositories are not supported. @@ -271,7 +271,7 @@ class CloudFunction extends \Google\Protobuf\Internal\Message private $docker_repository = ''; /** * Docker Registry to use for this deployment. - * If `docker_repository` field is specified, this field will be automatically + * If `docker_repository` field is specified, this field is automatically * set as `ARTIFACT_REGISTRY`. * If unspecified, it currently defaults to `CONTAINER_REGISTRY`. * This field may be overridden by the backend for eligible deployments. @@ -300,7 +300,7 @@ class CloudFunction extends \Google\Protobuf\Internal\Message * **Beta Feature** * The source repository where a function is hosted. * @type string $source_upload_url - * The Google Cloud Storage signed URL used for source uploading, generated + * The Google Cloud Storage-signed URL used for source uploading, generated * by calling [google.cloud.functions.v1.GenerateUploadUrl]. * The signature is validated on write methods (Create, Update) * The signature is stripped from the Function object on read methods (Get, @@ -312,12 +312,12 @@ class CloudFunction extends \Google\Protobuf\Internal\Message * @type int $status * Output only. Status of the function deployment. * @type string $entry_point - * The name of the function (as defined in source code) that will be - * executed. Defaults to the resource name suffix, if not specified. For - * backward compatibility, if function with given name is not found, then the - * system will try to use function named "function". - * For Node.js this is name of a function exported by the module specified - * in `source_location`. + * The name of the function (as defined in source code) that is executed. + * Defaults to the resource name suffix, if not specified. For + * backward compatibility, if function with given name is not found, the + * system tries to use the function named "function". + * For Node.js, this is the name of a function exported by the module + * as specified in `source_location`. * @type string $runtime * The runtime in which to run the function. Required when deploying a new * function, optional when updating an existing function. For a complete @@ -337,8 +337,8 @@ class CloudFunction extends \Google\Protobuf\Internal\Message * @type \Google\Protobuf\Timestamp $update_time * Output only. The last update timestamp of a Cloud Function. * @type int|string $version_id - * Output only. The version identifier of the Cloud Function. Each deployment attempt - * results in a new version of a function being created. + * Output only. The version identifier of the Cloud Function. Each deployment + * attempt results in a new version of a function being created. * @type array|\Google\Protobuf\Internal\MapField $labels * Labels associated with this Cloud Function. * @type array|\Google\Protobuf\Internal\MapField $environment_variables @@ -346,11 +346,11 @@ class CloudFunction extends \Google\Protobuf\Internal\Message * @type array|\Google\Protobuf\Internal\MapField $build_environment_variables * Build environment variables that shall be available during build time. * @type string $network - * The VPC Network that this cloud function can connect to. It can be - * either the fully-qualified URI, or the short name of the network resource. - * If the short network name is used, the network must belong to the same - * project. Otherwise, it must belong to a project within the same - * organization. The format of this field is either + * The Serverless VPC Access connector that this cloud function can connect + * to. It can be either the fully qualified URI, or the short name of the + * connector resource. If the connector name is used, the connector must + * belong to the same project as the function. Otherwise, it must belong to a + * project within the same organization. The format of this field is either * `projects/{project}/global/networks/{network}` or `{network}`, where * `{project}` is a project id where the network is defined, and `{network}` * is the short name of the network. @@ -359,22 +359,22 @@ class CloudFunction extends \Google\Protobuf\Internal\Message * See [the VPC documentation](https://cloud.google.com/compute/docs/vpc) for * more information on connecting Cloud projects. * @type int $max_instances - * The limit on the maximum number of function instances that may coexist at a + * The limit on the maximum number of function instances that can coexist at a * given time. - * In some cases, such as rapid traffic surges, Cloud Functions may, for a - * short period of time, create more instances than the specified max + * In some cases, such as rapid traffic surges, Cloud Functions can for a + * short period of time create more instances than the specified max * instances limit. If your function cannot tolerate this temporary behavior, - * you may want to factor in a safety margin and set a lower max instances + * you might want to factor in a safety margin and set a lower max instances * value than your function can tolerate. * See the [Max * Instances](https://cloud.google.com/functions/docs/max-instances) Guide for * more details. * @type int $min_instances - * A lower bound for the number function instances that may coexist at a + * A lower bound for the number function instances that can coexist at a * given time. * @type string $vpc_connector * The VPC Network Connector that this cloud function can connect to. It can - * be either the fully-qualified URI, or the short name of the network + * be either the fully qualified URI, or the short name of the network * connector resource. The format of this field is * `projects/*/locations/*/connectors/*` * This field is mutually exclusive with `network` field and will eventually @@ -435,15 +435,15 @@ class CloudFunction extends \Google\Protobuf\Internal\Message * @type array<\Google\Cloud\Functions\V1\SecretVolume>|\Google\Protobuf\Internal\RepeatedField $secret_volumes * Secret volumes configuration. * @type string $source_token - * Input only. An identifier for Firebase function sources. Disclaimer: This field is only - * supported for Firebase function deployments. + * Input only. An identifier for Firebase function sources. Disclaimer: This + * field is only supported for Firebase function deployments. * @type string $docker_repository * User managed repository created in Artifact Registry optionally with a * customer managed encryption key. If specified, deployments will use * Artifact Registry. If unspecified and the deployment is eligible to use * Artifact Registry, GCF will create and use a repository named * 'gcf-artifacts' for every deployed region. This is the repository to which - * the function docker image will be pushed after it is built by Cloud Build. + * the function docker image is pushed after it is built by Cloud Build. * It must match the pattern * `projects/{project}/locations/{location}/repositories/{repository}`. * Cross-project repositories are not supported. @@ -451,7 +451,7 @@ class CloudFunction extends \Google\Protobuf\Internal\Message * Repository format must be 'DOCKER'. * @type int $docker_registry * Docker Registry to use for this deployment. - * If `docker_repository` field is specified, this field will be automatically + * If `docker_repository` field is specified, this field is automatically * set as `ARTIFACT_REGISTRY`. * If unspecified, it currently defaults to `CONTAINER_REGISTRY`. * This field may be overridden by the backend for eligible deployments. @@ -583,7 +583,7 @@ public function setSourceRepository($var) } /** - * The Google Cloud Storage signed URL used for source uploading, generated + * The Google Cloud Storage-signed URL used for source uploading, generated * by calling [google.cloud.functions.v1.GenerateUploadUrl]. * The signature is validated on write methods (Create, Update) * The signature is stripped from the Function object on read methods (Get, @@ -603,7 +603,7 @@ public function hasSourceUploadUrl() } /** - * The Google Cloud Storage signed URL used for source uploading, generated + * The Google Cloud Storage-signed URL used for source uploading, generated * by calling [google.cloud.functions.v1.GenerateUploadUrl]. * The signature is validated on write methods (Create, Update) * The signature is stripped from the Function object on read methods (Get, @@ -710,12 +710,12 @@ public function setStatus($var) } /** - * The name of the function (as defined in source code) that will be - * executed. Defaults to the resource name suffix, if not specified. For - * backward compatibility, if function with given name is not found, then the - * system will try to use function named "function". - * For Node.js this is name of a function exported by the module specified - * in `source_location`. + * The name of the function (as defined in source code) that is executed. + * Defaults to the resource name suffix, if not specified. For + * backward compatibility, if function with given name is not found, the + * system tries to use the function named "function". + * For Node.js, this is the name of a function exported by the module + * as specified in `source_location`. * * Generated from protobuf field string entry_point = 8; * @return string @@ -726,12 +726,12 @@ public function getEntryPoint() } /** - * The name of the function (as defined in source code) that will be - * executed. Defaults to the resource name suffix, if not specified. For - * backward compatibility, if function with given name is not found, then the - * system will try to use function named "function". - * For Node.js this is name of a function exported by the module specified - * in `source_location`. + * The name of the function (as defined in source code) that is executed. + * Defaults to the resource name suffix, if not specified. For + * backward compatibility, if function with given name is not found, the + * system tries to use the function named "function". + * For Node.js, this is the name of a function exported by the module + * as specified in `source_location`. * * Generated from protobuf field string entry_point = 8; * @param string $var @@ -912,8 +912,8 @@ public function setUpdateTime($var) } /** - * Output only. The version identifier of the Cloud Function. Each deployment attempt - * results in a new version of a function being created. + * Output only. The version identifier of the Cloud Function. Each deployment + * attempt results in a new version of a function being created. * * Generated from protobuf field int64 version_id = 14 [(.google.api.field_behavior) = OUTPUT_ONLY]; * @return int|string @@ -924,8 +924,8 @@ public function getVersionId() } /** - * Output only. The version identifier of the Cloud Function. Each deployment attempt - * results in a new version of a function being created. + * Output only. The version identifier of the Cloud Function. Each deployment + * attempt results in a new version of a function being created. * * Generated from protobuf field int64 version_id = 14 [(.google.api.field_behavior) = OUTPUT_ONLY]; * @param int|string $var @@ -1018,11 +1018,11 @@ public function setBuildEnvironmentVariables($var) } /** - * The VPC Network that this cloud function can connect to. It can be - * either the fully-qualified URI, or the short name of the network resource. - * If the short network name is used, the network must belong to the same - * project. Otherwise, it must belong to a project within the same - * organization. The format of this field is either + * The Serverless VPC Access connector that this cloud function can connect + * to. It can be either the fully qualified URI, or the short name of the + * connector resource. If the connector name is used, the connector must + * belong to the same project as the function. Otherwise, it must belong to a + * project within the same organization. The format of this field is either * `projects/{project}/global/networks/{network}` or `{network}`, where * `{project}` is a project id where the network is defined, and `{network}` * is the short name of the network. @@ -1040,11 +1040,11 @@ public function getNetwork() } /** - * The VPC Network that this cloud function can connect to. It can be - * either the fully-qualified URI, or the short name of the network resource. - * If the short network name is used, the network must belong to the same - * project. Otherwise, it must belong to a project within the same - * organization. The format of this field is either + * The Serverless VPC Access connector that this cloud function can connect + * to. It can be either the fully qualified URI, or the short name of the + * connector resource. If the connector name is used, the connector must + * belong to the same project as the function. Otherwise, it must belong to a + * project within the same organization. The format of this field is either * `projects/{project}/global/networks/{network}` or `{network}`, where * `{project}` is a project id where the network is defined, and `{network}` * is the short name of the network. @@ -1066,12 +1066,12 @@ public function setNetwork($var) } /** - * The limit on the maximum number of function instances that may coexist at a + * The limit on the maximum number of function instances that can coexist at a * given time. - * In some cases, such as rapid traffic surges, Cloud Functions may, for a - * short period of time, create more instances than the specified max + * In some cases, such as rapid traffic surges, Cloud Functions can for a + * short period of time create more instances than the specified max * instances limit. If your function cannot tolerate this temporary behavior, - * you may want to factor in a safety margin and set a lower max instances + * you might want to factor in a safety margin and set a lower max instances * value than your function can tolerate. * See the [Max * Instances](https://cloud.google.com/functions/docs/max-instances) Guide for @@ -1086,12 +1086,12 @@ public function getMaxInstances() } /** - * The limit on the maximum number of function instances that may coexist at a + * The limit on the maximum number of function instances that can coexist at a * given time. - * In some cases, such as rapid traffic surges, Cloud Functions may, for a - * short period of time, create more instances than the specified max + * In some cases, such as rapid traffic surges, Cloud Functions can for a + * short period of time create more instances than the specified max * instances limit. If your function cannot tolerate this temporary behavior, - * you may want to factor in a safety margin and set a lower max instances + * you might want to factor in a safety margin and set a lower max instances * value than your function can tolerate. * See the [Max * Instances](https://cloud.google.com/functions/docs/max-instances) Guide for @@ -1110,7 +1110,7 @@ public function setMaxInstances($var) } /** - * A lower bound for the number function instances that may coexist at a + * A lower bound for the number function instances that can coexist at a * given time. * * Generated from protobuf field int32 min_instances = 32; @@ -1122,7 +1122,7 @@ public function getMinInstances() } /** - * A lower bound for the number function instances that may coexist at a + * A lower bound for the number function instances that can coexist at a * given time. * * Generated from protobuf field int32 min_instances = 32; @@ -1139,7 +1139,7 @@ public function setMinInstances($var) /** * The VPC Network Connector that this cloud function can connect to. It can - * be either the fully-qualified URI, or the short name of the network + * be either the fully qualified URI, or the short name of the network * connector resource. The format of this field is * `projects/*/locations/*/connectors/*` * This field is mutually exclusive with `network` field and will eventually @@ -1157,7 +1157,7 @@ public function getVpcConnector() /** * The VPC Network Connector that this cloud function can connect to. It can - * be either the fully-qualified URI, or the short name of the network + * be either the fully qualified URI, or the short name of the network * connector resource. The format of this field is * `projects/*/locations/*/connectors/*` * This field is mutually exclusive with `network` field and will eventually @@ -1460,8 +1460,8 @@ public function setSecretVolumes($var) } /** - * Input only. An identifier for Firebase function sources. Disclaimer: This field is only - * supported for Firebase function deployments. + * Input only. An identifier for Firebase function sources. Disclaimer: This + * field is only supported for Firebase function deployments. * * Generated from protobuf field string source_token = 31 [(.google.api.field_behavior) = INPUT_ONLY]; * @return string @@ -1472,8 +1472,8 @@ public function getSourceToken() } /** - * Input only. An identifier for Firebase function sources. Disclaimer: This field is only - * supported for Firebase function deployments. + * Input only. An identifier for Firebase function sources. Disclaimer: This + * field is only supported for Firebase function deployments. * * Generated from protobuf field string source_token = 31 [(.google.api.field_behavior) = INPUT_ONLY]; * @param string $var @@ -1493,7 +1493,7 @@ public function setSourceToken($var) * Artifact Registry. If unspecified and the deployment is eligible to use * Artifact Registry, GCF will create and use a repository named * 'gcf-artifacts' for every deployed region. This is the repository to which - * the function docker image will be pushed after it is built by Cloud Build. + * the function docker image is pushed after it is built by Cloud Build. * It must match the pattern * `projects/{project}/locations/{location}/repositories/{repository}`. * Cross-project repositories are not supported. @@ -1514,7 +1514,7 @@ public function getDockerRepository() * Artifact Registry. If unspecified and the deployment is eligible to use * Artifact Registry, GCF will create and use a repository named * 'gcf-artifacts' for every deployed region. This is the repository to which - * the function docker image will be pushed after it is built by Cloud Build. + * the function docker image is pushed after it is built by Cloud Build. * It must match the pattern * `projects/{project}/locations/{location}/repositories/{repository}`. * Cross-project repositories are not supported. @@ -1535,7 +1535,7 @@ public function setDockerRepository($var) /** * Docker Registry to use for this deployment. - * If `docker_repository` field is specified, this field will be automatically + * If `docker_repository` field is specified, this field is automatically * set as `ARTIFACT_REGISTRY`. * If unspecified, it currently defaults to `CONTAINER_REGISTRY`. * This field may be overridden by the backend for eligible deployments. @@ -1550,7 +1550,7 @@ public function getDockerRegistry() /** * Docker Registry to use for this deployment. - * If `docker_repository` field is specified, this field will be automatically + * If `docker_repository` field is specified, this field is automatically * set as `ARTIFACT_REGISTRY`. * If unspecified, it currently defaults to `CONTAINER_REGISTRY`. * This field may be overridden by the backend for eligible deployments. diff --git a/Functions/src/V1/CloudFunction/DockerRegistry.php b/Functions/src/V1/CloudFunction/DockerRegistry.php index 754aa937ed87..7fdc4346226e 100644 --- a/Functions/src/V1/CloudFunction/DockerRegistry.php +++ b/Functions/src/V1/CloudFunction/DockerRegistry.php @@ -20,18 +20,18 @@ class DockerRegistry */ const DOCKER_REGISTRY_UNSPECIFIED = 0; /** - * Docker images will be stored in multi-regional Container Registry + * Docker images are stored in multi-regional Container Registry * repositories named `gcf`. * * Generated from protobuf enum CONTAINER_REGISTRY = 1; */ const CONTAINER_REGISTRY = 1; /** - * Docker images will be stored in regional Artifact Registry repositories. - * By default, GCF will create and use repositories named `gcf-artifacts` - * in every region in which a function is deployed. But the repository to - * use can also be specified by the user using the `docker_repository` - * field. + * Docker images are stored in regional Artifact Registry repositories. + * By default, Cloud Functions creates and uses repositories named + * `gcf-artifacts` in every region in which a function is deployed. But the + * repository to use can also be specified by the user by using the + * `docker_repository` field. * * Generated from protobuf enum ARTIFACT_REGISTRY = 2; */ diff --git a/Functions/src/V1/CloudFunction/IngressSettings.php b/Functions/src/V1/CloudFunction/IngressSettings.php index 628fc4bb407f..4921e3027121 100644 --- a/Functions/src/V1/CloudFunction/IngressSettings.php +++ b/Functions/src/V1/CloudFunction/IngressSettings.php @@ -9,7 +9,7 @@ /** * Available ingress settings. * This controls what traffic can reach the function. - * If unspecified, ALLOW_ALL will be used. + * If unspecified, ALLOW_ALL is used. * * Protobuf type google.cloud.functions.v1.CloudFunction.IngressSettings */ diff --git a/Functions/src/V1/CloudFunction/VpcConnectorEgressSettings.php b/Functions/src/V1/CloudFunction/VpcConnectorEgressSettings.php index 406bab72d4be..4dccd894f72d 100644 --- a/Functions/src/V1/CloudFunction/VpcConnectorEgressSettings.php +++ b/Functions/src/V1/CloudFunction/VpcConnectorEgressSettings.php @@ -8,8 +8,8 @@ /** * Available egress settings. - * This controls what traffic is diverted through the VPC Access Connector - * resource. By default PRIVATE_RANGES_ONLY will be used. + * This controls what traffic is diverted through the Serverless VPC Access + * connector resource. By default, PRIVATE_RANGES_ONLY is used. * * Protobuf type google.cloud.functions.v1.CloudFunction.VpcConnectorEgressSettings */ @@ -22,14 +22,15 @@ class VpcConnectorEgressSettings */ const VPC_CONNECTOR_EGRESS_SETTINGS_UNSPECIFIED = 0; /** - * Use the VPC Access Connector only for private IP space from RFC1918. + * Use the Serverless VPC Access connector only for private IP space from + * RFC1918. * * Generated from protobuf enum PRIVATE_RANGES_ONLY = 1; */ const PRIVATE_RANGES_ONLY = 1; /** - * Force the use of VPC Access Connector for all egress traffic from the - * function. + * Force the use of Serverless VPC Access connector for all egress traffic + * from the function. * * Generated from protobuf enum ALL_TRAFFIC = 2; */ diff --git a/Functions/src/V1/CreateFunctionRequest.php b/Functions/src/V1/CreateFunctionRequest.php index c8eb147a4718..19f1eab96860 100644 --- a/Functions/src/V1/CreateFunctionRequest.php +++ b/Functions/src/V1/CreateFunctionRequest.php @@ -16,8 +16,8 @@ class CreateFunctionRequest extends \Google\Protobuf\Internal\Message { /** - * Required. The project and location in which the function should be created, specified - * in the format `projects/*/locations/*` + * Required. The project and location in which the function should be created, + * specified in the format `projects/*/locations/*` * * Generated from protobuf field string location = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ @@ -36,8 +36,8 @@ class CreateFunctionRequest extends \Google\Protobuf\Internal\Message * Optional. Data for populating the Message object. * * @type string $location - * Required. The project and location in which the function should be created, specified - * in the format `projects/*/locations/*` + * Required. The project and location in which the function should be created, + * specified in the format `projects/*/locations/*` * @type \Google\Cloud\Functions\V1\CloudFunction $function * Required. Function to be created. * } @@ -48,8 +48,8 @@ public function __construct($data = NULL) { } /** - * Required. The project and location in which the function should be created, specified - * in the format `projects/*/locations/*` + * Required. The project and location in which the function should be created, + * specified in the format `projects/*/locations/*` * * Generated from protobuf field string location = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { * @return string @@ -60,8 +60,8 @@ public function getLocation() } /** - * Required. The project and location in which the function should be created, specified - * in the format `projects/*/locations/*` + * Required. The project and location in which the function should be created, + * specified in the format `projects/*/locations/*` * * Generated from protobuf field string location = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { * @param string $var diff --git a/Functions/src/V1/EventTrigger.php b/Functions/src/V1/EventTrigger.php index 5077fe9af240..8cbcf1a743d4 100644 --- a/Functions/src/V1/EventTrigger.php +++ b/Functions/src/V1/EventTrigger.php @@ -9,7 +9,7 @@ use Google\Protobuf\Internal\GPBUtil; /** - * Describes EventTrigger, used to request events be sent from another + * Describes EventTrigger, used to request that events be sent from another * service. * * Generated from protobuf message google.cloud.functions.v1.EventTrigger @@ -28,7 +28,7 @@ class EventTrigger extends \Google\Protobuf\Internal\Message * example, the Google Cloud Storage API includes the type `object`. * 3. action: The action that generates the event. For example, action for * a Google Cloud Storage Object is 'change'. - * These parts are lower case. + * These parts are lowercase. * * Generated from protobuf field string event_type = 1; */ @@ -46,7 +46,7 @@ class EventTrigger extends \Google\Protobuf\Internal\Message * `event_type` of "google.pubsub.topic.publish" should have a resource * that matches Google Cloud Pub/Sub topics. * Additionally, some services may support short names when creating an - * `EventTrigger`. These will always be returned in the normalized "long" + * `EventTrigger`. These are always returned in the normalized "long" * format. * See each *service's* documentation for supported formats. * @@ -87,7 +87,7 @@ class EventTrigger extends \Google\Protobuf\Internal\Message * example, the Google Cloud Storage API includes the type `object`. * 3. action: The action that generates the event. For example, action for * a Google Cloud Storage Object is 'change'. - * These parts are lower case. + * These parts are lowercase. * @type string $resource * Required. The resource(s) from which to observe events, for example, * `projects/_/buckets/myBucket`. @@ -101,7 +101,7 @@ class EventTrigger extends \Google\Protobuf\Internal\Message * `event_type` of "google.pubsub.topic.publish" should have a resource * that matches Google Cloud Pub/Sub topics. * Additionally, some services may support short names when creating an - * `EventTrigger`. These will always be returned in the normalized "long" + * `EventTrigger`. These are always returned in the normalized "long" * format. * See each *service's* documentation for supported formats. * @type string $service @@ -130,7 +130,7 @@ public function __construct($data = NULL) { * example, the Google Cloud Storage API includes the type `object`. * 3. action: The action that generates the event. For example, action for * a Google Cloud Storage Object is 'change'. - * These parts are lower case. + * These parts are lowercase. * * Generated from protobuf field string event_type = 1; * @return string @@ -152,7 +152,7 @@ public function getEventType() * example, the Google Cloud Storage API includes the type `object`. * 3. action: The action that generates the event. For example, action for * a Google Cloud Storage Object is 'change'. - * These parts are lower case. + * These parts are lowercase. * * Generated from protobuf field string event_type = 1; * @param string $var @@ -179,7 +179,7 @@ public function setEventType($var) * `event_type` of "google.pubsub.topic.publish" should have a resource * that matches Google Cloud Pub/Sub topics. * Additionally, some services may support short names when creating an - * `EventTrigger`. These will always be returned in the normalized "long" + * `EventTrigger`. These are always returned in the normalized "long" * format. * See each *service's* documentation for supported formats. * @@ -204,7 +204,7 @@ public function getResource() * `event_type` of "google.pubsub.topic.publish" should have a resource * that matches Google Cloud Pub/Sub topics. * Additionally, some services may support short names when creating an - * `EventTrigger`. These will always be returned in the normalized "long" + * `EventTrigger`. These are always returned in the normalized "long" * format. * See each *service's* documentation for supported formats. * diff --git a/Functions/src/V1/FailurePolicy.php b/Functions/src/V1/FailurePolicy.php index f81b50f6d779..e6f712158eb6 100644 --- a/Functions/src/V1/FailurePolicy.php +++ b/Functions/src/V1/FailurePolicy.php @@ -10,7 +10,7 @@ /** * Describes the policy in case of function's execution failure. - * If empty, then defaults to ignoring failures (i.e. not retrying them). + * If empty, then defaults to ignoring failures (i.e., not retrying them). * * Generated from protobuf message google.cloud.functions.v1.FailurePolicy */ @@ -25,7 +25,7 @@ class FailurePolicy extends \Google\Protobuf\Internal\Message * Optional. Data for populating the Message object. * * @type \Google\Cloud\Functions\V1\FailurePolicy\Retry $retry - * If specified, then the function will be retried in case of a failure. + * If specified, the function is retried in case of a failure. * } */ public function __construct($data = NULL) { @@ -34,7 +34,7 @@ public function __construct($data = NULL) { } /** - * If specified, then the function will be retried in case of a failure. + * If specified, the function is retried in case of a failure. * * Generated from protobuf field .google.cloud.functions.v1.FailurePolicy.Retry retry = 1; * @return \Google\Cloud\Functions\V1\FailurePolicy\Retry|null @@ -50,7 +50,7 @@ public function hasRetry() } /** - * If specified, then the function will be retried in case of a failure. + * If specified, the function is retried in case of a failure. * * Generated from protobuf field .google.cloud.functions.v1.FailurePolicy.Retry retry = 1; * @param \Google\Cloud\Functions\V1\FailurePolicy\Retry $var diff --git a/Functions/src/V1/FailurePolicy/Retry.php b/Functions/src/V1/FailurePolicy/Retry.php index 062b6f1ac609..f64380d6d38e 100644 --- a/Functions/src/V1/FailurePolicy/Retry.php +++ b/Functions/src/V1/FailurePolicy/Retry.php @@ -10,8 +10,8 @@ /** * Describes the retry policy in case of function's execution failure. - * A function execution will be retried on any failure. - * A failed execution will be retried up to 7 days with an exponential backoff + * A function execution is retried on any failure. + * A failed execution is retried up to 7 days with an exponential backoff * (capped at 10 seconds). * Retried execution is charged as any other execution. * diff --git a/Functions/src/V1/Gapic/CloudFunctionsServiceGapicClient.php b/Functions/src/V1/Gapic/CloudFunctionsServiceGapicClient.php index 5dc164b6203d..2d144e86483b 100644 --- a/Functions/src/V1/Gapic/CloudFunctionsServiceGapicClient.php +++ b/Functions/src/V1/Gapic/CloudFunctionsServiceGapicClient.php @@ -54,6 +54,8 @@ use Google\Cloud\Iam\V1\SetIamPolicyRequest; use Google\Cloud\Iam\V1\TestIamPermissionsRequest; use Google\Cloud\Iam\V1\TestIamPermissionsResponse; +use Google\Cloud\Location\ListLocationsRequest; +use Google\Cloud\Location\ListLocationsResponse; use Google\LongRunning\Operation; use Google\Protobuf\FieldMask; @@ -478,7 +480,7 @@ public function callFunction($name, $data, array $optionalArgs = []) /** * Creates a new function. If a function with the given name already exists in - * the specified project, the long running operation will return + * the specified project, the long running operation returns an * `ALREADY_EXISTS` error. * * Sample code: @@ -518,8 +520,8 @@ public function callFunction($name, $data, array $optionalArgs = []) * } * ``` * - * @param string $location Required. The project and location in which the function should be created, specified - * in the format `projects/*/locations/*` + * @param string $location Required. The project and location in which the function should be created, + * specified in the format `projects/*/locations/*` * @param CloudFunction $function Required. Function to be created. * @param array $optionalArgs { * Optional. @@ -560,7 +562,7 @@ public function createFunction( /** * 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 + * given function is used by some trigger, the trigger is updated to * remove this function. * * Sample code: @@ -633,9 +635,9 @@ public function deleteFunction($name, array $optionalArgs = []) /** * Returns a signed URL for downloading deployed function source code. - * The URL is only valid for a limited period and should be used within + * The URL is only valid for a limited period and must be used within * minutes after generation. - * For more information about the signed URL usage see: + * For more information about the signed URL usage, see: * https://cloud.google.com/storage/docs/access-control/signed-urls * * Sample code: @@ -712,12 +714,12 @@ public function generateDownloadUrl(array $optionalArgs = []) * 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: + * When making an HTTP PUT request, these two headers must be specified: * * * `content-type: application/zip` * * `x-goog-content-length-range: 0,104857600` * - * And this header SHOULD NOT be specified: + * And this header must NOT be specified: * * * `Authorization: Bearer YOUR_TOKEN` * @@ -1052,7 +1054,7 @@ public function setIamPolicy($resource, $policy, array $optionalArgs = []) /** * 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 + * If the function does not exist, this returns an empty set of * permissions, not a NOT_FOUND error. * * Sample code: @@ -1188,4 +1190,91 @@ public function updateFunction($function, array $optionalArgs = []) $this->getOperationsClient() )->wait(); } + + /** + * Lists information about the supported locations for this service. + * + * Sample code: + * ``` + * $cloudFunctionsServiceClient = new CloudFunctionsServiceClient(); + * try { + * // Iterate over pages of elements + * $pagedResponse = $cloudFunctionsServiceClient->listLocations(); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $cloudFunctionsServiceClient->listLocations(); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $cloudFunctionsServiceClient->close(); + * } + * ``` + * + * @param array $optionalArgs { + * Optional. + * + * @type string $name + * The resource that owns the locations collection, if applicable. + * @type string $filter + * The standard list filter. + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listLocations(array $optionalArgs = []) + { + $request = new ListLocationsRequest(); + $requestParamHeaders = []; + if (isset($optionalArgs['name'])) { + $request->setName($optionalArgs['name']); + $requestParamHeaders['name'] = $optionalArgs['name']; + } + + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor( + $requestParamHeaders + ); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + return $this->getPagedListResponse( + 'ListLocations', + $optionalArgs, + ListLocationsResponse::class, + $request, + 'google.cloud.location.Locations' + ); + } } diff --git a/Functions/src/V1/HttpsTrigger.php b/Functions/src/V1/HttpsTrigger.php index 617101cfe760..1fafae709ebe 100644 --- a/Functions/src/V1/HttpsTrigger.php +++ b/Functions/src/V1/HttpsTrigger.php @@ -16,7 +16,7 @@ class HttpsTrigger extends \Google\Protobuf\Internal\Message { /** - * Output only. The deployed url for the function. + * Output only. The deployed URL for the function. * * Generated from protobuf field string url = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ @@ -35,7 +35,7 @@ class HttpsTrigger extends \Google\Protobuf\Internal\Message * Optional. Data for populating the Message object. * * @type string $url - * Output only. The deployed url for the function. + * Output only. The deployed URL for the function. * @type int $security_level * The security level for the function. * } @@ -46,7 +46,7 @@ public function __construct($data = NULL) { } /** - * Output only. The deployed url for the function. + * Output only. The deployed URL for the function. * * Generated from protobuf field string url = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; * @return string @@ -57,7 +57,7 @@ public function getUrl() } /** - * Output only. The deployed url for the function. + * Output only. The deployed URL for the function. * * Generated from protobuf field string url = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; * @param string $var diff --git a/Functions/src/V1/HttpsTrigger/SecurityLevel.php b/Functions/src/V1/HttpsTrigger/SecurityLevel.php index 68089ebbb2da..6f5ba27b0831 100644 --- a/Functions/src/V1/HttpsTrigger/SecurityLevel.php +++ b/Functions/src/V1/HttpsTrigger/SecurityLevel.php @@ -7,9 +7,9 @@ use UnexpectedValueException; /** - * Available security level settings. + * Available security-level settings. * This controls the methods to enforce security (HTTPS) on a URL. - * If unspecified, SECURE_OPTIONAL will be used. + * If unspecified, SECURE_OPTIONAL is used. * * Protobuf type google.cloud.functions.v1.HttpsTrigger.SecurityLevel */ diff --git a/Functions/src/V1/SecretEnvVar.php b/Functions/src/V1/SecretEnvVar.php index 7271ad4f3924..2844a1b74c29 100644 --- a/Functions/src/V1/SecretEnvVar.php +++ b/Functions/src/V1/SecretEnvVar.php @@ -10,7 +10,7 @@ /** * Configuration for a secret environment variable. It has the information - * necessary to fetch the secret value from secret manager and expose it as an + * necessary to fetch the secret value from Secret Manager and expose it as an * environment variable. * * Generated from protobuf message google.cloud.functions.v1.SecretEnvVar @@ -25,15 +25,15 @@ class SecretEnvVar extends \Google\Protobuf\Internal\Message private $key = ''; /** * Project identifier (preferrably project number but can also be the project - * ID) of the project that contains the secret. If not set, it will be - * populated with the function's project assuming that the secret exists in - * the same project as of the function. + * ID) of the project that contains the secret. If not set, it is + * populated with the function's project, assuming that the secret exists in + * the same project as the function. * * Generated from protobuf field string project_id = 2; */ private $project_id = ''; /** - * Name of the secret in secret manager (not the full resource name). + * Name of the secret in Secret Manager (not the full resource name). * * Generated from protobuf field string secret = 3; */ @@ -57,11 +57,11 @@ class SecretEnvVar extends \Google\Protobuf\Internal\Message * Name of the environment variable. * @type string $project_id * Project identifier (preferrably project number but can also be the project - * ID) of the project that contains the secret. If not set, it will be - * populated with the function's project assuming that the secret exists in - * the same project as of the function. + * ID) of the project that contains the secret. If not set, it is + * populated with the function's project, assuming that the secret exists in + * the same project as the function. * @type string $secret - * Name of the secret in secret manager (not the full resource name). + * Name of the secret in Secret Manager (not the full resource name). * @type string $version * Version of the secret (version number or the string 'latest'). It is * recommended to use a numeric version for secret environment variables as @@ -101,9 +101,9 @@ public function setKey($var) /** * Project identifier (preferrably project number but can also be the project - * ID) of the project that contains the secret. If not set, it will be - * populated with the function's project assuming that the secret exists in - * the same project as of the function. + * ID) of the project that contains the secret. If not set, it is + * populated with the function's project, assuming that the secret exists in + * the same project as the function. * * Generated from protobuf field string project_id = 2; * @return string @@ -115,9 +115,9 @@ public function getProjectId() /** * Project identifier (preferrably project number but can also be the project - * ID) of the project that contains the secret. If not set, it will be - * populated with the function's project assuming that the secret exists in - * the same project as of the function. + * ID) of the project that contains the secret. If not set, it is + * populated with the function's project, assuming that the secret exists in + * the same project as the function. * * Generated from protobuf field string project_id = 2; * @param string $var @@ -132,7 +132,7 @@ public function setProjectId($var) } /** - * Name of the secret in secret manager (not the full resource name). + * Name of the secret in Secret Manager (not the full resource name). * * Generated from protobuf field string secret = 3; * @return string @@ -143,7 +143,7 @@ public function getSecret() } /** - * Name of the secret in secret manager (not the full resource name). + * Name of the secret in Secret Manager (not the full resource name). * * Generated from protobuf field string secret = 3; * @param string $var diff --git a/Functions/src/V1/SecretVolume.php b/Functions/src/V1/SecretVolume.php index 44905ba05fe1..6fd39f71d94c 100644 --- a/Functions/src/V1/SecretVolume.php +++ b/Functions/src/V1/SecretVolume.php @@ -10,10 +10,10 @@ /** * Configuration for a secret volume. It has the information necessary to fetch - * the secret value from secret manager and make it available as files mounted + * the secret value from Secret Manager and make it available as files mounted * at the requested paths within the application container. Secret value is not - * a part of the configuration. Every filesystem read operation performs a - * lookup in secret manager to retrieve the secret value. + * a part of the configuration. Every file system read operation performs a + * lookup in Secret Manager to retrieve the secret value. * * Generated from protobuf message google.cloud.functions.v1.SecretVolume */ @@ -21,8 +21,8 @@ class SecretVolume extends \Google\Protobuf\Internal\Message { /** * The path within the container to mount the secret volume. For example, - * setting the mount_path as `/etc/secrets` would mount the secret value files - * under the `/etc/secrets` directory. This directory will also be completely + * setting the mount_path as `/etc/secrets` mounts the secret value files + * under the `/etc/secrets` directory. This directory is also completely * shadowed and unavailable to mount any other secrets. * Recommended mount paths: /etc/secrets * Restricted mount paths: /cloudsql, /dev/log, /pod, /proc, /var/log @@ -32,22 +32,22 @@ class SecretVolume extends \Google\Protobuf\Internal\Message private $mount_path = ''; /** * Project identifier (preferrably project number but can also be the project - * ID) of the project that contains the secret. If not set, it will be - * populated with the function's project assuming that the secret exists in - * the same project as of the function. + * ID) of the project that contains the secret. If not set, it is + * populated with the function's project, assuming that the secret exists in + * the same project as the function. * * Generated from protobuf field string project_id = 2; */ private $project_id = ''; /** - * Name of the secret in secret manager (not the full resource name). + * Name of the secret in Secret Manager (not the full resource name). * * Generated from protobuf field string secret = 3; */ private $secret = ''; /** * List of secret versions to mount for this secret. If empty, the `latest` - * version of the secret will be made available in a file named after the + * version of the secret is made available in a file named after the * secret under the mount point. * * Generated from protobuf field repeated .google.cloud.functions.v1.SecretVolume.SecretVersion versions = 4; @@ -62,21 +62,21 @@ class SecretVolume extends \Google\Protobuf\Internal\Message * * @type string $mount_path * The path within the container to mount the secret volume. For example, - * setting the mount_path as `/etc/secrets` would mount the secret value files - * under the `/etc/secrets` directory. This directory will also be completely + * setting the mount_path as `/etc/secrets` mounts the secret value files + * under the `/etc/secrets` directory. This directory is also completely * shadowed and unavailable to mount any other secrets. * Recommended mount paths: /etc/secrets * Restricted mount paths: /cloudsql, /dev/log, /pod, /proc, /var/log * @type string $project_id * Project identifier (preferrably project number but can also be the project - * ID) of the project that contains the secret. If not set, it will be - * populated with the function's project assuming that the secret exists in - * the same project as of the function. + * ID) of the project that contains the secret. If not set, it is + * populated with the function's project, assuming that the secret exists in + * the same project as the function. * @type string $secret - * Name of the secret in secret manager (not the full resource name). + * Name of the secret in Secret Manager (not the full resource name). * @type array<\Google\Cloud\Functions\V1\SecretVolume\SecretVersion>|\Google\Protobuf\Internal\RepeatedField $versions * List of secret versions to mount for this secret. If empty, the `latest` - * version of the secret will be made available in a file named after the + * version of the secret is made available in a file named after the * secret under the mount point. * } */ @@ -87,8 +87,8 @@ public function __construct($data = NULL) { /** * The path within the container to mount the secret volume. For example, - * setting the mount_path as `/etc/secrets` would mount the secret value files - * under the `/etc/secrets` directory. This directory will also be completely + * setting the mount_path as `/etc/secrets` mounts the secret value files + * under the `/etc/secrets` directory. This directory is also completely * shadowed and unavailable to mount any other secrets. * Recommended mount paths: /etc/secrets * Restricted mount paths: /cloudsql, /dev/log, /pod, /proc, /var/log @@ -103,8 +103,8 @@ public function getMountPath() /** * The path within the container to mount the secret volume. For example, - * setting the mount_path as `/etc/secrets` would mount the secret value files - * under the `/etc/secrets` directory. This directory will also be completely + * setting the mount_path as `/etc/secrets` mounts the secret value files + * under the `/etc/secrets` directory. This directory is also completely * shadowed and unavailable to mount any other secrets. * Recommended mount paths: /etc/secrets * Restricted mount paths: /cloudsql, /dev/log, /pod, /proc, /var/log @@ -123,9 +123,9 @@ public function setMountPath($var) /** * Project identifier (preferrably project number but can also be the project - * ID) of the project that contains the secret. If not set, it will be - * populated with the function's project assuming that the secret exists in - * the same project as of the function. + * ID) of the project that contains the secret. If not set, it is + * populated with the function's project, assuming that the secret exists in + * the same project as the function. * * Generated from protobuf field string project_id = 2; * @return string @@ -137,9 +137,9 @@ public function getProjectId() /** * Project identifier (preferrably project number but can also be the project - * ID) of the project that contains the secret. If not set, it will be - * populated with the function's project assuming that the secret exists in - * the same project as of the function. + * ID) of the project that contains the secret. If not set, it is + * populated with the function's project, assuming that the secret exists in + * the same project as the function. * * Generated from protobuf field string project_id = 2; * @param string $var @@ -154,7 +154,7 @@ public function setProjectId($var) } /** - * Name of the secret in secret manager (not the full resource name). + * Name of the secret in Secret Manager (not the full resource name). * * Generated from protobuf field string secret = 3; * @return string @@ -165,7 +165,7 @@ public function getSecret() } /** - * Name of the secret in secret manager (not the full resource name). + * Name of the secret in Secret Manager (not the full resource name). * * Generated from protobuf field string secret = 3; * @param string $var @@ -181,7 +181,7 @@ public function setSecret($var) /** * List of secret versions to mount for this secret. If empty, the `latest` - * version of the secret will be made available in a file named after the + * version of the secret is made available in a file named after the * secret under the mount point. * * Generated from protobuf field repeated .google.cloud.functions.v1.SecretVolume.SecretVersion versions = 4; @@ -194,7 +194,7 @@ public function getVersions() /** * List of secret versions to mount for this secret. If empty, the `latest` - * version of the secret will be made available in a file named after the + * version of the secret is made available in a file named after the * secret under the mount point. * * Generated from protobuf field repeated .google.cloud.functions.v1.SecretVolume.SecretVersion versions = 4; diff --git a/Functions/src/V1/SecretVolume/SecretVersion.php b/Functions/src/V1/SecretVolume/SecretVersion.php index 8fe49f9d8afd..c7ab24ef116b 100644 --- a/Functions/src/V1/SecretVolume/SecretVersion.php +++ b/Functions/src/V1/SecretVolume/SecretVersion.php @@ -17,7 +17,7 @@ class SecretVersion extends \Google\Protobuf\Internal\Message { /** * Version of the secret (version number or the string 'latest'). It is - * preferrable to use `latest` version with secret volumes as secret value + * preferable to use `latest` version with secret volumes as secret value * changes are reflected immediately. * * Generated from protobuf field string version = 1; @@ -25,8 +25,8 @@ class SecretVersion extends \Google\Protobuf\Internal\Message private $version = ''; /** * Relative path of the file under the mount path where the secret value for - * this version will be fetched and made available. For example, setting the - * mount_path as '/etc/secrets' and path as `/secret_foo` would mount the + * this version is fetched and made available. For example, setting the + * mount_path as '/etc/secrets' and path as `/secret_foo` mounts the * secret value file at `/etc/secrets/secret_foo`. * * Generated from protobuf field string path = 2; @@ -41,12 +41,12 @@ class SecretVersion extends \Google\Protobuf\Internal\Message * * @type string $version * Version of the secret (version number or the string 'latest'). It is - * preferrable to use `latest` version with secret volumes as secret value + * preferable to use `latest` version with secret volumes as secret value * changes are reflected immediately. * @type string $path * Relative path of the file under the mount path where the secret value for - * this version will be fetched and made available. For example, setting the - * mount_path as '/etc/secrets' and path as `/secret_foo` would mount the + * this version is fetched and made available. For example, setting the + * mount_path as '/etc/secrets' and path as `/secret_foo` mounts the * secret value file at `/etc/secrets/secret_foo`. * } */ @@ -57,7 +57,7 @@ public function __construct($data = NULL) { /** * Version of the secret (version number or the string 'latest'). It is - * preferrable to use `latest` version with secret volumes as secret value + * preferable to use `latest` version with secret volumes as secret value * changes are reflected immediately. * * Generated from protobuf field string version = 1; @@ -70,7 +70,7 @@ public function getVersion() /** * Version of the secret (version number or the string 'latest'). It is - * preferrable to use `latest` version with secret volumes as secret value + * preferable to use `latest` version with secret volumes as secret value * changes are reflected immediately. * * Generated from protobuf field string version = 1; @@ -87,8 +87,8 @@ public function setVersion($var) /** * Relative path of the file under the mount path where the secret value for - * this version will be fetched and made available. For example, setting the - * mount_path as '/etc/secrets' and path as `/secret_foo` would mount the + * this version is fetched and made available. For example, setting the + * mount_path as '/etc/secrets' and path as `/secret_foo` mounts the * secret value file at `/etc/secrets/secret_foo`. * * Generated from protobuf field string path = 2; @@ -101,8 +101,8 @@ public function getPath() /** * Relative path of the file under the mount path where the secret value for - * this version will be fetched and made available. For example, setting the - * mount_path as '/etc/secrets' and path as `/secret_foo` would mount the + * this version is fetched and made available. For example, setting the + * mount_path as '/etc/secrets' and path as `/secret_foo` mounts the * secret value file at `/etc/secrets/secret_foo`. * * Generated from protobuf field string path = 2; diff --git a/Functions/src/V1/SourceRepository.php b/Functions/src/V1/SourceRepository.php index 470d86b1e531..b404df96b221 100644 --- a/Functions/src/V1/SourceRepository.php +++ b/Functions/src/V1/SourceRepository.php @@ -27,7 +27,7 @@ class SourceRepository extends \Google\Protobuf\Internal\Message * In particular, to refer to HEAD use `master` moveable alias. * To refer to a specific fixed alias (tag): * `https://source.developers.google.com/projects/*/repos/*/fixed-aliases/*/paths/*` - * You may omit `paths/*` if you want to use the main directory. + * You can omit `paths/*` if you want to use the main directory. * * Generated from protobuf field string url = 1; */ @@ -58,7 +58,7 @@ class SourceRepository extends \Google\Protobuf\Internal\Message * In particular, to refer to HEAD use `master` moveable alias. * To refer to a specific fixed alias (tag): * `https://source.developers.google.com/projects/*/repos/*/fixed-aliases/*/paths/*` - * You may omit `paths/*` if you want to use the main directory. + * You can omit `paths/*` if you want to use the main directory. * @type string $deployed_url * Output only. The URL pointing to the hosted repository where the function * were defined at the time of deployment. It always points to a specific @@ -81,7 +81,7 @@ public function __construct($data = NULL) { * In particular, to refer to HEAD use `master` moveable alias. * To refer to a specific fixed alias (tag): * `https://source.developers.google.com/projects/*/repos/*/fixed-aliases/*/paths/*` - * You may omit `paths/*` if you want to use the main directory. + * You can omit `paths/*` if you want to use the main directory. * * Generated from protobuf field string url = 1; * @return string @@ -102,7 +102,7 @@ public function getUrl() * In particular, to refer to HEAD use `master` moveable alias. * To refer to a specific fixed alias (tag): * `https://source.developers.google.com/projects/*/repos/*/fixed-aliases/*/paths/*` - * You may omit `paths/*` if you want to use the main directory. + * You can omit `paths/*` if you want to use the main directory. * * Generated from protobuf field string url = 1; * @param string $var diff --git a/Functions/src/V1/gapic_metadata.json b/Functions/src/V1/gapic_metadata.json index 0571f724aa05..eeb514889328 100644 --- a/Functions/src/V1/gapic_metadata.json +++ b/Functions/src/V1/gapic_metadata.json @@ -64,6 +64,11 @@ "methods": [ "updateFunction" ] + }, + "ListLocations": { + "methods": [ + "listLocations" + ] } } } diff --git a/Functions/src/V1/resources/cloud_functions_service_client_config.json b/Functions/src/V1/resources/cloud_functions_service_client_config.json index ef89754d42df..fd458597923c 100644 --- a/Functions/src/V1/resources/cloud_functions_service_client_config.json +++ b/Functions/src/V1/resources/cloud_functions_service_client_config.json @@ -93,6 +93,11 @@ "timeout_millis": 600000, "retry_codes_name": "retry_policy_1_codes", "retry_params_name": "retry_policy_1_params" + }, + "ListLocations": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" } } } diff --git a/Functions/src/V1/resources/cloud_functions_service_descriptor_config.php b/Functions/src/V1/resources/cloud_functions_service_descriptor_config.php index d908323e3be1..9f874b5bbb75 100644 --- a/Functions/src/V1/resources/cloud_functions_service_descriptor_config.php +++ b/Functions/src/V1/resources/cloud_functions_service_descriptor_config.php @@ -43,6 +43,17 @@ 'resourcesGetMethod' => 'getFunctions', ], ], + 'ListLocations' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getLocations', + ], + 'interfaceOverride' => 'google.cloud.location.Locations', + ], ], ], ]; diff --git a/Functions/tests/Unit/V1/CloudFunctionsServiceClientTest.php b/Functions/tests/Unit/V1/CloudFunctionsServiceClientTest.php index 662433eab3af..62b85a751b1b 100644 --- a/Functions/tests/Unit/V1/CloudFunctionsServiceClientTest.php +++ b/Functions/tests/Unit/V1/CloudFunctionsServiceClientTest.php @@ -35,6 +35,8 @@ use Google\Cloud\Functions\V1\ListFunctionsResponse; use Google\Cloud\Iam\V1\Policy; use Google\Cloud\Iam\V1\TestIamPermissionsResponse; +use Google\Cloud\Location\ListLocationsResponse; +use Google\Cloud\Location\Location; use Google\LongRunning\GetOperationRequest; use Google\LongRunning\Operation; use Google\Protobuf\Any; @@ -1018,4 +1020,66 @@ public function updateFunctionExceptionTest() $this->assertTrue($transport->isExhausted()); $this->assertTrue($operationsTransport->isExhausted()); } + + /** @test */ + public function listLocationsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $locationsElement = new Location(); + $locations = [ + $locationsElement, + ]; + $expectedResponse = new ListLocationsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setLocations($locations); + $transport->addResponse($expectedResponse); + $response = $gapicClient->listLocations(); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getLocations()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.location.Locations/ListLocations', $actualFuncCall); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listLocationsExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + try { + $gapicClient->listLocations(); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } }