diff --git a/Dataplex/metadata/V1/DataQuality.php b/Dataplex/metadata/V1/DataQuality.php index c9051dac7828..d0ba14beaf9d 100644 Binary files a/Dataplex/metadata/V1/DataQuality.php and b/Dataplex/metadata/V1/DataQuality.php differ diff --git a/Dataplex/src/V1/Client/BaseClient/ContentServiceBaseClient.php b/Dataplex/src/V1/Client/BaseClient/ContentServiceBaseClient.php deleted file mode 100644 index 0d8186deecc2..000000000000 --- a/Dataplex/src/V1/Client/BaseClient/ContentServiceBaseClient.php +++ /dev/null @@ -1,533 +0,0 @@ - self::SERVICE_NAME, - 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => __DIR__ . '/../../resources/content_service_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../../resources/content_service_descriptor_config.php', - 'gcpApiConfigPath' => __DIR__ . '/../../resources/content_service_grpc_config.json', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../../resources/content_service_rest_client_config.php', - ], - ], - ]; - } - - /** - * Formats a string containing the fully-qualified path to represent a content - * resource. - * - * @param string $project - * @param string $location - * @param string $lake - * @param string $content - * - * @return string The formatted content resource. - */ - public static function contentName(string $project, string $location, string $lake, string $content): string - { - return self::getPathTemplate('content')->render([ - 'project' => $project, - 'location' => $location, - 'lake' => $lake, - 'content' => $content, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a lake - * resource. - * - * @param string $project - * @param string $location - * @param string $lake - * - * @return string The formatted lake resource. - */ - public static function lakeName(string $project, string $location, string $lake): string - { - return self::getPathTemplate('lake')->render([ - 'project' => $project, - 'location' => $location, - 'lake' => $lake, - ]); - } - - /** - * Parses a formatted name string and returns an associative array of the components in the name. - * The following name formats are supported: - * Template: Pattern - * - content: projects/{project}/locations/{location}/lakes/{lake}/content/{content} - * - lake: projects/{project}/locations/{location}/lakes/{lake} - * - * 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 $template argument does not match one of the templates - * listed, then parseName will check each of the supported templates, and return - * the first match. - * - * @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. - * - * @throws ValidationException If $formattedName could not be matched. - */ - public static function parseName(string $formattedName, string $template = null): array - { - return self::parseFormattedName($formattedName, $template); - } - - /** - * Constructor. - * - * @param array $options { - * Optional. Options for configuring the service API wrapper. - * - * @type string $apiEndpoint - * The address of the API remote host. May optionally include the port, formatted - * as ":". Default 'dataplex.googleapis.com:443'. - * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials - * The credentials to be used by the client to authorize API calls. This option - * accepts either a path to a credentials file, or a decoded credentials file as a - * PHP array. - * *Advanced usage*: In addition, this option can also accept a pre-constructed - * {@see \Google\Auth\FetchAuthTokenInterface} object or - * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these - * objects are provided, any settings in $credentialsConfig will be ignored. - * @type array $credentialsConfig - * Options used to configure credentials, including auth token caching, for the - * client. For a full list of supporting configuration options, see - * {@see \Google\ApiCore\CredentialsWrapper::build()} . - * @type bool $disableRetries - * Determines whether or not retries defined by the client configuration should be - * disabled. Defaults to `false`. - * @type string|array $clientConfig - * Client method configuration, including retry settings. This option can be either - * a path to a JSON file, or a PHP array containing the decoded JSON data. By - * default this settings points to the default client config file, which is - * provided in the resources folder. - * @type string|TransportInterface $transport - * The transport used for executing network requests. May be either the string - * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. - * *Advanced usage*: Additionally, it is possible to pass in an already - * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note - * that when this object is provided, any settings in $transportConfig, and any - * $apiEndpoint setting, will be ignored. - * @type array $transportConfig - * Configuration options that will be used to construct the transport. Options for - * each supported transport type should be passed in a key for that transport. For - * example: - * $transportConfig = [ - * 'grpc' => [...], - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and - * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the - * supported options. - * @type callable $clientCertSource - * A callable which returns the client cert as a string. This can be used to - * provide a certificate and private key to the transport layer for mTLS. - * } - * - * @throws ValidationException - */ - public function __construct(array $options = []) - { - $clientOptions = $this->buildClientOptions($options); - $this->setClientOptions($clientOptions); - } - - /** Handles execution of the async variants for each documented method. */ - public function __call($method, $args) - { - if (substr($method, -5) !== 'Async') { - trigger_error('Call to undefined method ' . __CLASS__ . "::$method()", E_USER_ERROR); - } - - array_unshift($args, substr($method, 0, -5)); - return call_user_func_array([$this, 'startAsyncCall'], $args); - } - - /** - * Create a content. - * - * The async variant is {@see self::createContentAsync()} . - * - * @example samples/V1/ContentServiceClient/create_content.php - * - * @param CreateContentRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return Content - * - * @throws ApiException Thrown if the API call fails. - */ - public function createContent(CreateContentRequest $request, array $callOptions = []): Content - { - return $this->startApiCall('CreateContent', $request, $callOptions)->wait(); - } - - /** - * Delete a content. - * - * The async variant is {@see self::deleteContentAsync()} . - * - * @example samples/V1/ContentServiceClient/delete_content.php - * - * @param DeleteContentRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @throws ApiException Thrown if the API call fails. - */ - public function deleteContent(DeleteContentRequest $request, array $callOptions = []): void - { - $this->startApiCall('DeleteContent', $request, $callOptions)->wait(); - } - - /** - * Get a content resource. - * - * The async variant is {@see self::getContentAsync()} . - * - * @example samples/V1/ContentServiceClient/get_content.php - * - * @param GetContentRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return Content - * - * @throws ApiException Thrown if the API call fails. - */ - public function getContent(GetContentRequest $request, array $callOptions = []): Content - { - return $this->startApiCall('GetContent', $request, $callOptions)->wait(); - } - - /** - * Gets the access control policy for a contentitem resource. A `NOT_FOUND` - * error is returned if the resource does not exist. An empty policy is - * returned if the resource exists but does not have a policy set on it. - * - * Caller must have Google IAM `dataplex.content.getIamPolicy` permission - * on the resource. - * - * The async variant is {@see self::getIamPolicyAsync()} . - * - * @example samples/V1/ContentServiceClient/get_iam_policy.php - * - * @param GetIamPolicyRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return Policy - * - * @throws ApiException Thrown if the API call fails. - */ - public function getIamPolicy(GetIamPolicyRequest $request, array $callOptions = []): Policy - { - return $this->startApiCall('GetIamPolicy', $request, $callOptions)->wait(); - } - - /** - * List content. - * - * The async variant is {@see self::listContentAsync()} . - * - * @example samples/V1/ContentServiceClient/list_content.php - * - * @param ListContentRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return PagedListResponse - * - * @throws ApiException Thrown if the API call fails. - */ - public function listContent(ListContentRequest $request, array $callOptions = []): PagedListResponse - { - return $this->startApiCall('ListContent', $request, $callOptions); - } - - /** - * Sets the access control policy on the specified contentitem resource. - * Replaces any existing policy. - * - * Caller must have Google IAM `dataplex.content.setIamPolicy` permission - * on the resource. - * - * The async variant is {@see self::setIamPolicyAsync()} . - * - * @example samples/V1/ContentServiceClient/set_iam_policy.php - * - * @param SetIamPolicyRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return Policy - * - * @throws ApiException Thrown if the API call fails. - */ - public function setIamPolicy(SetIamPolicyRequest $request, array $callOptions = []): Policy - { - return $this->startApiCall('SetIamPolicy', $request, $callOptions)->wait(); - } - - /** - * Returns the caller's permissions on a resource. - * If the resource does not exist, an empty set of - * permissions is returned (a `NOT_FOUND` error is not returned). - * - * A caller is not required to have Google IAM permission to make this - * request. - * - * Note: This operation is designed to be used for building permission-aware - * UIs and command-line tools, not for authorization checking. This operation - * may "fail open" without warning. - * - * The async variant is {@see self::testIamPermissionsAsync()} . - * - * @example samples/V1/ContentServiceClient/test_iam_permissions.php - * - * @param TestIamPermissionsRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return TestIamPermissionsResponse - * - * @throws ApiException Thrown if the API call fails. - */ - public function testIamPermissions(TestIamPermissionsRequest $request, array $callOptions = []): TestIamPermissionsResponse - { - return $this->startApiCall('TestIamPermissions', $request, $callOptions)->wait(); - } - - /** - * Update a content. Only supports full resource update. - * - * The async variant is {@see self::updateContentAsync()} . - * - * @example samples/V1/ContentServiceClient/update_content.php - * - * @param UpdateContentRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return Content - * - * @throws ApiException Thrown if the API call fails. - */ - public function updateContent(UpdateContentRequest $request, array $callOptions = []): Content - { - return $this->startApiCall('UpdateContent', $request, $callOptions)->wait(); - } - - /** - * Gets information about a location. - * - * The async variant is {@see self::getLocationAsync()} . - * - * @example samples/V1/ContentServiceClient/get_location.php - * - * @param GetLocationRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return Location - * - * @throws ApiException Thrown if the API call fails. - */ - public function getLocation(GetLocationRequest $request, array $callOptions = []): Location - { - return $this->startApiCall('GetLocation', $request, $callOptions)->wait(); - } - - /** - * Lists information about the supported locations for this service. - * - * The async variant is {@see self::listLocationsAsync()} . - * - * @example samples/V1/ContentServiceClient/list_locations.php - * - * @param ListLocationsRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return PagedListResponse - * - * @throws ApiException Thrown if the API call fails. - */ - public function listLocations(ListLocationsRequest $request, array $callOptions = []): PagedListResponse - { - return $this->startApiCall('ListLocations', $request, $callOptions); - } -} diff --git a/Dataplex/src/V1/Client/BaseClient/DataScanServiceBaseClient.php b/Dataplex/src/V1/Client/BaseClient/DataScanServiceBaseClient.php deleted file mode 100644 index aa72e4013c9c..000000000000 --- a/Dataplex/src/V1/Client/BaseClient/DataScanServiceBaseClient.php +++ /dev/null @@ -1,693 +0,0 @@ - self::SERVICE_NAME, - 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => __DIR__ . '/../../resources/data_scan_service_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../../resources/data_scan_service_descriptor_config.php', - 'gcpApiConfigPath' => __DIR__ . '/../../resources/data_scan_service_grpc_config.json', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../../resources/data_scan_service_rest_client_config.php', - ], - ], - ]; - } - - /** - * Return an OperationsClient object with the same endpoint as $this. - * - * @return OperationsClient - */ - public function getOperationsClient() - { - return $this->operationsClient; - } - - /** - * Resume an existing long running operation that was previously started by a long - * running API method. If $methodName is not provided, or does not match a long - * running API method, then the operation can still be resumed, but the - * OperationResponse object will not deserialize the final response. - * - * @param string $operationName The name of the long running operation - * @param string $methodName The name of the method used to start the operation - * - * @return OperationResponse - */ - public function resumeOperation($operationName, $methodName = null) - { - $options = isset($this->descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : []; - $operation = new OperationResponse($operationName, $this->getOperationsClient(), $options); - $operation->reload(); - return $operation; - } - - /** - * Formats a string containing the fully-qualified path to represent a data_scan - * resource. - * - * @param string $project - * @param string $location - * @param string $dataScan - * - * @return string The formatted data_scan resource. - */ - public static function dataScanName(string $project, string $location, string $dataScan): string - { - return self::getPathTemplate('dataScan')->render([ - 'project' => $project, - 'location' => $location, - 'dataScan' => $dataScan, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a - * data_scan_job resource. - * - * @param string $project - * @param string $location - * @param string $dataScan - * @param string $job - * - * @return string The formatted data_scan_job resource. - */ - public static function dataScanJobName(string $project, string $location, string $dataScan, string $job): string - { - return self::getPathTemplate('dataScanJob')->render([ - 'project' => $project, - 'location' => $location, - 'dataScan' => $dataScan, - 'job' => $job, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a entity - * resource. - * - * @param string $project - * @param string $location - * @param string $lake - * @param string $zone - * @param string $entity - * - * @return string The formatted entity resource. - */ - public static function entityName(string $project, string $location, string $lake, string $zone, string $entity): string - { - return self::getPathTemplate('entity')->render([ - 'project' => $project, - 'location' => $location, - 'lake' => $lake, - 'zone' => $zone, - 'entity' => $entity, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a location - * resource. - * - * @param string $project - * @param string $location - * - * @return string The formatted location resource. - */ - public static function locationName(string $project, string $location): string - { - return self::getPathTemplate('location')->render([ - 'project' => $project, - 'location' => $location, - ]); - } - - /** - * Parses a formatted name string and returns an associative array of the components in the name. - * The following name formats are supported: - * Template: Pattern - * - dataScan: projects/{project}/locations/{location}/dataScans/{dataScan} - * - dataScanJob: projects/{project}/locations/{location}/dataScans/{dataScan}/jobs/{job} - * - entity: projects/{project}/locations/{location}/lakes/{lake}/zones/{zone}/entities/{entity} - * - location: projects/{project}/locations/{location} - * - * 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 $template argument does not match one of the templates - * listed, then parseName will check each of the supported templates, and return - * the first match. - * - * @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. - * - * @throws ValidationException If $formattedName could not be matched. - */ - public static function parseName(string $formattedName, string $template = null): array - { - return self::parseFormattedName($formattedName, $template); - } - - /** - * Constructor. - * - * @param array $options { - * Optional. Options for configuring the service API wrapper. - * - * @type string $apiEndpoint - * The address of the API remote host. May optionally include the port, formatted - * as ":". Default 'dataplex.googleapis.com:443'. - * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials - * The credentials to be used by the client to authorize API calls. This option - * accepts either a path to a credentials file, or a decoded credentials file as a - * PHP array. - * *Advanced usage*: In addition, this option can also accept a pre-constructed - * {@see \Google\Auth\FetchAuthTokenInterface} object or - * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these - * objects are provided, any settings in $credentialsConfig will be ignored. - * @type array $credentialsConfig - * Options used to configure credentials, including auth token caching, for the - * client. For a full list of supporting configuration options, see - * {@see \Google\ApiCore\CredentialsWrapper::build()} . - * @type bool $disableRetries - * Determines whether or not retries defined by the client configuration should be - * disabled. Defaults to `false`. - * @type string|array $clientConfig - * Client method configuration, including retry settings. This option can be either - * a path to a JSON file, or a PHP array containing the decoded JSON data. By - * default this settings points to the default client config file, which is - * provided in the resources folder. - * @type string|TransportInterface $transport - * The transport used for executing network requests. May be either the string - * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. - * *Advanced usage*: Additionally, it is possible to pass in an already - * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note - * that when this object is provided, any settings in $transportConfig, and any - * $apiEndpoint setting, will be ignored. - * @type array $transportConfig - * Configuration options that will be used to construct the transport. Options for - * each supported transport type should be passed in a key for that transport. For - * example: - * $transportConfig = [ - * 'grpc' => [...], - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and - * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the - * supported options. - * @type callable $clientCertSource - * A callable which returns the client cert as a string. This can be used to - * provide a certificate and private key to the transport layer for mTLS. - * } - * - * @throws ValidationException - */ - public function __construct(array $options = []) - { - $clientOptions = $this->buildClientOptions($options); - $this->setClientOptions($clientOptions); - $this->operationsClient = $this->createOperationsClient($clientOptions); - } - - /** Handles execution of the async variants for each documented method. */ - public function __call($method, $args) - { - if (substr($method, -5) !== 'Async') { - trigger_error('Call to undefined method ' . __CLASS__ . "::$method()", E_USER_ERROR); - } - - array_unshift($args, substr($method, 0, -5)); - return call_user_func_array([$this, 'startAsyncCall'], $args); - } - - /** - * Creates a DataScan resource. - * - * The async variant is {@see self::createDataScanAsync()} . - * - * @example samples/V1/DataScanServiceClient/create_data_scan.php - * - * @param CreateDataScanRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return OperationResponse - * - * @throws ApiException Thrown if the API call fails. - */ - public function createDataScan(CreateDataScanRequest $request, array $callOptions = []): OperationResponse - { - return $this->startApiCall('CreateDataScan', $request, $callOptions)->wait(); - } - - /** - * Deletes a DataScan resource. - * - * The async variant is {@see self::deleteDataScanAsync()} . - * - * @example samples/V1/DataScanServiceClient/delete_data_scan.php - * - * @param DeleteDataScanRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return OperationResponse - * - * @throws ApiException Thrown if the API call fails. - */ - public function deleteDataScan(DeleteDataScanRequest $request, array $callOptions = []): OperationResponse - { - return $this->startApiCall('DeleteDataScan', $request, $callOptions)->wait(); - } - - /** - * Gets a DataScan resource. - * - * The async variant is {@see self::getDataScanAsync()} . - * - * @example samples/V1/DataScanServiceClient/get_data_scan.php - * - * @param GetDataScanRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return DataScan - * - * @throws ApiException Thrown if the API call fails. - */ - public function getDataScan(GetDataScanRequest $request, array $callOptions = []): DataScan - { - return $this->startApiCall('GetDataScan', $request, $callOptions)->wait(); - } - - /** - * Gets a DataScanJob resource. - * - * The async variant is {@see self::getDataScanJobAsync()} . - * - * @example samples/V1/DataScanServiceClient/get_data_scan_job.php - * - * @param GetDataScanJobRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return DataScanJob - * - * @throws ApiException Thrown if the API call fails. - */ - public function getDataScanJob(GetDataScanJobRequest $request, array $callOptions = []): DataScanJob - { - return $this->startApiCall('GetDataScanJob', $request, $callOptions)->wait(); - } - - /** - * Lists DataScanJobs under the given DataScan. - * - * The async variant is {@see self::listDataScanJobsAsync()} . - * - * @example samples/V1/DataScanServiceClient/list_data_scan_jobs.php - * - * @param ListDataScanJobsRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return PagedListResponse - * - * @throws ApiException Thrown if the API call fails. - */ - public function listDataScanJobs(ListDataScanJobsRequest $request, array $callOptions = []): PagedListResponse - { - return $this->startApiCall('ListDataScanJobs', $request, $callOptions); - } - - /** - * Lists DataScans. - * - * The async variant is {@see self::listDataScansAsync()} . - * - * @example samples/V1/DataScanServiceClient/list_data_scans.php - * - * @param ListDataScansRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return PagedListResponse - * - * @throws ApiException Thrown if the API call fails. - */ - public function listDataScans(ListDataScansRequest $request, array $callOptions = []): PagedListResponse - { - return $this->startApiCall('ListDataScans', $request, $callOptions); - } - - /** - * Runs an on-demand execution of a DataScan - * - * The async variant is {@see self::runDataScanAsync()} . - * - * @example samples/V1/DataScanServiceClient/run_data_scan.php - * - * @param RunDataScanRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return RunDataScanResponse - * - * @throws ApiException Thrown if the API call fails. - */ - public function runDataScan(RunDataScanRequest $request, array $callOptions = []): RunDataScanResponse - { - return $this->startApiCall('RunDataScan', $request, $callOptions)->wait(); - } - - /** - * Updates a DataScan resource. - * - * The async variant is {@see self::updateDataScanAsync()} . - * - * @example samples/V1/DataScanServiceClient/update_data_scan.php - * - * @param UpdateDataScanRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return OperationResponse - * - * @throws ApiException Thrown if the API call fails. - */ - public function updateDataScan(UpdateDataScanRequest $request, array $callOptions = []): OperationResponse - { - return $this->startApiCall('UpdateDataScan', $request, $callOptions)->wait(); - } - - /** - * Gets the access control policy for a resource. Returns an empty policy - if the resource exists and does not have a policy set. - * - * The async variant is {@see self::getIamPolicyAsync()} . - * - * @example samples/V1/DataScanServiceClient/get_iam_policy.php - * - * @param GetIamPolicyRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return Policy - * - * @throws ApiException Thrown if the API call fails. - */ - public function getIamPolicy(GetIamPolicyRequest $request, array $callOptions = []): Policy - { - return $this->startApiCall('GetIamPolicy', $request, $callOptions)->wait(); - } - - /** - * Sets the access control policy on the specified resource. Replaces - any existing policy. - - Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` - errors. - * - * The async variant is {@see self::setIamPolicyAsync()} . - * - * @example samples/V1/DataScanServiceClient/set_iam_policy.php - * - * @param SetIamPolicyRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return Policy - * - * @throws ApiException Thrown if the API call fails. - */ - public function setIamPolicy(SetIamPolicyRequest $request, array $callOptions = []): Policy - { - return $this->startApiCall('SetIamPolicy', $request, $callOptions)->wait(); - } - - /** - * Returns permissions that a caller has on the specified resource. If the - resource does not exist, this will return an empty set of - permissions, not a `NOT_FOUND` error. - - Note: This operation is designed to be used for building - permission-aware UIs and command-line tools, not for authorization - checking. This operation may "fail open" without warning. - * - * The async variant is {@see self::testIamPermissionsAsync()} . - * - * @example samples/V1/DataScanServiceClient/test_iam_permissions.php - * - * @param TestIamPermissionsRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return TestIamPermissionsResponse - * - * @throws ApiException Thrown if the API call fails. - */ - public function testIamPermissions(TestIamPermissionsRequest $request, array $callOptions = []): TestIamPermissionsResponse - { - return $this->startApiCall('TestIamPermissions', $request, $callOptions)->wait(); - } - - /** - * Gets information about a location. - * - * The async variant is {@see self::getLocationAsync()} . - * - * @example samples/V1/DataScanServiceClient/get_location.php - * - * @param GetLocationRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return Location - * - * @throws ApiException Thrown if the API call fails. - */ - public function getLocation(GetLocationRequest $request, array $callOptions = []): Location - { - return $this->startApiCall('GetLocation', $request, $callOptions)->wait(); - } - - /** - * Lists information about the supported locations for this service. - * - * The async variant is {@see self::listLocationsAsync()} . - * - * @example samples/V1/DataScanServiceClient/list_locations.php - * - * @param ListLocationsRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return PagedListResponse - * - * @throws ApiException Thrown if the API call fails. - */ - public function listLocations(ListLocationsRequest $request, array $callOptions = []): PagedListResponse - { - return $this->startApiCall('ListLocations', $request, $callOptions); - } -} diff --git a/Dataplex/src/V1/Client/BaseClient/DataTaxonomyServiceBaseClient.php b/Dataplex/src/V1/Client/BaseClient/DataTaxonomyServiceBaseClient.php deleted file mode 100644 index 911b7402a850..000000000000 --- a/Dataplex/src/V1/Client/BaseClient/DataTaxonomyServiceBaseClient.php +++ /dev/null @@ -1,888 +0,0 @@ - self::SERVICE_NAME, - 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => __DIR__ . '/../../resources/data_taxonomy_service_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../../resources/data_taxonomy_service_descriptor_config.php', - 'gcpApiConfigPath' => __DIR__ . '/../../resources/data_taxonomy_service_grpc_config.json', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../../resources/data_taxonomy_service_rest_client_config.php', - ], - ], - ]; - } - - /** - * Return an OperationsClient object with the same endpoint as $this. - * - * @return OperationsClient - */ - public function getOperationsClient() - { - return $this->operationsClient; - } - - /** - * Resume an existing long running operation that was previously started by a long - * running API method. If $methodName is not provided, or does not match a long - * running API method, then the operation can still be resumed, but the - * OperationResponse object will not deserialize the final response. - * - * @param string $operationName The name of the long running operation - * @param string $methodName The name of the method used to start the operation - * - * @return OperationResponse - */ - public function resumeOperation($operationName, $methodName = null) - { - $options = isset($this->descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : []; - $operation = new OperationResponse($operationName, $this->getOperationsClient(), $options); - $operation->reload(); - return $operation; - } - - /** - * Formats a string containing the fully-qualified path to represent a - * data_attribute resource. - * - * @param string $project - * @param string $location - * @param string $dataTaxonomy - * @param string $dataAttributeId - * - * @return string The formatted data_attribute resource. - */ - public static function dataAttributeName(string $project, string $location, string $dataTaxonomy, string $dataAttributeId): string - { - return self::getPathTemplate('dataAttribute')->render([ - 'project' => $project, - 'location' => $location, - 'dataTaxonomy' => $dataTaxonomy, - 'data_attribute_id' => $dataAttributeId, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a - * data_attribute_binding resource. - * - * @param string $project - * @param string $location - * @param string $dataAttributeBindingId - * - * @return string The formatted data_attribute_binding resource. - */ - public static function dataAttributeBindingName(string $project, string $location, string $dataAttributeBindingId): string - { - return self::getPathTemplate('dataAttributeBinding')->render([ - 'project' => $project, - 'location' => $location, - 'data_attribute_binding_id' => $dataAttributeBindingId, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a - * data_taxonomy resource. - * - * @param string $project - * @param string $location - * @param string $dataTaxonomyId - * - * @return string The formatted data_taxonomy resource. - */ - public static function dataTaxonomyName(string $project, string $location, string $dataTaxonomyId): string - { - return self::getPathTemplate('dataTaxonomy')->render([ - 'project' => $project, - 'location' => $location, - 'data_taxonomy_id' => $dataTaxonomyId, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a location - * resource. - * - * @param string $project - * @param string $location - * - * @return string The formatted location resource. - */ - public static function locationName(string $project, string $location): string - { - return self::getPathTemplate('location')->render([ - 'project' => $project, - 'location' => $location, - ]); - } - - /** - * Parses a formatted name string and returns an associative array of the components in the name. - * The following name formats are supported: - * Template: Pattern - * - dataAttribute: projects/{project}/locations/{location}/dataTaxonomies/{dataTaxonomy}/attributes/{data_attribute_id} - * - dataAttributeBinding: projects/{project}/locations/{location}/dataAttributeBindings/{data_attribute_binding_id} - * - dataTaxonomy: projects/{project}/locations/{location}/dataTaxonomies/{data_taxonomy_id} - * - location: projects/{project}/locations/{location} - * - * 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 $template argument does not match one of the templates - * listed, then parseName will check each of the supported templates, and return - * the first match. - * - * @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. - * - * @throws ValidationException If $formattedName could not be matched. - */ - public static function parseName(string $formattedName, string $template = null): array - { - return self::parseFormattedName($formattedName, $template); - } - - /** - * Constructor. - * - * @param array $options { - * Optional. Options for configuring the service API wrapper. - * - * @type string $apiEndpoint - * The address of the API remote host. May optionally include the port, formatted - * as ":". Default 'dataplex.googleapis.com:443'. - * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials - * The credentials to be used by the client to authorize API calls. This option - * accepts either a path to a credentials file, or a decoded credentials file as a - * PHP array. - * *Advanced usage*: In addition, this option can also accept a pre-constructed - * {@see \Google\Auth\FetchAuthTokenInterface} object or - * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these - * objects are provided, any settings in $credentialsConfig will be ignored. - * @type array $credentialsConfig - * Options used to configure credentials, including auth token caching, for the - * client. For a full list of supporting configuration options, see - * {@see \Google\ApiCore\CredentialsWrapper::build()} . - * @type bool $disableRetries - * Determines whether or not retries defined by the client configuration should be - * disabled. Defaults to `false`. - * @type string|array $clientConfig - * Client method configuration, including retry settings. This option can be either - * a path to a JSON file, or a PHP array containing the decoded JSON data. By - * default this settings points to the default client config file, which is - * provided in the resources folder. - * @type string|TransportInterface $transport - * The transport used for executing network requests. May be either the string - * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. - * *Advanced usage*: Additionally, it is possible to pass in an already - * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note - * that when this object is provided, any settings in $transportConfig, and any - * $apiEndpoint setting, will be ignored. - * @type array $transportConfig - * Configuration options that will be used to construct the transport. Options for - * each supported transport type should be passed in a key for that transport. For - * example: - * $transportConfig = [ - * 'grpc' => [...], - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and - * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the - * supported options. - * @type callable $clientCertSource - * A callable which returns the client cert as a string. This can be used to - * provide a certificate and private key to the transport layer for mTLS. - * } - * - * @throws ValidationException - */ - public function __construct(array $options = []) - { - $clientOptions = $this->buildClientOptions($options); - $this->setClientOptions($clientOptions); - $this->operationsClient = $this->createOperationsClient($clientOptions); - } - - /** Handles execution of the async variants for each documented method. */ - public function __call($method, $args) - { - if (substr($method, -5) !== 'Async') { - trigger_error('Call to undefined method ' . __CLASS__ . "::$method()", E_USER_ERROR); - } - - array_unshift($args, substr($method, 0, -5)); - return call_user_func_array([$this, 'startAsyncCall'], $args); - } - - /** - * Create a DataAttribute resource. - * - * The async variant is {@see self::createDataAttributeAsync()} . - * - * @example samples/V1/DataTaxonomyServiceClient/create_data_attribute.php - * - * @param CreateDataAttributeRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return OperationResponse - * - * @throws ApiException Thrown if the API call fails. - */ - public function createDataAttribute(CreateDataAttributeRequest $request, array $callOptions = []): OperationResponse - { - return $this->startApiCall('CreateDataAttribute', $request, $callOptions)->wait(); - } - - /** - * Create a DataAttributeBinding resource. - * - * The async variant is {@see self::createDataAttributeBindingAsync()} . - * - * @example samples/V1/DataTaxonomyServiceClient/create_data_attribute_binding.php - * - * @param CreateDataAttributeBindingRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return OperationResponse - * - * @throws ApiException Thrown if the API call fails. - */ - public function createDataAttributeBinding(CreateDataAttributeBindingRequest $request, array $callOptions = []): OperationResponse - { - return $this->startApiCall('CreateDataAttributeBinding', $request, $callOptions)->wait(); - } - - /** - * Create a DataTaxonomy resource. - * - * The async variant is {@see self::createDataTaxonomyAsync()} . - * - * @example samples/V1/DataTaxonomyServiceClient/create_data_taxonomy.php - * - * @param CreateDataTaxonomyRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return OperationResponse - * - * @throws ApiException Thrown if the API call fails. - */ - public function createDataTaxonomy(CreateDataTaxonomyRequest $request, array $callOptions = []): OperationResponse - { - return $this->startApiCall('CreateDataTaxonomy', $request, $callOptions)->wait(); - } - - /** - * Deletes a Data Attribute resource. - * - * The async variant is {@see self::deleteDataAttributeAsync()} . - * - * @example samples/V1/DataTaxonomyServiceClient/delete_data_attribute.php - * - * @param DeleteDataAttributeRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return OperationResponse - * - * @throws ApiException Thrown if the API call fails. - */ - public function deleteDataAttribute(DeleteDataAttributeRequest $request, array $callOptions = []): OperationResponse - { - return $this->startApiCall('DeleteDataAttribute', $request, $callOptions)->wait(); - } - - /** - * Deletes a DataAttributeBinding resource. All attributes within the - * DataAttributeBinding must be deleted before the DataAttributeBinding can be - * deleted. - * - * The async variant is {@see self::deleteDataAttributeBindingAsync()} . - * - * @example samples/V1/DataTaxonomyServiceClient/delete_data_attribute_binding.php - * - * @param DeleteDataAttributeBindingRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return OperationResponse - * - * @throws ApiException Thrown if the API call fails. - */ - public function deleteDataAttributeBinding(DeleteDataAttributeBindingRequest $request, array $callOptions = []): OperationResponse - { - return $this->startApiCall('DeleteDataAttributeBinding', $request, $callOptions)->wait(); - } - - /** - * Deletes a DataTaxonomy resource. All attributes within the DataTaxonomy - * must be deleted before the DataTaxonomy can be deleted. - * - * The async variant is {@see self::deleteDataTaxonomyAsync()} . - * - * @example samples/V1/DataTaxonomyServiceClient/delete_data_taxonomy.php - * - * @param DeleteDataTaxonomyRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return OperationResponse - * - * @throws ApiException Thrown if the API call fails. - */ - public function deleteDataTaxonomy(DeleteDataTaxonomyRequest $request, array $callOptions = []): OperationResponse - { - return $this->startApiCall('DeleteDataTaxonomy', $request, $callOptions)->wait(); - } - - /** - * Retrieves a Data Attribute resource. - * - * The async variant is {@see self::getDataAttributeAsync()} . - * - * @example samples/V1/DataTaxonomyServiceClient/get_data_attribute.php - * - * @param GetDataAttributeRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return DataAttribute - * - * @throws ApiException Thrown if the API call fails. - */ - public function getDataAttribute(GetDataAttributeRequest $request, array $callOptions = []): DataAttribute - { - return $this->startApiCall('GetDataAttribute', $request, $callOptions)->wait(); - } - - /** - * Retrieves a DataAttributeBinding resource. - * - * The async variant is {@see self::getDataAttributeBindingAsync()} . - * - * @example samples/V1/DataTaxonomyServiceClient/get_data_attribute_binding.php - * - * @param GetDataAttributeBindingRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return DataAttributeBinding - * - * @throws ApiException Thrown if the API call fails. - */ - public function getDataAttributeBinding(GetDataAttributeBindingRequest $request, array $callOptions = []): DataAttributeBinding - { - return $this->startApiCall('GetDataAttributeBinding', $request, $callOptions)->wait(); - } - - /** - * Retrieves a DataTaxonomy resource. - * - * The async variant is {@see self::getDataTaxonomyAsync()} . - * - * @example samples/V1/DataTaxonomyServiceClient/get_data_taxonomy.php - * - * @param GetDataTaxonomyRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return DataTaxonomy - * - * @throws ApiException Thrown if the API call fails. - */ - public function getDataTaxonomy(GetDataTaxonomyRequest $request, array $callOptions = []): DataTaxonomy - { - return $this->startApiCall('GetDataTaxonomy', $request, $callOptions)->wait(); - } - - /** - * Lists DataAttributeBinding resources in a project and location. - * - * The async variant is {@see self::listDataAttributeBindingsAsync()} . - * - * @example samples/V1/DataTaxonomyServiceClient/list_data_attribute_bindings.php - * - * @param ListDataAttributeBindingsRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return PagedListResponse - * - * @throws ApiException Thrown if the API call fails. - */ - public function listDataAttributeBindings(ListDataAttributeBindingsRequest $request, array $callOptions = []): PagedListResponse - { - return $this->startApiCall('ListDataAttributeBindings', $request, $callOptions); - } - - /** - * Lists Data Attribute resources in a DataTaxonomy. - * - * The async variant is {@see self::listDataAttributesAsync()} . - * - * @example samples/V1/DataTaxonomyServiceClient/list_data_attributes.php - * - * @param ListDataAttributesRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return PagedListResponse - * - * @throws ApiException Thrown if the API call fails. - */ - public function listDataAttributes(ListDataAttributesRequest $request, array $callOptions = []): PagedListResponse - { - return $this->startApiCall('ListDataAttributes', $request, $callOptions); - } - - /** - * Lists DataTaxonomy resources in a project and location. - * - * The async variant is {@see self::listDataTaxonomiesAsync()} . - * - * @example samples/V1/DataTaxonomyServiceClient/list_data_taxonomies.php - * - * @param ListDataTaxonomiesRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return PagedListResponse - * - * @throws ApiException Thrown if the API call fails. - */ - public function listDataTaxonomies(ListDataTaxonomiesRequest $request, array $callOptions = []): PagedListResponse - { - return $this->startApiCall('ListDataTaxonomies', $request, $callOptions); - } - - /** - * Updates a DataAttribute resource. - * - * The async variant is {@see self::updateDataAttributeAsync()} . - * - * @example samples/V1/DataTaxonomyServiceClient/update_data_attribute.php - * - * @param UpdateDataAttributeRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return OperationResponse - * - * @throws ApiException Thrown if the API call fails. - */ - public function updateDataAttribute(UpdateDataAttributeRequest $request, array $callOptions = []): OperationResponse - { - return $this->startApiCall('UpdateDataAttribute', $request, $callOptions)->wait(); - } - - /** - * Updates a DataAttributeBinding resource. - * - * The async variant is {@see self::updateDataAttributeBindingAsync()} . - * - * @example samples/V1/DataTaxonomyServiceClient/update_data_attribute_binding.php - * - * @param UpdateDataAttributeBindingRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return OperationResponse - * - * @throws ApiException Thrown if the API call fails. - */ - public function updateDataAttributeBinding(UpdateDataAttributeBindingRequest $request, array $callOptions = []): OperationResponse - { - return $this->startApiCall('UpdateDataAttributeBinding', $request, $callOptions)->wait(); - } - - /** - * Updates a DataTaxonomy resource. - * - * The async variant is {@see self::updateDataTaxonomyAsync()} . - * - * @example samples/V1/DataTaxonomyServiceClient/update_data_taxonomy.php - * - * @param UpdateDataTaxonomyRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return OperationResponse - * - * @throws ApiException Thrown if the API call fails. - */ - public function updateDataTaxonomy(UpdateDataTaxonomyRequest $request, array $callOptions = []): OperationResponse - { - return $this->startApiCall('UpdateDataTaxonomy', $request, $callOptions)->wait(); - } - - /** - * Gets the access control policy for a resource. Returns an empty policy - if the resource exists and does not have a policy set. - * - * The async variant is {@see self::getIamPolicyAsync()} . - * - * @example samples/V1/DataTaxonomyServiceClient/get_iam_policy.php - * - * @param GetIamPolicyRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return Policy - * - * @throws ApiException Thrown if the API call fails. - */ - public function getIamPolicy(GetIamPolicyRequest $request, array $callOptions = []): Policy - { - return $this->startApiCall('GetIamPolicy', $request, $callOptions)->wait(); - } - - /** - * Sets the access control policy on the specified resource. Replaces - any existing policy. - - Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` - errors. - * - * The async variant is {@see self::setIamPolicyAsync()} . - * - * @example samples/V1/DataTaxonomyServiceClient/set_iam_policy.php - * - * @param SetIamPolicyRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return Policy - * - * @throws ApiException Thrown if the API call fails. - */ - public function setIamPolicy(SetIamPolicyRequest $request, array $callOptions = []): Policy - { - return $this->startApiCall('SetIamPolicy', $request, $callOptions)->wait(); - } - - /** - * Returns permissions that a caller has on the specified resource. If the - resource does not exist, this will return an empty set of - permissions, not a `NOT_FOUND` error. - - Note: This operation is designed to be used for building - permission-aware UIs and command-line tools, not for authorization - checking. This operation may "fail open" without warning. - * - * The async variant is {@see self::testIamPermissionsAsync()} . - * - * @example samples/V1/DataTaxonomyServiceClient/test_iam_permissions.php - * - * @param TestIamPermissionsRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return TestIamPermissionsResponse - * - * @throws ApiException Thrown if the API call fails. - */ - public function testIamPermissions(TestIamPermissionsRequest $request, array $callOptions = []): TestIamPermissionsResponse - { - return $this->startApiCall('TestIamPermissions', $request, $callOptions)->wait(); - } - - /** - * Gets information about a location. - * - * The async variant is {@see self::getLocationAsync()} . - * - * @example samples/V1/DataTaxonomyServiceClient/get_location.php - * - * @param GetLocationRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return Location - * - * @throws ApiException Thrown if the API call fails. - */ - public function getLocation(GetLocationRequest $request, array $callOptions = []): Location - { - return $this->startApiCall('GetLocation', $request, $callOptions)->wait(); - } - - /** - * Lists information about the supported locations for this service. - * - * The async variant is {@see self::listLocationsAsync()} . - * - * @example samples/V1/DataTaxonomyServiceClient/list_locations.php - * - * @param ListLocationsRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return PagedListResponse - * - * @throws ApiException Thrown if the API call fails. - */ - public function listLocations(ListLocationsRequest $request, array $callOptions = []): PagedListResponse - { - return $this->startApiCall('ListLocations', $request, $callOptions); - } -} diff --git a/Dataplex/src/V1/Client/BaseClient/DataplexServiceBaseClient.php b/Dataplex/src/V1/Client/BaseClient/DataplexServiceBaseClient.php deleted file mode 100644 index 766f7eee283a..000000000000 --- a/Dataplex/src/V1/Client/BaseClient/DataplexServiceBaseClient.php +++ /dev/null @@ -1,1469 +0,0 @@ - self::SERVICE_NAME, - 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => __DIR__ . '/../../resources/dataplex_service_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../../resources/dataplex_service_descriptor_config.php', - 'gcpApiConfigPath' => __DIR__ . '/../../resources/dataplex_service_grpc_config.json', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../../resources/dataplex_service_rest_client_config.php', - ], - ], - ]; - } - - /** - * Return an OperationsClient object with the same endpoint as $this. - * - * @return OperationsClient - */ - public function getOperationsClient() - { - return $this->operationsClient; - } - - /** - * Resume an existing long running operation that was previously started by a long - * running API method. If $methodName is not provided, or does not match a long - * running API method, then the operation can still be resumed, but the - * OperationResponse object will not deserialize the final response. - * - * @param string $operationName The name of the long running operation - * @param string $methodName The name of the method used to start the operation - * - * @return OperationResponse - */ - public function resumeOperation($operationName, $methodName = null) - { - $options = isset($this->descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : []; - $operation = new OperationResponse($operationName, $this->getOperationsClient(), $options); - $operation->reload(); - return $operation; - } - - /** - * Formats a string containing the fully-qualified path to represent a asset - * resource. - * - * @param string $project - * @param string $location - * @param string $lake - * @param string $zone - * @param string $asset - * - * @return string The formatted asset resource. - */ - public static function assetName(string $project, string $location, string $lake, string $zone, string $asset): string - { - return self::getPathTemplate('asset')->render([ - 'project' => $project, - 'location' => $location, - 'lake' => $lake, - 'zone' => $zone, - 'asset' => $asset, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a environment - * resource. - * - * @param string $project - * @param string $location - * @param string $lake - * @param string $environment - * - * @return string The formatted environment resource. - */ - public static function environmentName(string $project, string $location, string $lake, string $environment): string - { - return self::getPathTemplate('environment')->render([ - 'project' => $project, - 'location' => $location, - 'lake' => $lake, - 'environment' => $environment, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a job - * resource. - * - * @param string $project - * @param string $location - * @param string $lake - * @param string $task - * @param string $job - * - * @return string The formatted job resource. - */ - public static function jobName(string $project, string $location, string $lake, string $task, string $job): string - { - return self::getPathTemplate('job')->render([ - 'project' => $project, - 'location' => $location, - 'lake' => $lake, - 'task' => $task, - 'job' => $job, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a lake - * resource. - * - * @param string $project - * @param string $location - * @param string $lake - * - * @return string The formatted lake resource. - */ - public static function lakeName(string $project, string $location, string $lake): string - { - return self::getPathTemplate('lake')->render([ - 'project' => $project, - 'location' => $location, - 'lake' => $lake, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a location - * resource. - * - * @param string $project - * @param string $location - * - * @return string The formatted location resource. - */ - public static function locationName(string $project, string $location): string - { - return self::getPathTemplate('location')->render([ - 'project' => $project, - 'location' => $location, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a task - * resource. - * - * @param string $project - * @param string $location - * @param string $lake - * @param string $task - * - * @return string The formatted task resource. - */ - public static function taskName(string $project, string $location, string $lake, string $task): string - { - return self::getPathTemplate('task')->render([ - 'project' => $project, - 'location' => $location, - 'lake' => $lake, - 'task' => $task, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a zone - * resource. - * - * @param string $project - * @param string $location - * @param string $lake - * @param string $zone - * - * @return string The formatted zone resource. - */ - public static function zoneName(string $project, string $location, string $lake, string $zone): string - { - return self::getPathTemplate('zone')->render([ - 'project' => $project, - 'location' => $location, - 'lake' => $lake, - 'zone' => $zone, - ]); - } - - /** - * Parses a formatted name string and returns an associative array of the components in the name. - * The following name formats are supported: - * Template: Pattern - * - asset: projects/{project}/locations/{location}/lakes/{lake}/zones/{zone}/assets/{asset} - * - environment: projects/{project}/locations/{location}/lakes/{lake}/environments/{environment} - * - job: projects/{project}/locations/{location}/lakes/{lake}/tasks/{task}/jobs/{job} - * - lake: projects/{project}/locations/{location}/lakes/{lake} - * - location: projects/{project}/locations/{location} - * - task: projects/{project}/locations/{location}/lakes/{lake}/tasks/{task} - * - zone: projects/{project}/locations/{location}/lakes/{lake}/zones/{zone} - * - * 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 $template argument does not match one of the templates - * listed, then parseName will check each of the supported templates, and return - * the first match. - * - * @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. - * - * @throws ValidationException If $formattedName could not be matched. - */ - public static function parseName(string $formattedName, string $template = null): array - { - return self::parseFormattedName($formattedName, $template); - } - - /** - * Constructor. - * - * @param array $options { - * Optional. Options for configuring the service API wrapper. - * - * @type string $apiEndpoint - * The address of the API remote host. May optionally include the port, formatted - * as ":". Default 'dataplex.googleapis.com:443'. - * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials - * The credentials to be used by the client to authorize API calls. This option - * accepts either a path to a credentials file, or a decoded credentials file as a - * PHP array. - * *Advanced usage*: In addition, this option can also accept a pre-constructed - * {@see \Google\Auth\FetchAuthTokenInterface} object or - * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these - * objects are provided, any settings in $credentialsConfig will be ignored. - * @type array $credentialsConfig - * Options used to configure credentials, including auth token caching, for the - * client. For a full list of supporting configuration options, see - * {@see \Google\ApiCore\CredentialsWrapper::build()} . - * @type bool $disableRetries - * Determines whether or not retries defined by the client configuration should be - * disabled. Defaults to `false`. - * @type string|array $clientConfig - * Client method configuration, including retry settings. This option can be either - * a path to a JSON file, or a PHP array containing the decoded JSON data. By - * default this settings points to the default client config file, which is - * provided in the resources folder. - * @type string|TransportInterface $transport - * The transport used for executing network requests. May be either the string - * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. - * *Advanced usage*: Additionally, it is possible to pass in an already - * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note - * that when this object is provided, any settings in $transportConfig, and any - * $apiEndpoint setting, will be ignored. - * @type array $transportConfig - * Configuration options that will be used to construct the transport. Options for - * each supported transport type should be passed in a key for that transport. For - * example: - * $transportConfig = [ - * 'grpc' => [...], - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and - * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the - * supported options. - * @type callable $clientCertSource - * A callable which returns the client cert as a string. This can be used to - * provide a certificate and private key to the transport layer for mTLS. - * } - * - * @throws ValidationException - */ - public function __construct(array $options = []) - { - $clientOptions = $this->buildClientOptions($options); - $this->setClientOptions($clientOptions); - $this->operationsClient = $this->createOperationsClient($clientOptions); - } - - /** Handles execution of the async variants for each documented method. */ - public function __call($method, $args) - { - if (substr($method, -5) !== 'Async') { - trigger_error('Call to undefined method ' . __CLASS__ . "::$method()", E_USER_ERROR); - } - - array_unshift($args, substr($method, 0, -5)); - return call_user_func_array([$this, 'startAsyncCall'], $args); - } - - /** - * Cancel jobs running for the task resource. - * - * The async variant is {@see self::cancelJobAsync()} . - * - * @example samples/V1/DataplexServiceClient/cancel_job.php - * - * @param CancelJobRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @throws ApiException Thrown if the API call fails. - */ - public function cancelJob(CancelJobRequest $request, array $callOptions = []): void - { - $this->startApiCall('CancelJob', $request, $callOptions)->wait(); - } - - /** - * Creates an asset resource. - * - * The async variant is {@see self::createAssetAsync()} . - * - * @example samples/V1/DataplexServiceClient/create_asset.php - * - * @param CreateAssetRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return OperationResponse - * - * @throws ApiException Thrown if the API call fails. - */ - public function createAsset(CreateAssetRequest $request, array $callOptions = []): OperationResponse - { - return $this->startApiCall('CreateAsset', $request, $callOptions)->wait(); - } - - /** - * Create an environment resource. - * - * The async variant is {@see self::createEnvironmentAsync()} . - * - * @example samples/V1/DataplexServiceClient/create_environment.php - * - * @param CreateEnvironmentRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return OperationResponse - * - * @throws ApiException Thrown if the API call fails. - */ - public function createEnvironment(CreateEnvironmentRequest $request, array $callOptions = []): OperationResponse - { - return $this->startApiCall('CreateEnvironment', $request, $callOptions)->wait(); - } - - /** - * Creates a lake resource. - * - * The async variant is {@see self::createLakeAsync()} . - * - * @example samples/V1/DataplexServiceClient/create_lake.php - * - * @param CreateLakeRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return OperationResponse - * - * @throws ApiException Thrown if the API call fails. - */ - public function createLake(CreateLakeRequest $request, array $callOptions = []): OperationResponse - { - return $this->startApiCall('CreateLake', $request, $callOptions)->wait(); - } - - /** - * Creates a task resource within a lake. - * - * The async variant is {@see self::createTaskAsync()} . - * - * @example samples/V1/DataplexServiceClient/create_task.php - * - * @param CreateTaskRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return OperationResponse - * - * @throws ApiException Thrown if the API call fails. - */ - public function createTask(CreateTaskRequest $request, array $callOptions = []): OperationResponse - { - return $this->startApiCall('CreateTask', $request, $callOptions)->wait(); - } - - /** - * Creates a zone resource within a lake. - * - * The async variant is {@see self::createZoneAsync()} . - * - * @example samples/V1/DataplexServiceClient/create_zone.php - * - * @param CreateZoneRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return OperationResponse - * - * @throws ApiException Thrown if the API call fails. - */ - public function createZone(CreateZoneRequest $request, array $callOptions = []): OperationResponse - { - return $this->startApiCall('CreateZone', $request, $callOptions)->wait(); - } - - /** - * Deletes an asset resource. The referenced storage resource is detached - * (default) or deleted based on the associated Lifecycle policy. - * - * The async variant is {@see self::deleteAssetAsync()} . - * - * @example samples/V1/DataplexServiceClient/delete_asset.php - * - * @param DeleteAssetRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return OperationResponse - * - * @throws ApiException Thrown if the API call fails. - */ - public function deleteAsset(DeleteAssetRequest $request, array $callOptions = []): OperationResponse - { - return $this->startApiCall('DeleteAsset', $request, $callOptions)->wait(); - } - - /** - * Delete the environment resource. All the child resources must have been - * deleted before environment deletion can be initiated. - * - * The async variant is {@see self::deleteEnvironmentAsync()} . - * - * @example samples/V1/DataplexServiceClient/delete_environment.php - * - * @param DeleteEnvironmentRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return OperationResponse - * - * @throws ApiException Thrown if the API call fails. - */ - public function deleteEnvironment(DeleteEnvironmentRequest $request, array $callOptions = []): OperationResponse - { - return $this->startApiCall('DeleteEnvironment', $request, $callOptions)->wait(); - } - - /** - * Deletes a lake resource. All zones within the lake must be deleted before - * the lake can be deleted. - * - * The async variant is {@see self::deleteLakeAsync()} . - * - * @example samples/V1/DataplexServiceClient/delete_lake.php - * - * @param DeleteLakeRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return OperationResponse - * - * @throws ApiException Thrown if the API call fails. - */ - public function deleteLake(DeleteLakeRequest $request, array $callOptions = []): OperationResponse - { - return $this->startApiCall('DeleteLake', $request, $callOptions)->wait(); - } - - /** - * Delete the task resource. - * - * The async variant is {@see self::deleteTaskAsync()} . - * - * @example samples/V1/DataplexServiceClient/delete_task.php - * - * @param DeleteTaskRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return OperationResponse - * - * @throws ApiException Thrown if the API call fails. - */ - public function deleteTask(DeleteTaskRequest $request, array $callOptions = []): OperationResponse - { - return $this->startApiCall('DeleteTask', $request, $callOptions)->wait(); - } - - /** - * Deletes a zone resource. All assets within a zone must be deleted before - * the zone can be deleted. - * - * The async variant is {@see self::deleteZoneAsync()} . - * - * @example samples/V1/DataplexServiceClient/delete_zone.php - * - * @param DeleteZoneRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return OperationResponse - * - * @throws ApiException Thrown if the API call fails. - */ - public function deleteZone(DeleteZoneRequest $request, array $callOptions = []): OperationResponse - { - return $this->startApiCall('DeleteZone', $request, $callOptions)->wait(); - } - - /** - * Retrieves an asset resource. - * - * The async variant is {@see self::getAssetAsync()} . - * - * @example samples/V1/DataplexServiceClient/get_asset.php - * - * @param GetAssetRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return Asset - * - * @throws ApiException Thrown if the API call fails. - */ - public function getAsset(GetAssetRequest $request, array $callOptions = []): Asset - { - return $this->startApiCall('GetAsset', $request, $callOptions)->wait(); - } - - /** - * Get environment resource. - * - * The async variant is {@see self::getEnvironmentAsync()} . - * - * @example samples/V1/DataplexServiceClient/get_environment.php - * - * @param GetEnvironmentRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return Environment - * - * @throws ApiException Thrown if the API call fails. - */ - public function getEnvironment(GetEnvironmentRequest $request, array $callOptions = []): Environment - { - return $this->startApiCall('GetEnvironment', $request, $callOptions)->wait(); - } - - /** - * Get job resource. - * - * The async variant is {@see self::getJobAsync()} . - * - * @example samples/V1/DataplexServiceClient/get_job.php - * - * @param GetJobRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return Job - * - * @throws ApiException Thrown if the API call fails. - */ - public function getJob(GetJobRequest $request, array $callOptions = []): Job - { - return $this->startApiCall('GetJob', $request, $callOptions)->wait(); - } - - /** - * Retrieves a lake resource. - * - * The async variant is {@see self::getLakeAsync()} . - * - * @example samples/V1/DataplexServiceClient/get_lake.php - * - * @param GetLakeRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return Lake - * - * @throws ApiException Thrown if the API call fails. - */ - public function getLake(GetLakeRequest $request, array $callOptions = []): Lake - { - return $this->startApiCall('GetLake', $request, $callOptions)->wait(); - } - - /** - * Get task resource. - * - * The async variant is {@see self::getTaskAsync()} . - * - * @example samples/V1/DataplexServiceClient/get_task.php - * - * @param GetTaskRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return Task - * - * @throws ApiException Thrown if the API call fails. - */ - public function getTask(GetTaskRequest $request, array $callOptions = []): Task - { - return $this->startApiCall('GetTask', $request, $callOptions)->wait(); - } - - /** - * Retrieves a zone resource. - * - * The async variant is {@see self::getZoneAsync()} . - * - * @example samples/V1/DataplexServiceClient/get_zone.php - * - * @param GetZoneRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return Zone - * - * @throws ApiException Thrown if the API call fails. - */ - public function getZone(GetZoneRequest $request, array $callOptions = []): Zone - { - return $this->startApiCall('GetZone', $request, $callOptions)->wait(); - } - - /** - * Lists action resources in an asset. - * - * The async variant is {@see self::listAssetActionsAsync()} . - * - * @example samples/V1/DataplexServiceClient/list_asset_actions.php - * - * @param ListAssetActionsRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return PagedListResponse - * - * @throws ApiException Thrown if the API call fails. - */ - public function listAssetActions(ListAssetActionsRequest $request, array $callOptions = []): PagedListResponse - { - return $this->startApiCall('ListAssetActions', $request, $callOptions); - } - - /** - * Lists asset resources in a zone. - * - * The async variant is {@see self::listAssetsAsync()} . - * - * @example samples/V1/DataplexServiceClient/list_assets.php - * - * @param ListAssetsRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return PagedListResponse - * - * @throws ApiException Thrown if the API call fails. - */ - public function listAssets(ListAssetsRequest $request, array $callOptions = []): PagedListResponse - { - return $this->startApiCall('ListAssets', $request, $callOptions); - } - - /** - * Lists environments under the given lake. - * - * The async variant is {@see self::listEnvironmentsAsync()} . - * - * @example samples/V1/DataplexServiceClient/list_environments.php - * - * @param ListEnvironmentsRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return PagedListResponse - * - * @throws ApiException Thrown if the API call fails. - */ - public function listEnvironments(ListEnvironmentsRequest $request, array $callOptions = []): PagedListResponse - { - return $this->startApiCall('ListEnvironments', $request, $callOptions); - } - - /** - * Lists Jobs under the given task. - * - * The async variant is {@see self::listJobsAsync()} . - * - * @example samples/V1/DataplexServiceClient/list_jobs.php - * - * @param ListJobsRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return PagedListResponse - * - * @throws ApiException Thrown if the API call fails. - */ - public function listJobs(ListJobsRequest $request, array $callOptions = []): PagedListResponse - { - return $this->startApiCall('ListJobs', $request, $callOptions); - } - - /** - * Lists action resources in a lake. - * - * The async variant is {@see self::listLakeActionsAsync()} . - * - * @example samples/V1/DataplexServiceClient/list_lake_actions.php - * - * @param ListLakeActionsRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return PagedListResponse - * - * @throws ApiException Thrown if the API call fails. - */ - public function listLakeActions(ListLakeActionsRequest $request, array $callOptions = []): PagedListResponse - { - return $this->startApiCall('ListLakeActions', $request, $callOptions); - } - - /** - * Lists lake resources in a project and location. - * - * The async variant is {@see self::listLakesAsync()} . - * - * @example samples/V1/DataplexServiceClient/list_lakes.php - * - * @param ListLakesRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return PagedListResponse - * - * @throws ApiException Thrown if the API call fails. - */ - public function listLakes(ListLakesRequest $request, array $callOptions = []): PagedListResponse - { - return $this->startApiCall('ListLakes', $request, $callOptions); - } - - /** - * Lists session resources in an environment. - * - * The async variant is {@see self::listSessionsAsync()} . - * - * @example samples/V1/DataplexServiceClient/list_sessions.php - * - * @param ListSessionsRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return PagedListResponse - * - * @throws ApiException Thrown if the API call fails. - */ - public function listSessions(ListSessionsRequest $request, array $callOptions = []): PagedListResponse - { - return $this->startApiCall('ListSessions', $request, $callOptions); - } - - /** - * Lists tasks under the given lake. - * - * The async variant is {@see self::listTasksAsync()} . - * - * @example samples/V1/DataplexServiceClient/list_tasks.php - * - * @param ListTasksRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return PagedListResponse - * - * @throws ApiException Thrown if the API call fails. - */ - public function listTasks(ListTasksRequest $request, array $callOptions = []): PagedListResponse - { - return $this->startApiCall('ListTasks', $request, $callOptions); - } - - /** - * Lists action resources in a zone. - * - * The async variant is {@see self::listZoneActionsAsync()} . - * - * @example samples/V1/DataplexServiceClient/list_zone_actions.php - * - * @param ListZoneActionsRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return PagedListResponse - * - * @throws ApiException Thrown if the API call fails. - */ - public function listZoneActions(ListZoneActionsRequest $request, array $callOptions = []): PagedListResponse - { - return $this->startApiCall('ListZoneActions', $request, $callOptions); - } - - /** - * Lists zone resources in a lake. - * - * The async variant is {@see self::listZonesAsync()} . - * - * @example samples/V1/DataplexServiceClient/list_zones.php - * - * @param ListZonesRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return PagedListResponse - * - * @throws ApiException Thrown if the API call fails. - */ - public function listZones(ListZonesRequest $request, array $callOptions = []): PagedListResponse - { - return $this->startApiCall('ListZones', $request, $callOptions); - } - - /** - * Run an on demand execution of a Task. - * - * The async variant is {@see self::runTaskAsync()} . - * - * @example samples/V1/DataplexServiceClient/run_task.php - * - * @param RunTaskRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return RunTaskResponse - * - * @throws ApiException Thrown if the API call fails. - */ - public function runTask(RunTaskRequest $request, array $callOptions = []): RunTaskResponse - { - return $this->startApiCall('RunTask', $request, $callOptions)->wait(); - } - - /** - * Updates an asset resource. - * - * The async variant is {@see self::updateAssetAsync()} . - * - * @example samples/V1/DataplexServiceClient/update_asset.php - * - * @param UpdateAssetRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return OperationResponse - * - * @throws ApiException Thrown if the API call fails. - */ - public function updateAsset(UpdateAssetRequest $request, array $callOptions = []): OperationResponse - { - return $this->startApiCall('UpdateAsset', $request, $callOptions)->wait(); - } - - /** - * Update the environment resource. - * - * The async variant is {@see self::updateEnvironmentAsync()} . - * - * @example samples/V1/DataplexServiceClient/update_environment.php - * - * @param UpdateEnvironmentRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return OperationResponse - * - * @throws ApiException Thrown if the API call fails. - */ - public function updateEnvironment(UpdateEnvironmentRequest $request, array $callOptions = []): OperationResponse - { - return $this->startApiCall('UpdateEnvironment', $request, $callOptions)->wait(); - } - - /** - * Updates a lake resource. - * - * The async variant is {@see self::updateLakeAsync()} . - * - * @example samples/V1/DataplexServiceClient/update_lake.php - * - * @param UpdateLakeRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return OperationResponse - * - * @throws ApiException Thrown if the API call fails. - */ - public function updateLake(UpdateLakeRequest $request, array $callOptions = []): OperationResponse - { - return $this->startApiCall('UpdateLake', $request, $callOptions)->wait(); - } - - /** - * Update the task resource. - * - * The async variant is {@see self::updateTaskAsync()} . - * - * @example samples/V1/DataplexServiceClient/update_task.php - * - * @param UpdateTaskRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return OperationResponse - * - * @throws ApiException Thrown if the API call fails. - */ - public function updateTask(UpdateTaskRequest $request, array $callOptions = []): OperationResponse - { - return $this->startApiCall('UpdateTask', $request, $callOptions)->wait(); - } - - /** - * Updates a zone resource. - * - * The async variant is {@see self::updateZoneAsync()} . - * - * @example samples/V1/DataplexServiceClient/update_zone.php - * - * @param UpdateZoneRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return OperationResponse - * - * @throws ApiException Thrown if the API call fails. - */ - public function updateZone(UpdateZoneRequest $request, array $callOptions = []): OperationResponse - { - return $this->startApiCall('UpdateZone', $request, $callOptions)->wait(); - } - - /** - * Gets the access control policy for a resource. Returns an empty policy - if the resource exists and does not have a policy set. - * - * The async variant is {@see self::getIamPolicyAsync()} . - * - * @example samples/V1/DataplexServiceClient/get_iam_policy.php - * - * @param GetIamPolicyRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return Policy - * - * @throws ApiException Thrown if the API call fails. - */ - public function getIamPolicy(GetIamPolicyRequest $request, array $callOptions = []): Policy - { - return $this->startApiCall('GetIamPolicy', $request, $callOptions)->wait(); - } - - /** - * Sets the access control policy on the specified resource. Replaces - any existing policy. - - Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` - errors. - * - * The async variant is {@see self::setIamPolicyAsync()} . - * - * @example samples/V1/DataplexServiceClient/set_iam_policy.php - * - * @param SetIamPolicyRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return Policy - * - * @throws ApiException Thrown if the API call fails. - */ - public function setIamPolicy(SetIamPolicyRequest $request, array $callOptions = []): Policy - { - return $this->startApiCall('SetIamPolicy', $request, $callOptions)->wait(); - } - - /** - * Returns permissions that a caller has on the specified resource. If the - resource does not exist, this will return an empty set of - permissions, not a `NOT_FOUND` error. - - Note: This operation is designed to be used for building - permission-aware UIs and command-line tools, not for authorization - checking. This operation may "fail open" without warning. - * - * The async variant is {@see self::testIamPermissionsAsync()} . - * - * @example samples/V1/DataplexServiceClient/test_iam_permissions.php - * - * @param TestIamPermissionsRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return TestIamPermissionsResponse - * - * @throws ApiException Thrown if the API call fails. - */ - public function testIamPermissions(TestIamPermissionsRequest $request, array $callOptions = []): TestIamPermissionsResponse - { - return $this->startApiCall('TestIamPermissions', $request, $callOptions)->wait(); - } - - /** - * Gets information about a location. - * - * The async variant is {@see self::getLocationAsync()} . - * - * @example samples/V1/DataplexServiceClient/get_location.php - * - * @param GetLocationRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return Location - * - * @throws ApiException Thrown if the API call fails. - */ - public function getLocation(GetLocationRequest $request, array $callOptions = []): Location - { - return $this->startApiCall('GetLocation', $request, $callOptions)->wait(); - } - - /** - * Lists information about the supported locations for this service. - * - * The async variant is {@see self::listLocationsAsync()} . - * - * @example samples/V1/DataplexServiceClient/list_locations.php - * - * @param ListLocationsRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return PagedListResponse - * - * @throws ApiException Thrown if the API call fails. - */ - public function listLocations(ListLocationsRequest $request, array $callOptions = []): PagedListResponse - { - return $this->startApiCall('ListLocations', $request, $callOptions); - } -} diff --git a/Dataplex/src/V1/Client/BaseClient/MetadataServiceBaseClient.php b/Dataplex/src/V1/Client/BaseClient/MetadataServiceBaseClient.php deleted file mode 100644 index 27ab01a8e83c..000000000000 --- a/Dataplex/src/V1/Client/BaseClient/MetadataServiceBaseClient.php +++ /dev/null @@ -1,668 +0,0 @@ - self::SERVICE_NAME, - 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => __DIR__ . '/../../resources/metadata_service_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../../resources/metadata_service_descriptor_config.php', - 'gcpApiConfigPath' => __DIR__ . '/../../resources/metadata_service_grpc_config.json', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../../resources/metadata_service_rest_client_config.php', - ], - ], - ]; - } - - /** - * Formats a string containing the fully-qualified path to represent a entity - * resource. - * - * @param string $project - * @param string $location - * @param string $lake - * @param string $zone - * @param string $entity - * - * @return string The formatted entity resource. - */ - public static function entityName(string $project, string $location, string $lake, string $zone, string $entity): string - { - return self::getPathTemplate('entity')->render([ - 'project' => $project, - 'location' => $location, - 'lake' => $lake, - 'zone' => $zone, - 'entity' => $entity, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a partition - * resource. - * - * @param string $project - * @param string $location - * @param string $lake - * @param string $zone - * @param string $entity - * @param string $partition - * - * @return string The formatted partition resource. - */ - public static function partitionName(string $project, string $location, string $lake, string $zone, string $entity, string $partition): string - { - return self::getPathTemplate('partition')->render([ - 'project' => $project, - 'location' => $location, - 'lake' => $lake, - 'zone' => $zone, - 'entity' => $entity, - 'partition' => $partition, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a zone - * resource. - * - * @param string $project - * @param string $location - * @param string $lake - * @param string $zone - * - * @return string The formatted zone resource. - */ - public static function zoneName(string $project, string $location, string $lake, string $zone): string - { - return self::getPathTemplate('zone')->render([ - 'project' => $project, - 'location' => $location, - 'lake' => $lake, - 'zone' => $zone, - ]); - } - - /** - * Parses a formatted name string and returns an associative array of the components in the name. - * The following name formats are supported: - * Template: Pattern - * - entity: projects/{project}/locations/{location}/lakes/{lake}/zones/{zone}/entities/{entity} - * - partition: projects/{project}/locations/{location}/lakes/{lake}/zones/{zone}/entities/{entity}/partitions/{partition} - * - zone: projects/{project}/locations/{location}/lakes/{lake}/zones/{zone} - * - * 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 $template argument does not match one of the templates - * listed, then parseName will check each of the supported templates, and return - * the first match. - * - * @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. - * - * @throws ValidationException If $formattedName could not be matched. - */ - public static function parseName(string $formattedName, string $template = null): array - { - return self::parseFormattedName($formattedName, $template); - } - - /** - * Constructor. - * - * @param array $options { - * Optional. Options for configuring the service API wrapper. - * - * @type string $apiEndpoint - * The address of the API remote host. May optionally include the port, formatted - * as ":". Default 'dataplex.googleapis.com:443'. - * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials - * The credentials to be used by the client to authorize API calls. This option - * accepts either a path to a credentials file, or a decoded credentials file as a - * PHP array. - * *Advanced usage*: In addition, this option can also accept a pre-constructed - * {@see \Google\Auth\FetchAuthTokenInterface} object or - * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these - * objects are provided, any settings in $credentialsConfig will be ignored. - * @type array $credentialsConfig - * Options used to configure credentials, including auth token caching, for the - * client. For a full list of supporting configuration options, see - * {@see \Google\ApiCore\CredentialsWrapper::build()} . - * @type bool $disableRetries - * Determines whether or not retries defined by the client configuration should be - * disabled. Defaults to `false`. - * @type string|array $clientConfig - * Client method configuration, including retry settings. This option can be either - * a path to a JSON file, or a PHP array containing the decoded JSON data. By - * default this settings points to the default client config file, which is - * provided in the resources folder. - * @type string|TransportInterface $transport - * The transport used for executing network requests. May be either the string - * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. - * *Advanced usage*: Additionally, it is possible to pass in an already - * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note - * that when this object is provided, any settings in $transportConfig, and any - * $apiEndpoint setting, will be ignored. - * @type array $transportConfig - * Configuration options that will be used to construct the transport. Options for - * each supported transport type should be passed in a key for that transport. For - * example: - * $transportConfig = [ - * 'grpc' => [...], - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and - * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the - * supported options. - * @type callable $clientCertSource - * A callable which returns the client cert as a string. This can be used to - * provide a certificate and private key to the transport layer for mTLS. - * } - * - * @throws ValidationException - */ - public function __construct(array $options = []) - { - $clientOptions = $this->buildClientOptions($options); - $this->setClientOptions($clientOptions); - } - - /** Handles execution of the async variants for each documented method. */ - public function __call($method, $args) - { - if (substr($method, -5) !== 'Async') { - trigger_error('Call to undefined method ' . __CLASS__ . "::$method()", E_USER_ERROR); - } - - array_unshift($args, substr($method, 0, -5)); - return call_user_func_array([$this, 'startAsyncCall'], $args); - } - - /** - * Create a metadata entity. - * - * The async variant is {@see self::createEntityAsync()} . - * - * @example samples/V1/MetadataServiceClient/create_entity.php - * - * @param CreateEntityRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return Entity - * - * @throws ApiException Thrown if the API call fails. - */ - public function createEntity(CreateEntityRequest $request, array $callOptions = []): Entity - { - return $this->startApiCall('CreateEntity', $request, $callOptions)->wait(); - } - - /** - * Create a metadata partition. - * - * The async variant is {@see self::createPartitionAsync()} . - * - * @example samples/V1/MetadataServiceClient/create_partition.php - * - * @param CreatePartitionRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return Partition - * - * @throws ApiException Thrown if the API call fails. - */ - public function createPartition(CreatePartitionRequest $request, array $callOptions = []): Partition - { - return $this->startApiCall('CreatePartition', $request, $callOptions)->wait(); - } - - /** - * Delete a metadata entity. - * - * The async variant is {@see self::deleteEntityAsync()} . - * - * @example samples/V1/MetadataServiceClient/delete_entity.php - * - * @param DeleteEntityRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @throws ApiException Thrown if the API call fails. - */ - public function deleteEntity(DeleteEntityRequest $request, array $callOptions = []): void - { - $this->startApiCall('DeleteEntity', $request, $callOptions)->wait(); - } - - /** - * Delete a metadata partition. - * - * The async variant is {@see self::deletePartitionAsync()} . - * - * @example samples/V1/MetadataServiceClient/delete_partition.php - * - * @param DeletePartitionRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @throws ApiException Thrown if the API call fails. - */ - public function deletePartition(DeletePartitionRequest $request, array $callOptions = []): void - { - $this->startApiCall('DeletePartition', $request, $callOptions)->wait(); - } - - /** - * Get a metadata entity. - * - * The async variant is {@see self::getEntityAsync()} . - * - * @example samples/V1/MetadataServiceClient/get_entity.php - * - * @param GetEntityRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return Entity - * - * @throws ApiException Thrown if the API call fails. - */ - public function getEntity(GetEntityRequest $request, array $callOptions = []): Entity - { - return $this->startApiCall('GetEntity', $request, $callOptions)->wait(); - } - - /** - * Get a metadata partition of an entity. - * - * The async variant is {@see self::getPartitionAsync()} . - * - * @example samples/V1/MetadataServiceClient/get_partition.php - * - * @param GetPartitionRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return Partition - * - * @throws ApiException Thrown if the API call fails. - */ - public function getPartition(GetPartitionRequest $request, array $callOptions = []): Partition - { - return $this->startApiCall('GetPartition', $request, $callOptions)->wait(); - } - - /** - * List metadata entities in a zone. - * - * The async variant is {@see self::listEntitiesAsync()} . - * - * @example samples/V1/MetadataServiceClient/list_entities.php - * - * @param ListEntitiesRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return PagedListResponse - * - * @throws ApiException Thrown if the API call fails. - */ - public function listEntities(ListEntitiesRequest $request, array $callOptions = []): PagedListResponse - { - return $this->startApiCall('ListEntities', $request, $callOptions); - } - - /** - * List metadata partitions of an entity. - * - * The async variant is {@see self::listPartitionsAsync()} . - * - * @example samples/V1/MetadataServiceClient/list_partitions.php - * - * @param ListPartitionsRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return PagedListResponse - * - * @throws ApiException Thrown if the API call fails. - */ - public function listPartitions(ListPartitionsRequest $request, array $callOptions = []): PagedListResponse - { - return $this->startApiCall('ListPartitions', $request, $callOptions); - } - - /** - * Update a metadata entity. Only supports full resource update. - * - * The async variant is {@see self::updateEntityAsync()} . - * - * @example samples/V1/MetadataServiceClient/update_entity.php - * - * @param UpdateEntityRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return Entity - * - * @throws ApiException Thrown if the API call fails. - */ - public function updateEntity(UpdateEntityRequest $request, array $callOptions = []): Entity - { - return $this->startApiCall('UpdateEntity', $request, $callOptions)->wait(); - } - - /** - * Gets the access control policy for a resource. Returns an empty policy - if the resource exists and does not have a policy set. - * - * The async variant is {@see self::getIamPolicyAsync()} . - * - * @example samples/V1/MetadataServiceClient/get_iam_policy.php - * - * @param GetIamPolicyRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return Policy - * - * @throws ApiException Thrown if the API call fails. - */ - public function getIamPolicy(GetIamPolicyRequest $request, array $callOptions = []): Policy - { - return $this->startApiCall('GetIamPolicy', $request, $callOptions)->wait(); - } - - /** - * Sets the access control policy on the specified resource. Replaces - any existing policy. - - Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` - errors. - * - * The async variant is {@see self::setIamPolicyAsync()} . - * - * @example samples/V1/MetadataServiceClient/set_iam_policy.php - * - * @param SetIamPolicyRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return Policy - * - * @throws ApiException Thrown if the API call fails. - */ - public function setIamPolicy(SetIamPolicyRequest $request, array $callOptions = []): Policy - { - return $this->startApiCall('SetIamPolicy', $request, $callOptions)->wait(); - } - - /** - * Returns permissions that a caller has on the specified resource. If the - resource does not exist, this will return an empty set of - permissions, not a `NOT_FOUND` error. - - Note: This operation is designed to be used for building - permission-aware UIs and command-line tools, not for authorization - checking. This operation may "fail open" without warning. - * - * The async variant is {@see self::testIamPermissionsAsync()} . - * - * @example samples/V1/MetadataServiceClient/test_iam_permissions.php - * - * @param TestIamPermissionsRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return TestIamPermissionsResponse - * - * @throws ApiException Thrown if the API call fails. - */ - public function testIamPermissions(TestIamPermissionsRequest $request, array $callOptions = []): TestIamPermissionsResponse - { - return $this->startApiCall('TestIamPermissions', $request, $callOptions)->wait(); - } - - /** - * Gets information about a location. - * - * The async variant is {@see self::getLocationAsync()} . - * - * @example samples/V1/MetadataServiceClient/get_location.php - * - * @param GetLocationRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return Location - * - * @throws ApiException Thrown if the API call fails. - */ - public function getLocation(GetLocationRequest $request, array $callOptions = []): Location - { - return $this->startApiCall('GetLocation', $request, $callOptions)->wait(); - } - - /** - * Lists information about the supported locations for this service. - * - * The async variant is {@see self::listLocationsAsync()} . - * - * @example samples/V1/MetadataServiceClient/list_locations.php - * - * @param ListLocationsRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return PagedListResponse - * - * @throws ApiException Thrown if the API call fails. - */ - public function listLocations(ListLocationsRequest $request, array $callOptions = []): PagedListResponse - { - return $this->startApiCall('ListLocations', $request, $callOptions); - } -} diff --git a/Dataplex/src/V1/Client/ContentServiceClient.php b/Dataplex/src/V1/Client/ContentServiceClient.php index 6163761dc617..fce64db8c840 100644 --- a/Dataplex/src/V1/Client/ContentServiceClient.php +++ b/Dataplex/src/V1/Client/ContentServiceClient.php @@ -24,17 +24,509 @@ namespace Google\Cloud\Dataplex\V1\Client; -use Google\Cloud\Dataplex\V1\Client\BaseClient\ContentServiceBaseClient; +use Google\ApiCore\ApiException; +use Google\ApiCore\CredentialsWrapper; +use Google\ApiCore\GapicClientTrait; +use Google\ApiCore\PagedListResponse; +use Google\ApiCore\ResourceHelperTrait; +use Google\ApiCore\RetrySettings; +use Google\ApiCore\Transport\TransportInterface; +use Google\ApiCore\ValidationException; +use Google\Auth\FetchAuthTokenInterface; +use Google\Cloud\Dataplex\V1\Content; +use Google\Cloud\Dataplex\V1\CreateContentRequest; +use Google\Cloud\Dataplex\V1\DeleteContentRequest; +use Google\Cloud\Dataplex\V1\GetContentRequest; +use Google\Cloud\Dataplex\V1\ListContentRequest; +use Google\Cloud\Dataplex\V1\UpdateContentRequest; +use Google\Cloud\Iam\V1\GetIamPolicyRequest; +use Google\Cloud\Iam\V1\Policy; +use Google\Cloud\Iam\V1\SetIamPolicyRequest; +use Google\Cloud\Iam\V1\TestIamPermissionsRequest; +use Google\Cloud\Iam\V1\TestIamPermissionsResponse; +use Google\Cloud\Location\GetLocationRequest; +use Google\Cloud\Location\ListLocationsRequest; +use Google\Cloud\Location\Location; +use GuzzleHttp\Promise\PromiseInterface; /** - * {@inheritdoc} + * Service Description: ContentService manages Notebook and SQL Scripts for Dataplex. * - * This class is currently experimental and may be subject to changes. + * This class provides the ability to make remote calls to the backing service through method + * calls that map to API methods. + * + * Many parameters require resource names to be formatted in a particular way. To + * assist with these names, this class includes a format method for each type of + * name, and additionally a parseName method to extract the individual identifiers + * contained within formatted names that are returned by the API. + * + * This class is currently experimental and may be subject to changes. See {@see + * \Google\Cloud\Dataplex\V1\ContentServiceClient} for the stable implementation * * @experimental + * + * @method PromiseInterface createContentAsync(CreateContentRequest $request, array $optionalArgs = []) + * @method PromiseInterface deleteContentAsync(DeleteContentRequest $request, array $optionalArgs = []) + * @method PromiseInterface getContentAsync(GetContentRequest $request, array $optionalArgs = []) + * @method PromiseInterface getIamPolicyAsync(GetIamPolicyRequest $request, array $optionalArgs = []) + * @method PromiseInterface listContentAsync(ListContentRequest $request, array $optionalArgs = []) + * @method PromiseInterface setIamPolicyAsync(SetIamPolicyRequest $request, array $optionalArgs = []) + * @method PromiseInterface testIamPermissionsAsync(TestIamPermissionsRequest $request, array $optionalArgs = []) + * @method PromiseInterface updateContentAsync(UpdateContentRequest $request, array $optionalArgs = []) + * @method PromiseInterface getLocationAsync(GetLocationRequest $request, array $optionalArgs = []) + * @method PromiseInterface listLocationsAsync(ListLocationsRequest $request, array $optionalArgs = []) */ -final class ContentServiceClient extends ContentServiceBaseClient +final class ContentServiceClient { - // This class is intentionally empty, and is intended to hold manual additions to - // the generated {@see ContentServiceBaseClient} class. + use GapicClientTrait; + use ResourceHelperTrait; + + /** The name of the service. */ + private const SERVICE_NAME = 'google.cloud.dataplex.v1.ContentService'; + + /** The default address of the service. */ + private const SERVICE_ADDRESS = 'dataplex.googleapis.com'; + + /** The default port of the service. */ + private const DEFAULT_SERVICE_PORT = 443; + + /** The name of the code generator, to be included in the agent header. */ + private const CODEGEN_NAME = 'gapic'; + + /** The default scopes required by the service. */ + public static $serviceScopes = [ + 'https://www.googleapis.com/auth/cloud-platform', + ]; + + private static function getClientDefaults() + { + return [ + 'serviceName' => self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/content_service_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/content_service_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/content_service_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/content_service_rest_client_config.php', + ], + ], + ]; + } + + /** + * Formats a string containing the fully-qualified path to represent a content + * resource. + * + * @param string $project + * @param string $location + * @param string $lake + * @param string $content + * + * @return string The formatted content resource. + */ + public static function contentName(string $project, string $location, string $lake, string $content): string + { + return self::getPathTemplate('content')->render([ + 'project' => $project, + 'location' => $location, + 'lake' => $lake, + 'content' => $content, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a lake + * resource. + * + * @param string $project + * @param string $location + * @param string $lake + * + * @return string The formatted lake resource. + */ + public static function lakeName(string $project, string $location, string $lake): string + { + return self::getPathTemplate('lake')->render([ + 'project' => $project, + 'location' => $location, + 'lake' => $lake, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - content: projects/{project}/locations/{location}/lakes/{lake}/content/{content} + * - lake: projects/{project}/locations/{location}/lakes/{lake} + * + * 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 $template argument does not match one of the templates + * listed, then parseName will check each of the supported templates, and return + * the first match. + * + * @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. + * + * @throws ValidationException If $formattedName could not be matched. + */ + public static function parseName(string $formattedName, string $template = null): array + { + return self::parseFormattedName($formattedName, $template); + } + + /** + * Constructor. + * + * @param array $options { + * Optional. Options for configuring the service API wrapper. + * + * @type string $apiEndpoint + * The address of the API remote host. May optionally include the port, formatted + * as ":". Default 'dataplex.googleapis.com:443'. + * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials + * The credentials to be used by the client to authorize API calls. This option + * accepts either a path to a credentials file, or a decoded credentials file as a + * PHP array. + * *Advanced usage*: In addition, this option can also accept a pre-constructed + * {@see \Google\Auth\FetchAuthTokenInterface} object or + * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these + * objects are provided, any settings in $credentialsConfig will be ignored. + * @type array $credentialsConfig + * Options used to configure credentials, including auth token caching, for the + * client. For a full list of supporting configuration options, see + * {@see \Google\ApiCore\CredentialsWrapper::build()} . + * @type bool $disableRetries + * Determines whether or not retries defined by the client configuration should be + * disabled. Defaults to `false`. + * @type string|array $clientConfig + * Client method configuration, including retry settings. This option can be either + * a path to a JSON file, or a PHP array containing the decoded JSON data. By + * default this settings points to the default client config file, which is + * provided in the resources folder. + * @type string|TransportInterface $transport + * The transport used for executing network requests. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *Advanced usage*: Additionally, it is possible to pass in an already + * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note + * that when this object is provided, any settings in $transportConfig, and any + * $apiEndpoint setting, will be ignored. + * @type array $transportConfig + * Configuration options that will be used to construct the transport. Options for + * each supported transport type should be passed in a key for that transport. For + * example: + * $transportConfig = [ + * 'grpc' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the + * supported options. + * @type callable $clientCertSource + * A callable which returns the client cert as a string. This can be used to + * provide a certificate and private key to the transport layer for mTLS. + * } + * + * @throws ValidationException + */ + public function __construct(array $options = []) + { + $clientOptions = $this->buildClientOptions($options); + $this->setClientOptions($clientOptions); + } + + /** Handles execution of the async variants for each documented method. */ + public function __call($method, $args) + { + if (substr($method, -5) !== 'Async') { + trigger_error('Call to undefined method ' . __CLASS__ . "::$method()", E_USER_ERROR); + } + + array_unshift($args, substr($method, 0, -5)); + return call_user_func_array([$this, 'startAsyncCall'], $args); + } + + /** + * Create a content. + * + * The async variant is {@see ContentServiceGapicClient::createContentAsync()} . + * + * @example samples/V1/ContentServiceClient/create_content.php + * + * @param CreateContentRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Content + * + * @throws ApiException Thrown if the API call fails. + */ + public function createContent(CreateContentRequest $request, array $callOptions = []): Content + { + return $this->startApiCall('CreateContent', $request, $callOptions)->wait(); + } + + /** + * Delete a content. + * + * The async variant is {@see ContentServiceGapicClient::deleteContentAsync()} . + * + * @example samples/V1/ContentServiceClient/delete_content.php + * + * @param DeleteContentRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @throws ApiException Thrown if the API call fails. + */ + public function deleteContent(DeleteContentRequest $request, array $callOptions = []): void + { + $this->startApiCall('DeleteContent', $request, $callOptions)->wait(); + } + + /** + * Get a content resource. + * + * The async variant is {@see ContentServiceGapicClient::getContentAsync()} . + * + * @example samples/V1/ContentServiceClient/get_content.php + * + * @param GetContentRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Content + * + * @throws ApiException Thrown if the API call fails. + */ + public function getContent(GetContentRequest $request, array $callOptions = []): Content + { + return $this->startApiCall('GetContent', $request, $callOptions)->wait(); + } + + /** + * Gets the access control policy for a contentitem resource. A `NOT_FOUND` + * error is returned if the resource does not exist. An empty policy is + * returned if the resource exists but does not have a policy set on it. + * + * Caller must have Google IAM `dataplex.content.getIamPolicy` permission + * on the resource. + * + * The async variant is {@see ContentServiceGapicClient::getIamPolicyAsync()} . + * + * @example samples/V1/ContentServiceClient/get_iam_policy.php + * + * @param GetIamPolicyRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Policy + * + * @throws ApiException Thrown if the API call fails. + */ + public function getIamPolicy(GetIamPolicyRequest $request, array $callOptions = []): Policy + { + return $this->startApiCall('GetIamPolicy', $request, $callOptions)->wait(); + } + + /** + * List content. + * + * The async variant is {@see ContentServiceGapicClient::listContentAsync()} . + * + * @example samples/V1/ContentServiceClient/list_content.php + * + * @param ListContentRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listContent(ListContentRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListContent', $request, $callOptions); + } + + /** + * Sets the access control policy on the specified contentitem resource. + * Replaces any existing policy. + * + * Caller must have Google IAM `dataplex.content.setIamPolicy` permission + * on the resource. + * + * The async variant is {@see ContentServiceGapicClient::setIamPolicyAsync()} . + * + * @example samples/V1/ContentServiceClient/set_iam_policy.php + * + * @param SetIamPolicyRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Policy + * + * @throws ApiException Thrown if the API call fails. + */ + public function setIamPolicy(SetIamPolicyRequest $request, array $callOptions = []): Policy + { + return $this->startApiCall('SetIamPolicy', $request, $callOptions)->wait(); + } + + /** + * Returns the caller's permissions on a resource. + * If the resource does not exist, an empty set of + * permissions is returned (a `NOT_FOUND` error is not returned). + * + * A caller is not required to have Google IAM permission to make this + * request. + * + * Note: This operation is designed to be used for building permission-aware + * UIs and command-line tools, not for authorization checking. This operation + * may "fail open" without warning. + * + * The async variant is {@see ContentServiceGapicClient::testIamPermissionsAsync()} + * . + * + * @example samples/V1/ContentServiceClient/test_iam_permissions.php + * + * @param TestIamPermissionsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return TestIamPermissionsResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function testIamPermissions(TestIamPermissionsRequest $request, array $callOptions = []): TestIamPermissionsResponse + { + return $this->startApiCall('TestIamPermissions', $request, $callOptions)->wait(); + } + + /** + * Update a content. Only supports full resource update. + * + * The async variant is {@see ContentServiceGapicClient::updateContentAsync()} . + * + * @example samples/V1/ContentServiceClient/update_content.php + * + * @param UpdateContentRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Content + * + * @throws ApiException Thrown if the API call fails. + */ + public function updateContent(UpdateContentRequest $request, array $callOptions = []): Content + { + return $this->startApiCall('UpdateContent', $request, $callOptions)->wait(); + } + + /** + * Gets information about a location. + * + * The async variant is {@see ContentServiceGapicClient::getLocationAsync()} . + * + * @example samples/V1/ContentServiceClient/get_location.php + * + * @param GetLocationRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Location + * + * @throws ApiException Thrown if the API call fails. + */ + public function getLocation(GetLocationRequest $request, array $callOptions = []): Location + { + return $this->startApiCall('GetLocation', $request, $callOptions)->wait(); + } + + /** + * Lists information about the supported locations for this service. + * + * The async variant is {@see ContentServiceGapicClient::listLocationsAsync()} . + * + * @example samples/V1/ContentServiceClient/list_locations.php + * + * @param ListLocationsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listLocations(ListLocationsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListLocations', $request, $callOptions); + } } diff --git a/Dataplex/src/V1/Client/DataScanServiceClient.php b/Dataplex/src/V1/Client/DataScanServiceClient.php index 66ecac34f1e0..ec8546dfef25 100644 --- a/Dataplex/src/V1/Client/DataScanServiceClient.php +++ b/Dataplex/src/V1/Client/DataScanServiceClient.php @@ -24,17 +24,670 @@ namespace Google\Cloud\Dataplex\V1\Client; -use Google\Cloud\Dataplex\V1\Client\BaseClient\DataScanServiceBaseClient; +use Google\ApiCore\ApiException; +use Google\ApiCore\CredentialsWrapper; +use Google\ApiCore\GapicClientTrait; +use Google\ApiCore\LongRunning\OperationsClient; +use Google\ApiCore\OperationResponse; +use Google\ApiCore\PagedListResponse; +use Google\ApiCore\ResourceHelperTrait; +use Google\ApiCore\RetrySettings; +use Google\ApiCore\Transport\TransportInterface; +use Google\ApiCore\ValidationException; +use Google\Auth\FetchAuthTokenInterface; +use Google\Cloud\Dataplex\V1\CreateDataScanRequest; +use Google\Cloud\Dataplex\V1\DataScan; +use Google\Cloud\Dataplex\V1\DataScanJob; +use Google\Cloud\Dataplex\V1\DeleteDataScanRequest; +use Google\Cloud\Dataplex\V1\GetDataScanJobRequest; +use Google\Cloud\Dataplex\V1\GetDataScanRequest; +use Google\Cloud\Dataplex\V1\ListDataScanJobsRequest; +use Google\Cloud\Dataplex\V1\ListDataScansRequest; +use Google\Cloud\Dataplex\V1\RunDataScanRequest; +use Google\Cloud\Dataplex\V1\RunDataScanResponse; +use Google\Cloud\Dataplex\V1\UpdateDataScanRequest; +use Google\Cloud\Iam\V1\GetIamPolicyRequest; +use Google\Cloud\Iam\V1\Policy; +use Google\Cloud\Iam\V1\SetIamPolicyRequest; +use Google\Cloud\Iam\V1\TestIamPermissionsRequest; +use Google\Cloud\Iam\V1\TestIamPermissionsResponse; +use Google\Cloud\Location\GetLocationRequest; +use Google\Cloud\Location\ListLocationsRequest; +use Google\Cloud\Location\Location; +use Google\LongRunning\Operation; +use GuzzleHttp\Promise\PromiseInterface; /** - * {@inheritdoc} + * Service Description: DataScanService manages DataScan resources which can be configured to run + * various types of data scanning workload and generate enriched metadata (e.g. + * Data Profile, Data Quality) for the data source. * - * This class is currently experimental and may be subject to changes. + * This class provides the ability to make remote calls to the backing service through method + * calls that map to API methods. + * + * Many parameters require resource names to be formatted in a particular way. To + * assist with these names, this class includes a format method for each type of + * name, and additionally a parseName method to extract the individual identifiers + * contained within formatted names that are returned by the API. + * + * This class is currently experimental and may be subject to changes. See {@see + * \Google\Cloud\Dataplex\V1\DataScanServiceClient} for the stable implementation * * @experimental + * + * @method PromiseInterface createDataScanAsync(CreateDataScanRequest $request, array $optionalArgs = []) + * @method PromiseInterface deleteDataScanAsync(DeleteDataScanRequest $request, array $optionalArgs = []) + * @method PromiseInterface getDataScanAsync(GetDataScanRequest $request, array $optionalArgs = []) + * @method PromiseInterface getDataScanJobAsync(GetDataScanJobRequest $request, array $optionalArgs = []) + * @method PromiseInterface listDataScanJobsAsync(ListDataScanJobsRequest $request, array $optionalArgs = []) + * @method PromiseInterface listDataScansAsync(ListDataScansRequest $request, array $optionalArgs = []) + * @method PromiseInterface runDataScanAsync(RunDataScanRequest $request, array $optionalArgs = []) + * @method PromiseInterface updateDataScanAsync(UpdateDataScanRequest $request, array $optionalArgs = []) + * @method PromiseInterface getIamPolicyAsync(GetIamPolicyRequest $request, array $optionalArgs = []) + * @method PromiseInterface setIamPolicyAsync(SetIamPolicyRequest $request, array $optionalArgs = []) + * @method PromiseInterface testIamPermissionsAsync(TestIamPermissionsRequest $request, array $optionalArgs = []) + * @method PromiseInterface getLocationAsync(GetLocationRequest $request, array $optionalArgs = []) + * @method PromiseInterface listLocationsAsync(ListLocationsRequest $request, array $optionalArgs = []) */ -final class DataScanServiceClient extends DataScanServiceBaseClient +final class DataScanServiceClient { - // This class is intentionally empty, and is intended to hold manual additions to - // the generated {@see DataScanServiceBaseClient} class. + use GapicClientTrait; + use ResourceHelperTrait; + + /** The name of the service. */ + private const SERVICE_NAME = 'google.cloud.dataplex.v1.DataScanService'; + + /** The default address of the service. */ + private const SERVICE_ADDRESS = 'dataplex.googleapis.com'; + + /** The default port of the service. */ + private const DEFAULT_SERVICE_PORT = 443; + + /** The name of the code generator, to be included in the agent header. */ + private const CODEGEN_NAME = 'gapic'; + + /** The default scopes required by the service. */ + public static $serviceScopes = [ + 'https://www.googleapis.com/auth/cloud-platform', + ]; + + private $operationsClient; + + private static function getClientDefaults() + { + return [ + 'serviceName' => self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/data_scan_service_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/data_scan_service_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/data_scan_service_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/data_scan_service_rest_client_config.php', + ], + ], + ]; + } + + /** + * Return an OperationsClient object with the same endpoint as $this. + * + * @return OperationsClient + */ + public function getOperationsClient() + { + return $this->operationsClient; + } + + /** + * Resume an existing long running operation that was previously started by a long + * running API method. If $methodName is not provided, or does not match a long + * running API method, then the operation can still be resumed, but the + * OperationResponse object will not deserialize the final response. + * + * @param string $operationName The name of the long running operation + * @param string $methodName The name of the method used to start the operation + * + * @return OperationResponse + */ + public function resumeOperation($operationName, $methodName = null) + { + $options = isset($this->descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : []; + $operation = new OperationResponse($operationName, $this->getOperationsClient(), $options); + $operation->reload(); + return $operation; + } + + /** + * Formats a string containing the fully-qualified path to represent a data_scan + * resource. + * + * @param string $project + * @param string $location + * @param string $dataScan + * + * @return string The formatted data_scan resource. + */ + public static function dataScanName(string $project, string $location, string $dataScan): string + { + return self::getPathTemplate('dataScan')->render([ + 'project' => $project, + 'location' => $location, + 'dataScan' => $dataScan, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * data_scan_job resource. + * + * @param string $project + * @param string $location + * @param string $dataScan + * @param string $job + * + * @return string The formatted data_scan_job resource. + */ + public static function dataScanJobName(string $project, string $location, string $dataScan, string $job): string + { + return self::getPathTemplate('dataScanJob')->render([ + 'project' => $project, + 'location' => $location, + 'dataScan' => $dataScan, + 'job' => $job, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a entity + * resource. + * + * @param string $project + * @param string $location + * @param string $lake + * @param string $zone + * @param string $entity + * + * @return string The formatted entity resource. + */ + public static function entityName(string $project, string $location, string $lake, string $zone, string $entity): string + { + return self::getPathTemplate('entity')->render([ + 'project' => $project, + 'location' => $location, + 'lake' => $lake, + 'zone' => $zone, + 'entity' => $entity, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a location + * resource. + * + * @param string $project + * @param string $location + * + * @return string The formatted location resource. + */ + public static function locationName(string $project, string $location): string + { + return self::getPathTemplate('location')->render([ + 'project' => $project, + 'location' => $location, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - dataScan: projects/{project}/locations/{location}/dataScans/{dataScan} + * - dataScanJob: projects/{project}/locations/{location}/dataScans/{dataScan}/jobs/{job} + * - entity: projects/{project}/locations/{location}/lakes/{lake}/zones/{zone}/entities/{entity} + * - location: projects/{project}/locations/{location} + * + * 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 $template argument does not match one of the templates + * listed, then parseName will check each of the supported templates, and return + * the first match. + * + * @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. + * + * @throws ValidationException If $formattedName could not be matched. + */ + public static function parseName(string $formattedName, string $template = null): array + { + return self::parseFormattedName($formattedName, $template); + } + + /** + * Constructor. + * + * @param array $options { + * Optional. Options for configuring the service API wrapper. + * + * @type string $apiEndpoint + * The address of the API remote host. May optionally include the port, formatted + * as ":". Default 'dataplex.googleapis.com:443'. + * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials + * The credentials to be used by the client to authorize API calls. This option + * accepts either a path to a credentials file, or a decoded credentials file as a + * PHP array. + * *Advanced usage*: In addition, this option can also accept a pre-constructed + * {@see \Google\Auth\FetchAuthTokenInterface} object or + * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these + * objects are provided, any settings in $credentialsConfig will be ignored. + * @type array $credentialsConfig + * Options used to configure credentials, including auth token caching, for the + * client. For a full list of supporting configuration options, see + * {@see \Google\ApiCore\CredentialsWrapper::build()} . + * @type bool $disableRetries + * Determines whether or not retries defined by the client configuration should be + * disabled. Defaults to `false`. + * @type string|array $clientConfig + * Client method configuration, including retry settings. This option can be either + * a path to a JSON file, or a PHP array containing the decoded JSON data. By + * default this settings points to the default client config file, which is + * provided in the resources folder. + * @type string|TransportInterface $transport + * The transport used for executing network requests. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *Advanced usage*: Additionally, it is possible to pass in an already + * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note + * that when this object is provided, any settings in $transportConfig, and any + * $apiEndpoint setting, will be ignored. + * @type array $transportConfig + * Configuration options that will be used to construct the transport. Options for + * each supported transport type should be passed in a key for that transport. For + * example: + * $transportConfig = [ + * 'grpc' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the + * supported options. + * @type callable $clientCertSource + * A callable which returns the client cert as a string. This can be used to + * provide a certificate and private key to the transport layer for mTLS. + * } + * + * @throws ValidationException + */ + public function __construct(array $options = []) + { + $clientOptions = $this->buildClientOptions($options); + $this->setClientOptions($clientOptions); + $this->operationsClient = $this->createOperationsClient($clientOptions); + } + + /** Handles execution of the async variants for each documented method. */ + public function __call($method, $args) + { + if (substr($method, -5) !== 'Async') { + trigger_error('Call to undefined method ' . __CLASS__ . "::$method()", E_USER_ERROR); + } + + array_unshift($args, substr($method, 0, -5)); + return call_user_func_array([$this, 'startAsyncCall'], $args); + } + + /** + * Creates a DataScan resource. + * + * The async variant is {@see DataScanServiceGapicClient::createDataScanAsync()} . + * + * @example samples/V1/DataScanServiceClient/create_data_scan.php + * + * @param CreateDataScanRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function createDataScan(CreateDataScanRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('CreateDataScan', $request, $callOptions)->wait(); + } + + /** + * Deletes a DataScan resource. + * + * The async variant is {@see DataScanServiceGapicClient::deleteDataScanAsync()} . + * + * @example samples/V1/DataScanServiceClient/delete_data_scan.php + * + * @param DeleteDataScanRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function deleteDataScan(DeleteDataScanRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('DeleteDataScan', $request, $callOptions)->wait(); + } + + /** + * Gets a DataScan resource. + * + * The async variant is {@see DataScanServiceGapicClient::getDataScanAsync()} . + * + * @example samples/V1/DataScanServiceClient/get_data_scan.php + * + * @param GetDataScanRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return DataScan + * + * @throws ApiException Thrown if the API call fails. + */ + public function getDataScan(GetDataScanRequest $request, array $callOptions = []): DataScan + { + return $this->startApiCall('GetDataScan', $request, $callOptions)->wait(); + } + + /** + * Gets a DataScanJob resource. + * + * The async variant is {@see DataScanServiceGapicClient::getDataScanJobAsync()} . + * + * @example samples/V1/DataScanServiceClient/get_data_scan_job.php + * + * @param GetDataScanJobRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return DataScanJob + * + * @throws ApiException Thrown if the API call fails. + */ + public function getDataScanJob(GetDataScanJobRequest $request, array $callOptions = []): DataScanJob + { + return $this->startApiCall('GetDataScanJob', $request, $callOptions)->wait(); + } + + /** + * Lists DataScanJobs under the given DataScan. + * + * The async variant is {@see DataScanServiceGapicClient::listDataScanJobsAsync()} + * . + * + * @example samples/V1/DataScanServiceClient/list_data_scan_jobs.php + * + * @param ListDataScanJobsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listDataScanJobs(ListDataScanJobsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListDataScanJobs', $request, $callOptions); + } + + /** + * Lists DataScans. + * + * The async variant is {@see DataScanServiceGapicClient::listDataScansAsync()} . + * + * @example samples/V1/DataScanServiceClient/list_data_scans.php + * + * @param ListDataScansRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listDataScans(ListDataScansRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListDataScans', $request, $callOptions); + } + + /** + * Runs an on-demand execution of a DataScan + * + * The async variant is {@see DataScanServiceGapicClient::runDataScanAsync()} . + * + * @example samples/V1/DataScanServiceClient/run_data_scan.php + * + * @param RunDataScanRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return RunDataScanResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function runDataScan(RunDataScanRequest $request, array $callOptions = []): RunDataScanResponse + { + return $this->startApiCall('RunDataScan', $request, $callOptions)->wait(); + } + + /** + * Updates a DataScan resource. + * + * The async variant is {@see DataScanServiceGapicClient::updateDataScanAsync()} . + * + * @example samples/V1/DataScanServiceClient/update_data_scan.php + * + * @param UpdateDataScanRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function updateDataScan(UpdateDataScanRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('UpdateDataScan', $request, $callOptions)->wait(); + } + + /** + * Gets the access control policy for a resource. Returns an empty policy + if the resource exists and does not have a policy set. + * + * The async variant is {@see DataScanServiceGapicClient::getIamPolicyAsync()} . + * + * @example samples/V1/DataScanServiceClient/get_iam_policy.php + * + * @param GetIamPolicyRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Policy + * + * @throws ApiException Thrown if the API call fails. + */ + public function getIamPolicy(GetIamPolicyRequest $request, array $callOptions = []): Policy + { + return $this->startApiCall('GetIamPolicy', $request, $callOptions)->wait(); + } + + /** + * Sets the access control policy on the specified resource. Replaces + any existing policy. + + Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` + errors. + * + * The async variant is {@see DataScanServiceGapicClient::setIamPolicyAsync()} . + * + * @example samples/V1/DataScanServiceClient/set_iam_policy.php + * + * @param SetIamPolicyRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Policy + * + * @throws ApiException Thrown if the API call fails. + */ + public function setIamPolicy(SetIamPolicyRequest $request, array $callOptions = []): Policy + { + return $this->startApiCall('SetIamPolicy', $request, $callOptions)->wait(); + } + + /** + * Returns permissions that a caller has on the specified resource. If the + resource does not exist, this will return an empty set of + permissions, not a `NOT_FOUND` error. + + Note: This operation is designed to be used for building + permission-aware UIs and command-line tools, not for authorization + checking. This operation may "fail open" without warning. + * + * The async variant is + * {@see DataScanServiceGapicClient::testIamPermissionsAsync()} . + * + * @example samples/V1/DataScanServiceClient/test_iam_permissions.php + * + * @param TestIamPermissionsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return TestIamPermissionsResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function testIamPermissions(TestIamPermissionsRequest $request, array $callOptions = []): TestIamPermissionsResponse + { + return $this->startApiCall('TestIamPermissions', $request, $callOptions)->wait(); + } + + /** + * Gets information about a location. + * + * The async variant is {@see DataScanServiceGapicClient::getLocationAsync()} . + * + * @example samples/V1/DataScanServiceClient/get_location.php + * + * @param GetLocationRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Location + * + * @throws ApiException Thrown if the API call fails. + */ + public function getLocation(GetLocationRequest $request, array $callOptions = []): Location + { + return $this->startApiCall('GetLocation', $request, $callOptions)->wait(); + } + + /** + * Lists information about the supported locations for this service. + * + * The async variant is {@see DataScanServiceGapicClient::listLocationsAsync()} . + * + * @example samples/V1/DataScanServiceClient/list_locations.php + * + * @param ListLocationsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listLocations(ListLocationsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListLocations', $request, $callOptions); + } } diff --git a/Dataplex/src/V1/Client/DataTaxonomyServiceClient.php b/Dataplex/src/V1/Client/DataTaxonomyServiceClient.php index 533ce1c13131..29a134d05af6 100644 --- a/Dataplex/src/V1/Client/DataTaxonomyServiceClient.php +++ b/Dataplex/src/V1/Client/DataTaxonomyServiceClient.php @@ -24,17 +24,882 @@ namespace Google\Cloud\Dataplex\V1\Client; -use Google\Cloud\Dataplex\V1\Client\BaseClient\DataTaxonomyServiceBaseClient; +use Google\ApiCore\ApiException; +use Google\ApiCore\CredentialsWrapper; +use Google\ApiCore\GapicClientTrait; +use Google\ApiCore\LongRunning\OperationsClient; +use Google\ApiCore\OperationResponse; +use Google\ApiCore\PagedListResponse; +use Google\ApiCore\ResourceHelperTrait; +use Google\ApiCore\RetrySettings; +use Google\ApiCore\Transport\TransportInterface; +use Google\ApiCore\ValidationException; +use Google\Auth\FetchAuthTokenInterface; +use Google\Cloud\Dataplex\V1\CreateDataAttributeBindingRequest; +use Google\Cloud\Dataplex\V1\CreateDataAttributeRequest; +use Google\Cloud\Dataplex\V1\CreateDataTaxonomyRequest; +use Google\Cloud\Dataplex\V1\DataAttribute; +use Google\Cloud\Dataplex\V1\DataAttributeBinding; +use Google\Cloud\Dataplex\V1\DataTaxonomy; +use Google\Cloud\Dataplex\V1\DeleteDataAttributeBindingRequest; +use Google\Cloud\Dataplex\V1\DeleteDataAttributeRequest; +use Google\Cloud\Dataplex\V1\DeleteDataTaxonomyRequest; +use Google\Cloud\Dataplex\V1\GetDataAttributeBindingRequest; +use Google\Cloud\Dataplex\V1\GetDataAttributeRequest; +use Google\Cloud\Dataplex\V1\GetDataTaxonomyRequest; +use Google\Cloud\Dataplex\V1\ListDataAttributeBindingsRequest; +use Google\Cloud\Dataplex\V1\ListDataAttributesRequest; +use Google\Cloud\Dataplex\V1\ListDataTaxonomiesRequest; +use Google\Cloud\Dataplex\V1\UpdateDataAttributeBindingRequest; +use Google\Cloud\Dataplex\V1\UpdateDataAttributeRequest; +use Google\Cloud\Dataplex\V1\UpdateDataTaxonomyRequest; +use Google\Cloud\Iam\V1\GetIamPolicyRequest; +use Google\Cloud\Iam\V1\Policy; +use Google\Cloud\Iam\V1\SetIamPolicyRequest; +use Google\Cloud\Iam\V1\TestIamPermissionsRequest; +use Google\Cloud\Iam\V1\TestIamPermissionsResponse; +use Google\Cloud\Location\GetLocationRequest; +use Google\Cloud\Location\ListLocationsRequest; +use Google\Cloud\Location\Location; +use Google\LongRunning\Operation; +use GuzzleHttp\Promise\PromiseInterface; /** - * {@inheritdoc} + * Service Description: DataTaxonomyService enables attribute-based governance. The resources + * currently offered include DataTaxonomy and DataAttribute. * - * This class is currently experimental and may be subject to changes. + * This class provides the ability to make remote calls to the backing service through method + * calls that map to API methods. + * + * Many parameters require resource names to be formatted in a particular way. To + * assist with these names, this class includes a format method for each type of + * name, and additionally a parseName method to extract the individual identifiers + * contained within formatted names that are returned by the API. + * + * This class is currently experimental and may be subject to changes. See {@see + * \Google\Cloud\Dataplex\V1\DataTaxonomyServiceClient} for the stable + * implementation * * @experimental + * + * @method PromiseInterface createDataAttributeAsync(CreateDataAttributeRequest $request, array $optionalArgs = []) + * @method PromiseInterface createDataAttributeBindingAsync(CreateDataAttributeBindingRequest $request, array $optionalArgs = []) + * @method PromiseInterface createDataTaxonomyAsync(CreateDataTaxonomyRequest $request, array $optionalArgs = []) + * @method PromiseInterface deleteDataAttributeAsync(DeleteDataAttributeRequest $request, array $optionalArgs = []) + * @method PromiseInterface deleteDataAttributeBindingAsync(DeleteDataAttributeBindingRequest $request, array $optionalArgs = []) + * @method PromiseInterface deleteDataTaxonomyAsync(DeleteDataTaxonomyRequest $request, array $optionalArgs = []) + * @method PromiseInterface getDataAttributeAsync(GetDataAttributeRequest $request, array $optionalArgs = []) + * @method PromiseInterface getDataAttributeBindingAsync(GetDataAttributeBindingRequest $request, array $optionalArgs = []) + * @method PromiseInterface getDataTaxonomyAsync(GetDataTaxonomyRequest $request, array $optionalArgs = []) + * @method PromiseInterface listDataAttributeBindingsAsync(ListDataAttributeBindingsRequest $request, array $optionalArgs = []) + * @method PromiseInterface listDataAttributesAsync(ListDataAttributesRequest $request, array $optionalArgs = []) + * @method PromiseInterface listDataTaxonomiesAsync(ListDataTaxonomiesRequest $request, array $optionalArgs = []) + * @method PromiseInterface updateDataAttributeAsync(UpdateDataAttributeRequest $request, array $optionalArgs = []) + * @method PromiseInterface updateDataAttributeBindingAsync(UpdateDataAttributeBindingRequest $request, array $optionalArgs = []) + * @method PromiseInterface updateDataTaxonomyAsync(UpdateDataTaxonomyRequest $request, array $optionalArgs = []) + * @method PromiseInterface getIamPolicyAsync(GetIamPolicyRequest $request, array $optionalArgs = []) + * @method PromiseInterface setIamPolicyAsync(SetIamPolicyRequest $request, array $optionalArgs = []) + * @method PromiseInterface testIamPermissionsAsync(TestIamPermissionsRequest $request, array $optionalArgs = []) + * @method PromiseInterface getLocationAsync(GetLocationRequest $request, array $optionalArgs = []) + * @method PromiseInterface listLocationsAsync(ListLocationsRequest $request, array $optionalArgs = []) */ -final class DataTaxonomyServiceClient extends DataTaxonomyServiceBaseClient +final class DataTaxonomyServiceClient { - // This class is intentionally empty, and is intended to hold manual additions to - // the generated {@see DataTaxonomyServiceBaseClient} class. + use GapicClientTrait; + use ResourceHelperTrait; + + /** The name of the service. */ + private const SERVICE_NAME = 'google.cloud.dataplex.v1.DataTaxonomyService'; + + /** The default address of the service. */ + private const SERVICE_ADDRESS = 'dataplex.googleapis.com'; + + /** The default port of the service. */ + private const DEFAULT_SERVICE_PORT = 443; + + /** The name of the code generator, to be included in the agent header. */ + private const CODEGEN_NAME = 'gapic'; + + /** The default scopes required by the service. */ + public static $serviceScopes = [ + 'https://www.googleapis.com/auth/cloud-platform', + ]; + + private $operationsClient; + + private static function getClientDefaults() + { + return [ + 'serviceName' => self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/data_taxonomy_service_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/data_taxonomy_service_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/data_taxonomy_service_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/data_taxonomy_service_rest_client_config.php', + ], + ], + ]; + } + + /** + * Return an OperationsClient object with the same endpoint as $this. + * + * @return OperationsClient + */ + public function getOperationsClient() + { + return $this->operationsClient; + } + + /** + * Resume an existing long running operation that was previously started by a long + * running API method. If $methodName is not provided, or does not match a long + * running API method, then the operation can still be resumed, but the + * OperationResponse object will not deserialize the final response. + * + * @param string $operationName The name of the long running operation + * @param string $methodName The name of the method used to start the operation + * + * @return OperationResponse + */ + public function resumeOperation($operationName, $methodName = null) + { + $options = isset($this->descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : []; + $operation = new OperationResponse($operationName, $this->getOperationsClient(), $options); + $operation->reload(); + return $operation; + } + + /** + * Formats a string containing the fully-qualified path to represent a + * data_attribute resource. + * + * @param string $project + * @param string $location + * @param string $dataTaxonomy + * @param string $dataAttributeId + * + * @return string The formatted data_attribute resource. + */ + public static function dataAttributeName(string $project, string $location, string $dataTaxonomy, string $dataAttributeId): string + { + return self::getPathTemplate('dataAttribute')->render([ + 'project' => $project, + 'location' => $location, + 'dataTaxonomy' => $dataTaxonomy, + 'data_attribute_id' => $dataAttributeId, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * data_attribute_binding resource. + * + * @param string $project + * @param string $location + * @param string $dataAttributeBindingId + * + * @return string The formatted data_attribute_binding resource. + */ + public static function dataAttributeBindingName(string $project, string $location, string $dataAttributeBindingId): string + { + return self::getPathTemplate('dataAttributeBinding')->render([ + 'project' => $project, + 'location' => $location, + 'data_attribute_binding_id' => $dataAttributeBindingId, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * data_taxonomy resource. + * + * @param string $project + * @param string $location + * @param string $dataTaxonomyId + * + * @return string The formatted data_taxonomy resource. + */ + public static function dataTaxonomyName(string $project, string $location, string $dataTaxonomyId): string + { + return self::getPathTemplate('dataTaxonomy')->render([ + 'project' => $project, + 'location' => $location, + 'data_taxonomy_id' => $dataTaxonomyId, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a location + * resource. + * + * @param string $project + * @param string $location + * + * @return string The formatted location resource. + */ + public static function locationName(string $project, string $location): string + { + return self::getPathTemplate('location')->render([ + 'project' => $project, + 'location' => $location, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - dataAttribute: projects/{project}/locations/{location}/dataTaxonomies/{dataTaxonomy}/attributes/{data_attribute_id} + * - dataAttributeBinding: projects/{project}/locations/{location}/dataAttributeBindings/{data_attribute_binding_id} + * - dataTaxonomy: projects/{project}/locations/{location}/dataTaxonomies/{data_taxonomy_id} + * - location: projects/{project}/locations/{location} + * + * 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 $template argument does not match one of the templates + * listed, then parseName will check each of the supported templates, and return + * the first match. + * + * @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. + * + * @throws ValidationException If $formattedName could not be matched. + */ + public static function parseName(string $formattedName, string $template = null): array + { + return self::parseFormattedName($formattedName, $template); + } + + /** + * Constructor. + * + * @param array $options { + * Optional. Options for configuring the service API wrapper. + * + * @type string $apiEndpoint + * The address of the API remote host. May optionally include the port, formatted + * as ":". Default 'dataplex.googleapis.com:443'. + * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials + * The credentials to be used by the client to authorize API calls. This option + * accepts either a path to a credentials file, or a decoded credentials file as a + * PHP array. + * *Advanced usage*: In addition, this option can also accept a pre-constructed + * {@see \Google\Auth\FetchAuthTokenInterface} object or + * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these + * objects are provided, any settings in $credentialsConfig will be ignored. + * @type array $credentialsConfig + * Options used to configure credentials, including auth token caching, for the + * client. For a full list of supporting configuration options, see + * {@see \Google\ApiCore\CredentialsWrapper::build()} . + * @type bool $disableRetries + * Determines whether or not retries defined by the client configuration should be + * disabled. Defaults to `false`. + * @type string|array $clientConfig + * Client method configuration, including retry settings. This option can be either + * a path to a JSON file, or a PHP array containing the decoded JSON data. By + * default this settings points to the default client config file, which is + * provided in the resources folder. + * @type string|TransportInterface $transport + * The transport used for executing network requests. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *Advanced usage*: Additionally, it is possible to pass in an already + * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note + * that when this object is provided, any settings in $transportConfig, and any + * $apiEndpoint setting, will be ignored. + * @type array $transportConfig + * Configuration options that will be used to construct the transport. Options for + * each supported transport type should be passed in a key for that transport. For + * example: + * $transportConfig = [ + * 'grpc' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the + * supported options. + * @type callable $clientCertSource + * A callable which returns the client cert as a string. This can be used to + * provide a certificate and private key to the transport layer for mTLS. + * } + * + * @throws ValidationException + */ + public function __construct(array $options = []) + { + $clientOptions = $this->buildClientOptions($options); + $this->setClientOptions($clientOptions); + $this->operationsClient = $this->createOperationsClient($clientOptions); + } + + /** Handles execution of the async variants for each documented method. */ + public function __call($method, $args) + { + if (substr($method, -5) !== 'Async') { + trigger_error('Call to undefined method ' . __CLASS__ . "::$method()", E_USER_ERROR); + } + + array_unshift($args, substr($method, 0, -5)); + return call_user_func_array([$this, 'startAsyncCall'], $args); + } + + /** + * Create a DataAttribute resource. + * + * The async variant is + * {@see DataTaxonomyServiceGapicClient::createDataAttributeAsync()} . + * + * @example samples/V1/DataTaxonomyServiceClient/create_data_attribute.php + * + * @param CreateDataAttributeRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function createDataAttribute(CreateDataAttributeRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('CreateDataAttribute', $request, $callOptions)->wait(); + } + + /** + * Create a DataAttributeBinding resource. + * + * The async variant is + * {@see DataTaxonomyServiceGapicClient::createDataAttributeBindingAsync()} . + * + * @example samples/V1/DataTaxonomyServiceClient/create_data_attribute_binding.php + * + * @param CreateDataAttributeBindingRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function createDataAttributeBinding(CreateDataAttributeBindingRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('CreateDataAttributeBinding', $request, $callOptions)->wait(); + } + + /** + * Create a DataTaxonomy resource. + * + * The async variant is + * {@see DataTaxonomyServiceGapicClient::createDataTaxonomyAsync()} . + * + * @example samples/V1/DataTaxonomyServiceClient/create_data_taxonomy.php + * + * @param CreateDataTaxonomyRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function createDataTaxonomy(CreateDataTaxonomyRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('CreateDataTaxonomy', $request, $callOptions)->wait(); + } + + /** + * Deletes a Data Attribute resource. + * + * The async variant is + * {@see DataTaxonomyServiceGapicClient::deleteDataAttributeAsync()} . + * + * @example samples/V1/DataTaxonomyServiceClient/delete_data_attribute.php + * + * @param DeleteDataAttributeRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function deleteDataAttribute(DeleteDataAttributeRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('DeleteDataAttribute', $request, $callOptions)->wait(); + } + + /** + * Deletes a DataAttributeBinding resource. All attributes within the + * DataAttributeBinding must be deleted before the DataAttributeBinding can be + * deleted. + * + * The async variant is + * {@see DataTaxonomyServiceGapicClient::deleteDataAttributeBindingAsync()} . + * + * @example samples/V1/DataTaxonomyServiceClient/delete_data_attribute_binding.php + * + * @param DeleteDataAttributeBindingRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function deleteDataAttributeBinding(DeleteDataAttributeBindingRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('DeleteDataAttributeBinding', $request, $callOptions)->wait(); + } + + /** + * Deletes a DataTaxonomy resource. All attributes within the DataTaxonomy + * must be deleted before the DataTaxonomy can be deleted. + * + * The async variant is + * {@see DataTaxonomyServiceGapicClient::deleteDataTaxonomyAsync()} . + * + * @example samples/V1/DataTaxonomyServiceClient/delete_data_taxonomy.php + * + * @param DeleteDataTaxonomyRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function deleteDataTaxonomy(DeleteDataTaxonomyRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('DeleteDataTaxonomy', $request, $callOptions)->wait(); + } + + /** + * Retrieves a Data Attribute resource. + * + * The async variant is + * {@see DataTaxonomyServiceGapicClient::getDataAttributeAsync()} . + * + * @example samples/V1/DataTaxonomyServiceClient/get_data_attribute.php + * + * @param GetDataAttributeRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return DataAttribute + * + * @throws ApiException Thrown if the API call fails. + */ + public function getDataAttribute(GetDataAttributeRequest $request, array $callOptions = []): DataAttribute + { + return $this->startApiCall('GetDataAttribute', $request, $callOptions)->wait(); + } + + /** + * Retrieves a DataAttributeBinding resource. + * + * The async variant is + * {@see DataTaxonomyServiceGapicClient::getDataAttributeBindingAsync()} . + * + * @example samples/V1/DataTaxonomyServiceClient/get_data_attribute_binding.php + * + * @param GetDataAttributeBindingRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return DataAttributeBinding + * + * @throws ApiException Thrown if the API call fails. + */ + public function getDataAttributeBinding(GetDataAttributeBindingRequest $request, array $callOptions = []): DataAttributeBinding + { + return $this->startApiCall('GetDataAttributeBinding', $request, $callOptions)->wait(); + } + + /** + * Retrieves a DataTaxonomy resource. + * + * The async variant is + * {@see DataTaxonomyServiceGapicClient::getDataTaxonomyAsync()} . + * + * @example samples/V1/DataTaxonomyServiceClient/get_data_taxonomy.php + * + * @param GetDataTaxonomyRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return DataTaxonomy + * + * @throws ApiException Thrown if the API call fails. + */ + public function getDataTaxonomy(GetDataTaxonomyRequest $request, array $callOptions = []): DataTaxonomy + { + return $this->startApiCall('GetDataTaxonomy', $request, $callOptions)->wait(); + } + + /** + * Lists DataAttributeBinding resources in a project and location. + * + * The async variant is + * {@see DataTaxonomyServiceGapicClient::listDataAttributeBindingsAsync()} . + * + * @example samples/V1/DataTaxonomyServiceClient/list_data_attribute_bindings.php + * + * @param ListDataAttributeBindingsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listDataAttributeBindings(ListDataAttributeBindingsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListDataAttributeBindings', $request, $callOptions); + } + + /** + * Lists Data Attribute resources in a DataTaxonomy. + * + * The async variant is + * {@see DataTaxonomyServiceGapicClient::listDataAttributesAsync()} . + * + * @example samples/V1/DataTaxonomyServiceClient/list_data_attributes.php + * + * @param ListDataAttributesRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listDataAttributes(ListDataAttributesRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListDataAttributes', $request, $callOptions); + } + + /** + * Lists DataTaxonomy resources in a project and location. + * + * The async variant is + * {@see DataTaxonomyServiceGapicClient::listDataTaxonomiesAsync()} . + * + * @example samples/V1/DataTaxonomyServiceClient/list_data_taxonomies.php + * + * @param ListDataTaxonomiesRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listDataTaxonomies(ListDataTaxonomiesRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListDataTaxonomies', $request, $callOptions); + } + + /** + * Updates a DataAttribute resource. + * + * The async variant is + * {@see DataTaxonomyServiceGapicClient::updateDataAttributeAsync()} . + * + * @example samples/V1/DataTaxonomyServiceClient/update_data_attribute.php + * + * @param UpdateDataAttributeRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function updateDataAttribute(UpdateDataAttributeRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('UpdateDataAttribute', $request, $callOptions)->wait(); + } + + /** + * Updates a DataAttributeBinding resource. + * + * The async variant is + * {@see DataTaxonomyServiceGapicClient::updateDataAttributeBindingAsync()} . + * + * @example samples/V1/DataTaxonomyServiceClient/update_data_attribute_binding.php + * + * @param UpdateDataAttributeBindingRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function updateDataAttributeBinding(UpdateDataAttributeBindingRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('UpdateDataAttributeBinding', $request, $callOptions)->wait(); + } + + /** + * Updates a DataTaxonomy resource. + * + * The async variant is + * {@see DataTaxonomyServiceGapicClient::updateDataTaxonomyAsync()} . + * + * @example samples/V1/DataTaxonomyServiceClient/update_data_taxonomy.php + * + * @param UpdateDataTaxonomyRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function updateDataTaxonomy(UpdateDataTaxonomyRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('UpdateDataTaxonomy', $request, $callOptions)->wait(); + } + + /** + * Gets the access control policy for a resource. Returns an empty policy + if the resource exists and does not have a policy set. + * + * The async variant is {@see DataTaxonomyServiceGapicClient::getIamPolicyAsync()} + * . + * + * @example samples/V1/DataTaxonomyServiceClient/get_iam_policy.php + * + * @param GetIamPolicyRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Policy + * + * @throws ApiException Thrown if the API call fails. + */ + public function getIamPolicy(GetIamPolicyRequest $request, array $callOptions = []): Policy + { + return $this->startApiCall('GetIamPolicy', $request, $callOptions)->wait(); + } + + /** + * Sets the access control policy on the specified resource. Replaces + any existing policy. + + Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` + errors. + * + * The async variant is {@see DataTaxonomyServiceGapicClient::setIamPolicyAsync()} + * . + * + * @example samples/V1/DataTaxonomyServiceClient/set_iam_policy.php + * + * @param SetIamPolicyRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Policy + * + * @throws ApiException Thrown if the API call fails. + */ + public function setIamPolicy(SetIamPolicyRequest $request, array $callOptions = []): Policy + { + return $this->startApiCall('SetIamPolicy', $request, $callOptions)->wait(); + } + + /** + * Returns permissions that a caller has on the specified resource. If the + resource does not exist, this will return an empty set of + permissions, not a `NOT_FOUND` error. + + Note: This operation is designed to be used for building + permission-aware UIs and command-line tools, not for authorization + checking. This operation may "fail open" without warning. + * + * The async variant is + * {@see DataTaxonomyServiceGapicClient::testIamPermissionsAsync()} . + * + * @example samples/V1/DataTaxonomyServiceClient/test_iam_permissions.php + * + * @param TestIamPermissionsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return TestIamPermissionsResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function testIamPermissions(TestIamPermissionsRequest $request, array $callOptions = []): TestIamPermissionsResponse + { + return $this->startApiCall('TestIamPermissions', $request, $callOptions)->wait(); + } + + /** + * Gets information about a location. + * + * The async variant is {@see DataTaxonomyServiceGapicClient::getLocationAsync()} . + * + * @example samples/V1/DataTaxonomyServiceClient/get_location.php + * + * @param GetLocationRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Location + * + * @throws ApiException Thrown if the API call fails. + */ + public function getLocation(GetLocationRequest $request, array $callOptions = []): Location + { + return $this->startApiCall('GetLocation', $request, $callOptions)->wait(); + } + + /** + * Lists information about the supported locations for this service. + * + * The async variant is {@see DataTaxonomyServiceGapicClient::listLocationsAsync()} + * . + * + * @example samples/V1/DataTaxonomyServiceClient/list_locations.php + * + * @param ListLocationsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listLocations(ListLocationsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListLocations', $request, $callOptions); + } } diff --git a/Dataplex/src/V1/Client/DataplexServiceClient.php b/Dataplex/src/V1/Client/DataplexServiceClient.php index b04e25af5362..637a9eb561d1 100644 --- a/Dataplex/src/V1/Client/DataplexServiceClient.php +++ b/Dataplex/src/V1/Client/DataplexServiceClient.php @@ -24,17 +24,1450 @@ namespace Google\Cloud\Dataplex\V1\Client; -use Google\Cloud\Dataplex\V1\Client\BaseClient\DataplexServiceBaseClient; +use Google\ApiCore\ApiException; +use Google\ApiCore\CredentialsWrapper; +use Google\ApiCore\GapicClientTrait; +use Google\ApiCore\LongRunning\OperationsClient; +use Google\ApiCore\OperationResponse; +use Google\ApiCore\PagedListResponse; +use Google\ApiCore\ResourceHelperTrait; +use Google\ApiCore\RetrySettings; +use Google\ApiCore\Transport\TransportInterface; +use Google\ApiCore\ValidationException; +use Google\Auth\FetchAuthTokenInterface; +use Google\Cloud\Dataplex\V1\Asset; +use Google\Cloud\Dataplex\V1\CancelJobRequest; +use Google\Cloud\Dataplex\V1\CreateAssetRequest; +use Google\Cloud\Dataplex\V1\CreateEnvironmentRequest; +use Google\Cloud\Dataplex\V1\CreateLakeRequest; +use Google\Cloud\Dataplex\V1\CreateTaskRequest; +use Google\Cloud\Dataplex\V1\CreateZoneRequest; +use Google\Cloud\Dataplex\V1\DeleteAssetRequest; +use Google\Cloud\Dataplex\V1\DeleteEnvironmentRequest; +use Google\Cloud\Dataplex\V1\DeleteLakeRequest; +use Google\Cloud\Dataplex\V1\DeleteTaskRequest; +use Google\Cloud\Dataplex\V1\DeleteZoneRequest; +use Google\Cloud\Dataplex\V1\Environment; +use Google\Cloud\Dataplex\V1\GetAssetRequest; +use Google\Cloud\Dataplex\V1\GetEnvironmentRequest; +use Google\Cloud\Dataplex\V1\GetJobRequest; +use Google\Cloud\Dataplex\V1\GetLakeRequest; +use Google\Cloud\Dataplex\V1\GetTaskRequest; +use Google\Cloud\Dataplex\V1\GetZoneRequest; +use Google\Cloud\Dataplex\V1\Job; +use Google\Cloud\Dataplex\V1\Lake; +use Google\Cloud\Dataplex\V1\ListAssetActionsRequest; +use Google\Cloud\Dataplex\V1\ListAssetsRequest; +use Google\Cloud\Dataplex\V1\ListEnvironmentsRequest; +use Google\Cloud\Dataplex\V1\ListJobsRequest; +use Google\Cloud\Dataplex\V1\ListLakeActionsRequest; +use Google\Cloud\Dataplex\V1\ListLakesRequest; +use Google\Cloud\Dataplex\V1\ListSessionsRequest; +use Google\Cloud\Dataplex\V1\ListTasksRequest; +use Google\Cloud\Dataplex\V1\ListZoneActionsRequest; +use Google\Cloud\Dataplex\V1\ListZonesRequest; +use Google\Cloud\Dataplex\V1\RunTaskRequest; +use Google\Cloud\Dataplex\V1\RunTaskResponse; +use Google\Cloud\Dataplex\V1\Task; +use Google\Cloud\Dataplex\V1\UpdateAssetRequest; +use Google\Cloud\Dataplex\V1\UpdateEnvironmentRequest; +use Google\Cloud\Dataplex\V1\UpdateLakeRequest; +use Google\Cloud\Dataplex\V1\UpdateTaskRequest; +use Google\Cloud\Dataplex\V1\UpdateZoneRequest; +use Google\Cloud\Dataplex\V1\Zone; +use Google\Cloud\Iam\V1\GetIamPolicyRequest; +use Google\Cloud\Iam\V1\Policy; +use Google\Cloud\Iam\V1\SetIamPolicyRequest; +use Google\Cloud\Iam\V1\TestIamPermissionsRequest; +use Google\Cloud\Iam\V1\TestIamPermissionsResponse; +use Google\Cloud\Location\GetLocationRequest; +use Google\Cloud\Location\ListLocationsRequest; +use Google\Cloud\Location\Location; +use Google\LongRunning\Operation; +use GuzzleHttp\Promise\PromiseInterface; /** - * {@inheritdoc} + * Service Description: Dataplex service provides data lakes as a service. The primary resources + * offered by this service are Lakes, Zones and Assets which collectively allow + * a data administrator to organize, manage, secure and catalog data across + * their organization located across cloud projects in a variety of storage + * systems including Cloud Storage and BigQuery. * - * This class is currently experimental and may be subject to changes. + * This class provides the ability to make remote calls to the backing service through method + * calls that map to API methods. + * + * Many parameters require resource names to be formatted in a particular way. To + * assist with these names, this class includes a format method for each type of + * name, and additionally a parseName method to extract the individual identifiers + * contained within formatted names that are returned by the API. + * + * This class is currently experimental and may be subject to changes. See {@see + * \Google\Cloud\Dataplex\V1\DataplexServiceClient} for the stable implementation * * @experimental + * + * @method PromiseInterface cancelJobAsync(CancelJobRequest $request, array $optionalArgs = []) + * @method PromiseInterface createAssetAsync(CreateAssetRequest $request, array $optionalArgs = []) + * @method PromiseInterface createEnvironmentAsync(CreateEnvironmentRequest $request, array $optionalArgs = []) + * @method PromiseInterface createLakeAsync(CreateLakeRequest $request, array $optionalArgs = []) + * @method PromiseInterface createTaskAsync(CreateTaskRequest $request, array $optionalArgs = []) + * @method PromiseInterface createZoneAsync(CreateZoneRequest $request, array $optionalArgs = []) + * @method PromiseInterface deleteAssetAsync(DeleteAssetRequest $request, array $optionalArgs = []) + * @method PromiseInterface deleteEnvironmentAsync(DeleteEnvironmentRequest $request, array $optionalArgs = []) + * @method PromiseInterface deleteLakeAsync(DeleteLakeRequest $request, array $optionalArgs = []) + * @method PromiseInterface deleteTaskAsync(DeleteTaskRequest $request, array $optionalArgs = []) + * @method PromiseInterface deleteZoneAsync(DeleteZoneRequest $request, array $optionalArgs = []) + * @method PromiseInterface getAssetAsync(GetAssetRequest $request, array $optionalArgs = []) + * @method PromiseInterface getEnvironmentAsync(GetEnvironmentRequest $request, array $optionalArgs = []) + * @method PromiseInterface getJobAsync(GetJobRequest $request, array $optionalArgs = []) + * @method PromiseInterface getLakeAsync(GetLakeRequest $request, array $optionalArgs = []) + * @method PromiseInterface getTaskAsync(GetTaskRequest $request, array $optionalArgs = []) + * @method PromiseInterface getZoneAsync(GetZoneRequest $request, array $optionalArgs = []) + * @method PromiseInterface listAssetActionsAsync(ListAssetActionsRequest $request, array $optionalArgs = []) + * @method PromiseInterface listAssetsAsync(ListAssetsRequest $request, array $optionalArgs = []) + * @method PromiseInterface listEnvironmentsAsync(ListEnvironmentsRequest $request, array $optionalArgs = []) + * @method PromiseInterface listJobsAsync(ListJobsRequest $request, array $optionalArgs = []) + * @method PromiseInterface listLakeActionsAsync(ListLakeActionsRequest $request, array $optionalArgs = []) + * @method PromiseInterface listLakesAsync(ListLakesRequest $request, array $optionalArgs = []) + * @method PromiseInterface listSessionsAsync(ListSessionsRequest $request, array $optionalArgs = []) + * @method PromiseInterface listTasksAsync(ListTasksRequest $request, array $optionalArgs = []) + * @method PromiseInterface listZoneActionsAsync(ListZoneActionsRequest $request, array $optionalArgs = []) + * @method PromiseInterface listZonesAsync(ListZonesRequest $request, array $optionalArgs = []) + * @method PromiseInterface runTaskAsync(RunTaskRequest $request, array $optionalArgs = []) + * @method PromiseInterface updateAssetAsync(UpdateAssetRequest $request, array $optionalArgs = []) + * @method PromiseInterface updateEnvironmentAsync(UpdateEnvironmentRequest $request, array $optionalArgs = []) + * @method PromiseInterface updateLakeAsync(UpdateLakeRequest $request, array $optionalArgs = []) + * @method PromiseInterface updateTaskAsync(UpdateTaskRequest $request, array $optionalArgs = []) + * @method PromiseInterface updateZoneAsync(UpdateZoneRequest $request, array $optionalArgs = []) + * @method PromiseInterface getIamPolicyAsync(GetIamPolicyRequest $request, array $optionalArgs = []) + * @method PromiseInterface setIamPolicyAsync(SetIamPolicyRequest $request, array $optionalArgs = []) + * @method PromiseInterface testIamPermissionsAsync(TestIamPermissionsRequest $request, array $optionalArgs = []) + * @method PromiseInterface getLocationAsync(GetLocationRequest $request, array $optionalArgs = []) + * @method PromiseInterface listLocationsAsync(ListLocationsRequest $request, array $optionalArgs = []) */ -final class DataplexServiceClient extends DataplexServiceBaseClient +final class DataplexServiceClient { - // This class is intentionally empty, and is intended to hold manual additions to - // the generated {@see DataplexServiceBaseClient} class. + use GapicClientTrait; + use ResourceHelperTrait; + + /** The name of the service. */ + private const SERVICE_NAME = 'google.cloud.dataplex.v1.DataplexService'; + + /** The default address of the service. */ + private const SERVICE_ADDRESS = 'dataplex.googleapis.com'; + + /** The default port of the service. */ + private const DEFAULT_SERVICE_PORT = 443; + + /** The name of the code generator, to be included in the agent header. */ + private const CODEGEN_NAME = 'gapic'; + + /** The default scopes required by the service. */ + public static $serviceScopes = [ + 'https://www.googleapis.com/auth/cloud-platform', + ]; + + private $operationsClient; + + private static function getClientDefaults() + { + return [ + 'serviceName' => self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/dataplex_service_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/dataplex_service_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/dataplex_service_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/dataplex_service_rest_client_config.php', + ], + ], + ]; + } + + /** + * Return an OperationsClient object with the same endpoint as $this. + * + * @return OperationsClient + */ + public function getOperationsClient() + { + return $this->operationsClient; + } + + /** + * Resume an existing long running operation that was previously started by a long + * running API method. If $methodName is not provided, or does not match a long + * running API method, then the operation can still be resumed, but the + * OperationResponse object will not deserialize the final response. + * + * @param string $operationName The name of the long running operation + * @param string $methodName The name of the method used to start the operation + * + * @return OperationResponse + */ + public function resumeOperation($operationName, $methodName = null) + { + $options = isset($this->descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : []; + $operation = new OperationResponse($operationName, $this->getOperationsClient(), $options); + $operation->reload(); + return $operation; + } + + /** + * Formats a string containing the fully-qualified path to represent a asset + * resource. + * + * @param string $project + * @param string $location + * @param string $lake + * @param string $zone + * @param string $asset + * + * @return string The formatted asset resource. + */ + public static function assetName(string $project, string $location, string $lake, string $zone, string $asset): string + { + return self::getPathTemplate('asset')->render([ + 'project' => $project, + 'location' => $location, + 'lake' => $lake, + 'zone' => $zone, + 'asset' => $asset, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a environment + * resource. + * + * @param string $project + * @param string $location + * @param string $lake + * @param string $environment + * + * @return string The formatted environment resource. + */ + public static function environmentName(string $project, string $location, string $lake, string $environment): string + { + return self::getPathTemplate('environment')->render([ + 'project' => $project, + 'location' => $location, + 'lake' => $lake, + 'environment' => $environment, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a job + * resource. + * + * @param string $project + * @param string $location + * @param string $lake + * @param string $task + * @param string $job + * + * @return string The formatted job resource. + */ + public static function jobName(string $project, string $location, string $lake, string $task, string $job): string + { + return self::getPathTemplate('job')->render([ + 'project' => $project, + 'location' => $location, + 'lake' => $lake, + 'task' => $task, + 'job' => $job, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a lake + * resource. + * + * @param string $project + * @param string $location + * @param string $lake + * + * @return string The formatted lake resource. + */ + public static function lakeName(string $project, string $location, string $lake): string + { + return self::getPathTemplate('lake')->render([ + 'project' => $project, + 'location' => $location, + 'lake' => $lake, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a location + * resource. + * + * @param string $project + * @param string $location + * + * @return string The formatted location resource. + */ + public static function locationName(string $project, string $location): string + { + return self::getPathTemplate('location')->render([ + 'project' => $project, + 'location' => $location, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a task + * resource. + * + * @param string $project + * @param string $location + * @param string $lake + * @param string $task + * + * @return string The formatted task resource. + */ + public static function taskName(string $project, string $location, string $lake, string $task): string + { + return self::getPathTemplate('task')->render([ + 'project' => $project, + 'location' => $location, + 'lake' => $lake, + 'task' => $task, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a zone + * resource. + * + * @param string $project + * @param string $location + * @param string $lake + * @param string $zone + * + * @return string The formatted zone resource. + */ + public static function zoneName(string $project, string $location, string $lake, string $zone): string + { + return self::getPathTemplate('zone')->render([ + 'project' => $project, + 'location' => $location, + 'lake' => $lake, + 'zone' => $zone, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - asset: projects/{project}/locations/{location}/lakes/{lake}/zones/{zone}/assets/{asset} + * - environment: projects/{project}/locations/{location}/lakes/{lake}/environments/{environment} + * - job: projects/{project}/locations/{location}/lakes/{lake}/tasks/{task}/jobs/{job} + * - lake: projects/{project}/locations/{location}/lakes/{lake} + * - location: projects/{project}/locations/{location} + * - task: projects/{project}/locations/{location}/lakes/{lake}/tasks/{task} + * - zone: projects/{project}/locations/{location}/lakes/{lake}/zones/{zone} + * + * 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 $template argument does not match one of the templates + * listed, then parseName will check each of the supported templates, and return + * the first match. + * + * @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. + * + * @throws ValidationException If $formattedName could not be matched. + */ + public static function parseName(string $formattedName, string $template = null): array + { + return self::parseFormattedName($formattedName, $template); + } + + /** + * Constructor. + * + * @param array $options { + * Optional. Options for configuring the service API wrapper. + * + * @type string $apiEndpoint + * The address of the API remote host. May optionally include the port, formatted + * as ":". Default 'dataplex.googleapis.com:443'. + * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials + * The credentials to be used by the client to authorize API calls. This option + * accepts either a path to a credentials file, or a decoded credentials file as a + * PHP array. + * *Advanced usage*: In addition, this option can also accept a pre-constructed + * {@see \Google\Auth\FetchAuthTokenInterface} object or + * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these + * objects are provided, any settings in $credentialsConfig will be ignored. + * @type array $credentialsConfig + * Options used to configure credentials, including auth token caching, for the + * client. For a full list of supporting configuration options, see + * {@see \Google\ApiCore\CredentialsWrapper::build()} . + * @type bool $disableRetries + * Determines whether or not retries defined by the client configuration should be + * disabled. Defaults to `false`. + * @type string|array $clientConfig + * Client method configuration, including retry settings. This option can be either + * a path to a JSON file, or a PHP array containing the decoded JSON data. By + * default this settings points to the default client config file, which is + * provided in the resources folder. + * @type string|TransportInterface $transport + * The transport used for executing network requests. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *Advanced usage*: Additionally, it is possible to pass in an already + * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note + * that when this object is provided, any settings in $transportConfig, and any + * $apiEndpoint setting, will be ignored. + * @type array $transportConfig + * Configuration options that will be used to construct the transport. Options for + * each supported transport type should be passed in a key for that transport. For + * example: + * $transportConfig = [ + * 'grpc' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the + * supported options. + * @type callable $clientCertSource + * A callable which returns the client cert as a string. This can be used to + * provide a certificate and private key to the transport layer for mTLS. + * } + * + * @throws ValidationException + */ + public function __construct(array $options = []) + { + $clientOptions = $this->buildClientOptions($options); + $this->setClientOptions($clientOptions); + $this->operationsClient = $this->createOperationsClient($clientOptions); + } + + /** Handles execution of the async variants for each documented method. */ + public function __call($method, $args) + { + if (substr($method, -5) !== 'Async') { + trigger_error('Call to undefined method ' . __CLASS__ . "::$method()", E_USER_ERROR); + } + + array_unshift($args, substr($method, 0, -5)); + return call_user_func_array([$this, 'startAsyncCall'], $args); + } + + /** + * Cancel jobs running for the task resource. + * + * The async variant is {@see DataplexServiceGapicClient::cancelJobAsync()} . + * + * @example samples/V1/DataplexServiceClient/cancel_job.php + * + * @param CancelJobRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @throws ApiException Thrown if the API call fails. + */ + public function cancelJob(CancelJobRequest $request, array $callOptions = []): void + { + $this->startApiCall('CancelJob', $request, $callOptions)->wait(); + } + + /** + * Creates an asset resource. + * + * The async variant is {@see DataplexServiceGapicClient::createAssetAsync()} . + * + * @example samples/V1/DataplexServiceClient/create_asset.php + * + * @param CreateAssetRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function createAsset(CreateAssetRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('CreateAsset', $request, $callOptions)->wait(); + } + + /** + * Create an environment resource. + * + * The async variant is {@see DataplexServiceGapicClient::createEnvironmentAsync()} + * . + * + * @example samples/V1/DataplexServiceClient/create_environment.php + * + * @param CreateEnvironmentRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function createEnvironment(CreateEnvironmentRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('CreateEnvironment', $request, $callOptions)->wait(); + } + + /** + * Creates a lake resource. + * + * The async variant is {@see DataplexServiceGapicClient::createLakeAsync()} . + * + * @example samples/V1/DataplexServiceClient/create_lake.php + * + * @param CreateLakeRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function createLake(CreateLakeRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('CreateLake', $request, $callOptions)->wait(); + } + + /** + * Creates a task resource within a lake. + * + * The async variant is {@see DataplexServiceGapicClient::createTaskAsync()} . + * + * @example samples/V1/DataplexServiceClient/create_task.php + * + * @param CreateTaskRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function createTask(CreateTaskRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('CreateTask', $request, $callOptions)->wait(); + } + + /** + * Creates a zone resource within a lake. + * + * The async variant is {@see DataplexServiceGapicClient::createZoneAsync()} . + * + * @example samples/V1/DataplexServiceClient/create_zone.php + * + * @param CreateZoneRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function createZone(CreateZoneRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('CreateZone', $request, $callOptions)->wait(); + } + + /** + * Deletes an asset resource. The referenced storage resource is detached + * (default) or deleted based on the associated Lifecycle policy. + * + * The async variant is {@see DataplexServiceGapicClient::deleteAssetAsync()} . + * + * @example samples/V1/DataplexServiceClient/delete_asset.php + * + * @param DeleteAssetRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function deleteAsset(DeleteAssetRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('DeleteAsset', $request, $callOptions)->wait(); + } + + /** + * Delete the environment resource. All the child resources must have been + * deleted before environment deletion can be initiated. + * + * The async variant is {@see DataplexServiceGapicClient::deleteEnvironmentAsync()} + * . + * + * @example samples/V1/DataplexServiceClient/delete_environment.php + * + * @param DeleteEnvironmentRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function deleteEnvironment(DeleteEnvironmentRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('DeleteEnvironment', $request, $callOptions)->wait(); + } + + /** + * Deletes a lake resource. All zones within the lake must be deleted before + * the lake can be deleted. + * + * The async variant is {@see DataplexServiceGapicClient::deleteLakeAsync()} . + * + * @example samples/V1/DataplexServiceClient/delete_lake.php + * + * @param DeleteLakeRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function deleteLake(DeleteLakeRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('DeleteLake', $request, $callOptions)->wait(); + } + + /** + * Delete the task resource. + * + * The async variant is {@see DataplexServiceGapicClient::deleteTaskAsync()} . + * + * @example samples/V1/DataplexServiceClient/delete_task.php + * + * @param DeleteTaskRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function deleteTask(DeleteTaskRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('DeleteTask', $request, $callOptions)->wait(); + } + + /** + * Deletes a zone resource. All assets within a zone must be deleted before + * the zone can be deleted. + * + * The async variant is {@see DataplexServiceGapicClient::deleteZoneAsync()} . + * + * @example samples/V1/DataplexServiceClient/delete_zone.php + * + * @param DeleteZoneRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function deleteZone(DeleteZoneRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('DeleteZone', $request, $callOptions)->wait(); + } + + /** + * Retrieves an asset resource. + * + * The async variant is {@see DataplexServiceGapicClient::getAssetAsync()} . + * + * @example samples/V1/DataplexServiceClient/get_asset.php + * + * @param GetAssetRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Asset + * + * @throws ApiException Thrown if the API call fails. + */ + public function getAsset(GetAssetRequest $request, array $callOptions = []): Asset + { + return $this->startApiCall('GetAsset', $request, $callOptions)->wait(); + } + + /** + * Get environment resource. + * + * The async variant is {@see DataplexServiceGapicClient::getEnvironmentAsync()} . + * + * @example samples/V1/DataplexServiceClient/get_environment.php + * + * @param GetEnvironmentRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Environment + * + * @throws ApiException Thrown if the API call fails. + */ + public function getEnvironment(GetEnvironmentRequest $request, array $callOptions = []): Environment + { + return $this->startApiCall('GetEnvironment', $request, $callOptions)->wait(); + } + + /** + * Get job resource. + * + * The async variant is {@see DataplexServiceGapicClient::getJobAsync()} . + * + * @example samples/V1/DataplexServiceClient/get_job.php + * + * @param GetJobRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Job + * + * @throws ApiException Thrown if the API call fails. + */ + public function getJob(GetJobRequest $request, array $callOptions = []): Job + { + return $this->startApiCall('GetJob', $request, $callOptions)->wait(); + } + + /** + * Retrieves a lake resource. + * + * The async variant is {@see DataplexServiceGapicClient::getLakeAsync()} . + * + * @example samples/V1/DataplexServiceClient/get_lake.php + * + * @param GetLakeRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Lake + * + * @throws ApiException Thrown if the API call fails. + */ + public function getLake(GetLakeRequest $request, array $callOptions = []): Lake + { + return $this->startApiCall('GetLake', $request, $callOptions)->wait(); + } + + /** + * Get task resource. + * + * The async variant is {@see DataplexServiceGapicClient::getTaskAsync()} . + * + * @example samples/V1/DataplexServiceClient/get_task.php + * + * @param GetTaskRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Task + * + * @throws ApiException Thrown if the API call fails. + */ + public function getTask(GetTaskRequest $request, array $callOptions = []): Task + { + return $this->startApiCall('GetTask', $request, $callOptions)->wait(); + } + + /** + * Retrieves a zone resource. + * + * The async variant is {@see DataplexServiceGapicClient::getZoneAsync()} . + * + * @example samples/V1/DataplexServiceClient/get_zone.php + * + * @param GetZoneRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Zone + * + * @throws ApiException Thrown if the API call fails. + */ + public function getZone(GetZoneRequest $request, array $callOptions = []): Zone + { + return $this->startApiCall('GetZone', $request, $callOptions)->wait(); + } + + /** + * Lists action resources in an asset. + * + * The async variant is {@see DataplexServiceGapicClient::listAssetActionsAsync()} + * . + * + * @example samples/V1/DataplexServiceClient/list_asset_actions.php + * + * @param ListAssetActionsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listAssetActions(ListAssetActionsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListAssetActions', $request, $callOptions); + } + + /** + * Lists asset resources in a zone. + * + * The async variant is {@see DataplexServiceGapicClient::listAssetsAsync()} . + * + * @example samples/V1/DataplexServiceClient/list_assets.php + * + * @param ListAssetsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listAssets(ListAssetsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListAssets', $request, $callOptions); + } + + /** + * Lists environments under the given lake. + * + * The async variant is {@see DataplexServiceGapicClient::listEnvironmentsAsync()} + * . + * + * @example samples/V1/DataplexServiceClient/list_environments.php + * + * @param ListEnvironmentsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listEnvironments(ListEnvironmentsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListEnvironments', $request, $callOptions); + } + + /** + * Lists Jobs under the given task. + * + * The async variant is {@see DataplexServiceGapicClient::listJobsAsync()} . + * + * @example samples/V1/DataplexServiceClient/list_jobs.php + * + * @param ListJobsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listJobs(ListJobsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListJobs', $request, $callOptions); + } + + /** + * Lists action resources in a lake. + * + * The async variant is {@see DataplexServiceGapicClient::listLakeActionsAsync()} . + * + * @example samples/V1/DataplexServiceClient/list_lake_actions.php + * + * @param ListLakeActionsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listLakeActions(ListLakeActionsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListLakeActions', $request, $callOptions); + } + + /** + * Lists lake resources in a project and location. + * + * The async variant is {@see DataplexServiceGapicClient::listLakesAsync()} . + * + * @example samples/V1/DataplexServiceClient/list_lakes.php + * + * @param ListLakesRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listLakes(ListLakesRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListLakes', $request, $callOptions); + } + + /** + * Lists session resources in an environment. + * + * The async variant is {@see DataplexServiceGapicClient::listSessionsAsync()} . + * + * @example samples/V1/DataplexServiceClient/list_sessions.php + * + * @param ListSessionsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listSessions(ListSessionsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListSessions', $request, $callOptions); + } + + /** + * Lists tasks under the given lake. + * + * The async variant is {@see DataplexServiceGapicClient::listTasksAsync()} . + * + * @example samples/V1/DataplexServiceClient/list_tasks.php + * + * @param ListTasksRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listTasks(ListTasksRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListTasks', $request, $callOptions); + } + + /** + * Lists action resources in a zone. + * + * The async variant is {@see DataplexServiceGapicClient::listZoneActionsAsync()} . + * + * @example samples/V1/DataplexServiceClient/list_zone_actions.php + * + * @param ListZoneActionsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listZoneActions(ListZoneActionsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListZoneActions', $request, $callOptions); + } + + /** + * Lists zone resources in a lake. + * + * The async variant is {@see DataplexServiceGapicClient::listZonesAsync()} . + * + * @example samples/V1/DataplexServiceClient/list_zones.php + * + * @param ListZonesRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listZones(ListZonesRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListZones', $request, $callOptions); + } + + /** + * Run an on demand execution of a Task. + * + * The async variant is {@see DataplexServiceGapicClient::runTaskAsync()} . + * + * @example samples/V1/DataplexServiceClient/run_task.php + * + * @param RunTaskRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return RunTaskResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function runTask(RunTaskRequest $request, array $callOptions = []): RunTaskResponse + { + return $this->startApiCall('RunTask', $request, $callOptions)->wait(); + } + + /** + * Updates an asset resource. + * + * The async variant is {@see DataplexServiceGapicClient::updateAssetAsync()} . + * + * @example samples/V1/DataplexServiceClient/update_asset.php + * + * @param UpdateAssetRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function updateAsset(UpdateAssetRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('UpdateAsset', $request, $callOptions)->wait(); + } + + /** + * Update the environment resource. + * + * The async variant is {@see DataplexServiceGapicClient::updateEnvironmentAsync()} + * . + * + * @example samples/V1/DataplexServiceClient/update_environment.php + * + * @param UpdateEnvironmentRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function updateEnvironment(UpdateEnvironmentRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('UpdateEnvironment', $request, $callOptions)->wait(); + } + + /** + * Updates a lake resource. + * + * The async variant is {@see DataplexServiceGapicClient::updateLakeAsync()} . + * + * @example samples/V1/DataplexServiceClient/update_lake.php + * + * @param UpdateLakeRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function updateLake(UpdateLakeRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('UpdateLake', $request, $callOptions)->wait(); + } + + /** + * Update the task resource. + * + * The async variant is {@see DataplexServiceGapicClient::updateTaskAsync()} . + * + * @example samples/V1/DataplexServiceClient/update_task.php + * + * @param UpdateTaskRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function updateTask(UpdateTaskRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('UpdateTask', $request, $callOptions)->wait(); + } + + /** + * Updates a zone resource. + * + * The async variant is {@see DataplexServiceGapicClient::updateZoneAsync()} . + * + * @example samples/V1/DataplexServiceClient/update_zone.php + * + * @param UpdateZoneRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function updateZone(UpdateZoneRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('UpdateZone', $request, $callOptions)->wait(); + } + + /** + * Gets the access control policy for a resource. Returns an empty policy + if the resource exists and does not have a policy set. + * + * The async variant is {@see DataplexServiceGapicClient::getIamPolicyAsync()} . + * + * @example samples/V1/DataplexServiceClient/get_iam_policy.php + * + * @param GetIamPolicyRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Policy + * + * @throws ApiException Thrown if the API call fails. + */ + public function getIamPolicy(GetIamPolicyRequest $request, array $callOptions = []): Policy + { + return $this->startApiCall('GetIamPolicy', $request, $callOptions)->wait(); + } + + /** + * Sets the access control policy on the specified resource. Replaces + any existing policy. + + Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` + errors. + * + * The async variant is {@see DataplexServiceGapicClient::setIamPolicyAsync()} . + * + * @example samples/V1/DataplexServiceClient/set_iam_policy.php + * + * @param SetIamPolicyRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Policy + * + * @throws ApiException Thrown if the API call fails. + */ + public function setIamPolicy(SetIamPolicyRequest $request, array $callOptions = []): Policy + { + return $this->startApiCall('SetIamPolicy', $request, $callOptions)->wait(); + } + + /** + * Returns permissions that a caller has on the specified resource. If the + resource does not exist, this will return an empty set of + permissions, not a `NOT_FOUND` error. + + Note: This operation is designed to be used for building + permission-aware UIs and command-line tools, not for authorization + checking. This operation may "fail open" without warning. + * + * The async variant is + * {@see DataplexServiceGapicClient::testIamPermissionsAsync()} . + * + * @example samples/V1/DataplexServiceClient/test_iam_permissions.php + * + * @param TestIamPermissionsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return TestIamPermissionsResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function testIamPermissions(TestIamPermissionsRequest $request, array $callOptions = []): TestIamPermissionsResponse + { + return $this->startApiCall('TestIamPermissions', $request, $callOptions)->wait(); + } + + /** + * Gets information about a location. + * + * The async variant is {@see DataplexServiceGapicClient::getLocationAsync()} . + * + * @example samples/V1/DataplexServiceClient/get_location.php + * + * @param GetLocationRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Location + * + * @throws ApiException Thrown if the API call fails. + */ + public function getLocation(GetLocationRequest $request, array $callOptions = []): Location + { + return $this->startApiCall('GetLocation', $request, $callOptions)->wait(); + } + + /** + * Lists information about the supported locations for this service. + * + * The async variant is {@see DataplexServiceGapicClient::listLocationsAsync()} . + * + * @example samples/V1/DataplexServiceClient/list_locations.php + * + * @param ListLocationsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listLocations(ListLocationsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListLocations', $request, $callOptions); + } } diff --git a/Dataplex/src/V1/Client/MetadataServiceClient.php b/Dataplex/src/V1/Client/MetadataServiceClient.php index b060943ee15c..3b840ac8bad0 100644 --- a/Dataplex/src/V1/Client/MetadataServiceClient.php +++ b/Dataplex/src/V1/Client/MetadataServiceClient.php @@ -24,17 +24,644 @@ namespace Google\Cloud\Dataplex\V1\Client; -use Google\Cloud\Dataplex\V1\Client\BaseClient\MetadataServiceBaseClient; +use Google\ApiCore\ApiException; +use Google\ApiCore\CredentialsWrapper; +use Google\ApiCore\GapicClientTrait; +use Google\ApiCore\PagedListResponse; +use Google\ApiCore\ResourceHelperTrait; +use Google\ApiCore\RetrySettings; +use Google\ApiCore\Transport\TransportInterface; +use Google\ApiCore\ValidationException; +use Google\Auth\FetchAuthTokenInterface; +use Google\Cloud\Dataplex\V1\CreateEntityRequest; +use Google\Cloud\Dataplex\V1\CreatePartitionRequest; +use Google\Cloud\Dataplex\V1\DeleteEntityRequest; +use Google\Cloud\Dataplex\V1\DeletePartitionRequest; +use Google\Cloud\Dataplex\V1\Entity; +use Google\Cloud\Dataplex\V1\GetEntityRequest; +use Google\Cloud\Dataplex\V1\GetPartitionRequest; +use Google\Cloud\Dataplex\V1\ListEntitiesRequest; +use Google\Cloud\Dataplex\V1\ListPartitionsRequest; +use Google\Cloud\Dataplex\V1\Partition; +use Google\Cloud\Dataplex\V1\UpdateEntityRequest; +use Google\Cloud\Iam\V1\GetIamPolicyRequest; +use Google\Cloud\Iam\V1\Policy; +use Google\Cloud\Iam\V1\SetIamPolicyRequest; +use Google\Cloud\Iam\V1\TestIamPermissionsRequest; +use Google\Cloud\Iam\V1\TestIamPermissionsResponse; +use Google\Cloud\Location\GetLocationRequest; +use Google\Cloud\Location\ListLocationsRequest; +use Google\Cloud\Location\Location; +use GuzzleHttp\Promise\PromiseInterface; /** - * {@inheritdoc} + * Service Description: Metadata service manages metadata resources such as tables, filesets and + * partitions. * - * This class is currently experimental and may be subject to changes. + * This class provides the ability to make remote calls to the backing service through method + * calls that map to API methods. + * + * Many parameters require resource names to be formatted in a particular way. To + * assist with these names, this class includes a format method for each type of + * name, and additionally a parseName method to extract the individual identifiers + * contained within formatted names that are returned by the API. + * + * This class is currently experimental and may be subject to changes. See {@see + * \Google\Cloud\Dataplex\V1\MetadataServiceClient} for the stable implementation * * @experimental + * + * @method PromiseInterface createEntityAsync(CreateEntityRequest $request, array $optionalArgs = []) + * @method PromiseInterface createPartitionAsync(CreatePartitionRequest $request, array $optionalArgs = []) + * @method PromiseInterface deleteEntityAsync(DeleteEntityRequest $request, array $optionalArgs = []) + * @method PromiseInterface deletePartitionAsync(DeletePartitionRequest $request, array $optionalArgs = []) + * @method PromiseInterface getEntityAsync(GetEntityRequest $request, array $optionalArgs = []) + * @method PromiseInterface getPartitionAsync(GetPartitionRequest $request, array $optionalArgs = []) + * @method PromiseInterface listEntitiesAsync(ListEntitiesRequest $request, array $optionalArgs = []) + * @method PromiseInterface listPartitionsAsync(ListPartitionsRequest $request, array $optionalArgs = []) + * @method PromiseInterface updateEntityAsync(UpdateEntityRequest $request, array $optionalArgs = []) + * @method PromiseInterface getIamPolicyAsync(GetIamPolicyRequest $request, array $optionalArgs = []) + * @method PromiseInterface setIamPolicyAsync(SetIamPolicyRequest $request, array $optionalArgs = []) + * @method PromiseInterface testIamPermissionsAsync(TestIamPermissionsRequest $request, array $optionalArgs = []) + * @method PromiseInterface getLocationAsync(GetLocationRequest $request, array $optionalArgs = []) + * @method PromiseInterface listLocationsAsync(ListLocationsRequest $request, array $optionalArgs = []) */ -final class MetadataServiceClient extends MetadataServiceBaseClient +final class MetadataServiceClient { - // This class is intentionally empty, and is intended to hold manual additions to - // the generated {@see MetadataServiceBaseClient} class. + use GapicClientTrait; + use ResourceHelperTrait; + + /** The name of the service. */ + private const SERVICE_NAME = 'google.cloud.dataplex.v1.MetadataService'; + + /** The default address of the service. */ + private const SERVICE_ADDRESS = 'dataplex.googleapis.com'; + + /** The default port of the service. */ + private const DEFAULT_SERVICE_PORT = 443; + + /** The name of the code generator, to be included in the agent header. */ + private const CODEGEN_NAME = 'gapic'; + + /** The default scopes required by the service. */ + public static $serviceScopes = [ + 'https://www.googleapis.com/auth/cloud-platform', + ]; + + private static function getClientDefaults() + { + return [ + 'serviceName' => self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/metadata_service_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/metadata_service_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/metadata_service_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/metadata_service_rest_client_config.php', + ], + ], + ]; + } + + /** + * Formats a string containing the fully-qualified path to represent a entity + * resource. + * + * @param string $project + * @param string $location + * @param string $lake + * @param string $zone + * @param string $entity + * + * @return string The formatted entity resource. + */ + public static function entityName(string $project, string $location, string $lake, string $zone, string $entity): string + { + return self::getPathTemplate('entity')->render([ + 'project' => $project, + 'location' => $location, + 'lake' => $lake, + 'zone' => $zone, + 'entity' => $entity, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a partition + * resource. + * + * @param string $project + * @param string $location + * @param string $lake + * @param string $zone + * @param string $entity + * @param string $partition + * + * @return string The formatted partition resource. + */ + public static function partitionName(string $project, string $location, string $lake, string $zone, string $entity, string $partition): string + { + return self::getPathTemplate('partition')->render([ + 'project' => $project, + 'location' => $location, + 'lake' => $lake, + 'zone' => $zone, + 'entity' => $entity, + 'partition' => $partition, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a zone + * resource. + * + * @param string $project + * @param string $location + * @param string $lake + * @param string $zone + * + * @return string The formatted zone resource. + */ + public static function zoneName(string $project, string $location, string $lake, string $zone): string + { + return self::getPathTemplate('zone')->render([ + 'project' => $project, + 'location' => $location, + 'lake' => $lake, + 'zone' => $zone, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - entity: projects/{project}/locations/{location}/lakes/{lake}/zones/{zone}/entities/{entity} + * - partition: projects/{project}/locations/{location}/lakes/{lake}/zones/{zone}/entities/{entity}/partitions/{partition} + * - zone: projects/{project}/locations/{location}/lakes/{lake}/zones/{zone} + * + * 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 $template argument does not match one of the templates + * listed, then parseName will check each of the supported templates, and return + * the first match. + * + * @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. + * + * @throws ValidationException If $formattedName could not be matched. + */ + public static function parseName(string $formattedName, string $template = null): array + { + return self::parseFormattedName($formattedName, $template); + } + + /** + * Constructor. + * + * @param array $options { + * Optional. Options for configuring the service API wrapper. + * + * @type string $apiEndpoint + * The address of the API remote host. May optionally include the port, formatted + * as ":". Default 'dataplex.googleapis.com:443'. + * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials + * The credentials to be used by the client to authorize API calls. This option + * accepts either a path to a credentials file, or a decoded credentials file as a + * PHP array. + * *Advanced usage*: In addition, this option can also accept a pre-constructed + * {@see \Google\Auth\FetchAuthTokenInterface} object or + * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these + * objects are provided, any settings in $credentialsConfig will be ignored. + * @type array $credentialsConfig + * Options used to configure credentials, including auth token caching, for the + * client. For a full list of supporting configuration options, see + * {@see \Google\ApiCore\CredentialsWrapper::build()} . + * @type bool $disableRetries + * Determines whether or not retries defined by the client configuration should be + * disabled. Defaults to `false`. + * @type string|array $clientConfig + * Client method configuration, including retry settings. This option can be either + * a path to a JSON file, or a PHP array containing the decoded JSON data. By + * default this settings points to the default client config file, which is + * provided in the resources folder. + * @type string|TransportInterface $transport + * The transport used for executing network requests. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *Advanced usage*: Additionally, it is possible to pass in an already + * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note + * that when this object is provided, any settings in $transportConfig, and any + * $apiEndpoint setting, will be ignored. + * @type array $transportConfig + * Configuration options that will be used to construct the transport. Options for + * each supported transport type should be passed in a key for that transport. For + * example: + * $transportConfig = [ + * 'grpc' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the + * supported options. + * @type callable $clientCertSource + * A callable which returns the client cert as a string. This can be used to + * provide a certificate and private key to the transport layer for mTLS. + * } + * + * @throws ValidationException + */ + public function __construct(array $options = []) + { + $clientOptions = $this->buildClientOptions($options); + $this->setClientOptions($clientOptions); + } + + /** Handles execution of the async variants for each documented method. */ + public function __call($method, $args) + { + if (substr($method, -5) !== 'Async') { + trigger_error('Call to undefined method ' . __CLASS__ . "::$method()", E_USER_ERROR); + } + + array_unshift($args, substr($method, 0, -5)); + return call_user_func_array([$this, 'startAsyncCall'], $args); + } + + /** + * Create a metadata entity. + * + * The async variant is {@see MetadataServiceGapicClient::createEntityAsync()} . + * + * @example samples/V1/MetadataServiceClient/create_entity.php + * + * @param CreateEntityRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Entity + * + * @throws ApiException Thrown if the API call fails. + */ + public function createEntity(CreateEntityRequest $request, array $callOptions = []): Entity + { + return $this->startApiCall('CreateEntity', $request, $callOptions)->wait(); + } + + /** + * Create a metadata partition. + * + * The async variant is {@see MetadataServiceGapicClient::createPartitionAsync()} . + * + * @example samples/V1/MetadataServiceClient/create_partition.php + * + * @param CreatePartitionRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Partition + * + * @throws ApiException Thrown if the API call fails. + */ + public function createPartition(CreatePartitionRequest $request, array $callOptions = []): Partition + { + return $this->startApiCall('CreatePartition', $request, $callOptions)->wait(); + } + + /** + * Delete a metadata entity. + * + * The async variant is {@see MetadataServiceGapicClient::deleteEntityAsync()} . + * + * @example samples/V1/MetadataServiceClient/delete_entity.php + * + * @param DeleteEntityRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @throws ApiException Thrown if the API call fails. + */ + public function deleteEntity(DeleteEntityRequest $request, array $callOptions = []): void + { + $this->startApiCall('DeleteEntity', $request, $callOptions)->wait(); + } + + /** + * Delete a metadata partition. + * + * The async variant is {@see MetadataServiceGapicClient::deletePartitionAsync()} . + * + * @example samples/V1/MetadataServiceClient/delete_partition.php + * + * @param DeletePartitionRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @throws ApiException Thrown if the API call fails. + */ + public function deletePartition(DeletePartitionRequest $request, array $callOptions = []): void + { + $this->startApiCall('DeletePartition', $request, $callOptions)->wait(); + } + + /** + * Get a metadata entity. + * + * The async variant is {@see MetadataServiceGapicClient::getEntityAsync()} . + * + * @example samples/V1/MetadataServiceClient/get_entity.php + * + * @param GetEntityRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Entity + * + * @throws ApiException Thrown if the API call fails. + */ + public function getEntity(GetEntityRequest $request, array $callOptions = []): Entity + { + return $this->startApiCall('GetEntity', $request, $callOptions)->wait(); + } + + /** + * Get a metadata partition of an entity. + * + * The async variant is {@see MetadataServiceGapicClient::getPartitionAsync()} . + * + * @example samples/V1/MetadataServiceClient/get_partition.php + * + * @param GetPartitionRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Partition + * + * @throws ApiException Thrown if the API call fails. + */ + public function getPartition(GetPartitionRequest $request, array $callOptions = []): Partition + { + return $this->startApiCall('GetPartition', $request, $callOptions)->wait(); + } + + /** + * List metadata entities in a zone. + * + * The async variant is {@see MetadataServiceGapicClient::listEntitiesAsync()} . + * + * @example samples/V1/MetadataServiceClient/list_entities.php + * + * @param ListEntitiesRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listEntities(ListEntitiesRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListEntities', $request, $callOptions); + } + + /** + * List metadata partitions of an entity. + * + * The async variant is {@see MetadataServiceGapicClient::listPartitionsAsync()} . + * + * @example samples/V1/MetadataServiceClient/list_partitions.php + * + * @param ListPartitionsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listPartitions(ListPartitionsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListPartitions', $request, $callOptions); + } + + /** + * Update a metadata entity. Only supports full resource update. + * + * The async variant is {@see MetadataServiceGapicClient::updateEntityAsync()} . + * + * @example samples/V1/MetadataServiceClient/update_entity.php + * + * @param UpdateEntityRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Entity + * + * @throws ApiException Thrown if the API call fails. + */ + public function updateEntity(UpdateEntityRequest $request, array $callOptions = []): Entity + { + return $this->startApiCall('UpdateEntity', $request, $callOptions)->wait(); + } + + /** + * Gets the access control policy for a resource. Returns an empty policy + if the resource exists and does not have a policy set. + * + * The async variant is {@see MetadataServiceGapicClient::getIamPolicyAsync()} . + * + * @example samples/V1/MetadataServiceClient/get_iam_policy.php + * + * @param GetIamPolicyRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Policy + * + * @throws ApiException Thrown if the API call fails. + */ + public function getIamPolicy(GetIamPolicyRequest $request, array $callOptions = []): Policy + { + return $this->startApiCall('GetIamPolicy', $request, $callOptions)->wait(); + } + + /** + * Sets the access control policy on the specified resource. Replaces + any existing policy. + + Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` + errors. + * + * The async variant is {@see MetadataServiceGapicClient::setIamPolicyAsync()} . + * + * @example samples/V1/MetadataServiceClient/set_iam_policy.php + * + * @param SetIamPolicyRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Policy + * + * @throws ApiException Thrown if the API call fails. + */ + public function setIamPolicy(SetIamPolicyRequest $request, array $callOptions = []): Policy + { + return $this->startApiCall('SetIamPolicy', $request, $callOptions)->wait(); + } + + /** + * Returns permissions that a caller has on the specified resource. If the + resource does not exist, this will return an empty set of + permissions, not a `NOT_FOUND` error. + + Note: This operation is designed to be used for building + permission-aware UIs and command-line tools, not for authorization + checking. This operation may "fail open" without warning. + * + * The async variant is + * {@see MetadataServiceGapicClient::testIamPermissionsAsync()} . + * + * @example samples/V1/MetadataServiceClient/test_iam_permissions.php + * + * @param TestIamPermissionsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return TestIamPermissionsResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function testIamPermissions(TestIamPermissionsRequest $request, array $callOptions = []): TestIamPermissionsResponse + { + return $this->startApiCall('TestIamPermissions', $request, $callOptions)->wait(); + } + + /** + * Gets information about a location. + * + * The async variant is {@see MetadataServiceGapicClient::getLocationAsync()} . + * + * @example samples/V1/MetadataServiceClient/get_location.php + * + * @param GetLocationRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Location + * + * @throws ApiException Thrown if the API call fails. + */ + public function getLocation(GetLocationRequest $request, array $callOptions = []): Location + { + return $this->startApiCall('GetLocation', $request, $callOptions)->wait(); + } + + /** + * Lists information about the supported locations for this service. + * + * The async variant is {@see MetadataServiceGapicClient::listLocationsAsync()} . + * + * @example samples/V1/MetadataServiceClient/list_locations.php + * + * @param ListLocationsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listLocations(ListLocationsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListLocations', $request, $callOptions); + } } diff --git a/Dataplex/src/V1/DataQualityDimension.php b/Dataplex/src/V1/DataQualityDimension.php new file mode 100644 index 000000000000..cce04568241c --- /dev/null +++ b/Dataplex/src/V1/DataQualityDimension.php @@ -0,0 +1,76 @@ +google.cloud.dataplex.v1.DataQualityDimension + */ +class DataQualityDimension extends \Google\Protobuf\Internal\Message +{ + /** + * The dimension name a rule belongs to. Supported dimensions are + * ["COMPLETENESS", "ACCURACY", "CONSISTENCY", "VALIDITY", "UNIQUENESS", + * "INTEGRITY"] + * + * Generated from protobuf field string name = 1; + */ + private $name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The dimension name a rule belongs to. Supported dimensions are + * ["COMPLETENESS", "ACCURACY", "CONSISTENCY", "VALIDITY", "UNIQUENESS", + * "INTEGRITY"] + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dataplex\V1\DataQuality::initOnce(); + parent::__construct($data); + } + + /** + * The dimension name a rule belongs to. Supported dimensions are + * ["COMPLETENESS", "ACCURACY", "CONSISTENCY", "VALIDITY", "UNIQUENESS", + * "INTEGRITY"] + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The dimension name a rule belongs to. Supported dimensions are + * ["COMPLETENESS", "ACCURACY", "CONSISTENCY", "VALIDITY", "UNIQUENESS", + * "INTEGRITY"] + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/Dataplex/src/V1/DataQualityDimensionResult.php b/Dataplex/src/V1/DataQualityDimensionResult.php index 22172600650b..2b46cd07c939 100644 --- a/Dataplex/src/V1/DataQualityDimensionResult.php +++ b/Dataplex/src/V1/DataQualityDimensionResult.php @@ -16,6 +16,12 @@ */ class DataQualityDimensionResult extends \Google\Protobuf\Internal\Message { + /** + * Output only. The dimension config specified in the DataQualitySpec, as is. + * + * Generated from protobuf field .google.cloud.dataplex.v1.DataQualityDimension dimension = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $dimension = null; /** * Whether the dimension passed or failed. * @@ -29,6 +35,8 @@ class DataQualityDimensionResult extends \Google\Protobuf\Internal\Message * @param array $data { * Optional. Data for populating the Message object. * + * @type \Google\Cloud\Dataplex\V1\DataQualityDimension $dimension + * Output only. The dimension config specified in the DataQualitySpec, as is. * @type bool $passed * Whether the dimension passed or failed. * } @@ -38,6 +46,42 @@ public function __construct($data = NULL) { parent::__construct($data); } + /** + * Output only. The dimension config specified in the DataQualitySpec, as is. + * + * Generated from protobuf field .google.cloud.dataplex.v1.DataQualityDimension dimension = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Cloud\Dataplex\V1\DataQualityDimension|null + */ + public function getDimension() + { + return $this->dimension; + } + + public function hasDimension() + { + return isset($this->dimension); + } + + public function clearDimension() + { + unset($this->dimension); + } + + /** + * Output only. The dimension config specified in the DataQualitySpec, as is. + * + * Generated from protobuf field .google.cloud.dataplex.v1.DataQualityDimension dimension = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Cloud\Dataplex\V1\DataQualityDimension $var + * @return $this + */ + public function setDimension($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dataplex\V1\DataQualityDimension::class); + $this->dimension = $var; + + return $this; + } + /** * Whether the dimension passed or failed. *