# Google Cloud Network Security V1 Client - Class Rule (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 Rule.

Specification of rules.

Generated from protobuf message `google.cloud.networksecurity.v1.AuthorizationPolicy.Rule`

## Namespace

Google \\ Cloud \\ NetworkSecurity \\ V1 \\ AuthorizationPolicy

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ sources` | `array<https://docs.cloud.google.com/php/docs/reference/cloud-network-security/latest/V1.AuthorizationPolicy.Rule.Source>` Optional. List of attributes for the traffic source. All of the sources must match. A source is a match if both principals and ip_blocks match. If not set, the action specified in the 'action' field will be applied without any rule checks for the source. |
| `↳ destinations` | `array<https://docs.cloud.google.com/php/docs/reference/cloud-network-security/latest/V1.AuthorizationPolicy.Rule.Destination>` Optional. List of attributes for the traffic destination. All of the destinations must match. A destination is a match if a request matches all the specified hosts, ports, methods and headers. If not set, the action specified in the 'action' field will be applied without any rule checks for the destination. |

### getSources

Optional. List of attributes for the traffic source. All of the sources
must match. A source is a match if both principals and ip_blocks match.

If not set, the action specified in the 'action' field will be applied
without any rule checks for the source.

| **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.AuthorizationPolicy.Rule.Source>` |   |

### setSources

Optional. List of attributes for the traffic source. All of the sources
must match. A source is a match if both principals and ip_blocks match.

If not set, the action specified in the 'action' field will be applied
without any rule checks for the source.

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

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

### getDestinations

Optional. List of attributes for the traffic destination. All of the
destinations must match. A destination is a match if a request matches
all the specified hosts, ports, methods and headers. If not set, the
action specified in the 'action' field will be applied without any rule
checks for the destination.

| **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.AuthorizationPolicy.Rule.Destination>` |   |

### setDestinations

Optional. List of attributes for the traffic destination. All of the
destinations must match. A destination is a match if a request matches
all the specified hosts, ports, methods and headers. If not set, the
action specified in the 'action' field will be applied without any rule
checks for the destination.

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

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