Reference documentation and code samples for the Compute V1 Client class OrganizationSecurityPoliciesClient.
Service Description: The OrganizationSecurityPolicies API.
This class provides the ability to make remote calls to the backing service through method calls that map to API methods.
Namespace
Google \ Cloud \ Compute \ 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. At the moment, supports only |
↳ 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 = [ 'rest' => [...], ]; See the Google\ApiCore\Transport\RestTransport::build() method 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'. |
addAssociation
Inserts an association for the specified security policy.
This has billing implications. Projects in the hierarchy with effective hierarchical security policies will be automatically enrolled into Cloud Armor Enterprise if not already enrolled.
Use this API to modify Cloud Armor policies. Previously, alpha and beta versions of this API were used to modify firewall policies. This usage is now disabled for most organizations. Use firewallPolicies.addAssociation instead.
The async variant is OrganizationSecurityPoliciesClient::addAssociationAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Compute\V1\AddAssociationOrganizationSecurityPolicyRequest
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 |
|
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Compute\V1\AddAssociationOrganizationSecurityPolicyRequest;
use Google\Cloud\Compute\V1\Client\OrganizationSecurityPoliciesClient;
use Google\Cloud\Compute\V1\SecurityPolicyAssociation;
use Google\Rpc\Status;
/**
* @param string $securityPolicy Name of the security policy to update.
*/
function add_association_sample(string $securityPolicy): void
{
// Create a client.
$organizationSecurityPoliciesClient = new OrganizationSecurityPoliciesClient();
// Prepare the request message.
$securityPolicyAssociationResource = new SecurityPolicyAssociation();
$request = (new AddAssociationOrganizationSecurityPolicyRequest())
->setSecurityPolicy($securityPolicy)
->setSecurityPolicyAssociationResource($securityPolicyAssociationResource);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $organizationSecurityPoliciesClient->addAssociation($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
{
$securityPolicy = '[SECURITY_POLICY]';
add_association_sample($securityPolicy);
}
addRule
Inserts a rule into a security policy.
Use this API to modify Cloud Armor policies. Previously, alpha and beta versions of this API were used to modify firewall policies. This usage is now disabled for most organizations. Use firewallPolicies.addRule instead.
The async variant is OrganizationSecurityPoliciesClient::addRuleAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Compute\V1\AddRuleOrganizationSecurityPolicyRequest
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 |
|
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Compute\V1\AddRuleOrganizationSecurityPolicyRequest;
use Google\Cloud\Compute\V1\Client\OrganizationSecurityPoliciesClient;
use Google\Cloud\Compute\V1\SecurityPolicyRule;
use Google\Rpc\Status;
/**
* @param string $securityPolicy Name of the security policy to update.
*/
function add_rule_sample(string $securityPolicy): void
{
// Create a client.
$organizationSecurityPoliciesClient = new OrganizationSecurityPoliciesClient();
// Prepare the request message.
$securityPolicyRuleResource = new SecurityPolicyRule();
$request = (new AddRuleOrganizationSecurityPolicyRequest())
->setSecurityPolicy($securityPolicy)
->setSecurityPolicyRuleResource($securityPolicyRuleResource);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $organizationSecurityPoliciesClient->addRule($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
{
$securityPolicy = '[SECURITY_POLICY]';
add_rule_sample($securityPolicy);
}
copyRules
Copies rules to the specified security policy.
Use this API to modify Cloud Armor policies. Previously, alpha and beta versions of this API were used to modify firewall policies. This usage is now disabled for most organizations. Use firewallPolicies.cloneRules instead.
The async variant is OrganizationSecurityPoliciesClient::copyRulesAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Compute\V1\CopyRulesOrganizationSecurityPolicyRequest
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 |
|
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Compute\V1\Client\OrganizationSecurityPoliciesClient;
use Google\Cloud\Compute\V1\CopyRulesOrganizationSecurityPolicyRequest;
use Google\Rpc\Status;
/**
* @param string $securityPolicy Name of the security policy to update.
*/
function copy_rules_sample(string $securityPolicy): void
{
// Create a client.
$organizationSecurityPoliciesClient = new OrganizationSecurityPoliciesClient();
// Prepare the request message.
$request = (new CopyRulesOrganizationSecurityPolicyRequest())
->setSecurityPolicy($securityPolicy);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $organizationSecurityPoliciesClient->copyRules($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
{
$securityPolicy = '[SECURITY_POLICY]';
copy_rules_sample($securityPolicy);
}
delete
Deletes the specified policy.
Use this API to remove Cloud Armor policies. Previously, alpha and beta versions of this API were used to remove firewall policies. This usage is now disabled for most organizations. Use firewallPolicies.delete instead.
The async variant is OrganizationSecurityPoliciesClient::deleteAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Compute\V1\DeleteOrganizationSecurityPolicyRequest
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 |
|
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Compute\V1\Client\OrganizationSecurityPoliciesClient;
use Google\Cloud\Compute\V1\DeleteOrganizationSecurityPolicyRequest;
use Google\Rpc\Status;
/**
* @param string $securityPolicy Name of the security policy to delete.
*/
function delete_sample(string $securityPolicy): void
{
// Create a client.
$organizationSecurityPoliciesClient = new OrganizationSecurityPoliciesClient();
// Prepare the request message.
$request = (new DeleteOrganizationSecurityPolicyRequest())
->setSecurityPolicy($securityPolicy);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $organizationSecurityPoliciesClient->delete($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
{
$securityPolicy = '[SECURITY_POLICY]';
delete_sample($securityPolicy);
}
get
List all of the ordered rules present in a single specified policy.
Use this API to read Cloud Armor policies. Previously, alpha and beta versions of this API were used to read firewall policies. This usage is now disabled for most organizations. Use firewallPolicies.get instead.
The async variant is OrganizationSecurityPoliciesClient::getAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Compute\V1\GetOrganizationSecurityPolicyRequest
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\Compute\V1\SecurityPolicy |
|
use Google\ApiCore\ApiException;
use Google\Cloud\Compute\V1\Client\OrganizationSecurityPoliciesClient;
use Google\Cloud\Compute\V1\GetOrganizationSecurityPolicyRequest;
use Google\Cloud\Compute\V1\SecurityPolicy;
/**
* @param string $securityPolicy Name of the security policy to get.
*/
function get_sample(string $securityPolicy): void
{
// Create a client.
$organizationSecurityPoliciesClient = new OrganizationSecurityPoliciesClient();
// Prepare the request message.
$request = (new GetOrganizationSecurityPolicyRequest())
->setSecurityPolicy($securityPolicy);
// Call the API and handle any network failures.
try {
/** @var SecurityPolicy $response */
$response = $organizationSecurityPoliciesClient->get($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
{
$securityPolicy = '[SECURITY_POLICY]';
get_sample($securityPolicy);
}
getAssociation
Gets an association with the specified name.
Use this API to read Cloud Armor policies. Previously, alpha and beta versions of this API were used to read firewall policies. This usage is now disabled for most organizations. Use firewallPolicies.getAssociation instead.
The async variant is OrganizationSecurityPoliciesClient::getAssociationAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Compute\V1\GetAssociationOrganizationSecurityPolicyRequest
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\Compute\V1\SecurityPolicyAssociation |
|
use Google\ApiCore\ApiException;
use Google\Cloud\Compute\V1\Client\OrganizationSecurityPoliciesClient;
use Google\Cloud\Compute\V1\GetAssociationOrganizationSecurityPolicyRequest;
use Google\Cloud\Compute\V1\SecurityPolicyAssociation;
/**
* @param string $securityPolicy Name of the security policy to which the queried rule belongs.
*/
function get_association_sample(string $securityPolicy): void
{
// Create a client.
$organizationSecurityPoliciesClient = new OrganizationSecurityPoliciesClient();
// Prepare the request message.
$request = (new GetAssociationOrganizationSecurityPolicyRequest())
->setSecurityPolicy($securityPolicy);
// Call the API and handle any network failures.
try {
/** @var SecurityPolicyAssociation $response */
$response = $organizationSecurityPoliciesClient->getAssociation($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
{
$securityPolicy = '[SECURITY_POLICY]';
get_association_sample($securityPolicy);
}
getRule
Gets a rule at the specified priority.
Use this API to read Cloud Armor policies. Previously, alpha and beta versions of this API were used to read firewall policies. This usage is now disabled for most organizations. Use firewallPolicies.getRule instead.
The async variant is OrganizationSecurityPoliciesClient::getRuleAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Compute\V1\GetRuleOrganizationSecurityPolicyRequest
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\Compute\V1\SecurityPolicyRule |
|
use Google\ApiCore\ApiException;
use Google\Cloud\Compute\V1\Client\OrganizationSecurityPoliciesClient;
use Google\Cloud\Compute\V1\GetRuleOrganizationSecurityPolicyRequest;
use Google\Cloud\Compute\V1\SecurityPolicyRule;
/**
* @param string $securityPolicy Name of the security policy to which the queried rule belongs.
*/
function get_rule_sample(string $securityPolicy): void
{
// Create a client.
$organizationSecurityPoliciesClient = new OrganizationSecurityPoliciesClient();
// Prepare the request message.
$request = (new GetRuleOrganizationSecurityPolicyRequest())
->setSecurityPolicy($securityPolicy);
// Call the API and handle any network failures.
try {
/** @var SecurityPolicyRule $response */
$response = $organizationSecurityPoliciesClient->getRule($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$securityPolicy = '[SECURITY_POLICY]';
get_rule_sample($securityPolicy);
}
insert
Creates a new policy in the specified organization using the data included in the request.
Use this API to add Cloud Armor policies. Previously, alpha and beta versions of this API were used to add firewall policies. This usage is now disabled for most organizations. Use firewallPolicies.insert instead.
The async variant is OrganizationSecurityPoliciesClient::insertAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Compute\V1\InsertOrganizationSecurityPolicyRequest
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 |
|
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Compute\V1\Client\OrganizationSecurityPoliciesClient;
use Google\Cloud\Compute\V1\InsertOrganizationSecurityPolicyRequest;
use Google\Cloud\Compute\V1\SecurityPolicy;
use Google\Rpc\Status;
/**
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function insert_sample(): void
{
// Create a client.
$organizationSecurityPoliciesClient = new OrganizationSecurityPoliciesClient();
// Prepare the request message.
$securityPolicyResource = new SecurityPolicy();
$request = (new InsertOrganizationSecurityPolicyRequest())
->setSecurityPolicyResource($securityPolicyResource);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $organizationSecurityPoliciesClient->insert($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());
}
}
list
List all the policies that have been configured for the specified organization.
Use this API to read Cloud Armor policies. Previously, alpha and beta versions of this API were used to read firewall policies. This usage is now disabled for most organizations. Use firewallPolicies.list instead.
The async variant is OrganizationSecurityPoliciesClient::listAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Compute\V1\ListOrganizationSecurityPoliciesRequest
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\Compute\V1\Client\OrganizationSecurityPoliciesClient;
use Google\Cloud\Compute\V1\ListOrganizationSecurityPoliciesRequest;
/**
* 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_sample(): void
{
// Create a client.
$organizationSecurityPoliciesClient = new OrganizationSecurityPoliciesClient();
// Prepare the request message.
$request = new ListOrganizationSecurityPoliciesRequest();
// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $organizationSecurityPoliciesClient->list($request);
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());
}
}
listAssociations
Lists associations of a specified target, i.e., organization or folder.
Use this API to read Cloud Armor policies. Previously, alpha and beta versions of this API were used to read firewall policies. This usage is now disabled for most organizations. Use firewallPolicies.listAssociations instead.
The async variant is OrganizationSecurityPoliciesClient::listAssociationsAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Compute\V1\ListAssociationsOrganizationSecurityPolicyRequest
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\Compute\V1\OrganizationSecurityPoliciesListAssociationsResponse |
|
use Google\ApiCore\ApiException;
use Google\Cloud\Compute\V1\Client\OrganizationSecurityPoliciesClient;
use Google\Cloud\Compute\V1\ListAssociationsOrganizationSecurityPolicyRequest;
use Google\Cloud\Compute\V1\OrganizationSecurityPoliciesListAssociationsResponse;
/**
* 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_associations_sample(): void
{
// Create a client.
$organizationSecurityPoliciesClient = new OrganizationSecurityPoliciesClient();
// Prepare the request message.
$request = new ListAssociationsOrganizationSecurityPolicyRequest();
// Call the API and handle any network failures.
try {
/** @var OrganizationSecurityPoliciesListAssociationsResponse $response */
$response = $organizationSecurityPoliciesClient->listAssociations($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
listPreconfiguredExpressionSets
Gets the current list of preconfigured Web Application Firewall (WAF) expressions.
The async variant is OrganizationSecurityPoliciesClient::listPreconfiguredExpressionSetsAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Compute\V1\ListPreconfiguredExpressionSetsOrganizationSecurityPoliciesRequest
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\Compute\V1\SecurityPoliciesListPreconfiguredExpressionSetsResponse |
|
use Google\ApiCore\ApiException;
use Google\Cloud\Compute\V1\Client\OrganizationSecurityPoliciesClient;
use Google\Cloud\Compute\V1\ListPreconfiguredExpressionSetsOrganizationSecurityPoliciesRequest;
use Google\Cloud\Compute\V1\SecurityPoliciesListPreconfiguredExpressionSetsResponse;
/**
* 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_preconfigured_expression_sets_sample(): void
{
// Create a client.
$organizationSecurityPoliciesClient = new OrganizationSecurityPoliciesClient();
// Prepare the request message.
$request = new ListPreconfiguredExpressionSetsOrganizationSecurityPoliciesRequest();
// Call the API and handle any network failures.
try {
/** @var SecurityPoliciesListPreconfiguredExpressionSetsResponse $response */
$response = $organizationSecurityPoliciesClient->listPreconfiguredExpressionSets($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
move
Moves the specified security policy.
Use this API to modify Cloud Armor policies. Previously, alpha and beta versions of this API were used to modify firewall policies. This usage is now disabled for most organizations. Use firewallPolicies.move instead.
The async variant is OrganizationSecurityPoliciesClient::moveAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Compute\V1\MoveOrganizationSecurityPolicyRequest
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 |
|
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Compute\V1\Client\OrganizationSecurityPoliciesClient;
use Google\Cloud\Compute\V1\MoveOrganizationSecurityPolicyRequest;
use Google\Rpc\Status;
/**
* @param string $securityPolicy Name of the security policy to update.
*/
function move_sample(string $securityPolicy): void
{
// Create a client.
$organizationSecurityPoliciesClient = new OrganizationSecurityPoliciesClient();
// Prepare the request message.
$request = (new MoveOrganizationSecurityPolicyRequest())
->setSecurityPolicy($securityPolicy);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $organizationSecurityPoliciesClient->move($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
{
$securityPolicy = '[SECURITY_POLICY]';
move_sample($securityPolicy);
}
patch
Patches the specified policy with the data included in the request.
Use this API to modify Cloud Armor policies. Previously, alpha and beta versions of this API were used to modify firewall policies. This usage is now disabled for most organizations. Use firewallPolicies.patch instead.
The async variant is OrganizationSecurityPoliciesClient::patchAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Compute\V1\PatchOrganizationSecurityPolicyRequest
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 |
|
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Compute\V1\Client\OrganizationSecurityPoliciesClient;
use Google\Cloud\Compute\V1\PatchOrganizationSecurityPolicyRequest;
use Google\Cloud\Compute\V1\SecurityPolicy;
use Google\Rpc\Status;
/**
* @param string $securityPolicy Name of the security policy to update.
*/
function patch_sample(string $securityPolicy): void
{
// Create a client.
$organizationSecurityPoliciesClient = new OrganizationSecurityPoliciesClient();
// Prepare the request message.
$securityPolicyResource = new SecurityPolicy();
$request = (new PatchOrganizationSecurityPolicyRequest())
->setSecurityPolicy($securityPolicy)
->setSecurityPolicyResource($securityPolicyResource);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $organizationSecurityPoliciesClient->patch($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
{
$securityPolicy = '[SECURITY_POLICY]';
patch_sample($securityPolicy);
}
patchRule
Patches a rule at the specified priority.
Use this API to modify Cloud Armor policies. Previously, alpha and beta versions of this API were used to modify firewall policies. This usage is now disabled for most organizations. Use firewallPolicies.patchRule instead.
The async variant is OrganizationSecurityPoliciesClient::patchRuleAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Compute\V1\PatchRuleOrganizationSecurityPolicyRequest
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 |
|
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Compute\V1\Client\OrganizationSecurityPoliciesClient;
use Google\Cloud\Compute\V1\PatchRuleOrganizationSecurityPolicyRequest;
use Google\Cloud\Compute\V1\SecurityPolicyRule;
use Google\Rpc\Status;
/**
* @param string $securityPolicy Name of the security policy to update.
*/
function patch_rule_sample(string $securityPolicy): void
{
// Create a client.
$organizationSecurityPoliciesClient = new OrganizationSecurityPoliciesClient();
// Prepare the request message.
$securityPolicyRuleResource = new SecurityPolicyRule();
$request = (new PatchRuleOrganizationSecurityPolicyRequest())
->setSecurityPolicy($securityPolicy)
->setSecurityPolicyRuleResource($securityPolicyRuleResource);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $organizationSecurityPoliciesClient->patchRule($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
{
$securityPolicy = '[SECURITY_POLICY]';
patch_rule_sample($securityPolicy);
}
removeAssociation
Removes an association for the specified security policy.
Use this API to modify Cloud Armor policies. Previously, alpha and beta versions of this API were used to modify firewall policies. This usage is now disabled for most organizations. Use firewallPolicies.removeAssociation instead.
The async variant is OrganizationSecurityPoliciesClient::removeAssociationAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Compute\V1\RemoveAssociationOrganizationSecurityPolicyRequest
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 |
|
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Compute\V1\Client\OrganizationSecurityPoliciesClient;
use Google\Cloud\Compute\V1\RemoveAssociationOrganizationSecurityPolicyRequest;
use Google\Rpc\Status;
/**
* @param string $securityPolicy Name of the security policy to update.
*/
function remove_association_sample(string $securityPolicy): void
{
// Create a client.
$organizationSecurityPoliciesClient = new OrganizationSecurityPoliciesClient();
// Prepare the request message.
$request = (new RemoveAssociationOrganizationSecurityPolicyRequest())
->setSecurityPolicy($securityPolicy);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $organizationSecurityPoliciesClient->removeAssociation($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
{
$securityPolicy = '[SECURITY_POLICY]';
remove_association_sample($securityPolicy);
}
removeRule
Deletes a rule at the specified priority.
Use this API to modify Cloud Armor policies. Previously, alpha and beta versions of this API were used to modify firewall policies. This usage is now disabled for most organizations. Use firewallPolicies.removeRule instead.
The async variant is OrganizationSecurityPoliciesClient::removeRuleAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Compute\V1\RemoveRuleOrganizationSecurityPolicyRequest
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 |
|
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Compute\V1\Client\OrganizationSecurityPoliciesClient;
use Google\Cloud\Compute\V1\RemoveRuleOrganizationSecurityPolicyRequest;
use Google\Rpc\Status;
/**
* @param string $securityPolicy Name of the security policy to update.
*/
function remove_rule_sample(string $securityPolicy): void
{
// Create a client.
$organizationSecurityPoliciesClient = new OrganizationSecurityPoliciesClient();
// Prepare the request message.
$request = (new RemoveRuleOrganizationSecurityPolicyRequest())
->setSecurityPolicy($securityPolicy);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $organizationSecurityPoliciesClient->removeRule($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
{
$securityPolicy = '[SECURITY_POLICY]';
remove_rule_sample($securityPolicy);
}
addAssociationAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Compute\V1\AddAssociationOrganizationSecurityPolicyRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse> |
|
addRuleAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Compute\V1\AddRuleOrganizationSecurityPolicyRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse> |
|
copyRulesAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Compute\V1\CopyRulesOrganizationSecurityPolicyRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse> |
|
deleteAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Compute\V1\DeleteOrganizationSecurityPolicyRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse> |
|
getAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Compute\V1\GetOrganizationSecurityPolicyRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Compute\V1\SecurityPolicy> |
|
getAssociationAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Compute\V1\GetAssociationOrganizationSecurityPolicyRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Compute\V1\SecurityPolicyAssociation> |
|
getRuleAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Compute\V1\GetRuleOrganizationSecurityPolicyRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Compute\V1\SecurityPolicyRule> |
|
insertAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Compute\V1\InsertOrganizationSecurityPolicyRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse> |
|
listAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Compute\V1\ListOrganizationSecurityPoliciesRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\PagedListResponse> |
|
listAssociationsAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Compute\V1\ListAssociationsOrganizationSecurityPolicyRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Compute\V1\OrganizationSecurityPoliciesListAssociationsResponse> |
|
listPreconfiguredExpressionSetsAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Compute\V1\ListPreconfiguredExpressionSetsOrganizationSecurityPoliciesRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Compute\V1\SecurityPoliciesListPreconfiguredExpressionSetsResponse> |
|
moveAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Compute\V1\MoveOrganizationSecurityPolicyRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse> |
|
patchAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Compute\V1\PatchOrganizationSecurityPolicyRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse> |
|
patchRuleAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Compute\V1\PatchRuleOrganizationSecurityPolicyRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse> |
|
removeAssociationAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Compute\V1\RemoveAssociationOrganizationSecurityPolicyRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse> |
|
removeRuleAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Compute\V1\RemoveRuleOrganizationSecurityPolicyRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse> |
|
getOperationsClient
Return an GlobalOrganizationOperationsClient object with the same endpoint as $this.
| Returns | |
|---|---|
| Type | Description |
GlobalOrganizationOperationsClient |
|
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 |
|