Google Cloud Chronicle V1 Client - Class RuleServiceClient (0.1.1)

Reference documentation and code samples for the Google Cloud Chronicle V1 Client class RuleServiceClient.

Service Description: RuleService provides interface for user-created rules.

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 \ Chronicle \ 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

createRetrohunt

Create a Retrohunt.

The async variant is RuleServiceClient::createRetrohuntAsync() .

Parameters
Name
Description
request
Google\Cloud\Chronicle\V1\CreateRetrohuntRequest

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
Example
 use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Chronicle\V1\Client\RuleServiceClient;
use Google\Cloud\Chronicle\V1\CreateRetrohuntRequest;
use Google\Cloud\Chronicle\V1\Retrohunt;
use Google\Rpc\Status;
use Google\Type\Interval;

/**
 * @param string $formattedParent The parent of retrohunt, which is a rule.
 *                                Format:
 *                                `projects/{project}/locations/{location}/instances/{instance}/rules/{rule}`
 *                                Please see {@see RuleServiceClient::ruleName()} for help formatting this field.
 */
function create_retrohunt_sample(string $formattedParent): void
{
    // Create a client.
    $ruleServiceClient = new RuleServiceClient();

    // Prepare the request message.
    $retrohuntProcessInterval = new Interval();
    $retrohunt = (new Retrohunt())
        ->setProcessInterval($retrohuntProcessInterval);
    $request = (new CreateRetrohuntRequest())
        ->setParent($formattedParent)
        ->setRetrohunt($retrohunt);

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $ruleServiceClient->createRetrohunt($request);
        $response->pollUntilComplete();

        if ($response->operationSucceeded()) {
            /** @var Retrohunt $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 = RuleServiceClient::ruleName('[PROJECT]', '[LOCATION]', '[INSTANCE]', '[RULE]');

    create_retrohunt_sample($formattedParent);
} 

createRule

Creates a new Rule.

The async variant is RuleServiceClient::createRuleAsync() .

Parameters
Name
Description
request
Google\Cloud\Chronicle\V1\CreateRuleRequest

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
Example
 use Google\ApiCore\ApiException;
use Google\Cloud\Chronicle\V1\Client\RuleServiceClient;
use Google\Cloud\Chronicle\V1\CreateRuleRequest;
use Google\Cloud\Chronicle\V1\Rule;

/**
 * @param string $formattedParent The parent resource where this rule will be created.
 *                                Format: `projects/{project}/locations/{location}/instances/{instance}`
 *                                Please see {@see RuleServiceClient::instanceName()} for help formatting this field.
 */
function create_rule_sample(string $formattedParent): void
{
    // Create a client.
    $ruleServiceClient = new RuleServiceClient();

    // Prepare the request message.
    $rule = new Rule();
    $request = (new CreateRuleRequest())
        ->setParent($formattedParent)
        ->setRule($rule);

    // Call the API and handle any network failures.
    try {
        /** @var Rule $response */
        $response = $ruleServiceClient->createRule($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 = RuleServiceClient::instanceName('[PROJECT]', '[LOCATION]', '[INSTANCE]');

    create_rule_sample($formattedParent);
} 

deleteRule

Deletes a Rule.

The async variant is RuleServiceClient::deleteRuleAsync() .

Parameters
Name
Description
request
Google\Cloud\Chronicle\V1\DeleteRuleRequest

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\Chronicle\V1\Client\RuleServiceClient;
use Google\Cloud\Chronicle\V1\DeleteRuleRequest;

/**
 * @param string $formattedName The name of the rule to delete. A rule revision timestamp cannot
 *                              be specified as part of the name, as deleting specific revisions is not
 *                              supported.
 *                              Format:
 *                              `projects/{project}/locations/{location}/instances/{instance}/rules/{rule}`
 *                              Please see {@see RuleServiceClient::ruleName()} for help formatting this field.
 */
function delete_rule_sample(string $formattedName): void
{
    // Create a client.
    $ruleServiceClient = new RuleServiceClient();

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

    // Call the API and handle any network failures.
    try {
        $ruleServiceClient->deleteRule($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 = RuleServiceClient::ruleName('[PROJECT]', '[LOCATION]', '[INSTANCE]', '[RULE]');

    delete_rule_sample($formattedName);
} 

getRetrohunt

Get a Retrohunt.

The async variant is RuleServiceClient::getRetrohuntAsync() .

Parameters
Name
Description
request
Google\Cloud\Chronicle\V1\GetRetrohuntRequest

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
Example
 use Google\ApiCore\ApiException;
use Google\Cloud\Chronicle\V1\Client\RuleServiceClient;
use Google\Cloud\Chronicle\V1\GetRetrohuntRequest;
use Google\Cloud\Chronicle\V1\Retrohunt;

/**
 * @param string $formattedName The name of the retrohunt to retrieve.
 *                              Format:
 *                              `projects/{project}/locations/{location}/instances/{instance}/rules/{rule}/retrohunts/{retrohunt}`
 *                              Please see {@see RuleServiceClient::retrohuntName()} for help formatting this field.
 */
function get_retrohunt_sample(string $formattedName): void
{
    // Create a client.
    $ruleServiceClient = new RuleServiceClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var Retrohunt $response */
        $response = $ruleServiceClient->getRetrohunt($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 = RuleServiceClient::retrohuntName(
        '[PROJECT]',
        '[LOCATION]',
        '[INSTANCE]',
        '[RULE]',
        '[RETROHUNT]'
    );

    get_retrohunt_sample($formattedName);
} 

getRule

Gets a Rule.

The async variant is RuleServiceClient::getRuleAsync() .

Parameters
Name
Description
request
Google\Cloud\Chronicle\V1\GetRuleRequest

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
Example
 use Google\ApiCore\ApiException;
use Google\Cloud\Chronicle\V1\Client\RuleServiceClient;
use Google\Cloud\Chronicle\V1\GetRuleRequest;
use Google\Cloud\Chronicle\V1\Rule;

/**
 * @param string $formattedName The name of the rule to retrieve.
 *                              Format:
 *                              `projects/{project}/locations/{location}/instances/{instance}/rules/{rule}`
 *                              Please see {@see RuleServiceClient::ruleName()} for help formatting this field.
 */
function get_rule_sample(string $formattedName): void
{
    // Create a client.
    $ruleServiceClient = new RuleServiceClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var Rule $response */
        $response = $ruleServiceClient->getRule($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 = RuleServiceClient::ruleName('[PROJECT]', '[LOCATION]', '[INSTANCE]', '[RULE]');

    get_rule_sample($formattedName);
} 

getRuleDeployment

Gets a RuleDeployment.

The async variant is RuleServiceClient::getRuleDeploymentAsync() .

Parameters
Name
Description
request
Google\Cloud\Chronicle\V1\GetRuleDeploymentRequest

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
Example
 use Google\ApiCore\ApiException;
use Google\Cloud\Chronicle\V1\Client\RuleServiceClient;
use Google\Cloud\Chronicle\V1\GetRuleDeploymentRequest;
use Google\Cloud\Chronicle\V1\RuleDeployment;

/**
 * @param string $formattedName The name of the rule deployment to retrieve.
 *                              Format:
 *                              `projects/{project}/locations/{location}/instances/{instance}/rules/{rule}/deployment`
 *                              Please see {@see RuleServiceClient::ruleDeploymentName()} for help formatting this field.
 */
function get_rule_deployment_sample(string $formattedName): void
{
    // Create a client.
    $ruleServiceClient = new RuleServiceClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var RuleDeployment $response */
        $response = $ruleServiceClient->getRuleDeployment($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 = RuleServiceClient::ruleDeploymentName(
        '[PROJECT]',
        '[LOCATION]',
        '[INSTANCE]',
        '[RULE]'
    );

    get_rule_deployment_sample($formattedName);
} 

listRetrohunts

List Retrohunts.

The async variant is RuleServiceClient::listRetrohuntsAsync() .

Parameters
Name
Description
request
Google\Cloud\Chronicle\V1\ListRetrohuntsRequest

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
Example
 use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\Chronicle\V1\Client\RuleServiceClient;
use Google\Cloud\Chronicle\V1\ListRetrohuntsRequest;
use Google\Cloud\Chronicle\V1\Retrohunt;

/**
 * @param string $formattedParent The rule that the retrohunts belong to.
 *                                Format:
 *                                `projects/{project}/locations/{location}/instances/{instance}/rules/{rule}`
 *                                Please see {@see RuleServiceClient::ruleName()} for help formatting this field.
 */
function list_retrohunts_sample(string $formattedParent): void
{
    // Create a client.
    $ruleServiceClient = new RuleServiceClient();

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

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

        /** @var Retrohunt $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 = RuleServiceClient::ruleName('[PROJECT]', '[LOCATION]', '[INSTANCE]', '[RULE]');

    list_retrohunts_sample($formattedParent);
} 

listRuleDeployments

Lists RuleDeployments across all Rules.

The async variant is RuleServiceClient::listRuleDeploymentsAsync() .

Parameters
Name
Description
request
Google\Cloud\Chronicle\V1\ListRuleDeploymentsRequest

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
Example
 use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\Chronicle\V1\Client\RuleServiceClient;
use Google\Cloud\Chronicle\V1\ListRuleDeploymentsRequest;
use Google\Cloud\Chronicle\V1\RuleDeployment;

/**
 * @param string $formattedParent The collection of all parents which own all rule deployments. The
 *                                "-" wildcard token must be used as the rule identifier in the resource
 *                                path. Format:
 *                                `projects/{project}/locations/{location}/instances/{instance}/rules/-`
 *                                Please see {@see RuleServiceClient::ruleName()} for help formatting this field.
 */
function list_rule_deployments_sample(string $formattedParent): void
{
    // Create a client.
    $ruleServiceClient = new RuleServiceClient();

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

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

        /** @var RuleDeployment $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 = RuleServiceClient::ruleName('[PROJECT]', '[LOCATION]', '[INSTANCE]', '[RULE]');

    list_rule_deployments_sample($formattedParent);
} 

listRuleRevisions

Lists all revisions of the rule.

The async variant is RuleServiceClient::listRuleRevisionsAsync() .

Parameters
Name
Description
request
Google\Cloud\Chronicle\V1\ListRuleRevisionsRequest

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
Example
 use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\Chronicle\V1\Client\RuleServiceClient;
use Google\Cloud\Chronicle\V1\ListRuleRevisionsRequest;
use Google\Cloud\Chronicle\V1\Rule;

/**
 * @param string $formattedName The name of the rule to list revisions for.
 *                              Format:
 *                              `projects/{project}/locations/{location}/instances/{instance}/rules/{rule}`
 *                              Please see {@see RuleServiceClient::ruleName()} for help formatting this field.
 */
function list_rule_revisions_sample(string $formattedName): void
{
    // Create a client.
    $ruleServiceClient = new RuleServiceClient();

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

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

        /** @var Rule $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
{
    $formattedName = RuleServiceClient::ruleName('[PROJECT]', '[LOCATION]', '[INSTANCE]', '[RULE]');

    list_rule_revisions_sample($formattedName);
} 

listRules

Lists Rules.

The async variant is RuleServiceClient::listRulesAsync() .

Parameters
Name
Description
request
Google\Cloud\Chronicle\V1\ListRulesRequest

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
Example
 use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\Chronicle\V1\Client\RuleServiceClient;
use Google\Cloud\Chronicle\V1\ListRulesRequest;
use Google\Cloud\Chronicle\V1\Rule;

/**
 * @param string $formattedParent The parent, which owns this collection of rules.
 *                                Format:
 *                                `projects/{project}/locations/{location}/instances/{instance}`
 *                                Please see {@see RuleServiceClient::instanceName()} for help formatting this field.
 */
function list_rules_sample(string $formattedParent): void
{
    // Create a client.
    $ruleServiceClient = new RuleServiceClient();

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

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

        /** @var Rule $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 = RuleServiceClient::instanceName('[PROJECT]', '[LOCATION]', '[INSTANCE]');

    list_rules_sample($formattedParent);
} 

updateRule

Updates a Rule.

The async variant is RuleServiceClient::updateRuleAsync() .

Parameters
Name
Description
request
Google\Cloud\Chronicle\V1\UpdateRuleRequest

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
Example
 use Google\ApiCore\ApiException;
use Google\Cloud\Chronicle\V1\Client\RuleServiceClient;
use Google\Cloud\Chronicle\V1\Rule;
use Google\Cloud\Chronicle\V1\UpdateRuleRequest;

/**
 * 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_rule_sample(): void
{
    // Create a client.
    $ruleServiceClient = new RuleServiceClient();

    // Prepare the request message.
    $rule = new Rule();
    $request = (new UpdateRuleRequest())
        ->setRule($rule);

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

updateRuleDeployment

Updates a RuleDeployment.

Failures are not necessarily atomic. If there is a request to update multiple fields, and any update to a single field fails, an error will be returned, but other fields may remain successfully updated.

The async variant is RuleServiceClient::updateRuleDeploymentAsync() .

Parameters
Name
Description
request
Google\Cloud\Chronicle\V1\UpdateRuleDeploymentRequest

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
Example
 use Google\ApiCore\ApiException;
use Google\Cloud\Chronicle\V1\Client\RuleServiceClient;
use Google\Cloud\Chronicle\V1\RuleDeployment;
use Google\Cloud\Chronicle\V1\UpdateRuleDeploymentRequest;
use Google\Protobuf\FieldMask;

/**
 * @param string $ruleDeploymentName The resource name of the rule deployment.
 *                                   Note that RuleDeployment is a child of the overall Rule, not any individual
 *                                   revision, so the resource ID segment for the Rule resource must not
 *                                   reference a specific revision.
 *                                   Format:
 *                                   `projects/{project}/locations/{location}/instances/{instance}/rules/{rule}/deployment`
 */
function update_rule_deployment_sample(string $ruleDeploymentName): void
{
    // Create a client.
    $ruleServiceClient = new RuleServiceClient();

    // Prepare the request message.
    $ruleDeployment = (new RuleDeployment())
        ->setName($ruleDeploymentName);
    $updateMask = new FieldMask();
    $request = (new UpdateRuleDeploymentRequest())
        ->setRuleDeployment($ruleDeployment)
        ->setUpdateMask($updateMask);

    // Call the API and handle any network failures.
    try {
        /** @var RuleDeployment $response */
        $response = $ruleServiceClient->updateRuleDeployment($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
{
    $ruleDeploymentName = '[NAME]';

    update_rule_deployment_sample($ruleDeploymentName);
} 

createRetrohuntAsync

Parameters
Name
Description
optionalArgs
array

createRuleAsync

Parameters
Name
Description
optionalArgs
array

deleteRuleAsync

Parameters
Name
Description
optionalArgs
array
Returns
Type
Description

getRetrohuntAsync

Parameters
Name
Description
optionalArgs
array

getRuleAsync

Parameters
Name
Description
optionalArgs
array

getRuleDeploymentAsync

Parameters
Name
Description
optionalArgs
array

listRetrohuntsAsync

Parameters
Name
Description
optionalArgs
array

listRuleDeploymentsAsync

Parameters
Name
Description
optionalArgs
array

listRuleRevisionsAsync

Parameters
Name
Description
optionalArgs
array

listRulesAsync

Parameters
Name
Description
optionalArgs
array

updateRuleAsync

Parameters
Name
Description
optionalArgs
array

updateRuleDeploymentAsync

Parameters
Name
Description
optionalArgs
array

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

static::dataAccessScopeName

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

Parameters
Name
Description
project
string
location
string
instance
string
dataAccessScope
string
Returns
Type
Description
string
The formatted data_access_scope resource.

static::instanceName

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

Parameters
Name
Description
project
string
location
string
instance
string
Returns
Type
Description
string
The formatted instance resource.

static::referenceListName

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

Parameters
Name
Description
project
string
location
string
instance
string
referenceList
string
Returns
Type
Description
string
The formatted reference_list resource.

static::retrohuntName

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

Parameters
Name
Description
project
string
location
string
instance
string
rule
string
retrohunt
string
Returns
Type
Description
string
The formatted retrohunt resource.

static::ruleName

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

Parameters
Name
Description
project
string
location
string
instance
string
rule
string
Returns
Type
Description
string
The formatted rule resource.

static::ruleDeploymentName

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

Parameters
Name
Description
project
string
location
string
instance
string
rule
string
Returns
Type
Description
string
The formatted rule_deployment 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

  • dataAccessScope: projects/{project}/locations/{location}/instances/{instance}/dataAccessScopes/{data_access_scope}
  • instance: projects/{project}/locations/{location}/instances/{instance}
  • referenceList: projects/{project}/locations/{location}/instances/{instance}/referenceLists/{reference_list}
  • retrohunt: projects/{project}/locations/{location}/instances/{instance}/rules/{rule}/retrohunts/{retrohunt}
  • rule: projects/{project}/locations/{location}/instances/{instance}/rules/{rule}
  • ruleDeployment: projects/{project}/locations/{location}/instances/{instance}/rules/{rule}/deployment

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.
Design a Mobile Site
View Site in Mobile | Classic
Share by: