Reference documentation and code samples for the Google Cloud Network Security V1 Client class MirroringClient.
Service Description: PM2 is the "out-of-band" flavor of the Network Security Integrations product.
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 \ NetworkSecurity \ V1 \ ClientMethods
__construct
Constructor.
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
FetchAuthTokenInterface|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 use Google\Auth\Credentials\ServiceAccountCredentials; use Google\Cloud\NetworkSecurity\V1\MirroringClient; $creds = new ServiceAccountCredentials($scopes, $json); $options = new MirroringClient(['credentials' => $creds]);
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
↳ universeDomain
string
The service domain for the client. Defaults to 'googleapis.com'.
createMirroringDeployment
Creates a deployment in a given project and location.
See https://google.aip.dev/133 .
The async variant is MirroringClient::createMirroringDeploymentAsync() .
request
Google\Cloud\NetworkSecurity\V1\CreateMirroringDeploymentRequest
A request to house fields associated with the call.
callOptions
array
Optional.
↳ retrySettings
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\NetworkSecurity\V1\Client\MirroringClient;
use Google\Cloud\NetworkSecurity\V1\CreateMirroringDeploymentRequest;
use Google\Cloud\NetworkSecurity\V1\MirroringDeployment;
use Google\Rpc\Status;
/**
* @param string $formattedParent The parent resource where this deployment will be created.
* Format: projects/{project}/locations/{location}
* Please see {@see MirroringClient::locationName()} for help formatting this field.
* @param string $mirroringDeploymentId The ID to use for the new deployment, which will become the final
* component of the deployment's resource name.
* @param string $formattedMirroringDeploymentForwardingRule Immutable. The regional forwarding rule that fronts the mirroring
* collectors, for example:
* `projects/123456789/regions/us-central1/forwardingRules/my-rule`. See
* https://google.aip.dev/124. Please see
* {@see MirroringClient::forwardingRuleName()} for help formatting this field.
* @param string $formattedMirroringDeploymentMirroringDeploymentGroup Immutable. The deployment group that this deployment is a part
* of, for example:
* `projects/123456789/locations/global/mirroringDeploymentGroups/my-dg`.
* See https://google.aip.dev/124. Please see
* {@see MirroringClient::mirroringDeploymentGroupName()} for help formatting this field.
*/
function create_mirroring_deployment_sample(
string $formattedParent,
string $mirroringDeploymentId,
string $formattedMirroringDeploymentForwardingRule,
string $formattedMirroringDeploymentMirroringDeploymentGroup
): void {
// Create a client.
$mirroringClient = new MirroringClient();
// Prepare the request message.
$mirroringDeployment = (new MirroringDeployment())
->setForwardingRule($formattedMirroringDeploymentForwardingRule)
->setMirroringDeploymentGroup($formattedMirroringDeploymentMirroringDeploymentGroup);
$request = (new CreateMirroringDeploymentRequest())
->setParent($formattedParent)
->setMirroringDeploymentId($mirroringDeploymentId)
->setMirroringDeployment($mirroringDeployment);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $mirroringClient->createMirroringDeployment($request);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
/** @var MirroringDeployment $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 = MirroringClient::locationName('[PROJECT]', '[LOCATION]');
$mirroringDeploymentId = '[MIRRORING_DEPLOYMENT_ID]';
$formattedMirroringDeploymentForwardingRule = MirroringClient::forwardingRuleName(
'[PROJECT]',
'[FORWARDING_RULE]'
);
$formattedMirroringDeploymentMirroringDeploymentGroup = MirroringClient::mirroringDeploymentGroupName(
'[PROJECT]',
'[LOCATION]',
'[MIRRORING_DEPLOYMENT_GROUP]'
);
create_mirroring_deployment_sample(
$formattedParent,
$mirroringDeploymentId,
$formattedMirroringDeploymentForwardingRule,
$formattedMirroringDeploymentMirroringDeploymentGroup
);
}
createMirroringDeploymentGroup
Creates a deployment group in a given project and location.
See https://google.aip.dev/133 .
The async variant is MirroringClient::createMirroringDeploymentGroupAsync() .
request
Google\Cloud\NetworkSecurity\V1\CreateMirroringDeploymentGroupRequest
A request to house fields associated with the call.
callOptions
array
Optional.
↳ retrySettings
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\NetworkSecurity\V1\Client\MirroringClient;
use Google\Cloud\NetworkSecurity\V1\CreateMirroringDeploymentGroupRequest;
use Google\Cloud\NetworkSecurity\V1\MirroringDeploymentGroup;
use Google\Rpc\Status;
/**
* @param string $formattedParent The parent resource where this deployment group will be created.
* Format: projects/{project}/locations/{location}
* Please see {@see MirroringClient::locationName()} for help formatting this field.
* @param string $mirroringDeploymentGroupId The ID to use for the new deployment group, which will become the
* final component of the deployment group's resource name.
* @param string $formattedMirroringDeploymentGroupNetwork Immutable. The network that will be used for all child
* deployments, for example: `projects/{project}/global/networks/{network}`.
* See https://google.aip.dev/124. Please see
* {@see MirroringClient::networkName()} for help formatting this field.
*/
function create_mirroring_deployment_group_sample(
string $formattedParent,
string $mirroringDeploymentGroupId,
string $formattedMirroringDeploymentGroupNetwork
): void {
// Create a client.
$mirroringClient = new MirroringClient();
// Prepare the request message.
$mirroringDeploymentGroup = (new MirroringDeploymentGroup())
->setNetwork($formattedMirroringDeploymentGroupNetwork);
$request = (new CreateMirroringDeploymentGroupRequest())
->setParent($formattedParent)
->setMirroringDeploymentGroupId($mirroringDeploymentGroupId)
->setMirroringDeploymentGroup($mirroringDeploymentGroup);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $mirroringClient->createMirroringDeploymentGroup($request);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
/** @var MirroringDeploymentGroup $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 = MirroringClient::locationName('[PROJECT]', '[LOCATION]');
$mirroringDeploymentGroupId = '[MIRRORING_DEPLOYMENT_GROUP_ID]';
$formattedMirroringDeploymentGroupNetwork = MirroringClient::networkName('[PROJECT]', '[NETWORK]');
create_mirroring_deployment_group_sample(
$formattedParent,
$mirroringDeploymentGroupId,
$formattedMirroringDeploymentGroupNetwork
);
}
createMirroringEndpointGroup
Creates an endpoint group in a given project and location.
See https://google.aip.dev/133 .
The async variant is MirroringClient::createMirroringEndpointGroupAsync() .
request
Google\Cloud\NetworkSecurity\V1\CreateMirroringEndpointGroupRequest
A request to house fields associated with the call.
callOptions
array
Optional.
↳ retrySettings
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\NetworkSecurity\V1\Client\MirroringClient;
use Google\Cloud\NetworkSecurity\V1\CreateMirroringEndpointGroupRequest;
use Google\Cloud\NetworkSecurity\V1\MirroringEndpointGroup;
use Google\Rpc\Status;
/**
* @param string $formattedParent The parent resource where this endpoint group will be created.
* Format: projects/{project}/locations/{location}
* Please see {@see MirroringClient::locationName()} for help formatting this field.
* @param string $mirroringEndpointGroupId The ID to use for the endpoint group, which will become the final
* component of the endpoint group's resource name.
*/
function create_mirroring_endpoint_group_sample(
string $formattedParent,
string $mirroringEndpointGroupId
): void {
// Create a client.
$mirroringClient = new MirroringClient();
// Prepare the request message.
$mirroringEndpointGroup = new MirroringEndpointGroup();
$request = (new CreateMirroringEndpointGroupRequest())
->setParent($formattedParent)
->setMirroringEndpointGroupId($mirroringEndpointGroupId)
->setMirroringEndpointGroup($mirroringEndpointGroup);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $mirroringClient->createMirroringEndpointGroup($request);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
/** @var MirroringEndpointGroup $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 = MirroringClient::locationName('[PROJECT]', '[LOCATION]');
$mirroringEndpointGroupId = '[MIRRORING_ENDPOINT_GROUP_ID]';
create_mirroring_endpoint_group_sample($formattedParent, $mirroringEndpointGroupId);
}
createMirroringEndpointGroupAssociation
Creates an association in a given project and location.
See https://google.aip.dev/133 .
The async variant is MirroringClient::createMirroringEndpointGroupAssociationAsync() .
request
Google\Cloud\NetworkSecurity\V1\CreateMirroringEndpointGroupAssociationRequest
A request to house fields associated with the call.
callOptions
array
Optional.
↳ retrySettings
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\NetworkSecurity\V1\Client\MirroringClient;
use Google\Cloud\NetworkSecurity\V1\CreateMirroringEndpointGroupAssociationRequest;
use Google\Cloud\NetworkSecurity\V1\MirroringEndpointGroupAssociation;
use Google\Rpc\Status;
/**
* @param string $formattedParent The parent resource where this association will be created.
* Format: projects/{project}/locations/{location}
* Please see {@see MirroringClient::locationName()} for help formatting this field.
*/
function create_mirroring_endpoint_group_association_sample(string $formattedParent): void
{
// Create a client.
$mirroringClient = new MirroringClient();
// Prepare the request message.
$mirroringEndpointGroupAssociation = new MirroringEndpointGroupAssociation();
$request = (new CreateMirroringEndpointGroupAssociationRequest())
->setParent($formattedParent)
->setMirroringEndpointGroupAssociation($mirroringEndpointGroupAssociation);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $mirroringClient->createMirroringEndpointGroupAssociation($request);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
/** @var MirroringEndpointGroupAssociation $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 = MirroringClient::locationName('[PROJECT]', '[LOCATION]');
create_mirroring_endpoint_group_association_sample($formattedParent);
}
deleteMirroringDeployment
Deletes a deployment.
See https://google.aip.dev/135 .
The async variant is MirroringClient::deleteMirroringDeploymentAsync() .
request
Google\Cloud\NetworkSecurity\V1\DeleteMirroringDeploymentRequest
A request to house fields associated with the call.
callOptions
array
Optional.
↳ retrySettings
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\NetworkSecurity\V1\Client\MirroringClient;
use Google\Cloud\NetworkSecurity\V1\DeleteMirroringDeploymentRequest;
use Google\Rpc\Status;
/**
* @param string $formattedName Name of the resource
* Please see {@see MirroringClient::mirroringDeploymentName()} for help formatting this field.
*/
function delete_mirroring_deployment_sample(string $formattedName): void
{
// Create a client.
$mirroringClient = new MirroringClient();
// Prepare the request message.
$request = (new DeleteMirroringDeploymentRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $mirroringClient->deleteMirroringDeployment($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 = MirroringClient::mirroringDeploymentName(
'[PROJECT]',
'[LOCATION]',
'[MIRRORING_DEPLOYMENT]'
);
delete_mirroring_deployment_sample($formattedName);
}
deleteMirroringDeploymentGroup
Deletes a deployment group.
See https://google.aip.dev/135 .
The async variant is MirroringClient::deleteMirroringDeploymentGroupAsync() .
request
Google\Cloud\NetworkSecurity\V1\DeleteMirroringDeploymentGroupRequest
A request to house fields associated with the call.
callOptions
array
Optional.
↳ retrySettings
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\NetworkSecurity\V1\Client\MirroringClient;
use Google\Cloud\NetworkSecurity\V1\DeleteMirroringDeploymentGroupRequest;
use Google\Rpc\Status;
/**
* @param string $formattedName The deployment group to delete. Please see
* {@see MirroringClient::mirroringDeploymentGroupName()} for help formatting this field.
*/
function delete_mirroring_deployment_group_sample(string $formattedName): void
{
// Create a client.
$mirroringClient = new MirroringClient();
// Prepare the request message.
$request = (new DeleteMirroringDeploymentGroupRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $mirroringClient->deleteMirroringDeploymentGroup($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 = MirroringClient::mirroringDeploymentGroupName(
'[PROJECT]',
'[LOCATION]',
'[MIRRORING_DEPLOYMENT_GROUP]'
);
delete_mirroring_deployment_group_sample($formattedName);
}
deleteMirroringEndpointGroup
Deletes an endpoint group.
See https://google.aip.dev/135 .
The async variant is MirroringClient::deleteMirroringEndpointGroupAsync() .
request
Google\Cloud\NetworkSecurity\V1\DeleteMirroringEndpointGroupRequest
A request to house fields associated with the call.
callOptions
array
Optional.
↳ retrySettings
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\NetworkSecurity\V1\Client\MirroringClient;
use Google\Cloud\NetworkSecurity\V1\DeleteMirroringEndpointGroupRequest;
use Google\Rpc\Status;
/**
* @param string $formattedName The endpoint group to delete. Please see
* {@see MirroringClient::mirroringEndpointGroupName()} for help formatting this field.
*/
function delete_mirroring_endpoint_group_sample(string $formattedName): void
{
// Create a client.
$mirroringClient = new MirroringClient();
// Prepare the request message.
$request = (new DeleteMirroringEndpointGroupRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $mirroringClient->deleteMirroringEndpointGroup($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 = MirroringClient::mirroringEndpointGroupName(
'[PROJECT]',
'[LOCATION]',
'[MIRRORING_ENDPOINT_GROUP]'
);
delete_mirroring_endpoint_group_sample($formattedName);
}
deleteMirroringEndpointGroupAssociation
Deletes an association.
See https://google.aip.dev/135 .
The async variant is MirroringClient::deleteMirroringEndpointGroupAssociationAsync() .
request
Google\Cloud\NetworkSecurity\V1\DeleteMirroringEndpointGroupAssociationRequest
A request to house fields associated with the call.
callOptions
array
Optional.
↳ retrySettings
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\NetworkSecurity\V1\Client\MirroringClient;
use Google\Cloud\NetworkSecurity\V1\DeleteMirroringEndpointGroupAssociationRequest;
use Google\Rpc\Status;
/**
* @param string $formattedName The association to delete. Please see
* {@see MirroringClient::mirroringEndpointGroupAssociationName()} for help formatting this field.
*/
function delete_mirroring_endpoint_group_association_sample(string $formattedName): void
{
// Create a client.
$mirroringClient = new MirroringClient();
// Prepare the request message.
$request = (new DeleteMirroringEndpointGroupAssociationRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $mirroringClient->deleteMirroringEndpointGroupAssociation($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 = MirroringClient::mirroringEndpointGroupAssociationName(
'[PROJECT]',
'[LOCATION]',
'[MIRRORING_ENDPOINT_GROUP_ASSOCIATION]'
);
delete_mirroring_endpoint_group_association_sample($formattedName);
}
getMirroringDeployment
Gets a specific deployment.
See https://google.aip.dev/131 .
The async variant is MirroringClient::getMirroringDeploymentAsync() .
request
Google\Cloud\NetworkSecurity\V1\GetMirroringDeploymentRequest
A request to house fields associated with the call.
callOptions
array
Optional.
↳ retrySettings
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
use Google\ApiCore\ApiException;
use Google\Cloud\NetworkSecurity\V1\Client\MirroringClient;
use Google\Cloud\NetworkSecurity\V1\GetMirroringDeploymentRequest;
use Google\Cloud\NetworkSecurity\V1\MirroringDeployment;
/**
* @param string $formattedName The name of the deployment to retrieve.
* Format:
* projects/{project}/locations/{location}/mirroringDeployments/{mirroring_deployment}
* Please see {@see MirroringClient::mirroringDeploymentName()} for help formatting this field.
*/
function get_mirroring_deployment_sample(string $formattedName): void
{
// Create a client.
$mirroringClient = new MirroringClient();
// Prepare the request message.
$request = (new GetMirroringDeploymentRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
/** @var MirroringDeployment $response */
$response = $mirroringClient->getMirroringDeployment($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 = MirroringClient::mirroringDeploymentName(
'[PROJECT]',
'[LOCATION]',
'[MIRRORING_DEPLOYMENT]'
);
get_mirroring_deployment_sample($formattedName);
}
getMirroringDeploymentGroup
Gets a specific deployment group.
See https://google.aip.dev/131 .
The async variant is MirroringClient::getMirroringDeploymentGroupAsync() .
request
Google\Cloud\NetworkSecurity\V1\GetMirroringDeploymentGroupRequest
A request to house fields associated with the call.
callOptions
array
Optional.
↳ retrySettings
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
use Google\ApiCore\ApiException;
use Google\Cloud\NetworkSecurity\V1\Client\MirroringClient;
use Google\Cloud\NetworkSecurity\V1\GetMirroringDeploymentGroupRequest;
use Google\Cloud\NetworkSecurity\V1\MirroringDeploymentGroup;
/**
* @param string $formattedName The name of the deployment group to retrieve.
* Format:
* projects/{project}/locations/{location}/mirroringDeploymentGroups/{mirroring_deployment_group}
* Please see {@see MirroringClient::mirroringDeploymentGroupName()} for help formatting this field.
*/
function get_mirroring_deployment_group_sample(string $formattedName): void
{
// Create a client.
$mirroringClient = new MirroringClient();
// Prepare the request message.
$request = (new GetMirroringDeploymentGroupRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
/** @var MirroringDeploymentGroup $response */
$response = $mirroringClient->getMirroringDeploymentGroup($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 = MirroringClient::mirroringDeploymentGroupName(
'[PROJECT]',
'[LOCATION]',
'[MIRRORING_DEPLOYMENT_GROUP]'
);
get_mirroring_deployment_group_sample($formattedName);
}
getMirroringEndpointGroup
Gets a specific endpoint group.
See https://google.aip.dev/131 .
The async variant is MirroringClient::getMirroringEndpointGroupAsync() .
request
Google\Cloud\NetworkSecurity\V1\GetMirroringEndpointGroupRequest
A request to house fields associated with the call.
callOptions
array
Optional.
↳ retrySettings
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
use Google\ApiCore\ApiException;
use Google\Cloud\NetworkSecurity\V1\Client\MirroringClient;
use Google\Cloud\NetworkSecurity\V1\GetMirroringEndpointGroupRequest;
use Google\Cloud\NetworkSecurity\V1\MirroringEndpointGroup;
/**
* @param string $formattedName The name of the endpoint group to retrieve.
* Format:
* projects/{project}/locations/{location}/mirroringEndpointGroups/{mirroring_endpoint_group}
* Please see {@see MirroringClient::mirroringEndpointGroupName()} for help formatting this field.
*/
function get_mirroring_endpoint_group_sample(string $formattedName): void
{
// Create a client.
$mirroringClient = new MirroringClient();
// Prepare the request message.
$request = (new GetMirroringEndpointGroupRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
/** @var MirroringEndpointGroup $response */
$response = $mirroringClient->getMirroringEndpointGroup($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 = MirroringClient::mirroringEndpointGroupName(
'[PROJECT]',
'[LOCATION]',
'[MIRRORING_ENDPOINT_GROUP]'
);
get_mirroring_endpoint_group_sample($formattedName);
}
getMirroringEndpointGroupAssociation
Gets a specific association.
See https://google.aip.dev/131 .
The async variant is MirroringClient::getMirroringEndpointGroupAssociationAsync() .
request
Google\Cloud\NetworkSecurity\V1\GetMirroringEndpointGroupAssociationRequest
A request to house fields associated with the call.
callOptions
array
Optional.
↳ retrySettings
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
use Google\ApiCore\ApiException;
use Google\Cloud\NetworkSecurity\V1\Client\MirroringClient;
use Google\Cloud\NetworkSecurity\V1\GetMirroringEndpointGroupAssociationRequest;
use Google\Cloud\NetworkSecurity\V1\MirroringEndpointGroupAssociation;
/**
* @param string $formattedName The name of the association to retrieve.
* Format:
* projects/{project}/locations/{location}/mirroringEndpointGroupAssociations/{mirroring_endpoint_group_association}
* Please see {@see MirroringClient::mirroringEndpointGroupAssociationName()} for help formatting this field.
*/
function get_mirroring_endpoint_group_association_sample(string $formattedName): void
{
// Create a client.
$mirroringClient = new MirroringClient();
// Prepare the request message.
$request = (new GetMirroringEndpointGroupAssociationRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
/** @var MirroringEndpointGroupAssociation $response */
$response = $mirroringClient->getMirroringEndpointGroupAssociation($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 = MirroringClient::mirroringEndpointGroupAssociationName(
'[PROJECT]',
'[LOCATION]',
'[MIRRORING_ENDPOINT_GROUP_ASSOCIATION]'
);
get_mirroring_endpoint_group_association_sample($formattedName);
}
listMirroringDeploymentGroups
Lists deployment groups in a given project and location.
See https://google.aip.dev/132 .
The async variant is MirroringClient::listMirroringDeploymentGroupsAsync() .
request
Google\Cloud\NetworkSecurity\V1\ListMirroringDeploymentGroupsRequest
A request to house fields associated with the call.
callOptions
array
Optional.
↳ retrySettings
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\NetworkSecurity\V1\Client\MirroringClient;
use Google\Cloud\NetworkSecurity\V1\ListMirroringDeploymentGroupsRequest;
use Google\Cloud\NetworkSecurity\V1\MirroringDeploymentGroup;
/**
* @param string $formattedParent The parent, which owns this collection of deployment groups.
* Example: `projects/123456789/locations/global`.
* See https://google.aip.dev/132 for more details. Please see
* {@see MirroringClient::locationName()} for help formatting this field.
*/
function list_mirroring_deployment_groups_sample(string $formattedParent): void
{
// Create a client.
$mirroringClient = new MirroringClient();
// Prepare the request message.
$request = (new ListMirroringDeploymentGroupsRequest())
->setParent($formattedParent);
// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $mirroringClient->listMirroringDeploymentGroups($request);
/** @var MirroringDeploymentGroup $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 = MirroringClient::locationName('[PROJECT]', '[LOCATION]');
list_mirroring_deployment_groups_sample($formattedParent);
}
listMirroringDeployments
Lists deployments in a given project and location.
See https://google.aip.dev/132 .
The async variant is MirroringClient::listMirroringDeploymentsAsync() .
request
Google\Cloud\NetworkSecurity\V1\ListMirroringDeploymentsRequest
A request to house fields associated with the call.
callOptions
array
Optional.
↳ retrySettings
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\NetworkSecurity\V1\Client\MirroringClient;
use Google\Cloud\NetworkSecurity\V1\ListMirroringDeploymentsRequest;
use Google\Cloud\NetworkSecurity\V1\MirroringDeployment;
/**
* @param string $formattedParent The parent, which owns this collection of deployments.
* Example: `projects/123456789/locations/us-central1-a`.
* See https://google.aip.dev/132 for more details. Please see
* {@see MirroringClient::locationName()} for help formatting this field.
*/
function list_mirroring_deployments_sample(string $formattedParent): void
{
// Create a client.
$mirroringClient = new MirroringClient();
// Prepare the request message.
$request = (new ListMirroringDeploymentsRequest())
->setParent($formattedParent);
// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $mirroringClient->listMirroringDeployments($request);
/** @var MirroringDeployment $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 = MirroringClient::locationName('[PROJECT]', '[LOCATION]');
list_mirroring_deployments_sample($formattedParent);
}
listMirroringEndpointGroupAssociations
Lists associations in a given project and location.
See https://google.aip.dev/132 .
The async variant is MirroringClient::listMirroringEndpointGroupAssociationsAsync() .
request
Google\Cloud\NetworkSecurity\V1\ListMirroringEndpointGroupAssociationsRequest
A request to house fields associated with the call.
callOptions
array
Optional.
↳ retrySettings
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\NetworkSecurity\V1\Client\MirroringClient;
use Google\Cloud\NetworkSecurity\V1\ListMirroringEndpointGroupAssociationsRequest;
use Google\Cloud\NetworkSecurity\V1\MirroringEndpointGroupAssociation;
/**
* @param string $formattedParent The parent, which owns this collection of associations.
* Example: `projects/123456789/locations/global`.
* See https://google.aip.dev/132 for more details. Please see
* {@see MirroringClient::locationName()} for help formatting this field.
*/
function list_mirroring_endpoint_group_associations_sample(string $formattedParent): void
{
// Create a client.
$mirroringClient = new MirroringClient();
// Prepare the request message.
$request = (new ListMirroringEndpointGroupAssociationsRequest())
->setParent($formattedParent);
// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $mirroringClient->listMirroringEndpointGroupAssociations($request);
/** @var MirroringEndpointGroupAssociation $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 = MirroringClient::locationName('[PROJECT]', '[LOCATION]');
list_mirroring_endpoint_group_associations_sample($formattedParent);
}
listMirroringEndpointGroups
Lists endpoint groups in a given project and location.
See https://google.aip.dev/132 .
The async variant is MirroringClient::listMirroringEndpointGroupsAsync() .
request
Google\Cloud\NetworkSecurity\V1\ListMirroringEndpointGroupsRequest
A request to house fields associated with the call.
callOptions
array
Optional.
↳ retrySettings
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\NetworkSecurity\V1\Client\MirroringClient;
use Google\Cloud\NetworkSecurity\V1\ListMirroringEndpointGroupsRequest;
use Google\Cloud\NetworkSecurity\V1\MirroringEndpointGroup;
/**
* @param string $formattedParent The parent, which owns this collection of endpoint groups.
* Example: `projects/123456789/locations/global`.
* See https://google.aip.dev/132 for more details. Please see
* {@see MirroringClient::locationName()} for help formatting this field.
*/
function list_mirroring_endpoint_groups_sample(string $formattedParent): void
{
// Create a client.
$mirroringClient = new MirroringClient();
// Prepare the request message.
$request = (new ListMirroringEndpointGroupsRequest())
->setParent($formattedParent);
// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $mirroringClient->listMirroringEndpointGroups($request);
/** @var MirroringEndpointGroup $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 = MirroringClient::locationName('[PROJECT]', '[LOCATION]');
list_mirroring_endpoint_groups_sample($formattedParent);
}
updateMirroringDeployment
Updates a deployment.
See https://google.aip.dev/134 .
The async variant is MirroringClient::updateMirroringDeploymentAsync() .
request
Google\Cloud\NetworkSecurity\V1\UpdateMirroringDeploymentRequest
A request to house fields associated with the call.
callOptions
array
Optional.
↳ retrySettings
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\NetworkSecurity\V1\Client\MirroringClient;
use Google\Cloud\NetworkSecurity\V1\MirroringDeployment;
use Google\Cloud\NetworkSecurity\V1\UpdateMirroringDeploymentRequest;
use Google\Rpc\Status;
/**
* @param string $formattedMirroringDeploymentForwardingRule Immutable. The regional forwarding rule that fronts the mirroring
* collectors, for example:
* `projects/123456789/regions/us-central1/forwardingRules/my-rule`. See
* https://google.aip.dev/124. Please see
* {@see MirroringClient::forwardingRuleName()} for help formatting this field.
* @param string $formattedMirroringDeploymentMirroringDeploymentGroup Immutable. The deployment group that this deployment is a part
* of, for example:
* `projects/123456789/locations/global/mirroringDeploymentGroups/my-dg`.
* See https://google.aip.dev/124. Please see
* {@see MirroringClient::mirroringDeploymentGroupName()} for help formatting this field.
*/
function update_mirroring_deployment_sample(
string $formattedMirroringDeploymentForwardingRule,
string $formattedMirroringDeploymentMirroringDeploymentGroup
): void {
// Create a client.
$mirroringClient = new MirroringClient();
// Prepare the request message.
$mirroringDeployment = (new MirroringDeployment())
->setForwardingRule($formattedMirroringDeploymentForwardingRule)
->setMirroringDeploymentGroup($formattedMirroringDeploymentMirroringDeploymentGroup);
$request = (new UpdateMirroringDeploymentRequest())
->setMirroringDeployment($mirroringDeployment);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $mirroringClient->updateMirroringDeployment($request);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
/** @var MirroringDeployment $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
{
$formattedMirroringDeploymentForwardingRule = MirroringClient::forwardingRuleName(
'[PROJECT]',
'[FORWARDING_RULE]'
);
$formattedMirroringDeploymentMirroringDeploymentGroup = MirroringClient::mirroringDeploymentGroupName(
'[PROJECT]',
'[LOCATION]',
'[MIRRORING_DEPLOYMENT_GROUP]'
);
update_mirroring_deployment_sample(
$formattedMirroringDeploymentForwardingRule,
$formattedMirroringDeploymentMirroringDeploymentGroup
);
}
updateMirroringDeploymentGroup
Updates a deployment group.
See https://google.aip.dev/134 .
The async variant is MirroringClient::updateMirroringDeploymentGroupAsync() .
request
Google\Cloud\NetworkSecurity\V1\UpdateMirroringDeploymentGroupRequest
A request to house fields associated with the call.
callOptions
array
Optional.
↳ retrySettings
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\NetworkSecurity\V1\Client\MirroringClient;
use Google\Cloud\NetworkSecurity\V1\MirroringDeploymentGroup;
use Google\Cloud\NetworkSecurity\V1\UpdateMirroringDeploymentGroupRequest;
use Google\Rpc\Status;
/**
* @param string $formattedMirroringDeploymentGroupNetwork Immutable. The network that will be used for all child
* deployments, for example: `projects/{project}/global/networks/{network}`.
* See https://google.aip.dev/124. Please see
* {@see MirroringClient::networkName()} for help formatting this field.
*/
function update_mirroring_deployment_group_sample(
string $formattedMirroringDeploymentGroupNetwork
): void {
// Create a client.
$mirroringClient = new MirroringClient();
// Prepare the request message.
$mirroringDeploymentGroup = (new MirroringDeploymentGroup())
->setNetwork($formattedMirroringDeploymentGroupNetwork);
$request = (new UpdateMirroringDeploymentGroupRequest())
->setMirroringDeploymentGroup($mirroringDeploymentGroup);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $mirroringClient->updateMirroringDeploymentGroup($request);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
/** @var MirroringDeploymentGroup $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
{
$formattedMirroringDeploymentGroupNetwork = MirroringClient::networkName('[PROJECT]', '[NETWORK]');
update_mirroring_deployment_group_sample($formattedMirroringDeploymentGroupNetwork);
}
updateMirroringEndpointGroup
Updates an endpoint group.
See https://google.aip.dev/134 .
The async variant is MirroringClient::updateMirroringEndpointGroupAsync() .
request
Google\Cloud\NetworkSecurity\V1\UpdateMirroringEndpointGroupRequest
A request to house fields associated with the call.
callOptions
array
Optional.
↳ retrySettings
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\NetworkSecurity\V1\Client\MirroringClient;
use Google\Cloud\NetworkSecurity\V1\MirroringEndpointGroup;
use Google\Cloud\NetworkSecurity\V1\UpdateMirroringEndpointGroupRequest;
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_mirroring_endpoint_group_sample(): void
{
// Create a client.
$mirroringClient = new MirroringClient();
// Prepare the request message.
$mirroringEndpointGroup = new MirroringEndpointGroup();
$request = (new UpdateMirroringEndpointGroupRequest())
->setMirroringEndpointGroup($mirroringEndpointGroup);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $mirroringClient->updateMirroringEndpointGroup($request);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
/** @var MirroringEndpointGroup $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());
}
}
updateMirroringEndpointGroupAssociation
Updates an association.
See https://google.aip.dev/134 .
The async variant is MirroringClient::updateMirroringEndpointGroupAssociationAsync() .
request
Google\Cloud\NetworkSecurity\V1\UpdateMirroringEndpointGroupAssociationRequest
A request to house fields associated with the call.
callOptions
array
Optional.
↳ retrySettings
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\NetworkSecurity\V1\Client\MirroringClient;
use Google\Cloud\NetworkSecurity\V1\MirroringEndpointGroupAssociation;
use Google\Cloud\NetworkSecurity\V1\UpdateMirroringEndpointGroupAssociationRequest;
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_mirroring_endpoint_group_association_sample(): void
{
// Create a client.
$mirroringClient = new MirroringClient();
// Prepare the request message.
$mirroringEndpointGroupAssociation = new MirroringEndpointGroupAssociation();
$request = (new UpdateMirroringEndpointGroupAssociationRequest())
->setMirroringEndpointGroupAssociation($mirroringEndpointGroupAssociation);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $mirroringClient->updateMirroringEndpointGroupAssociation($request);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
/** @var MirroringEndpointGroupAssociation $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 MirroringClient::getLocationAsync() .
request
callOptions
array
Optional.
↳ retrySettings
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
use Google\ApiCore\ApiException;
use Google\Cloud\Location\GetLocationRequest;
use Google\Cloud\Location\Location;
use Google\Cloud\NetworkSecurity\V1\Client\MirroringClient;
/**
* 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.
$mirroringClient = new MirroringClient();
// Prepare the request message.
$request = new GetLocationRequest();
// Call the API and handle any network failures.
try {
/** @var Location $response */
$response = $mirroringClient->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 MirroringClient::listLocationsAsync() .
request
callOptions
array
Optional.
↳ retrySettings
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\Location\ListLocationsRequest;
use Google\Cloud\Location\Location;
use Google\Cloud\NetworkSecurity\V1\Client\MirroringClient;
/**
* 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.
$mirroringClient = new MirroringClient();
// Prepare the request message.
$request = new ListLocationsRequest();
// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $mirroringClient->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());
}
}
getIamPolicy
Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
The async variant is MirroringClient::getIamPolicyAsync() .
request
callOptions
array
Optional.
↳ retrySettings
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
use Google\ApiCore\ApiException;
use Google\Cloud\Iam\V1\GetIamPolicyRequest;
use Google\Cloud\Iam\V1\Policy;
use Google\Cloud\NetworkSecurity\V1\Client\MirroringClient;
/**
* @param string $resource REQUIRED: The resource for which the policy is being requested.
* See the operation documentation for the appropriate value for this field.
*/
function get_iam_policy_sample(string $resource): void
{
// Create a client.
$mirroringClient = new MirroringClient();
// Prepare the request message.
$request = (new GetIamPolicyRequest())
->setResource($resource);
// Call the API and handle any network failures.
try {
/** @var Policy $response */
$response = $mirroringClient->getIamPolicy($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
{
$resource = '[RESOURCE]';
get_iam_policy_sample($resource);
}
setIamPolicy
Sets the access control policy on the specified resource. Replaces any existing policy.
Can return NOT_FOUND
, INVALID_ARGUMENT
, and PERMISSION_DENIED
errors.
The async variant is MirroringClient::setIamPolicyAsync() .
request
callOptions
array
Optional.
↳ retrySettings
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
use Google\ApiCore\ApiException;
use Google\Cloud\Iam\V1\Policy;
use Google\Cloud\Iam\V1\SetIamPolicyRequest;
use Google\Cloud\NetworkSecurity\V1\Client\MirroringClient;
/**
* @param string $resource REQUIRED: The resource for which the policy is being specified.
* See the operation documentation for the appropriate value for this field.
*/
function set_iam_policy_sample(string $resource): void
{
// Create a client.
$mirroringClient = new MirroringClient();
// Prepare the request message.
$policy = new Policy();
$request = (new SetIamPolicyRequest())
->setResource($resource)
->setPolicy($policy);
// Call the API and handle any network failures.
try {
/** @var Policy $response */
$response = $mirroringClient->setIamPolicy($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
{
$resource = '[RESOURCE]';
set_iam_policy_sample($resource);
}
testIamPermissions
Returns permissions that a caller has on the specified resource. If the
resource does not exist, this will return an empty set of
permissions, not a NOT_FOUND
error.
Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.
The async variant is MirroringClient::testIamPermissionsAsync() .
request
callOptions
array
Optional.
↳ retrySettings
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.
use Google\ApiCore\ApiException;
use Google\Cloud\Iam\V1\TestIamPermissionsRequest;
use Google\Cloud\Iam\V1\TestIamPermissionsResponse;
use Google\Cloud\NetworkSecurity\V1\Client\MirroringClient;
/**
* @param string $resource REQUIRED: The resource for which the policy detail is being requested.
* See the operation documentation for the appropriate value for this field.
* @param string $permissionsElement The set of permissions to check for the `resource`. Permissions with
* wildcards (such as '*' or 'storage.*') are not allowed. For more
* information see
* [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions).
*/
function test_iam_permissions_sample(string $resource, string $permissionsElement): void
{
// Create a client.
$mirroringClient = new MirroringClient();
// Prepare the request message.
$permissions = [$permissionsElement,];
$request = (new TestIamPermissionsRequest())
->setResource($resource)
->setPermissions($permissions);
// Call the API and handle any network failures.
try {
/** @var TestIamPermissionsResponse $response */
$response = $mirroringClient->testIamPermissions($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
{
$resource = '[RESOURCE]';
$permissionsElement = '[PERMISSIONS]';
test_iam_permissions_sample($resource, $permissionsElement);
}
createMirroringDeploymentAsync
optionalArgs
array
createMirroringDeploymentGroupAsync
optionalArgs
array
createMirroringEndpointGroupAsync
optionalArgs
array
createMirroringEndpointGroupAssociationAsync
optionalArgs
array
deleteMirroringDeploymentAsync
optionalArgs
array
deleteMirroringDeploymentGroupAsync
optionalArgs
array
deleteMirroringEndpointGroupAsync
optionalArgs
array
deleteMirroringEndpointGroupAssociationAsync
optionalArgs
array
getMirroringDeploymentAsync
optionalArgs
array
getMirroringDeploymentGroupAsync
optionalArgs
array
getMirroringEndpointGroupAsync
optionalArgs
array
getMirroringEndpointGroupAssociationAsync
optionalArgs
array
listMirroringDeploymentGroupsAsync
optionalArgs
array
listMirroringDeploymentsAsync
optionalArgs
array
listMirroringEndpointGroupAssociationsAsync
optionalArgs
array
listMirroringEndpointGroupsAsync
optionalArgs
array
updateMirroringDeploymentAsync
optionalArgs
array
updateMirroringDeploymentGroupAsync
optionalArgs
array
updateMirroringEndpointGroupAsync
optionalArgs
array
updateMirroringEndpointGroupAssociationAsync
optionalArgs
array
getLocationAsync
listLocationsAsync
getIamPolicyAsync
setIamPolicyAsync
testIamPermissionsAsync
optionalArgs
array
getOperationsClient
Return an OperationsClient object with the same endpoint as $this.
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.
operationName
string
The name of the long running operation
methodName
string
The name of the method used to start the operation
static::forwardingRuleName
Formats a string containing the fully-qualified path to represent a forwarding_rule resource.
project
string
forwardingRule
string
string
static::locationName
Formats a string containing the fully-qualified path to represent a location resource.
project
string
location
string
string
static::mirroringDeploymentName
Formats a string containing the fully-qualified path to represent a mirroring_deployment resource.
project
string
location
string
mirroringDeployment
string
string
static::mirroringDeploymentGroupName
Formats a string containing the fully-qualified path to represent a mirroring_deployment_group resource.
project
string
location
string
mirroringDeploymentGroup
string
string
static::mirroringEndpointGroupName
Formats a string containing the fully-qualified path to represent a mirroring_endpoint_group resource.
project
string
location
string
mirroringEndpointGroup
string
string
static::mirroringEndpointGroupAssociationName
Formats a string containing the fully-qualified path to represent a mirroring_endpoint_group_association resource.
project
string
location
string
mirroringEndpointGroupAssociation
string
string
static::networkName
Formats a string containing the fully-qualified path to represent a network resource.
project
string
network
string
string
static::parseName
Parses a formatted name string and returns an associative array of the components in the name.
The following name formats are supported: Template: Pattern
- forwardingRule: projects/{project}/global/forwardingRules/{forwarding_rule}
- location: projects/{project}/locations/{location}
- mirroringDeployment: projects/{project}/locations/{location}/mirroringDeployments/{mirroring_deployment}
- mirroringDeploymentGroup: projects/{project}/locations/{location}/mirroringDeploymentGroups/{mirroring_deployment_group}
- mirroringEndpointGroup: projects/{project}/locations/{location}/mirroringEndpointGroups/{mirroring_endpoint_group}
- mirroringEndpointGroupAssociation: projects/{project}/locations/{location}/mirroringEndpointGroupAssociations/{mirroring_endpoint_group_association}
- network: projects/{project}/global/networks/{network}
The optional $template argument can be supplied to specify a particular pattern, and must match one of the templates listed above. If no $template argument is provided, or if the $template argument does not match one of the templates listed, then parseName will check each of the supported templates, and return the first match.
formattedName
string
The formatted name string
template
?string
Optional name of template to match
array

