# Google Cloud Network Security V1 Client - Class AuthzPolicy (1.4.0)

1.4.0 (latest) 1.3.0 1.2.3 1.1.0 1.0.4 0.6.5 0.5.2 0.4.1 0.3.7 Reference documentation and code samples for the Google Cloud Network Security V1 Client class AuthzPolicy.

`AuthzPolicy` is a resource that allows to forward traffic to a
callout backend designed to scan the traffic for security purposes.

Generated from protobuf message `google.cloud.networksecurity.v1.AuthzPolicy`

## Namespace

Google \\ Cloud \\ NetworkSecurity \\ V1

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ name` | `string` Required. Identifier. Name of the `AuthzPolicy` resource in the following format: `projects/{project}/locations/{location}/authzPolicies/{authz_policy}`. |
| `↳ create_time` | `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Timestamp` Output only. The timestamp when the resource was created. |
| `↳ update_time` | `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Timestamp` Output only. The timestamp when the resource was updated. |
| `↳ description` | `string` Optional. A human-readable description of the resource. |
| `↳ labels` | `array|https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Internal/MapField` Optional. Set of labels associated with the `AuthzPolicy` resource. The format must comply with [the following requirements](https://docs.cloud.google.com/compute/docs/labeling-resources#requirements). |
| `↳ target` | `https://docs.cloud.google.com/php/docs/reference/cloud-network-security/latest/V1.AuthzPolicy.Target` Required. Specifies the set of resources to which this policy should be applied to. |
| `↳ http_rules` | `array<https://docs.cloud.google.com/php/docs/reference/cloud-network-security/latest/V1.AuthzPolicy.AuthzRule>` Optional. A list of authorization HTTP rules to match against the incoming request. A policy match occurs when at least one HTTP rule matches the request or when no HTTP rules are specified in the policy. At least one HTTP Rule is required for Allow or Deny Action. Limited to 5 rules. |
| `↳ network_rules` | `array<https://docs.cloud.google.com/php/docs/reference/cloud-network-security/latest/V1.AuthzPolicy.AuthzRule>` Optional. A list of authorization network rules to match against the incoming request. A policy match occurs when at least one network rule matches the request. At least one network rule is required for Allow or Deny Action if no HTTP rules are provided. Network rules are mutually exclusive with HTTP rules. Limited to 5 rules. |
| `↳ action` | `int` Required. 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. |
| `↳ custom_provider` | `https://docs.cloud.google.com/php/docs/reference/cloud-network-security/latest/V1.AuthzPolicy.CustomProvider` Optional. Required if the action is `CUSTOM`. Allows delegating authorization decisions to Cloud IAP or to Service Extensions. One of `cloudIap` or `authzExtension` must be specified. |
| `↳ policy_profile` | `int` Optional. Immutable. Defines the type of authorization being performed. If not specified, `REQUEST_AUTHZ` is applied. This field cannot be changed once AuthzPolicy is created. |

### getName

Required. Identifier. Name of the `AuthzPolicy` resource in the following
format:
`projects/{project}/locations/{location}/authzPolicies/{authz_policy}`.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setName

Required. Identifier. Name of the `AuthzPolicy` resource in the following
format:
`projects/{project}/locations/{location}/authzPolicies/{authz_policy}`.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getCreateTime

Output only. The timestamp when the resource was created.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Timestamp|null` |   |

### hasCreateTime

### clearCreateTime

### setCreateTime

Output only. The timestamp when the resource was created.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Timestamp` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getUpdateTime

Output only. The timestamp when the resource was updated.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Timestamp|null` |   |

### hasUpdateTime

### clearUpdateTime

### setUpdateTime

Output only. The timestamp when the resource was updated.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Timestamp` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getDescription

Optional. A human-readable description of the resource.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setDescription

Optional. A human-readable description of the resource.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getLabels

Optional. Set of labels associated with the `AuthzPolicy` resource.

