Reference documentation and code samples for the Google Cloud Discovery Engine V1beta Client class SiteSearchEngineServiceClient.
Service Description: Service for managing site search related resources.
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.
Namespace
Google \ Cloud \ DiscoveryEngine \ V1beta \ ClientMethods
__construct
Constructor.
Parameters | |
---|---|
Name | Description |
options |
array
Optional. Options for configuring the service API wrapper. |
↳ apiEndpoint |
string
The address of the API remote host. May optionally include the port, formatted as "
|
↳ credentials |
string|array|FetchAuthTokenInterface|CredentialsWrapper
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 Google\Auth\FetchAuthTokenInterface object or Google\ApiCore\CredentialsWrapper object. Note that when one of these objects are provided, any settings in $credentialsConfig will be ignored. |
↳ credentialsConfig |
array
Options used to configure credentials, including auth token caching, for the client. For a full list of supporting configuration options, see Google\ApiCore\CredentialsWrapper::build() . |
↳ disableRetries |
bool
Determines whether or not retries defined by the client configuration should be disabled. Defaults to |
↳ clientConfig |
string|array
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. |
↳ transport |
string|TransportInterface
The transport used for executing network requests. May be either the string |
↳ transportConfig |
array
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 Google\ApiCore\Transport\GrpcTransport::build() and Google\ApiCore\Transport\RestTransport::build() methods for the supported options. |
↳ clientCertSource |
callable
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. |
batchCreateTargetSites
Creates TargetSite in a batch.
The async variant is Google\Cloud\DiscoveryEngine\V1beta\Client\SiteSearchEngineServiceClient::batchCreateTargetSitesAsync() .
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\DiscoveryEngine\V1beta\BatchCreateTargetSitesRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\ApiCore\OperationResponse |
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\DiscoveryEngine\V1beta\BatchCreateTargetSitesRequest;
use Google\Cloud\DiscoveryEngine\V1beta\BatchCreateTargetSitesResponse;
use Google\Cloud\DiscoveryEngine\V1beta\Client\SiteSearchEngineServiceClient;
use Google\Cloud\DiscoveryEngine\V1beta\CreateTargetSiteRequest;
use Google\Cloud\DiscoveryEngine\V1beta\TargetSite;
use Google\Rpc\Status;
/**
* @param string $formattedParent The parent resource shared by all TargetSites being created.
* `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/siteSearchEngine`.
* The parent field in the CreateBookRequest messages must either be empty or
* match this field. Please see
* {@see SiteSearchEngineServiceClient::siteSearchEngineName()} for help formatting this field.
* @param string $formattedRequestsParent Parent resource name of
* [TargetSite][google.cloud.discoveryengine.v1beta.TargetSite], such as
* `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/siteSearchEngine`. Please see
* {@see SiteSearchEngineServiceClient::siteSearchEngineName()} for help formatting this field.
* @param string $requestsTargetSiteProvidedUriPattern Input only. The user provided URI pattern from which the
* `generated_uri_pattern` is generated.
*/
function batch_create_target_sites_sample(
string $formattedParent,
string $formattedRequestsParent,
string $requestsTargetSiteProvidedUriPattern
): void {
// Create a client.
$siteSearchEngineServiceClient = new SiteSearchEngineServiceClient();
// Prepare the request message.
$requestsTargetSite = (new TargetSite())
->setProvidedUriPattern($requestsTargetSiteProvidedUriPattern);
$createTargetSiteRequest = (new CreateTargetSiteRequest())
->setParent($formattedRequestsParent)
->setTargetSite($requestsTargetSite);
$requests = [$createTargetSiteRequest,];
$request = (new BatchCreateTargetSitesRequest())
->setParent($formattedParent)
->setRequests($requests);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $siteSearchEngineServiceClient->batchCreateTargetSites($request);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
/** @var BatchCreateTargetSitesResponse $result */
$result = $response->getResult();
printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
} else {
/** @var Status $error */
$error = $response->getError();
printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
}
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedParent = SiteSearchEngineServiceClient::siteSearchEngineName(
'[PROJECT]',
'[LOCATION]',
'[DATA_STORE]'
);
$formattedRequestsParent = SiteSearchEngineServiceClient::siteSearchEngineName(
'[PROJECT]',
'[LOCATION]',
'[DATA_STORE]'
);
$requestsTargetSiteProvidedUriPattern = '[PROVIDED_URI_PATTERN]';
batch_create_target_sites_sample(
$formattedParent,
$formattedRequestsParent,
$requestsTargetSiteProvidedUriPattern
);
}
batchVerifyTargetSites
Verify target sites' ownership and validity.
This API sends all the target sites under site search engine for verification.
The async variant is Google\Cloud\DiscoveryEngine\V1beta\Client\SiteSearchEngineServiceClient::batchVerifyTargetSitesAsync() .
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\DiscoveryEngine\V1beta\BatchVerifyTargetSitesRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\ApiCore\OperationResponse |
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\DiscoveryEngine\V1beta\BatchVerifyTargetSitesRequest;
use Google\Cloud\DiscoveryEngine\V1beta\BatchVerifyTargetSitesResponse;
use Google\Cloud\DiscoveryEngine\V1beta\Client\SiteSearchEngineServiceClient;
use Google\Rpc\Status;
/**
* @param string $formattedParent The parent resource shared by all TargetSites being verified.
* `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/siteSearchEngine`. Please see
* {@see SiteSearchEngineServiceClient::siteSearchEngineName()} for help formatting this field.
*/
function batch_verify_target_sites_sample(string $formattedParent): void
{
// Create a client.
$siteSearchEngineServiceClient = new SiteSearchEngineServiceClient();
// Prepare the request message.
$request = (new BatchVerifyTargetSitesRequest())
->setParent($formattedParent);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $siteSearchEngineServiceClient->batchVerifyTargetSites($request);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
/** @var BatchVerifyTargetSitesResponse $result */
$result = $response->getResult();
printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
} else {
/** @var Status $error */
$error = $response->getError();
printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
}
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedParent = SiteSearchEngineServiceClient::siteSearchEngineName(
'[PROJECT]',
'[LOCATION]',
'[DATA_STORE]'
);
batch_verify_target_sites_sample($formattedParent);
}
createTargetSite
Creates a TargetSite.
The async variant is Google\Cloud\DiscoveryEngine\V1beta\Client\SiteSearchEngineServiceClient::createTargetSiteAsync() .
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\DiscoveryEngine\V1beta\CreateTargetSiteRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\ApiCore\OperationResponse |
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\DiscoveryEngine\V1beta\Client\SiteSearchEngineServiceClient;
use Google\Cloud\DiscoveryEngine\V1beta\CreateTargetSiteRequest;
use Google\Cloud\DiscoveryEngine\V1beta\TargetSite;
use Google\Rpc\Status;
/**
* @param string $formattedParent Parent resource name of
* [TargetSite][google.cloud.discoveryengine.v1beta.TargetSite], such as
* `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/siteSearchEngine`. Please see
* {@see SiteSearchEngineServiceClient::siteSearchEngineName()} for help formatting this field.
* @param string $targetSiteProvidedUriPattern Input only. The user provided URI pattern from which the
* `generated_uri_pattern` is generated.
*/
function create_target_site_sample(
string $formattedParent,
string $targetSiteProvidedUriPattern
): void {
// Create a client.
$siteSearchEngineServiceClient = new SiteSearchEngineServiceClient();
// Prepare the request message.
$targetSite = (new TargetSite())
->setProvidedUriPattern($targetSiteProvidedUriPattern);
$request = (new CreateTargetSiteRequest())
->setParent($formattedParent)
->setTargetSite($targetSite);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $siteSearchEngineServiceClient->createTargetSite($request);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
/** @var TargetSite $result */
$result = $response->getResult();
printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
} else {
/** @var Status $error */
$error = $response->getError();
printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
}
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedParent = SiteSearchEngineServiceClient::siteSearchEngineName(
'[PROJECT]',
'[LOCATION]',
'[DATA_STORE]'
);
$targetSiteProvidedUriPattern = '[PROVIDED_URI_PATTERN]';
create_target_site_sample($formattedParent, $targetSiteProvidedUriPattern);
}
deleteTargetSite
Deletes a TargetSite.
The async variant is Google\Cloud\DiscoveryEngine\V1beta\Client\SiteSearchEngineServiceClient::deleteTargetSiteAsync() .
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\DiscoveryEngine\V1beta\DeleteTargetSiteRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\ApiCore\OperationResponse |
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\DiscoveryEngine\V1beta\Client\SiteSearchEngineServiceClient;
use Google\Cloud\DiscoveryEngine\V1beta\DeleteTargetSiteRequest;
use Google\Rpc\Status;
/**
* @param string $formattedName Full resource name of
* [TargetSite][google.cloud.discoveryengine.v1beta.TargetSite], such as
* `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/siteSearchEngine/targetSites/{target_site}`.
*
* If the caller does not have permission to access the
* [TargetSite][google.cloud.discoveryengine.v1beta.TargetSite], regardless of
* whether or not it exists, a PERMISSION_DENIED error is returned.
*
* If the requested
* [TargetSite][google.cloud.discoveryengine.v1beta.TargetSite] does not
* exist, a NOT_FOUND error is returned. Please see
* {@see SiteSearchEngineServiceClient::targetSiteName()} for help formatting this field.
*/
function delete_target_site_sample(string $formattedName): void
{
// Create a client.
$siteSearchEngineServiceClient = new SiteSearchEngineServiceClient();
// Prepare the request message.
$request = (new DeleteTargetSiteRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $siteSearchEngineServiceClient->deleteTargetSite($request);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
printf('Operation completed successfully.' . PHP_EOL);
} else {
/** @var Status $error */
$error = $response->getError();
printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
}
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedName = SiteSearchEngineServiceClient::targetSiteName(
'[PROJECT]',
'[LOCATION]',
'[DATA_STORE]',
'[TARGET_SITE]'
);
delete_target_site_sample($formattedName);
}
disableAdvancedSiteSearch
Downgrade from advanced site search to basic site search.
The async variant is Google\Cloud\DiscoveryEngine\V1beta\Client\SiteSearchEngineServiceClient::disableAdvancedSiteSearchAsync() .
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\DiscoveryEngine\V1beta\DisableAdvancedSiteSearchRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\ApiCore\OperationResponse |
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\DiscoveryEngine\V1beta\Client\SiteSearchEngineServiceClient;
use Google\Cloud\DiscoveryEngine\V1beta\DisableAdvancedSiteSearchRequest;
use Google\Cloud\DiscoveryEngine\V1beta\DisableAdvancedSiteSearchResponse;
use Google\Rpc\Status;
/**
* @param string $formattedSiteSearchEngine Full resource name of the
* [SiteSearchEngine][google.cloud.discoveryengine.v1beta.SiteSearchEngine],
* such as
* `projects/{project}/locations/{location}/dataStores/{data_store_id}/siteSearchEngine`. Please see
* {@see SiteSearchEngineServiceClient::siteSearchEngineName()} for help formatting this field.
*/
function disable_advanced_site_search_sample(string $formattedSiteSearchEngine): void
{
// Create a client.
$siteSearchEngineServiceClient = new SiteSearchEngineServiceClient();
// Prepare the request message.
$request = (new DisableAdvancedSiteSearchRequest())
->setSiteSearchEngine($formattedSiteSearchEngine);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $siteSearchEngineServiceClient->disableAdvancedSiteSearch($request);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
/** @var DisableAdvancedSiteSearchResponse $result */
$result = $response->getResult();
printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
} else {
/** @var Status $error */
$error = $response->getError();
printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
}
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedSiteSearchEngine = SiteSearchEngineServiceClient::siteSearchEngineName(
'[PROJECT]',
'[LOCATION]',
'[DATA_STORE]'
);
disable_advanced_site_search_sample($formattedSiteSearchEngine);
}
enableAdvancedSiteSearch
Upgrade from basic site search to advanced site search.
The async variant is Google\Cloud\DiscoveryEngine\V1beta\Client\SiteSearchEngineServiceClient::enableAdvancedSiteSearchAsync() .
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\DiscoveryEngine\V1beta\EnableAdvancedSiteSearchRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\ApiCore\OperationResponse |
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\DiscoveryEngine\V1beta\Client\SiteSearchEngineServiceClient;
use Google\Cloud\DiscoveryEngine\V1beta\EnableAdvancedSiteSearchRequest;
use Google\Cloud\DiscoveryEngine\V1beta\EnableAdvancedSiteSearchResponse;
use Google\Rpc\Status;
/**
* @param string $formattedSiteSearchEngine Full resource name of the
* [SiteSearchEngine][google.cloud.discoveryengine.v1beta.SiteSearchEngine],
* such as
* `projects/{project}/locations/{location}/dataStores/{data_store_id}/siteSearchEngine`. Please see
* {@see SiteSearchEngineServiceClient::siteSearchEngineName()} for help formatting this field.
*/
function enable_advanced_site_search_sample(string $formattedSiteSearchEngine): void
{
// Create a client.
$siteSearchEngineServiceClient = new SiteSearchEngineServiceClient();
// Prepare the request message.
$request = (new EnableAdvancedSiteSearchRequest())
->setSiteSearchEngine($formattedSiteSearchEngine);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $siteSearchEngineServiceClient->enableAdvancedSiteSearch($request);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
/** @var EnableAdvancedSiteSearchResponse $result */
$result = $response->getResult();
printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
} else {
/** @var Status $error */
$error = $response->getError();
printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
}
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedSiteSearchEngine = SiteSearchEngineServiceClient::siteSearchEngineName(
'[PROJECT]',
'[LOCATION]',
'[DATA_STORE]'
);
enable_advanced_site_search_sample($formattedSiteSearchEngine);
}
fetchDomainVerificationStatus
Returns list of target sites with its domain verification status.
This method can only be called under data store with BASIC_SITE_SEARCH state at the moment.
The async variant is Google\Cloud\DiscoveryEngine\V1beta\Client\SiteSearchEngineServiceClient::fetchDomainVerificationStatusAsync() .
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\DiscoveryEngine\V1beta\FetchDomainVerificationStatusRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\ApiCore\PagedListResponse |
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\DiscoveryEngine\V1beta\Client\SiteSearchEngineServiceClient;
use Google\Cloud\DiscoveryEngine\V1beta\FetchDomainVerificationStatusRequest;
use Google\Cloud\DiscoveryEngine\V1beta\TargetSite;
/**
* @param string $formattedSiteSearchEngine The site search engine resource under which we fetch all the
* domain verification status.
* `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/siteSearchEngine`. Please see
* {@see SiteSearchEngineServiceClient::siteSearchEngineName()} for help formatting this field.
*/
function fetch_domain_verification_status_sample(string $formattedSiteSearchEngine): void
{
// Create a client.
$siteSearchEngineServiceClient = new SiteSearchEngineServiceClient();
// Prepare the request message.
$request = (new FetchDomainVerificationStatusRequest())
->setSiteSearchEngine($formattedSiteSearchEngine);
// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $siteSearchEngineServiceClient->fetchDomainVerificationStatus($request);
/** @var TargetSite $element */
foreach ($response as $element) {
printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
}
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedSiteSearchEngine = SiteSearchEngineServiceClient::siteSearchEngineName(
'[PROJECT]',
'[LOCATION]',
'[DATA_STORE]'
);
fetch_domain_verification_status_sample($formattedSiteSearchEngine);
}
getSiteSearchEngine
Gets the SiteSearchEngine.
The async variant is Google\Cloud\DiscoveryEngine\V1beta\Client\SiteSearchEngineServiceClient::getSiteSearchEngineAsync() .
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\DiscoveryEngine\V1beta\GetSiteSearchEngineRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\Cloud\DiscoveryEngine\V1beta\SiteSearchEngine |
use Google\ApiCore\ApiException;
use Google\Cloud\DiscoveryEngine\V1beta\Client\SiteSearchEngineServiceClient;
use Google\Cloud\DiscoveryEngine\V1beta\GetSiteSearchEngineRequest;
use Google\Cloud\DiscoveryEngine\V1beta\SiteSearchEngine;
/**
* @param string $formattedName Resource name of
* [SiteSearchEngine][google.cloud.discoveryengine.v1beta.SiteSearchEngine],
* such as
* `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/siteSearchEngine`.
*
* If the caller does not have permission to access the [SiteSearchEngine],
* regardless of whether or not it exists, a PERMISSION_DENIED error is
* returned. Please see
* {@see SiteSearchEngineServiceClient::siteSearchEngineName()} for help formatting this field.
*/
function get_site_search_engine_sample(string $formattedName): void
{
// Create a client.
$siteSearchEngineServiceClient = new SiteSearchEngineServiceClient();
// Prepare the request message.
$request = (new GetSiteSearchEngineRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
/** @var SiteSearchEngine $response */
$response = $siteSearchEngineServiceClient->getSiteSearchEngine($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedName = SiteSearchEngineServiceClient::siteSearchEngineName(
'[PROJECT]',
'[LOCATION]',
'[DATA_STORE]'
);
get_site_search_engine_sample($formattedName);
}
getTargetSite
Gets a TargetSite.
The async variant is Google\Cloud\DiscoveryEngine\V1beta\Client\SiteSearchEngineServiceClient::getTargetSiteAsync() .
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\DiscoveryEngine\V1beta\GetTargetSiteRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\Cloud\DiscoveryEngine\V1beta\TargetSite |
use Google\ApiCore\ApiException;
use Google\Cloud\DiscoveryEngine\V1beta\Client\SiteSearchEngineServiceClient;
use Google\Cloud\DiscoveryEngine\V1beta\GetTargetSiteRequest;
use Google\Cloud\DiscoveryEngine\V1beta\TargetSite;
/**
* @param string $formattedName Full resource name of
* [TargetSite][google.cloud.discoveryengine.v1beta.TargetSite], such as
* `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/siteSearchEngine/targetSites/{target_site}`.
*
* If the caller does not have permission to access the
* [TargetSite][google.cloud.discoveryengine.v1beta.TargetSite], regardless of
* whether or not it exists, a PERMISSION_DENIED error is returned.
*
* If the requested
* [TargetSite][google.cloud.discoveryengine.v1beta.TargetSite] does not
* exist, a NOT_FOUND error is returned. Please see
* {@see SiteSearchEngineServiceClient::targetSiteName()} for help formatting this field.
*/
function get_target_site_sample(string $formattedName): void
{
// Create a client.
$siteSearchEngineServiceClient = new SiteSearchEngineServiceClient();
// Prepare the request message.
$request = (new GetTargetSiteRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
/** @var TargetSite $response */
$response = $siteSearchEngineServiceClient->getTargetSite($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedName = SiteSearchEngineServiceClient::targetSiteName(
'[PROJECT]',
'[LOCATION]',
'[DATA_STORE]',
'[TARGET_SITE]'
);
get_target_site_sample($formattedName);
}
listTargetSites
Gets a list of TargetSites.
The async variant is Google\Cloud\DiscoveryEngine\V1beta\Client\SiteSearchEngineServiceClient::listTargetSitesAsync() .
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\DiscoveryEngine\V1beta\ListTargetSitesRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\ApiCore\PagedListResponse |
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\DiscoveryEngine\V1beta\Client\SiteSearchEngineServiceClient;
use Google\Cloud\DiscoveryEngine\V1beta\ListTargetSitesRequest;
use Google\Cloud\DiscoveryEngine\V1beta\TargetSite;
/**
* @param string $formattedParent The parent site search engine resource name, such as
* `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/siteSearchEngine`.
*
* If the caller does not have permission to list
* [TargetSite][google.cloud.discoveryengine.v1beta.TargetSite]s under this
* site search engine, regardless of whether or not this branch exists, a
* PERMISSION_DENIED error is returned. Please see
* {@see SiteSearchEngineServiceClient::siteSearchEngineName()} for help formatting this field.
*/
function list_target_sites_sample(string $formattedParent): void
{
// Create a client.
$siteSearchEngineServiceClient = new SiteSearchEngineServiceClient();
// Prepare the request message.
$request = (new ListTargetSitesRequest())
->setParent($formattedParent);
// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $siteSearchEngineServiceClient->listTargetSites($request);
/** @var TargetSite $element */
foreach ($response as $element) {
printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
}
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedParent = SiteSearchEngineServiceClient::siteSearchEngineName(
'[PROJECT]',
'[LOCATION]',
'[DATA_STORE]'
);
list_target_sites_sample($formattedParent);
}
recrawlUris
Request on-demand recrawl for a list of URIs.
The async variant is Google\Cloud\DiscoveryEngine\V1beta\Client\SiteSearchEngineServiceClient::recrawlUrisAsync() .
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\DiscoveryEngine\V1beta\RecrawlUrisRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\ApiCore\OperationResponse |
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\DiscoveryEngine\V1beta\Client\SiteSearchEngineServiceClient;
use Google\Cloud\DiscoveryEngine\V1beta\RecrawlUrisRequest;
use Google\Cloud\DiscoveryEngine\V1beta\RecrawlUrisResponse;
use Google\Rpc\Status;
/**
* @param string $formattedSiteSearchEngine Full resource name of the
* [SiteSearchEngine][google.cloud.discoveryengine.v1beta.SiteSearchEngine],
* such as
* `projects/*/locations/*/collections/*/dataStores/*/siteSearchEngine`. Please see
* {@see SiteSearchEngineServiceClient::siteSearchEngineName()} for help formatting this field.
* @param string $urisElement List of URIs to crawl. At most 10K URIs are supported, otherwise
* an INVALID_ARGUMENT error is thrown. Each URI should match at least one
* [TargetSite][google.cloud.discoveryengine.v1beta.TargetSite] in
* `site_search_engine`.
*/
function recrawl_uris_sample(string $formattedSiteSearchEngine, string $urisElement): void
{
// Create a client.
$siteSearchEngineServiceClient = new SiteSearchEngineServiceClient();
// Prepare the request message.
$uris = [$urisElement,];
$request = (new RecrawlUrisRequest())
->setSiteSearchEngine($formattedSiteSearchEngine)
->setUris($uris);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $siteSearchEngineServiceClient->recrawlUris($request);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
/** @var RecrawlUrisResponse $result */
$result = $response->getResult();
printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
} else {
/** @var Status $error */
$error = $response->getError();
printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
}
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedSiteSearchEngine = SiteSearchEngineServiceClient::siteSearchEngineName(
'[PROJECT]',
'[LOCATION]',
'[DATA_STORE]'
);
$urisElement = '[URIS]';
recrawl_uris_sample($formattedSiteSearchEngine, $urisElement);
}
updateTargetSite
Updates a TargetSite.
The async variant is Google\Cloud\DiscoveryEngine\V1beta\Client\SiteSearchEngineServiceClient::updateTargetSiteAsync() .
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\DiscoveryEngine\V1beta\UpdateTargetSiteRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\ApiCore\OperationResponse |
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\DiscoveryEngine\V1beta\Client\SiteSearchEngineServiceClient;
use Google\Cloud\DiscoveryEngine\V1beta\TargetSite;
use Google\Cloud\DiscoveryEngine\V1beta\UpdateTargetSiteRequest;
use Google\Rpc\Status;
/**
* @param string $targetSiteProvidedUriPattern Input only. The user provided URI pattern from which the
* `generated_uri_pattern` is generated.
*/
function update_target_site_sample(string $targetSiteProvidedUriPattern): void
{
// Create a client.
$siteSearchEngineServiceClient = new SiteSearchEngineServiceClient();
// Prepare the request message.
$targetSite = (new TargetSite())
->setProvidedUriPattern($targetSiteProvidedUriPattern);
$request = (new UpdateTargetSiteRequest())
->setTargetSite($targetSite);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $siteSearchEngineServiceClient->updateTargetSite($request);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
/** @var TargetSite $result */
$result = $response->getResult();
printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
} else {
/** @var Status $error */
$error = $response->getError();
printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
}
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$targetSiteProvidedUriPattern = '[PROVIDED_URI_PATTERN]';
update_target_site_sample($targetSiteProvidedUriPattern);
}
batchCreateTargetSitesAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\DiscoveryEngine\V1beta\BatchCreateTargetSitesRequest
|
optionalArgs = [] |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface |
batchVerifyTargetSitesAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\DiscoveryEngine\V1beta\BatchVerifyTargetSitesRequest
|
optionalArgs = [] |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface |
createTargetSiteAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\DiscoveryEngine\V1beta\CreateTargetSiteRequest
|
optionalArgs = [] |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface |
deleteTargetSiteAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\DiscoveryEngine\V1beta\DeleteTargetSiteRequest
|
optionalArgs = [] |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface |
disableAdvancedSiteSearchAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\DiscoveryEngine\V1beta\DisableAdvancedSiteSearchRequest
|
optionalArgs = [] |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface |
enableAdvancedSiteSearchAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\DiscoveryEngine\V1beta\EnableAdvancedSiteSearchRequest
|
optionalArgs = [] |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface |
fetchDomainVerificationStatusAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\DiscoveryEngine\V1beta\FetchDomainVerificationStatusRequest
|
optionalArgs = [] |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface |
getSiteSearchEngineAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\DiscoveryEngine\V1beta\GetSiteSearchEngineRequest
|
optionalArgs = [] |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface |
getTargetSiteAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\DiscoveryEngine\V1beta\GetTargetSiteRequest
|
optionalArgs = [] |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface |
listTargetSitesAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\DiscoveryEngine\V1beta\ListTargetSitesRequest
|
optionalArgs = [] |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface |
recrawlUrisAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\DiscoveryEngine\V1beta\RecrawlUrisRequest
|
optionalArgs = [] |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface |
updateTargetSiteAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\DiscoveryEngine\V1beta\UpdateTargetSiteRequest
|
optionalArgs = [] |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface |
getOperationsClient
Return an OperationsClient object with the same endpoint as $this.
Returns | |
---|---|
Type | Description |
Google\LongRunning\Client\OperationsClient |
resumeOperation
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.
Parameters | |
---|---|
Name | Description |
operationName |
string
The name of the long running operation |
methodName |
string
The name of the method used to start the operation |
Returns | |
---|---|
Type | Description |
Google\ApiCore\OperationResponse |
static::projectLocationCollectionDataStoreSiteSearchEngineName
Formats a string containing the fully-qualified path to represent a project_location_collection_data_store_siteSearchEngine resource.
Parameters | |
---|---|
Name | Description |
project |
string
|
location |
string
|
collection |
string
|
dataStore |
string
|
Returns | |
---|---|
Type | Description |
string |
The formatted project_location_collection_data_store_siteSearchEngine resource. |
static::projectLocationCollectionDataStoreTargetSiteName
Formats a string containing the fully-qualified path to represent a project_location_collection_data_store_target_site resource.
Parameters | |
---|---|
Name | Description |
project |
string
|
location |
string
|
collection |
string
|
dataStore |
string
|
targetSite |
string
|
Returns | |
---|---|
Type | Description |
string |
The formatted project_location_collection_data_store_target_site resource. |
static::projectLocationDataStoreSiteSearchEngineName
Formats a string containing the fully-qualified path to represent a project_location_data_store_siteSearchEngine resource.
Parameters | |
---|---|
Name | Description |
project |
string
|
location |
string
|
dataStore |
string
|
Returns | |
---|---|
Type | Description |
string |
The formatted project_location_data_store_siteSearchEngine resource. |
static::projectLocationDataStoreTargetSiteName
Formats a string containing the fully-qualified path to represent a project_location_data_store_target_site resource.
Parameters | |
---|---|
Name | Description |
project |
string
|
location |
string
|
dataStore |
string
|
targetSite |
string
|
Returns | |
---|---|
Type | Description |
string |
The formatted project_location_data_store_target_site resource. |
static::siteSearchEngineName
Formats a string containing the fully-qualified path to represent a site_search_engine resource.
Parameters | |
---|---|
Name | Description |
project |
string
|
location |
string
|
dataStore |
string
|
Returns | |
---|---|
Type | Description |
string |
The formatted site_search_engine resource. |
static::targetSiteName
Formats a string containing the fully-qualified path to represent a target_site resource.
Parameters | |
---|---|
Name | Description |
project |
string
|
location |
string
|
dataStore |
string
|
targetSite |
string
|
Returns | |
---|---|
Type | Description |
string |
The formatted target_site resource. |
static::parseName
Parses a formatted name string and returns an associative array of the components in the name.
The following name formats are supported: Template: Pattern
- projectLocationCollectionDataStoreSiteSearchEngine: projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/siteSearchEngine
- projectLocationCollectionDataStoreTargetSite: projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/siteSearchEngine/targetSites/{target_site}
- projectLocationDataStoreSiteSearchEngine: projects/{project}/locations/{location}/dataStores/{data_store}/siteSearchEngine
- projectLocationDataStoreTargetSite: projects/{project}/locations/{location}/dataStores/{data_store}/siteSearchEngine/targetSites/{target_site}
- siteSearchEngine: projects/{project}/locations/{location}/dataStores/{data_store}/siteSearchEngine
- targetSite: projects/{project}/locations/{location}/dataStores/{data_store}/siteSearchEngine/targetSites/{target_site}
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.
Parameters | |
---|---|
Name | Description |
formattedName |
string
The formatted name string |
template |
string
Optional name of template to match |
Returns | |
---|---|
Type | Description |
array |
An associative array from name component IDs to component values. |