Reference documentation and code samples for the Google Cloud Network Security V1 Client class NetworkSecurityClient.
Service Description: Network Security API provides resources to configure authentication and authorization policies. Refer to per API resource documentation for more information.
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.
| Parameters | |
|---|---|
| Name | Description |
options |
array|Google\ApiCore\Options\ClientOptions
Optional. Options for configuring the service API wrapper. |
↳ apiEndpoint |
string
The address of the API remote host. May optionally include the port, formatted as "
|
↳ credentials |
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 |
↳ credentialsConfig |
array
Options used to configure credentials, including auth token caching, for the client. For a full list of supporting configuration options, see Google\ApiCore\CredentialsWrapper::build() . |
↳ disableRetries |
bool
Determines whether or not retries defined by the client configuration should be disabled. Defaults to |
↳ clientConfig |
string|array
Client method configuration, including retry settings. This option can be either a path to a JSON file, or a PHP array containing the decoded JSON data. By default this settings points to the default client config file, which is provided in the resources folder. |
↳ transport |
string|TransportInterface
The transport used for executing network requests. May be either the string |
↳ transportConfig |
array
Configuration options that will be used to construct the transport. Options for each supported transport type should be passed in a key for that transport. For example: $transportConfig = [ 'grpc' => [...], 'rest' => [...], ]; See the Google\ApiCore\Transport\GrpcTransport::build() and Google\ApiCore\Transport\RestTransport::build() methods for the supported options. |
↳ clientCertSource |
callable
A callable which returns the client cert as a string. This can be used to provide a certificate and private key to the transport layer for mTLS. |
↳ logger |
false|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'. |
createAuthorizationPolicy
Creates a new AuthorizationPolicy in a given project and location.
The async variant is NetworkSecurityClient::createAuthorizationPolicyAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\NetworkSecurity\V1\CreateAuthorizationPolicyRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Returns | |
|---|---|
| Type | Description |
Google\ApiCore\OperationResponse<Google\Cloud\NetworkSecurity\V1\AuthorizationPolicy> |
|
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\NetworkSecurity\V1\AuthorizationPolicy;
use Google\Cloud\NetworkSecurity\V1\AuthorizationPolicy\Action;
use Google\Cloud\NetworkSecurity\V1\Client\NetworkSecurityClient;
use Google\Cloud\NetworkSecurity\V1\CreateAuthorizationPolicyRequest;
use Google\Rpc\Status;
/**
* @param string $formattedParent The parent resource of the AuthorizationPolicy. Must be in the
* format `projects/{project}/locations/{location}`. Please see
* {@see NetworkSecurityClient::locationName()} for help formatting this field.
* @param string $authorizationPolicyId Short name of the AuthorizationPolicy resource to be created.
* This value should be 1-63 characters long, containing only
* letters, numbers, hyphens, and underscores, and should not start
* with a number. E.g. "authz_policy".
* @param string $authorizationPolicyName Name of the AuthorizationPolicy resource. It matches pattern
* `projects/{project}/locations/{location}/authorizationPolicies/<authorization_policy>`.
* @param int $authorizationPolicyAction The action to take when a rule match is found. Possible values
* are "ALLOW" or "DENY".
*/
function create_authorization_policy_sample(
string $formattedParent,
string $authorizationPolicyId,
string $authorizationPolicyName,
int $authorizationPolicyAction
): void {
// Create a client.
$networkSecurityClient = new NetworkSecurityClient();
// Prepare the request message.
$authorizationPolicy = (new AuthorizationPolicy())
->setName($authorizationPolicyName)
->setAction($authorizationPolicyAction);
$request = (new CreateAuthorizationPolicyRequest())
->setParent($formattedParent)
->setAuthorizationPolicyId($authorizationPolicyId)
->setAuthorizationPolicy($authorizationPolicy);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $networkSecurityClient->createAuthorizationPolicy($request);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
/** @var AuthorizationPolicy $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 = NetworkSecurityClient::locationName('[PROJECT]', '[LOCATION]');
$authorizationPolicyId = '[AUTHORIZATION_POLICY_ID]';
$authorizationPolicyName = '[NAME]';
$authorizationPolicyAction = Action::ACTION_UNSPECIFIED;
create_authorization_policy_sample(
$formattedParent,
$authorizationPolicyId,
$authorizationPolicyName,
$authorizationPolicyAction
);
}
createAuthzPolicy
Creates a new AuthzPolicy in a given project and location.
The async variant is NetworkSecurityClient::createAuthzPolicyAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\NetworkSecurity\V1\CreateAuthzPolicyRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Returns | |
|---|---|
| Type | Description |
Google\ApiCore\OperationResponse<Google\Cloud\NetworkSecurity\V1\AuthzPolicy> |
|
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\NetworkSecurity\V1\AuthzPolicy;
use Google\Cloud\NetworkSecurity\V1\AuthzPolicy\AuthzAction;
use Google\Cloud\NetworkSecurity\V1\AuthzPolicy\Target;
use Google\Cloud\NetworkSecurity\V1\Client\NetworkSecurityClient;
use Google\Cloud\NetworkSecurity\V1\CreateAuthzPolicyRequest;
use Google\Rpc\Status;
/**
* @param string $formattedParent The parent resource of the `AuthzPolicy` resource. Must be in
* the format `projects/{project}/locations/{location}`. Please see
* {@see NetworkSecurityClient::locationName()} for help formatting this field.
* @param string $authzPolicyId User-provided ID of the `AuthzPolicy` resource to be created.
* @param string $authzPolicyName Identifier. Name of the `AuthzPolicy` resource in the following
* format:
* `projects/{project}/locations/{location}/authzPolicies/{authz_policy}`.
* @param string $authzPolicyTargetResourcesElement A list of references to the Forwarding Rules on which this
* policy will be applied.
* @param int $authzPolicyAction Can be one of `ALLOW`, `DENY`, `CUSTOM`.
*
* When the action is `CUSTOM`, `customProvider` must be specified.
*
* When the action is `ALLOW`, only requests matching the policy will
* be allowed.
*
* When the action is `DENY`, only requests matching the policy will be
* denied.
*
* When a request arrives, the policies are evaluated in the following order:
*
* 1. If there is a `CUSTOM` policy that matches the request, the `CUSTOM`
* policy is evaluated using the custom authorization providers and the
* request is denied if the provider rejects the request.
*
* 2. If there are any `DENY` policies that match the request, the request
* is denied.
*
* 3. If there are no `ALLOW` policies for the resource or if any of the
* `ALLOW` policies match the request, the request is allowed.
*
* 4. Else the request is denied by default if none of the configured
* AuthzPolicies with `ALLOW` action match the request.
*/
function create_authz_policy_sample(
string $formattedParent,
string $authzPolicyId,
string $authzPolicyName,
string $authzPolicyTargetResourcesElement,
int $authzPolicyAction
): void {
// Create a client.
$networkSecurityClient = new NetworkSecurityClient();
// Prepare the request message.
$authzPolicyTargetResources = [$authzPolicyTargetResourcesElement,];
$authzPolicyTarget = (new Target())
->setResources($authzPolicyTargetResources);
$authzPolicy = (new AuthzPolicy())
->setName($authzPolicyName)
->setTarget($authzPolicyTarget)
->setAction($authzPolicyAction);
$request = (new CreateAuthzPolicyRequest())
->setParent($formattedParent)
->setAuthzPolicyId($authzPolicyId)
->setAuthzPolicy($authzPolicy);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $networkSecurityClient->createAuthzPolicy($request);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
/** @var AuthzPolicy $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 = NetworkSecurityClient::locationName('[PROJECT]', '[LOCATION]');
$authzPolicyId = '[AUTHZ_POLICY_ID]';
$authzPolicyName = '[NAME]';
$authzPolicyTargetResourcesElement = '[RESOURCES]';
$authzPolicyAction = AuthzAction::AUTHZ_ACTION_UNSPECIFIED;
create_authz_policy_sample(
$formattedParent,
$authzPolicyId,
$authzPolicyName,
$authzPolicyTargetResourcesElement,
$authzPolicyAction
);
}
createBackendAuthenticationConfig
Creates a new BackendAuthenticationConfig in a given project and location.
The async variant is NetworkSecurityClient::createBackendAuthenticationConfigAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\NetworkSecurity\V1\CreateBackendAuthenticationConfigRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Returns | |
|---|---|
| Type | Description |
Google\ApiCore\OperationResponse<Google\Cloud\NetworkSecurity\V1\BackendAuthenticationConfig> |
|
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\NetworkSecurity\V1\BackendAuthenticationConfig;
use Google\Cloud\NetworkSecurity\V1\Client\NetworkSecurityClient;
use Google\Cloud\NetworkSecurity\V1\CreateBackendAuthenticationConfigRequest;
use Google\Rpc\Status;
/**
* @param string $formattedParent The parent resource of the BackendAuthenticationConfig. Must be
* in the format `projects/*/locations/{location}`. Please see
* {@see NetworkSecurityClient::locationName()} for help formatting this field.
* @param string $backendAuthenticationConfigId Short name of the BackendAuthenticationConfig resource to be
* created. This value should be 1-63 characters long, containing only
* letters, numbers, hyphens, and underscores, and should not start with a
* number. E.g. "backend-auth-config".
* @param string $backendAuthenticationConfigName Name of the BackendAuthenticationConfig resource. It matches the
* pattern
* `projects/*/locations/{location}/backendAuthenticationConfigs/{backend_authentication_config}`
*/
function create_backend_authentication_config_sample(
string $formattedParent,
string $backendAuthenticationConfigId,
string $backendAuthenticationConfigName
): void {
// Create a client.
$networkSecurityClient = new NetworkSecurityClient();
// Prepare the request message.
$backendAuthenticationConfig = (new BackendAuthenticationConfig())
->setName($backendAuthenticationConfigName);
$request = (new CreateBackendAuthenticationConfigRequest())
->setParent($formattedParent)
->setBackendAuthenticationConfigId($backendAuthenticationConfigId)
->setBackendAuthenticationConfig($backendAuthenticationConfig);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $networkSecurityClient->createBackendAuthenticationConfig($request);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
/** @var BackendAuthenticationConfig $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 = NetworkSecurityClient::locationName('[PROJECT]', '[LOCATION]');
$backendAuthenticationConfigId = '[BACKEND_AUTHENTICATION_CONFIG_ID]';
$backendAuthenticationConfigName = '[NAME]';
create_backend_authentication_config_sample(
$formattedParent,
$backendAuthenticationConfigId,
$backendAuthenticationConfigName
);
}
createClientTlsPolicy
Creates a new ClientTlsPolicy in a given project and location.
The async variant is NetworkSecurityClient::createClientTlsPolicyAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\NetworkSecurity\V1\CreateClientTlsPolicyRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Returns | |
|---|---|
| Type | Description |
Google\ApiCore\OperationResponse<lsPolicy> |
|
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\NetworkSecurity\V1\ClientTlsPolicy;
use Google\Cloud\NetworkSecurity\V1\Client\NetworkSecurityClient;
use Google\Cloud\NetworkSecurity\V1\CreateClientTlsPolicyRequest;
use Google\Rpc\Status;
/**
* @param string $formattedParent The parent resource of the ClientTlsPolicy. Must be in
* the format `projects/*/locations/{location}`. Please see
* {@see NetworkSecurityClient::locationName()} for help formatting this field.
* @param string $clientTlsPolicyId Short name of the ClientTlsPolicy resource to be created. This
* value should be 1-63 characters long, containing only letters, numbers,
* hyphens, and underscores, and should not start with a number. E.g.
* "client_mtls_policy".
* @param string $clientTlsPolicyName Name of the ClientTlsPolicy resource. It matches the pattern
* `projects/{project}/locations/{location}/clientTlsPolicies/{client_tls_policy}`
*/
function create_client_tls_policy_sample(
string $formattedParent,
string $clientTlsPolicyId,
string $clientTlsPolicyName
): void {
// Create a client.
$networkSecurityClient = new NetworkSecurityClient();
// Prepare the request message.
$clientTlsPolicy = (new ClientTlsPolicy())
->setName($clientTlsPolicyName);
$request = (new CreateClientTlsPolicyRequest())
->setParent($formattedParent)
->setClientTlsPolicyId($clientTlsPolicyId)
->setClientTlsPolicy($clientTlsPolicy);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $networkSecurityClient->createClientTlsPolicy($request);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
/** @var ClientTlsPolicy $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 = NetworkSecurityClient::locationName('[PROJECT]', '[LOCATION]');
$clientTlsPolicyId = '[CLIENT_TLS_POLICY_ID]';
$clientTlsPolicyName = '[NAME]';
create_client_tls_policy_sample($formattedParent, $clientTlsPolicyId, $clientTlsPolicyName);
}
createGatewaySecurityPolicy
Creates a new GatewaySecurityPolicy in a given project and location.
The async variant is NetworkSecurityClient::createGatewaySecurityPolicyAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\NetworkSecurity\V1\CreateGatewaySecurityPolicyRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Returns | |
|---|---|
| Type | Description |
Google\ApiCore\OperationResponse<Google\Cloud\NetworkSecurity\V1\GatewaySecurityPolicy> |
|
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\NetworkSecurity\V1\Client\NetworkSecurityClient;
use Google\Cloud\NetworkSecurity\V1\CreateGatewaySecurityPolicyRequest;
use Google\Cloud\NetworkSecurity\V1\GatewaySecurityPolicy;
use Google\Rpc\Status;
/**
* @param string $formattedParent The parent resource of the GatewaySecurityPolicy. Must be in the
* format `projects/{project}/locations/{location}`. Please see
* {@see NetworkSecurityClient::locationName()} for help formatting this field.
* @param string $gatewaySecurityPolicyId Short name of the GatewaySecurityPolicy resource to be created.
* This value should be 1-63 characters long, containing only
* letters, numbers, hyphens, and underscores, and should not start
* with a number. E.g. "gateway_security_policy1".
* @param string $gatewaySecurityPolicyName Name of the resource. Name is of the form
* projects/{project}/locations/{location}/gatewaySecurityPolicies/{gateway_security_policy}
* gateway_security_policy should match the
* pattern:(^[a-z]([a-z0-9-]{0,61}[a-z0-9])?$).
*/
function create_gateway_security_policy_sample(
string $formattedParent,
string $gatewaySecurityPolicyId,
string $gatewaySecurityPolicyName
): void {
// Create a client.
$networkSecurityClient = new NetworkSecurityClient();
// Prepare the request message.
$gatewaySecurityPolicy = (new GatewaySecurityPolicy())
->setName($gatewaySecurityPolicyName);
$request = (new CreateGatewaySecurityPolicyRequest())
->setParent($formattedParent)
->setGatewaySecurityPolicyId($gatewaySecurityPolicyId)
->setGatewaySecurityPolicy($gatewaySecurityPolicy);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $networkSecurityClient->createGatewaySecurityPolicy($request);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
/** @var GatewaySecurityPolicy $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 = NetworkSecurityClient::locationName('[PROJECT]', '[LOCATION]');
$gatewaySecurityPolicyId = '[GATEWAY_SECURITY_POLICY_ID]';
$gatewaySecurityPolicyName = '[NAME]';
create_gateway_security_policy_sample(
$formattedParent,
$gatewaySecurityPolicyId,
$gatewaySecurityPolicyName
);
}
createGatewaySecurityPolicyRule
Creates a new GatewaySecurityPolicy in a given project and location.
The async variant is NetworkSecurityClient::createGatewaySecurityPolicyRuleAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\NetworkSecurity\V1\CreateGatewaySecurityPolicyRuleRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Returns | |
|---|---|
| Type | Description |
Google\ApiCore\OperationResponse<Google\Cloud\NetworkSecurity\V1\GatewaySecurityPolicyRule> |
|
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\NetworkSecurity\V1\Client\NetworkSecurityClient;
use Google\Cloud\NetworkSecurity\V1\CreateGatewaySecurityPolicyRuleRequest;
use Google\Cloud\NetworkSecurity\V1\GatewaySecurityPolicyRule;
use Google\Cloud\NetworkSecurity\V1\GatewaySecurityPolicyRule\BasicProfile;
use Google\Rpc\Status;
/**
* @param string $formattedParent The parent where this rule will be created.
* Format :
* projects/{project}/location/{location}/gatewaySecurityPolicies/*
* Please see {@see NetworkSecurityClient::gatewaySecurityPolicyName()} for help formatting this field.
* @param int $gatewaySecurityPolicyRuleBasicProfile Profile which tells what the primitive action should be.
* @param string $gatewaySecurityPolicyRuleName Immutable. Name of the resource. ame is the full resource name so
* projects/{project}/locations/{location}/gatewaySecurityPolicies/{gateway_security_policy}/rules/{rule}
* rule should match the
* pattern: (^[a-z]([a-z0-9-]{0,61}[a-z0-9])?$).
* @param bool $gatewaySecurityPolicyRuleEnabled Whether the rule is enforced.
* @param int $gatewaySecurityPolicyRulePriority Priority of the rule.
* Lower number corresponds to higher precedence.
* @param string $gatewaySecurityPolicyRuleSessionMatcher CEL expression for matching on session criteria.
*/
function create_gateway_security_policy_rule_sample(
string $formattedParent,
int $gatewaySecurityPolicyRuleBasicProfile,
string $gatewaySecurityPolicyRuleName,
bool $gatewaySecurityPolicyRuleEnabled,
int $gatewaySecurityPolicyRulePriority,
string $gatewaySecurityPolicyRuleSessionMatcher
): void {
// Create a client.
$networkSecurityClient = new NetworkSecurityClient();
// Prepare the request message.
$gatewaySecurityPolicyRule = (new GatewaySecurityPolicyRule())
->setBasicProfile($gatewaySecurityPolicyRuleBasicProfile)
->setName($gatewaySecurityPolicyRuleName)
->setEnabled($gatewaySecurityPolicyRuleEnabled)
->setPriority($gatewaySecurityPolicyRulePriority)
->setSessionMatcher($gatewaySecurityPolicyRuleSessionMatcher);
$request = (new CreateGatewaySecurityPolicyRuleRequest())
->setParent($formattedParent)
->setGatewaySecurityPolicyRule($gatewaySecurityPolicyRule);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $networkSecurityClient->createGatewaySecurityPolicyRule($request);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
/** @var GatewaySecurityPolicyRule $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 = NetworkSecurityClient::gatewaySecurityPolicyName(
'[PROJECT]',
'[LOCATION]',
'[GATEWAY_SECURITY_POLICY]'
);
$gatewaySecurityPolicyRuleBasicProfile = BasicProfile::BASIC_PROFILE_UNSPECIFIED;
$gatewaySecurityPolicyRuleName = '[NAME]';
$gatewaySecurityPolicyRuleEnabled = false;
$gatewaySecurityPolicyRulePriority = 0;
$gatewaySecurityPolicyRuleSessionMatcher = '[SESSION_MATCHER]';
create_gateway_security_policy_rule_sample(
$formattedParent,
$gatewaySecurityPolicyRuleBasicProfile,
$gatewaySecurityPolicyRuleName,
$gatewaySecurityPolicyRuleEnabled,
$gatewaySecurityPolicyRulePriority,
$gatewaySecurityPolicyRuleSessionMatcher
);
}
createServerTlsPolicy
Creates a new ServerTlsPolicy in a given project and location.
The async variant is NetworkSecurityClient::createServerTlsPolicyAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\NetworkSecurity\V1\CreateServerTlsPolicyRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Returns | |
|---|---|
| Type | Description |
Google\ApiCore\OperationResponse<Google\Cloud\NetworkSecurity\V1\ServerTlsPolicy> |
|
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\NetworkSecurity\V1\Client\NetworkSecurityClient;
use Google\Cloud\NetworkSecurity\V1\CreateServerTlsPolicyRequest;
use Google\Cloud\NetworkSecurity\V1\ServerTlsPolicy;
use Google\Rpc\Status;
/**
* @param string $formattedParent The parent resource of the ServerTlsPolicy. Must be in
* the format `projects/*/locations/{location}`. Please see
* {@see NetworkSecurityClient::locationName()} for help formatting this field.
* @param string $serverTlsPolicyId Short name of the ServerTlsPolicy resource to be created. This
* value should be 1-63 characters long, containing only letters, numbers,
* hyphens, and underscores, and should not start with a number. E.g.
* "server_mtls_policy".
* @param string $serverTlsPolicyName Name of the ServerTlsPolicy resource. It matches the pattern
* `projects/*/locations/{location}/serverTlsPolicies/{server_tls_policy}`
*/
function create_server_tls_policy_sample(
string $formattedParent,
string $serverTlsPolicyId,
string $serverTlsPolicyName
): void {
// Create a client.
$networkSecurityClient = new NetworkSecurityClient();
// Prepare the request message.
$serverTlsPolicy = (new ServerTlsPolicy())
->setName($serverTlsPolicyName);
$request = (new CreateServerTlsPolicyRequest())
->setParent($formattedParent)
->setServerTlsPolicyId($serverTlsPolicyId)
->setServerTlsPolicy($serverTlsPolicy);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $networkSecurityClient->createServerTlsPolicy($request);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
/** @var ServerTlsPolicy $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 = NetworkSecurityClient::locationName('[PROJECT]', '[LOCATION]');
$serverTlsPolicyId = '[SERVER_TLS_POLICY_ID]';
$serverTlsPolicyName = '[NAME]';
create_server_tls_policy_sample($formattedParent, $serverTlsPolicyId, $serverTlsPolicyName);
}
createTlsInspectionPolicy
Creates a new TlsInspectionPolicy in a given project and location.
The async variant is NetworkSecurityClient::createTlsInspectionPolicyAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\NetworkSecurity\V1\CreateTlsInspectionPolicyRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Returns | |
|---|---|
| Type | Description |
Google\ApiCore\OperationResponse<Google\Cloud\NetworkSecurity\V1\TlsInspectionPolicy> |
|
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\NetworkSecurity\V1\Client\NetworkSecurityClient;
use Google\Cloud\NetworkSecurity\V1\CreateTlsInspectionPolicyRequest;
use Google\Cloud\NetworkSecurity\V1\TlsInspectionPolicy;
use Google\Rpc\Status;
/**
* @param string $formattedParent The parent resource of the TlsInspectionPolicy. Must be in the
* format `projects/{project}/locations/{location}`. Please see
* {@see NetworkSecurityClient::locationName()} for help formatting this field.
* @param string $tlsInspectionPolicyId Short name of the TlsInspectionPolicy resource to be created.
* This value should be 1-63 characters long, containing only
* letters, numbers, hyphens, and underscores, and should not start
* with a number. E.g. "tls_inspection_policy1".
* @param string $tlsInspectionPolicyName Name of the resource. Name is of the form
* projects/{project}/locations/{location}/tlsInspectionPolicies/{tls_inspection_policy}
* tls_inspection_policy should match the
* pattern:(^[a-z]([a-z0-9-]{0,61}[a-z0-9])?$).
* @param string $formattedTlsInspectionPolicyCaPool A CA pool resource used to issue interception certificates.
* The CA pool string has a relative resource path following the form
* "projects/{project}/locations/{location}/caPools/{ca_pool}". Please see
* {@see NetworkSecurityClient::caPoolName()} for help formatting this field.
*/
function create_tls_inspection_policy_sample(
string $formattedParent,
string $tlsInspectionPolicyId,
string $tlsInspectionPolicyName,
string $formattedTlsInspectionPolicyCaPool
): void {
// Create a client.
$networkSecurityClient = new NetworkSecurityClient();
// Prepare the request message.
$tlsInspectionPolicy = (new TlsInspectionPolicy())
->setName($tlsInspectionPolicyName)
->setCaPool($formattedTlsInspectionPolicyCaPool);
$request = (new CreateTlsInspectionPolicyRequest())
->setParent($formattedParent)
->setTlsInspectionPolicyId($tlsInspectionPolicyId)
->setTlsInspectionPolicy($tlsInspectionPolicy);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $networkSecurityClient->createTlsInspectionPolicy($request);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
/** @var TlsInspectionPolicy $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 = NetworkSecurityClient::locationName('[PROJECT]', '[LOCATION]');
$tlsInspectionPolicyId = '[TLS_INSPECTION_POLICY_ID]';
$tlsInspectionPolicyName = '[NAME]';
$formattedTlsInspectionPolicyCaPool = NetworkSecurityClient::caPoolName(
'[PROJECT]',
'[LOCATION]',
'[CA_POOL]'
);
create_tls_inspection_policy_sample(
$formattedParent,
$tlsInspectionPolicyId,
$tlsInspectionPolicyName,
$formattedTlsInspectionPolicyCaPool
);
}
createUrlList
Creates a new UrlList in a given project and location.
The async variant is NetworkSecurityClient::createUrlListAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\NetworkSecurity\V1\CreateUrlListRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Returns | |
|---|---|
| Type | Description |
Google\ApiCore\OperationResponse<Google\Cloud\NetworkSecurity\V1\UrlList> |
|
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\NetworkSecurity\V1\Client\NetworkSecurityClient;
use Google\Cloud\NetworkSecurity\V1\CreateUrlListRequest;
use Google\Cloud\NetworkSecurity\V1\UrlList;
use Google\Rpc\Status;
/**
* @param string $formattedParent The parent resource of the UrlList. Must be in
* the format `projects/*/locations/{location}`. Please see
* {@see NetworkSecurityClient::locationName()} for help formatting this field.
* @param string $urlListId Short name of the UrlList resource to be created. This value
* should be 1-63 characters long, containing only letters, numbers, hyphens,
* and underscores, and should not start with a number. E.g. "url_list".
* @param string $urlListName Name of the resource provided by the user.
* Name is of the form
* projects/{project}/locations/{location}/urlLists/{url_list}
* url_list should match the
* pattern:(^[a-z]([a-z0-9-]{0,61}[a-z0-9])?$).
* @param string $urlListValuesElement FQDNs and URLs.
*/
function create_url_list_sample(
string $formattedParent,
string $urlListId,
string $urlListName,
string $urlListValuesElement
): void {
// Create a client.
$networkSecurityClient = new NetworkSecurityClient();
// Prepare the request message.
$urlListValues = [$urlListValuesElement,];
$urlList = (new UrlList())
->setName($urlListName)
->setValues($urlListValues);
$request = (new CreateUrlListRequest())
->setParent($formattedParent)
->setUrlListId($urlListId)
->setUrlList($urlList);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $networkSecurityClient->createUrlList($request);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
/** @var UrlList $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 = NetworkSecurityClient::locationName('[PROJECT]', '[LOCATION]');
$urlListId = '[URL_LIST_ID]';
$urlListName = '[NAME]';
$urlListValuesElement = '[VALUES]';
create_url_list_sample($formattedParent, $urlListId, $urlListName, $urlListValuesElement);
}
deleteAuthorizationPolicy
Deletes a single AuthorizationPolicy.
The async variant is NetworkSecurityClient::deleteAuthorizationPolicyAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\NetworkSecurity\V1\DeleteAuthorizationPolicyRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Returns | |
|---|---|
| Type | Description |
Google\ApiCore\OperationResponse<null> |
|
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\NetworkSecurity\V1\Client\NetworkSecurityClient;
use Google\Cloud\NetworkSecurity\V1\DeleteAuthorizationPolicyRequest;
use Google\Rpc\Status;
/**
* @param string $formattedName A name of the AuthorizationPolicy to delete. Must be in the
* format `projects/{project}/locations/{location}/authorizationPolicies/*`. Please see
* {@see NetworkSecurityClient::authorizationPolicyName()} for help formatting this field.
*/
function delete_authorization_policy_sample(string $formattedName): void
{
// Create a client.
$networkSecurityClient = new NetworkSecurityClient();
// Prepare the request message.
$request = (new DeleteAuthorizationPolicyRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $networkSecurityClient->deleteAuthorizationPolicy($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 = NetworkSecurityClient::authorizationPolicyName(
'[PROJECT]',
'[LOCATION]',
'[AUTHORIZATION_POLICY]'
);
delete_authorization_policy_sample($formattedName);
}
deleteAuthzPolicy
Deletes a single AuthzPolicy.
The async variant is NetworkSecurityClient::deleteAuthzPolicyAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\NetworkSecurity\V1\DeleteAuthzPolicyRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Returns | |
|---|---|
| Type | Description |
Google\ApiCore\OperationResponse<null> |
|
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\NetworkSecurity\V1\Client\NetworkSecurityClient;
use Google\Cloud\NetworkSecurity\V1\DeleteAuthzPolicyRequest;
use Google\Rpc\Status;
/**
* @param string $formattedName The name of the `AuthzPolicy` resource to delete. Must be in
* the format
* `projects/{project}/locations/{location}/authzPolicies/{authz_policy}`. Please see
* {@see NetworkSecurityClient::authzPolicyName()} for help formatting this field.
*/
function delete_authz_policy_sample(string $formattedName): void
{
// Create a client.
$networkSecurityClient = new NetworkSecurityClient();
// Prepare the request message.
$request = (new DeleteAuthzPolicyRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $networkSecurityClient->deleteAuthzPolicy($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 = NetworkSecurityClient::authzPolicyName(
'[PROJECT]',
'[LOCATION]',
'[AUTHZ_POLICY]'
);
delete_authz_policy_sample($formattedName);
}
deleteBackendAuthenticationConfig
Deletes a single BackendAuthenticationConfig to BackendAuthenticationConfig.
The async variant is NetworkSecurityClient::deleteBackendAuthenticationConfigAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\NetworkSecurity\V1\DeleteBackendAuthenticationConfigRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Returns | |
|---|---|
| Type | Description |
Google\ApiCore\OperationResponse<null> |
|
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\NetworkSecurity\V1\Client\NetworkSecurityClient;
use Google\Cloud\NetworkSecurity\V1\DeleteBackendAuthenticationConfigRequest;
use Google\Rpc\Status;
/**
* @param string $formattedName A name of the BackendAuthenticationConfig to delete. Must be in
* the format
* `projects/*/locations/{location}/backendAuthenticationConfigs/*`. Please see
* {@see NetworkSecurityClient::backendAuthenticationConfigName()} for help formatting this field.
*/
function delete_backend_authentication_config_sample(string $formattedName): void
{
// Create a client.
$networkSecurityClient = new NetworkSecurityClient();
// Prepare the request message.
$request = (new DeleteBackendAuthenticationConfigRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $networkSecurityClient->deleteBackendAuthenticationConfig($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 = NetworkSecurityClient::backendAuthenticationConfigName(
'[PROJECT]',
'[LOCATION]',
'[BACKEND_AUTHENTICATION_CONFIG]'
);
delete_backend_authentication_config_sample($formattedName);
}
deleteClientTlsPolicy
Deletes a single ClientTlsPolicy.
The async variant is NetworkSecurityClient::deleteClientTlsPolicyAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\NetworkSecurity\V1\DeleteClientTlsPolicyRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Returns | |
|---|---|
| Type | Description |
Google\ApiCore\OperationResponse<null> |
|
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\NetworkSecurity\V1\Client\NetworkSecurityClient;
use Google\Cloud\NetworkSecurity\V1\DeleteClientTlsPolicyRequest;
use Google\Rpc\Status;
/**
* @param string $formattedName A name of the ClientTlsPolicy to delete. Must be in
* the format `projects/*/locations/{location}/clientTlsPolicies/*`. Please see
* {@see NetworkSecurityClient::clientTlsPolicyName()} for help formatting this field.
*/
function delete_client_tls_policy_sample(string $formattedName): void
{
// Create a client.
$networkSecurityClient = new NetworkSecurityClient();
// Prepare the request message.
$request = (new DeleteClientTlsPolicyRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $networkSecurityClient->deleteClientTlsPolicy($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 = NetworkSecurityClient::clientTlsPolicyName(
'[PROJECT]',
'[LOCATION]',
'[CLIENT_TLS_POLICY]'
);
delete_client_tls_policy_sample($formattedName);
}
deleteGatewaySecurityPolicy
Deletes a single GatewaySecurityPolicy.
The async variant is NetworkSecurityClient::deleteGatewaySecurityPolicyAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\NetworkSecurity\V1\DeleteGatewaySecurityPolicyRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Returns | |
|---|---|
| Type | Description |
Google\ApiCore\OperationResponse<null> |
|
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\NetworkSecurity\V1\Client\NetworkSecurityClient;
use Google\Cloud\NetworkSecurity\V1\DeleteGatewaySecurityPolicyRequest;
use Google\Rpc\Status;
/**
* @param string $formattedName A name of the GatewaySecurityPolicy to delete. Must be in the
* format `projects/{project}/locations/{location}/gatewaySecurityPolicies/*`. Please see
* {@see NetworkSecurityClient::gatewaySecurityPolicyName()} for help formatting this field.
*/
function delete_gateway_security_policy_sample(string $formattedName): void
{
// Create a client.
$networkSecurityClient = new NetworkSecurityClient();
// Prepare the request message.
$request = (new DeleteGatewaySecurityPolicyRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $networkSecurityClient->deleteGatewaySecurityPolicy($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 = NetworkSecurityClient::gatewaySecurityPolicyName(
'[PROJECT]',
'[LOCATION]',
'[GATEWAY_SECURITY_POLICY]'
);
delete_gateway_security_policy_sample($formattedName);
}
deleteGatewaySecurityPolicyRule
Deletes a single GatewaySecurityPolicyRule.
The async variant is NetworkSecurityClient::deleteGatewaySecurityPolicyRuleAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\NetworkSecurity\V1\DeleteGatewaySecurityPolicyRuleRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Returns | |
|---|---|
| Type | Description |
Google\ApiCore\OperationResponse<null> |
|
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\NetworkSecurity\V1\Client\NetworkSecurityClient;
use Google\Cloud\NetworkSecurity\V1\DeleteGatewaySecurityPolicyRuleRequest;
use Google\Rpc\Status;
/**
* @param string $formattedName A name of the GatewaySecurityPolicyRule to delete. Must be in the
* format
* `projects/{project}/locations/{location}/gatewaySecurityPolicies/{gatewaySecurityPolicy}/rules/*`. Please see
* {@see NetworkSecurityClient::gatewaySecurityPolicyRuleName()} for help formatting this field.
*/
function delete_gateway_security_policy_rule_sample(string $formattedName): void
{
// Create a client.
$networkSecurityClient = new NetworkSecurityClient();
// Prepare the request message.
$request = (new DeleteGatewaySecurityPolicyRuleRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $networkSecurityClient->deleteGatewaySecurityPolicyRule($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 = NetworkSecurityClient::gatewaySecurityPolicyRuleName(
'[PROJECT]',
'[LOCATION]',
'[GATEWAY_SECURITY_POLICY]',
'[RULE]'
);
delete_gateway_security_policy_rule_sample($formattedName);
}
deleteServerTlsPolicy
Deletes a single ServerTlsPolicy.
The async variant is NetworkSecurityClient::deleteServerTlsPolicyAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\NetworkSecurity\V1\DeleteServerTlsPolicyRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Returns | |
|---|---|
| Type | Description |
Google\ApiCore\OperationResponse<null> |
|
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\NetworkSecurity\V1\Client\NetworkSecurityClient;
use Google\Cloud\NetworkSecurity\V1\DeleteServerTlsPolicyRequest;
use Google\Rpc\Status;
/**
* @param string $formattedName A name of the ServerTlsPolicy to delete. Must be in
* the format `projects/*/locations/{location}/serverTlsPolicies/*`. Please see
* {@see NetworkSecurityClient::serverTlsPolicyName()} for help formatting this field.
*/
function delete_server_tls_policy_sample(string $formattedName): void
{
// Create a client.
$networkSecurityClient = new NetworkSecurityClient();
// Prepare the request message.
$request = (new DeleteServerTlsPolicyRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $networkSecurityClient->deleteServerTlsPolicy($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 = NetworkSecurityClient::serverTlsPolicyName(
'[PROJECT]',
'[LOCATION]',
'[SERVER_TLS_POLICY]'
);
delete_server_tls_policy_sample($formattedName);
}
deleteTlsInspectionPolicy
Deletes a single TlsInspectionPolicy.
The async variant is NetworkSecurityClient::deleteTlsInspectionPolicyAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\NetworkSecurity\V1\DeleteTlsInspectionPolicyRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Returns | |
|---|---|
| Type | Description |
Google\ApiCore\OperationResponse<null> |
|
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\NetworkSecurity\V1\Client\NetworkSecurityClient;
use Google\Cloud\NetworkSecurity\V1\DeleteTlsInspectionPolicyRequest;
use Google\Rpc\Status;
/**
* @param string $formattedName A name of the TlsInspectionPolicy to delete. Must be in the
* format
* `projects/{project}/locations/{location}/tlsInspectionPolicies/{tls_inspection_policy}`. Please see
* {@see NetworkSecurityClient::tlsInspectionPolicyName()} for help formatting this field.
*/
function delete_tls_inspection_policy_sample(string $formattedName): void
{
// Create a client.
$networkSecurityClient = new NetworkSecurityClient();
// Prepare the request message.
$request = (new DeleteTlsInspectionPolicyRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $networkSecurityClient->deleteTlsInspectionPolicy($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 = NetworkSecurityClient::tlsInspectionPolicyName(
'[PROJECT]',
'[LOCATION]',
'[TLS_INSPECTION_POLICY]'
);
delete_tls_inspection_policy_sample($formattedName);
}
deleteUrlList
Deletes a single UrlList.
The async variant is NetworkSecurityClient::deleteUrlListAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\NetworkSecurity\V1\DeleteUrlListRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Returns | |
|---|---|
| Type | Description |
Google\ApiCore\OperationResponse<null> |
|
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\NetworkSecurity\V1\Client\NetworkSecurityClient;
use Google\Cloud\NetworkSecurity\V1\DeleteUrlListRequest;
use Google\Rpc\Status;
/**
* @param string $formattedName A name of the UrlList to delete. Must be in
* the format `projects/*/locations/{location}/urlLists/*`. Please see
* {@see NetworkSecurityClient::urlListName()} for help formatting this field.
*/
function delete_url_list_sample(string $formattedName): void
{
// Create a client.
$networkSecurityClient = new NetworkSecurityClient();
// Prepare the request message.
$request = (new DeleteUrlListRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $networkSecurityClient->deleteUrlList($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 = NetworkSecurityClient::urlListName('[PROJECT]', '[LOCATION]', '[URL_LIST]');
delete_url_list_sample($formattedName);
}
getAuthorizationPolicy
Gets details of a single AuthorizationPolicy.
The async variant is NetworkSecurityClient::getAuthorizationPolicyAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\NetworkSecurity\V1\GetAuthorizationPolicyRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Returns | |
|---|---|
| Type | Description |
Google\Cloud\NetworkSecurity\V1\AuthorizationPolicy |
|
use Google\ApiCore\ApiException;
use Google\Cloud\NetworkSecurity\V1\AuthorizationPolicy;
use Google\Cloud\NetworkSecurity\V1\Client\NetworkSecurityClient;
use Google\Cloud\NetworkSecurity\V1\GetAuthorizationPolicyRequest;
/**
* @param string $formattedName A name of the AuthorizationPolicy to get. Must be in the format
* `projects/{project}/locations/{location}/authorizationPolicies/*`. Please see
* {@see NetworkSecurityClient::authorizationPolicyName()} for help formatting this field.
*/
function get_authorization_policy_sample(string $formattedName): void
{
// Create a client.
$networkSecurityClient = new NetworkSecurityClient();
// Prepare the request message.
$request = (new GetAuthorizationPolicyRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
/** @var AuthorizationPolicy $response */
$response = $networkSecurityClient->getAuthorizationPolicy($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 = NetworkSecurityClient::authorizationPolicyName(
'[PROJECT]',
'[LOCATION]',
'[AUTHORIZATION_POLICY]'
);
get_authorization_policy_sample($formattedName);
}
getAuthzPolicy
Gets details of a single AuthzPolicy.
The async variant is NetworkSecurityClient::getAuthzPolicyAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\NetworkSecurity\V1\GetAuthzPolicyRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Returns | |
|---|---|
| Type | Description |
Google\Cloud\NetworkSecurity\V1\AuthzPolicy |
|
use Google\ApiCore\ApiException;
use Google\Cloud\NetworkSecurity\V1\AuthzPolicy;
use Google\Cloud\NetworkSecurity\V1\Client\NetworkSecurityClient;
use Google\Cloud\NetworkSecurity\V1\GetAuthzPolicyRequest;
/**
* @param string $formattedName A name of the `AuthzPolicy` resource to get. Must be in the
* format
* `projects/{project}/locations/{location}/authzPolicies/{authz_policy}`. Please see
* {@see NetworkSecurityClient::authzPolicyName()} for help formatting this field.
*/
function get_authz_policy_sample(string $formattedName): void
{
// Create a client.
$networkSecurityClient = new NetworkSecurityClient();
// Prepare the request message.
$request = (new GetAuthzPolicyRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
/** @var AuthzPolicy $response */
$response = $networkSecurityClient->getAuthzPolicy($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 = NetworkSecurityClient::authzPolicyName(
'[PROJECT]',
'[LOCATION]',
'[AUTHZ_POLICY]'
);
get_authz_policy_sample($formattedName);
}
getBackendAuthenticationConfig
Gets details of a single BackendAuthenticationConfig to BackendAuthenticationConfig.
The async variant is NetworkSecurityClient::getBackendAuthenticationConfigAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\NetworkSecurity\V1\GetBackendAuthenticationConfigRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Returns | |
|---|---|
| Type | Description |
Google\Cloud\NetworkSecurity\V1\BackendAuthenticationConfig |
|
use Google\ApiCore\ApiException;
use Google\Cloud\NetworkSecurity\V1\BackendAuthenticationConfig;
use Google\Cloud\NetworkSecurity\V1\Client\NetworkSecurityClient;
use Google\Cloud\NetworkSecurity\V1\GetBackendAuthenticationConfigRequest;
/**
* @param string $formattedName A name of the BackendAuthenticationConfig to get. Must be in the
* format `projects/*/locations/{location}/backendAuthenticationConfigs/*`. Please see
* {@see NetworkSecurityClient::backendAuthenticationConfigName()} for help formatting this field.
*/
function get_backend_authentication_config_sample(string $formattedName): void
{
// Create a client.
$networkSecurityClient = new NetworkSecurityClient();
// Prepare the request message.
$request = (new GetBackendAuthenticationConfigRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
/** @var BackendAuthenticationConfig $response */
$response = $networkSecurityClient->getBackendAuthenticationConfig($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 = NetworkSecurityClient::backendAuthenticationConfigName(
'[PROJECT]',
'[LOCATION]',
'[BACKEND_AUTHENTICATION_CONFIG]'
);
get_backend_authentication_config_sample($formattedName);
}
getClientTlsPolicy
Gets details of a single ClientTlsPolicy.
The async variant is NetworkSecurityClient::getClientTlsPolicyAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\NetworkSecurity\V1\GetClientTlsPolicyRequest
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 |
lsPolicy |
|
use Google\ApiCore\ApiException;
use Google\Cloud\NetworkSecurity\V1\ClientTlsPolicy;
use Google\Cloud\NetworkSecurity\V1\Client\NetworkSecurityClient;
use Google\Cloud\NetworkSecurity\V1\GetClientTlsPolicyRequest;
/**
* @param string $formattedName A name of the ClientTlsPolicy to get. Must be in the format
* `projects/*/locations/{location}/clientTlsPolicies/*`. Please see
* {@see NetworkSecurityClient::clientTlsPolicyName()} for help formatting this field.
*/
function get_client_tls_policy_sample(string $formattedName): void
{
// Create a client.
$networkSecurityClient = new NetworkSecurityClient();
// Prepare the request message.
$request = (new GetClientTlsPolicyRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
/** @var ClientTlsPolicy $response */
$response = $networkSecurityClient->getClientTlsPolicy($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 = NetworkSecurityClient::clientTlsPolicyName(
'[PROJECT]',
'[LOCATION]',
'[CLIENT_TLS_POLICY]'
);
get_client_tls_policy_sample($formattedName);
}
getGatewaySecurityPolicy
Gets details of a single GatewaySecurityPolicy.
The async variant is NetworkSecurityClient::getGatewaySecurityPolicyAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\NetworkSecurity\V1\GetGatewaySecurityPolicyRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Returns | |
|---|---|
| Type | Description |
Google\Cloud\NetworkSecurity\V1\GatewaySecurityPolicy |
|
use Google\ApiCore\ApiException;
use Google\Cloud\NetworkSecurity\V1\Client\NetworkSecurityClient;
use Google\Cloud\NetworkSecurity\V1\GatewaySecurityPolicy;
use Google\Cloud\NetworkSecurity\V1\GetGatewaySecurityPolicyRequest;
/**
* @param string $formattedName A name of the GatewaySecurityPolicy to get. Must be in the format
* `projects/{project}/locations/{location}/gatewaySecurityPolicies/*`. Please see
* {@see NetworkSecurityClient::gatewaySecurityPolicyName()} for help formatting this field.
*/
function get_gateway_security_policy_sample(string $formattedName): void
{
// Create a client.
$networkSecurityClient = new NetworkSecurityClient();
// Prepare the request message.
$request = (new GetGatewaySecurityPolicyRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
/** @var GatewaySecurityPolicy $response */
$response = $networkSecurityClient->getGatewaySecurityPolicy($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 = NetworkSecurityClient::gatewaySecurityPolicyName(
'[PROJECT]',
'[LOCATION]',
'[GATEWAY_SECURITY_POLICY]'
);
get_gateway_security_policy_sample($formattedName);
}
getGatewaySecurityPolicyRule
Gets details of a single GatewaySecurityPolicyRule.
The async variant is NetworkSecurityClient::getGatewaySecurityPolicyRuleAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\NetworkSecurity\V1\GetGatewaySecurityPolicyRuleRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Returns | |
|---|---|
| Type | Description |
Google\Cloud\NetworkSecurity\V1\GatewaySecurityPolicyRule |
|
use Google\ApiCore\ApiException;
use Google\Cloud\NetworkSecurity\V1\Client\NetworkSecurityClient;
use Google\Cloud\NetworkSecurity\V1\GatewaySecurityPolicyRule;
use Google\Cloud\NetworkSecurity\V1\GetGatewaySecurityPolicyRuleRequest;
/**
* @param string $formattedName The name of the GatewaySecurityPolicyRule to retrieve.
* Format:
* projects/{project}/location/{location}/gatewaySecurityPolicies/*/rules/*
* Please see {@see NetworkSecurityClient::gatewaySecurityPolicyRuleName()} for help formatting this field.
*/
function get_gateway_security_policy_rule_sample(string $formattedName): void
{
// Create a client.
$networkSecurityClient = new NetworkSecurityClient();
// Prepare the request message.
$request = (new GetGatewaySecurityPolicyRuleRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
/** @var GatewaySecurityPolicyRule $response */
$response = $networkSecurityClient->getGatewaySecurityPolicyRule($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 = NetworkSecurityClient::gatewaySecurityPolicyRuleName(
'[PROJECT]',
'[LOCATION]',
'[GATEWAY_SECURITY_POLICY]',
'[RULE]'
);
get_gateway_security_policy_rule_sample($formattedName);
}
getServerTlsPolicy
Gets details of a single ServerTlsPolicy.
The async variant is NetworkSecurityClient::getServerTlsPolicyAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\NetworkSecurity\V1\GetServerTlsPolicyRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Returns | |
|---|---|
| Type | Description |
Google\Cloud\NetworkSecurity\V1\ServerTlsPolicy |
|
use Google\ApiCore\ApiException;
use Google\Cloud\NetworkSecurity\V1\Client\NetworkSecurityClient;
use Google\Cloud\NetworkSecurity\V1\GetServerTlsPolicyRequest;
use Google\Cloud\NetworkSecurity\V1\ServerTlsPolicy;
/**
* @param string $formattedName A name of the ServerTlsPolicy to get. Must be in the format
* `projects/*/locations/{location}/serverTlsPolicies/*`. Please see
* {@see NetworkSecurityClient::serverTlsPolicyName()} for help formatting this field.
*/
function get_server_tls_policy_sample(string $formattedName): void
{
// Create a client.
$networkSecurityClient = new NetworkSecurityClient();
// Prepare the request message.
$request = (new GetServerTlsPolicyRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
/** @var ServerTlsPolicy $response */
$response = $networkSecurityClient->getServerTlsPolicy($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 = NetworkSecurityClient::serverTlsPolicyName(
'[PROJECT]',
'[LOCATION]',
'[SERVER_TLS_POLICY]'
);
get_server_tls_policy_sample($formattedName);
}
getTlsInspectionPolicy
Gets details of a single TlsInspectionPolicy.
The async variant is NetworkSecurityClient::getTlsInspectionPolicyAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\NetworkSecurity\V1\GetTlsInspectionPolicyRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Returns | |
|---|---|
| Type | Description |
Google\Cloud\NetworkSecurity\V1\TlsInspectionPolicy |
|
use Google\ApiCore\ApiException;
use Google\Cloud\NetworkSecurity\V1\Client\NetworkSecurityClient;
use Google\Cloud\NetworkSecurity\V1\GetTlsInspectionPolicyRequest;
use Google\Cloud\NetworkSecurity\V1\TlsInspectionPolicy;
/**
* @param string $formattedName A name of the TlsInspectionPolicy to get. Must be in the format
* `projects/{project}/locations/{location}/tlsInspectionPolicies/{tls_inspection_policy}`. Please see
* {@see NetworkSecurityClient::tlsInspectionPolicyName()} for help formatting this field.
*/
function get_tls_inspection_policy_sample(string $formattedName): void
{
// Create a client.
$networkSecurityClient = new NetworkSecurityClient();
// Prepare the request message.
$request = (new GetTlsInspectionPolicyRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
/** @var TlsInspectionPolicy $response */
$response = $networkSecurityClient->getTlsInspectionPolicy($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 = NetworkSecurityClient::tlsInspectionPolicyName(
'[PROJECT]',
'[LOCATION]',
'[TLS_INSPECTION_POLICY]'
);
get_tls_inspection_policy_sample($formattedName);
}
getUrlList
Gets details of a single UrlList.
The async variant is NetworkSecurityClient::getUrlListAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\NetworkSecurity\V1\GetUrlListRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Returns | |
|---|---|
| Type | Description |
Google\Cloud\NetworkSecurity\V1\UrlList |
|
use Google\ApiCore\ApiException;
use Google\Cloud\NetworkSecurity\V1\Client\NetworkSecurityClient;
use Google\Cloud\NetworkSecurity\V1\GetUrlListRequest;
use Google\Cloud\NetworkSecurity\V1\UrlList;
/**
* @param string $formattedName A name of the UrlList to get. Must be in the format
* `projects/*/locations/{location}/urlLists/*`. Please see
* {@see NetworkSecurityClient::urlListName()} for help formatting this field.
*/
function get_url_list_sample(string $formattedName): void
{
// Create a client.
$networkSecurityClient = new NetworkSecurityClient();
// Prepare the request message.
$request = (new GetUrlListRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
/** @var UrlList $response */
$response = $networkSecurityClient->getUrlList($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 = NetworkSecurityClient::urlListName('[PROJECT]', '[LOCATION]', '[URL_LIST]');
get_url_list_sample($formattedName);
}
listAuthorizationPolicies
Lists AuthorizationPolicies in a given project and location.
The async variant is NetworkSecurityClient::listAuthorizationPoliciesAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\NetworkSecurity\V1\ListAuthorizationPoliciesRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Returns | |
|---|---|
| Type | Description |
Google\ApiCore\PagedListResponse |
|
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\NetworkSecurity\V1\AuthorizationPolicy;
use Google\Cloud\NetworkSecurity\V1\Client\NetworkSecurityClient;
use Google\Cloud\NetworkSecurity\V1\ListAuthorizationPoliciesRequest;
/**
* @param string $formattedParent The project and location from which the AuthorizationPolicies
* should be listed, specified in the format
* `projects/{project}/locations/{location}`. Please see
* {@see NetworkSecurityClient::locationName()} for help formatting this field.
*/
function list_authorization_policies_sample(string $formattedParent): void
{
// Create a client.
$networkSecurityClient = new NetworkSecurityClient();
// Prepare the request message.
$request = (new ListAuthorizationPoliciesRequest())
->setParent($formattedParent);
// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $networkSecurityClient->listAuthorizationPolicies($request);
/** @var AuthorizationPolicy $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 = NetworkSecurityClient::locationName('[PROJECT]', '[LOCATION]');
list_authorization_policies_sample($formattedParent);
}
listAuthzPolicies
Lists AuthzPolicies in a given project and location.
The async variant is NetworkSecurityClient::listAuthzPoliciesAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\NetworkSecurity\V1\ListAuthzPoliciesRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Returns | |
|---|---|
| Type | Description |
Google\ApiCore\PagedListResponse |
|
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\NetworkSecurity\V1\AuthzPolicy;
use Google\Cloud\NetworkSecurity\V1\Client\NetworkSecurityClient;
use Google\Cloud\NetworkSecurity\V1\ListAuthzPoliciesRequest;
/**
* @param string $formattedParent The project and location from which the `AuthzPolicy` resources
* are listed, specified in the following format:
* `projects/{project}/locations/{location}`. Please see
* {@see NetworkSecurityClient::locationName()} for help formatting this field.
*/
function list_authz_policies_sample(string $formattedParent): void
{
// Create a client.
$networkSecurityClient = new NetworkSecurityClient();
// Prepare the request message.
$request = (new ListAuthzPoliciesRequest())
->setParent($formattedParent);
// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $networkSecurityClient->listAuthzPolicies($request);
/** @var AuthzPolicy $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 = NetworkSecurityClient::locationName('[PROJECT]', '[LOCATION]');
list_authz_policies_sample($formattedParent);
}
listBackendAuthenticationConfigs
Lists BackendAuthenticationConfigs in a given project and location.
The async variant is NetworkSecurityClient::listBackendAuthenticationConfigsAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\NetworkSecurity\V1\ListBackendAuthenticationConfigsRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Returns | |
|---|---|
| Type | Description |
Google\ApiCore\PagedListResponse |
|
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\NetworkSecurity\V1\BackendAuthenticationConfig;
use Google\Cloud\NetworkSecurity\V1\Client\NetworkSecurityClient;
use Google\Cloud\NetworkSecurity\V1\ListBackendAuthenticationConfigsRequest;
/**
* @param string $formattedParent The project and location from which the
* BackendAuthenticationConfigs should be listed, specified in the format
* `projects/*/locations/{location}`. Please see
* {@see NetworkSecurityClient::locationName()} for help formatting this field.
*/
function list_backend_authentication_configs_sample(string $formattedParent): void
{
// Create a client.
$networkSecurityClient = new NetworkSecurityClient();
// Prepare the request message.
$request = (new ListBackendAuthenticationConfigsRequest())
->setParent($formattedParent);
// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $networkSecurityClient->listBackendAuthenticationConfigs($request);
/** @var BackendAuthenticationConfig $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 = NetworkSecurityClient::locationName('[PROJECT]', '[LOCATION]');
list_backend_authentication_configs_sample($formattedParent);
}
listClientTlsPolicies
Lists ClientTlsPolicies in a given project and location.
The async variant is NetworkSecurityClient::listClientTlsPoliciesAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\NetworkSecurity\V1\ListClientTlsPoliciesRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Returns | |
|---|---|
| Type | Description |
Google\ApiCore\PagedListResponse |
|
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\NetworkSecurity\V1\ClientTlsPolicy;
use Google\Cloud\NetworkSecurity\V1\Client\NetworkSecurityClient;
use Google\Cloud\NetworkSecurity\V1\ListClientTlsPoliciesRequest;
/**
* @param string $formattedParent The project and location from which the ClientTlsPolicies should
* be listed, specified in the format `projects/*/locations/{location}`. Please see
* {@see NetworkSecurityClient::locationName()} for help formatting this field.
*/
function list_client_tls_policies_sample(string $formattedParent): void
{
// Create a client.
$networkSecurityClient = new NetworkSecurityClient();
// Prepare the request message.
$request = (new ListClientTlsPoliciesRequest())
->setParent($formattedParent);
// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $networkSecurityClient->listClientTlsPolicies($request);
/** @var ClientTlsPolicy $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 = NetworkSecurityClient::locationName('[PROJECT]', '[LOCATION]');
list_client_tls_policies_sample($formattedParent);
}
listGatewaySecurityPolicies
Lists GatewaySecurityPolicies in a given project and location.
The async variant is NetworkSecurityClient::listGatewaySecurityPoliciesAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\NetworkSecurity\V1\ListGatewaySecurityPoliciesRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Returns | |
|---|---|
| Type | Description |
Google\ApiCore\PagedListResponse |
|
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\NetworkSecurity\V1\Client\NetworkSecurityClient;
use Google\Cloud\NetworkSecurity\V1\GatewaySecurityPolicy;
use Google\Cloud\NetworkSecurity\V1\ListGatewaySecurityPoliciesRequest;
/**
* @param string $formattedParent The project and location from which the GatewaySecurityPolicies
* should be listed, specified in the format
* `projects/{project}/locations/{location}`. Please see
* {@see NetworkSecurityClient::locationName()} for help formatting this field.
*/
function list_gateway_security_policies_sample(string $formattedParent): void
{
// Create a client.
$networkSecurityClient = new NetworkSecurityClient();
// Prepare the request message.
$request = (new ListGatewaySecurityPoliciesRequest())
->setParent($formattedParent);
// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $networkSecurityClient->listGatewaySecurityPolicies($request);
/** @var GatewaySecurityPolicy $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 = NetworkSecurityClient::locationName('[PROJECT]', '[LOCATION]');
list_gateway_security_policies_sample($formattedParent);
}
listGatewaySecurityPolicyRules
Lists GatewaySecurityPolicyRules in a given project and location.
The async variant is NetworkSecurityClient::listGatewaySecurityPolicyRulesAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\NetworkSecurity\V1\ListGatewaySecurityPolicyRulesRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Returns | |
|---|---|
| Type | Description |
Google\ApiCore\PagedListResponse |
|
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\NetworkSecurity\V1\Client\NetworkSecurityClient;
use Google\Cloud\NetworkSecurity\V1\GatewaySecurityPolicyRule;
use Google\Cloud\NetworkSecurity\V1\ListGatewaySecurityPolicyRulesRequest;
/**
* @param string $formattedParent The project, location and GatewaySecurityPolicy from which the
* GatewaySecurityPolicyRules should be listed, specified in the format
* `projects/{project}/locations/{location}/gatewaySecurityPolicies/{gatewaySecurityPolicy}`. Please see
* {@see NetworkSecurityClient::gatewaySecurityPolicyName()} for help formatting this field.
*/
function list_gateway_security_policy_rules_sample(string $formattedParent): void
{
// Create a client.
$networkSecurityClient = new NetworkSecurityClient();
// Prepare the request message.
$request = (new ListGatewaySecurityPolicyRulesRequest())
->setParent($formattedParent);
// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $networkSecurityClient->listGatewaySecurityPolicyRules($request);
/** @var GatewaySecurityPolicyRule $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 = NetworkSecurityClient::gatewaySecurityPolicyName(
'[PROJECT]',
'[LOCATION]',
'[GATEWAY_SECURITY_POLICY]'
);
list_gateway_security_policy_rules_sample($formattedParent);
}
listServerTlsPolicies
Lists ServerTlsPolicies in a given project and location.
The async variant is NetworkSecurityClient::listServerTlsPoliciesAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\NetworkSecurity\V1\ListServerTlsPoliciesRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Returns | |
|---|---|
| Type | Description |
Google\ApiCore\PagedListResponse |
|
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\NetworkSecurity\V1\Client\NetworkSecurityClient;
use Google\Cloud\NetworkSecurity\V1\ListServerTlsPoliciesRequest;
use Google\Cloud\NetworkSecurity\V1\ServerTlsPolicy;
/**
* @param string $formattedParent The project and location from which the ServerTlsPolicies should
* be listed, specified in the format `projects/*/locations/{location}`. Please see
* {@see NetworkSecurityClient::locationName()} for help formatting this field.
*/
function list_server_tls_policies_sample(string $formattedParent): void
{
// Create a client.
$networkSecurityClient = new NetworkSecurityClient();
// Prepare the request message.
$request = (new ListServerTlsPoliciesRequest())
->setParent($formattedParent);
// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $networkSecurityClient->listServerTlsPolicies($request);
/** @var ServerTlsPolicy $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 = NetworkSecurityClient::locationName('[PROJECT]', '[LOCATION]');
list_server_tls_policies_sample($formattedParent);
}
listTlsInspectionPolicies
Lists TlsInspectionPolicies in a given project and location.
The async variant is NetworkSecurityClient::listTlsInspectionPoliciesAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\NetworkSecurity\V1\ListTlsInspectionPoliciesRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Returns | |
|---|---|
| Type | Description |
Google\ApiCore\PagedListResponse |
|
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\NetworkSecurity\V1\Client\NetworkSecurityClient;
use Google\Cloud\NetworkSecurity\V1\ListTlsInspectionPoliciesRequest;
use Google\Cloud\NetworkSecurity\V1\TlsInspectionPolicy;
/**
* @param string $formattedParent The project and location from which the TlsInspectionPolicies
* should be listed, specified in the format
* `projects/{project}/locations/{location}`. Please see
* {@see NetworkSecurityClient::locationName()} for help formatting this field.
*/
function list_tls_inspection_policies_sample(string $formattedParent): void
{
// Create a client.
$networkSecurityClient = new NetworkSecurityClient();
// Prepare the request message.
$request = (new ListTlsInspectionPoliciesRequest())
->setParent($formattedParent);
// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $networkSecurityClient->listTlsInspectionPolicies($request);
/** @var TlsInspectionPolicy $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 = NetworkSecurityClient::locationName('[PROJECT]', '[LOCATION]');
list_tls_inspection_policies_sample($formattedParent);
}
listUrlLists
Lists UrlLists in a given project and location.
The async variant is NetworkSecurityClient::listUrlListsAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\NetworkSecurity\V1\ListUrlListsRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Returns | |
|---|---|
| Type | Description |
Google\ApiCore\PagedListResponse |
|
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\NetworkSecurity\V1\Client\NetworkSecurityClient;
use Google\Cloud\NetworkSecurity\V1\ListUrlListsRequest;
use Google\Cloud\NetworkSecurity\V1\UrlList;
/**
* @param string $formattedParent The project and location from which the UrlLists should
* be listed, specified in the format
* `projects/{project}/locations/{location}`. Please see
* {@see NetworkSecurityClient::locationName()} for help formatting this field.
*/
function list_url_lists_sample(string $formattedParent): void
{
// Create a client.
$networkSecurityClient = new NetworkSecurityClient();
// Prepare the request message.
$request = (new ListUrlListsRequest())
->setParent($formattedParent);
// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $networkSecurityClient->listUrlLists($request);
/** @var UrlList $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 = NetworkSecurityClient::locationName('[PROJECT]', '[LOCATION]');
list_url_lists_sample($formattedParent);
}
updateAuthorizationPolicy
Updates the parameters of a single AuthorizationPolicy.
The async variant is NetworkSecurityClient::updateAuthorizationPolicyAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\NetworkSecurity\V1\UpdateAuthorizationPolicyRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Returns | |
|---|---|
| Type | Description |
Google\ApiCore\OperationResponse<Google\Cloud\NetworkSecurity\V1\AuthorizationPolicy> |
|
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\NetworkSecurity\V1\AuthorizationPolicy;
use Google\Cloud\NetworkSecurity\V1\AuthorizationPolicy\Action;
use Google\Cloud\NetworkSecurity\V1\Client\NetworkSecurityClient;
use Google\Cloud\NetworkSecurity\V1\UpdateAuthorizationPolicyRequest;
use Google\Rpc\Status;
/**
* @param string $authorizationPolicyName Name of the AuthorizationPolicy resource. It matches pattern
* `projects/{project}/locations/{location}/authorizationPolicies/<authorization_policy>`.
* @param int $authorizationPolicyAction The action to take when a rule match is found. Possible values
* are "ALLOW" or "DENY".
*/
function update_authorization_policy_sample(
string $authorizationPolicyName,
int $authorizationPolicyAction
): void {
// Create a client.
$networkSecurityClient = new NetworkSecurityClient();
// Prepare the request message.
$authorizationPolicy = (new AuthorizationPolicy())
->setName($authorizationPolicyName)
->setAction($authorizationPolicyAction);
$request = (new UpdateAuthorizationPolicyRequest())
->setAuthorizationPolicy($authorizationPolicy);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $networkSecurityClient->updateAuthorizationPolicy($request);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
/** @var AuthorizationPolicy $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
{
$authorizationPolicyName = '[NAME]';
$authorizationPolicyAction = Action::ACTION_UNSPECIFIED;
update_authorization_policy_sample($authorizationPolicyName, $authorizationPolicyAction);
}
updateAuthzPolicy
Updates the parameters of a single AuthzPolicy.
The async variant is NetworkSecurityClient::updateAuthzPolicyAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\NetworkSecurity\V1\UpdateAuthzPolicyRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Returns | |
|---|---|
| Type | Description |
Google\ApiCore\OperationResponse<Google\Cloud\NetworkSecurity\V1\AuthzPolicy> |
|
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\NetworkSecurity\V1\AuthzPolicy;
use Google\Cloud\NetworkSecurity\V1\AuthzPolicy\AuthzAction;
use Google\Cloud\NetworkSecurity\V1\AuthzPolicy\Target;
use Google\Cloud\NetworkSecurity\V1\Client\NetworkSecurityClient;
use Google\Cloud\NetworkSecurity\V1\UpdateAuthzPolicyRequest;
use Google\Protobuf\FieldMask;
use Google\Rpc\Status;
/**
* @param string $authzPolicyName Identifier. Name of the `AuthzPolicy` resource in the following
* format:
* `projects/{project}/locations/{location}/authzPolicies/{authz_policy}`.
* @param string $authzPolicyTargetResourcesElement A list of references to the Forwarding Rules on which this
* policy will be applied.
* @param int $authzPolicyAction Can be one of `ALLOW`, `DENY`, `CUSTOM`.
*
* When the action is `CUSTOM`, `customProvider` must be specified.
*
* When the action is `ALLOW`, only requests matching the policy will
* be allowed.
*
* When the action is `DENY`, only requests matching the policy will be
* denied.
*
* When a request arrives, the policies are evaluated in the following order:
*
* 1. If there is a `CUSTOM` policy that matches the request, the `CUSTOM`
* policy is evaluated using the custom authorization providers and the
* request is denied if the provider rejects the request.
*
* 2. If there are any `DENY` policies that match the request, the request
* is denied.
*
* 3. If there are no `ALLOW` policies for the resource or if any of the
* `ALLOW` policies match the request, the request is allowed.
*
* 4. Else the request is denied by default if none of the configured
* AuthzPolicies with `ALLOW` action match the request.
*/
function update_authz_policy_sample(
string $authzPolicyName,
string $authzPolicyTargetResourcesElement,
int $authzPolicyAction
): void {
// Create a client.
$networkSecurityClient = new NetworkSecurityClient();
// Prepare the request message.
$updateMask = new FieldMask();
$authzPolicyTargetResources = [$authzPolicyTargetResourcesElement,];
$authzPolicyTarget = (new Target())
->setResources($authzPolicyTargetResources);
$authzPolicy = (new AuthzPolicy())
->setName($authzPolicyName)
->setTarget($authzPolicyTarget)
->setAction($authzPolicyAction);
$request = (new UpdateAuthzPolicyRequest())
->setUpdateMask($updateMask)
->setAuthzPolicy($authzPolicy);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $networkSecurityClient->updateAuthzPolicy($request);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
/** @var AuthzPolicy $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
{
$authzPolicyName = '[NAME]';
$authzPolicyTargetResourcesElement = '[RESOURCES]';
$authzPolicyAction = AuthzAction::AUTHZ_ACTION_UNSPECIFIED;
update_authz_policy_sample(
$authzPolicyName,
$authzPolicyTargetResourcesElement,
$authzPolicyAction
);
}
updateBackendAuthenticationConfig
Updates the parameters of a single BackendAuthenticationConfig to BackendAuthenticationConfig.
The async variant is NetworkSecurityClient::updateBackendAuthenticationConfigAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\NetworkSecurity\V1\UpdateBackendAuthenticationConfigRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Returns | |
|---|---|
| Type | Description |
Google\ApiCore\OperationResponse<Google\Cloud\NetworkSecurity\V1\BackendAuthenticationConfig> |
|
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\NetworkSecurity\V1\BackendAuthenticationConfig;
use Google\Cloud\NetworkSecurity\V1\Client\NetworkSecurityClient;
use Google\Cloud\NetworkSecurity\V1\UpdateBackendAuthenticationConfigRequest;
use Google\Rpc\Status;
/**
* @param string $backendAuthenticationConfigName Name of the BackendAuthenticationConfig resource. It matches the
* pattern
* `projects/*/locations/{location}/backendAuthenticationConfigs/{backend_authentication_config}`
*/
function update_backend_authentication_config_sample(
string $backendAuthenticationConfigName
): void {
// Create a client.
$networkSecurityClient = new NetworkSecurityClient();
// Prepare the request message.
$backendAuthenticationConfig = (new BackendAuthenticationConfig())
->setName($backendAuthenticationConfigName);
$request = (new UpdateBackendAuthenticationConfigRequest())
->setBackendAuthenticationConfig($backendAuthenticationConfig);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $networkSecurityClient->updateBackendAuthenticationConfig($request);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
/** @var BackendAuthenticationConfig $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
{
$backendAuthenticationConfigName = '[NAME]';
update_backend_authentication_config_sample($backendAuthenticationConfigName);
}
updateClientTlsPolicy
Updates the parameters of a single ClientTlsPolicy.
The async variant is NetworkSecurityClient::updateClientTlsPolicyAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\NetworkSecurity\V1\UpdateClientTlsPolicyRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Returns | |
|---|---|
| Type | Description |
Google\ApiCore\OperationResponse<lsPolicy> |
|
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\NetworkSecurity\V1\ClientTlsPolicy;
use Google\Cloud\NetworkSecurity\V1\Client\NetworkSecurityClient;
use Google\Cloud\NetworkSecurity\V1\UpdateClientTlsPolicyRequest;
use Google\Rpc\Status;
/**
* @param string $clientTlsPolicyName Name of the ClientTlsPolicy resource. It matches the pattern
* `projects/{project}/locations/{location}/clientTlsPolicies/{client_tls_policy}`
*/
function update_client_tls_policy_sample(string $clientTlsPolicyName): void
{
// Create a client.
$networkSecurityClient = new NetworkSecurityClient();
// Prepare the request message.
$clientTlsPolicy = (new ClientTlsPolicy())
->setName($clientTlsPolicyName);
$request = (new UpdateClientTlsPolicyRequest())
->setClientTlsPolicy($clientTlsPolicy);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $networkSecurityClient->updateClientTlsPolicy($request);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
/** @var ClientTlsPolicy $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
{
$clientTlsPolicyName = '[NAME]';
update_client_tls_policy_sample($clientTlsPolicyName);
}
updateGatewaySecurityPolicy
Updates the parameters of a single GatewaySecurityPolicy.
The async variant is NetworkSecurityClient::updateGatewaySecurityPolicyAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\NetworkSecurity\V1\UpdateGatewaySecurityPolicyRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Returns | |
|---|---|
| Type | Description |
Google\ApiCore\OperationResponse<Google\Cloud\NetworkSecurity\V1\GatewaySecurityPolicy> |
|
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\NetworkSecurity\V1\Client\NetworkSecurityClient;
use Google\Cloud\NetworkSecurity\V1\GatewaySecurityPolicy;
use Google\Cloud\NetworkSecurity\V1\UpdateGatewaySecurityPolicyRequest;
use Google\Rpc\Status;
/**
* @param string $gatewaySecurityPolicyName Name of the resource. Name is of the form
* projects/{project}/locations/{location}/gatewaySecurityPolicies/{gateway_security_policy}
* gateway_security_policy should match the
* pattern:(^[a-z]([a-z0-9-]{0,61}[a-z0-9])?$).
*/
function update_gateway_security_policy_sample(string $gatewaySecurityPolicyName): void
{
// Create a client.
$networkSecurityClient = new NetworkSecurityClient();
// Prepare the request message.
$gatewaySecurityPolicy = (new GatewaySecurityPolicy())
->setName($gatewaySecurityPolicyName);
$request = (new UpdateGatewaySecurityPolicyRequest())
->setGatewaySecurityPolicy($gatewaySecurityPolicy);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $networkSecurityClient->updateGatewaySecurityPolicy($request);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
/** @var GatewaySecurityPolicy $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
{
$gatewaySecurityPolicyName = '[NAME]';
update_gateway_security_policy_sample($gatewaySecurityPolicyName);
}
updateGatewaySecurityPolicyRule
Updates the parameters of a single GatewaySecurityPolicyRule.
The async variant is NetworkSecurityClient::updateGatewaySecurityPolicyRuleAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\NetworkSecurity\V1\UpdateGatewaySecurityPolicyRuleRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Returns | |
|---|---|
| Type | Description |
Google\ApiCore\OperationResponse<Google\Cloud\NetworkSecurity\V1\GatewaySecurityPolicyRule> |
|
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\NetworkSecurity\V1\Client\NetworkSecurityClient;
use Google\Cloud\NetworkSecurity\V1\GatewaySecurityPolicyRule;
use Google\Cloud\NetworkSecurity\V1\GatewaySecurityPolicyRule\BasicProfile;
use Google\Cloud\NetworkSecurity\V1\UpdateGatewaySecurityPolicyRuleRequest;
use Google\Rpc\Status;
/**
* @param int $gatewaySecurityPolicyRuleBasicProfile Profile which tells what the primitive action should be.
* @param string $gatewaySecurityPolicyRuleName Immutable. Name of the resource. ame is the full resource name so
* projects/{project}/locations/{location}/gatewaySecurityPolicies/{gateway_security_policy}/rules/{rule}
* rule should match the
* pattern: (^[a-z]([a-z0-9-]{0,61}[a-z0-9])?$).
* @param bool $gatewaySecurityPolicyRuleEnabled Whether the rule is enforced.
* @param int $gatewaySecurityPolicyRulePriority Priority of the rule.
* Lower number corresponds to higher precedence.
* @param string $gatewaySecurityPolicyRuleSessionMatcher CEL expression for matching on session criteria.
*/
function update_gateway_security_policy_rule_sample(
int $gatewaySecurityPolicyRuleBasicProfile,
string $gatewaySecurityPolicyRuleName,
bool $gatewaySecurityPolicyRuleEnabled,
int $gatewaySecurityPolicyRulePriority,
string $gatewaySecurityPolicyRuleSessionMatcher
): void {
// Create a client.
$networkSecurityClient = new NetworkSecurityClient();
// Prepare the request message.
$gatewaySecurityPolicyRule = (new GatewaySecurityPolicyRule())
->setBasicProfile($gatewaySecurityPolicyRuleBasicProfile)
->setName($gatewaySecurityPolicyRuleName)
->setEnabled($gatewaySecurityPolicyRuleEnabled)
->setPriority($gatewaySecurityPolicyRulePriority)
->setSessionMatcher($gatewaySecurityPolicyRuleSessionMatcher);
$request = (new UpdateGatewaySecurityPolicyRuleRequest())
->setGatewaySecurityPolicyRule($gatewaySecurityPolicyRule);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $networkSecurityClient->updateGatewaySecurityPolicyRule($request);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
/** @var GatewaySecurityPolicyRule $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
{
$gatewaySecurityPolicyRuleBasicProfile = BasicProfile::BASIC_PROFILE_UNSPECIFIED;
$gatewaySecurityPolicyRuleName = '[NAME]';
$gatewaySecurityPolicyRuleEnabled = false;
$gatewaySecurityPolicyRulePriority = 0;
$gatewaySecurityPolicyRuleSessionMatcher = '[SESSION_MATCHER]';
update_gateway_security_policy_rule_sample(
$gatewaySecurityPolicyRuleBasicProfile,
$gatewaySecurityPolicyRuleName,
$gatewaySecurityPolicyRuleEnabled,
$gatewaySecurityPolicyRulePriority,
$gatewaySecurityPolicyRuleSessionMatcher
);
}
updateServerTlsPolicy
Updates the parameters of a single ServerTlsPolicy.
The async variant is NetworkSecurityClient::updateServerTlsPolicyAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\NetworkSecurity\V1\UpdateServerTlsPolicyRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Returns | |
|---|---|
| Type | Description |
Google\ApiCore\OperationResponse<Google\Cloud\NetworkSecurity\V1\ServerTlsPolicy> |
|
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\NetworkSecurity\V1\Client\NetworkSecurityClient;
use Google\Cloud\NetworkSecurity\V1\ServerTlsPolicy;
use Google\Cloud\NetworkSecurity\V1\UpdateServerTlsPolicyRequest;
use Google\Rpc\Status;
/**
* @param string $serverTlsPolicyName Name of the ServerTlsPolicy resource. It matches the pattern
* `projects/*/locations/{location}/serverTlsPolicies/{server_tls_policy}`
*/
function update_server_tls_policy_sample(string $serverTlsPolicyName): void
{
// Create a client.
$networkSecurityClient = new NetworkSecurityClient();
// Prepare the request message.
$serverTlsPolicy = (new ServerTlsPolicy())
->setName($serverTlsPolicyName);
$request = (new UpdateServerTlsPolicyRequest())
->setServerTlsPolicy($serverTlsPolicy);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $networkSecurityClient->updateServerTlsPolicy($request);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
/** @var ServerTlsPolicy $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
{
$serverTlsPolicyName = '[NAME]';
update_server_tls_policy_sample($serverTlsPolicyName);
}
updateTlsInspectionPolicy
Updates the parameters of a single TlsInspectionPolicy.
The async variant is NetworkSecurityClient::updateTlsInspectionPolicyAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\NetworkSecurity\V1\UpdateTlsInspectionPolicyRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Returns | |
|---|---|
| Type | Description |
Google\ApiCore\OperationResponse<Google\Cloud\NetworkSecurity\V1\TlsInspectionPolicy> |
|
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\NetworkSecurity\V1\Client\NetworkSecurityClient;
use Google\Cloud\NetworkSecurity\V1\TlsInspectionPolicy;
use Google\Cloud\NetworkSecurity\V1\UpdateTlsInspectionPolicyRequest;
use Google\Rpc\Status;
/**
* @param string $tlsInspectionPolicyName Name of the resource. Name is of the form
* projects/{project}/locations/{location}/tlsInspectionPolicies/{tls_inspection_policy}
* tls_inspection_policy should match the
* pattern:(^[a-z]([a-z0-9-]{0,61}[a-z0-9])?$).
* @param string $formattedTlsInspectionPolicyCaPool A CA pool resource used to issue interception certificates.
* The CA pool string has a relative resource path following the form
* "projects/{project}/locations/{location}/caPools/{ca_pool}". Please see
* {@see NetworkSecurityClient::caPoolName()} for help formatting this field.
*/
function update_tls_inspection_policy_sample(
string $tlsInspectionPolicyName,
string $formattedTlsInspectionPolicyCaPool
): void {
// Create a client.
$networkSecurityClient = new NetworkSecurityClient();
// Prepare the request message.
$tlsInspectionPolicy = (new TlsInspectionPolicy())
->setName($tlsInspectionPolicyName)
->setCaPool($formattedTlsInspectionPolicyCaPool);
$request = (new UpdateTlsInspectionPolicyRequest())
->setTlsInspectionPolicy($tlsInspectionPolicy);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $networkSecurityClient->updateTlsInspectionPolicy($request);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
/** @var TlsInspectionPolicy $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
{
$tlsInspectionPolicyName = '[NAME]';
$formattedTlsInspectionPolicyCaPool = NetworkSecurityClient::caPoolName(
'[PROJECT]',
'[LOCATION]',
'[CA_POOL]'
);
update_tls_inspection_policy_sample($tlsInspectionPolicyName, $formattedTlsInspectionPolicyCaPool);
}
updateUrlList
Updates the parameters of a single UrlList.
The async variant is NetworkSecurityClient::updateUrlListAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\NetworkSecurity\V1\UpdateUrlListRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Returns | |
|---|---|
| Type | Description |
Google\ApiCore\OperationResponse<Google\Cloud\NetworkSecurity\V1\UrlList> |
|
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\NetworkSecurity\V1\Client\NetworkSecurityClient;
use Google\Cloud\NetworkSecurity\V1\UpdateUrlListRequest;
use Google\Cloud\NetworkSecurity\V1\UrlList;
use Google\Rpc\Status;
/**
* @param string $urlListName Name of the resource provided by the user.
* Name is of the form
* projects/{project}/locations/{location}/urlLists/{url_list}
* url_list should match the
* pattern:(^[a-z]([a-z0-9-]{0,61}[a-z0-9])?$).
* @param string $urlListValuesElement FQDNs and URLs.
*/
function update_url_list_sample(string $urlListName, string $urlListValuesElement): void
{
// Create a client.
$networkSecurityClient = new NetworkSecurityClient();
// Prepare the request message.
$urlListValues = [$urlListValuesElement,];
$urlList = (new UrlList())
->setName($urlListName)
->setValues($urlListValues);
$request = (new UpdateUrlListRequest())
->setUrlList($urlList);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $networkSecurityClient->updateUrlList($request);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
/** @var UrlList $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
{
$urlListName = '[NAME]';
$urlListValuesElement = '[VALUES]';
update_url_list_sample($urlListName, $urlListValuesElement);
}
getLocation
Gets information about a location.
The async variant is NetworkSecurityClient::getLocationAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Location\GetLocationRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Returns | |
|---|---|
| Type | Description |
Google\Cloud\Location\Location |
|
use Google\ApiCore\ApiException;
use Google\Cloud\Location\GetLocationRequest;
use Google\Cloud\Location\Location;
use Google\Cloud\NetworkSecurity\V1\Client\NetworkSecurityClient;
/**
* 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.
$networkSecurityClient = new NetworkSecurityClient();
// Prepare the request message.
$request = new GetLocationRequest();
// Call the API and handle any network failures.
try {
/** @var Location $response */
$response = $networkSecurityClient->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 NetworkSecurityClient::listLocationsAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Location\ListLocationsRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Returns | |
|---|---|
| Type | Description |
Google\ApiCore\PagedListResponse |
|
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\Location\ListLocationsRequest;
use Google\Cloud\Location\Location;
use Google\Cloud\NetworkSecurity\V1\Client\NetworkSecurityClient;
/**
* 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.
$networkSecurityClient = new NetworkSecurityClient();
// Prepare the request message.
$request = new ListLocationsRequest();
// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $networkSecurityClient->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 NetworkSecurityClient::getIamPolicyAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Iam\V1\GetIamPolicyRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Returns | |
|---|---|
| Type | Description |
Google\Cloud\Iam\V1\Policy |
|
use Google\ApiCore\ApiException;
use Google\Cloud\Iam\V1\GetIamPolicyRequest;
use Google\Cloud\Iam\V1\Policy;
use Google\Cloud\NetworkSecurity\V1\Client\NetworkSecurityClient;
/**
* @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.
$networkSecurityClient = new NetworkSecurityClient();
// Prepare the request message.
$request = (new GetIamPolicyRequest())
->setResource($resource);
// Call the API and handle any network failures.
try {
/** @var Policy $response */
$response = $networkSecurityClient->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 NetworkSecurityClient::setIamPolicyAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Iam\V1\SetIamPolicyRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Returns | |
|---|---|
| Type | Description |
Google\Cloud\Iam\V1\Policy |
|
use Google\ApiCore\ApiException;
use Google\Cloud\Iam\V1\Policy;
use Google\Cloud\Iam\V1\SetIamPolicyRequest;
use Google\Cloud\NetworkSecurity\V1\Client\NetworkSecurityClient;
/**
* @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.
$networkSecurityClient = new NetworkSecurityClient();
// 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 = $networkSecurityClient->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 NetworkSecurityClient::testIamPermissionsAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Iam\V1\TestIamPermissionsRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Returns | |
|---|---|
| Type | Description |
Google\Cloud\Iam\V1\TestIamPermissionsResponse |
|
use Google\ApiCore\ApiException;
use Google\Cloud\Iam\V1\TestIamPermissionsRequest;
use Google\Cloud\Iam\V1\TestIamPermissionsResponse;
use Google\Cloud\NetworkSecurity\V1\Client\NetworkSecurityClient;
/**
* @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.
$networkSecurityClient = new NetworkSecurityClient();
// 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 = $networkSecurityClient->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);
}
createAuthorizationPolicyAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\NetworkSecurity\V1\CreateAuthorizationPolicyRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse> |
|
createAuthzPolicyAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\NetworkSecurity\V1\CreateAuthzPolicyRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse> |
|
createBackendAuthenticationConfigAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\NetworkSecurity\V1\CreateBackendAuthenticationConfigRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse> |
|
createClientTlsPolicyAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\NetworkSecurity\V1\CreateClientTlsPolicyRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse> |
|
createGatewaySecurityPolicyAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\NetworkSecurity\V1\CreateGatewaySecurityPolicyRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse> |
|
createGatewaySecurityPolicyRuleAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\NetworkSecurity\V1\CreateGatewaySecurityPolicyRuleRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse> |
|
createServerTlsPolicyAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\NetworkSecurity\V1\CreateServerTlsPolicyRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse> |
|
createTlsInspectionPolicyAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\NetworkSecurity\V1\CreateTlsInspectionPolicyRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse> |
|
createUrlListAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\NetworkSecurity\V1\CreateUrlListRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse> |
|
deleteAuthorizationPolicyAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\NetworkSecurity\V1\DeleteAuthorizationPolicyRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse> |
|
deleteAuthzPolicyAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\NetworkSecurity\V1\DeleteAuthzPolicyRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse> |
|
deleteBackendAuthenticationConfigAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\NetworkSecurity\V1\DeleteBackendAuthenticationConfigRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse> |
|
deleteClientTlsPolicyAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\NetworkSecurity\V1\DeleteClientTlsPolicyRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse> |
|
deleteGatewaySecurityPolicyAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\NetworkSecurity\V1\DeleteGatewaySecurityPolicyRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse> |
|
deleteGatewaySecurityPolicyRuleAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\NetworkSecurity\V1\DeleteGatewaySecurityPolicyRuleRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse> |
|
deleteServerTlsPolicyAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\NetworkSecurity\V1\DeleteServerTlsPolicyRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse> |
|
deleteTlsInspectionPolicyAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\NetworkSecurity\V1\DeleteTlsInspectionPolicyRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse> |
|
deleteUrlListAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\NetworkSecurity\V1\DeleteUrlListRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse> |
|
getAuthorizationPolicyAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\NetworkSecurity\V1\GetAuthorizationPolicyRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\NetworkSecurity\V1\AuthorizationPolicy> |
|
getAuthzPolicyAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\NetworkSecurity\V1\GetAuthzPolicyRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\NetworkSecurity\V1\AuthzPolicy> |
|
getBackendAuthenticationConfigAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\NetworkSecurity\V1\GetBackendAuthenticationConfigRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\NetworkSecurity\V1\BackendAuthenticationConfig> |
|
getClientTlsPolicyAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\NetworkSecurity\V1\GetClientTlsPolicyRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<lsPolicy> |
|
getGatewaySecurityPolicyAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\NetworkSecurity\V1\GetGatewaySecurityPolicyRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\NetworkSecurity\V1\GatewaySecurityPolicy> |
|
getGatewaySecurityPolicyRuleAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\NetworkSecurity\V1\GetGatewaySecurityPolicyRuleRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\NetworkSecurity\V1\GatewaySecurityPolicyRule> |
|
getServerTlsPolicyAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\NetworkSecurity\V1\GetServerTlsPolicyRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\NetworkSecurity\V1\ServerTlsPolicy> |
|
getTlsInspectionPolicyAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\NetworkSecurity\V1\GetTlsInspectionPolicyRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\NetworkSecurity\V1\TlsInspectionPolicy> |
|
getUrlListAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\NetworkSecurity\V1\GetUrlListRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\NetworkSecurity\V1\UrlList> |
|
listAuthorizationPoliciesAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\NetworkSecurity\V1\ListAuthorizationPoliciesRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\PagedListResponse> |
|
listAuthzPoliciesAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\NetworkSecurity\V1\ListAuthzPoliciesRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\PagedListResponse> |
|
listBackendAuthenticationConfigsAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\NetworkSecurity\V1\ListBackendAuthenticationConfigsRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\PagedListResponse> |
|
listClientTlsPoliciesAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\NetworkSecurity\V1\ListClientTlsPoliciesRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\PagedListResponse> |
|
listGatewaySecurityPoliciesAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\NetworkSecurity\V1\ListGatewaySecurityPoliciesRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\PagedListResponse> |
|
listGatewaySecurityPolicyRulesAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\NetworkSecurity\V1\ListGatewaySecurityPolicyRulesRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\PagedListResponse> |
|
listServerTlsPoliciesAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\NetworkSecurity\V1\ListServerTlsPoliciesRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\PagedListResponse> |
|
listTlsInspectionPoliciesAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\NetworkSecurity\V1\ListTlsInspectionPoliciesRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\PagedListResponse> |
|
listUrlListsAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\NetworkSecurity\V1\ListUrlListsRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\PagedListResponse> |
|
updateAuthorizationPolicyAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\NetworkSecurity\V1\UpdateAuthorizationPolicyRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse> |
|
updateAuthzPolicyAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\NetworkSecurity\V1\UpdateAuthzPolicyRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse> |
|
updateBackendAuthenticationConfigAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\NetworkSecurity\V1\UpdateBackendAuthenticationConfigRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse> |
|
updateClientTlsPolicyAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\NetworkSecurity\V1\UpdateClientTlsPolicyRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse> |
|
updateGatewaySecurityPolicyAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\NetworkSecurity\V1\UpdateGatewaySecurityPolicyRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse> |
|
updateGatewaySecurityPolicyRuleAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\NetworkSecurity\V1\UpdateGatewaySecurityPolicyRuleRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse> |
|
updateServerTlsPolicyAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\NetworkSecurity\V1\UpdateServerTlsPolicyRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse> |
|
updateTlsInspectionPolicyAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\NetworkSecurity\V1\UpdateTlsInspectionPolicyRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse> |
|
updateUrlListAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\NetworkSecurity\V1\UpdateUrlListRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse> |
|
getLocationAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Location\GetLocationRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Location\Location> |
|
listLocationsAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Location\ListLocationsRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\PagedListResponse> |
|
getIamPolicyAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Iam\V1\GetIamPolicyRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Iam\V1\Policy> |
|
setIamPolicyAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Iam\V1\SetIamPolicyRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Iam\V1\Policy> |
|
testIamPermissionsAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Iam\V1\TestIamPermissionsRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Iam\V1\TestIamPermissionsResponse> |
|
getOperationsClient
Return an OperationsClient object with the same endpoint as $this.
| Returns | |
|---|---|
| Type | Description |
Google\LongRunning\Client\OperationsClient |
|
resumeOperation
Resume an existing long running operation that was previously started by a long running API method. If $methodName is not provided, or does not match a long running API method, then the operation can still be resumed, but the OperationResponse object will not deserialize the final response.
| Parameters | |
|---|---|
| Name | Description |
operationName |
string
The name of the long running operation |
methodName |
string
The name of the method used to start the operation |
| Returns | |
|---|---|
| Type | Description |
Google\ApiCore\OperationResponse |
|
static::authorizationPolicyName
Formats a string containing the fully-qualified path to represent a authorization_policy resource.
| Parameters | |
|---|---|
| Name | Description |
project |
string
|
location |
string
|
authorizationPolicy |
string
|
| Returns | |
|---|---|
| Type | Description |
string |
The formatted authorization_policy resource. |
static::authzPolicyName
Formats a string containing the fully-qualified path to represent a authz_policy resource.
| Parameters | |
|---|---|
| Name | Description |
project |
string
|
location |
string
|
authzPolicy |
string
|
| Returns | |
|---|---|
| Type | Description |
string |
The formatted authz_policy resource. |
static::backendAuthenticationConfigName
Formats a string containing the fully-qualified path to represent a backend_authentication_config resource.
| Parameters | |
|---|---|
| Name | Description |
project |
string
|
location |
string
|
backendAuthenticationConfig |
string
|
| Returns | |
|---|---|
| Type | Description |
string |
The formatted backend_authentication_config resource. |
static::caPoolName
Formats a string containing the fully-qualified path to represent a ca_pool resource.
| Parameters | |
|---|---|
| Name | Description |
project |
string
|
location |
string
|
caPool |
string
|
| Returns | |
|---|---|
| Type | Description |
string |
The formatted ca_pool resource. |
static::certificateName
Formats a string containing the fully-qualified path to represent a certificate resource.
| Parameters | |
|---|---|
| Name | Description |
project |
string
|
location |
string
|
certificate |
string
|
| Returns | |
|---|---|
| Type | Description |
string |
The formatted certificate resource. |
static::clientTlsPolicyName
Formats a string containing the fully-qualified path to represent a client_tls_policy resource.
| Parameters | |
|---|---|
| Name | Description |
project |
string
|
location |
string
|
clientTlsPolicy |
string
|
| Returns | |
|---|---|
| Type | Description |
string |
The formatted client_tls_policy resource. |
static::gatewaySecurityPolicyName
Formats a string containing the fully-qualified path to represent a gateway_security_policy resource.
| Parameters | |
|---|---|
| Name | Description |
project |
string
|
location |
string
|
gatewaySecurityPolicy |
string
|
| Returns | |
|---|---|
| Type | Description |
string |
The formatted gateway_security_policy resource. |
static::gatewaySecurityPolicyRuleName
Formats a string containing the fully-qualified path to represent a gateway_security_policy_rule resource.
| Parameters | |
|---|---|
| Name | Description |
project |
string
|
location |
string
|
gatewaySecurityPolicy |
string
|
rule |
string
|
| Returns | |
|---|---|
| Type | Description |
string |
The formatted gateway_security_policy_rule resource. |
static::locationName
Formats a string containing the fully-qualified path to represent a location resource.
| Parameters | |
|---|---|
| Name | Description |
project |
string
|
location |
string
|
| Returns | |
|---|---|
| Type | Description |
string |
The formatted location resource. |
static::serverTlsPolicyName
Formats a string containing the fully-qualified path to represent a server_tls_policy resource.
| Parameters | |
|---|---|
| Name | Description |
project |
string
|
location |
string
|
serverTlsPolicy |
string
|
| Returns | |
|---|---|
| Type | Description |
string |
The formatted server_tls_policy resource. |
static::tlsInspectionPolicyName
Formats a string containing the fully-qualified path to represent a tls_inspection_policy resource.
| Parameters | |
|---|---|
| Name | Description |
project |
string
|
location |
string
|
tlsInspectionPolicy |
string
|
| Returns | |
|---|---|
| Type | Description |
string |
The formatted tls_inspection_policy resource. |
static::trustConfigName
Formats a string containing the fully-qualified path to represent a trust_config resource.
| Parameters | |
|---|---|
| Name | Description |
project |
string
|
location |
string
|
trustConfig |
string
|
| Returns | |
|---|---|
| Type | Description |
string |
The formatted trust_config resource. |
static::urlListName
Formats a string containing the fully-qualified path to represent a url_list resource.
| Parameters | |
|---|---|
| Name | Description |
project |
string
|
location |
string
|
urlList |
string
|
| Returns | |
|---|---|
| Type | Description |
string |
The formatted url_list 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
- authorizationPolicy: projects/{project}/locations/{location}/authorizationPolicies/{authorization_policy}
- authzPolicy: projects/{project}/locations/{location}/authzPolicies/{authz_policy}
- backendAuthenticationConfig: projects/{project}/locations/{location}/backendAuthenticationConfigs/{backend_authentication_config}
- caPool: projects/{project}/locations/{location}/caPools/{ca_pool}
- certificate: projects/{project}/locations/{location}/certificates/{certificate}
- clientTlsPolicy: projects/{project}/locations/{location}/clientTlsPolicies/{client_tls_policy}
- gatewaySecurityPolicy: projects/{project}/locations/{location}/gatewaySecurityPolicies/{gateway_security_policy}
- gatewaySecurityPolicyRule: projects/{project}/locations/{location}/gatewaySecurityPolicies/{gateway_security_policy}/rules/{rule}
- location: projects/{project}/locations/{location}
- serverTlsPolicy: projects/{project}/locations/{location}/serverTlsPolicies/{server_tls_policy}
- tlsInspectionPolicy: projects/{project}/locations/{location}/tlsInspectionPolicies/{tls_inspection_policy}
- trustConfig: projects/{project}/locations/{location}/trustConfigs/{trust_config}
- urlList: projects/{project}/locations/{location}/urlLists/{url_list}
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. |