# Google Cloud Network Services V1 Client - Class MetadataLabelMatcher (0.8.2)

0.8.2 (latest) 0.8.1 0.7.1 0.6.1 0.5.0 0.4.0 0.3.0 0.2.3 0.1.1 Reference documentation and code samples for the Google Cloud Network Services V1 Client class MetadataLabelMatcher.

The matcher that is based on node metadata presented by xDS clients.

Generated from protobuf message `google.cloud.networkservices.v1.EndpointMatcher.MetadataLabelMatcher`

## Namespace

Google \\ Cloud \\ NetworkServices \\ V1 \\ EndpointMatcher

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ metadata_label_match_criteria` | `int` Specifies how matching should be done. Supported values are: MATCH_ANY: At least one of the Labels specified in the matcher should match the metadata presented by xDS client. MATCH_ALL: The metadata presented by the xDS client should contain all of the labels specified here. The selection is determined based on the best match. For example, suppose there are three EndpointPolicy resources P1, P2 and P3 and if P1 has a the matcher as MATCH_ANY \<A:1, B:1\>, P2 has MATCH_ALL \<A:1,B:1\>, and P3 has MATCH_ALL \<A:1,B:1,C:1\>. If a client with label \<A:1\> connects, the config from P1 will be selected. If a client with label \<A:1,B:1\> connects, the config from P2 will be selected. If a client with label \<A:1,B:1,C:1\> connects, the config from P3 will be selected. If there is more than one best match, (for example, if a config P4 with selector \<A:1,D:1\> exists and if a client with label \<A:1,B:1,D:1\> connects), pick up the one with older creation time. |
| `↳ metadata_labels` | `array<https://docs.cloud.google.com/php/docs/reference/cloud-networkservices/latest/V1.EndpointMatcher.MetadataLabelMatcher.MetadataLabels>` The list of label value pairs that must match labels in the provided metadata based on filterMatchCriteria This list can have at most 64 entries. The list can be empty if the match criteria is MATCH_ANY, to specify a wildcard match (i.e this matches any client). |

### getMetadataLabelMatchCriteria

Specifies how matching should be done.

Supported values are:
MATCH_ANY: At least one of the Labels specified in the
matcher should match the metadata presented by xDS client.
MATCH_ALL: The metadata presented by the xDS client should
contain all of the labels specified here.
The selection is determined based on the best match. For
example, suppose there are three EndpointPolicy
resources P1, P2 and P3 and if P1 has a the matcher as
MATCH_ANY \<A:1, B:1\>, P2 has MATCH_ALL \<A:1,B:1\>, and P3 has
MATCH_ALL \<A:1,B:1,C:1\>.
If a client with label \<A:1\> connects, the config from P1
will be selected.
If a client with label \<A:1,B:1\> connects, the config from P2
will be selected.
If a client with label \<A:1,B:1,C:1\> connects, the config
from P3 will be selected.
If there is more than one best match, (for example, if a
config P4 with selector \<A:1,D:1\> exists and if a client with
label \<A:1,B:1,D:1\> connects), pick up the one with older creation time.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `int` | Enum of type [MetadataLabelMatchCriteria](https://docs.cloud.google.com/php/docs/reference/cloud-networkservices/latest/V1.EndpointMatcher.MetadataLabelMatcher.MetadataLabelMatchCriteria). |

### setMetadataLabelMatchCriteria

Specifies how matching should be done.

Supported values are:
MATCH_ANY: At least one of the Labels specified in the
matcher should match the metadata presented by xDS client.
MATCH_ALL: The metadata presented by the xDS client should
contain all of the labels specified here.
The selection is determined based on the best match. For
example, suppose there are three EndpointPolicy
resources P1, P2 and P3 and if P1 has a the matcher as
MATCH_ANY \<A:1, B:1\>, P2 has MATCH_ALL \<A:1,B:1\>, and P3 has
MATCH_ALL \<A:1,B:1,C:1\>.
If a client with label \<A:1\> connects, the config from P1
will be selected.
If a client with label \<A:1,B:1\> connects, the config from P2
will be selected.
If a client with label \<A:1,B:1,C:1\> connects, the config
from P3 will be selected.
If there is more than one best match, (for example, if a
config P4 with selector \<A:1,D:1\> exists and if a client with
label \<A:1,B:1,D:1\> connects), pick up the one with older creation time.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `int` Enum of type [MetadataLabelMatchCriteria](https://docs.cloud.google.com/php/docs/reference/cloud-networkservices/latest/V1.EndpointMatcher.MetadataLabelMatcher.MetadataLabelMatchCriteria). |

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

### getMetadataLabels

The list of label value pairs that must match labels in the
provided metadata based on filterMatchCriteria This list can
have at most 64 entries. The list can be empty if the match
criteria is MATCH_ANY, to specify a wildcard match (i.e this
matches any client).

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/RepeatedField<https://docs.cloud.google.com/php/docs/reference/cloud-networkservices/latest/V1.EndpointMatcher.MetadataLabelMatcher.MetadataLabels>` |   |

### setMetadataLabels

The list of label value pairs that must match labels in the
provided metadata based on filterMatchCriteria This list can
have at most 64 entries. The list can be empty if the match
criteria is MATCH_ANY, to specify a wildcard match (i.e this
matches any client).

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `array<https://docs.cloud.google.com/php/docs/reference/cloud-networkservices/latest/V1.EndpointMatcher.MetadataLabelMatcher.MetadataLabels>` |

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