# Google Cloud Service Management V1 Client - Class TrafficPercentStrategy (2.2.0)

2.2.0 (latest) 2.1.2 2.0.5 1.3.5 1.2.2 1.1.1 1.0.6 Reference documentation and code samples for the Google Cloud Service Management V1 Client class TrafficPercentStrategy.

Strategy that specifies how clients of Google Service Controller want to
send traffic to use different config versions. This is generally
used by API proxy to split traffic based on your configured percentage for
each config version.

One example of how to gradually rollout a new service configuration using
this
strategy:
Day 1
Rollout {
id: "example.googleapis.com/rollout_20160206"
traffic_percent_strategy {
percentages: {
"example.googleapis.com/20160201": 70.00
"example.googleapis.com/20160206": 30.00
}
}
}
Day 2
Rollout {
id: "example.googleapis.com/rollout_20160207"
traffic_percent_strategy: {
percentages: {
"example.googleapis.com/20160206": 100.00
}
}
}

Generated from protobuf message `google.api.servicemanagement.v1.Rollout.TrafficPercentStrategy`

## Namespace

Google \\ Cloud \\ ServiceManagement \\ V1 \\ Rollout

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ percentages` | `array|https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Internal/MapField` Maps service configuration IDs to their corresponding traffic percentage. Key is the service configuration ID, Value is the traffic percentage which must be greater than 0.0 and the sum must equal to 100.0. |

### getPercentages

Maps service configuration IDs to their corresponding traffic percentage.

Key is the service configuration ID, Value is the traffic percentage
which must be greater than 0.0 and the sum must equal to 100.0.

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

### setPercentages

Maps service configuration IDs to their corresponding traffic percentage.

Key is the service configuration ID, Value is the traffic percentage
which must be greater than 0.0 and the sum must equal to 100.0.

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

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