Reference documentation and code samples for the Google Cloud Api Hub V1 Client class ApiHubClient.
Service Description: This service provides all methods related to the API hub.
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.
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 false
.
↳ 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 rest
. Advanced usage
: Additionally, it is possible to pass in an already instantiated Google\ApiCore\Transport\TransportInterface
object. Note that when this object is provided, any settings in $transportConfig, and any $apiEndpoint setting, will be ignored.
↳ 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
createApi
Create an API resource in the API hub.
Once an API resource is created, versions can be added to it.
The async variant is ApiHubClient::createApiAsync() .
request
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\Api;
use Google\Cloud\ApiHub\V1\Client\ApiHubClient;
use Google\Cloud\ApiHub\V1\CreateApiRequest;
/**
* @param string $formattedParent The parent resource for the API resource.
* Format: `projects/{project}/locations/{location}`
* Please see {@see ApiHubClient::locationName()} for help formatting this field.
* @param string $apiDisplayName The display name of the API resource.
*/
function create_api_sample(string $formattedParent, string $apiDisplayName): void
{
// Create a client.
$apiHubClient = new ApiHubClient();
// Prepare the request message.
$api = (new Api())
->setDisplayName($apiDisplayName);
$request = (new CreateApiRequest())
->setParent($formattedParent)
->setApi($api);
// Call the API and handle any network failures.
try {
/** @var Api $response */
$response = $apiHubClient->createApi($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 = ApiHubClient::locationName('[PROJECT]', '[LOCATION]');
$apiDisplayName = '[DISPLAY_NAME]';
create_api_sample($formattedParent, $apiDisplayName);
}
createApiOperation
Create an apiOperation in an API version.
An apiOperation can be created only if the version has no apiOperations which were created by parsing a spec.
The async variant is ApiHubClient::createApiOperationAsync() .
request
Google\Cloud\ApiHub\V1\CreateApiOperationRequest
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\ApiOperation;
use Google\Cloud\ApiHub\V1\Client\ApiHubClient;
use Google\Cloud\ApiHub\V1\CreateApiOperationRequest;
/**
* @param string $formattedParent The parent resource for the operation resource.
* Format:
* `projects/{project}/locations/{location}/apis/{api}/versions/{version}`
* Please see {@see ApiHubClient::versionName()} for help formatting this field.
*/
function create_api_operation_sample(string $formattedParent): void
{
// Create a client.
$apiHubClient = new ApiHubClient();
// Prepare the request message.
$apiOperation = new ApiOperation();
$request = (new CreateApiOperationRequest())
->setParent($formattedParent)
->setApiOperation($apiOperation);
// Call the API and handle any network failures.
try {
/** @var ApiOperation $response */
$response = $apiHubClient->createApiOperation($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 = ApiHubClient::versionName('[PROJECT]', '[LOCATION]', '[API]', '[VERSION]');
create_api_operation_sample($formattedParent);
}
createAttribute
Create a user defined attribute.
Certain pre defined attributes are already created by the API hub. These
attributes will have type as SYSTEM_DEFINED
and can be listed via ListAttributes
method.
Allowed values for the same can be updated via UpdateAttribute
method.
The async variant is ApiHubClient::createAttributeAsync() .
request
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\Attribute;
use Google\Cloud\ApiHub\V1\Attribute\DataType;
use Google\Cloud\ApiHub\V1\Attribute\Scope;
use Google\Cloud\ApiHub\V1\Client\ApiHubClient;
use Google\Cloud\ApiHub\V1\CreateAttributeRequest;
/**
* @param string $formattedParent The parent resource for Attribute.
* Format: `projects/{project}/locations/{location}`
* Please see {@see ApiHubClient::locationName()} for help formatting this field.
* @param string $attributeDisplayName The display name of the attribute.
* @param int $attributeScope The scope of the attribute. It represents the resource in the API
* Hub to which the attribute can be linked.
* @param int $attributeDataType The type of the data of the attribute.
*/
function create_attribute_sample(
string $formattedParent,
string $attributeDisplayName,
int $attributeScope,
int $attributeDataType
): void {
// Create a client.
$apiHubClient = new ApiHubClient();
// Prepare the request message.
$attribute = (new Attribute())
->setDisplayName($attributeDisplayName)
->setScope($attributeScope)
->setDataType($attributeDataType);
$request = (new CreateAttributeRequest())
->setParent($formattedParent)
->setAttribute($attribute);
// Call the API and handle any network failures.
try {
/** @var Attribute $response */
$response = $apiHubClient->createAttribute($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 = ApiHubClient::locationName('[PROJECT]', '[LOCATION]');
$attributeDisplayName = '[DISPLAY_NAME]';
$attributeScope = Scope::SCOPE_UNSPECIFIED;
$attributeDataType = DataType::DATA_TYPE_UNSPECIFIED;
create_attribute_sample(
$formattedParent,
$attributeDisplayName,
$attributeScope,
$attributeDataType
);
}
createDeployment
Create a deployment resource in the API hub.
Once a deployment resource is created, it can be associated with API versions.
The async variant is ApiHubClient::createDeploymentAsync() .
request
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\AttributeValues;
use Google\Cloud\ApiHub\V1\Client\ApiHubClient;
use Google\Cloud\ApiHub\V1\CreateDeploymentRequest;
use Google\Cloud\ApiHub\V1\Deployment;
/**
* @param string $formattedParent The parent resource for the deployment resource.
* Format: `projects/{project}/locations/{location}`
* Please see {@see ApiHubClient::locationName()} for help formatting this field.
* @param string $deploymentDisplayName The display name of the deployment.
* @param string $deploymentResourceUri The resource URI identifies the deployment within its gateway.
* For Apigee gateways, its recommended to use the format:
* organizations/{org}/environments/{env}/apis/{api}.
* For ex: if a proxy with name `orders` is deployed in `staging`
* environment of `cymbal` organization, the resource URI would be:
* `organizations/cymbal/environments/staging/apis/orders`.
* @param string $deploymentEndpointsElement The endpoints at which this deployment resource is listening for
* API requests. This could be a list of complete URIs, hostnames or an IP
* addresses.
*/
function create_deployment_sample(
string $formattedParent,
string $deploymentDisplayName,
string $deploymentResourceUri,
string $deploymentEndpointsElement
): void {
// Create a client.
$apiHubClient = new ApiHubClient();
// Prepare the request message.
$deploymentDeploymentType = new AttributeValues();
$deploymentEndpoints = [$deploymentEndpointsElement,];
$deployment = (new Deployment())
->setDisplayName($deploymentDisplayName)
->setDeploymentType($deploymentDeploymentType)
->setResourceUri($deploymentResourceUri)
->setEndpoints($deploymentEndpoints);
$request = (new CreateDeploymentRequest())
->setParent($formattedParent)
->setDeployment($deployment);
// Call the API and handle any network failures.
try {
/** @var Deployment $response */
$response = $apiHubClient->createDeployment($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 = ApiHubClient::locationName('[PROJECT]', '[LOCATION]');
$deploymentDisplayName = '[DISPLAY_NAME]';
$deploymentResourceUri = '[RESOURCE_URI]';
$deploymentEndpointsElement = '[ENDPOINTS]';
create_deployment_sample(
$formattedParent,
$deploymentDisplayName,
$deploymentResourceUri,
$deploymentEndpointsElement
);
}
createExternalApi
Create an External API resource in the API hub.
The async variant is ApiHubClient::createExternalApiAsync() .
request
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\ApiHubClient;
use Google\Cloud\ApiHub\V1\CreateExternalApiRequest;
use Google\Cloud\ApiHub\V1\ExternalApi;
/**
* @param string $formattedParent The parent resource for the External API resource.
* Format: `projects/{project}/locations/{location}`
* Please see {@see ApiHubClient::locationName()} for help formatting this field.
* @param string $externalApiDisplayName Display name of the external API. Max length is 63 characters
* (Unicode Code Points).
*/
function create_external_api_sample(string $formattedParent, string $externalApiDisplayName): void
{
// Create a client.
$apiHubClient = new ApiHubClient();
// Prepare the request message.
$externalApi = (new ExternalApi())
->setDisplayName($externalApiDisplayName);
$request = (new CreateExternalApiRequest())
->setParent($formattedParent)
->setExternalApi($externalApi);
// Call the API and handle any network failures.
try {
/** @var ExternalApi $response */
$response = $apiHubClient->createExternalApi($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 = ApiHubClient::locationName('[PROJECT]', '[LOCATION]');
$externalApiDisplayName = '[DISPLAY_NAME]';
create_external_api_sample($formattedParent, $externalApiDisplayName);
}
createSpec
Add a spec to an API version in the API hub.
Multiple specs can be added to an API version.
Note, while adding a spec, at least one of contents
or source_uri
must
be provided. If contents
is provided, then spec_type
must also be
provided.
On adding a spec with contents to the version, the operations present in it
will be added to the version.Note that the file contents in the spec should
be of the same type as defined in the projects/{project}/locations/{location}/attributes/system-spec-type
attribute associated with spec resource. Note that specs of various types
can be uploaded, however parsing of details is supported for OpenAPI spec
currently.
In order to access the information parsed from the spec, use the GetSpec method. In order to access the raw contents for a particular spec, use the GetSpecContents method. In order to access the operations parsed from the spec, use the ListAPIOperations method.
The async variant is ApiHubClient::createSpecAsync() .
request
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\AttributeValues;
use Google\Cloud\ApiHub\V1\Client\ApiHubClient;
use Google\Cloud\ApiHub\V1\CreateSpecRequest;
use Google\Cloud\ApiHub\V1\Spec;
/**
* @param string $formattedParent The parent resource for Spec.
* Format:
* `projects/{project}/locations/{location}/apis/{api}/versions/{version}`
* Please see {@see ApiHubClient::versionName()} for help formatting this field.
* @param string $specDisplayName The display name of the spec.
* This can contain the file name of the spec.
*/
function create_spec_sample(string $formattedParent, string $specDisplayName): void
{
// Create a client.
$apiHubClient = new ApiHubClient();
// Prepare the request message.
$specSpecType = new AttributeValues();
$spec = (new Spec())
->setDisplayName($specDisplayName)
->setSpecType($specSpecType);
$request = (new CreateSpecRequest())
->setParent($formattedParent)
->setSpec($spec);
// Call the API and handle any network failures.
try {
/** @var Spec $response */
$response = $apiHubClient->createSpec($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 = ApiHubClient::versionName('[PROJECT]', '[LOCATION]', '[API]', '[VERSION]');
$specDisplayName = '[DISPLAY_NAME]';
create_spec_sample($formattedParent, $specDisplayName);
}
createVersion
Create an API version for an API resource in the API hub.
The async variant is ApiHubClient::createVersionAsync() .
request
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\ApiHubClient;
use Google\Cloud\ApiHub\V1\CreateVersionRequest;
use Google\Cloud\ApiHub\V1\Version;
/**
* @param string $formattedParent The parent resource for API version.
* Format: `projects/{project}/locations/{location}/apis/{api}`
* Please see {@see ApiHubClient::apiName()} for help formatting this field.
* @param string $versionDisplayName The display name of the version.
*/
function create_version_sample(string $formattedParent, string $versionDisplayName): void
{
// Create a client.
$apiHubClient = new ApiHubClient();
// Prepare the request message.
$version = (new Version())
->setDisplayName($versionDisplayName);
$request = (new CreateVersionRequest())
->setParent($formattedParent)
->setVersion($version);
// Call the API and handle any network failures.
try {
/** @var Version $response */
$response = $apiHubClient->createVersion($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 = ApiHubClient::apiName('[PROJECT]', '[LOCATION]', '[API]');
$versionDisplayName = '[DISPLAY_NAME]';
create_version_sample($formattedParent, $versionDisplayName);
}
deleteApi
Delete an API resource in the API hub. API can only be deleted if all underlying versions are deleted.
The async variant is ApiHubClient::deleteApiAsync() .
request
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\ApiHubClient;
use Google\Cloud\ApiHub\V1\DeleteApiRequest;
/**
* @param string $formattedName The name of the API resource to delete.
* Format: `projects/{project}/locations/{location}/apis/{api}`
* Please see {@see ApiHubClient::apiName()} for help formatting this field.
*/
function delete_api_sample(string $formattedName): void
{
// Create a client.
$apiHubClient = new ApiHubClient();
// Prepare the request message.
$request = (new DeleteApiRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
$apiHubClient->deleteApi($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 = ApiHubClient::apiName('[PROJECT]', '[LOCATION]', '[API]');
delete_api_sample($formattedName);
}
deleteApiOperation
Delete an operation in an API version and we can delete only the operations created via create API. If the operation was created by parsing the spec, then it can be deleted by editing or deleting the spec.
The async variant is ApiHubClient::deleteApiOperationAsync() .
request
Google\Cloud\ApiHub\V1\DeleteApiOperationRequest
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\ApiHubClient;
use Google\Cloud\ApiHub\V1\DeleteApiOperationRequest;
/**
* @param string $formattedName The name of the operation resource to delete.
* Format:
* `projects/{project}/locations/{location}/apis/{api}/versions/{version}/operations/{operation}`
* Please see {@see ApiHubClient::apiOperationName()} for help formatting this field.
*/
function delete_api_operation_sample(string $formattedName): void
{
// Create a client.
$apiHubClient = new ApiHubClient();
// Prepare the request message.
$request = (new DeleteApiOperationRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
$apiHubClient->deleteApiOperation($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 = ApiHubClient::apiOperationName(
'[PROJECT]',
'[LOCATION]',
'[API]',
'[VERSION]',
'[OPERATION]'
);
delete_api_operation_sample($formattedName);
}
deleteAttribute
Delete an attribute.
Note: System defined attributes cannot be deleted. All associations of the attribute being deleted with any API hub resource will also get deleted.
The async variant is ApiHubClient::deleteAttributeAsync() .
request
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\ApiHubClient;
use Google\Cloud\ApiHub\V1\DeleteAttributeRequest;
/**
* @param string $formattedName The name of the attribute to delete.
* Format:
* `projects/{project}/locations/{location}/attributes/{attribute}`
* Please see {@see ApiHubClient::attributeName()} for help formatting this field.
*/
function delete_attribute_sample(string $formattedName): void
{
// Create a client.
$apiHubClient = new ApiHubClient();
// Prepare the request message.
$request = (new DeleteAttributeRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
$apiHubClient->deleteAttribute($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 = ApiHubClient::attributeName('[PROJECT]', '[LOCATION]', '[ATTRIBUTE]');
delete_attribute_sample($formattedName);
}
deleteDeployment
Delete a deployment resource in the API hub.
The async variant is ApiHubClient::deleteDeploymentAsync() .
request
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\ApiHubClient;
use Google\Cloud\ApiHub\V1\DeleteDeploymentRequest;
/**
* @param string $formattedName The name of the deployment resource to delete.
* Format: `projects/{project}/locations/{location}/deployments/{deployment}`
* Please see {@see ApiHubClient::deploymentName()} for help formatting this field.
*/
function delete_deployment_sample(string $formattedName): void
{
// Create a client.
$apiHubClient = new ApiHubClient();
// Prepare the request message.
$request = (new DeleteDeploymentRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
$apiHubClient->deleteDeployment($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 = ApiHubClient::deploymentName('[PROJECT]', '[LOCATION]', '[DEPLOYMENT]');
delete_deployment_sample($formattedName);
}
deleteExternalApi
Delete an External API resource in the API hub.
The async variant is ApiHubClient::deleteExternalApiAsync() .
request
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\ApiHubClient;
use Google\Cloud\ApiHub\V1\DeleteExternalApiRequest;
/**
* @param string $formattedName The name of the External API resource to delete.
* Format:
* `projects/{project}/locations/{location}/externalApis/{externalApi}`
* Please see {@see ApiHubClient::externalApiName()} for help formatting this field.
*/
function delete_external_api_sample(string $formattedName): void
{
// Create a client.
$apiHubClient = new ApiHubClient();
// Prepare the request message.
$request = (new DeleteExternalApiRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
$apiHubClient->deleteExternalApi($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 = ApiHubClient::externalApiName('[PROJECT]', '[LOCATION]', '[EXTERNAL_API]');
delete_external_api_sample($formattedName);
}
deleteSpec
Delete a spec.
Deleting a spec will also delete the associated operations from the version.
The async variant is ApiHubClient::deleteSpecAsync() .
request
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\ApiHubClient;
use Google\Cloud\ApiHub\V1\DeleteSpecRequest;
/**
* @param string $formattedName The name of the spec to delete.
* Format:
* `projects/{project}/locations/{location}/apis/{api}/versions/{version}/specs/{spec}`
* Please see {@see ApiHubClient::specName()} for help formatting this field.
*/
function delete_spec_sample(string $formattedName): void
{
// Create a client.
$apiHubClient = new ApiHubClient();
// Prepare the request message.
$request = (new DeleteSpecRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
$apiHubClient->deleteSpec($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 = ApiHubClient::specName('[PROJECT]', '[LOCATION]', '[API]', '[VERSION]', '[SPEC]');
delete_spec_sample($formattedName);
}
deleteVersion
Delete an API version. Version can only be deleted if all underlying specs, operations, definitions and linked deployments are deleted.
The async variant is ApiHubClient::deleteVersionAsync() .
request
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\ApiHubClient;
use Google\Cloud\ApiHub\V1\DeleteVersionRequest;
/**
* @param string $formattedName The name of the version to delete.
* Format:
* `projects/{project}/locations/{location}/apis/{api}/versions/{version}`
* Please see {@see ApiHubClient::versionName()} for help formatting this field.
*/
function delete_version_sample(string $formattedName): void
{
// Create a client.
$apiHubClient = new ApiHubClient();
// Prepare the request message.
$request = (new DeleteVersionRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
$apiHubClient->deleteVersion($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 = ApiHubClient::versionName('[PROJECT]', '[LOCATION]', '[API]', '[VERSION]');
delete_version_sample($formattedName);
}
getApi
Get API resource details including the API versions contained in it.
The async variant is ApiHubClient::getApiAsync() .
request
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\Api;
use Google\Cloud\ApiHub\V1\Client\ApiHubClient;
use Google\Cloud\ApiHub\V1\GetApiRequest;
/**
* @param string $formattedName The name of the API resource to retrieve.
* Format: `projects/{project}/locations/{location}/apis/{api}`
* Please see {@see ApiHubClient::apiName()} for help formatting this field.
*/
function get_api_sample(string $formattedName): void
{
// Create a client.
$apiHubClient = new ApiHubClient();
// Prepare the request message.
$request = (new GetApiRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
/** @var Api $response */
$response = $apiHubClient->getApi($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 = ApiHubClient::apiName('[PROJECT]', '[LOCATION]', '[API]');
get_api_sample($formattedName);
}
getApiOperation
Get details about a particular operation in API version.
The async variant is ApiHubClient::getApiOperationAsync() .
request
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\ApiOperation;
use Google\Cloud\ApiHub\V1\Client\ApiHubClient;
use Google\Cloud\ApiHub\V1\GetApiOperationRequest;
/**
* @param string $formattedName The name of the operation to retrieve.
* Format:
* `projects/{project}/locations/{location}/apis/{api}/versions/{version}/operations/{operation}`
* Please see {@see ApiHubClient::apiOperationName()} for help formatting this field.
*/
function get_api_operation_sample(string $formattedName): void
{
// Create a client.
$apiHubClient = new ApiHubClient();
// Prepare the request message.
$request = (new GetApiOperationRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
/** @var ApiOperation $response */
$response = $apiHubClient->getApiOperation($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 = ApiHubClient::apiOperationName(
'[PROJECT]',
'[LOCATION]',
'[API]',
'[VERSION]',
'[OPERATION]'
);
get_api_operation_sample($formattedName);
}
getAttribute
Get details about the attribute.
The async variant is ApiHubClient::getAttributeAsync() .
request
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\Attribute;
use Google\Cloud\ApiHub\V1\Client\ApiHubClient;
use Google\Cloud\ApiHub\V1\GetAttributeRequest;
/**
* @param string $formattedName The name of the attribute to retrieve.
* Format:
* `projects/{project}/locations/{location}/attributes/{attribute}`
* Please see {@see ApiHubClient::attributeName()} for help formatting this field.
*/
function get_attribute_sample(string $formattedName): void
{
// Create a client.
$apiHubClient = new ApiHubClient();
// Prepare the request message.
$request = (new GetAttributeRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
/** @var Attribute $response */
$response = $apiHubClient->getAttribute($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 = ApiHubClient::attributeName('[PROJECT]', '[LOCATION]', '[ATTRIBUTE]');
get_attribute_sample($formattedName);
}
getDefinition
Get details about a definition in an API version.
The async variant is ApiHubClient::getDefinitionAsync() .
request
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\ApiHubClient;
use Google\Cloud\ApiHub\V1\Definition;
use Google\Cloud\ApiHub\V1\GetDefinitionRequest;
/**
* @param string $formattedName The name of the definition to retrieve.
* Format:
* `projects/{project}/locations/{location}/apis/{api}/versions/{version}/definitions/{definition}`
* Please see {@see ApiHubClient::definitionName()} for help formatting this field.
*/
function get_definition_sample(string $formattedName): void
{
// Create a client.
$apiHubClient = new ApiHubClient();
// Prepare the request message.
$request = (new GetDefinitionRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
/** @var Definition $response */
$response = $apiHubClient->getDefinition($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 = ApiHubClient::definitionName(
'[PROJECT]',
'[LOCATION]',
'[API]',
'[VERSION]',
'[DEFINITION]'
);
get_definition_sample($formattedName);
}
getDeployment
Get details about a deployment and the API versions linked to it.
The async variant is ApiHubClient::getDeploymentAsync() .
request
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\ApiHubClient;
use Google\Cloud\ApiHub\V1\Deployment;
use Google\Cloud\ApiHub\V1\GetDeploymentRequest;
/**
* @param string $formattedName The name of the deployment resource to retrieve.
* Format: `projects/{project}/locations/{location}/deployments/{deployment}`
* Please see {@see ApiHubClient::deploymentName()} for help formatting this field.
*/
function get_deployment_sample(string $formattedName): void
{
// Create a client.
$apiHubClient = new ApiHubClient();
// Prepare the request message.
$request = (new GetDeploymentRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
/** @var Deployment $response */
$response = $apiHubClient->getDeployment($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 = ApiHubClient::deploymentName('[PROJECT]', '[LOCATION]', '[DEPLOYMENT]');
get_deployment_sample($formattedName);
}
getExternalApi
Get details about an External API resource in the API hub.
The async variant is ApiHubClient::getExternalApiAsync() .
request
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\ApiHubClient;
use Google\Cloud\ApiHub\V1\ExternalApi;
use Google\Cloud\ApiHub\V1\GetExternalApiRequest;
/**
* @param string $formattedName The name of the External API resource to retrieve.
* Format:
* `projects/{project}/locations/{location}/externalApis/{externalApi}`
* Please see {@see ApiHubClient::externalApiName()} for help formatting this field.
*/
function get_external_api_sample(string $formattedName): void
{
// Create a client.
$apiHubClient = new ApiHubClient();
// Prepare the request message.
$request = (new GetExternalApiRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
/** @var ExternalApi $response */
$response = $apiHubClient->getExternalApi($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 = ApiHubClient::externalApiName('[PROJECT]', '[LOCATION]', '[EXTERNAL_API]');
get_external_api_sample($formattedName);
}
getSpec
Get details about the information parsed from a spec.
Note that this method does not return the raw spec contents. Use GetSpecContents method to retrieve the same.
The async variant is ApiHubClient::getSpecAsync() .
request
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\ApiHubClient;
use Google\Cloud\ApiHub\V1\GetSpecRequest;
use Google\Cloud\ApiHub\V1\Spec;
/**
* @param string $formattedName The name of the spec to retrieve.
* Format:
* `projects/{project}/locations/{location}/apis/{api}/versions/{version}/specs/{spec}`
* Please see {@see ApiHubClient::specName()} for help formatting this field.
*/
function get_spec_sample(string $formattedName): void
{
// Create a client.
$apiHubClient = new ApiHubClient();
// Prepare the request message.
$request = (new GetSpecRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
/** @var Spec $response */
$response = $apiHubClient->getSpec($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 = ApiHubClient::specName('[PROJECT]', '[LOCATION]', '[API]', '[VERSION]', '[SPEC]');
get_spec_sample($formattedName);
}
getSpecContents
Get spec contents.
The async variant is ApiHubClient::getSpecContentsAsync() .
request
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\ApiHubClient;
use Google\Cloud\ApiHub\V1\GetSpecContentsRequest;
use Google\Cloud\ApiHub\V1\SpecContents;
/**
* @param string $formattedName The name of the spec whose contents need to be retrieved.
* Format:
* `projects/{project}/locations/{location}/apis/{api}/versions/{version}/specs/{spec}`
* Please see {@see ApiHubClient::specName()} for help formatting this field.
*/
function get_spec_contents_sample(string $formattedName): void
{
// Create a client.
$apiHubClient = new ApiHubClient();
// Prepare the request message.
$request = (new GetSpecContentsRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
/** @var SpecContents $response */
$response = $apiHubClient->getSpecContents($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 = ApiHubClient::specName('[PROJECT]', '[LOCATION]', '[API]', '[VERSION]', '[SPEC]');
get_spec_contents_sample($formattedName);
}
getVersion
Get details about the API version of an API resource. This will include information about the specs and operations present in the API version as well as the deployments linked to it.
The async variant is ApiHubClient::getVersionAsync() .
request
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\ApiHubClient;
use Google\Cloud\ApiHub\V1\GetVersionRequest;
use Google\Cloud\ApiHub\V1\Version;
/**
* @param string $formattedName The name of the API version to retrieve.
* Format:
* `projects/{project}/locations/{location}/apis/{api}/versions/{version}`
* Please see {@see ApiHubClient::versionName()} for help formatting this field.
*/
function get_version_sample(string $formattedName): void
{
// Create a client.
$apiHubClient = new ApiHubClient();
// Prepare the request message.
$request = (new GetVersionRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
/** @var Version $response */
$response = $apiHubClient->getVersion($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 = ApiHubClient::versionName('[PROJECT]', '[LOCATION]', '[API]', '[VERSION]');
get_version_sample($formattedName);
}
listApiOperations
List operations in an API version.
The async variant is ApiHubClient::listApiOperationsAsync() .
request
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\ApiCore\PagedListResponse;
use Google\Cloud\ApiHub\V1\Client\ApiHubClient;
use Google\Cloud\ApiHub\V1\ListApiOperationsRequest;
/**
* @param string $formattedParent The parent which owns this collection of operations i.e., the API
* version. Format:
* `projects/{project}/locations/{location}/apis/{api}/versions/{version}`
* Please see {@see ApiHubClient::versionName()} for help formatting this field.
*/
function list_api_operations_sample(string $formattedParent): void
{
// Create a client.
$apiHubClient = new ApiHubClient();
// Prepare the request message.
$request = (new ListApiOperationsRequest())
->setParent($formattedParent);
// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $apiHubClient->listApiOperations($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 = ApiHubClient::versionName('[PROJECT]', '[LOCATION]', '[API]', '[VERSION]');
list_api_operations_sample($formattedParent);
}
listApis
List API resources in the API hub.
The async variant is ApiHubClient::listApisAsync() .
request
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\ApiCore\PagedListResponse;
use Google\Cloud\ApiHub\V1\Client\ApiHubClient;
use Google\Cloud\ApiHub\V1\ListApisRequest;
/**
* @param string $formattedParent The parent, which owns this collection of API resources.
* Format: `projects/{project}/locations/{location}`
* Please see {@see ApiHubClient::locationName()} for help formatting this field.
*/
function list_apis_sample(string $formattedParent): void
{
// Create a client.
$apiHubClient = new ApiHubClient();
// Prepare the request message.
$request = (new ListApisRequest())
->setParent($formattedParent);
// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $apiHubClient->listApis($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 = ApiHubClient::locationName('[PROJECT]', '[LOCATION]');
list_apis_sample($formattedParent);
}
listAttributes
List all attributes.
The async variant is ApiHubClient::listAttributesAsync() .
request
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\ApiCore\PagedListResponse;
use Google\Cloud\ApiHub\V1\Client\ApiHubClient;
use Google\Cloud\ApiHub\V1\ListAttributesRequest;
/**
* @param string $formattedParent The parent resource for Attribute.
* Format: `projects/{project}/locations/{location}`
* Please see {@see ApiHubClient::locationName()} for help formatting this field.
*/
function list_attributes_sample(string $formattedParent): void
{
// Create a client.
$apiHubClient = new ApiHubClient();
// Prepare the request message.
$request = (new ListAttributesRequest())
->setParent($formattedParent);
// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $apiHubClient->listAttributes($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 = ApiHubClient::locationName('[PROJECT]', '[LOCATION]');
list_attributes_sample($formattedParent);
}
listDeployments
List deployment resources in the API hub.
The async variant is ApiHubClient::listDeploymentsAsync() .
request
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\ApiCore\PagedListResponse;
use Google\Cloud\ApiHub\V1\Client\ApiHubClient;
use Google\Cloud\ApiHub\V1\ListDeploymentsRequest;
/**
* @param string $formattedParent The parent, which owns this collection of deployment resources.
* Format: `projects/{project}/locations/{location}`
* Please see {@see ApiHubClient::locationName()} for help formatting this field.
*/
function list_deployments_sample(string $formattedParent): void
{
// Create a client.
$apiHubClient = new ApiHubClient();
// Prepare the request message.
$request = (new ListDeploymentsRequest())
->setParent($formattedParent);
// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $apiHubClient->listDeployments($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 = ApiHubClient::locationName('[PROJECT]', '[LOCATION]');
list_deployments_sample($formattedParent);
}
listExternalApis
List External API resources in the API hub.
The async variant is ApiHubClient::listExternalApisAsync() .
request
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\ApiCore\PagedListResponse;
use Google\Cloud\ApiHub\V1\Client\ApiHubClient;
use Google\Cloud\ApiHub\V1\ListExternalApisRequest;
/**
* @param string $formattedParent The parent, which owns this collection of External API resources.
* Format: `projects/{project}/locations/{location}`
* Please see {@see ApiHubClient::locationName()} for help formatting this field.
*/
function list_external_apis_sample(string $formattedParent): void
{
// Create a client.
$apiHubClient = new ApiHubClient();
// Prepare the request message.
$request = (new ListExternalApisRequest())
->setParent($formattedParent);
// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $apiHubClient->listExternalApis($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 = ApiHubClient::locationName('[PROJECT]', '[LOCATION]');
list_external_apis_sample($formattedParent);
}
listSpecs
List specs corresponding to a particular API resource.
The async variant is ApiHubClient::listSpecsAsync() .
request
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\ApiCore\PagedListResponse;
use Google\Cloud\ApiHub\V1\Client\ApiHubClient;
use Google\Cloud\ApiHub\V1\ListSpecsRequest;
/**
* @param string $formattedParent The parent, which owns this collection of specs.
* Format:
* `projects/{project}/locations/{location}/apis/{api}/versions/{version}`
* Please see {@see ApiHubClient::versionName()} for help formatting this field.
*/
function list_specs_sample(string $formattedParent): void
{
// Create a client.
$apiHubClient = new ApiHubClient();
// Prepare the request message.
$request = (new ListSpecsRequest())
->setParent($formattedParent);
// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $apiHubClient->listSpecs($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 = ApiHubClient::versionName('[PROJECT]', '[LOCATION]', '[API]', '[VERSION]');
list_specs_sample($formattedParent);
}
listVersions
List API versions of an API resource in the API hub.
The async variant is ApiHubClient::listVersionsAsync() .
request
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\ApiCore\PagedListResponse;
use Google\Cloud\ApiHub\V1\Client\ApiHubClient;
use Google\Cloud\ApiHub\V1\ListVersionsRequest;
/**
* @param string $formattedParent The parent which owns this collection of API versions i.e., the
* API resource Format: `projects/{project}/locations/{location}/apis/{api}`
* Please see {@see ApiHubClient::apiName()} for help formatting this field.
*/
function list_versions_sample(string $formattedParent): void
{
// Create a client.
$apiHubClient = new ApiHubClient();
// Prepare the request message.
$request = (new ListVersionsRequest())
->setParent($formattedParent);
// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $apiHubClient->listVersions($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 = ApiHubClient::apiName('[PROJECT]', '[LOCATION]', '[API]');
list_versions_sample($formattedParent);
}
searchResources
Search across API-Hub resources.
The async variant is ApiHubClient::searchResourcesAsync() .
request
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\ApiCore\PagedListResponse;
use Google\Cloud\ApiHub\V1\Client\ApiHubClient;
use Google\Cloud\ApiHub\V1\SearchResourcesRequest;
/**
* @param string $formattedLocation The resource name of the location which will be of the type
* `projects/{project_id}/locations/{location_id}`. This field is used to
* identify the instance of API-Hub in which resources should be searched. Please see
* {@see ApiHubClient::locationName()} for help formatting this field.
* @param string $query The free text search query. This query can contain keywords which
* could be related to any detail of the API-Hub resources such display names,
* descriptions, attributes etc.
*/
function search_resources_sample(string $formattedLocation, string $query): void
{
// Create a client.
$apiHubClient = new ApiHubClient();
// Prepare the request message.
$request = (new SearchResourcesRequest())
->setLocation($formattedLocation)
->setQuery($query);
// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $apiHubClient->searchResources($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
{
$formattedLocation = ApiHubClient::locationName('[PROJECT]', '[LOCATION]');
$query = '[QUERY]';
search_resources_sample($formattedLocation, $query);
}
updateApi
Update an API resource in the API hub. The following fields in the API can be updated:
- display_name
- description
- owner
- documentation
- target_user
- team
- business_unit
- maturity_level
- api_style
- attributes
The update_mask should be used to specify the fields being updated.
Updating the owner field requires complete owner message and updates both owner and email fields.
The async variant is ApiHubClient::updateApiAsync() .
request
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\Api;
use Google\Cloud\ApiHub\V1\Client\ApiHubClient;
use Google\Cloud\ApiHub\V1\UpdateApiRequest;
use Google\Protobuf\FieldMask;
/**
* @param string $apiDisplayName The display name of the API resource.
*/
function update_api_sample(string $apiDisplayName): void
{
// Create a client.
$apiHubClient = new ApiHubClient();
// Prepare the request message.
$api = (new Api())
->setDisplayName($apiDisplayName);
$updateMask = new FieldMask();
$request = (new UpdateApiRequest())
->setApi($api)
->setUpdateMask($updateMask);
// Call the API and handle any network failures.
try {
/** @var Api $response */
$response = $apiHubClient->updateApi($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
{
$apiDisplayName = '[DISPLAY_NAME]';
update_api_sample($apiDisplayName);
}
updateApiOperation
Update an operation in an API version. The following fields in the ApiOperation resource can be updated:
- details.description
- details.documentation
- details.http_operation.path
- details.http_operation.method
- details.deprecated
- attributes
The update_mask should be used to specify the fields being updated.
An operation can be updated only if the operation was created via CreateApiOperation API. If the operation was created by parsing the spec, then it can be edited by updating the spec.
The async variant is ApiHubClient::updateApiOperationAsync() .
request
Google\Cloud\ApiHub\V1\UpdateApiOperationRequest
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\ApiOperation;
use Google\Cloud\ApiHub\V1\Client\ApiHubClient;
use Google\Cloud\ApiHub\V1\UpdateApiOperationRequest;
use Google\Protobuf\FieldMask;
/**
* 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 update_api_operation_sample(): void
{
// Create a client.
$apiHubClient = new ApiHubClient();
// Prepare the request message.
$apiOperation = new ApiOperation();
$updateMask = new FieldMask();
$request = (new UpdateApiOperationRequest())
->setApiOperation($apiOperation)
->setUpdateMask($updateMask);
// Call the API and handle any network failures.
try {
/** @var ApiOperation $response */
$response = $apiHubClient->updateApiOperation($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
updateAttribute
Update the attribute. The following fields in the Attribute resource can be updated:
- display_name The display name can be updated for user defined attributes only.
- description The description can be updated for user defined attributes only.
- allowed_values To update the list of allowed values, clients need to use the fetched list of allowed values and add or remove values to or from the same list. The mutable allowed values can be updated for both user defined and System defined attributes. The immutable allowed values cannot be updated or deleted. The updated list of allowed values cannot be empty. If an allowed value that is already used by some resource's attribute is deleted, then the association between the resource and the attribute value will also be deleted.
- cardinality The cardinality can be updated for user defined attributes only. Cardinality can only be increased during an update.
The update_mask should be used to specify the fields being updated.
The async variant is ApiHubClient::updateAttributeAsync() .
request
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\Attribute;
use Google\Cloud\ApiHub\V1\Attribute\DataType;
use Google\Cloud\ApiHub\V1\Attribute\Scope;
use Google\Cloud\ApiHub\V1\Client\ApiHubClient;
use Google\Cloud\ApiHub\V1\UpdateAttributeRequest;
use Google\Protobuf\FieldMask;
/**
* @param string $attributeDisplayName The display name of the attribute.
* @param int $attributeScope The scope of the attribute. It represents the resource in the API
* Hub to which the attribute can be linked.
* @param int $attributeDataType The type of the data of the attribute.
*/
function update_attribute_sample(
string $attributeDisplayName,
int $attributeScope,
int $attributeDataType
): void {
// Create a client.
$apiHubClient = new ApiHubClient();
// Prepare the request message.
$attribute = (new Attribute())
->setDisplayName($attributeDisplayName)
->setScope($attributeScope)
->setDataType($attributeDataType);
$updateMask = new FieldMask();
$request = (new UpdateAttributeRequest())
->setAttribute($attribute)
->setUpdateMask($updateMask);
// Call the API and handle any network failures.
try {
/** @var Attribute $response */
$response = $apiHubClient->updateAttribute($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
{
$attributeDisplayName = '[DISPLAY_NAME]';
$attributeScope = Scope::SCOPE_UNSPECIFIED;
$attributeDataType = DataType::DATA_TYPE_UNSPECIFIED;
update_attribute_sample($attributeDisplayName, $attributeScope, $attributeDataType);
}
updateDeployment
Update a deployment resource in the API hub. The following fields in the deployment resource can be updated:
- display_name
- description
- documentation
- deployment_type
- resource_uri
- endpoints
- slo
- environment
- attributes
- source_project
- source_environment
- management_url
- source_uri The update_mask should be used to specify the fields being updated.
The async variant is ApiHubClient::updateDeploymentAsync() .
request
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\AttributeValues;
use Google\Cloud\ApiHub\V1\Client\ApiHubClient;
use Google\Cloud\ApiHub\V1\Deployment;
use Google\Cloud\ApiHub\V1\UpdateDeploymentRequest;
use Google\Protobuf\FieldMask;
/**
* @param string $deploymentDisplayName The display name of the deployment.
* @param string $deploymentResourceUri The resource URI identifies the deployment within its gateway.
* For Apigee gateways, its recommended to use the format:
* organizations/{org}/environments/{env}/apis/{api}.
* For ex: if a proxy with name `orders` is deployed in `staging`
* environment of `cymbal` organization, the resource URI would be:
* `organizations/cymbal/environments/staging/apis/orders`.
* @param string $deploymentEndpointsElement The endpoints at which this deployment resource is listening for
* API requests. This could be a list of complete URIs, hostnames or an IP
* addresses.
*/
function update_deployment_sample(
string $deploymentDisplayName,
string $deploymentResourceUri,
string $deploymentEndpointsElement
): void {
// Create a client.
$apiHubClient = new ApiHubClient();
// Prepare the request message.
$deploymentDeploymentType = new AttributeValues();
$deploymentEndpoints = [$deploymentEndpointsElement,];
$deployment = (new Deployment())
->setDisplayName($deploymentDisplayName)
->setDeploymentType($deploymentDeploymentType)
->setResourceUri($deploymentResourceUri)
->setEndpoints($deploymentEndpoints);
$updateMask = new FieldMask();
$request = (new UpdateDeploymentRequest())
->setDeployment($deployment)
->setUpdateMask($updateMask);
// Call the API and handle any network failures.
try {
/** @var Deployment $response */
$response = $apiHubClient->updateDeployment($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
{
$deploymentDisplayName = '[DISPLAY_NAME]';
$deploymentResourceUri = '[RESOURCE_URI]';
$deploymentEndpointsElement = '[ENDPOINTS]';
update_deployment_sample(
$deploymentDisplayName,
$deploymentResourceUri,
$deploymentEndpointsElement
);
}
updateExternalApi
Update an External API resource in the API hub. The following fields can be updated:
The update_mask should be used to specify the fields being updated.
The async variant is ApiHubClient::updateExternalApiAsync() .
request
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\ApiHubClient;
use Google\Cloud\ApiHub\V1\ExternalApi;
use Google\Cloud\ApiHub\V1\UpdateExternalApiRequest;
use Google\Protobuf\FieldMask;
/**
* @param string $externalApiDisplayName Display name of the external API. Max length is 63 characters
* (Unicode Code Points).
*/
function update_external_api_sample(string $externalApiDisplayName): void
{
// Create a client.
$apiHubClient = new ApiHubClient();
// Prepare the request message.
$externalApi = (new ExternalApi())
->setDisplayName($externalApiDisplayName);
$updateMask = new FieldMask();
$request = (new UpdateExternalApiRequest())
->setExternalApi($externalApi)
->setUpdateMask($updateMask);
// Call the API and handle any network failures.
try {
/** @var ExternalApi $response */
$response = $apiHubClient->updateExternalApi($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
{
$externalApiDisplayName = '[DISPLAY_NAME]';
update_external_api_sample($externalApiDisplayName);
}
updateSpec
Update spec. The following fields in the spec can be updated:
In case of an OAS spec, updating spec contents can lead to:
- Creation, deletion and update of operations.
- Creation, deletion and update of definitions.
- Update of other info parsed out from the new spec.
In case of contents or source_uri being present in update mask, spec_type must also be present. Also, spec_type can not be present in update mask if contents or source_uri is not present.
The update_mask should be used to specify the fields being updated.
The async variant is ApiHubClient::updateSpecAsync() .
request
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\AttributeValues;
use Google\Cloud\ApiHub\V1\Client\ApiHubClient;
use Google\Cloud\ApiHub\V1\Spec;
use Google\Cloud\ApiHub\V1\UpdateSpecRequest;
use Google\Protobuf\FieldMask;
/**
* @param string $specDisplayName The display name of the spec.
* This can contain the file name of the spec.
*/
function update_spec_sample(string $specDisplayName): void
{
// Create a client.
$apiHubClient = new ApiHubClient();
// Prepare the request message.
$specSpecType = new AttributeValues();
$spec = (new Spec())
->setDisplayName($specDisplayName)
->setSpecType($specSpecType);
$updateMask = new FieldMask();
$request = (new UpdateSpecRequest())
->setSpec($spec)
->setUpdateMask($updateMask);
// Call the API and handle any network failures.
try {
/** @var Spec $response */
$response = $apiHubClient->updateSpec($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
{
$specDisplayName = '[DISPLAY_NAME]';
update_spec_sample($specDisplayName);
}
updateVersion
Update API version. The following fields in the version can be updated currently:
The update_mask should be used to specify the fields being updated.
The async variant is ApiHubClient::updateVersionAsync() .
request
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\ApiHubClient;
use Google\Cloud\ApiHub\V1\UpdateVersionRequest;
use Google\Cloud\ApiHub\V1\Version;
use Google\Protobuf\FieldMask;
/**
* @param string $versionDisplayName The display name of the version.
*/
function update_version_sample(string $versionDisplayName): void
{
// Create a client.
$apiHubClient = new ApiHubClient();
// Prepare the request message.
$version = (new Version())
->setDisplayName($versionDisplayName);
$updateMask = new FieldMask();
$request = (new UpdateVersionRequest())
->setVersion($version)
->setUpdateMask($updateMask);
// Call the API and handle any network failures.
try {
/** @var Version $response */
$response = $apiHubClient->updateVersion($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
{
$versionDisplayName = '[DISPLAY_NAME]';
update_version_sample($versionDisplayName);
}
getLocation
Gets information about a location.
The async variant is ApiHubClient::getLocationAsync() .
request
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\ApiHubClient;
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.
$apiHubClient = new ApiHubClient();
// Prepare the request message.
$request = new GetLocationRequest();
// Call the API and handle any network failures.
try {
/** @var Location $response */
$response = $apiHubClient->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 ApiHubClient::listLocationsAsync() .
request
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\ApiCore\PagedListResponse;
use Google\Cloud\ApiHub\V1\Client\ApiHubClient;
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.
$apiHubClient = new ApiHubClient();
// Prepare the request message.
$request = new ListLocationsRequest();
// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $apiHubClient->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());
}
}
createApiAsync
createApiOperationAsync
optionalArgs
array
createAttributeAsync
optionalArgs
array
createDeploymentAsync
optionalArgs
array
createExternalApiAsync
optionalArgs
array
createSpecAsync
createVersionAsync
deleteApiAsync
deleteApiOperationAsync
optionalArgs
array
deleteAttributeAsync
optionalArgs
array
deleteDeploymentAsync
optionalArgs
array
deleteExternalApiAsync
optionalArgs
array
deleteSpecAsync
deleteVersionAsync
getApiAsync
getApiOperationAsync
optionalArgs
array
getAttributeAsync
getDefinitionAsync
getDeploymentAsync
getExternalApiAsync
getSpecAsync
getSpecContentsAsync
optionalArgs
array
getVersionAsync
listApiOperationsAsync
optionalArgs
array
listApisAsync
listAttributesAsync
listDeploymentsAsync
optionalArgs
array
listExternalApisAsync
optionalArgs
array
listSpecsAsync
listVersionsAsync
searchResourcesAsync
optionalArgs
array
updateApiAsync
updateApiOperationAsync
optionalArgs
array
updateAttributeAsync
optionalArgs
array
updateDeploymentAsync
optionalArgs
array
updateExternalApiAsync
optionalArgs
array
updateSpecAsync
updateVersionAsync
getLocationAsync
listLocationsAsync
static::apiName
Formats a string containing the fully-qualified path to represent a api resource.
project
string
location
string
api
string
string
static::apiOperationName
Formats a string containing the fully-qualified path to represent a api_operation resource.
project
string
location
string
api
string
version
string
operation
string
string
static::attributeName
Formats a string containing the fully-qualified path to represent a attribute resource.
project
string
location
string
attribute
string
string
static::definitionName
Formats a string containing the fully-qualified path to represent a definition resource.
project
string
location
string
api
string
version
string
definition
string
string
static::deploymentName
Formats a string containing the fully-qualified path to represent a deployment resource.
project
string
location
string
deployment
string
string
static::externalApiName
Formats a string containing the fully-qualified path to represent a external_api resource.
project
string
location
string
externalApi
string
string
static::locationName
Formats a string containing the fully-qualified path to represent a location resource.
project
string
location
string
string
static::pluginInstanceName
Formats a string containing the fully-qualified path to represent a plugin_instance resource.
project
string
location
string
plugin
string
instance
string
string
static::specName
Formats a string containing the fully-qualified path to represent a spec resource.
project
string
location
string
api
string
version
string
spec
string
string
static::versionName
Formats a string containing the fully-qualified path to represent a version resource.
project
string
location
string
api
string
version
string
string
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
- api: projects/{project}/locations/{location}/apis/{api}
- apiOperation: projects/{project}/locations/{location}/apis/{api}/versions/{version}/operations/{operation}
- attribute: projects/{project}/locations/{location}/attributes/{attribute}
- definition: projects/{project}/locations/{location}/apis/{api}/versions/{version}/definitions/{definition}
- deployment: projects/{project}/locations/{location}/deployments/{deployment}
- externalApi: projects/{project}/locations/{location}/externalApis/{external_api}
- location: projects/{project}/locations/{location}
- pluginInstance: projects/{project}/locations/{location}/plugins/{plugin}/instances/{instance}
- spec: projects/{project}/locations/{location}/apis/{api}/versions/{version}/specs/{spec}
- version: projects/{project}/locations/{location}/apis/{api}/versions/{version}
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.
formattedName
string
The formatted name string
template
?string
Optional name of template to match
array