The format must comply with [the following
requirements](https://docs.cloud.google.com/compute/docs/labeling-resources#requirements).

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Internal/MapField` |   |

### setLabels

Optional. Set of labels associated with the `AuthzPolicy` resource.

The format must comply with [the following
requirements](https://docs.cloud.google.com/compute/docs/labeling-resources#requirements).

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `array|https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Internal/MapField` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getTarget

Required. Specifies the set of resources to which this policy should be
applied to.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-network-security/latest/V1.AuthzPolicy.Target|null` |   |

### hasTarget

### clearTarget

### setTarget

Required. Specifies the set of resources to which this policy should be
applied to.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/cloud-network-security/latest/V1.AuthzPolicy.Target` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getHttpRules

Optional. A list of authorization HTTP rules to match against the incoming
request. A policy match occurs when at least one HTTP rule matches the
request or when no HTTP rules are specified in the policy.

At least one HTTP Rule is required for Allow or Deny Action. Limited
to 5 rules.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/RepeatedField<https://docs.cloud.google.com/php/docs/reference/cloud-network-security/latest/V1.AuthzPolicy.AuthzRule>` |   |

### setHttpRules

Optional. A list of authorization HTTP rules to match against the incoming
request. A policy match occurs when at least one HTTP rule matches the
request or when no HTTP rules are specified in the policy.

At least one HTTP Rule is required for Allow or Deny Action. Limited
to 5 rules.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `array<https://docs.cloud.google.com/php/docs/reference/cloud-network-security/latest/V1.AuthzPolicy.AuthzRule>` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getNetworkRules

Optional. A list of authorization network rules to match against the
incoming request. A policy match occurs when at least one network rule
matches the request.

At least one network rule is required for Allow or Deny Action if no HTTP
rules are provided. Network rules are mutually exclusive with HTTP rules.
Limited to 5 rules.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/RepeatedField<https://docs.cloud.google.com/php/docs/reference/cloud-network-security/latest/V1.AuthzPolicy.AuthzRule>` |   |

### setNetworkRules

Optional. A list of authorization network rules to match against the
incoming request. A policy match occurs when at least one network rule
matches the request.

At least one network rule is required for Allow or Deny Action if no HTTP
rules are provided. Network rules are mutually exclusive with HTTP rules.
Limited to 5 rules.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `array<https://docs.cloud.google.com/php/docs/reference/cloud-network-security/latest/V1.AuthzPolicy.AuthzRule>` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getAction

Required. 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.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `int` | Enum of type [AuthzAction](https://docs.cloud.google.com/php/docs/reference/cloud-network-security/latest/V1.AuthzPolicy.AuthzAction). |

### setAction

Required. 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.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `int` Enum of type [AuthzAction](https://docs.cloud.google.com/php/docs/reference/cloud-network-security/latest/V1.AuthzPolicy.AuthzAction). |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getCustomProvider

Optional. Required if the action is `CUSTOM`. Allows delegating
authorization decisions to Cloud IAP or to Service Extensions. One of
`cloudIap` or `authzExtension` must be specified.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-network-security/latest/V1.AuthzPolicy.CustomProvider|null` |   |

### hasCustomProvider

### clearCustomProvider

### setCustomProvider

Optional. Required if the action is `CUSTOM`. Allows delegating
authorization decisions to Cloud IAP or to Service Extensions. One of
`cloudIap` or `authzExtension` must be specified.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/cloud-network-security/latest/V1.AuthzPolicy.CustomProvider` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getPolicyProfile

Optional. Immutable. Defines the type of authorization being performed.

If not specified, `REQUEST_AUTHZ` is applied. This field cannot be changed
once AuthzPolicy is created.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `int` | Enum of type [PolicyProfile](https://docs.cloud.google.com/php/docs/reference/cloud-network-security/latest/V1.AuthzPolicy.PolicyProfile). |

### setPolicyProfile

Optional. Immutable. Defines the type of authorization being performed.

If not specified, `REQUEST_AUTHZ` is applied. This field cannot be changed
once AuthzPolicy is created.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `int` Enum of type [PolicyProfile](https://docs.cloud.google.com/php/docs/reference/cloud-network-security/latest/V1.AuthzPolicy.PolicyProfile). |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |