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

Describes the properties of a principal to be matched against.

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

## Namespace

Google \\ Cloud \\ NetworkSecurity \\ V1 \\ AuthzPolicy \\ AuthzRule

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ principal_selector` | `int` Optional. An enum to decide what principal value the principal rule will match against. If not specified, the PrincipalSelector is CLIENT_CERT_URI_SAN. |
| `↳ principal` | `https://docs.cloud.google.com/php/docs/reference/cloud-network-security/latest/V1.AuthzPolicy.AuthzRule.StringMatch` Required. A non-empty string whose value is matched against the principal value based on the principal_selector. Only exact match can be applied for CLIENT_CERT_URI_SAN, CLIENT_CERT_DNS_NAME_SAN, CLIENT_CERT_COMMON_NAME selectors. |

### getPrincipalSelector

Optional. An enum to decide what principal value the principal rule
will match against. If not specified, the PrincipalSelector is
CLIENT_CERT_URI_SAN.

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

### setPrincipalSelector

Optional. An enum to decide what principal value the principal rule
will match against. If not specified, the PrincipalSelector is
CLIENT_CERT_URI_SAN.

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

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

### getPrincipal

Required. A non-empty string whose value is matched against the
principal value based on the principal_selector. Only exact match can
be applied for CLIENT_CERT_URI_SAN, CLIENT_CERT_DNS_NAME_SAN,
CLIENT_CERT_COMMON_NAME selectors.

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

### hasPrincipal

### clearPrincipal

### setPrincipal

Required. A non-empty string whose value is matched against the
principal value based on the principal_selector. Only exact match can
be applied for CLIENT_CERT_URI_SAN, CLIENT_CERT_DNS_NAME_SAN,
CLIENT_CERT_COMMON_NAME selectors.

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

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