Google Cloud Model Armor V1 Client - Class ModelArmorClient (0.3.1)

Reference documentation and code samples for the Google Cloud Model Armor V1 Client class ModelArmorClient.

Service Description: Service describing handlers for resources

This class provides the ability to make remote calls to the backing service through method calls that map to API methods.

Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parseName method to extract the individual identifiers contained within formatted names that are returned by the API.

Namespace

Google \ Cloud \ ModelArmor \ V1 \ Client

Methods

__construct

Constructor.

Parameters
Name Description
options array

Optional. Options for configuring the service API wrapper.

↳ apiEndpoint string

The address of the API remote host. May optionally include the port, formatted as "

↳ credentials string|array|FetchAuthTokenInterface|CredentialsWrapper

The credentials to be used by the client to authorize API calls. This option accepts either a path to a credentials file, or a decoded credentials file as a PHP array. Advanced usage: In addition, this option can also accept a pre-constructed Google\Auth\FetchAuthTokenInterface object or Google\ApiCore\CredentialsWrapper object. Note that when one of these objects are provided, any settings in $credentialsConfig will be ignored. Important: If you accept a credential configuration (credential JSON/File/Stream) from an external source for authentication to Google Cloud Platform, you must validate it before providing it to any Google API or library. Providing an unvalidated credential configuration to Google APIs can compromise the security of your systems and data. For more information https://cloud.google.com/docs/authentication/external/externally-sourced-credentials

↳ credentialsConfig array

Options used to configure credentials, including auth token caching, for the client. For a full list of supporting configuration options, see Google\ApiCore\CredentialsWrapper::build() .

↳ disableRetries bool

