Reference documentation and code samples for the Google Cloud Agent Registry V1 Client class AgentRegistryClient.
Service Description: Service for managing Agents, Endpoints, McpServers, Services, and Bindings.
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 \ AgentRegistry \ V1 \ ClientMethods
__construct
Constructor.
| Parameters | |
|---|---|
| Name | Description |
options |
array|Google\ApiCore\Options\ClientOptions
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 |
Google\Auth\FetchAuthTokenInterface|Google\ApiCore\CredentialsWrapper
This option should only be used with a pre-constructed Google\Auth\FetchAuthTokenInterface or Google\ApiCore\CredentialsWrapper object. Note that when one of these objects are provided, any settings in $credentialsConfig will be ignored. Important: If you are providing a path to a credentials file, or a decoded credentials file as a PHP array, this usage is now DEPRECATED. Providing an unvalidated credential configuration to Google APIs can compromise the security of your systems and data. It is recommended to create the credentials explicitly |
↳ credentialsConfig |
array
Options used to configure credentials, including auth token caching, for the client. For a full list of supporting configuration options, see Google\ApiCore\CredentialsWrapper::build() . |
↳ disableRetries |
bool
Determines whether or not retries defined by the client configuration should be disabled. Defaults to |
↳ clientConfig |
string|array
Client method configuration, including retry settings. This option can be either a path to a JSON file, or a PHP array containing the decoded JSON data. By default this settings points to the default client config file, which is provided in the resources folder. |
↳ transport |
string|Google\ApiCore\Transport\TransportInterface
The transport used for executing network requests. May be either the string |
↳ transportConfig |
array
Configuration options that will be used to construct the transport. Options for each supported transport type should be passed in a key for that transport. For example: $transportConfig = [ 'grpc' => [...], 'rest' => [...], ]; See the Google\ApiCore\Transport\GrpcTransport::build() and Google\ApiCore\Transport\RestTransport::build() methods for the supported options. |
↳ clientCertSource |
callable
A callable which returns the client cert as a string. This can be used to provide a certificate and private key to the transport layer for mTLS. |
↳ logger |
false|Psr\Log\LoggerInterface
A PSR-3 compliant logger. If set to false, logging is disabled, ignoring the 'GOOGLE_SDK_PHP_LOGGING' environment flag |
↳ universeDomain |
string
The service domain for the client. Defaults to 'googleapis.com'. |
createBinding
Creates a new Binding in a given project and location.
The async variant is AgentRegistryClient::createBindingAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\AgentRegistry\V1\CreateBindingRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
Google\ApiCore\RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Returns | |
|---|---|
| Type | Description |
Google\ApiCore\OperationResponse<Google\Cloud\AgentRegistry\V1\Binding> |
|
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\AgentRegistry\V1\Binding;
use Google\Cloud\AgentRegistry\V1\Binding\Target;
use Google\Cloud\AgentRegistry\V1\Client\AgentRegistryClient;
use Google\Cloud\AgentRegistry\V1\CreateBindingRequest;
use Google\Rpc\Status;
/**
* @param string $formattedParent The project and location to create the Binding in.
* Expected format: `projects/{project}/locations/{location}`. Please see
* {@see AgentRegistryClient::locationName()} for help formatting this field.
* @param string $bindingId The ID to use for the binding, which will become the final
* component of the binding's resource name.
*
* This value should be 4-63 characters, and must conform to RFC-1034.
* Specifically, it must match the regular expression
* `^[a-z]([a-z0-9-]{0,61}[a-z0-9])?$`.
* @param string $bindingName Identifier. The resource name of the Binding.
* Format: `projects/{project}/locations/{location}/bindings/{binding}`.
*/
function create_binding_sample(
string $formattedParent,
string $bindingId,
string $bindingName
): void {
// Create a client.
$agentRegistryClient = new AgentRegistryClient();
// Prepare the request message.
$bindingTarget = new Target();
$binding = (new Binding())
->setName($bindingName)
->setTarget($bindingTarget);
$request = (new CreateBindingRequest())
->setParent($formattedParent)
->setBindingId($bindingId)
->setBinding($binding);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $agentRegistryClient->createBinding($request);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
/** @var Binding $result */
$result = $response->getResult();
printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
} else {
/** @var Status $error */
$error = $response->getError();
printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
}
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedParent = AgentRegistryClient::locationName('[PROJECT]', '[LOCATION]');
$bindingId = '[BINDING_ID]';
$bindingName = '[NAME]';
create_binding_sample($formattedParent, $bindingId, $bindingName);
}
createService
Creates a new Service in a given project and location.
The async variant is AgentRegistryClient::createServiceAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\AgentRegistry\V1\CreateServiceRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
Google\ApiCore\RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Returns | |
|---|---|
| Type | Description |
Google\ApiCore\OperationResponse<Google\Cloud\AgentRegistry\V1\Service> |
|
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\AgentRegistry\V1\Client\AgentRegistryClient;
use Google\Cloud\AgentRegistry\V1\CreateServiceRequest;
use Google\Cloud\AgentRegistry\V1\Service;
use Google\Rpc\Status;
/**
* @param string $formattedParent The project and location to create the Service in.
* Expected format: `projects/{project}/locations/{location}`. Please see
* {@see AgentRegistryClient::locationName()} for help formatting this field.
* @param string $serviceId The ID to use for the service, which will become the final
* component of the service's resource name.
*
* This value should be 4-63 characters, and valid characters
* are `/[a-z][0-9]-/`.
*/
function create_service_sample(string $formattedParent, string $serviceId): void
{
// Create a client.
$agentRegistryClient = new AgentRegistryClient();
// Prepare the request message.
$service = new Service();
$request = (new CreateServiceRequest())
->setParent($formattedParent)
->setServiceId($serviceId)
->setService($service);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $agentRegistryClient->createService($request);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
/** @var Service $result */
$result = $response->getResult();
printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
} else {
/** @var Status $error */
$error = $response->getError();
printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
}
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedParent = AgentRegistryClient::locationName('[PROJECT]', '[LOCATION]');
$serviceId = '[SERVICE_ID]';
create_service_sample($formattedParent, $serviceId);
}
deleteBinding
Deletes a single Binding.
The async variant is AgentRegistryClient::deleteBindingAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\AgentRegistry\V1\DeleteBindingRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
Google\ApiCore\RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Returns | |
|---|---|
| Type | Description |
Google\ApiCore\OperationResponse<null> |
|
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\AgentRegistry\V1\Client\AgentRegistryClient;
use Google\Cloud\AgentRegistry\V1\DeleteBindingRequest;
use Google\Rpc\Status;
/**
* @param string $formattedName The name of the Binding.
* Format: `projects/{project}/locations/{location}/bindings/{binding}`. Please see
* {@see AgentRegistryClient::bindingName()} for help formatting this field.
*/
function delete_binding_sample(string $formattedName): void
{
// Create a client.
$agentRegistryClient = new AgentRegistryClient();
// Prepare the request message.
$request = (new DeleteBindingRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $agentRegistryClient->deleteBinding($request);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
printf('Operation completed successfully.' . PHP_EOL);
} else {
/** @var Status $error */
$error = $response->getError();
printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
}
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedName = AgentRegistryClient::bindingName('[PROJECT]', '[LOCATION]', '[BINDING]');
delete_binding_sample($formattedName);
}
deleteService
Deletes a single Service.
The async variant is AgentRegistryClient::deleteServiceAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\AgentRegistry\V1\DeleteServiceRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
Google\ApiCore\RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Returns | |
|---|---|
| Type | Description |
Google\ApiCore\OperationResponse<null> |
|
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\AgentRegistry\V1\Client\AgentRegistryClient;
use Google\Cloud\AgentRegistry\V1\DeleteServiceRequest;
use Google\Rpc\Status;
/**
* @param string $formattedName The name of the Service.
* Format: `projects/{project}/locations/{location}/services/{service}`. Please see
* {@see AgentRegistryClient::serviceName()} for help formatting this field.
*/
function delete_service_sample(string $formattedName): void
{
// Create a client.
$agentRegistryClient = new AgentRegistryClient();
// Prepare the request message.
$request = (new DeleteServiceRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $agentRegistryClient->deleteService($request);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
printf('Operation completed successfully.' . PHP_EOL);
} else {
/** @var Status $error */
$error = $response->getError();
printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
}
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedName = AgentRegistryClient::serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]');
delete_service_sample($formattedName);
}
fetchAvailableBindings
Fetches available Bindings.
The async variant is AgentRegistryClient::fetchAvailableBindingsAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\AgentRegistry\V1\FetchAvailableBindingsRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
Google\ApiCore\RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Returns | |
|---|---|
| Type | Description |
Google\ApiCore\PagedListResponse |
|
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\AgentRegistry\V1\Binding;
use Google\Cloud\AgentRegistry\V1\Client\AgentRegistryClient;
use Google\Cloud\AgentRegistry\V1\FetchAvailableBindingsRequest;
/**
* @param string $formattedParent The parent, in the format
* `projects/{project}/locations/{location}`. Please see
* {@see AgentRegistryClient::locationName()} for help formatting this field.
*/
function fetch_available_bindings_sample(string $formattedParent): void
{
// Create a client.
$agentRegistryClient = new AgentRegistryClient();
// Prepare the request message.
$request = (new FetchAvailableBindingsRequest())
->setParent($formattedParent);
// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $agentRegistryClient->fetchAvailableBindings($request);
/** @var Binding $element */
foreach ($response as $element) {
printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
}
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedParent = AgentRegistryClient::locationName('[PROJECT]', '[LOCATION]');
fetch_available_bindings_sample($formattedParent);
}
getAgent
Gets details of a single Agent.
The async variant is AgentRegistryClient::getAgentAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\AgentRegistry\V1\GetAgentRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
Google\ApiCore\RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Returns | |
|---|---|
| Type | Description |
Google\Cloud\AgentRegistry\V1\Agent |
|
use Google\ApiCore\ApiException;
use Google\Cloud\AgentRegistry\V1\Agent;
use Google\Cloud\AgentRegistry\V1\Client\AgentRegistryClient;
use Google\Cloud\AgentRegistry\V1\GetAgentRequest;
/**
* @param string $formattedName Name of the resource
* Please see {@see AgentRegistryClient::agentName()} for help formatting this field.
*/
function get_agent_sample(string $formattedName): void
{
// Create a client.
$agentRegistryClient = new AgentRegistryClient();
// Prepare the request message.
$request = (new GetAgentRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
/** @var Agent $response */
$response = $agentRegistryClient->getAgent($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 = AgentRegistryClient::agentName('[PROJECT]', '[LOCATION]', '[AGENT]');
get_agent_sample($formattedName);
}
getBinding
Gets details of a single Binding.
The async variant is AgentRegistryClient::getBindingAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\AgentRegistry\V1\GetBindingRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
Google\ApiCore\RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Returns | |
|---|---|
| Type | Description |
Google\Cloud\AgentRegistry\V1\Binding |
|
use Google\ApiCore\ApiException;
use Google\Cloud\AgentRegistry\V1\Binding;
use Google\Cloud\AgentRegistry\V1\Client\AgentRegistryClient;
use Google\Cloud\AgentRegistry\V1\GetBindingRequest;
/**
* @param string $formattedName The name of the Binding.
* Format: `projects/{project}/locations/{location}/bindings/{binding}`. Please see
* {@see AgentRegistryClient::bindingName()} for help formatting this field.
*/
function get_binding_sample(string $formattedName): void
{
// Create a client.
$agentRegistryClient = new AgentRegistryClient();
// Prepare the request message.
$request = (new GetBindingRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
/** @var Binding $response */
$response = $agentRegistryClient->getBinding($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 = AgentRegistryClient::bindingName('[PROJECT]', '[LOCATION]', '[BINDING]');
get_binding_sample($formattedName);
}
getEndpoint
Gets details of a single Endpoint.
The async variant is AgentRegistryClient::getEndpointAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\AgentRegistry\V1\GetEndpointRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
Google\ApiCore\RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Returns | |
|---|---|
| Type | Description |
Google\Cloud\AgentRegistry\V1\Endpoint |
|
use Google\ApiCore\ApiException;
use Google\Cloud\AgentRegistry\V1\Client\AgentRegistryClient;
use Google\Cloud\AgentRegistry\V1\Endpoint;
use Google\Cloud\AgentRegistry\V1\GetEndpointRequest;
/**
* @param string $formattedName The name of the endpoint to retrieve.
* Format: `projects/{project}/locations/{location}/endpoints/{endpoint}`
* Please see {@see AgentRegistryClient::endpointName()} for help formatting this field.
*/
function get_endpoint_sample(string $formattedName): void
{
// Create a client.
$agentRegistryClient = new AgentRegistryClient();
// Prepare the request message.
$request = (new GetEndpointRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
/** @var Endpoint $response */
$response = $agentRegistryClient->getEndpoint($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 = AgentRegistryClient::endpointName('[PROJECT]', '[LOCATION]', '[ENDPOINT]');
get_endpoint_sample($formattedName);
}
getMcpServer
Gets details of a single McpServer.
The async variant is AgentRegistryClient::getMcpServerAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\AgentRegistry\V1\GetMcpServerRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
Google\ApiCore\RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Returns | |
|---|---|
| Type | Description |
Google\Cloud\AgentRegistry\V1\McpServer |
|
use Google\ApiCore\ApiException;
use Google\Cloud\AgentRegistry\V1\Client\AgentRegistryClient;
use Google\Cloud\AgentRegistry\V1\GetMcpServerRequest;
use Google\Cloud\AgentRegistry\V1\McpServer;
/**
* @param string $formattedName Name of the resource
* Please see {@see AgentRegistryClient::mcpServerName()} for help formatting this field.
*/
function get_mcp_server_sample(string $formattedName): void
{
// Create a client.
$agentRegistryClient = new AgentRegistryClient();
// Prepare the request message.
$request = (new GetMcpServerRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
/** @var McpServer $response */
$response = $agentRegistryClient->getMcpServer($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 = AgentRegistryClient::mcpServerName('[PROJECT]', '[LOCATION]', '[MCP_SERVER]');
get_mcp_server_sample($formattedName);
}
getService
Gets details of a single Service.
The async variant is AgentRegistryClient::getServiceAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\AgentRegistry\V1\GetServiceRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
Google\ApiCore\RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Returns | |
|---|---|
| Type | Description |
Google\Cloud\AgentRegistry\V1\Service |
|
use Google\ApiCore\ApiException;
use Google\Cloud\AgentRegistry\V1\Client\AgentRegistryClient;
use Google\Cloud\AgentRegistry\V1\GetServiceRequest;
use Google\Cloud\AgentRegistry\V1\Service;
/**
* @param string $formattedName The name of the Service.
* Format: `projects/{project}/locations/{location}/services/{service}`. Please see
* {@see AgentRegistryClient::serviceName()} for help formatting this field.
*/
function get_service_sample(string $formattedName): void
{
// Create a client.
$agentRegistryClient = new AgentRegistryClient();
// Prepare the request message.
$request = (new GetServiceRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
/** @var Service $response */
$response = $agentRegistryClient->getService($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 = AgentRegistryClient::serviceName('[PROJECT]', '[LOCATION]', '[SERVICE]');
get_service_sample($formattedName);
}
listAgents
Lists Agents in a given project and location.
The async variant is AgentRegistryClient::listAgentsAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\AgentRegistry\V1\ListAgentsRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
Google\ApiCore\RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Returns | |
|---|---|
| Type | Description |
Google\ApiCore\PagedListResponse |
|
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\AgentRegistry\V1\Agent;
use Google\Cloud\AgentRegistry\V1\Client\AgentRegistryClient;
use Google\Cloud\AgentRegistry\V1\ListAgentsRequest;
/**
* @param string $formattedParent Parent value for ListAgentsRequest
* Please see {@see AgentRegistryClient::locationName()} for help formatting this field.
*/
function list_agents_sample(string $formattedParent): void
{
// Create a client.
$agentRegistryClient = new AgentRegistryClient();
// Prepare the request message.
$request = (new ListAgentsRequest())
->setParent($formattedParent);
// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $agentRegistryClient->listAgents($request);
/** @var Agent $element */
foreach ($response as $element) {
printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
}
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedParent = AgentRegistryClient::locationName('[PROJECT]', '[LOCATION]');
list_agents_sample($formattedParent);
}
listBindings
Lists Bindings in a given project and location.
The async variant is AgentRegistryClient::listBindingsAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\AgentRegistry\V1\ListBindingsRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
Google\ApiCore\RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Returns | |
|---|---|
| Type | Description |
Google\ApiCore\PagedListResponse |
|
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\AgentRegistry\V1\Binding;
use Google\Cloud\AgentRegistry\V1\Client\AgentRegistryClient;
use Google\Cloud\AgentRegistry\V1\ListBindingsRequest;
/**
* @param string $formattedParent The project and location to list bindings in.
* Expected format: `projects/{project}/locations/{location}`. Please see
* {@see AgentRegistryClient::locationName()} for help formatting this field.
*/
function list_bindings_sample(string $formattedParent): void
{
// Create a client.
$agentRegistryClient = new AgentRegistryClient();
// Prepare the request message.
$request = (new ListBindingsRequest())
->setParent($formattedParent);
// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $agentRegistryClient->listBindings($request);
/** @var Binding $element */
foreach ($response as $element) {
printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
}
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedParent = AgentRegistryClient::locationName('[PROJECT]', '[LOCATION]');
list_bindings_sample($formattedParent);
}
listEndpoints
Lists Endpoints in a given project and location.
The async variant is AgentRegistryClient::listEndpointsAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\AgentRegistry\V1\ListEndpointsRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
Google\ApiCore\RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Returns | |
|---|---|
| Type | Description |
Google\ApiCore\PagedListResponse |
|
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\AgentRegistry\V1\Client\AgentRegistryClient;
use Google\Cloud\AgentRegistry\V1\Endpoint;
use Google\Cloud\AgentRegistry\V1\ListEndpointsRequest;
/**
* @param string $formattedParent The project and location to list endpoints in.
* Expected format: `projects/{project}/locations/{location}`. Please see
* {@see AgentRegistryClient::locationName()} for help formatting this field.
*/
function list_endpoints_sample(string $formattedParent): void
{
// Create a client.
$agentRegistryClient = new AgentRegistryClient();
// Prepare the request message.
$request = (new ListEndpointsRequest())
->setParent($formattedParent);
// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $agentRegistryClient->listEndpoints($request);
/** @var Endpoint $element */
foreach ($response as $element) {
printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
}
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedParent = AgentRegistryClient::locationName('[PROJECT]', '[LOCATION]');
list_endpoints_sample($formattedParent);
}
listMcpServers
Lists McpServers in a given project and location.
The async variant is AgentRegistryClient::listMcpServersAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\AgentRegistry\V1\ListMcpServersRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
Google\ApiCore\RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Returns | |
|---|---|
| Type | Description |
Google\ApiCore\PagedListResponse |
|
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\AgentRegistry\V1\Client\AgentRegistryClient;
use Google\Cloud\AgentRegistry\V1\ListMcpServersRequest;
use Google\Cloud\AgentRegistry\V1\McpServer;
/**
* @param string $formattedParent Parent value for ListMcpServersRequest. Format:
* `projects/{project}/locations/{location}`. Please see
* {@see AgentRegistryClient::locationName()} for help formatting this field.
*/
function list_mcp_servers_sample(string $formattedParent): void
{
// Create a client.
$agentRegistryClient = new AgentRegistryClient();
// Prepare the request message.
$request = (new ListMcpServersRequest())
->setParent($formattedParent);
// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $agentRegistryClient->listMcpServers($request);
/** @var McpServer $element */
foreach ($response as $element) {
printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
}
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedParent = AgentRegistryClient::locationName('[PROJECT]', '[LOCATION]');
list_mcp_servers_sample($formattedParent);
}
listServices
Lists Services in a given project and location.
The async variant is AgentRegistryClient::listServicesAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\AgentRegistry\V1\ListServicesRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
Google\ApiCore\RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Returns | |
|---|---|
| Type | Description |
Google\ApiCore\PagedListResponse |
|
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\AgentRegistry\V1\Client\AgentRegistryClient;
use Google\Cloud\AgentRegistry\V1\ListServicesRequest;
use Google\Cloud\AgentRegistry\V1\Service;
/**
* @param string $formattedParent The project and location to list services in.
* Expected format: `projects/{project}/locations/{location}`. Please see
* {@see AgentRegistryClient::locationName()} for help formatting this field.
*/
function list_services_sample(string $formattedParent): void
{
// Create a client.
$agentRegistryClient = new AgentRegistryClient();
// Prepare the request message.
$request = (new ListServicesRequest())
->setParent($formattedParent);
// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $agentRegistryClient->listServices($request);
/** @var Service $element */
foreach ($response as $element) {
printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
}
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedParent = AgentRegistryClient::locationName('[PROJECT]', '[LOCATION]');
list_services_sample($formattedParent);
}
searchAgents
Searches Agents in a given project and location.
The async variant is AgentRegistryClient::searchAgentsAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\AgentRegistry\V1\SearchAgentsRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
Google\ApiCore\RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Returns | |
|---|---|
| Type | Description |
Google\ApiCore\PagedListResponse |
|
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\AgentRegistry\V1\Agent;
use Google\Cloud\AgentRegistry\V1\Client\AgentRegistryClient;
use Google\Cloud\AgentRegistry\V1\SearchAgentsRequest;
/**
* @param string $formattedParent Parent value for SearchAgentsRequest. Format:
* `projects/{project}/locations/{location}`. Please see
* {@see AgentRegistryClient::locationName()} for help formatting this field.
*/
function search_agents_sample(string $formattedParent): void
{
// Create a client.
$agentRegistryClient = new AgentRegistryClient();
// Prepare the request message.
$request = (new SearchAgentsRequest())
->setParent($formattedParent);
// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $agentRegistryClient->searchAgents($request);
/** @var Agent $element */
foreach ($response as $element) {
printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
}
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedParent = AgentRegistryClient::locationName('[PROJECT]', '[LOCATION]');
search_agents_sample($formattedParent);
}
searchMcpServers
Searches McpServers in a given project and location.
The async variant is AgentRegistryClient::searchMcpServersAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\AgentRegistry\V1\SearchMcpServersRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
Google\ApiCore\RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Returns | |
|---|---|
| Type | Description |
Google\ApiCore\PagedListResponse |
|
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\AgentRegistry\V1\Client\AgentRegistryClient;
use Google\Cloud\AgentRegistry\V1\McpServer;
use Google\Cloud\AgentRegistry\V1\SearchMcpServersRequest;
/**
* @param string $formattedParent Parent value for SearchMcpServersRequest. Format:
* `projects/{project}/locations/{location}`. Please see
* {@see AgentRegistryClient::locationName()} for help formatting this field.
*/
function search_mcp_servers_sample(string $formattedParent): void
{
// Create a client.
$agentRegistryClient = new AgentRegistryClient();
// Prepare the request message.
$request = (new SearchMcpServersRequest())
->setParent($formattedParent);
// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $agentRegistryClient->searchMcpServers($request);
/** @var McpServer $element */
foreach ($response as $element) {
printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
}
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedParent = AgentRegistryClient::locationName('[PROJECT]', '[LOCATION]');
search_mcp_servers_sample($formattedParent);
}
updateBinding
Updates the parameters of a single Binding.
The async variant is AgentRegistryClient::updateBindingAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\AgentRegistry\V1\UpdateBindingRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
Google\ApiCore\RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Returns | |
|---|---|
| Type | Description |
Google\ApiCore\OperationResponse<Google\Cloud\AgentRegistry\V1\Binding> |
|
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\AgentRegistry\V1\Binding;
use Google\Cloud\AgentRegistry\V1\Binding\Target;
use Google\Cloud\AgentRegistry\V1\Client\AgentRegistryClient;
use Google\Cloud\AgentRegistry\V1\UpdateBindingRequest;
use Google\Rpc\Status;
/**
* @param string $bindingName Identifier. The resource name of the Binding.
* Format: `projects/{project}/locations/{location}/bindings/{binding}`.
*/
function update_binding_sample(string $bindingName): void
{
// Create a client.
$agentRegistryClient = new AgentRegistryClient();
// Prepare the request message.
$bindingTarget = new Target();
$binding = (new Binding())
->setName($bindingName)
->setTarget($bindingTarget);
$request = (new UpdateBindingRequest())
->setBinding($binding);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $agentRegistryClient->updateBinding($request);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
/** @var Binding $result */
$result = $response->getResult();
printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
} else {
/** @var Status $error */
$error = $response->getError();
printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
}
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$bindingName = '[NAME]';
update_binding_sample($bindingName);
}
updateService
Updates the parameters of a single Service.
The async variant is AgentRegistryClient::updateServiceAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\AgentRegistry\V1\UpdateServiceRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
Google\ApiCore\RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Returns | |
|---|---|
| Type | Description |
Google\ApiCore\OperationResponse<Google\Cloud\AgentRegistry\V1\Service> |
|
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\AgentRegistry\V1\Client\AgentRegistryClient;
use Google\Cloud\AgentRegistry\V1\Service;
use Google\Cloud\AgentRegistry\V1\UpdateServiceRequest;
use Google\Rpc\Status;
/**
* 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_service_sample(): void
{
// Create a client.
$agentRegistryClient = new AgentRegistryClient();
// Prepare the request message.
$service = new Service();
$request = (new UpdateServiceRequest())
->setService($service);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $agentRegistryClient->updateService($request);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
/** @var Service $result */
$result = $response->getResult();
printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
} else {
/** @var Status $error */
$error = $response->getError();
printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
}
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
getLocation
Gets information about a location.
The async variant is AgentRegistryClient::getLocationAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Location\GetLocationRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
Google\ApiCore\RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Returns | |
|---|---|
| Type | Description |
Google\Cloud\Location\Location |
|
use Google\ApiCore\ApiException;
use Google\Cloud\AgentRegistry\V1\Client\AgentRegistryClient;
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.
$agentRegistryClient = new AgentRegistryClient();
// Prepare the request message.
$request = new GetLocationRequest();
// Call the API and handle any network failures.
try {
/** @var Location $response */
$response = $agentRegistryClient->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.
This method lists locations based on the resource scope provided in
the ListLocationsRequest.name field: *
Global locations: If name is empty, the method lists the
public locations available to all projects. * Project-specific
locations: If name follows the format
projects/{project}, the method lists locations visible to that
specific project. This includes public, private, or other
project-specific locations enabled for the project.
For gRPC and client library implementations, the resource name is
passed as the name field. For direct service calls, the resource
name is
incorporated into the request path based on the specific service
implementation and version.
The async variant is AgentRegistryClient::listLocationsAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Location\ListLocationsRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
Google\ApiCore\RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Returns | |
|---|---|
| Type | Description |
Google\ApiCore\PagedListResponse |
|
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\AgentRegistry\V1\Client\AgentRegistryClient;
use Google\Cloud\Location\ListLocationsRequest;
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 list_locations_sample(): void
{
// Create a client.
$agentRegistryClient = new AgentRegistryClient();
// Prepare the request message.
$request = new ListLocationsRequest();
// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $agentRegistryClient->listLocations($request);
/** @var Location $element */
foreach ($response as $element) {
printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
}
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
createBindingAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\AgentRegistry\V1\CreateBindingRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse> |
|
createServiceAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\AgentRegistry\V1\CreateServiceRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse> |
|
deleteBindingAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\AgentRegistry\V1\DeleteBindingRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse> |
|
deleteServiceAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\AgentRegistry\V1\DeleteServiceRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse> |
|
fetchAvailableBindingsAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\AgentRegistry\V1\FetchAvailableBindingsRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\PagedListResponse> |
|
getAgentAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\AgentRegistry\V1\GetAgentRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\AgentRegistry\V1\Agent> |
|
getBindingAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\AgentRegistry\V1\GetBindingRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\AgentRegistry\V1\Binding> |
|
getEndpointAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\AgentRegistry\V1\GetEndpointRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\AgentRegistry\V1\Endpoint> |
|
getMcpServerAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\AgentRegistry\V1\GetMcpServerRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\AgentRegistry\V1\McpServer> |
|
getServiceAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\AgentRegistry\V1\GetServiceRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\AgentRegistry\V1\Service> |
|
listAgentsAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\AgentRegistry\V1\ListAgentsRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\PagedListResponse> |
|
listBindingsAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\AgentRegistry\V1\ListBindingsRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\PagedListResponse> |
|
listEndpointsAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\AgentRegistry\V1\ListEndpointsRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\PagedListResponse> |
|
listMcpServersAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\AgentRegistry\V1\ListMcpServersRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\PagedListResponse> |
|
listServicesAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\AgentRegistry\V1\ListServicesRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\PagedListResponse> |
|
searchAgentsAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\AgentRegistry\V1\SearchAgentsRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\PagedListResponse> |
|
searchMcpServersAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\AgentRegistry\V1\SearchMcpServersRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\PagedListResponse> |
|
updateBindingAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\AgentRegistry\V1\UpdateBindingRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse> |
|
updateServiceAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\AgentRegistry\V1\UpdateServiceRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse> |
|
getLocationAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Location\GetLocationRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Location\Location> |
|
listLocationsAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Location\ListLocationsRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\PagedListResponse> |
|
getOperationsClient
Return an OperationsClient object with the same endpoint as $this.
| Returns | |
|---|---|
| Type | Description |
Google\LongRunning\Client\OperationsClient |
|
resumeOperation
Resume an existing long running operation that was previously started by a long running API method. If $methodName is not provided, or does not match a long running API method, then the operation can still be resumed, but the OperationResponse object will not deserialize the final response.
| Parameters | |
|---|---|
| Name | Description |
operationName |
string
The name of the long running operation |
methodName |
string
The name of the method used to start the operation |
| Returns | |
|---|---|
| Type | Description |
Google\ApiCore\OperationResponse |
|
static::agentName
Formats a string containing the fully-qualified path to represent a agent resource.
| Parameters | |
|---|---|
| Name | Description |
project |
string
|
location |
string
|
agent |
string
|
| Returns | |
|---|---|
| Type | Description |
string |
The formatted agent resource. |
static::bindingName
Formats a string containing the fully-qualified path to represent a binding resource.
| Parameters | |
|---|---|
| Name | Description |
project |
string
|
location |
string
|
binding |
string
|
| Returns | |
|---|---|
| Type | Description |
string |
The formatted binding resource. |
static::endpointName
Formats a string containing the fully-qualified path to represent a endpoint resource.
| Parameters | |
|---|---|
| Name | Description |
project |
string
|
location |
string
|
endpoint |
string
|
| Returns | |
|---|---|
| Type | Description |
string |
The formatted endpoint resource. |
static::locationName
Formats a string containing the fully-qualified path to represent a location resource.
| Parameters | |
|---|---|
| Name | Description |
project |
string
|
location |
string
|
| Returns | |
|---|---|
| Type | Description |
string |
The formatted location resource. |
static::mcpServerName
Formats a string containing the fully-qualified path to represent a mcp_server resource.
| Parameters | |
|---|---|
| Name | Description |
project |
string
|
location |
string
|
mcpServer |
string
|
| Returns | |
|---|---|
| Type | Description |
string |
The formatted mcp_server resource. |
static::serviceName
Formats a string containing the fully-qualified path to represent a service resource.
| Parameters | |
|---|---|
| Name | Description |
project |
string
|
location |
string
|
service |
string
|
| Returns | |
|---|---|
| Type | Description |
string |
The formatted service resource. |
static::parseName
Parses a formatted name string and returns an associative array of the components in the name.
The following name formats are supported: Template: Pattern
- agent: projects/{project}/locations/{location}/agents/{agent}
- binding: projects/{project}/locations/{location}/bindings/{binding}
- endpoint: projects/{project}/locations/{location}/endpoints/{endpoint}
- location: projects/{project}/locations/{location}
- mcpServer: projects/{project}/locations/{location}/mcpServers/{mcp_server}
- service: projects/{project}/locations/{location}/services/{service}
The optional $template argument can be supplied to specify a particular pattern, and must match one of the templates listed above. If no $template argument is provided, or if the $template argument does not match one of the templates listed, then parseName will check each of the supported templates, and return the first match.
| Parameters | |
|---|---|
| Name | Description |
formattedName |
string
The formatted name string |
template |
?string
Optional name of template to match |
| Returns | |
|---|---|
| Type | Description |
array |
An associative array from name component IDs to component values. |