diff --git a/composer.json b/composer.json index 2f2328a2357c..cebc9971d6d3 100644 --- a/composer.json +++ b/composer.json @@ -48,8 +48,8 @@ "monolog/monolog": "~1", "psr/http-message": "1.0.*", "ramsey/uuid": "~3", - "google/proto-client": "^0.24", - "google/gax": "^0.24" + "google/proto-client": "^0.25", + "google/gax": "^0.25" }, "require-dev": { "phpunit/phpunit": "4.8.*", @@ -117,4 +117,4 @@ ] } } -} \ No newline at end of file +} diff --git a/src/Dlp/V2beta1/Gapic/DlpServiceGapicClient.php b/src/Dlp/V2beta1/Gapic/DlpServiceGapicClient.php index ee0fc733829b..52f4af114b72 100644 --- a/src/Dlp/V2beta1/Gapic/DlpServiceGapicClient.php +++ b/src/Dlp/V2beta1/Gapic/DlpServiceGapicClient.php @@ -39,8 +39,12 @@ use Google\GAX\OperationResponse; use Google\GAX\PathTemplate; use Google\GAX\ValidationException; +use Google\Privacy\Dlp\V2beta1\AnalyzeDataSourceRiskRequest; +use Google\Privacy\Dlp\V2beta1\BigQueryTable; use Google\Privacy\Dlp\V2beta1\ContentItem; use Google\Privacy\Dlp\V2beta1\CreateInspectOperationRequest; +use Google\Privacy\Dlp\V2beta1\DeidentifyConfig; +use Google\Privacy\Dlp\V2beta1\DeidentifyContentRequest; use Google\Privacy\Dlp\V2beta1\DlpServiceGrpcClient; use Google\Privacy\Dlp\V2beta1\InspectConfig; use Google\Privacy\Dlp\V2beta1\InspectContentRequest; @@ -49,6 +53,7 @@ use Google\Privacy\Dlp\V2beta1\ListRootCategoriesRequest; use Google\Privacy\Dlp\V2beta1\OperationConfig; use Google\Privacy\Dlp\V2beta1\OutputStorageConfig; +use Google\Privacy\Dlp\V2beta1\PrivacyMetric; use Google\Privacy\Dlp\V2beta1\RedactContentRequest; use Google\Privacy\Dlp\V2beta1\RedactContentRequest_ImageRedactionConfig as ImageRedactionConfig; use Google\Privacy\Dlp\V2beta1\RedactContentRequest_ReplaceConfig as ReplaceConfig; @@ -72,19 +77,10 @@ * ``` * try { * $dlpServiceClient = new DlpServiceClient(); - * $name = "EMAIL_ADDRESS"; - * $infoTypesElement = new InfoType(); - * $infoTypesElement->setName($name); - * $infoTypes = [$infoTypesElement]; + * $deidentifyConfig = new DeidentifyConfig(); * $inspectConfig = new InspectConfig(); - * $inspectConfig->setInfoTypes($infoTypes); - * $type = "text/plain"; - * $value = "My email is example@example.com."; - * $itemsElement = new ContentItem(); - * $itemsElement->setType($type); - * $itemsElement->setValue($value); - * $items = [$itemsElement]; - * $response = $dlpServiceClient->inspectContent($inspectConfig, $items); + * $items = []; + * $response = $dlpServiceClient->deidentifyContent($deidentifyConfig, $inspectConfig, $items); * } finally { * $dlpServiceClient->close(); * } @@ -154,6 +150,10 @@ private static function getPathTemplateMap() private static function getLongRunningDescriptors() { return [ + 'analyzeDataSourceRisk' => [ + 'operationReturnType' => '\Google\Privacy\Dlp\V2beta1\RiskAnalysisOperationResult', + 'metadataReturnType' => '\Google\Privacy\Dlp\V2beta1\RiskAnalysisOperationMetadata', + ], 'createInspectOperation' => [ 'operationReturnType' => '\Google\Privacy\Dlp\V2beta1\InspectOperationResult', 'metadataReturnType' => '\Google\Privacy\Dlp\V2beta1\InspectOperationMetadata', @@ -181,7 +181,7 @@ private static function getGapicVersion() * * @param string $result * - * @return string The formatted result resource. + * @return string the formatted result resource * @experimental */ public static function resultName($result) @@ -205,9 +205,9 @@ public static function resultName($result) * @param string $formattedName The formatted name string * @param string $template Optional name of template to match * - * @return array An associative array from name component IDs to component values. + * @return array an associative array from name component IDs to component values * - * @throws ValidationException If $formattedName could not be matched. + * @throws ValidationException if $formattedName could not be matched * @experimental */ public static function parseName($formattedName, $template = null) @@ -345,6 +345,8 @@ public function __construct($options = []) $defaultDescriptors = ['headerDescriptor' => $headerDescriptor]; $this->descriptors = [ + 'deidentifyContent' => $defaultDescriptors, + 'analyzeDataSourceRisk' => $defaultDescriptors, 'inspectContent' => $defaultDescriptors, 'redactContent' => $defaultDescriptors, 'createInspectOperation' => $defaultDescriptors, @@ -383,6 +385,153 @@ public function __construct($options = []) $this->dlpServiceStub = $this->grpcCredentialsHelper->createStub($createDlpServiceStubFunction); } + /** + * De-identifies potentially sensitive info from a list of strings. + * This method has limits on input size and output size. + * + * Sample code: + * ``` + * try { + * $dlpServiceClient = new DlpServiceClient(); + * $deidentifyConfig = new DeidentifyConfig(); + * $inspectConfig = new InspectConfig(); + * $items = []; + * $response = $dlpServiceClient->deidentifyContent($deidentifyConfig, $inspectConfig, $items); + * } finally { + * $dlpServiceClient->close(); + * } + * ``` + * + * @param DeidentifyConfig $deidentifyConfig configuration for the de-identification of the list of content items + * @param InspectConfig $inspectConfig configuration for the inspector + * @param ContentItem[] $items The list of items to inspect. Up to 100 are allowed per request. + * All items will be treated as text/*. + * @param array $optionalArgs { + * Optional + * + * @type \Google\GAX\RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a + * {@see Google\GAX\RetrySettings} object, or an associative array + * of retry settings parameters. See the documentation on + * {@see Google\GAX\RetrySettings} for example usage. + * } + * + * @return \Google\Privacy\Dlp\V2beta1\DeidentifyContentResponse + * + * @throws \Google\GAX\ApiException if the remote call fails + * @experimental + */ + public function deidentifyContent($deidentifyConfig, $inspectConfig, $items, $optionalArgs = []) + { + $request = new DeidentifyContentRequest(); + $request->setDeidentifyConfig($deidentifyConfig); + $request->setInspectConfig($inspectConfig); + $request->setItems($items); + + $defaultCallSettings = $this->defaultCallSettings['deidentifyContent']; + if (isset($optionalArgs['retrySettings']) && is_array($optionalArgs['retrySettings'])) { + $optionalArgs['retrySettings'] = $defaultCallSettings->getRetrySettings()->with( + $optionalArgs['retrySettings'] + ); + } + $mergedSettings = $defaultCallSettings->merge(new CallSettings($optionalArgs)); + $callable = ApiCallable::createApiCall( + $this->dlpServiceStub, + 'DeidentifyContent', + $mergedSettings, + $this->descriptors['deidentifyContent'] + ); + + return $callable( + $request, + [], + ['call_credentials_callback' => $this->createCredentialsCallback()]); + } + + /** + * Schedules a job to compute risk analysis metrics over content in a Google + * Cloud Platform repository. + * + * Sample code: + * ``` + * try { + * $dlpServiceClient = new DlpServiceClient(); + * $privacyMetric = new PrivacyMetric(); + * $sourceTable = new BigQueryTable(); + * $operationResponse = $dlpServiceClient->analyzeDataSourceRisk($privacyMetric, $sourceTable); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * + * // OR start the operation, keep the operation name, and resume later + * $operationResponse = $dlpServiceClient->analyzeDataSourceRisk($privacyMetric, $sourceTable); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $dlpServiceClient->resumeOperation($operationName, 'analyzeDataSourceRisk'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $dlpServiceClient->close(); + * } + * ``` + * + * @param PrivacyMetric $privacyMetric privacy metric to compute + * @param BigQueryTable $sourceTable input dataset to compute metrics over + * @param array $optionalArgs { + * Optional + * + * @type \Google\GAX\RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a + * {@see Google\GAX\RetrySettings} object, or an associative array + * of retry settings parameters. See the documentation on + * {@see Google\GAX\RetrySettings} for example usage. + * } + * + * @return \Google\GAX\OperationResponse + * + * @throws \Google\GAX\ApiException if the remote call fails + * @experimental + */ + public function analyzeDataSourceRisk($privacyMetric, $sourceTable, $optionalArgs = []) + { + $request = new AnalyzeDataSourceRiskRequest(); + $request->setPrivacyMetric($privacyMetric); + $request->setSourceTable($sourceTable); + + $defaultCallSettings = $this->defaultCallSettings['analyzeDataSourceRisk']; + if (isset($optionalArgs['retrySettings']) && is_array($optionalArgs['retrySettings'])) { + $optionalArgs['retrySettings'] = $defaultCallSettings->getRetrySettings()->with( + $optionalArgs['retrySettings'] + ); + } + $mergedSettings = $defaultCallSettings->merge(new CallSettings($optionalArgs)); + $callable = ApiCallable::createApiCall( + $this->dlpServiceStub, + 'AnalyzeDataSourceRisk', + $mergedSettings, + $this->descriptors['analyzeDataSourceRisk'] + ); + + return $callable( + $request, + [], + ['call_credentials_callback' => $this->createCredentialsCallback()]); + } + /** * Finds potentially sensitive info in a list of strings. * This method has limits on input size, processing time, and output size. @@ -391,14 +540,14 @@ public function __construct($options = []) * ``` * try { * $dlpServiceClient = new DlpServiceClient(); - * $name = "EMAIL_ADDRESS"; + * $name = 'EMAIL_ADDRESS'; * $infoTypesElement = new InfoType(); * $infoTypesElement->setName($name); * $infoTypes = [$infoTypesElement]; * $inspectConfig = new InspectConfig(); * $inspectConfig->setInfoTypes($infoTypes); - * $type = "text/plain"; - * $value = "My email is example@example.com."; + * $type = 'text/plain'; + * $value = 'My email is example@example.com.'; * $itemsElement = new ContentItem(); * $itemsElement->setType($type); * $itemsElement->setValue($value); @@ -409,12 +558,12 @@ public function __construct($options = []) * } * ``` * - * @param InspectConfig $inspectConfig Configuration for the inspector. + * @param InspectConfig $inspectConfig configuration for the inspector * @param ContentItem[] $items The list of items to inspect. Items in a single request are * considered "related" unless inspect_config.independent_inputs is true. * Up to 100 are allowed per request. * @param array $optionalArgs { - * Optional. + * Optional * * @type \Google\GAX\RetrySettings|array $retrySettings * Retry settings to use for this call. Can be a @@ -462,22 +611,22 @@ public function inspectContent($inspectConfig, $items, $optionalArgs = []) * ``` * try { * $dlpServiceClient = new DlpServiceClient(); - * $name = "EMAIL_ADDRESS"; + * $name = 'EMAIL_ADDRESS'; * $infoTypesElement = new InfoType(); * $infoTypesElement->setName($name); * $infoTypes = [$infoTypesElement]; * $inspectConfig = new InspectConfig(); * $inspectConfig->setInfoTypes($infoTypes); - * $type = "text/plain"; - * $value = "My email is example@example.com."; + * $type = 'text/plain'; + * $value = 'My email is example@example.com.'; * $itemsElement = new ContentItem(); * $itemsElement->setType($type); * $itemsElement->setValue($value); * $items = [$itemsElement]; - * $name2 = "EMAIL_ADDRESS"; + * $name2 = 'EMAIL_ADDRESS'; * $infoType = new InfoType(); * $infoType->setName($name2); - * $replaceWith = "REDACTED"; + * $replaceWith = 'REDACTED'; * $replaceConfigsElement = new ReplaceConfig(); * $replaceConfigsElement->setInfoType($infoType); * $replaceConfigsElement->setReplaceWith($replaceWith); @@ -488,12 +637,12 @@ public function inspectContent($inspectConfig, $items, $optionalArgs = []) * } * ``` * - * @param InspectConfig $inspectConfig Configuration for the inspector. + * @param InspectConfig $inspectConfig configuration for the inspector * @param ContentItem[] $items The list of items to inspect. Up to 100 are allowed per request. * @param ReplaceConfig[] $replaceConfigs The strings to replace findings text findings with. Must specify at least * one of these or one ImageRedactionConfig if redacting images. * @param array $optionalArgs { - * Optional. + * Optional * * @type ImageRedactionConfig[] $imageRedactionConfigs * The configuration for specifying what content to redact from images. @@ -547,13 +696,13 @@ public function redactContent($inspectConfig, $items, $replaceConfigs, $optional * ``` * try { * $dlpServiceClient = new DlpServiceClient(); - * $name = "EMAIL_ADDRESS"; + * $name = 'EMAIL_ADDRESS'; * $infoTypesElement = new InfoType(); * $infoTypesElement->setName($name); * $infoTypes = [$infoTypesElement]; * $inspectConfig = new InspectConfig(); * $inspectConfig->setInfoTypes($infoTypes); - * $url = "gs://example_bucket/example_file.png"; + * $url = 'gs://example_bucket/example_file.png'; * $fileSet = new FileSet(); * $fileSet->setUrl($url); * $cloudStorageOptions = new CloudStorageOptions(); @@ -592,26 +741,11 @@ public function redactContent($inspectConfig, $items, $replaceConfigs, $optional * } * ``` * - * @param InspectConfig $inspectConfig Configuration for the inspector. - * @param StorageConfig $storageConfig Specification of the data set to process. - * @param OutputStorageConfig $outputConfig Optional location to store findings. The bucket must already exist and - * the Google APIs service account for DLP must have write permission to - * write to the given bucket. - *

Results are split over multiple csv files with each file name matching - * the pattern "[operation_id]_[count].csv", for example - * `3094877188788974909_1.csv`. The `operation_id` matches the - * identifier for the Operation, and the `count` is a counter used for - * tracking the number of files written.

The CSV file(s) contain the - * following columns regardless of storage type scanned:

  • id
  • info_type - *
  • likelihood
  • byte size of finding
  • quote
  • timestamp
    - *

    For Cloud Storage the next columns are:

  • file_path - *
  • start_offset
    - *

    For Cloud Datastore the next columns are:

  • project_id - *
  • namespace_id
  • path
  • column_name
  • offset
    - *

    For BigQuery the next columns are:

  • row_number
  • project_id - *
  • dataset_id
  • table_id + * @param InspectConfig $inspectConfig configuration for the inspector + * @param StorageConfig $storageConfig specification of the data set to process + * @param OutputStorageConfig $outputConfig optional location to store findings * @param array $optionalArgs { - * Optional. + * Optional * * @type OperationConfig $operationConfig * Additional configuration settings for long running operations. @@ -664,7 +798,7 @@ public function createInspectOperation($inspectConfig, $storageConfig, $outputCo * ``` * try { * $dlpServiceClient = new DlpServiceClient(); - * $formattedName = $dlpServiceClient->resultName("[RESULT]"); + * $formattedName = $dlpServiceClient->resultName('[RESULT]'); * $response = $dlpServiceClient->listInspectFindings($formattedName); * } finally { * $dlpServiceClient->close(); @@ -672,10 +806,10 @@ public function createInspectOperation($inspectConfig, $storageConfig, $outputCo * ``` * * @param string $name Identifier of the results set returned as metadata of - * the longrunning operation created by a call to CreateInspectOperation. + * the longrunning operation created by a call to InspectDataSource. * Should be in the format of `inspect/results/{id}`. * @param array $optionalArgs { - * Optional. + * Optional * * @type int $pageSize * Maximum number of results to return. @@ -686,12 +820,14 @@ public function createInspectOperation($inspectConfig, $storageConfig, $outputCo * the system should return the next page of data. * @type string $filter * Restricts findings to items that match. Supports info_type and likelihood. - *

    Examples:
    - *

  • info_type=EMAIL_ADDRESS - *
  • info_type=PHONE_NUMBER,EMAIL_ADDRESS - *
  • likelihood=VERY_LIKELY - *
  • likelihood=VERY_LIKELY,LIKELY - *
  • info_type=EMAIL_ADDRESS,likelihood=VERY_LIKELY,LIKELY + * + * Examples: + * + * - info_type=EMAIL_ADDRESS + * - info_type=PHONE_NUMBER,EMAIL_ADDRESS + * - likelihood=VERY_LIKELY + * - likelihood=VERY_LIKELY,LIKELY + * - info_type=EMAIL_ADDRESS,likelihood=VERY_LIKELY,LIKELY * @type \Google\GAX\RetrySettings|array $retrySettings * Retry settings to use for this call. Can be a * {@see Google\GAX\RetrySettings} object, or an associative array @@ -745,20 +881,20 @@ public function listInspectFindings($name, $optionalArgs = []) * ``` * try { * $dlpServiceClient = new DlpServiceClient(); - * $category = "PII"; - * $languageCode = "en"; + * $category = 'PII'; + * $languageCode = 'en'; * $response = $dlpServiceClient->listInfoTypes($category, $languageCode); * } finally { * $dlpServiceClient->close(); * } * ``` * - * @param string $category Category name as returned by ListRootCategories. + * @param string $category category name as returned by ListRootCategories * @param string $languageCode Optional BCP-47 language code for localized info type friendly * names. If omitted, or if localized strings are not available, * en-US strings will be returned. * @param array $optionalArgs { - * Optional. + * Optional * * @type \Google\GAX\RetrySettings|array $retrySettings * Retry settings to use for this call. Can be a @@ -805,7 +941,7 @@ public function listInfoTypes($category, $languageCode, $optionalArgs = []) * ``` * try { * $dlpServiceClient = new DlpServiceClient(); - * $languageCode = "en"; + * $languageCode = 'en'; * $response = $dlpServiceClient->listRootCategories($languageCode); * } finally { * $dlpServiceClient->close(); @@ -816,7 +952,7 @@ public function listInfoTypes($category, $languageCode, $optionalArgs = []) * If omitted or if localized strings are not available, * en-US strings will be returned. * @param array $optionalArgs { - * Optional. + * Optional * * @type \Google\GAX\RetrySettings|array $retrySettings * Retry settings to use for this call. Can be a diff --git a/src/Dlp/V2beta1/resources/dlp_service_client_config.json b/src/Dlp/V2beta1/resources/dlp_service_client_config.json index 6d7f18ff7827..4ec7851489a4 100644 --- a/src/Dlp/V2beta1/resources/dlp_service_client_config.json +++ b/src/Dlp/V2beta1/resources/dlp_service_client_config.json @@ -20,6 +20,16 @@ } }, "methods": { + "DeidentifyContent": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "AnalyzeDataSourceRisk": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, "InspectContent": { "timeout_millis": 60000, "retry_codes_name": "non_idempotent", diff --git a/src/ErrorReporting/V1beta1/Gapic/ErrorGroupServiceGapicClient.php b/src/ErrorReporting/V1beta1/Gapic/ErrorGroupServiceGapicClient.php index 191a4091a666..c3ea6a797138 100644 --- a/src/ErrorReporting/V1beta1/Gapic/ErrorGroupServiceGapicClient.php +++ b/src/ErrorReporting/V1beta1/Gapic/ErrorGroupServiceGapicClient.php @@ -55,7 +55,7 @@ * ``` * try { * $errorGroupServiceClient = new ErrorGroupServiceClient(); - * $formattedGroupName = $errorGroupServiceClient->groupName("[PROJECT]", "[GROUP]"); + * $formattedGroupName = $errorGroupServiceClient->groupName('[PROJECT]', '[GROUP]'); * $response = $errorGroupServiceClient->getGroup($formattedGroupName); * } finally { * $errorGroupServiceClient->close(); @@ -143,7 +143,7 @@ private static function getGapicVersion() * @param string $project * @param string $group * - * @return string The formatted group resource. + * @return string the formatted group resource * @experimental */ public static function groupName($project, $group) @@ -168,9 +168,9 @@ public static function groupName($project, $group) * @param string $formattedName The formatted name string * @param string $template Optional name of template to match * - * @return array An associative array from name component IDs to component values. + * @return array an associative array from name component IDs to component values * - * @throws ValidationException If $formattedName could not be matched. + * @throws ValidationException if $formattedName could not be matched * @experimental */ public static function parseName($formattedName, $template = null) @@ -298,7 +298,7 @@ public function __construct($options = []) * ``` * try { * $errorGroupServiceClient = new ErrorGroupServiceClient(); - * $formattedGroupName = $errorGroupServiceClient->groupName("[PROJECT]", "[GROUP]"); + * $formattedGroupName = $errorGroupServiceClient->groupName('[PROJECT]', '[GROUP]'); * $response = $errorGroupServiceClient->getGroup($formattedGroupName); * } finally { * $errorGroupServiceClient->close(); @@ -314,7 +314,7 @@ public function __construct($options = []) * * Example: projects/my-project-123/groups/my-group * @param array $optionalArgs { - * Optional. + * Optional * * @type \Google\GAX\RetrySettings|array $retrySettings * Retry settings to use for this call. Can be a @@ -368,9 +368,9 @@ public function getGroup($groupName, $optionalArgs = []) * } * ``` * - * @param ErrorGroup $group [Required] The group which replaces the resource on the server. + * @param errorGroup $group [Required] The group which replaces the resource on the server * @param array $optionalArgs { - * Optional. + * Optional * * @type \Google\GAX\RetrySettings|array $retrySettings * Retry settings to use for this call. Can be a diff --git a/src/ErrorReporting/V1beta1/Gapic/ErrorStatsServiceGapicClient.php b/src/ErrorReporting/V1beta1/Gapic/ErrorStatsServiceGapicClient.php index f42d6c076b8e..681babf69ed9 100644 --- a/src/ErrorReporting/V1beta1/Gapic/ErrorStatsServiceGapicClient.php +++ b/src/ErrorReporting/V1beta1/Gapic/ErrorStatsServiceGapicClient.php @@ -61,7 +61,7 @@ * ``` * try { * $errorStatsServiceClient = new ErrorStatsServiceClient(); - * $formattedProjectName = $errorStatsServiceClient->projectName("[PROJECT]"); + * $formattedProjectName = $errorStatsServiceClient->projectName('[PROJECT]'); * $timeRange = new QueryTimeRange(); * // Iterate through all elements * $pagedResponse = $errorStatsServiceClient->listGroupStats($formattedProjectName, $timeRange); @@ -69,8 +69,8 @@ * // doSomethingWith($element); * } * - * // OR iterate over pages of elements, with the maximum page size set to 5 - * $pagedResponse = $errorStatsServiceClient->listGroupStats($formattedProjectName, $timeRange, ['pageSize' => 5]); + * // OR iterate over pages of elements + * $pagedResponse = $errorStatsServiceClient->listGroupStats($formattedProjectName, $timeRange); * foreach ($pagedResponse->iteratePages() as $page) { * foreach ($page as $element) { * // doSomethingWith($element); @@ -140,6 +140,7 @@ private static function getPathTemplateMap() return self::$pathTemplateMap; } + private static function getPageStreamingDescriptors() { $listGroupStatsPageStreamingDescriptor = @@ -189,7 +190,7 @@ private static function getGapicVersion() * * @param string $project * - * @return string The formatted project resource. + * @return string the formatted project resource * @experimental */ public static function projectName($project) @@ -213,9 +214,9 @@ public static function projectName($project) * @param string $formattedName The formatted name string * @param string $template Optional name of template to match * - * @return array An associative array from name component IDs to component values. + * @return array an associative array from name component IDs to component values * - * @throws ValidationException If $formattedName could not be matched. + * @throws ValidationException if $formattedName could not be matched * @experimental */ public static function parseName($formattedName, $template = null) @@ -348,7 +349,7 @@ public function __construct($options = []) * ``` * try { * $errorStatsServiceClient = new ErrorStatsServiceClient(); - * $formattedProjectName = $errorStatsServiceClient->projectName("[PROJECT]"); + * $formattedProjectName = $errorStatsServiceClient->projectName('[PROJECT]'); * $timeRange = new QueryTimeRange(); * // Iterate through all elements * $pagedResponse = $errorStatsServiceClient->listGroupStats($formattedProjectName, $timeRange); @@ -356,8 +357,8 @@ public function __construct($options = []) * // doSomethingWith($element); * } * - * // OR iterate over pages of elements, with the maximum page size set to 5 - * $pagedResponse = $errorStatsServiceClient->listGroupStats($formattedProjectName, $timeRange, ['pageSize' => 5]); + * // OR iterate over pages of elements + * $pagedResponse = $errorStatsServiceClient->listGroupStats($formattedProjectName, $timeRange); * foreach ($pagedResponse->iteratePages() as $page) { * foreach ($page as $element) { * // doSomethingWith($element); @@ -382,7 +383,7 @@ public function __construct($options = []) * If a group_id list is given, also ErrorGroupStats with zero * occurrences are returned. * @param array $optionalArgs { - * Optional. + * Optional * * @type string[] $groupId * [Optional] List all ErrorGroupStats with these IDs. @@ -482,16 +483,16 @@ public function listGroupStats($projectName, $timeRange, $optionalArgs = []) * ``` * try { * $errorStatsServiceClient = new ErrorStatsServiceClient(); - * $formattedProjectName = $errorStatsServiceClient->projectName("[PROJECT]"); - * $groupId = ""; + * $formattedProjectName = $errorStatsServiceClient->projectName('[PROJECT]'); + * $groupId = ''; * // Iterate through all elements * $pagedResponse = $errorStatsServiceClient->listEvents($formattedProjectName, $groupId); * foreach ($pagedResponse->iterateAllElements() as $element) { * // doSomethingWith($element); * } * - * // OR iterate over pages of elements, with the maximum page size set to 5 - * $pagedResponse = $errorStatsServiceClient->listEvents($formattedProjectName, $groupId, ['pageSize' => 5]); + * // OR iterate over pages of elements + * $pagedResponse = $errorStatsServiceClient->listEvents($formattedProjectName, $groupId); * foreach ($pagedResponse->iteratePages() as $page) { * foreach ($page as $element) { * // doSomethingWith($element); @@ -507,9 +508,9 @@ public function listGroupStats($projectName, $timeRange, $optionalArgs = []) * [Google Cloud Platform project * ID](https://support.google.com/cloud/answer/6158840). * Example: `projects/my-project-123`. - * @param string $groupId [Required] The group for which events shall be returned. + * @param string $groupId [Required] The group for which events shall be returned * @param array $optionalArgs { - * Optional. + * Optional * * @type ServiceContextFilter $serviceFilter * [Optional] List only ErrorGroups which belong to a service context that @@ -585,7 +586,7 @@ public function listEvents($projectName, $groupId, $optionalArgs = []) * ``` * try { * $errorStatsServiceClient = new ErrorStatsServiceClient(); - * $formattedProjectName = $errorStatsServiceClient->projectName("[PROJECT]"); + * $formattedProjectName = $errorStatsServiceClient->projectName('[PROJECT]'); * $response = $errorStatsServiceClient->deleteEvents($formattedProjectName); * } finally { * $errorStatsServiceClient->close(); @@ -598,7 +599,7 @@ public function listEvents($projectName, $groupId, $optionalArgs = []) * ID](https://support.google.com/cloud/answer/6158840). * Example: `projects/my-project-123`. * @param array $optionalArgs { - * Optional. + * Optional * * @type \Google\GAX\RetrySettings|array $retrySettings * Retry settings to use for this call. Can be a diff --git a/src/ErrorReporting/V1beta1/Gapic/ReportErrorsServiceGapicClient.php b/src/ErrorReporting/V1beta1/Gapic/ReportErrorsServiceGapicClient.php index 871d95617f8b..51311370ef41 100644 --- a/src/ErrorReporting/V1beta1/Gapic/ReportErrorsServiceGapicClient.php +++ b/src/ErrorReporting/V1beta1/Gapic/ReportErrorsServiceGapicClient.php @@ -54,7 +54,7 @@ * ``` * try { * $reportErrorsServiceClient = new ReportErrorsServiceClient(); - * $formattedProjectName = $reportErrorsServiceClient->projectName("[PROJECT]"); + * $formattedProjectName = $reportErrorsServiceClient->projectName('[PROJECT]'); * $event = new ReportedErrorEvent(); * $response = $reportErrorsServiceClient->reportErrorEvent($formattedProjectName, $event); * } finally { @@ -142,7 +142,7 @@ private static function getGapicVersion() * * @param string $project * - * @return string The formatted project resource. + * @return string the formatted project resource * @experimental */ public static function projectName($project) @@ -166,9 +166,9 @@ public static function projectName($project) * @param string $formattedName The formatted name string * @param string $template Optional name of template to match * - * @return array An associative array from name component IDs to component values. + * @return array an associative array from name component IDs to component values * - * @throws ValidationException If $formattedName could not be matched. + * @throws ValidationException if $formattedName could not be matched * @experimental */ public static function parseName($formattedName, $template = null) @@ -302,7 +302,7 @@ public function __construct($options = []) * ``` * try { * $reportErrorsServiceClient = new ReportErrorsServiceClient(); - * $formattedProjectName = $reportErrorsServiceClient->projectName("[PROJECT]"); + * $formattedProjectName = $reportErrorsServiceClient->projectName('[PROJECT]'); * $event = new ReportedErrorEvent(); * $response = $reportErrorsServiceClient->reportErrorEvent($formattedProjectName, $event); * } finally { @@ -314,9 +314,9 @@ public function __construct($options = []) * as `projects/` plus the * [Google Cloud Platform project ID](https://support.google.com/cloud/answer/6158840). * Example: `projects/my-project-123`. - * @param ReportedErrorEvent $event [Required] The error event to be reported. + * @param reportedErrorEvent $event [Required] The error event to be reported * @param array $optionalArgs { - * Optional. + * Optional * * @type \Google\GAX\RetrySettings|array $retrySettings * Retry settings to use for this call. Can be a diff --git a/src/Language/V1beta2/Gapic/LanguageServiceGapicClient.php b/src/Language/V1beta2/Gapic/LanguageServiceGapicClient.php index cac6b6dca6f6..20a6a474174a 100644 --- a/src/Language/V1beta2/Gapic/LanguageServiceGapicClient.php +++ b/src/Language/V1beta2/Gapic/LanguageServiceGapicClient.php @@ -228,9 +228,9 @@ public function __construct($options = []) * } * ``` * - * @param Document $document Input document. + * @param Document $document input document * @param array $optionalArgs { - * Optional. + * Optional * * @type int $encodingType * The encoding type used by the API to calculate sentence offsets for the @@ -292,9 +292,9 @@ public function analyzeSentiment($document, $optionalArgs = []) * } * ``` * - * @param Document $document Input document. + * @param Document $document input document * @param array $optionalArgs { - * Optional. + * Optional * * @type int $encodingType * The encoding type used by the API to calculate offsets. @@ -354,9 +354,9 @@ public function analyzeEntities($document, $optionalArgs = []) * } * ``` * - * @param Document $document Input document. + * @param Document $document input document * @param array $optionalArgs { - * Optional. + * Optional * * @type int $encodingType * The encoding type used by the API to calculate offsets. @@ -417,9 +417,9 @@ public function analyzeEntitySentiment($document, $optionalArgs = []) * } * ``` * - * @param Document $document Input document. + * @param Document $document input document * @param array $optionalArgs { - * Optional. + * Optional * * @type int $encodingType * The encoding type used by the API to calculate offsets. @@ -478,9 +478,9 @@ public function analyzeSyntax($document, $optionalArgs = []) * } * ``` * - * @param Document $document Input document. + * @param Document $document input document * @param array $optionalArgs { - * Optional. + * Optional * * @type \Google\GAX\RetrySettings|array $retrySettings * Retry settings to use for this call. Can be a @@ -535,10 +535,10 @@ public function classifyText($document, $optionalArgs = []) * } * ``` * - * @param Document $document Input document. - * @param Features $features The enabled features. + * @param Document $document input document + * @param Features $features the enabled features * @param array $optionalArgs { - * Optional. + * Optional * * @type int $encodingType * The encoding type used by the API to calculate offsets. diff --git a/src/Logging/V2/Gapic/ConfigServiceV2GapicClient.php b/src/Logging/V2/Gapic/ConfigServiceV2GapicClient.php index a8c746994d56..f0fce8507aad 100644 --- a/src/Logging/V2/Gapic/ConfigServiceV2GapicClient.php +++ b/src/Logging/V2/Gapic/ConfigServiceV2GapicClient.php @@ -39,12 +39,19 @@ use Google\GAX\PathTemplate; use Google\GAX\ValidationException; use Google\Logging\V2\ConfigServiceV2GrpcClient; +use Google\Logging\V2\CreateExclusionRequest; use Google\Logging\V2\CreateSinkRequest; +use Google\Logging\V2\DeleteExclusionRequest; use Google\Logging\V2\DeleteSinkRequest; +use Google\Logging\V2\GetExclusionRequest; use Google\Logging\V2\GetSinkRequest; +use Google\Logging\V2\ListExclusionsRequest; use Google\Logging\V2\ListSinksRequest; +use Google\Logging\V2\LogExclusion; use Google\Logging\V2\LogSink; +use Google\Logging\V2\UpdateExclusionRequest; use Google\Logging\V2\UpdateSinkRequest; +use Google\Protobuf\FieldMask; /** * Service Description: Service for configuring sinks used to export log entries outside of @@ -60,15 +67,15 @@ * ``` * try { * $configServiceV2Client = new ConfigServiceV2Client(); - * $formattedParent = $configServiceV2Client->projectName("[PROJECT]"); + * $formattedParent = $configServiceV2Client->projectName('[PROJECT]'); * // Iterate through all elements * $pagedResponse = $configServiceV2Client->listSinks($formattedParent); * foreach ($pagedResponse->iterateAllElements() as $element) { * // doSomethingWith($element); * } * - * // OR iterate over pages of elements, with the maximum page size set to 5 - * $pagedResponse = $configServiceV2Client->listSinks($formattedParent, ['pageSize' => 5]); + * // OR iterate over pages of elements + * $pagedResponse = $configServiceV2Client->listSinks($formattedParent); * foreach ($pagedResponse->iteratePages() as $page) { * foreach ($page as $element) { * // doSomethingWith($element); @@ -110,6 +117,7 @@ class ConfigServiceV2GapicClient private static $projectNameTemplate; private static $sinkNameTemplate; + private static $exclusionNameTemplate; private static $pathTemplateMap; private static $gapicVersion; private static $gapicVersionLoaded = false; @@ -138,17 +146,28 @@ private static function getSinkNameTemplate() return self::$sinkNameTemplate; } + private static function getExclusionNameTemplate() + { + if (self::$exclusionNameTemplate == null) { + self::$exclusionNameTemplate = new PathTemplate('projects/{project}/exclusions/{exclusion}'); + } + + return self::$exclusionNameTemplate; + } + private static function getPathTemplateMap() { if (self::$pathTemplateMap == null) { self::$pathTemplateMap = [ 'project' => self::getProjectNameTemplate(), 'sink' => self::getSinkNameTemplate(), + 'exclusion' => self::getExclusionNameTemplate(), ]; } return self::$pathTemplateMap; } + private static function getPageStreamingDescriptors() { $listSinksPageStreamingDescriptor = @@ -160,9 +179,19 @@ private static function getPageStreamingDescriptors() 'responsePageTokenGetMethod' => 'getNextPageToken', 'resourcesGetMethod' => 'getSinks', ]); + $listExclusionsPageStreamingDescriptor = + new PageStreamingDescriptor([ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getExclusions', + ]); $pageStreamingDescriptors = [ 'listSinks' => $listSinksPageStreamingDescriptor, + 'listExclusions' => $listExclusionsPageStreamingDescriptor, ]; return $pageStreamingDescriptors; @@ -188,7 +217,7 @@ private static function getGapicVersion() * * @param string $project * - * @return string The formatted project resource. + * @return string the formatted project resource * @experimental */ public static function projectName($project) @@ -205,7 +234,7 @@ public static function projectName($project) * @param string $project * @param string $sink * - * @return string The formatted sink resource. + * @return string the formatted sink resource * @experimental */ public static function sinkName($project, $sink) @@ -216,12 +245,31 @@ public static function sinkName($project, $sink) ]); } + /** + * Formats a string containing the fully-qualified path to represent + * a exclusion resource. + * + * @param string $project + * @param string $exclusion + * + * @return string the formatted exclusion resource + * @experimental + */ + public static function exclusionName($project, $exclusion) + { + return self::getExclusionNameTemplate()->render([ + 'project' => $project, + 'exclusion' => $exclusion, + ]); + } + /** * Parses a formatted name string and returns an associative array of the components in the name. * The following name formats are supported: * Template: Pattern * - project: projects/{project} - * - sink: projects/{project}/sinks/{sink}. + * - sink: projects/{project}/sinks/{sink} + * - exclusion: projects/{project}/exclusions/{exclusion}. * * The optional $template argument can be supplied to specify a particular pattern, and must * match one of the templates listed above. If no $template argument is provided, or if the @@ -231,9 +279,9 @@ public static function sinkName($project, $sink) * @param string $formattedName The formatted name string * @param string $template Optional name of template to match * - * @return array An associative array from name component IDs to component values. + * @return array an associative array from name component IDs to component values * - * @throws ValidationException If $formattedName could not be matched. + * @throws ValidationException if $formattedName could not be matched * @experimental */ public static function parseName($formattedName, $template = null) @@ -333,6 +381,11 @@ public function __construct($options = []) 'createSink' => $defaultDescriptors, 'updateSink' => $defaultDescriptors, 'deleteSink' => $defaultDescriptors, + 'listExclusions' => $defaultDescriptors, + 'getExclusion' => $defaultDescriptors, + 'createExclusion' => $defaultDescriptors, + 'updateExclusion' => $defaultDescriptors, + 'deleteExclusion' => $defaultDescriptors, ]; $pageStreamingDescriptors = self::getPageStreamingDescriptors(); foreach ($pageStreamingDescriptors as $method => $pageStreamingDescriptor) { @@ -372,15 +425,15 @@ public function __construct($options = []) * ``` * try { * $configServiceV2Client = new ConfigServiceV2Client(); - * $formattedParent = $configServiceV2Client->projectName("[PROJECT]"); + * $formattedParent = $configServiceV2Client->projectName('[PROJECT]'); * // Iterate through all elements * $pagedResponse = $configServiceV2Client->listSinks($formattedParent); * foreach ($pagedResponse->iterateAllElements() as $element) { * // doSomethingWith($element); * } * - * // OR iterate over pages of elements, with the maximum page size set to 5 - * $pagedResponse = $configServiceV2Client->listSinks($formattedParent, ['pageSize' => 5]); + * // OR iterate over pages of elements + * $pagedResponse = $configServiceV2Client->listSinks($formattedParent); * foreach ($pagedResponse->iteratePages() as $page) { * foreach ($page as $element) { * // doSomethingWith($element); @@ -398,7 +451,7 @@ public function __construct($options = []) * "billingAccounts/[BILLING_ACCOUNT_ID]" * "folders/[FOLDER_ID]" * @param array $optionalArgs { - * Optional. + * Optional * * @type string $pageToken * A page token is used to specify a page of values to be returned. @@ -459,7 +512,7 @@ public function listSinks($parent, $optionalArgs = []) * ``` * try { * $configServiceV2Client = new ConfigServiceV2Client(); - * $formattedSinkName = $configServiceV2Client->sinkName("[PROJECT]", "[SINK]"); + * $formattedSinkName = $configServiceV2Client->sinkName('[PROJECT]', '[SINK]'); * $response = $configServiceV2Client->getSink($formattedSinkName); * } finally { * $configServiceV2Client->close(); @@ -475,7 +528,7 @@ public function listSinks($parent, $optionalArgs = []) * * Example: `"projects/my-project-id/sinks/my-sink-id"`. * @param array $optionalArgs { - * Optional. + * Optional * * @type \Google\GAX\RetrySettings|array $retrySettings * Retry settings to use for this call. Can be a @@ -525,7 +578,7 @@ public function getSink($sinkName, $optionalArgs = []) * ``` * try { * $configServiceV2Client = new ConfigServiceV2Client(); - * $formattedParent = $configServiceV2Client->projectName("[PROJECT]"); + * $formattedParent = $configServiceV2Client->projectName('[PROJECT]'); * $sink = new LogSink(); * $response = $configServiceV2Client->createSink($formattedParent, $sink); * } finally { @@ -544,7 +597,7 @@ public function getSink($sinkName, $optionalArgs = []) * @param LogSink $sink Required. The new sink, whose `name` parameter is a sink identifier that * is not already in use. * @param array $optionalArgs { - * Optional. + * Optional * * @type bool $uniqueWriterIdentity * Optional. Determines the kind of IAM identity returned as `writer_identity` @@ -610,7 +663,7 @@ public function createSink($parent, $sink, $optionalArgs = []) * ``` * try { * $configServiceV2Client = new ConfigServiceV2Client(); - * $formattedSinkName = $configServiceV2Client->sinkName("[PROJECT]", "[SINK]"); + * $formattedSinkName = $configServiceV2Client->sinkName('[PROJECT]', '[SINK]'); * $sink = new LogSink(); * $response = $configServiceV2Client->updateSink($formattedSinkName, $sink); * } finally { @@ -630,7 +683,7 @@ public function createSink($parent, $sink, $optionalArgs = []) * @param LogSink $sink Required. The updated sink, whose name is the same identifier that appears * as part of `sink_name`. * @param array $optionalArgs { - * Optional. + * Optional * * @type bool $uniqueWriterIdentity * Optional. See @@ -694,7 +747,7 @@ public function updateSink($sinkName, $sink, $optionalArgs = []) * ``` * try { * $configServiceV2Client = new ConfigServiceV2Client(); - * $formattedSinkName = $configServiceV2Client->sinkName("[PROJECT]", "[SINK]"); + * $formattedSinkName = $configServiceV2Client->sinkName('[PROJECT]', '[SINK]'); * $configServiceV2Client->deleteSink($formattedSinkName); * } finally { * $configServiceV2Client->close(); @@ -711,7 +764,7 @@ public function updateSink($sinkName, $sink, $optionalArgs = []) * * Example: `"projects/my-project-id/sinks/my-sink-id"`. * @param array $optionalArgs { - * Optional. + * Optional * * @type \Google\GAX\RetrySettings|array $retrySettings * Retry settings to use for this call. Can be a @@ -748,6 +801,358 @@ public function deleteSink($sinkName, $optionalArgs = []) ['call_credentials_callback' => $this->createCredentialsCallback()]); } + /** + * Lists all the exclusions in a parent resource. + * + * Sample code: + * ``` + * try { + * $configServiceV2Client = new ConfigServiceV2Client(); + * $formattedParent = $configServiceV2Client->projectName('[PROJECT]'); + * // Iterate through all elements + * $pagedResponse = $configServiceV2Client->listExclusions($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * + * // OR iterate over pages of elements + * $pagedResponse = $configServiceV2Client->listExclusions($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * } finally { + * $configServiceV2Client->close(); + * } + * ``` + * + * @param string $parent Required. The parent resource whose exclusions are to be listed. + * + * "projects/[PROJECT_ID]" + * "organizations/[ORGANIZATION_ID]" + * "billingAccounts/[BILLING_ACCOUNT_ID]" + * "folders/[FOLDER_ID]" + * @param array $optionalArgs { + * Optional + * + * @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 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 \Google\GAX\RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a + * {@see Google\GAX\RetrySettings} object, or an associative array + * of retry settings parameters. See the documentation on + * {@see Google\GAX\RetrySettings} for example usage. + * } + * + * @return \Google\GAX\PagedListResponse + * + * @throws \Google\GAX\ApiException if the remote call fails + * @experimental + */ + public function listExclusions($parent, $optionalArgs = []) + { + $request = new ListExclusionsRequest(); + $request->setParent($parent); + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + $defaultCallSettings = $this->defaultCallSettings['listExclusions']; + if (isset($optionalArgs['retrySettings']) && is_array($optionalArgs['retrySettings'])) { + $optionalArgs['retrySettings'] = $defaultCallSettings->getRetrySettings()->with( + $optionalArgs['retrySettings'] + ); + } + $mergedSettings = $defaultCallSettings->merge(new CallSettings($optionalArgs)); + $callable = ApiCallable::createApiCall( + $this->configServiceV2Stub, + 'ListExclusions', + $mergedSettings, + $this->descriptors['listExclusions'] + ); + + return $callable( + $request, + [], + ['call_credentials_callback' => $this->createCredentialsCallback()]); + } + + /** + * Gets the description of an exclusion. + * + * Sample code: + * ``` + * try { + * $configServiceV2Client = new ConfigServiceV2Client(); + * $formattedName = $configServiceV2Client->exclusionName('[PROJECT]', '[EXCLUSION]'); + * $response = $configServiceV2Client->getExclusion($formattedName); + * } finally { + * $configServiceV2Client->close(); + * } + * ``` + * + * @param string $name Required. The resource name of an existing exclusion: + * + * "projects/[PROJECT_ID]/exclusions/[EXCLUSION_ID]" + * "organizations/[ORGANIZATION_ID]/exclusions/[EXCLUSION_ID]" + * "billingAccounts/[BILLING_ACCOUNT_ID]/exclusions/[EXCLUSION_ID]" + * "folders/[FOLDER_ID]/exclusions/[EXCLUSION_ID]" + * + * Example: `"projects/my-project-id/exclusions/my-exclusion-id"`. + * @param array $optionalArgs { + * Optional + * + * @type \Google\GAX\RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a + * {@see Google\GAX\RetrySettings} object, or an associative array + * of retry settings parameters. See the documentation on + * {@see Google\GAX\RetrySettings} for example usage. + * } + * + * @return \Google\Logging\V2\LogExclusion + * + * @throws \Google\GAX\ApiException if the remote call fails + * @experimental + */ + public function getExclusion($name, $optionalArgs = []) + { + $request = new GetExclusionRequest(); + $request->setName($name); + + $defaultCallSettings = $this->defaultCallSettings['getExclusion']; + if (isset($optionalArgs['retrySettings']) && is_array($optionalArgs['retrySettings'])) { + $optionalArgs['retrySettings'] = $defaultCallSettings->getRetrySettings()->with( + $optionalArgs['retrySettings'] + ); + } + $mergedSettings = $defaultCallSettings->merge(new CallSettings($optionalArgs)); + $callable = ApiCallable::createApiCall( + $this->configServiceV2Stub, + 'GetExclusion', + $mergedSettings, + $this->descriptors['getExclusion'] + ); + + return $callable( + $request, + [], + ['call_credentials_callback' => $this->createCredentialsCallback()]); + } + + /** + * Creates a new exclusion in a specified parent resource. + * Only log entries belonging to that resource can be excluded. + * You can have up to 10 exclusions in a resource. + * + * Sample code: + * ``` + * try { + * $configServiceV2Client = new ConfigServiceV2Client(); + * $formattedParent = $configServiceV2Client->projectName('[PROJECT]'); + * $exclusion = new LogExclusion(); + * $response = $configServiceV2Client->createExclusion($formattedParent, $exclusion); + * } finally { + * $configServiceV2Client->close(); + * } + * ``` + * + * @param string $parent Required. The parent resource in which to create the exclusion: + * + * "projects/[PROJECT_ID]" + * "organizations/[ORGANIZATION_ID]" + * "billingAccounts/[BILLING_ACCOUNT_ID]" + * "folders/[FOLDER_ID]" + * + * Examples: `"projects/my-logging-project"`, `"organizations/123456789"`. + * @param LogExclusion $exclusion Required. The new exclusion, whose `name` parameter is an exclusion name + * that is not already used in the parent resource. + * @param array $optionalArgs { + * Optional + * + * @type \Google\GAX\RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a + * {@see Google\GAX\RetrySettings} object, or an associative array + * of retry settings parameters. See the documentation on + * {@see Google\GAX\RetrySettings} for example usage. + * } + * + * @return \Google\Logging\V2\LogExclusion + * + * @throws \Google\GAX\ApiException if the remote call fails + * @experimental + */ + public function createExclusion($parent, $exclusion, $optionalArgs = []) + { + $request = new CreateExclusionRequest(); + $request->setParent($parent); + $request->setExclusion($exclusion); + + $defaultCallSettings = $this->defaultCallSettings['createExclusion']; + if (isset($optionalArgs['retrySettings']) && is_array($optionalArgs['retrySettings'])) { + $optionalArgs['retrySettings'] = $defaultCallSettings->getRetrySettings()->with( + $optionalArgs['retrySettings'] + ); + } + $mergedSettings = $defaultCallSettings->merge(new CallSettings($optionalArgs)); + $callable = ApiCallable::createApiCall( + $this->configServiceV2Stub, + 'CreateExclusion', + $mergedSettings, + $this->descriptors['createExclusion'] + ); + + return $callable( + $request, + [], + ['call_credentials_callback' => $this->createCredentialsCallback()]); + } + + /** + * Changes one or more properties of an existing exclusion. + * + * Sample code: + * ``` + * try { + * $configServiceV2Client = new ConfigServiceV2Client(); + * $formattedName = $configServiceV2Client->exclusionName('[PROJECT]', '[EXCLUSION]'); + * $exclusion = new LogExclusion(); + * $updateMask = new FieldMask(); + * $response = $configServiceV2Client->updateExclusion($formattedName, $exclusion, $updateMask); + * } finally { + * $configServiceV2Client->close(); + * } + * ``` + * + * @param string $name Required. The resource name of the exclusion to update: + * + * "projects/[PROJECT_ID]/exclusions/[EXCLUSION_ID]" + * "organizations/[ORGANIZATION_ID]/exclusions/[EXCLUSION_ID]" + * "billingAccounts/[BILLING_ACCOUNT_ID]/exclusions/[EXCLUSION_ID]" + * "folders/[FOLDER_ID]/exclusions/[EXCLUSION_ID]" + * + * Example: `"projects/my-project-id/exclusions/my-exclusion-id"`. + * @param LogExclusion $exclusion Required. New values for the existing exclusion. Only the fields specified + * in `update_mask` are relevant. + * @param FieldMask $updateMask Required. A nonempty list of fields to change in the existing exclusion. + * New values for the fields are taken from the corresponding fields in the + * [LogExclusion][google.logging.v2.LogExclusion] included in this request. Fields not mentioned in + * `update_mask` are not changed and are ignored in the request. + * + * For example, to change the filter and description of an exclusion, + * specify an `update_mask` of `"filter,description"`. + * @param array $optionalArgs { + * Optional + * + * @type \Google\GAX\RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a + * {@see Google\GAX\RetrySettings} object, or an associative array + * of retry settings parameters. See the documentation on + * {@see Google\GAX\RetrySettings} for example usage. + * } + * + * @return \Google\Logging\V2\LogExclusion + * + * @throws \Google\GAX\ApiException if the remote call fails + * @experimental + */ + public function updateExclusion($name, $exclusion, $updateMask, $optionalArgs = []) + { + $request = new UpdateExclusionRequest(); + $request->setName($name); + $request->setExclusion($exclusion); + $request->setUpdateMask($updateMask); + + $defaultCallSettings = $this->defaultCallSettings['updateExclusion']; + if (isset($optionalArgs['retrySettings']) && is_array($optionalArgs['retrySettings'])) { + $optionalArgs['retrySettings'] = $defaultCallSettings->getRetrySettings()->with( + $optionalArgs['retrySettings'] + ); + } + $mergedSettings = $defaultCallSettings->merge(new CallSettings($optionalArgs)); + $callable = ApiCallable::createApiCall( + $this->configServiceV2Stub, + 'UpdateExclusion', + $mergedSettings, + $this->descriptors['updateExclusion'] + ); + + return $callable( + $request, + [], + ['call_credentials_callback' => $this->createCredentialsCallback()]); + } + + /** + * Deletes an exclusion. + * + * Sample code: + * ``` + * try { + * $configServiceV2Client = new ConfigServiceV2Client(); + * $formattedName = $configServiceV2Client->exclusionName('[PROJECT]', '[EXCLUSION]'); + * $configServiceV2Client->deleteExclusion($formattedName); + * } finally { + * $configServiceV2Client->close(); + * } + * ``` + * + * @param string $name Required. The resource name of an existing exclusion to delete: + * + * "projects/[PROJECT_ID]/exclusions/[EXCLUSION_ID]" + * "organizations/[ORGANIZATION_ID]/exclusions/[EXCLUSION_ID]" + * "billingAccounts/[BILLING_ACCOUNT_ID]/exclusions/[EXCLUSION_ID]" + * "folders/[FOLDER_ID]/exclusions/[EXCLUSION_ID]" + * + * Example: `"projects/my-project-id/exclusions/my-exclusion-id"`. + * @param array $optionalArgs { + * Optional + * + * @type \Google\GAX\RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a + * {@see Google\GAX\RetrySettings} object, or an associative array + * of retry settings parameters. See the documentation on + * {@see Google\GAX\RetrySettings} for example usage. + * } + * + * @throws \Google\GAX\ApiException if the remote call fails + * @experimental + */ + public function deleteExclusion($name, $optionalArgs = []) + { + $request = new DeleteExclusionRequest(); + $request->setName($name); + + $defaultCallSettings = $this->defaultCallSettings['deleteExclusion']; + if (isset($optionalArgs['retrySettings']) && is_array($optionalArgs['retrySettings'])) { + $optionalArgs['retrySettings'] = $defaultCallSettings->getRetrySettings()->with( + $optionalArgs['retrySettings'] + ); + } + $mergedSettings = $defaultCallSettings->merge(new CallSettings($optionalArgs)); + $callable = ApiCallable::createApiCall( + $this->configServiceV2Stub, + 'DeleteExclusion', + $mergedSettings, + $this->descriptors['deleteExclusion'] + ); + + return $callable( + $request, + [], + ['call_credentials_callback' => $this->createCredentialsCallback()]); + } + /** * Initiates an orderly shutdown in which preexisting calls continue but new * calls are immediately cancelled. diff --git a/src/Logging/V2/Gapic/LoggingServiceV2GapicClient.php b/src/Logging/V2/Gapic/LoggingServiceV2GapicClient.php index afcc13483bdc..3f64b5f54cf3 100644 --- a/src/Logging/V2/Gapic/LoggingServiceV2GapicClient.php +++ b/src/Logging/V2/Gapic/LoggingServiceV2GapicClient.php @@ -60,7 +60,7 @@ * ``` * try { * $loggingServiceV2Client = new LoggingServiceV2Client(); - * $formattedLogName = $loggingServiceV2Client->logName("[PROJECT]", "[LOG]"); + * $formattedLogName = $loggingServiceV2Client->logName('[PROJECT]', '[LOG]'); * $loggingServiceV2Client->deleteLog($formattedLogName); * } finally { * $loggingServiceV2Client->close(); @@ -137,6 +137,7 @@ private static function getPathTemplateMap() return self::$pathTemplateMap; } + private static function getPageStreamingDescriptors() { $listLogEntriesPageStreamingDescriptor = @@ -196,7 +197,7 @@ private static function getGapicVersion() * * @param string $project * - * @return string The formatted project resource. + * @return string the formatted project resource * @experimental */ public static function projectName($project) @@ -213,7 +214,7 @@ public static function projectName($project) * @param string $project * @param string $log * - * @return string The formatted log resource. + * @return string the formatted log resource * @experimental */ public static function logName($project, $log) @@ -239,9 +240,9 @@ public static function logName($project, $log) * @param string $formattedName The formatted name string * @param string $template Optional name of template to match * - * @return array An associative array from name component IDs to component values. + * @return array an associative array from name component IDs to component values * - * @throws ValidationException If $formattedName could not be matched. + * @throws ValidationException if $formattedName could not be matched * @experimental */ public static function parseName($formattedName, $template = null) @@ -383,7 +384,7 @@ public function __construct($options = []) * ``` * try { * $loggingServiceV2Client = new LoggingServiceV2Client(); - * $formattedLogName = $loggingServiceV2Client->logName("[PROJECT]", "[LOG]"); + * $formattedLogName = $loggingServiceV2Client->logName('[PROJECT]', '[LOG]'); * $loggingServiceV2Client->deleteLog($formattedLogName); * } finally { * $loggingServiceV2Client->close(); @@ -403,7 +404,7 @@ public function __construct($options = []) * For more information about log names, see * [LogEntry][google.logging.v2.LogEntry]. * @param array $optionalArgs { - * Optional. + * Optional * * @type \Google\GAX\RetrySettings|array $retrySettings * Retry settings to use for this call. Can be a @@ -482,7 +483,7 @@ public function deleteLog($logName, $optionalArgs = []) * you should try to include several log entries in this list, * rather than calling this method for each individual log entry. * @param array $optionalArgs { - * Optional. + * Optional * * @type string $logName * Optional. A default log resource name that is assigned to all log entries @@ -583,8 +584,8 @@ public function writeLogEntries($entries, $optionalArgs = []) * // doSomethingWith($element); * } * - * // OR iterate over pages of elements, with the maximum page size set to 5 - * $pagedResponse = $loggingServiceV2Client->listLogEntries($resourceNames, ['pageSize' => 5]); + * // OR iterate over pages of elements + * $pagedResponse = $loggingServiceV2Client->listLogEntries($resourceNames); * foreach ($pagedResponse->iteratePages() as $page) { * foreach ($page as $element) { * // doSomethingWith($element); @@ -605,7 +606,7 @@ public function writeLogEntries($entries, $optionalArgs = []) * * Projects listed in the `project_ids` field are added to this list. * @param array $optionalArgs { - * Optional. + * Optional * * @type string[] $projectIds * Deprecated. Use `resource_names` instead. One or more project identifiers @@ -704,8 +705,8 @@ public function listLogEntries($resourceNames, $optionalArgs = []) * // doSomethingWith($element); * } * - * // OR iterate over pages of elements, with the maximum page size set to 5 - * $pagedResponse = $loggingServiceV2Client->listMonitoredResourceDescriptors(['pageSize' => 5]); + * // OR iterate over pages of elements + * $pagedResponse = $loggingServiceV2Client->listMonitoredResourceDescriptors(); * foreach ($pagedResponse->iteratePages() as $page) { * foreach ($page as $element) { * // doSomethingWith($element); @@ -717,7 +718,7 @@ public function listLogEntries($resourceNames, $optionalArgs = []) * ``` * * @param array $optionalArgs { - * Optional. + * Optional * * @type int $pageSize * The maximum number of resources contained in the underlying API @@ -778,15 +779,15 @@ public function listMonitoredResourceDescriptors($optionalArgs = []) * ``` * try { * $loggingServiceV2Client = new LoggingServiceV2Client(); - * $formattedParent = $loggingServiceV2Client->projectName("[PROJECT]"); + * $formattedParent = $loggingServiceV2Client->projectName('[PROJECT]'); * // Iterate through all elements * $pagedResponse = $loggingServiceV2Client->listLogs($formattedParent); * foreach ($pagedResponse->iterateAllElements() as $element) { * // doSomethingWith($element); * } * - * // OR iterate over pages of elements, with the maximum page size set to 5 - * $pagedResponse = $loggingServiceV2Client->listLogs($formattedParent, ['pageSize' => 5]); + * // OR iterate over pages of elements + * $pagedResponse = $loggingServiceV2Client->listLogs($formattedParent); * foreach ($pagedResponse->iteratePages() as $page) { * foreach ($page as $element) { * // doSomethingWith($element); @@ -804,7 +805,7 @@ public function listMonitoredResourceDescriptors($optionalArgs = []) * "billingAccounts/[BILLING_ACCOUNT_ID]" * "folders/[FOLDER_ID]" * @param array $optionalArgs { - * Optional. + * Optional * * @type int $pageSize * The maximum number of resources contained in the underlying API diff --git a/src/Logging/V2/Gapic/MetricsServiceV2GapicClient.php b/src/Logging/V2/Gapic/MetricsServiceV2GapicClient.php index f1ccaf9d5667..4b2886769142 100644 --- a/src/Logging/V2/Gapic/MetricsServiceV2GapicClient.php +++ b/src/Logging/V2/Gapic/MetricsServiceV2GapicClient.php @@ -59,15 +59,15 @@ * ``` * try { * $metricsServiceV2Client = new MetricsServiceV2Client(); - * $formattedParent = $metricsServiceV2Client->projectName("[PROJECT]"); + * $formattedParent = $metricsServiceV2Client->projectName('[PROJECT]'); * // Iterate through all elements * $pagedResponse = $metricsServiceV2Client->listLogMetrics($formattedParent); * foreach ($pagedResponse->iterateAllElements() as $element) { * // doSomethingWith($element); * } * - * // OR iterate over pages of elements, with the maximum page size set to 5 - * $pagedResponse = $metricsServiceV2Client->listLogMetrics($formattedParent, ['pageSize' => 5]); + * // OR iterate over pages of elements + * $pagedResponse = $metricsServiceV2Client->listLogMetrics($formattedParent); * foreach ($pagedResponse->iteratePages() as $page) { * foreach ($page as $element) { * // doSomethingWith($element); @@ -148,6 +148,7 @@ private static function getPathTemplateMap() return self::$pathTemplateMap; } + private static function getPageStreamingDescriptors() { $listLogMetricsPageStreamingDescriptor = @@ -187,7 +188,7 @@ private static function getGapicVersion() * * @param string $project * - * @return string The formatted project resource. + * @return string the formatted project resource * @experimental */ public static function projectName($project) @@ -204,7 +205,7 @@ public static function projectName($project) * @param string $project * @param string $metric * - * @return string The formatted metric resource. + * @return string the formatted metric resource * @experimental */ public static function metricName($project, $metric) @@ -230,9 +231,9 @@ public static function metricName($project, $metric) * @param string $formattedName The formatted name string * @param string $template Optional name of template to match * - * @return array An associative array from name component IDs to component values. + * @return array an associative array from name component IDs to component values * - * @throws ValidationException If $formattedName could not be matched. + * @throws ValidationException if $formattedName could not be matched * @experimental */ public static function parseName($formattedName, $template = null) @@ -371,15 +372,15 @@ public function __construct($options = []) * ``` * try { * $metricsServiceV2Client = new MetricsServiceV2Client(); - * $formattedParent = $metricsServiceV2Client->projectName("[PROJECT]"); + * $formattedParent = $metricsServiceV2Client->projectName('[PROJECT]'); * // Iterate through all elements * $pagedResponse = $metricsServiceV2Client->listLogMetrics($formattedParent); * foreach ($pagedResponse->iterateAllElements() as $element) { * // doSomethingWith($element); * } * - * // OR iterate over pages of elements, with the maximum page size set to 5 - * $pagedResponse = $metricsServiceV2Client->listLogMetrics($formattedParent, ['pageSize' => 5]); + * // OR iterate over pages of elements + * $pagedResponse = $metricsServiceV2Client->listLogMetrics($formattedParent); * foreach ($pagedResponse->iteratePages() as $page) { * foreach ($page as $element) { * // doSomethingWith($element); @@ -394,7 +395,7 @@ public function __construct($options = []) * * "projects/[PROJECT_ID]" * @param array $optionalArgs { - * Optional. + * Optional * * @type string $pageToken * A page token is used to specify a page of values to be returned. @@ -455,7 +456,7 @@ public function listLogMetrics($parent, $optionalArgs = []) * ``` * try { * $metricsServiceV2Client = new MetricsServiceV2Client(); - * $formattedMetricName = $metricsServiceV2Client->metricName("[PROJECT]", "[METRIC]"); + * $formattedMetricName = $metricsServiceV2Client->metricName('[PROJECT]', '[METRIC]'); * $response = $metricsServiceV2Client->getLogMetric($formattedMetricName); * } finally { * $metricsServiceV2Client->close(); @@ -466,7 +467,7 @@ public function listLogMetrics($parent, $optionalArgs = []) * * "projects/[PROJECT_ID]/metrics/[METRIC_ID]" * @param array $optionalArgs { - * Optional. + * Optional * * @type \Google\GAX\RetrySettings|array $retrySettings * Retry settings to use for this call. Can be a @@ -512,7 +513,7 @@ public function getLogMetric($metricName, $optionalArgs = []) * ``` * try { * $metricsServiceV2Client = new MetricsServiceV2Client(); - * $formattedParent = $metricsServiceV2Client->projectName("[PROJECT]"); + * $formattedParent = $metricsServiceV2Client->projectName('[PROJECT]'); * $metric = new LogMetric(); * $response = $metricsServiceV2Client->createLogMetric($formattedParent, $metric); * } finally { @@ -520,15 +521,15 @@ public function getLogMetric($metricName, $optionalArgs = []) * } * ``` * - * @param string $parent The resource name of the project in which to create the metric: + * @param string $parent the resource name of the project in which to create the metric: * * "projects/[PROJECT_ID]" * - * The new metric must be provided in the request. - * @param LogMetric $metric The new logs-based metric, which must not have an identifier that - * already exists. + * The new metric must be provided in the request + * @param LogMetric $metric the new logs-based metric, which must not have an identifier that + * already exists * @param array $optionalArgs { - * Optional. + * Optional * * @type \Google\GAX\RetrySettings|array $retrySettings * Retry settings to use for this call. Can be a @@ -575,7 +576,7 @@ public function createLogMetric($parent, $metric, $optionalArgs = []) * ``` * try { * $metricsServiceV2Client = new MetricsServiceV2Client(); - * $formattedMetricName = $metricsServiceV2Client->metricName("[PROJECT]", "[METRIC]"); + * $formattedMetricName = $metricsServiceV2Client->metricName('[PROJECT]', '[METRIC]'); * $metric = new LogMetric(); * $response = $metricsServiceV2Client->updateLogMetric($formattedMetricName, $metric); * } finally { @@ -583,16 +584,16 @@ public function createLogMetric($parent, $metric, $optionalArgs = []) * } * ``` * - * @param string $metricName The resource name of the metric to update: + * @param string $metricName the resource name of the metric to update: * * "projects/[PROJECT_ID]/metrics/[METRIC_ID]" * * The updated metric must be provided in the request and it's * `name` field must be the same as `[METRIC_ID]` If the metric - * does not exist in `[PROJECT_ID]`, then a new metric is created. - * @param LogMetric $metric The updated metric. + * does not exist in `[PROJECT_ID]`, then a new metric is created + * @param LogMetric $metric the updated metric * @param array $optionalArgs { - * Optional. + * Optional * * @type \Google\GAX\RetrySettings|array $retrySettings * Retry settings to use for this call. Can be a @@ -639,7 +640,7 @@ public function updateLogMetric($metricName, $metric, $optionalArgs = []) * ``` * try { * $metricsServiceV2Client = new MetricsServiceV2Client(); - * $formattedMetricName = $metricsServiceV2Client->metricName("[PROJECT]", "[METRIC]"); + * $formattedMetricName = $metricsServiceV2Client->metricName('[PROJECT]', '[METRIC]'); * $metricsServiceV2Client->deleteLogMetric($formattedMetricName); * } finally { * $metricsServiceV2Client->close(); @@ -650,7 +651,7 @@ public function updateLogMetric($metricName, $metric, $optionalArgs = []) * * "projects/[PROJECT_ID]/metrics/[METRIC_ID]" * @param array $optionalArgs { - * Optional. + * Optional * * @type \Google\GAX\RetrySettings|array $retrySettings * Retry settings to use for this call. Can be a diff --git a/src/Logging/V2/resources/config_service_v2_client_config.json b/src/Logging/V2/resources/config_service_v2_client_config.json index c0a6ecfa533c..733cac2aba0a 100644 --- a/src/Logging/V2/resources/config_service_v2_client_config.json +++ b/src/Logging/V2/resources/config_service_v2_client_config.json @@ -14,35 +14,69 @@ "initial_retry_delay_millis": 100, "retry_delay_multiplier": 1.2, "max_retry_delay_millis": 1000, - "initial_rpc_timeout_millis": 2000, + "initial_rpc_timeout_millis": 30000, "rpc_timeout_multiplier": 1.5, - "max_rpc_timeout_millis": 30000, - "total_timeout_millis": 45000 + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 90000 + }, + "write_sink": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.2, + "max_retry_delay_millis": 1000, + "initial_rpc_timeout_millis": 30000, + "rpc_timeout_multiplier": 1.5, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 120000 } }, "methods": { "ListSinks": { - "timeout_millis": 30000, + "timeout_millis": 60000, "retry_codes_name": "idempotent", "retry_params_name": "default" }, "GetSink": { - "timeout_millis": 30000, + "timeout_millis": 60000, "retry_codes_name": "idempotent", "retry_params_name": "default" }, "CreateSink": { - "timeout_millis": 30000, + "timeout_millis": 120000, "retry_codes_name": "non_idempotent", "retry_params_name": "default" }, "UpdateSink": { - "timeout_millis": 30000, + "timeout_millis": 120000, "retry_codes_name": "non_idempotent", "retry_params_name": "default" }, "DeleteSink": { - "timeout_millis": 30000, + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "ListExclusions": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "GetExclusion": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "CreateExclusion": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateExclusion": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteExclusion": { + "timeout_millis": 60000, "retry_codes_name": "idempotent", "retry_params_name": "default" } diff --git a/src/Logging/V2/resources/logging_service_v2_client_config.json b/src/Logging/V2/resources/logging_service_v2_client_config.json index 19f31df6f4bf..5d2fc1d67128 100644 --- a/src/Logging/V2/resources/logging_service_v2_client_config.json +++ b/src/Logging/V2/resources/logging_service_v2_client_config.json @@ -14,29 +14,29 @@ "initial_retry_delay_millis": 100, "retry_delay_multiplier": 1.2, "max_retry_delay_millis": 1000, - "initial_rpc_timeout_millis": 2000, + "initial_rpc_timeout_millis": 20000, "rpc_timeout_multiplier": 1.5, - "max_rpc_timeout_millis": 30000, - "total_timeout_millis": 45000 + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 90000 }, "list": { "initial_retry_delay_millis": 100, "retry_delay_multiplier": 1.2, "max_retry_delay_millis": 1000, - "initial_rpc_timeout_millis": 7000, + "initial_rpc_timeout_millis": 2000, "rpc_timeout_multiplier": 1.5, - "max_rpc_timeout_millis": 30000, - "total_timeout_millis": 45000 + "max_rpc_timeout_millis": 10000, + "total_timeout_millis": 20000 } }, "methods": { "DeleteLog": { - "timeout_millis": 30000, + "timeout_millis": 60000, "retry_codes_name": "idempotent", "retry_params_name": "default" }, "WriteLogEntries": { - "timeout_millis": 30000, + "timeout_millis": 60000, "retry_codes_name": "non_idempotent", "retry_params_name": "default", "bundling": { @@ -46,17 +46,17 @@ } }, "ListLogEntries": { - "timeout_millis": 30000, + "timeout_millis": 10000, "retry_codes_name": "idempotent", "retry_params_name": "list" }, "ListMonitoredResourceDescriptors": { - "timeout_millis": 30000, + "timeout_millis": 60000, "retry_codes_name": "idempotent", "retry_params_name": "default" }, "ListLogs": { - "timeout_millis": 30000, + "timeout_millis": 60000, "retry_codes_name": "idempotent", "retry_params_name": "default" } diff --git a/src/Logging/V2/resources/metrics_service_v2_client_config.json b/src/Logging/V2/resources/metrics_service_v2_client_config.json index 205eae8dd194..a0678701c210 100644 --- a/src/Logging/V2/resources/metrics_service_v2_client_config.json +++ b/src/Logging/V2/resources/metrics_service_v2_client_config.json @@ -14,35 +14,35 @@ "initial_retry_delay_millis": 100, "retry_delay_multiplier": 1.2, "max_retry_delay_millis": 1000, - "initial_rpc_timeout_millis": 2000, + "initial_rpc_timeout_millis": 20000, "rpc_timeout_multiplier": 1.5, - "max_rpc_timeout_millis": 30000, - "total_timeout_millis": 45000 + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 90000 } }, "methods": { "ListLogMetrics": { - "timeout_millis": 30000, + "timeout_millis": 60000, "retry_codes_name": "idempotent", "retry_params_name": "default" }, "GetLogMetric": { - "timeout_millis": 30000, + "timeout_millis": 60000, "retry_codes_name": "idempotent", "retry_params_name": "default" }, "CreateLogMetric": { - "timeout_millis": 30000, + "timeout_millis": 60000, "retry_codes_name": "non_idempotent", "retry_params_name": "default" }, "UpdateLogMetric": { - "timeout_millis": 30000, + "timeout_millis": 60000, "retry_codes_name": "non_idempotent", "retry_params_name": "default" }, "DeleteLogMetric": { - "timeout_millis": 30000, + "timeout_millis": 60000, "retry_codes_name": "idempotent", "retry_params_name": "default" } diff --git a/src/Monitoring/V3/Gapic/GroupServiceGapicClient.php b/src/Monitoring/V3/Gapic/GroupServiceGapicClient.php index df660abb679b..a0015110045a 100644 --- a/src/Monitoring/V3/Gapic/GroupServiceGapicClient.php +++ b/src/Monitoring/V3/Gapic/GroupServiceGapicClient.php @@ -72,15 +72,15 @@ * ``` * try { * $groupServiceClient = new GroupServiceClient(); - * $formattedName = $groupServiceClient->projectName("[PROJECT]"); + * $formattedName = $groupServiceClient->projectName('[PROJECT]'); * // Iterate through all elements * $pagedResponse = $groupServiceClient->listGroups($formattedName); * foreach ($pagedResponse->iterateAllElements() as $element) { * // doSomethingWith($element); * } * - * // OR iterate over pages of elements, with the maximum page size set to 5 - * $pagedResponse = $groupServiceClient->listGroups($formattedName, ['pageSize' => 5]); + * // OR iterate over pages of elements + * $pagedResponse = $groupServiceClient->listGroups($formattedName); * foreach ($pagedResponse->iteratePages() as $page) { * foreach ($page as $element) { * // doSomethingWith($element); @@ -161,6 +161,7 @@ private static function getPathTemplateMap() return self::$pathTemplateMap; } + private static function getPageStreamingDescriptors() { $listGroupsPageStreamingDescriptor = @@ -210,7 +211,7 @@ private static function getGapicVersion() * * @param string $project * - * @return string The formatted project resource. + * @return string the formatted project resource * @experimental */ public static function projectName($project) @@ -227,7 +228,7 @@ public static function projectName($project) * @param string $project * @param string $group * - * @return string The formatted group resource. + * @return string the formatted group resource * @experimental */ public static function groupName($project, $group) @@ -253,9 +254,9 @@ public static function groupName($project, $group) * @param string $formattedName The formatted name string * @param string $template Optional name of template to match * - * @return array An associative array from name component IDs to component values. + * @return array an associative array from name component IDs to component values * - * @throws ValidationException If $formattedName could not be matched. + * @throws ValidationException if $formattedName could not be matched * @experimental */ public static function parseName($formattedName, $template = null) @@ -394,15 +395,15 @@ public function __construct($options = []) * ``` * try { * $groupServiceClient = new GroupServiceClient(); - * $formattedName = $groupServiceClient->projectName("[PROJECT]"); + * $formattedName = $groupServiceClient->projectName('[PROJECT]'); * // Iterate through all elements * $pagedResponse = $groupServiceClient->listGroups($formattedName); * foreach ($pagedResponse->iterateAllElements() as $element) { * // doSomethingWith($element); * } * - * // OR iterate over pages of elements, with the maximum page size set to 5 - * $pagedResponse = $groupServiceClient->listGroups($formattedName, ['pageSize' => 5]); + * // OR iterate over pages of elements + * $pagedResponse = $groupServiceClient->listGroups($formattedName); * foreach ($pagedResponse->iteratePages() as $page) { * foreach ($page as $element) { * // doSomethingWith($element); @@ -416,7 +417,7 @@ public function __construct($options = []) * @param string $name The project whose groups are to be listed. The format is * `"projects/{project_id_or_number}"`. * @param array $optionalArgs { - * Optional. + * Optional * * @type string $childrenOfGroup * A group name: `"projects/{project_id_or_number}/groups/{group_id}"`. @@ -501,7 +502,7 @@ public function listGroups($name, $optionalArgs = []) * ``` * try { * $groupServiceClient = new GroupServiceClient(); - * $formattedName = $groupServiceClient->groupName("[PROJECT]", "[GROUP]"); + * $formattedName = $groupServiceClient->groupName('[PROJECT]', '[GROUP]'); * $response = $groupServiceClient->getGroup($formattedName); * } finally { * $groupServiceClient->close(); @@ -511,7 +512,7 @@ public function listGroups($name, $optionalArgs = []) * @param string $name The group to retrieve. The format is * `"projects/{project_id_or_number}/groups/{group_id}"`. * @param array $optionalArgs { - * Optional. + * Optional * * @type \Google\GAX\RetrySettings|array $retrySettings * Retry settings to use for this call. Can be a @@ -557,7 +558,7 @@ public function getGroup($name, $optionalArgs = []) * ``` * try { * $groupServiceClient = new GroupServiceClient(); - * $formattedName = $groupServiceClient->projectName("[PROJECT]"); + * $formattedName = $groupServiceClient->projectName('[PROJECT]'); * $group = new Group(); * $response = $groupServiceClient->createGroup($formattedName, $group); * } finally { @@ -570,7 +571,7 @@ public function getGroup($name, $optionalArgs = []) * @param Group $group A group definition. It is an error to define the `name` field because * the system assigns the name. * @param array $optionalArgs { - * Optional. + * Optional * * @type bool $validateOnly * If true, validate this request but do not create the group. @@ -633,7 +634,7 @@ public function createGroup($name, $group, $optionalArgs = []) * @param Group $group The new definition of the group. All fields of the existing group, * excepting `name`, are replaced with the corresponding fields of this group. * @param array $optionalArgs { - * Optional. + * Optional * * @type bool $validateOnly * If true, validate this request but do not update the existing group. @@ -684,7 +685,7 @@ public function updateGroup($group, $optionalArgs = []) * ``` * try { * $groupServiceClient = new GroupServiceClient(); - * $formattedName = $groupServiceClient->groupName("[PROJECT]", "[GROUP]"); + * $formattedName = $groupServiceClient->groupName('[PROJECT]', '[GROUP]'); * $groupServiceClient->deleteGroup($formattedName); * } finally { * $groupServiceClient->close(); @@ -694,7 +695,7 @@ public function updateGroup($group, $optionalArgs = []) * @param string $name The group to delete. The format is * `"projects/{project_id_or_number}/groups/{group_id}"`. * @param array $optionalArgs { - * Optional. + * Optional * * @type \Google\GAX\RetrySettings|array $retrySettings * Retry settings to use for this call. Can be a @@ -738,15 +739,15 @@ public function deleteGroup($name, $optionalArgs = []) * ``` * try { * $groupServiceClient = new GroupServiceClient(); - * $formattedName = $groupServiceClient->groupName("[PROJECT]", "[GROUP]"); + * $formattedName = $groupServiceClient->groupName('[PROJECT]', '[GROUP]'); * // Iterate through all elements * $pagedResponse = $groupServiceClient->listGroupMembers($formattedName); * foreach ($pagedResponse->iterateAllElements() as $element) { * // doSomethingWith($element); * } * - * // OR iterate over pages of elements, with the maximum page size set to 5 - * $pagedResponse = $groupServiceClient->listGroupMembers($formattedName, ['pageSize' => 5]); + * // OR iterate over pages of elements + * $pagedResponse = $groupServiceClient->listGroupMembers($formattedName); * foreach ($pagedResponse->iteratePages() as $page) { * foreach ($page as $element) { * // doSomethingWith($element); @@ -760,7 +761,7 @@ public function deleteGroup($name, $optionalArgs = []) * @param string $name The group whose members are listed. The format is * `"projects/{project_id_or_number}/groups/{group_id}"`. * @param array $optionalArgs { - * Optional. + * Optional * * @type int $pageSize * The maximum number of resources contained in the underlying API diff --git a/src/Monitoring/V3/Gapic/MetricServiceGapicClient.php b/src/Monitoring/V3/Gapic/MetricServiceGapicClient.php index c0f82ad77984..61ac1a6579a0 100644 --- a/src/Monitoring/V3/Gapic/MetricServiceGapicClient.php +++ b/src/Monitoring/V3/Gapic/MetricServiceGapicClient.php @@ -67,15 +67,15 @@ * ``` * try { * $metricServiceClient = new MetricServiceClient(); - * $formattedName = $metricServiceClient->projectName("[PROJECT]"); + * $formattedName = $metricServiceClient->projectName('[PROJECT]'); * // Iterate through all elements * $pagedResponse = $metricServiceClient->listMonitoredResourceDescriptors($formattedName); * foreach ($pagedResponse->iterateAllElements() as $element) { * // doSomethingWith($element); * } * - * // OR iterate over pages of elements, with the maximum page size set to 5 - * $pagedResponse = $metricServiceClient->listMonitoredResourceDescriptors($formattedName, ['pageSize' => 5]); + * // OR iterate over pages of elements + * $pagedResponse = $metricServiceClient->listMonitoredResourceDescriptors($formattedName); * foreach ($pagedResponse->iteratePages() as $page) { * foreach ($page as $element) { * // doSomethingWith($element); @@ -167,6 +167,7 @@ private static function getPathTemplateMap() return self::$pathTemplateMap; } + private static function getPageStreamingDescriptors() { $listMonitoredResourceDescriptorsPageStreamingDescriptor = @@ -226,7 +227,7 @@ private static function getGapicVersion() * * @param string $project * - * @return string The formatted project resource. + * @return string the formatted project resource * @experimental */ public static function projectName($project) @@ -243,7 +244,7 @@ public static function projectName($project) * @param string $project * @param string $metricDescriptor * - * @return string The formatted metric_descriptor resource. + * @return string the formatted metric_descriptor resource * @experimental */ public static function metricDescriptorName($project, $metricDescriptor) @@ -261,7 +262,7 @@ public static function metricDescriptorName($project, $metricDescriptor) * @param string $project * @param string $monitoredResourceDescriptor * - * @return string The formatted monitored_resource_descriptor resource. + * @return string the formatted monitored_resource_descriptor resource * @experimental */ public static function monitoredResourceDescriptorName($project, $monitoredResourceDescriptor) @@ -288,9 +289,9 @@ public static function monitoredResourceDescriptorName($project, $monitoredResou * @param string $formattedName The formatted name string * @param string $template Optional name of template to match * - * @return array An associative array from name component IDs to component values. + * @return array an associative array from name component IDs to component values * - * @throws ValidationException If $formattedName could not be matched. + * @throws ValidationException if $formattedName could not be matched * @experimental */ public static function parseName($formattedName, $template = null) @@ -431,15 +432,15 @@ public function __construct($options = []) * ``` * try { * $metricServiceClient = new MetricServiceClient(); - * $formattedName = $metricServiceClient->projectName("[PROJECT]"); + * $formattedName = $metricServiceClient->projectName('[PROJECT]'); * // Iterate through all elements * $pagedResponse = $metricServiceClient->listMonitoredResourceDescriptors($formattedName); * foreach ($pagedResponse->iterateAllElements() as $element) { * // doSomethingWith($element); * } * - * // OR iterate over pages of elements, with the maximum page size set to 5 - * $pagedResponse = $metricServiceClient->listMonitoredResourceDescriptors($formattedName, ['pageSize' => 5]); + * // OR iterate over pages of elements + * $pagedResponse = $metricServiceClient->listMonitoredResourceDescriptors($formattedName); * foreach ($pagedResponse->iteratePages() as $page) { * foreach ($page as $element) { * // doSomethingWith($element); @@ -453,7 +454,7 @@ public function __construct($options = []) * @param string $name The project on which to execute the request. The format is * `"projects/{project_id_or_number}"`. * @param array $optionalArgs { - * Optional. + * Optional * * @type string $filter * An optional [filter](https://cloud.google.com/monitoring/api/v3/filters) describing @@ -525,7 +526,7 @@ public function listMonitoredResourceDescriptors($name, $optionalArgs = []) * ``` * try { * $metricServiceClient = new MetricServiceClient(); - * $formattedName = $metricServiceClient->monitoredResourceDescriptorName("[PROJECT]", "[MONITORED_RESOURCE_DESCRIPTOR]"); + * $formattedName = $metricServiceClient->monitoredResourceDescriptorName('[PROJECT]', '[MONITORED_RESOURCE_DESCRIPTOR]'); * $response = $metricServiceClient->getMonitoredResourceDescriptor($formattedName); * } finally { * $metricServiceClient->close(); @@ -537,7 +538,7 @@ public function listMonitoredResourceDescriptors($name, $optionalArgs = []) * The `{resource_type}` is a predefined type, such as * `cloudsql_database`. * @param array $optionalArgs { - * Optional. + * Optional * * @type \Google\GAX\RetrySettings|array $retrySettings * Retry settings to use for this call. Can be a @@ -583,15 +584,15 @@ public function getMonitoredResourceDescriptor($name, $optionalArgs = []) * ``` * try { * $metricServiceClient = new MetricServiceClient(); - * $formattedName = $metricServiceClient->projectName("[PROJECT]"); + * $formattedName = $metricServiceClient->projectName('[PROJECT]'); * // Iterate through all elements * $pagedResponse = $metricServiceClient->listMetricDescriptors($formattedName); * foreach ($pagedResponse->iterateAllElements() as $element) { * // doSomethingWith($element); * } * - * // OR iterate over pages of elements, with the maximum page size set to 5 - * $pagedResponse = $metricServiceClient->listMetricDescriptors($formattedName, ['pageSize' => 5]); + * // OR iterate over pages of elements + * $pagedResponse = $metricServiceClient->listMetricDescriptors($formattedName); * foreach ($pagedResponse->iteratePages() as $page) { * foreach ($page as $element) { * // doSomethingWith($element); @@ -605,7 +606,7 @@ public function getMonitoredResourceDescriptor($name, $optionalArgs = []) * @param string $name The project on which to execute the request. The format is * `"projects/{project_id_or_number}"`. * @param array $optionalArgs { - * Optional. + * Optional * * @type string $filter * If this field is empty, all custom and @@ -678,7 +679,7 @@ public function listMetricDescriptors($name, $optionalArgs = []) * ``` * try { * $metricServiceClient = new MetricServiceClient(); - * $formattedName = $metricServiceClient->metricDescriptorName("[PROJECT]", "[METRIC_DESCRIPTOR]"); + * $formattedName = $metricServiceClient->metricDescriptorName('[PROJECT]', '[METRIC_DESCRIPTOR]'); * $response = $metricServiceClient->getMetricDescriptor($formattedName); * } finally { * $metricServiceClient->close(); @@ -690,7 +691,7 @@ public function listMetricDescriptors($name, $optionalArgs = []) * An example value of `{metric_id}` is * `"compute.googleapis.com/instance/disk/read_bytes_count"`. * @param array $optionalArgs { - * Optional. + * Optional * * @type \Google\GAX\RetrySettings|array $retrySettings * Retry settings to use for this call. Can be a @@ -738,7 +739,7 @@ public function getMetricDescriptor($name, $optionalArgs = []) * ``` * try { * $metricServiceClient = new MetricServiceClient(); - * $formattedName = $metricServiceClient->projectName("[PROJECT]"); + * $formattedName = $metricServiceClient->projectName('[PROJECT]'); * $metricDescriptor = new MetricDescriptor(); * $response = $metricServiceClient->createMetricDescriptor($formattedName, $metricDescriptor); * } finally { @@ -751,7 +752,7 @@ public function getMetricDescriptor($name, $optionalArgs = []) * @param MetricDescriptor $metricDescriptor The new [custom metric](https://cloud.google.com/monitoring/custom-metrics) * descriptor. * @param array $optionalArgs { - * Optional. + * Optional * * @type \Google\GAX\RetrySettings|array $retrySettings * Retry settings to use for this call. Can be a @@ -799,7 +800,7 @@ public function createMetricDescriptor($name, $metricDescriptor, $optionalArgs = * ``` * try { * $metricServiceClient = new MetricServiceClient(); - * $formattedName = $metricServiceClient->metricDescriptorName("[PROJECT]", "[METRIC_DESCRIPTOR]"); + * $formattedName = $metricServiceClient->metricDescriptorName('[PROJECT]', '[METRIC_DESCRIPTOR]'); * $metricServiceClient->deleteMetricDescriptor($formattedName); * } finally { * $metricServiceClient->close(); @@ -811,7 +812,7 @@ public function createMetricDescriptor($name, $metricDescriptor, $optionalArgs = * An example of `{metric_id}` is: * `"custom.googleapis.com/my_test_metric"`. * @param array $optionalArgs { - * Optional. + * Optional * * @type \Google\GAX\RetrySettings|array $retrySettings * Retry settings to use for this call. Can be a @@ -855,8 +856,8 @@ public function deleteMetricDescriptor($name, $optionalArgs = []) * ``` * try { * $metricServiceClient = new MetricServiceClient(); - * $formattedName = $metricServiceClient->projectName("[PROJECT]"); - * $filter = ""; + * $formattedName = $metricServiceClient->projectName('[PROJECT]'); + * $filter = ''; * $interval = new TimeInterval(); * $view = TimeSeriesView::FULL; * // Iterate through all elements @@ -865,8 +866,8 @@ public function deleteMetricDescriptor($name, $optionalArgs = []) * // doSomethingWith($element); * } * - * // OR iterate over pages of elements, with the maximum page size set to 5 - * $pagedResponse = $metricServiceClient->listTimeSeries($formattedName, $filter, $interval, $view, ['pageSize' => 5]); + * // OR iterate over pages of elements + * $pagedResponse = $metricServiceClient->listTimeSeries($formattedName, $filter, $interval, $view); * foreach ($pagedResponse->iteratePages() as $page) { * foreach ($page as $element) { * // doSomethingWith($element); @@ -892,7 +893,7 @@ public function deleteMetricDescriptor($name, $optionalArgs = []) * @param int $view Specifies which information is returned about the time series. * For allowed values, use constants defined on {@see \Google\Monitoring\V3\ListTimeSeriesRequest_TimeSeriesView} * @param array $optionalArgs { - * Optional. + * Optional * * @type Aggregation $aggregation * By default, the raw time series data is returned. @@ -973,7 +974,7 @@ public function listTimeSeries($name, $filter, $interval, $view, $optionalArgs = * ``` * try { * $metricServiceClient = new MetricServiceClient(); - * $formattedName = $metricServiceClient->projectName("[PROJECT]"); + * $formattedName = $metricServiceClient->projectName('[PROJECT]'); * $timeSeries = []; * $metricServiceClient->createTimeSeries($formattedName, $timeSeries); * } finally { @@ -989,7 +990,7 @@ public function listTimeSeries($name, $filter, $interval, $view, $optionalArgs = * `TimeSeries` value must fully specify a unique time series by supplying * all label values for the metric and the monitored resource. * @param array $optionalArgs { - * Optional. + * Optional * * @type \Google\GAX\RetrySettings|array $retrySettings * Retry settings to use for this call. Can be a diff --git a/src/PubSub/V1/Gapic/PublisherGapicClient.php b/src/PubSub/V1/Gapic/PublisherGapicClient.php index 7a079f9540e1..7047ab81b2ec 100644 --- a/src/PubSub/V1/Gapic/PublisherGapicClient.php +++ b/src/PubSub/V1/Gapic/PublisherGapicClient.php @@ -68,7 +68,7 @@ * ``` * try { * $publisherClient = new PublisherClient(); - * $formattedName = $publisherClient->topicName("[PROJECT]", "[TOPIC]"); + * $formattedName = $publisherClient->topicName('[PROJECT]', '[TOPIC]'); * $response = $publisherClient->createTopic($formattedName); * } finally { * $publisherClient->close(); @@ -146,6 +146,7 @@ private static function getPathTemplateMap() return self::$pathTemplateMap; } + private static function getPageStreamingDescriptors() { $listTopicsPageStreamingDescriptor = @@ -195,7 +196,7 @@ private static function getGapicVersion() * * @param string $project * - * @return string The formatted project resource. + * @return string the formatted project resource * @experimental */ public static function projectName($project) @@ -212,7 +213,7 @@ public static function projectName($project) * @param string $project * @param string $topic * - * @return string The formatted topic resource. + * @return string the formatted topic resource * @experimental */ public static function topicName($project, $topic) @@ -238,9 +239,9 @@ public static function topicName($project, $topic) * @param string $formattedName The formatted name string * @param string $template Optional name of template to match * - * @return array An associative array from name component IDs to component values. + * @return array an associative array from name component IDs to component values * - * @throws ValidationException If $formattedName could not be matched. + * @throws ValidationException if $formattedName could not be matched * @experimental */ public static function parseName($formattedName, $template = null) @@ -388,7 +389,7 @@ public function __construct($options = []) * ``` * try { * $publisherClient = new PublisherClient(); - * $formattedName = $publisherClient->topicName("[PROJECT]", "[TOPIC]"); + * $formattedName = $publisherClient->topicName('[PROJECT]', '[TOPIC]'); * $response = $publisherClient->createTopic($formattedName); * } finally { * $publisherClient->close(); @@ -402,7 +403,7 @@ public function __construct($options = []) * signs (`%`). It must be between 3 and 255 characters in length, and it * must not start with `"goog"`. * @param array $optionalArgs { - * Optional. + * Optional * * @type array $labels * User labels. @@ -466,11 +467,11 @@ public function createTopic($name, $optionalArgs = []) * } * ``` * - * @param Topic $topic The topic to update. + * @param Topic $topic the topic to update * @param FieldMask $updateMask Indicates which fields in the provided topic to update. * Must be specified and non-empty. * @param array $optionalArgs { - * Optional. + * Optional * * @type \Google\GAX\RetrySettings|array $retrySettings * Retry settings to use for this call. Can be a @@ -519,8 +520,8 @@ public function updateTopic($topic, $updateMask, $optionalArgs = []) * ``` * try { * $publisherClient = new PublisherClient(); - * $formattedTopic = $publisherClient->topicName("[PROJECT]", "[TOPIC]"); - * $data = ""; + * $formattedTopic = $publisherClient->topicName('[PROJECT]', '[TOPIC]'); + * $data = ''; * $messagesElement = new PubsubMessage(); * $messagesElement->setData($data); * $messages = [$messagesElement]; @@ -532,9 +533,9 @@ public function updateTopic($topic, $updateMask, $optionalArgs = []) * * @param string $topic The messages in the request will be published on this topic. * Format is `projects/{project}/topics/{topic}`. - * @param PubsubMessage[] $messages The messages to publish. + * @param PubsubMessage[] $messages the messages to publish * @param array $optionalArgs { - * Optional. + * Optional * * @type \Google\GAX\RetrySettings|array $retrySettings * Retry settings to use for this call. Can be a @@ -581,7 +582,7 @@ public function publish($topic, $messages, $optionalArgs = []) * ``` * try { * $publisherClient = new PublisherClient(); - * $formattedTopic = $publisherClient->topicName("[PROJECT]", "[TOPIC]"); + * $formattedTopic = $publisherClient->topicName('[PROJECT]', '[TOPIC]'); * $response = $publisherClient->getTopic($formattedTopic); * } finally { * $publisherClient->close(); @@ -591,7 +592,7 @@ public function publish($topic, $messages, $optionalArgs = []) * @param string $topic The name of the topic to get. * Format is `projects/{project}/topics/{topic}`. * @param array $optionalArgs { - * Optional. + * Optional * * @type \Google\GAX\RetrySettings|array $retrySettings * Retry settings to use for this call. Can be a @@ -637,15 +638,15 @@ public function getTopic($topic, $optionalArgs = []) * ``` * try { * $publisherClient = new PublisherClient(); - * $formattedProject = $publisherClient->projectName("[PROJECT]"); + * $formattedProject = $publisherClient->projectName('[PROJECT]'); * // Iterate through all elements * $pagedResponse = $publisherClient->listTopics($formattedProject); * foreach ($pagedResponse->iterateAllElements() as $element) { * // doSomethingWith($element); * } * - * // OR iterate over pages of elements, with the maximum page size set to 5 - * $pagedResponse = $publisherClient->listTopics($formattedProject, ['pageSize' => 5]); + * // OR iterate over pages of elements + * $pagedResponse = $publisherClient->listTopics($formattedProject); * foreach ($pagedResponse->iteratePages() as $page) { * foreach ($page as $element) { * // doSomethingWith($element); @@ -659,7 +660,7 @@ public function getTopic($topic, $optionalArgs = []) * @param string $project The name of the cloud project that topics belong to. * Format is `projects/{project}`. * @param array $optionalArgs { - * Optional. + * Optional * * @type int $pageSize * The maximum number of resources contained in the underlying API @@ -720,15 +721,15 @@ public function listTopics($project, $optionalArgs = []) * ``` * try { * $publisherClient = new PublisherClient(); - * $formattedTopic = $publisherClient->topicName("[PROJECT]", "[TOPIC]"); + * $formattedTopic = $publisherClient->topicName('[PROJECT]', '[TOPIC]'); * // Iterate through all elements * $pagedResponse = $publisherClient->listTopicSubscriptions($formattedTopic); * foreach ($pagedResponse->iterateAllElements() as $element) { * // doSomethingWith($element); * } * - * // OR iterate over pages of elements, with the maximum page size set to 5 - * $pagedResponse = $publisherClient->listTopicSubscriptions($formattedTopic, ['pageSize' => 5]); + * // OR iterate over pages of elements + * $pagedResponse = $publisherClient->listTopicSubscriptions($formattedTopic); * foreach ($pagedResponse->iteratePages() as $page) { * foreach ($page as $element) { * // doSomethingWith($element); @@ -742,7 +743,7 @@ public function listTopics($project, $optionalArgs = []) * @param string $topic The name of the topic that subscriptions are attached to. * Format is `projects/{project}/topics/{topic}`. * @param array $optionalArgs { - * Optional. + * Optional * * @type int $pageSize * The maximum number of resources contained in the underlying API @@ -807,7 +808,7 @@ public function listTopicSubscriptions($topic, $optionalArgs = []) * ``` * try { * $publisherClient = new PublisherClient(); - * $formattedTopic = $publisherClient->topicName("[PROJECT]", "[TOPIC]"); + * $formattedTopic = $publisherClient->topicName('[PROJECT]', '[TOPIC]'); * $publisherClient->deleteTopic($formattedTopic); * } finally { * $publisherClient->close(); @@ -817,7 +818,7 @@ public function listTopicSubscriptions($topic, $optionalArgs = []) * @param string $topic Name of the topic to delete. * Format is `projects/{project}/topics/{topic}`. * @param array $optionalArgs { - * Optional. + * Optional * * @type \Google\GAX\RetrySettings|array $retrySettings * Retry settings to use for this call. Can be a @@ -862,7 +863,7 @@ public function deleteTopic($topic, $optionalArgs = []) * ``` * try { * $publisherClient = new PublisherClient(); - * $formattedResource = $publisherClient->topicName("[PROJECT]", "[TOPIC]"); + * $formattedResource = $publisherClient->topicName('[PROJECT]', '[TOPIC]'); * $policy = new Policy(); * $response = $publisherClient->setIamPolicy($formattedResource, $policy); * } finally { @@ -878,7 +879,7 @@ public function deleteTopic($topic, $optionalArgs = []) * valid policy but certain Cloud Platform services (such as Projects) * might reject them. * @param array $optionalArgs { - * Optional. + * Optional * * @type \Google\GAX\RetrySettings|array $retrySettings * Retry settings to use for this call. Can be a @@ -927,7 +928,7 @@ public function setIamPolicy($resource, $policy, $optionalArgs = []) * ``` * try { * $publisherClient = new PublisherClient(); - * $formattedResource = $publisherClient->topicName("[PROJECT]", "[TOPIC]"); + * $formattedResource = $publisherClient->topicName('[PROJECT]', '[TOPIC]'); * $response = $publisherClient->getIamPolicy($formattedResource); * } finally { * $publisherClient->close(); @@ -938,7 +939,7 @@ public function setIamPolicy($resource, $policy, $optionalArgs = []) * `resource` is usually specified as a path. For example, a Project * resource is specified as `projects/{project}`. * @param array $optionalArgs { - * Optional. + * Optional * * @type \Google\GAX\RetrySettings|array $retrySettings * Retry settings to use for this call. Can be a @@ -986,7 +987,7 @@ public function getIamPolicy($resource, $optionalArgs = []) * ``` * try { * $publisherClient = new PublisherClient(); - * $formattedResource = $publisherClient->topicName("[PROJECT]", "[TOPIC]"); + * $formattedResource = $publisherClient->topicName('[PROJECT]', '[TOPIC]'); * $permissions = []; * $response = $publisherClient->testIamPermissions($formattedResource, $permissions); * } finally { @@ -1002,7 +1003,7 @@ public function getIamPolicy($resource, $optionalArgs = []) * information see * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). * @param array $optionalArgs { - * Optional. + * Optional * * @type \Google\GAX\RetrySettings|array $retrySettings * Retry settings to use for this call. Can be a diff --git a/src/PubSub/V1/Gapic/SubscriberGapicClient.php b/src/PubSub/V1/Gapic/SubscriberGapicClient.php index 4570c1ada8da..709443cf8c15 100644 --- a/src/PubSub/V1/Gapic/SubscriberGapicClient.php +++ b/src/PubSub/V1/Gapic/SubscriberGapicClient.php @@ -79,8 +79,8 @@ * ``` * try { * $subscriberClient = new SubscriberClient(); - * $formattedName = $subscriberClient->subscriptionName("[PROJECT]", "[SUBSCRIPTION]"); - * $formattedTopic = $subscriberClient->topicName("[PROJECT]", "[TOPIC]"); + * $formattedName = $subscriberClient->subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); + * $formattedTopic = $subscriberClient->topicName('[PROJECT]', '[TOPIC]'); * $response = $subscriberClient->createSubscription($formattedName, $formattedTopic); * } finally { * $subscriberClient->close(); @@ -180,6 +180,7 @@ private static function getPathTemplateMap() return self::$pathTemplateMap; } + private static function getPageStreamingDescriptors() { $listSubscriptionsPageStreamingDescriptor = @@ -239,7 +240,7 @@ private static function getGapicVersion() * * @param string $project * - * @return string The formatted project resource. + * @return string the formatted project resource * @experimental */ public static function projectName($project) @@ -256,7 +257,7 @@ public static function projectName($project) * @param string $project * @param string $snapshot * - * @return string The formatted snapshot resource. + * @return string the formatted snapshot resource * @experimental */ public static function snapshotName($project, $snapshot) @@ -274,7 +275,7 @@ public static function snapshotName($project, $snapshot) * @param string $project * @param string $subscription * - * @return string The formatted subscription resource. + * @return string the formatted subscription resource * @experimental */ public static function subscriptionName($project, $subscription) @@ -292,7 +293,7 @@ public static function subscriptionName($project, $subscription) * @param string $project * @param string $topic * - * @return string The formatted topic resource. + * @return string the formatted topic resource * @experimental */ public static function topicName($project, $topic) @@ -320,9 +321,9 @@ public static function topicName($project, $topic) * @param string $formattedName The formatted name string * @param string $template Optional name of template to match * - * @return array An associative array from name component IDs to component values. + * @return array an associative array from name component IDs to component values * - * @throws ValidationException If $formattedName could not be matched. + * @throws ValidationException if $formattedName could not be matched * @experimental */ public static function parseName($formattedName, $template = null) @@ -491,8 +492,8 @@ public function __construct($options = []) * ``` * try { * $subscriberClient = new SubscriberClient(); - * $formattedName = $subscriberClient->subscriptionName("[PROJECT]", "[SUBSCRIPTION]"); - * $formattedTopic = $subscriberClient->topicName("[PROJECT]", "[TOPIC]"); + * $formattedName = $subscriberClient->subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); + * $formattedTopic = $subscriberClient->topicName('[PROJECT]', '[TOPIC]'); * $response = $subscriberClient->createSubscription($formattedName, $formattedTopic); * } finally { * $subscriberClient->close(); @@ -510,7 +511,7 @@ public function __construct($options = []) * The value of this field will be `_deleted-topic_` if the topic has been * deleted. * @param array $optionalArgs { - * Optional. + * Optional * * @type PushConfig $pushConfig * If push delivery is used with this subscription, this field is @@ -610,7 +611,7 @@ public function createSubscription($name, $topic, $optionalArgs = []) * ``` * try { * $subscriberClient = new SubscriberClient(); - * $formattedSubscription = $subscriberClient->subscriptionName("[PROJECT]", "[SUBSCRIPTION]"); + * $formattedSubscription = $subscriberClient->subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); * $response = $subscriberClient->getSubscription($formattedSubscription); * } finally { * $subscriberClient->close(); @@ -620,7 +621,7 @@ public function createSubscription($name, $topic, $optionalArgs = []) * @param string $subscription The name of the subscription to get. * Format is `projects/{project}/subscriptions/{sub}`. * @param array $optionalArgs { - * Optional. + * Optional * * @type \Google\GAX\RetrySettings|array $retrySettings * Retry settings to use for this call. Can be a @@ -679,11 +680,11 @@ public function getSubscription($subscription, $optionalArgs = []) * } * ``` * - * @param Subscription $subscription The updated subscription object. + * @param Subscription $subscription the updated subscription object * @param FieldMask $updateMask Indicates which fields in the provided subscription to update. * Must be specified and non-empty. * @param array $optionalArgs { - * Optional. + * Optional * * @type \Google\GAX\RetrySettings|array $retrySettings * Retry settings to use for this call. Can be a @@ -730,15 +731,15 @@ public function updateSubscription($subscription, $updateMask, $optionalArgs = [ * ``` * try { * $subscriberClient = new SubscriberClient(); - * $formattedProject = $subscriberClient->projectName("[PROJECT]"); + * $formattedProject = $subscriberClient->projectName('[PROJECT]'); * // Iterate through all elements * $pagedResponse = $subscriberClient->listSubscriptions($formattedProject); * foreach ($pagedResponse->iterateAllElements() as $element) { * // doSomethingWith($element); * } * - * // OR iterate over pages of elements, with the maximum page size set to 5 - * $pagedResponse = $subscriberClient->listSubscriptions($formattedProject, ['pageSize' => 5]); + * // OR iterate over pages of elements + * $pagedResponse = $subscriberClient->listSubscriptions($formattedProject); * foreach ($pagedResponse->iteratePages() as $page) { * foreach ($page as $element) { * // doSomethingWith($element); @@ -752,7 +753,7 @@ public function updateSubscription($subscription, $updateMask, $optionalArgs = [ * @param string $project The name of the cloud project that subscriptions belong to. * Format is `projects/{project}`. * @param array $optionalArgs { - * Optional. + * Optional * * @type int $pageSize * The maximum number of resources contained in the underlying API @@ -817,7 +818,7 @@ public function listSubscriptions($project, $optionalArgs = []) * ``` * try { * $subscriberClient = new SubscriberClient(); - * $formattedSubscription = $subscriberClient->subscriptionName("[PROJECT]", "[SUBSCRIPTION]"); + * $formattedSubscription = $subscriberClient->subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); * $subscriberClient->deleteSubscription($formattedSubscription); * } finally { * $subscriberClient->close(); @@ -827,7 +828,7 @@ public function listSubscriptions($project, $optionalArgs = []) * @param string $subscription The subscription to delete. * Format is `projects/{project}/subscriptions/{sub}`. * @param array $optionalArgs { - * Optional. + * Optional * * @type \Google\GAX\RetrySettings|array $retrySettings * Retry settings to use for this call. Can be a @@ -875,7 +876,7 @@ public function deleteSubscription($subscription, $optionalArgs = []) * ``` * try { * $subscriberClient = new SubscriberClient(); - * $formattedSubscription = $subscriberClient->subscriptionName("[PROJECT]", "[SUBSCRIPTION]"); + * $formattedSubscription = $subscriberClient->subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); * $ackIds = []; * $ackDeadlineSeconds = 0; * $subscriberClient->modifyAckDeadline($formattedSubscription, $ackIds, $ackDeadlineSeconds); @@ -886,7 +887,7 @@ public function deleteSubscription($subscription, $optionalArgs = []) * * @param string $subscription The name of the subscription. * Format is `projects/{project}/subscriptions/{sub}`. - * @param string[] $ackIds List of acknowledgment IDs. + * @param string[] $ackIds list of acknowledgment IDs * @param int $ackDeadlineSeconds The new ack deadline with respect to the time this request was sent to * the Pub/Sub system. For example, if the value is 10, the new * ack deadline will expire 10 seconds after the `ModifyAckDeadline` call @@ -895,7 +896,7 @@ public function deleteSubscription($subscription, $optionalArgs = []) * The minimum deadline you can specify is 0 seconds. * The maximum deadline you can specify is 600 seconds (10 minutes). * @param array $optionalArgs { - * Optional. + * Optional * * @type \Google\GAX\RetrySettings|array $retrySettings * Retry settings to use for this call. Can be a @@ -947,7 +948,7 @@ public function modifyAckDeadline($subscription, $ackIds, $ackDeadlineSeconds, $ * ``` * try { * $subscriberClient = new SubscriberClient(); - * $formattedSubscription = $subscriberClient->subscriptionName("[PROJECT]", "[SUBSCRIPTION]"); + * $formattedSubscription = $subscriberClient->subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); * $ackIds = []; * $subscriberClient->acknowledge($formattedSubscription, $ackIds); * } finally { @@ -960,7 +961,7 @@ public function modifyAckDeadline($subscription, $ackIds, $ackDeadlineSeconds, $ * @param string[] $ackIds The acknowledgment ID for the messages being acknowledged that was returned * by the Pub/Sub system in the `Pull` response. Must not be empty. * @param array $optionalArgs { - * Optional. + * Optional * * @type \Google\GAX\RetrySettings|array $retrySettings * Retry settings to use for this call. Can be a @@ -1008,7 +1009,7 @@ public function acknowledge($subscription, $ackIds, $optionalArgs = []) * ``` * try { * $subscriberClient = new SubscriberClient(); - * $formattedSubscription = $subscriberClient->subscriptionName("[PROJECT]", "[SUBSCRIPTION]"); + * $formattedSubscription = $subscriberClient->subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); * $maxMessages = 0; * $response = $subscriberClient->pull($formattedSubscription, $maxMessages); * } finally { @@ -1021,7 +1022,7 @@ public function acknowledge($subscription, $ackIds, $optionalArgs = []) * @param int $maxMessages The maximum number of messages returned for this request. The Pub/Sub * system may return fewer than the number specified. * @param array $optionalArgs { - * Optional. + * Optional * * @type bool $returnImmediately * If this field set to true, the system will respond immediately even if @@ -1089,7 +1090,7 @@ public function pull($subscription, $maxMessages, $optionalArgs = []) * ``` * try { * $subscriberClient = new SubscriberClient(); - * $formattedSubscription = $subscriberClient->subscriptionName("[PROJECT]", "[SUBSCRIPTION]"); + * $formattedSubscription = $subscriberClient->subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); * $streamAckDeadlineSeconds = 0; * $request = new StreamingPullRequest(); * $request->setSubscription($formattedSubscription); @@ -1126,7 +1127,7 @@ public function pull($subscription, $maxMessages, $optionalArgs = []) * ``` * * @param array $optionalArgs { - * Optional. + * Optional * * @type int $timeoutMillis * Timeout to use for this call. @@ -1178,7 +1179,7 @@ public function streamingPull($optionalArgs = []) * ``` * try { * $subscriberClient = new SubscriberClient(); - * $formattedSubscription = $subscriberClient->subscriptionName("[PROJECT]", "[SUBSCRIPTION]"); + * $formattedSubscription = $subscriberClient->subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); * $pushConfig = new PushConfig(); * $subscriberClient->modifyPushConfig($formattedSubscription, $pushConfig); * } finally { @@ -1195,7 +1196,7 @@ public function streamingPull($optionalArgs = []) * messages to be pulled and acknowledged - effectively pausing * the subscription if `Pull` is not called. * @param array $optionalArgs { - * Optional. + * Optional * * @type \Google\GAX\RetrySettings|array $retrySettings * Retry settings to use for this call. Can be a @@ -1240,15 +1241,15 @@ public function modifyPushConfig($subscription, $pushConfig, $optionalArgs = []) * ``` * try { * $subscriberClient = new SubscriberClient(); - * $formattedProject = $subscriberClient->projectName("[PROJECT]"); + * $formattedProject = $subscriberClient->projectName('[PROJECT]'); * // Iterate through all elements * $pagedResponse = $subscriberClient->listSnapshots($formattedProject); * foreach ($pagedResponse->iterateAllElements() as $element) { * // doSomethingWith($element); * } * - * // OR iterate over pages of elements, with the maximum page size set to 5 - * $pagedResponse = $subscriberClient->listSnapshots($formattedProject, ['pageSize' => 5]); + * // OR iterate over pages of elements + * $pagedResponse = $subscriberClient->listSnapshots($formattedProject); * foreach ($pagedResponse->iteratePages() as $page) { * foreach ($page as $element) { * // doSomethingWith($element); @@ -1262,7 +1263,7 @@ public function modifyPushConfig($subscription, $pushConfig, $optionalArgs = []) * @param string $project The name of the cloud project that snapshots belong to. * Format is `projects/{project}`. * @param array $optionalArgs { - * Optional. + * Optional * * @type int $pageSize * The maximum number of resources contained in the underlying API @@ -1332,8 +1333,8 @@ public function listSnapshots($project, $optionalArgs = []) * ``` * try { * $subscriberClient = new SubscriberClient(); - * $formattedName = $subscriberClient->snapshotName("[PROJECT]", "[SNAPSHOT]"); - * $formattedSubscription = $subscriberClient->subscriptionName("[PROJECT]", "[SUBSCRIPTION]"); + * $formattedName = $subscriberClient->snapshotName('[PROJECT]', '[SNAPSHOT]'); + * $formattedSubscription = $subscriberClient->subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); * $response = $subscriberClient->createSnapshot($formattedName, $formattedSubscription); * } finally { * $subscriberClient->close(); @@ -1355,7 +1356,7 @@ public function listSnapshots($project, $optionalArgs = []) * successful completion of the CreateSnapshot request. * Format is `projects/{project}/subscriptions/{sub}`. * @param array $optionalArgs { - * Optional. + * Optional * * @type \Google\GAX\RetrySettings|array $retrySettings * Retry settings to use for this call. Can be a @@ -1415,11 +1416,11 @@ public function createSnapshot($name, $subscription, $optionalArgs = []) * } * ``` * - * @param Snapshot $snapshot The updated snpashot object. + * @param Snapshot $snapshot the updated snpashot object * @param FieldMask $updateMask Indicates which fields in the provided snapshot to update. * Must be specified and non-empty. * @param array $optionalArgs { - * Optional. + * Optional * * @type \Google\GAX\RetrySettings|array $retrySettings * Retry settings to use for this call. Can be a @@ -1469,7 +1470,7 @@ public function updateSnapshot($snapshot, $updateMask, $optionalArgs = []) * ``` * try { * $subscriberClient = new SubscriberClient(); - * $formattedSnapshot = $subscriberClient->snapshotName("[PROJECT]", "[SNAPSHOT]"); + * $formattedSnapshot = $subscriberClient->snapshotName('[PROJECT]', '[SNAPSHOT]'); * $subscriberClient->deleteSnapshot($formattedSnapshot); * } finally { * $subscriberClient->close(); @@ -1479,7 +1480,7 @@ public function updateSnapshot($snapshot, $updateMask, $optionalArgs = []) * @param string $snapshot The name of the snapshot to delete. * Format is `projects/{project}/snapshots/{snap}`. * @param array $optionalArgs { - * Optional. + * Optional * * @type \Google\GAX\RetrySettings|array $retrySettings * Retry settings to use for this call. Can be a @@ -1524,16 +1525,16 @@ public function deleteSnapshot($snapshot, $optionalArgs = []) * ``` * try { * $subscriberClient = new SubscriberClient(); - * $formattedSubscription = $subscriberClient->subscriptionName("[PROJECT]", "[SUBSCRIPTION]"); + * $formattedSubscription = $subscriberClient->subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); * $response = $subscriberClient->seek($formattedSubscription); * } finally { * $subscriberClient->close(); * } * ``` * - * @param string $subscription The subscription to affect. + * @param string $subscription the subscription to affect * @param array $optionalArgs { - * Optional. + * Optional * * @type Timestamp $time * The time to seek to. @@ -1602,7 +1603,7 @@ public function seek($subscription, $optionalArgs = []) * ``` * try { * $subscriberClient = new SubscriberClient(); - * $formattedResource = $subscriberClient->subscriptionName("[PROJECT]", "[SUBSCRIPTION]"); + * $formattedResource = $subscriberClient->subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); * $policy = new Policy(); * $response = $subscriberClient->setIamPolicy($formattedResource, $policy); * } finally { @@ -1618,7 +1619,7 @@ public function seek($subscription, $optionalArgs = []) * valid policy but certain Cloud Platform services (such as Projects) * might reject them. * @param array $optionalArgs { - * Optional. + * Optional * * @type \Google\GAX\RetrySettings|array $retrySettings * Retry settings to use for this call. Can be a @@ -1667,7 +1668,7 @@ public function setIamPolicy($resource, $policy, $optionalArgs = []) * ``` * try { * $subscriberClient = new SubscriberClient(); - * $formattedResource = $subscriberClient->subscriptionName("[PROJECT]", "[SUBSCRIPTION]"); + * $formattedResource = $subscriberClient->subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); * $response = $subscriberClient->getIamPolicy($formattedResource); * } finally { * $subscriberClient->close(); @@ -1678,7 +1679,7 @@ public function setIamPolicy($resource, $policy, $optionalArgs = []) * `resource` is usually specified as a path. For example, a Project * resource is specified as `projects/{project}`. * @param array $optionalArgs { - * Optional. + * Optional * * @type \Google\GAX\RetrySettings|array $retrySettings * Retry settings to use for this call. Can be a @@ -1726,7 +1727,7 @@ public function getIamPolicy($resource, $optionalArgs = []) * ``` * try { * $subscriberClient = new SubscriberClient(); - * $formattedResource = $subscriberClient->subscriptionName("[PROJECT]", "[SUBSCRIPTION]"); + * $formattedResource = $subscriberClient->subscriptionName('[PROJECT]', '[SUBSCRIPTION]'); * $permissions = []; * $response = $subscriberClient->testIamPermissions($formattedResource, $permissions); * } finally { @@ -1742,7 +1743,7 @@ public function getIamPolicy($resource, $optionalArgs = []) * information see * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). * @param array $optionalArgs { - * Optional. + * Optional * * @type \Google\GAX\RetrySettings|array $retrySettings * Retry settings to use for this call. Can be a diff --git a/src/PubSub/V1/resources/publisher_client_config.json b/src/PubSub/V1/resources/publisher_client_config.json index b1e3be747fd0..72dec325a157 100644 --- a/src/PubSub/V1/resources/publisher_client_config.json +++ b/src/PubSub/V1/resources/publisher_client_config.json @@ -7,13 +7,13 @@ "UNAVAILABLE" ], "one_plus_delivery": [ + "ABORTED", "CANCELLED", - "UNKNOWN", "DEADLINE_EXCEEDED", - "RESOURCE_EXHAUSTED", - "ABORTED", "INTERNAL", - "UNAVAILABLE" + "RESOURCE_EXHAUSTED", + "UNAVAILABLE", + "UNKNOWN" ], "non_idempotent": [] }, diff --git a/src/PubSub/V1/resources/subscriber_client_config.json b/src/PubSub/V1/resources/subscriber_client_config.json index 37a5f16fe8f7..764e831a944e 100644 --- a/src/PubSub/V1/resources/subscriber_client_config.json +++ b/src/PubSub/V1/resources/subscriber_client_config.json @@ -10,8 +10,8 @@ "pull": [ "CANCELLED", "DEADLINE_EXCEEDED", - "RESOURCE_EXHAUSTED", "INTERNAL", + "RESOURCE_EXHAUSTED", "UNAVAILABLE" ] }, diff --git a/src/Spanner/Admin/Database/V1/Gapic/DatabaseAdminGapicClient.php b/src/Spanner/Admin/Database/V1/Gapic/DatabaseAdminGapicClient.php index 38c4f0603ea9..b5e301f0e2ea 100644 --- a/src/Spanner/Admin/Database/V1/Gapic/DatabaseAdminGapicClient.php +++ b/src/Spanner/Admin/Database/V1/Gapic/DatabaseAdminGapicClient.php @@ -72,15 +72,15 @@ * ``` * try { * $databaseAdminClient = new DatabaseAdminClient(); - * $formattedParent = $databaseAdminClient->instanceName("[PROJECT]", "[INSTANCE]"); + * $formattedParent = $databaseAdminClient->instanceName('[PROJECT]', '[INSTANCE]'); * // Iterate through all elements * $pagedResponse = $databaseAdminClient->listDatabases($formattedParent); * foreach ($pagedResponse->iterateAllElements() as $element) { * // doSomethingWith($element); * } * - * // OR iterate over pages of elements, with the maximum page size set to 5 - * $pagedResponse = $databaseAdminClient->listDatabases($formattedParent, ['pageSize' => 5]); + * // OR iterate over pages of elements + * $pagedResponse = $databaseAdminClient->listDatabases($formattedParent); * foreach ($pagedResponse->iteratePages() as $page) { * foreach ($page as $element) { * // doSomethingWith($element); @@ -162,6 +162,7 @@ private static function getPathTemplateMap() return self::$pathTemplateMap; } + private static function getPageStreamingDescriptors() { $listDatabasesPageStreamingDescriptor = @@ -216,7 +217,7 @@ private static function getGapicVersion() * @param string $project * @param string $instance * - * @return string The formatted instance resource. + * @return string the formatted instance resource * @experimental */ public static function instanceName($project, $instance) @@ -235,7 +236,7 @@ public static function instanceName($project, $instance) * @param string $instance * @param string $database * - * @return string The formatted database resource. + * @return string the formatted database resource * @experimental */ public static function databaseName($project, $instance, $database) @@ -262,9 +263,9 @@ public static function databaseName($project, $instance, $database) * @param string $formattedName The formatted name string * @param string $template Optional name of template to match * - * @return array An associative array from name component IDs to component values. + * @return array an associative array from name component IDs to component values * - * @throws ValidationException If $formattedName could not be matched. + * @throws ValidationException if $formattedName could not be matched * @experimental */ public static function parseName($formattedName, $template = null) @@ -455,15 +456,15 @@ public function __construct($options = []) * ``` * try { * $databaseAdminClient = new DatabaseAdminClient(); - * $formattedParent = $databaseAdminClient->instanceName("[PROJECT]", "[INSTANCE]"); + * $formattedParent = $databaseAdminClient->instanceName('[PROJECT]', '[INSTANCE]'); * // Iterate through all elements * $pagedResponse = $databaseAdminClient->listDatabases($formattedParent); * foreach ($pagedResponse->iterateAllElements() as $element) { * // doSomethingWith($element); * } * - * // OR iterate over pages of elements, with the maximum page size set to 5 - * $pagedResponse = $databaseAdminClient->listDatabases($formattedParent, ['pageSize' => 5]); + * // OR iterate over pages of elements + * $pagedResponse = $databaseAdminClient->listDatabases($formattedParent); * foreach ($pagedResponse->iteratePages() as $page) { * foreach ($page as $element) { * // doSomethingWith($element); @@ -477,7 +478,7 @@ public function __construct($options = []) * @param string $parent Required. The instance whose databases should be listed. * Values are of the form `projects//instances/`. * @param array $optionalArgs { - * Optional. + * Optional * * @type int $pageSize * The maximum number of resources contained in the underlying API @@ -545,8 +546,8 @@ public function listDatabases($parent, $optionalArgs = []) * ``` * try { * $databaseAdminClient = new DatabaseAdminClient(); - * $formattedParent = $databaseAdminClient->instanceName("[PROJECT]", "[INSTANCE]"); - * $createStatement = ""; + * $formattedParent = $databaseAdminClient->instanceName('[PROJECT]', '[INSTANCE]'); + * $createStatement = ''; * $operationResponse = $databaseAdminClient->createDatabase($formattedParent, $createStatement); * $operationResponse->pollUntilComplete(); * if ($operationResponse->operationSucceeded()) { @@ -583,8 +584,10 @@ public function listDatabases($parent, $optionalArgs = []) * @param string $createStatement Required. A `CREATE DATABASE` statement, which specifies the ID of the * new database. The database ID must conform to the regular expression * `[a-z][a-z0-9_\-]*[a-z0-9]` and be between 2 and 30 characters in length. + * If the database ID is a reserved word or if it contains a hyphen, the + * database ID must be enclosed in backticks (`` ` ``). * @param array $optionalArgs { - * Optional. + * Optional * * @type string[] $extraStatements * An optional list of DDL statements to run inside the newly created @@ -639,7 +642,7 @@ public function createDatabase($parent, $createStatement, $optionalArgs = []) * ``` * try { * $databaseAdminClient = new DatabaseAdminClient(); - * $formattedName = $databaseAdminClient->databaseName("[PROJECT]", "[INSTANCE]", "[DATABASE]"); + * $formattedName = $databaseAdminClient->databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); * $response = $databaseAdminClient->getDatabase($formattedName); * } finally { * $databaseAdminClient->close(); @@ -649,7 +652,7 @@ public function createDatabase($parent, $createStatement, $optionalArgs = []) * @param string $name Required. The name of the requested database. Values are of the form * `projects//instances//databases/`. * @param array $optionalArgs { - * Optional. + * Optional * * @type \Google\GAX\RetrySettings|array $retrySettings * Retry settings to use for this call. Can be a @@ -701,7 +704,7 @@ public function getDatabase($name, $optionalArgs = []) * ``` * try { * $databaseAdminClient = new DatabaseAdminClient(); - * $formattedDatabase = $databaseAdminClient->databaseName("[PROJECT]", "[INSTANCE]", "[DATABASE]"); + * $formattedDatabase = $databaseAdminClient->databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); * $statements = []; * $operationResponse = $databaseAdminClient->updateDatabaseDdl($formattedDatabase, $statements); * $operationResponse->pollUntilComplete(); @@ -733,9 +736,9 @@ public function getDatabase($name, $optionalArgs = []) * ``` * * @param string $database Required. The database to update. - * @param string[] $statements DDL statements to be applied to the database. + * @param string[] $statements DDL statements to be applied to the database * @param array $optionalArgs { - * Optional. + * Optional * * @type string $operationId * If empty, the new update request is assigned an @@ -805,7 +808,7 @@ public function updateDatabaseDdl($database, $statements, $optionalArgs = []) * ``` * try { * $databaseAdminClient = new DatabaseAdminClient(); - * $formattedDatabase = $databaseAdminClient->databaseName("[PROJECT]", "[INSTANCE]", "[DATABASE]"); + * $formattedDatabase = $databaseAdminClient->databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); * $databaseAdminClient->dropDatabase($formattedDatabase); * } finally { * $databaseAdminClient->close(); @@ -814,7 +817,7 @@ public function updateDatabaseDdl($database, $statements, $optionalArgs = []) * * @param string $database Required. The database to be dropped. * @param array $optionalArgs { - * Optional. + * Optional * * @type \Google\GAX\RetrySettings|array $retrySettings * Retry settings to use for this call. Can be a @@ -860,7 +863,7 @@ public function dropDatabase($database, $optionalArgs = []) * ``` * try { * $databaseAdminClient = new DatabaseAdminClient(); - * $formattedDatabase = $databaseAdminClient->databaseName("[PROJECT]", "[INSTANCE]", "[DATABASE]"); + * $formattedDatabase = $databaseAdminClient->databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); * $response = $databaseAdminClient->getDatabaseDdl($formattedDatabase); * } finally { * $databaseAdminClient->close(); @@ -869,7 +872,7 @@ public function dropDatabase($database, $optionalArgs = []) * * @param string $database Required. The database whose schema we wish to get. * @param array $optionalArgs { - * Optional. + * Optional * * @type \Google\GAX\RetrySettings|array $retrySettings * Retry settings to use for this call. Can be a @@ -919,7 +922,7 @@ public function getDatabaseDdl($database, $optionalArgs = []) * ``` * try { * $databaseAdminClient = new DatabaseAdminClient(); - * $formattedResource = $databaseAdminClient->databaseName("[PROJECT]", "[INSTANCE]", "[DATABASE]"); + * $formattedResource = $databaseAdminClient->databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); * $policy = new Policy(); * $response = $databaseAdminClient->setIamPolicy($formattedResource, $policy); * } finally { @@ -935,7 +938,7 @@ public function getDatabaseDdl($database, $optionalArgs = []) * valid policy but certain Cloud Platform services (such as Projects) * might reject them. * @param array $optionalArgs { - * Optional. + * Optional * * @type \Google\GAX\RetrySettings|array $retrySettings * Retry settings to use for this call. Can be a @@ -986,7 +989,7 @@ public function setIamPolicy($resource, $policy, $optionalArgs = []) * ``` * try { * $databaseAdminClient = new DatabaseAdminClient(); - * $formattedResource = $databaseAdminClient->databaseName("[PROJECT]", "[INSTANCE]", "[DATABASE]"); + * $formattedResource = $databaseAdminClient->databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); * $response = $databaseAdminClient->getIamPolicy($formattedResource); * } finally { * $databaseAdminClient->close(); @@ -997,7 +1000,7 @@ public function setIamPolicy($resource, $policy, $optionalArgs = []) * `resource` is usually specified as a path. For example, a Project * resource is specified as `projects/{project}`. * @param array $optionalArgs { - * Optional. + * Optional * * @type \Google\GAX\RetrySettings|array $retrySettings * Retry settings to use for this call. Can be a @@ -1048,7 +1051,7 @@ public function getIamPolicy($resource, $optionalArgs = []) * ``` * try { * $databaseAdminClient = new DatabaseAdminClient(); - * $formattedResource = $databaseAdminClient->databaseName("[PROJECT]", "[INSTANCE]", "[DATABASE]"); + * $formattedResource = $databaseAdminClient->databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); * $permissions = []; * $response = $databaseAdminClient->testIamPermissions($formattedResource, $permissions); * } finally { @@ -1064,7 +1067,7 @@ public function getIamPolicy($resource, $optionalArgs = []) * information see * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). * @param array $optionalArgs { - * Optional. + * Optional * * @type \Google\GAX\RetrySettings|array $retrySettings * Retry settings to use for this call. Can be a diff --git a/src/Spanner/Admin/Instance/V1/Gapic/InstanceAdminGapicClient.php b/src/Spanner/Admin/Instance/V1/Gapic/InstanceAdminGapicClient.php index 3160533a1b7f..8a9d55182ab7 100644 --- a/src/Spanner/Admin/Instance/V1/Gapic/InstanceAdminGapicClient.php +++ b/src/Spanner/Admin/Instance/V1/Gapic/InstanceAdminGapicClient.php @@ -90,15 +90,15 @@ * ``` * try { * $instanceAdminClient = new InstanceAdminClient(); - * $formattedParent = $instanceAdminClient->projectName("[PROJECT]"); + * $formattedParent = $instanceAdminClient->projectName('[PROJECT]'); * // Iterate through all elements * $pagedResponse = $instanceAdminClient->listInstanceConfigs($formattedParent); * foreach ($pagedResponse->iterateAllElements() as $element) { * // doSomethingWith($element); * } * - * // OR iterate over pages of elements, with the maximum page size set to 5 - * $pagedResponse = $instanceAdminClient->listInstanceConfigs($formattedParent, ['pageSize' => 5]); + * // OR iterate over pages of elements + * $pagedResponse = $instanceAdminClient->listInstanceConfigs($formattedParent); * foreach ($pagedResponse->iteratePages() as $page) { * foreach ($page as $element) { * // doSomethingWith($element); @@ -191,6 +191,7 @@ private static function getPathTemplateMap() return self::$pathTemplateMap; } + private static function getPageStreamingDescriptors() { $listInstanceConfigsPageStreamingDescriptor = @@ -254,7 +255,7 @@ private static function getGapicVersion() * * @param string $project * - * @return string The formatted project resource. + * @return string the formatted project resource * @experimental */ public static function projectName($project) @@ -271,7 +272,7 @@ public static function projectName($project) * @param string $project * @param string $instanceConfig * - * @return string The formatted instance_config resource. + * @return string the formatted instance_config resource * @experimental */ public static function instanceConfigName($project, $instanceConfig) @@ -289,7 +290,7 @@ public static function instanceConfigName($project, $instanceConfig) * @param string $project * @param string $instance * - * @return string The formatted instance resource. + * @return string the formatted instance resource * @experimental */ public static function instanceName($project, $instance) @@ -316,9 +317,9 @@ public static function instanceName($project, $instance) * @param string $formattedName The formatted name string * @param string $template Optional name of template to match * - * @return array An associative array from name component IDs to component values. + * @return array an associative array from name component IDs to component values * - * @throws ValidationException If $formattedName could not be matched. + * @throws ValidationException if $formattedName could not be matched * @experimental */ public static function parseName($formattedName, $template = null) @@ -510,15 +511,15 @@ public function __construct($options = []) * ``` * try { * $instanceAdminClient = new InstanceAdminClient(); - * $formattedParent = $instanceAdminClient->projectName("[PROJECT]"); + * $formattedParent = $instanceAdminClient->projectName('[PROJECT]'); * // Iterate through all elements * $pagedResponse = $instanceAdminClient->listInstanceConfigs($formattedParent); * foreach ($pagedResponse->iterateAllElements() as $element) { * // doSomethingWith($element); * } * - * // OR iterate over pages of elements, with the maximum page size set to 5 - * $pagedResponse = $instanceAdminClient->listInstanceConfigs($formattedParent, ['pageSize' => 5]); + * // OR iterate over pages of elements + * $pagedResponse = $instanceAdminClient->listInstanceConfigs($formattedParent); * foreach ($pagedResponse->iteratePages() as $page) { * foreach ($page as $element) { * // doSomethingWith($element); @@ -533,7 +534,7 @@ public function __construct($options = []) * configurations is requested. Values are of the form * `projects/`. * @param array $optionalArgs { - * Optional. + * Optional * * @type int $pageSize * The maximum number of resources contained in the underlying API @@ -594,7 +595,7 @@ public function listInstanceConfigs($parent, $optionalArgs = []) * ``` * try { * $instanceAdminClient = new InstanceAdminClient(); - * $formattedName = $instanceAdminClient->instanceConfigName("[PROJECT]", "[INSTANCE_CONFIG]"); + * $formattedName = $instanceAdminClient->instanceConfigName('[PROJECT]', '[INSTANCE_CONFIG]'); * $response = $instanceAdminClient->getInstanceConfig($formattedName); * } finally { * $instanceAdminClient->close(); @@ -604,7 +605,7 @@ public function listInstanceConfigs($parent, $optionalArgs = []) * @param string $name Required. The name of the requested instance configuration. Values are of * the form `projects//instanceConfigs/`. * @param array $optionalArgs { - * Optional. + * Optional * * @type \Google\GAX\RetrySettings|array $retrySettings * Retry settings to use for this call. Can be a @@ -650,15 +651,15 @@ public function getInstanceConfig($name, $optionalArgs = []) * ``` * try { * $instanceAdminClient = new InstanceAdminClient(); - * $formattedParent = $instanceAdminClient->projectName("[PROJECT]"); + * $formattedParent = $instanceAdminClient->projectName('[PROJECT]'); * // Iterate through all elements * $pagedResponse = $instanceAdminClient->listInstances($formattedParent); * foreach ($pagedResponse->iterateAllElements() as $element) { * // doSomethingWith($element); * } * - * // OR iterate over pages of elements, with the maximum page size set to 5 - * $pagedResponse = $instanceAdminClient->listInstances($formattedParent, ['pageSize' => 5]); + * // OR iterate over pages of elements + * $pagedResponse = $instanceAdminClient->listInstances($formattedParent); * foreach ($pagedResponse->iteratePages() as $page) { * foreach ($page as $element) { * // doSomethingWith($element); @@ -672,7 +673,7 @@ public function getInstanceConfig($name, $optionalArgs = []) * @param string $parent Required. The name of the project for which a list of instances is * requested. Values are of the form `projects/`. * @param array $optionalArgs { - * Optional. + * Optional * * @type int $pageSize * The maximum number of resources contained in the underlying API @@ -687,20 +688,20 @@ public function getInstanceConfig($name, $optionalArgs = []) * An expression for filtering the results of the request. Filter rules are * case insensitive. The fields eligible for filtering are: * - * * name - * * display_name - * * labels.key where key is the name of a label + * * `name` + * * `display_name` + * * `labels.key` where key is the name of a label * * Some examples of using filters are: * - * * name:* --> The instance has a name. - * * name:Howl --> The instance's name contains the string "howl". - * * name:HOWL --> Equivalent to above. - * * NAME:howl --> Equivalent to above. - * * labels.env:* --> The instance has the label "env". - * * labels.env:dev --> The instance has the label "env" and the value of + * * `name:*` --> The instance has a name. + * * `name:Howl` --> The instance's name contains the string "howl". + * * `name:HOWL` --> Equivalent to above. + * * `NAME:howl` --> Equivalent to above. + * * `labels.env:*` --> The instance has the label "env". + * * `labels.env:dev` --> The instance has the label "env" and the value of * the label contains the string "dev". - * * name:howl labels.env:dev --> The instance's name contains "howl" and + * * `name:howl labels.env:dev` --> The instance's name contains "howl" and * it has the label "env" with its value * containing "dev". * @type \Google\GAX\RetrySettings|array $retrySettings @@ -756,7 +757,7 @@ public function listInstances($parent, $optionalArgs = []) * ``` * try { * $instanceAdminClient = new InstanceAdminClient(); - * $formattedName = $instanceAdminClient->instanceName("[PROJECT]", "[INSTANCE]"); + * $formattedName = $instanceAdminClient->instanceName('[PROJECT]', '[INSTANCE]'); * $response = $instanceAdminClient->getInstance($formattedName); * } finally { * $instanceAdminClient->close(); @@ -766,7 +767,7 @@ public function listInstances($parent, $optionalArgs = []) * @param string $name Required. The name of the requested instance. Values are of the form * `projects//instances/`. * @param array $optionalArgs { - * Optional. + * Optional * * @type \Google\GAX\RetrySettings|array $retrySettings * Retry settings to use for this call. Can be a @@ -845,8 +846,8 @@ public function getInstance($name, $optionalArgs = []) * ``` * try { * $instanceAdminClient = new InstanceAdminClient(); - * $formattedParent = $instanceAdminClient->projectName("[PROJECT]"); - * $instanceId = ""; + * $formattedParent = $instanceAdminClient->projectName('[PROJECT]'); + * $instanceId = ''; * $instance = new Instance(); * $operationResponse = $instanceAdminClient->createInstance($formattedParent, $instanceId, $instance); * $operationResponse->pollUntilComplete(); @@ -887,7 +888,7 @@ public function getInstance($name, $optionalArgs = []) * @param Instance $instance Required. The instance to create. The name may be omitted, but if * specified must be `/instances/`. * @param array $optionalArgs { - * Optional. + * Optional * * @type \Google\GAX\RetrySettings|array $retrySettings * Retry settings to use for this call. Can be a @@ -1014,7 +1015,7 @@ public function createInstance($parent, $instanceId, $instance, $optionalArgs = * [][google.spanner.admin.instance.v1.Instance] from being erased accidentally by clients that do not know * about them. * @param array $optionalArgs { - * Optional. + * Optional * * @type \Google\GAX\RetrySettings|array $retrySettings * Retry settings to use for this call. Can be a @@ -1071,7 +1072,7 @@ public function updateInstance($instance, $fieldMask, $optionalArgs = []) * ``` * try { * $instanceAdminClient = new InstanceAdminClient(); - * $formattedName = $instanceAdminClient->instanceName("[PROJECT]", "[INSTANCE]"); + * $formattedName = $instanceAdminClient->instanceName('[PROJECT]', '[INSTANCE]'); * $instanceAdminClient->deleteInstance($formattedName); * } finally { * $instanceAdminClient->close(); @@ -1081,7 +1082,7 @@ public function updateInstance($instance, $fieldMask, $optionalArgs = []) * @param string $name Required. The name of the instance to be deleted. Values are of the form * `projects//instances/` * @param array $optionalArgs { - * Optional. + * Optional * * @type \Google\GAX\RetrySettings|array $retrySettings * Retry settings to use for this call. Can be a @@ -1129,7 +1130,7 @@ public function deleteInstance($name, $optionalArgs = []) * ``` * try { * $instanceAdminClient = new InstanceAdminClient(); - * $formattedResource = $instanceAdminClient->instanceName("[PROJECT]", "[INSTANCE]"); + * $formattedResource = $instanceAdminClient->instanceName('[PROJECT]', '[INSTANCE]'); * $policy = new Policy(); * $response = $instanceAdminClient->setIamPolicy($formattedResource, $policy); * } finally { @@ -1145,7 +1146,7 @@ public function deleteInstance($name, $optionalArgs = []) * valid policy but certain Cloud Platform services (such as Projects) * might reject them. * @param array $optionalArgs { - * Optional. + * Optional * * @type \Google\GAX\RetrySettings|array $retrySettings * Retry settings to use for this call. Can be a @@ -1196,7 +1197,7 @@ public function setIamPolicy($resource, $policy, $optionalArgs = []) * ``` * try { * $instanceAdminClient = new InstanceAdminClient(); - * $formattedResource = $instanceAdminClient->instanceName("[PROJECT]", "[INSTANCE]"); + * $formattedResource = $instanceAdminClient->instanceName('[PROJECT]', '[INSTANCE]'); * $response = $instanceAdminClient->getIamPolicy($formattedResource); * } finally { * $instanceAdminClient->close(); @@ -1207,7 +1208,7 @@ public function setIamPolicy($resource, $policy, $optionalArgs = []) * `resource` is usually specified as a path. For example, a Project * resource is specified as `projects/{project}`. * @param array $optionalArgs { - * Optional. + * Optional * * @type \Google\GAX\RetrySettings|array $retrySettings * Retry settings to use for this call. Can be a @@ -1258,7 +1259,7 @@ public function getIamPolicy($resource, $optionalArgs = []) * ``` * try { * $instanceAdminClient = new InstanceAdminClient(); - * $formattedResource = $instanceAdminClient->instanceName("[PROJECT]", "[INSTANCE]"); + * $formattedResource = $instanceAdminClient->instanceName('[PROJECT]', '[INSTANCE]'); * $permissions = []; * $response = $instanceAdminClient->testIamPermissions($formattedResource, $permissions); * } finally { @@ -1274,7 +1275,7 @@ public function getIamPolicy($resource, $optionalArgs = []) * information see * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). * @param array $optionalArgs { - * Optional. + * Optional * * @type \Google\GAX\RetrySettings|array $retrySettings * Retry settings to use for this call. Can be a diff --git a/src/Spanner/V1/Gapic/SpannerGapicClient.php b/src/Spanner/V1/Gapic/SpannerGapicClient.php index c10f47559dd6..6c5f6a5fc631 100644 --- a/src/Spanner/V1/Gapic/SpannerGapicClient.php +++ b/src/Spanner/V1/Gapic/SpannerGapicClient.php @@ -35,6 +35,7 @@ use Google\GAX\ApiCallable; use Google\GAX\CallSettings; use Google\GAX\GrpcCredentialsHelper; +use Google\GAX\PageStreamingDescriptor; use Google\GAX\PathTemplate; use Google\GAX\ValidationException; use Google\Protobuf\Struct; @@ -46,9 +47,11 @@ use Google\Spanner\V1\ExecuteSqlRequest_QueryMode as QueryMode; use Google\Spanner\V1\GetSessionRequest; use Google\Spanner\V1\KeySet; +use Google\Spanner\V1\ListSessionsRequest; use Google\Spanner\V1\Mutation; use Google\Spanner\V1\ReadRequest; use Google\Spanner\V1\RollbackRequest; +use Google\Spanner\V1\Session; use Google\Spanner\V1\SpannerGrpcClient; use Google\Spanner\V1\TransactionOptions; use Google\Spanner\V1\TransactionSelector; @@ -69,7 +72,7 @@ * ``` * try { * $spannerClient = new SpannerClient(); - * $formattedDatabase = $spannerClient->databaseName("[PROJECT]", "[INSTANCE]", "[DATABASE]"); + * $formattedDatabase = $spannerClient->databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); * $response = $spannerClient->createSession($formattedDatabase); * } finally { * $spannerClient->close(); @@ -147,6 +150,25 @@ private static function getPathTemplateMap() return self::$pathTemplateMap; } + private static function getPageStreamingDescriptors() + { + $listSessionsPageStreamingDescriptor = + new PageStreamingDescriptor([ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getSessions', + ]); + + $pageStreamingDescriptors = [ + 'listSessions' => $listSessionsPageStreamingDescriptor, + ]; + + return $pageStreamingDescriptors; + } + private static function getGrpcStreamingDescriptors() { return [ @@ -181,7 +203,7 @@ private static function getGapicVersion() * @param string $instance * @param string $database * - * @return string The formatted database resource. + * @return string the formatted database resource * @experimental */ public static function databaseName($project, $instance, $database) @@ -202,7 +224,7 @@ public static function databaseName($project, $instance, $database) * @param string $database * @param string $session * - * @return string The formatted session resource. + * @return string the formatted session resource * @experimental */ public static function sessionName($project, $instance, $database, $session) @@ -230,9 +252,9 @@ public static function sessionName($project, $instance, $database, $session) * @param string $formattedName The formatted name string * @param string $template Optional name of template to match * - * @return array An associative array from name component IDs to component values. + * @return array an associative array from name component IDs to component values * - * @throws ValidationException If $formattedName could not be matched. + * @throws ValidationException if $formattedName could not be matched * @experimental */ public static function parseName($formattedName, $template = null) @@ -326,6 +348,7 @@ public function __construct($options = []) $this->descriptors = [ 'createSession' => $defaultDescriptors, 'getSession' => $defaultDescriptors, + 'listSessions' => $defaultDescriptors, 'deleteSession' => $defaultDescriptors, 'executeSql' => $defaultDescriptors, 'executeStreamingSql' => $defaultDescriptors, @@ -335,6 +358,10 @@ public function __construct($options = []) 'commit' => $defaultDescriptors, 'rollback' => $defaultDescriptors, ]; + $pageStreamingDescriptors = self::getPageStreamingDescriptors(); + foreach ($pageStreamingDescriptors as $method => $pageStreamingDescriptor) { + $this->descriptors[$method]['pageStreamingDescriptor'] = $pageStreamingDescriptor; + } $grpcStreamingDescriptors = self::getGrpcStreamingDescriptors(); foreach ($grpcStreamingDescriptors as $method => $grpcStreamingDescriptor) { $this->descriptors[$method]['grpcStreamingDescriptor'] = $grpcStreamingDescriptor; @@ -391,7 +418,7 @@ public function __construct($options = []) * ``` * try { * $spannerClient = new SpannerClient(); - * $formattedDatabase = $spannerClient->databaseName("[PROJECT]", "[INSTANCE]", "[DATABASE]"); + * $formattedDatabase = $spannerClient->databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); * $response = $spannerClient->createSession($formattedDatabase); * } finally { * $spannerClient->close(); @@ -400,8 +427,10 @@ public function __construct($options = []) * * @param string $database Required. The database in which the new session is created. * @param array $optionalArgs { - * Optional. + * Optional * + * @type Session $session + * The session to create. * @type \Google\GAX\RetrySettings|array $retrySettings * Retry settings to use for this call. Can be a * {@see Google\GAX\RetrySettings} object, or an associative array @@ -418,6 +447,9 @@ public function createSession($database, $optionalArgs = []) { $request = new CreateSessionRequest(); $request->setDatabase($database); + if (isset($optionalArgs['session'])) { + $request->setSession($optionalArgs['session']); + } $defaultCallSettings = $this->defaultCallSettings['createSession']; if (isset($optionalArgs['retrySettings']) && is_array($optionalArgs['retrySettings'])) { @@ -448,7 +480,7 @@ public function createSession($database, $optionalArgs = []) * ``` * try { * $spannerClient = new SpannerClient(); - * $formattedName = $spannerClient->sessionName("[PROJECT]", "[INSTANCE]", "[DATABASE]", "[SESSION]"); + * $formattedName = $spannerClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); * $response = $spannerClient->getSession($formattedName); * } finally { * $spannerClient->close(); @@ -457,7 +489,7 @@ public function createSession($database, $optionalArgs = []) * * @param string $name Required. The name of the session to retrieve. * @param array $optionalArgs { - * Optional. + * Optional * * @type \Google\GAX\RetrySettings|array $retrySettings * Retry settings to use for this call. Can be a @@ -496,6 +528,102 @@ public function getSession($name, $optionalArgs = []) ['call_credentials_callback' => $this->createCredentialsCallback()]); } + /** + * Lists all sessions in a given database. + * + * Sample code: + * ``` + * try { + * $spannerClient = new SpannerClient(); + * $formattedDatabase = $spannerClient->databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); + * // Iterate through all elements + * $pagedResponse = $spannerClient->listSessions($formattedDatabase); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * + * // OR iterate over pages of elements + * $pagedResponse = $spannerClient->listSessions($formattedDatabase); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * } finally { + * $spannerClient->close(); + * } + * ``` + * + * @param string $database Required. The database in which to list sessions. + * @param array $optionalArgs { + * Optional + * + * @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 string $filter + * An expression for filtering the results of the request. Filter rules are + * case insensitive. The fields eligible for filtering are: + * + * * `labels.key` where key is the name of a label + * + * Some examples of using filters are: + * + * * `labels.env:*` --> The session has the label "env". + * * `labels.env:dev` --> The session has the label "env" and the value of + * the label contains the string "dev". + * @type \Google\GAX\RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a + * {@see Google\GAX\RetrySettings} object, or an associative array + * of retry settings parameters. See the documentation on + * {@see Google\GAX\RetrySettings} for example usage. + * } + * + * @return \Google\GAX\PagedListResponse + * + * @throws \Google\GAX\ApiException if the remote call fails + * @experimental + */ + public function listSessions($database, $optionalArgs = []) + { + $request = new ListSessionsRequest(); + $request->setDatabase($database); + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + $defaultCallSettings = $this->defaultCallSettings['listSessions']; + if (isset($optionalArgs['retrySettings']) && is_array($optionalArgs['retrySettings'])) { + $optionalArgs['retrySettings'] = $defaultCallSettings->getRetrySettings()->with( + $optionalArgs['retrySettings'] + ); + } + $mergedSettings = $defaultCallSettings->merge(new CallSettings($optionalArgs)); + $callable = ApiCallable::createApiCall( + $this->spannerStub, + 'ListSessions', + $mergedSettings, + $this->descriptors['listSessions'] + ); + + return $callable( + $request, + [], + ['call_credentials_callback' => $this->createCredentialsCallback()]); + } + /** * Ends a session, releasing server resources associated with it. * @@ -503,7 +631,7 @@ public function getSession($name, $optionalArgs = []) * ``` * try { * $spannerClient = new SpannerClient(); - * $formattedName = $spannerClient->sessionName("[PROJECT]", "[INSTANCE]", "[DATABASE]", "[SESSION]"); + * $formattedName = $spannerClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); * $spannerClient->deleteSession($formattedName); * } finally { * $spannerClient->close(); @@ -512,7 +640,7 @@ public function getSession($name, $optionalArgs = []) * * @param string $name Required. The name of the session to delete. * @param array $optionalArgs { - * Optional. + * Optional * * @type \Google\GAX\RetrySettings|array $retrySettings * Retry settings to use for this call. Can be a @@ -566,8 +694,8 @@ public function deleteSession($name, $optionalArgs = []) * ``` * try { * $spannerClient = new SpannerClient(); - * $formattedSession = $spannerClient->sessionName("[PROJECT]", "[INSTANCE]", "[DATABASE]", "[SESSION]"); - * $sql = ""; + * $formattedSession = $spannerClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); + * $sql = ''; * $response = $spannerClient->executeSql($formattedSession, $sql); * } finally { * $spannerClient->close(); @@ -577,7 +705,7 @@ public function deleteSession($name, $optionalArgs = []) * @param string $session Required. The session in which the SQL query should be performed. * @param string $sql Required. The SQL query string. * @param array $optionalArgs { - * Optional. + * Optional * * @type TransactionSelector $transaction * The transaction to use. If none is provided, the default is a @@ -681,8 +809,8 @@ public function executeSql($session, $sql, $optionalArgs = []) * ``` * try { * $spannerClient = new SpannerClient(); - * $formattedSession = $spannerClient->sessionName("[PROJECT]", "[INSTANCE]", "[DATABASE]", "[SESSION]"); - * $sql = ""; + * $formattedSession = $spannerClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); + * $sql = ''; * // Read all responses until the stream is complete * $stream = $spannerClient->executeStreamingSql($formattedSession, $sql); * foreach ($stream->readAll() as $element) { @@ -696,7 +824,7 @@ public function executeSql($session, $sql, $optionalArgs = []) * @param string $session Required. The session in which the SQL query should be performed. * @param string $sql Required. The SQL query string. * @param array $optionalArgs { - * Optional. + * Optional * * @type TransactionSelector $transaction * The transaction to use. If none is provided, the default is a @@ -812,8 +940,8 @@ public function executeStreamingSql($session, $sql, $optionalArgs = []) * ``` * try { * $spannerClient = new SpannerClient(); - * $formattedSession = $spannerClient->sessionName("[PROJECT]", "[INSTANCE]", "[DATABASE]", "[SESSION]"); - * $table = ""; + * $formattedSession = $spannerClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); + * $table = ''; * $columns = []; * $keySet = new KeySet(); * $response = $spannerClient->read($formattedSession, $table, $columns, $keySet); @@ -837,7 +965,7 @@ public function executeStreamingSql($session, $sql, $optionalArgs = []) * It is not an error for the `key_set` to name rows that do not * exist in the database. Read yields nothing for nonexistent rows. * @param array $optionalArgs { - * Optional. + * Optional * * @type TransactionSelector $transaction * The transaction to use. If none is provided, the default is a @@ -919,8 +1047,8 @@ public function read($session, $table, $columns, $keySet, $optionalArgs = []) * ``` * try { * $spannerClient = new SpannerClient(); - * $formattedSession = $spannerClient->sessionName("[PROJECT]", "[INSTANCE]", "[DATABASE]", "[SESSION]"); - * $table = ""; + * $formattedSession = $spannerClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); + * $table = ''; * $columns = []; * $keySet = new KeySet(); * // Read all responses until the stream is complete @@ -948,7 +1076,7 @@ public function read($session, $table, $columns, $keySet, $optionalArgs = []) * It is not an error for the `key_set` to name rows that do not * exist in the database. Read yields nothing for nonexistent rows. * @param array $optionalArgs { - * Optional. + * Optional * * @type TransactionSelector $transaction * The transaction to use. If none is provided, the default is a @@ -1033,7 +1161,7 @@ public function streamingRead($session, $table, $columns, $keySet, $optionalArgs * ``` * try { * $spannerClient = new SpannerClient(); - * $formattedSession = $spannerClient->sessionName("[PROJECT]", "[INSTANCE]", "[DATABASE]", "[SESSION]"); + * $formattedSession = $spannerClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); * $options = new TransactionOptions(); * $response = $spannerClient->beginTransaction($formattedSession, $options); * } finally { @@ -1044,7 +1172,7 @@ public function streamingRead($session, $table, $columns, $keySet, $optionalArgs * @param string $session Required. The session in which the transaction runs. * @param TransactionOptions $options Required. Options for the new transaction. * @param array $optionalArgs { - * Optional. + * Optional * * @type \Google\GAX\RetrySettings|array $retrySettings * Retry settings to use for this call. Can be a @@ -1098,7 +1226,7 @@ public function beginTransaction($session, $options, $optionalArgs = []) * ``` * try { * $spannerClient = new SpannerClient(); - * $formattedSession = $spannerClient->sessionName("[PROJECT]", "[INSTANCE]", "[DATABASE]", "[SESSION]"); + * $formattedSession = $spannerClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); * $mutations = []; * $response = $spannerClient->commit($formattedSession, $mutations); * } finally { @@ -1111,7 +1239,7 @@ public function beginTransaction($session, $options, $optionalArgs = []) * mutations are applied atomically, in the order they appear in * this list. * @param array $optionalArgs { - * Optional. + * Optional * * @type string $transactionId * Commit a previously-started transaction. @@ -1183,8 +1311,8 @@ public function commit($session, $mutations, $optionalArgs = []) * ``` * try { * $spannerClient = new SpannerClient(); - * $formattedSession = $spannerClient->sessionName("[PROJECT]", "[INSTANCE]", "[DATABASE]", "[SESSION]"); - * $transactionId = ""; + * $formattedSession = $spannerClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); + * $transactionId = ''; * $spannerClient->rollback($formattedSession, $transactionId); * } finally { * $spannerClient->close(); @@ -1194,7 +1322,7 @@ public function commit($session, $mutations, $optionalArgs = []) * @param string $session Required. The session in which the transaction to roll back is running. * @param string $transactionId Required. The transaction to roll back. * @param array $optionalArgs { - * Optional. + * Optional * * @type \Google\GAX\RetrySettings|array $retrySettings * Retry settings to use for this call. Can be a diff --git a/src/Spanner/V1/resources/spanner_client_config.json b/src/Spanner/V1/resources/spanner_client_config.json index dfaf8457c912..81442861df8c 100644 --- a/src/Spanner/V1/resources/spanner_client_config.json +++ b/src/Spanner/V1/resources/spanner_client_config.json @@ -42,6 +42,11 @@ "retry_codes_name": "idempotent", "retry_params_name": "default" }, + "ListSessions": { + "timeout_millis": 30000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, "DeleteSession": { "timeout_millis": 30000, "retry_codes_name": "idempotent", diff --git a/src/Speech/V1/Gapic/SpeechGapicClient.php b/src/Speech/V1/Gapic/SpeechGapicClient.php index 6151aaa71b6a..e4ac14706487 100644 --- a/src/Speech/V1/Gapic/SpeechGapicClient.php +++ b/src/Speech/V1/Gapic/SpeechGapicClient.php @@ -60,12 +60,12 @@ * $speechClient = new SpeechClient(); * $encoding = AudioEncoding::FLAC; * $sampleRateHertz = 44100; - * $languageCode = "en-US"; + * $languageCode = 'en-US'; * $config = new RecognitionConfig(); * $config->setEncoding($encoding); * $config->setSampleRateHertz($sampleRateHertz); * $config->setLanguageCode($languageCode); - * $uri = "gs://bucket_name/file_name.flac"; + * $uri = 'gs://bucket_name/file_name.flac'; * $audio = new RecognitionAudio(); * $audio->setUri($uri); * $response = $speechClient->recognize($config, $audio); @@ -303,12 +303,12 @@ public function __construct($options = []) * $speechClient = new SpeechClient(); * $encoding = AudioEncoding::FLAC; * $sampleRateHertz = 44100; - * $languageCode = "en-US"; + * $languageCode = 'en-US'; * $config = new RecognitionConfig(); * $config->setEncoding($encoding); * $config->setSampleRateHertz($sampleRateHertz); * $config->setLanguageCode($languageCode); - * $uri = "gs://bucket_name/file_name.flac"; + * $uri = 'gs://bucket_name/file_name.flac'; * $audio = new RecognitionAudio(); * $audio->setUri($uri); * $response = $speechClient->recognize($config, $audio); @@ -317,11 +317,11 @@ public function __construct($options = []) * } * ``` * - * @param RecognitionConfig $config *Required* Provides information to the recognizer that specifies how to - * process the request. - * @param RecognitionAudio $audio *Required* The audio data to be recognized. + * @param recognitionConfig $config *Required* Provides information to the recognizer that specifies how to + * process the request + * @param recognitionAudio $audio *Required* The audio data to be recognized * @param array $optionalArgs { - * Optional. + * Optional * * @type \Google\GAX\RetrySettings|array $retrySettings * Retry settings to use for this call. Can be a @@ -373,12 +373,12 @@ public function recognize($config, $audio, $optionalArgs = []) * $speechClient = new SpeechClient(); * $encoding = AudioEncoding::FLAC; * $sampleRateHertz = 44100; - * $languageCode = "en-US"; + * $languageCode = 'en-US'; * $config = new RecognitionConfig(); * $config->setEncoding($encoding); * $config->setSampleRateHertz($sampleRateHertz); * $config->setLanguageCode($languageCode); - * $uri = "gs://bucket_name/file_name.flac"; + * $uri = 'gs://bucket_name/file_name.flac'; * $audio = new RecognitionAudio(); * $audio->setUri($uri); * $operationResponse = $speechClient->longRunningRecognize($config, $audio); @@ -412,11 +412,11 @@ public function recognize($config, $audio, $optionalArgs = []) * } * ``` * - * @param RecognitionConfig $config *Required* Provides information to the recognizer that specifies how to - * process the request. - * @param RecognitionAudio $audio *Required* The audio data to be recognized. + * @param recognitionConfig $config *Required* Provides information to the recognizer that specifies how to + * process the request + * @param recognitionAudio $audio *Required* The audio data to be recognized * @param array $optionalArgs { - * Optional. + * Optional * * @type \Google\GAX\RetrySettings|array $retrySettings * Retry settings to use for this call. Can be a @@ -497,7 +497,7 @@ public function longRunningRecognize($config, $audio, $optionalArgs = []) * ``` * * @param array $optionalArgs { - * Optional. + * Optional * * @type int $timeoutMillis * Timeout to use for this call. diff --git a/src/Speech/V1beta1/Gapic/SpeechGapicClient.php b/src/Speech/V1beta1/Gapic/SpeechGapicClient.php index 9d3071a1a5ae..9055fece0384 100644 --- a/src/Speech/V1beta1/Gapic/SpeechGapicClient.php +++ b/src/Speech/V1beta1/Gapic/SpeechGapicClient.php @@ -63,7 +63,7 @@ * $config = new RecognitionConfig(); * $config->setEncoding($encoding); * $config->setSampleRate($sampleRate); - * $uri = "gs://bucket_name/file_name.flac"; + * $uri = 'gs://bucket_name/file_name.flac'; * $audio = new RecognitionAudio(); * $audio->setUri($uri); * $response = $speechClient->syncRecognize($config, $audio); @@ -304,7 +304,7 @@ public function __construct($options = []) * $config = new RecognitionConfig(); * $config->setEncoding($encoding); * $config->setSampleRate($sampleRate); - * $uri = "gs://bucket_name/file_name.flac"; + * $uri = 'gs://bucket_name/file_name.flac'; * $audio = new RecognitionAudio(); * $audio->setUri($uri); * $response = $speechClient->syncRecognize($config, $audio); @@ -313,11 +313,11 @@ public function __construct($options = []) * } * ``` * - * @param RecognitionConfig $config *Required* Provides information to the recognizer that specifies how to - * process the request. - * @param RecognitionAudio $audio *Required* The audio data to be recognized. + * @param recognitionConfig $config *Required* Provides information to the recognizer that specifies how to + * process the request + * @param recognitionAudio $audio *Required* The audio data to be recognized * @param array $optionalArgs { - * Optional. + * Optional * * @type \Google\GAX\RetrySettings|array $retrySettings * Retry settings to use for this call. Can be a @@ -374,7 +374,7 @@ public function syncRecognize($config, $audio, $optionalArgs = []) * $config = new RecognitionConfig(); * $config->setEncoding($encoding); * $config->setSampleRate($sampleRate); - * $uri = "gs://bucket_name/file_name.flac"; + * $uri = 'gs://bucket_name/file_name.flac'; * $audio = new RecognitionAudio(); * $audio->setUri($uri); * $operationResponse = $speechClient->asyncRecognize($config, $audio); @@ -408,11 +408,11 @@ public function syncRecognize($config, $audio, $optionalArgs = []) * } * ``` * - * @param RecognitionConfig $config *Required* Provides information to the recognizer that specifies how to - * process the request. - * @param RecognitionAudio $audio *Required* The audio data to be recognized. + * @param recognitionConfig $config *Required* Provides information to the recognizer that specifies how to + * process the request + * @param recognitionAudio $audio *Required* The audio data to be recognized * @param array $optionalArgs { - * Optional. + * Optional * * @type \Google\GAX\RetrySettings|array $retrySettings * Retry settings to use for this call. Can be a @@ -493,7 +493,7 @@ public function asyncRecognize($config, $audio, $optionalArgs = []) * ``` * * @param array $optionalArgs { - * Optional. + * Optional * * @type int $timeoutMillis * Timeout to use for this call. diff --git a/src/VideoIntelligence/V1beta1/Gapic/VideoIntelligenceServiceGapicClient.php b/src/VideoIntelligence/V1beta1/Gapic/VideoIntelligenceServiceGapicClient.php index 6cb416296c74..764a74bb0519 100644 --- a/src/VideoIntelligence/V1beta1/Gapic/VideoIntelligenceServiceGapicClient.php +++ b/src/VideoIntelligence/V1beta1/Gapic/VideoIntelligenceServiceGapicClient.php @@ -57,8 +57,9 @@ * ``` * try { * $videoIntelligenceServiceClient = new VideoIntelligenceServiceClient(); - * $inputUri = ""; - * $features = []; + * $inputUri = 'gs://demomaker/cat.mp4'; + * $featuresElement = Feature::LABEL_DETECTION; + * $features = [$featuresElement]; * $operationResponse = $videoIntelligenceServiceClient->annotateVideo($inputUri, $features); * $operationResponse->pollUntilComplete(); * if ($operationResponse->operationSucceeded()) { @@ -304,8 +305,9 @@ public function __construct($options = []) * ``` * try { * $videoIntelligenceServiceClient = new VideoIntelligenceServiceClient(); - * $inputUri = ""; - * $features = []; + * $inputUri = 'gs://demomaker/cat.mp4'; + * $featuresElement = Feature::LABEL_DETECTION; + * $features = [$featuresElement]; * $operationResponse = $videoIntelligenceServiceClient->annotateVideo($inputUri, $features); * $operationResponse->pollUntilComplete(); * if ($operationResponse->operationSucceeded()) { @@ -350,7 +352,7 @@ public function __construct($options = []) * @param int[] $features Requested video annotation features. * For allowed values, use constants defined on {@see \Google\Cloud\Videointelligence\V1beta1\Feature} * @param array $optionalArgs { - * Optional. + * Optional * * @type string $inputContent * The video data bytes. Encoding: base64. If unset, the input video(s) diff --git a/src/VideoIntelligence/V1beta2/Gapic/VideoIntelligenceServiceGapicClient.php b/src/VideoIntelligence/V1beta2/Gapic/VideoIntelligenceServiceGapicClient.php index 691ec2bf34dd..bed9f7f7f616 100644 --- a/src/VideoIntelligence/V1beta2/Gapic/VideoIntelligenceServiceGapicClient.php +++ b/src/VideoIntelligence/V1beta2/Gapic/VideoIntelligenceServiceGapicClient.php @@ -57,9 +57,8 @@ * ``` * try { * $videoIntelligenceServiceClient = new VideoIntelligenceServiceClient(); - * $inputUri = ""; - * $features = []; - * $operationResponse = $videoIntelligenceServiceClient->annotateVideo($inputUri, $features); + * + * $operationResponse = $videoIntelligenceServiceClient->annotateVideo(); * $operationResponse->pollUntilComplete(); * if ($operationResponse->operationSucceeded()) { * $result = $operationResponse->getResult(); @@ -70,7 +69,7 @@ * } * * // OR start the operation, keep the operation name, and resume later - * $operationResponse = $videoIntelligenceServiceClient->annotateVideo($inputUri, $features); + * $operationResponse = $videoIntelligenceServiceClient->annotateVideo(); * $operationName = $operationResponse->getName(); * // ... do other work * $newOperationResponse = $videoIntelligenceServiceClient->resumeOperation($operationName, 'annotateVideo'); @@ -304,9 +303,8 @@ public function __construct($options = []) * ``` * try { * $videoIntelligenceServiceClient = new VideoIntelligenceServiceClient(); - * $inputUri = ""; - * $features = []; - * $operationResponse = $videoIntelligenceServiceClient->annotateVideo($inputUri, $features); + * + * $operationResponse = $videoIntelligenceServiceClient->annotateVideo(); * $operationResponse->pollUntilComplete(); * if ($operationResponse->operationSucceeded()) { * $result = $operationResponse->getResult(); @@ -317,7 +315,7 @@ public function __construct($options = []) * } * * // OR start the operation, keep the operation name, and resume later - * $operationResponse = $videoIntelligenceServiceClient->annotateVideo($inputUri, $features); + * $operationResponse = $videoIntelligenceServiceClient->annotateVideo(); * $operationName = $operationResponse->getName(); * // ... do other work * $newOperationResponse = $videoIntelligenceServiceClient->resumeOperation($operationName, 'annotateVideo'); @@ -337,24 +335,26 @@ public function __construct($options = []) * } * ``` * - * @param string $inputUri Input video location. Currently, only - * [Google Cloud Storage](https://cloud.google.com/storage/) URIs are - * supported, which must be specified in the following format: - * `gs://bucket-id/object-id` (other URI formats return - * [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]). For more information, see - * [Request URIs](https://cloud.google.com/storage/docs/reference-uris). - * A video URI may include wildcards in `object-id`, and thus identify - * multiple videos. Supported wildcards: '*' to match 0 or more characters; - * '?' to match 1 character. If unset, the input video should be embedded - * in the request as `input_content`. If set, `input_content` should be unset. - * @param int[] $features Requested video annotation features. - * For allowed values, use constants defined on {@see \Google\Cloud\Videointelligence\V1beta2\Feature} - * @param array $optionalArgs { - * Optional. + * @param array $optionalArgs { + * Optional * + * @type string $inputUri + * Input video location. Currently, only + * [Google Cloud Storage](https://cloud.google.com/storage/) URIs are + * supported, which must be specified in the following format: + * `gs://bucket-id/object-id` (other URI formats return + * [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]). For more information, see + * [Request URIs](https://cloud.google.com/storage/docs/reference-uris). + * A video URI may include wildcards in `object-id`, and thus identify + * multiple videos. Supported wildcards: '*' to match 0 or more characters; + * '?' to match 1 character. If unset, the input video should be embedded + * in the request as `input_content`. If set, `input_content` should be unset. * @type string $inputContent * The video data bytes. Encoding: base64. If unset, the input video(s) * should be specified via `input_uri`. If set, `input_uri` should be unset. + * @type int[] $features + * Requested video annotation features. + * For allowed values, use constants defined on {@see \Google\Cloud\Videointelligence\V1beta2\Feature} * @type VideoContext $videoContext * Additional video context and/or feature-specific parameters. * @type string $outputUri @@ -380,14 +380,18 @@ public function __construct($options = []) * @throws \Google\GAX\ApiException if the remote call fails * @experimental */ - public function annotateVideo($inputUri, $features, $optionalArgs = []) + public function annotateVideo($optionalArgs = []) { $request = new AnnotateVideoRequest(); - $request->setInputUri($inputUri); - $request->setFeatures($features); + if (isset($optionalArgs['inputUri'])) { + $request->setInputUri($optionalArgs['inputUri']); + } if (isset($optionalArgs['inputContent'])) { $request->setInputContent($optionalArgs['inputContent']); } + if (isset($optionalArgs['features'])) { + $request->setFeatures($optionalArgs['features']); + } if (isset($optionalArgs['videoContext'])) { $request->setVideoContext($optionalArgs['videoContext']); } diff --git a/src/Vision/V1/Gapic/ImageAnnotatorGapicClient.php b/src/Vision/V1/Gapic/ImageAnnotatorGapicClient.php index c98e572bdee9..bbd68a6a2716 100644 --- a/src/Vision/V1/Gapic/ImageAnnotatorGapicClient.php +++ b/src/Vision/V1/Gapic/ImageAnnotatorGapicClient.php @@ -217,9 +217,9 @@ public function __construct($options = []) * } * ``` * - * @param AnnotateImageRequest[] $requests Individual image annotation requests for this batch. + * @param AnnotateImageRequest[] $requests individual image annotation requests for this batch * @param array $optionalArgs { - * Optional. + * Optional * * @type \Google\GAX\RetrySettings|array $retrySettings * Retry settings to use for this call. Can be a