Determines whether or not retries defined by the client configuration should be disabled. Defaults to 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. May be either the string rest or grpc. Defaults to grpc if gRPC support is detected on the system. Advanced usage: Additionally, it is possible to pass in an already instantiated 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 = [ '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|LoggerInterface

A PSR-3 compliant logger. If set to false, logging is disabled, ignoring the 'GOOGLE_SDK_PHP_LOGGING' environment flag

createTemplate

Creates a new Template in a given project and ___location.

The async variant is ModelArmorClient::createTemplateAsync() .

Parameters
Name Description
request Google\Cloud\ModelArmor\V1\CreateTemplateRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\Cloud\ModelArmor\V1\Template
Example
use Google\ApiCore\ApiException;
use Google\Cloud\ModelArmor\V1\Client\ModelArmorClient;
use Google\Cloud\ModelArmor\V1\CreateTemplateRequest;
use Google\Cloud\ModelArmor\V1\FilterConfig;
use Google\Cloud\ModelArmor\V1\Template;

/**
 * @param string $formattedParent Value for parent. Please see
 *                                {@see ModelArmorClient::locationName()} for help formatting this field.
 * @param string $templateId      Id of the requesting object
 *                                If auto-generating Id server-side, remove this field and
 *                                template_id from the method_signature of Create RPC
 */
function create_template_sample(string $formattedParent, string $templateId): void
{
    // Create a client.
    $modelArmorClient = new ModelArmorClient();

    // Prepare the request message.
    $templateFilterConfig = new FilterConfig();
    $template = (new Template())
        ->setFilterConfig($templateFilterConfig);
    $request = (new CreateTemplateRequest())
        ->setParent($formattedParent)
        ->setTemplateId($templateId)
        ->setTemplate($template);

    // Call the API and handle any network failures.
    try {
        /** @var Template $response */
        $response = $modelArmorClient->createTemplate($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 = ModelArmorClient::locationName('[PROJECT]', '[LOCATION]');
    $templateId = '[TEMPLATE_ID]';

    create_template_sample($formattedParent, $templateId);
}

deleteTemplate

Deletes a single Template.

The async variant is ModelArmorClient::deleteTemplateAsync() .

Parameters
Name Description
request Google\Cloud\ModelArmor\V1\DeleteTemplateRequest

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.

Example
use Google\ApiCore\ApiException;
use Google\Cloud\ModelArmor\V1\Client\ModelArmorClient;
use Google\Cloud\ModelArmor\V1\DeleteTemplateRequest;

/**
 * @param string $formattedName Name of the resource
 *                              Please see {@see ModelArmorClient::templateName()} for help formatting this field.
 */
function delete_template_sample(string $formattedName): void
{
    // Create a client.
    $modelArmorClient = new ModelArmorClient();

    // Prepare the request message.
    $request = (new DeleteTemplateRequest())
        ->setName($formattedName);

    // Call the API and handle any network failures.
    try {
        $modelArmorClient->deleteTemplate($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 = ModelArmorClient::templateName('[PROJECT]', '[LOCATION]', '[TEMPLATE]');

    delete_template_sample($formattedName);
}

getFloorSetting

Gets details of a single floor setting of a project

The async variant is ModelArmorClient::getFloorSettingAsync() .

Parameters
Name Description
request Google\Cloud\ModelArmor\V1\GetFloorSettingRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\Cloud\ModelArmor\V1\FloorSetting
Example
use Google\ApiCore\ApiException;
use Google\Cloud\ModelArmor\V1\Client\ModelArmorClient;
use Google\Cloud\ModelArmor\V1\FloorSetting;
use Google\Cloud\ModelArmor\V1\GetFloorSettingRequest;

/**
 * @param string $formattedName The name of the floor setting to get, example
 *                              projects/123/floorsetting. Please see
 *                              {@see ModelArmorClient::floorSettingName()} for help formatting this field.
 */
function get_floor_setting_sample(string $formattedName): void
{
    // Create a client.
    $modelArmorClient = new ModelArmorClient();

    // Prepare the request message.
    $request = (new GetFloorSettingRequest())
        ->setName($formattedName);

    // Call the API and handle any network failures.
    try {
        /** @var FloorSetting $response */
        $response = $modelArmorClient->getFloorSetting($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 = ModelArmorClient::floorSettingName('[PROJECT]', '[LOCATION]');

    get_floor_setting_sample($formattedName);
}

getTemplate

Gets details of a single Template.

The async variant is ModelArmorClient::getTemplateAsync() .

Parameters
Name Description
request Google\Cloud\ModelArmor\V1\GetTemplateRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\Cloud\ModelArmor\V1\Template
Example
use Google\ApiCore\ApiException;
use Google\Cloud\ModelArmor\V1\Client\ModelArmorClient;
use Google\Cloud\ModelArmor\V1\GetTemplateRequest;
use Google\Cloud\ModelArmor\V1\Template;

/**
 * @param string $formattedName Name of the resource
 *                              Please see {@see ModelArmorClient::templateName()} for help formatting this field.
 */
function get_template_sample(string $formattedName): void
{
    // Create a client.
    $modelArmorClient = new ModelArmorClient();

    // Prepare the request message.
    $request = (new GetTemplateRequest())
        ->setName($formattedName);

    // Call the API and handle any network failures.
    try {
        /** @var Template $response */
        $response = $modelArmorClient->getTemplate($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 = ModelArmorClient::templateName('[PROJECT]', '[LOCATION]', '[TEMPLATE]');

    get_template_sample($formattedName);
}

listTemplates

Lists Templates in a given project and ___location.

The async variant is ModelArmorClient::listTemplatesAsync() .

Parameters
Name Description
request Google\Cloud\ModelArmor\V1\ListTemplatesRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\ApiCore\PagedListResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\ModelArmor\V1\Client\ModelArmorClient;
use Google\Cloud\ModelArmor\V1\ListTemplatesRequest;
use Google\Cloud\ModelArmor\V1\Template;

/**
 * @param string $formattedParent Parent value for ListTemplatesRequest
 *                                Please see {@see ModelArmorClient::locationName()} for help formatting this field.
 */
function list_templates_sample(string $formattedParent): void
{
    // Create a client.
    $modelArmorClient = new ModelArmorClient();

    // Prepare the request message.
    $request = (new ListTemplatesRequest())
        ->setParent($formattedParent);

    // Call the API and handle any network failures.
    try {
        /** @var PagedListResponse $response */
        $response = $modelArmorClient->listTemplates($request);

        /** @var Template $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 = ModelArmorClient::locationName('[PROJECT]', '[LOCATION]');

    list_templates_sample($formattedParent);
}

sanitizeModelResponse

Sanitizes Model Response.

The async variant is ModelArmorClient::sanitizeModelResponseAsync() .

Parameters
Name Description
request Google\Cloud\ModelArmor\V1\SanitizeModelResponseRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\Cloud\ModelArmor\V1\SanitizeModelResponseResponse
Example
use Google\ApiCore\ApiException;
use Google\Cloud\ModelArmor\V1\Client\ModelArmorClient;
use Google\Cloud\ModelArmor\V1\DataItem;
use Google\Cloud\ModelArmor\V1\SanitizeModelResponseRequest;
use Google\Cloud\ModelArmor\V1\SanitizeModelResponseResponse;

/**
 * @param string $formattedName Represents resource name of template
 *                              e.g. name=projects/sample-project/locations/us-central1/templates/templ01
 *                              Please see {@see ModelArmorClient::templateName()} for help formatting this field.
 */
function sanitize_model_response_sample(string $formattedName): void
{
    // Create a client.
    $modelArmorClient = new ModelArmorClient();

    // Prepare the request message.
    $modelResponseData = new DataItem();
    $request = (new SanitizeModelResponseRequest())
        ->setName($formattedName)
        ->setModelResponseData($modelResponseData);

    // Call the API and handle any network failures.
    try {
        /** @var SanitizeModelResponseResponse $response */
        $response = $modelArmorClient->sanitizeModelResponse($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 = ModelArmorClient::templateName('[PROJECT]', '[LOCATION]', '[TEMPLATE]');

    sanitize_model_response_sample($formattedName);
}

sanitizeUserPrompt

Sanitizes User Prompt.

The async variant is ModelArmorClient::sanitizeUserPromptAsync() .

Parameters
Name Description
request Google\Cloud\ModelArmor\V1\SanitizeUserPromptRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\Cloud\ModelArmor\V1\SanitizeUserPromptResponse
Example
use Google\ApiCore\ApiException;
use Google\Cloud\ModelArmor\V1\Client\ModelArmorClient;
use Google\Cloud\ModelArmor\V1\DataItem;
use Google\Cloud\ModelArmor\V1\SanitizeUserPromptRequest;
use Google\Cloud\ModelArmor\V1\SanitizeUserPromptResponse;

/**
 * @param string $formattedName Represents resource name of template
 *                              e.g. name=projects/sample-project/locations/us-central1/templates/templ01
 *                              Please see {@see ModelArmorClient::templateName()} for help formatting this field.
 */
function sanitize_user_prompt_sample(string $formattedName): void
{
    // Create a client.
    $modelArmorClient = new ModelArmorClient();

    // Prepare the request message.
    $userPromptData = new DataItem();
    $request = (new SanitizeUserPromptRequest())
        ->setName($formattedName)
        ->setUserPromptData($userPromptData);

    // Call the API and handle any network failures.
    try {
        /** @var SanitizeUserPromptResponse $response */
        $response = $modelArmorClient->sanitizeUserPrompt($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 = ModelArmorClient::templateName('[PROJECT]', '[LOCATION]', '[TEMPLATE]');

    sanitize_user_prompt_sample($formattedName);
}

updateFloorSetting

Updates the parameters of a single floor setting of a project

The async variant is ModelArmorClient::updateFloorSettingAsync() .

Parameters
Name Description
request Google\Cloud\ModelArmor\V1\UpdateFloorSettingRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\Cloud\ModelArmor\V1\FloorSetting
Example
use Google\ApiCore\ApiException;
use Google\Cloud\ModelArmor\V1\Client\ModelArmorClient;
use Google\Cloud\ModelArmor\V1\FilterConfig;
use Google\Cloud\ModelArmor\V1\FloorSetting;
use Google\Cloud\ModelArmor\V1\UpdateFloorSettingRequest;

/**
 * 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_floor_setting_sample(): void
{
    // Create a client.
    $modelArmorClient = new ModelArmorClient();

    // Prepare the request message.
    $floorSettingFilterConfig = new FilterConfig();
    $floorSetting = (new FloorSetting())
        ->setFilterConfig($floorSettingFilterConfig);
    $request = (new UpdateFloorSettingRequest())
        ->setFloorSetting($floorSetting);

    // Call the API and handle any network failures.
    try {
        /** @var FloorSetting $response */
        $response = $modelArmorClient->updateFloorSetting($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

updateTemplate

Updates the parameters of a single Template.

The async variant is ModelArmorClient::updateTemplateAsync() .

Parameters
Name Description
request Google\Cloud\ModelArmor\V1\UpdateTemplateRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\Cloud\ModelArmor\V1\Template
Example
use Google\ApiCore\ApiException;
use Google\Cloud\ModelArmor\V1\Client\ModelArmorClient;
use Google\Cloud\ModelArmor\V1\FilterConfig;
use Google\Cloud\ModelArmor\V1\Template;
use Google\Cloud\ModelArmor\V1\UpdateTemplateRequest;
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_template_sample(): void
{
    // Create a client.
    $modelArmorClient = new ModelArmorClient();

    // Prepare the request message.
    $updateMask = new FieldMask();
    $templateFilterConfig = new FilterConfig();
    $template = (new Template())
        ->setFilterConfig($templateFilterConfig);
    $request = (new UpdateTemplateRequest())
        ->setUpdateMask($updateMask)
        ->setTemplate($template);

    // Call the API and handle any network failures.
    try {
        /** @var Template $response */
        $response = $modelArmorClient->updateTemplate($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

getLocation

Gets information about a ___location.

The async variant is ModelArmorClient::getLocationAsync() .

Parameters
Name Description
request Google\Cloud\Location\GetLocationRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\Cloud\Location\Location
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Location\GetLocationRequest;
use Google\Cloud\Location\Location;
use Google\Cloud\ModelArmor\V1\Client\ModelArmorClient;

/**
 * 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.
    $modelArmorClient = new ModelArmorClient();

    // Prepare the request message.
    $request = new GetLocationRequest();

    // Call the API and handle any network failures.
    try {
        /** @var Location $response */
        $response = $modelArmorClient->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 ModelArmorClient::listLocationsAsync() .

Parameters
Name Description
request Google\Cloud\Location\ListLocationsRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\ApiCore\PagedListResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\Location\ListLocationsRequest;
use Google\Cloud\Location\Location;
use Google\Cloud\ModelArmor\V1\Client\ModelArmorClient;

/**
 * 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.
    $modelArmorClient = new ModelArmorClient();

    // Prepare the request message.
    $request = new ListLocationsRequest();

    // Call the API and handle any network failures.
    try {
        /** @var PagedListResponse $response */
        $response = $modelArmorClient->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());
    }
}

createTemplateAsync

Parameters
Name Description
request Google\Cloud\ModelArmor\V1\CreateTemplateRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\ModelArmor\V1\Template>

deleteTemplateAsync

Parameters
Name Description
request Google\Cloud\ModelArmor\V1\DeleteTemplateRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<void>

getFloorSettingAsync

Parameters
Name Description
request Google\Cloud\ModelArmor\V1\GetFloorSettingRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\ModelArmor\V1\FloorSetting>

getTemplateAsync

Parameters
Name Description
request Google\Cloud\ModelArmor\V1\GetTemplateRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\ModelArmor\V1\Template>

listTemplatesAsync

Parameters
Name Description
request Google\Cloud\ModelArmor\V1\ListTemplatesRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\PagedListResponse>

sanitizeModelResponseAsync

Parameters
Name Description
request Google\Cloud\ModelArmor\V1\SanitizeModelResponseRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\ModelArmor\V1\SanitizeModelResponseResponse>

sanitizeUserPromptAsync

Parameters
Name Description
request Google\Cloud\ModelArmor\V1\SanitizeUserPromptRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\ModelArmor\V1\SanitizeUserPromptResponse>

updateFloorSettingAsync

Parameters
Name Description
request Google\Cloud\ModelArmor\V1\UpdateFloorSettingRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\ModelArmor\V1\FloorSetting>

updateTemplateAsync

Parameters
Name Description
request Google\Cloud\ModelArmor\V1\UpdateTemplateRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\ModelArmor\V1\Template>

getLocationAsync

Parameters
Name Description
request Google\Cloud\Location\GetLocationRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Location\Location>

listLocationsAsync

Parameters
Name Description
request Google\Cloud\Location\ListLocationsRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\PagedListResponse>

static::floorSettingName

Formats a string containing the fully-qualified path to represent a floor_setting resource.

Parameters
Name Description
project string
___location string
Returns
Type Description
string The formatted floor_setting resource.

static::folderLocationFloorSettingName

Formats a string containing the fully-qualified path to represent a folder_location_floorSetting resource.

Parameters
Name Description
folder string
___location string
Returns
Type Description
string The formatted folder_location_floorSetting 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::organizationLocationFloorSettingName

Formats a string containing the fully-qualified path to represent a organization_location_floorSetting resource.

Parameters
Name Description
organization string
___location string
Returns
Type Description
string The formatted organization_location_floorSetting resource.

static::projectLocationFloorSettingName

Formats a string containing the fully-qualified path to represent a project_location_floorSetting resource.

Parameters
Name Description
project string
___location string
Returns
Type Description
string The formatted project_location_floorSetting resource.

static::templateName

Formats a string containing the fully-qualified path to represent a template resource.

Parameters
Name Description
project string
___location string
template string
Returns
Type Description
string The formatted template 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

  • floorSetting: projects/{project}/locations/{___location}/floorSetting
  • folderLocationFloorSetting: folders/{folder}/locations/{___location}/floorSetting
  • ___location: projects/{project}/locations/{___location}
  • organizationLocationFloorSetting: organizations/{organization}/locations/{___location}/floorSetting
  • projectLocationFloorSetting: projects/{project}/locations/{___location}/floorSetting
  • template: projects/{project}/locations/{___location}/templates/{template}

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.