Reference documentation and code samples for the Google Cloud Api Hub V1 Client class ApiHubCurateClient.
Service Description: This service is used for managing curations for processing API data consumed from collect layer.
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 \ ApiHub \ V1 \ 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. Important: If you accept a credential configuration (credential JSON/File/Stream) from an external source for authentication to Google Cloud Platform, you must validate it before providing it to any Google API or library. Providing an unvalidated credential configuration to Google APIs can compromise the security of your systems and data. For more information https://cloud.google.com/docs/authentication/external/externally-sourced-credentials |
↳ 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. At the moment, supports only |
↳ 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 = [ 'rest' => [...], ]; See the Google\ApiCore\Transport\RestTransport::build() method 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. |
↳ logger |
false|LoggerInterface
A PSR-3 compliant logger. If set to false, logging is disabled, ignoring the 'GOOGLE_SDK_PHP_LOGGING' environment flag |
createCuration
Create a curation resource in the API hub.
Once a curation resource is created, plugin instances can start using it.
The async variant is ApiHubCurateClient::createCurationAsync() .
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\ApiHub\V1\CreateCurationRequest
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\ApiHub\V1\Curation |
use Google\ApiCore\ApiException;
use Google\Cloud\ApiHub\V1\ApplicationIntegrationEndpointDetails;
use Google\Cloud\ApiHub\V1\Client\ApiHubCurateClient;
use Google\Cloud\ApiHub\V1\CreateCurationRequest;
use Google\Cloud\ApiHub\V1\Curation;
use Google\Cloud\ApiHub\V1\Endpoint;
/**
* @param string $formattedParent The parent resource for the curation resource.
* Format: `projects/{project}/locations/{location}`
* Please see {@see ApiHubCurateClient::locationName()} for help formatting this field.
* @param string $curationDisplayName The display name of the curation.
* @param string $curationEndpointApplicationIntegrationEndpointDetailsUri The endpoint URI should be a valid REST URI for triggering an
* Application Integration. Format:
* `https://integrations.googleapis.com/v1/{name=projects/*/locations/*/integrations/*}:execute`
* or
* `https://{location}-integrations.googleapis.com/v1/{name=projects/*/locations/*/integrations/*}:execute`
* @param string $curationEndpointApplicationIntegrationEndpointDetailsTriggerId The API trigger ID of the Application Integration workflow.
*/
function create_curation_sample(
string $formattedParent,
string $curationDisplayName,
string $curationEndpointApplicationIntegrationEndpointDetailsUri,
string $curationEndpointApplicationIntegrationEndpointDetailsTriggerId
): void {
// Create a client.
$apiHubCurateClient = new ApiHubCurateClient();
// Prepare the request message.
$curationEndpointApplicationIntegrationEndpointDetails = (new ApplicationIntegrationEndpointDetails())
->setUri($curationEndpointApplicationIntegrationEndpointDetailsUri)
->setTriggerId($curationEndpointApplicationIntegrationEndpointDetailsTriggerId);
$curationEndpoint = (new Endpoint())
->setApplicationIntegrationEndpointDetails($curationEndpointApplicationIntegrationEndpointDetails);
$curation = (new Curation())
->setDisplayName($curationDisplayName)
->setEndpoint($curationEndpoint);
$request = (new CreateCurationRequest())
->setParent($formattedParent)
->setCuration($curation);
// Call the API and handle any network failures.
try {
/** @var Curation $response */
$response = $apiHubCurateClient->createCuration($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
{
$formattedParent = ApiHubCurateClient::locationName('[PROJECT]', '[LOCATION]');
$curationDisplayName = '[DISPLAY_NAME]';
$curationEndpointApplicationIntegrationEndpointDetailsUri = '[URI]';
$curationEndpointApplicationIntegrationEndpointDetailsTriggerId = '[TRIGGER_ID]';
create_curation_sample(
$formattedParent,
$curationDisplayName,
$curationEndpointApplicationIntegrationEndpointDetailsUri,
$curationEndpointApplicationIntegrationEndpointDetailsTriggerId
);
}
deleteCuration
Delete a curation resource in the API hub. A curation can only be deleted if it's not being used by any plugin instance.
The async variant is ApiHubCurateClient::deleteCurationAsync() .
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\ApiHub\V1\DeleteCurationRequest
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. |
use Google\ApiCore\ApiException;
use Google\Cloud\ApiHub\V1\Client\ApiHubCurateClient;
use Google\Cloud\ApiHub\V1\DeleteCurationRequest;
/**
* @param string $formattedName The name of the curation resource to delete.
* Format: `projects/{project}/locations/{location}/curations/{curation}`
* Please see {@see ApiHubCurateClient::curationName()} for help formatting this field.
*/
function delete_curation_sample(string $formattedName): void
{
// Create a client.
$apiHubCurateClient = new ApiHubCurateClient();
// Prepare the request message.
$request = (new DeleteCurationRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
$apiHubCurateClient->deleteCuration($request);
printf('Call completed successfully.' . PHP_EOL);
} 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 = ApiHubCurateClient::curationName('[PROJECT]', '[LOCATION]', '[CURATION]');
delete_curation_sample($formattedName);
}
getCuration
Get curation resource details.
The async variant is ApiHubCurateClient::getCurationAsync() .
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\ApiHub\V1\GetCurationRequest
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\ApiHub\V1\Curation |
use Google\ApiCore\ApiException;
use Google\Cloud\ApiHub\V1\Client\ApiHubCurateClient;
use Google\Cloud\ApiHub\V1\Curation;
use Google\Cloud\ApiHub\V1\GetCurationRequest;
/**
* @param string $formattedName The name of the curation resource to retrieve.
* Format: `projects/{project}/locations/{location}/curations/{curation}`
* Please see {@see ApiHubCurateClient::curationName()} for help formatting this field.
*/
function get_curation_sample(string $formattedName): void
{
// Create a client.
$apiHubCurateClient = new ApiHubCurateClient();
// Prepare the request message.
$request = (new GetCurationRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
/** @var Curation $response */
$response = $apiHubCurateClient->getCuration($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 = ApiHubCurateClient::curationName('[PROJECT]', '[LOCATION]', '[CURATION]');
get_curation_sample($formattedName);
}
listCurations
List curation resources in the API hub.
The async variant is ApiHubCurateClient::listCurationsAsync() .
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\ApiHub\V1\ListCurationsRequest
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\ApiHub\V1\Client\ApiHubCurateClient;
use Google\Cloud\ApiHub\V1\ListCurationsRequest;
/**
* @param string $formattedParent The parent, which owns this collection of curation resources.
* Format: `projects/{project}/locations/{location}`
* Please see {@see ApiHubCurateClient::locationName()} for help formatting this field.
*/
function list_curations_sample(string $formattedParent): void
{
// Create a client.
$apiHubCurateClient = new ApiHubCurateClient();
// Prepare the request message.
$request = (new ListCurationsRequest())
->setParent($formattedParent);
// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $apiHubCurateClient->listCurations($request);
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 = ApiHubCurateClient::locationName('[PROJECT]', '[LOCATION]');
list_curations_sample($formattedParent);
}
updateCuration
Update a curation resource in the API hub. The following fields in the curation can be updated:
The update_mask should be used to specify the fields being updated.
The async variant is ApiHubCurateClient::updateCurationAsync() .
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\ApiHub\V1\UpdateCurationRequest
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\ApiHub\V1\Curation |
use Google\ApiCore\ApiException;
use Google\Cloud\ApiHub\V1\ApplicationIntegrationEndpointDetails;
use Google\Cloud\ApiHub\V1\Client\ApiHubCurateClient;
use Google\Cloud\ApiHub\V1\Curation;
use Google\Cloud\ApiHub\V1\Endpoint;
use Google\Cloud\ApiHub\V1\UpdateCurationRequest;
/**
* @param string $curationDisplayName The display name of the curation.
* @param string $curationEndpointApplicationIntegrationEndpointDetailsUri The endpoint URI should be a valid REST URI for triggering an
* Application Integration. Format:
* `https://integrations.googleapis.com/v1/{name=projects/*/locations/*/integrations/*}:execute`
* or
* `https://{location}-integrations.googleapis.com/v1/{name=projects/*/locations/*/integrations/*}:execute`
* @param string $curationEndpointApplicationIntegrationEndpointDetailsTriggerId The API trigger ID of the Application Integration workflow.
*/
function update_curation_sample(
string $curationDisplayName,
string $curationEndpointApplicationIntegrationEndpointDetailsUri,
string $curationEndpointApplicationIntegrationEndpointDetailsTriggerId
): void {
// Create a client.
$apiHubCurateClient = new ApiHubCurateClient();
// Prepare the request message.
$curationEndpointApplicationIntegrationEndpointDetails = (new ApplicationIntegrationEndpointDetails())
->setUri($curationEndpointApplicationIntegrationEndpointDetailsUri)
->setTriggerId($curationEndpointApplicationIntegrationEndpointDetailsTriggerId);
$curationEndpoint = (new Endpoint())
->setApplicationIntegrationEndpointDetails($curationEndpointApplicationIntegrationEndpointDetails);
$curation = (new Curation())
->setDisplayName($curationDisplayName)
->setEndpoint($curationEndpoint);
$request = (new UpdateCurationRequest())
->setCuration($curation);
// Call the API and handle any network failures.
try {
/** @var Curation $response */
$response = $apiHubCurateClient->updateCuration($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
{
$curationDisplayName = '[DISPLAY_NAME]';
$curationEndpointApplicationIntegrationEndpointDetailsUri = '[URI]';
$curationEndpointApplicationIntegrationEndpointDetailsTriggerId = '[TRIGGER_ID]';
update_curation_sample(
$curationDisplayName,
$curationEndpointApplicationIntegrationEndpointDetailsUri,
$curationEndpointApplicationIntegrationEndpointDetailsTriggerId
);
}
getLocation
Gets information about a location.
The async variant is ApiHubCurateClient::getLocationAsync() .
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\Location\GetLocationRequest
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\Location\Location |
use Google\ApiCore\ApiException;
use Google\Cloud\ApiHub\V1\Client\ApiHubCurateClient;
use Google\Cloud\Location\GetLocationRequest;
use Google\Cloud\Location\Location;
/**
* 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 get_location_sample(): void
{
// Create a client.
$apiHubCurateClient = new ApiHubCurateClient();
// Prepare the request message.
$request = new GetLocationRequest();
// Call the API and handle any network failures.
try {
/** @var Location $response */
$response = $apiHubCurateClient->getLocation($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
listLocations
Lists information about the supported locations for this service.
The async variant is ApiHubCurateClient::listLocationsAsync() .
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\Location\ListLocationsRequest
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\ApiHub\V1\Client\ApiHubCurateClient;
use Google\Cloud\Location\ListLocationsRequest;
/**
* 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 list_locations_sample(): void
{
// Create a client.
$apiHubCurateClient = new ApiHubCurateClient();
// Prepare the request message.
$request = new ListLocationsRequest();
// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $apiHubCurateClient->listLocations($request);
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());
}
}
createCurationAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\ApiHub\V1\CreateCurationRequest
|
optionalArgs |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\ApiHub\V1\Curation> |
deleteCurationAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\ApiHub\V1\DeleteCurationRequest
|
optionalArgs |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface<void> |
getCurationAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\ApiHub\V1\GetCurationRequest
|
optionalArgs |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\ApiHub\V1\Curation> |
listCurationsAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\ApiHub\V1\ListCurationsRequest
|
optionalArgs |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\PagedListResponse> |
updateCurationAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\ApiHub\V1\UpdateCurationRequest
|
optionalArgs |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\ApiHub\V1\Curation> |
getLocationAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\Location\GetLocationRequest
|
optionalArgs |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Location\Location> |
listLocationsAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\Location\ListLocationsRequest
|
optionalArgs |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\PagedListResponse> |
static::curationName
Formats a string containing the fully-qualified path to represent a curation resource.
Parameters | |
---|---|
Name | Description |
project |
string
|
location |
string
|
curation |
string
|
Returns | |
---|---|
Type | Description |
string |
The formatted curation resource. |
static::locationName
Formats a string containing the fully-qualified path to represent a location resource.
Parameters | |
---|---|
Name | Description |
project |
string
|
location |
string
|
Returns | |
---|---|
Type | Description |
string |
The formatted location resource. |
static::pluginInstanceName
Formats a string containing the fully-qualified path to represent a plugin_instance resource.
Parameters | |
---|---|
Name | Description |
project |
string
|
location |
string
|
plugin |
string
|
instance |
string
|
Returns | |
---|---|
Type | Description |
string |
The formatted plugin_instance 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
- curation: projects/{project}/locations/{location}/curations/{curation}
- location: projects/{project}/locations/{location}
- pluginInstance: projects/{project}/locations/{location}/plugins/{plugin}/instances/{instance}
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. |