## Resource: Traffic

Controls traffic configuration for the backend.

| JSON representation |
|---|
| ``` { "name": string, "current": { object (`https://firebase.google.com/docs/reference/apphosting/rest/v1/projects.locations.backends.traffic#TrafficSet`) }, "reconciling": boolean, "createTime": string, "updateTime": string, "labels": { string: string, ... }, "annotations": { string: string, ... }, "etag": string, "uid": string, // Union field `traffic_management` can be only one of the following: "target": { object (`https://firebase.google.com/docs/reference/apphosting/rest/v1/projects.locations.backends.traffic#TrafficSet`) }, "rolloutPolicy": { object (`https://firebase.google.com/docs/reference/apphosting/rest/v1/projects.locations.backends.traffic#RolloutPolicy`) } // End of list of possible types for union field `traffic_management`. } ``` |

| Fields ||
|---|---|
| `name` | `string` Identifier. The resource name of the backend's traffic. Format: `projects/{project}/locations/{locationId}/backends/{backendId}/traffic`. |
| `current` | ``object (`https://firebase.google.com/docs/reference/apphosting/rest/v1/projects.locations.backends.traffic#TrafficSet`)`` Output only. Current state of traffic allocation for the backend. When setting `target`, this field may differ for some time until the desired state is reached. |
| `reconciling` | `boolean` Output only. A field that, if true, indicates that the system is working to make the backend's `current` match the requested `target` list. |
| `createTime` | ``string (`https://protobuf.dev/reference/protobuf/google.protobuf#timestamp` format)`` Output only. Time at which the backend was created. Uses RFC 3339, where generated output will always be Z-normalized and use 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: `"2014-10-02T15:01:23Z"`, `"2014-10-02T15:01:23.045123456Z"` or `"2014-10-02T15:01:23+05:30"`. |
| `updateTime` | ``string (`https://protobuf.dev/reference/protobuf/google.protobuf#timestamp` format)`` Output only. Time at which the backend was last updated. Uses RFC 3339, where generated output will always be Z-normalized and use 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: `"2014-10-02T15:01:23Z"`, `"2014-10-02T15:01:23.045123456Z"` or `"2014-10-02T15:01:23+05:30"`. |
| `labels` | `map (key: string, value: string)` Optional. Unstructured key value map that can be used to organize and categorize objects. An object containing a list of `"key": value` pairs. Example: `{ "name": "wrench", "mass": "1.3kg", "count": "3" }`. |
| `annotations` | `map (key: string, value: string)` Optional. Unstructured key value map that may be set by external tools to store and arbitrary metadata. They are not queryable and should be preserved when modifying objects. An object containing a list of `"key": value` pairs. Example: `{ "name": "wrench", "mass": "1.3kg", "count": "3" }`. |
| `etag` | `string` Output only. Server-computed checksum based on other values; may be sent on update or delete to ensure operation is done on expected resource. |
| `uid` | `string` Output only. System-assigned, unique identifier. |
| Union field `traffic_management`. `traffic_management` can be only one of the following: ||
| `target` | ``object (`https://firebase.google.com/docs/reference/apphosting/rest/v1/projects.locations.backends.traffic#TrafficSet`)`` Set to manually control the desired traffic for the backend. This will cause `current` to eventually match this value. The percentages must add up to 100%. |
| `rolloutPolicy` | ``object (`https://firebase.google.com/docs/reference/apphosting/rest/v1/projects.locations.backends.traffic#RolloutPolicy`)`` A rollout policy specifies how new builds and automatic deployments are created. |

## TrafficSet

A list of traffic splits that together represent where traffic is being routed.

| JSON representation |
|---|
| ``` { "splits": [ { object (`https://firebase.google.com/docs/reference/apphosting/rest/v1/projects.locations.backends.traffic#TrafficSplit`) } ] } ``` |

| Fields ||
|---|---|
| `splits[]` | ``object (`https://firebase.google.com/docs/reference/apphosting/rest/v1/projects.locations.backends.traffic#TrafficSplit`)`` Required. The list of traffic splits. |

## TrafficSplit

The traffic allocation for the backend.

| JSON representation |
|---|
| ``` { "build": string, "percent": integer } ``` |

| Fields ||
|---|---|
| `build` | `string` Required. The build that traffic is being routed to. |
| `percent` | `integer` Required. The percentage of traffic to send to the build. Currently must be 100% or 0%. |

## RolloutPolicy

The policy for how automatic builds and rollouts are triggered and rolled out.

| JSON representation |
|---|
| ``` { "disabled": boolean, "disabledTime": string, "requiredPaths": [ { object (`https://firebase.google.com/docs/reference/apphosting/rest/v1/projects.locations.backends.traffic#Path`) } ], "ignoredPaths": [ { object (`https://firebase.google.com/docs/reference/apphosting/rest/v1/projects.locations.backends.traffic#Path`) } ], // Union field `trigger` can be only one of the following: "codebaseBranch": string // End of list of possible types for union field `trigger`. } ``` |

| Fields ||
|---|---|
| `disabled` | `boolean` Optional. A flag that, if true, prevents automatic rollouts from being created via this RolloutPolicy. |
| `disabledTime` | ``string (`https://protobuf.dev/reference/protobuf/google.protobuf#timestamp` format)`` Output only. If `disabled` is set, the time at which the automatic rollouts were disabled. Uses RFC 3339, where generated output will always be Z-normalized and use 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: `"2014-10-02T15:01:23Z"`, `"2014-10-02T15:01:23.045123456Z"` or `"2014-10-02T15:01:23+05:30"`. |
| `requiredPaths[]` | ``object (`https://firebase.google.com/docs/reference/apphosting/rest/v1/projects.locations.backends.traffic#Path`)`` Optional. A list of file paths patterns that trigger a build and rollout if at least one of the changed files in the commit are present in this list. This field is optional; the rollout policy will default to triggering on all paths if both ignoredPaths and requiredPaths are not populated. Limited to 100 paths. Example: requiredPaths: { pattern: "foo/bar/*", type: "GLOB" } |
| `ignoredPaths[]` | ``object (`https://firebase.google.com/docs/reference/apphosting/rest/v1/projects.locations.backends.traffic#Path`)`` Optional. A list of file paths patterns to exclude from triggering a rollout. Patterns in this list take precedence over requiredPaths. **Note**: All paths must be in the ignoredPaths in order for the rollout to be skipped. Limited to 100 paths. Example: ignoredPaths: { pattern: "foo/bar/excluded/*", type: "GLOB" } |
| Union field `trigger`. Specifies the type of codebase event that can trigger a new build. `trigger` can be only one of the following: ||
| `codebaseBranch` | `string` If set, specifies a branch that triggers a new build to be started with this policy. Otherwise, no automatic rollouts will happen. |

## Path

A file path pattern to match against.

| JSON representation |
|---|
| ``` { "pattern": string, "type": enum (`https://firebase.google.com/docs/reference/apphosting/rest/v1/projects.locations.backends.traffic#Path.PatternType`) } ``` |

| Fields ||
|---|---|
| `pattern` | `string` Optional. The pattern to match against. |
| `type` | ``enum (`https://firebase.google.com/docs/reference/apphosting/rest/v1/projects.locations.backends.traffic#Path.PatternType`)`` Optional. The type of pattern to match against. |

## Path.PatternType

The possible types of path patterns.

| Enums ||
|---|---|
| `PATTERN_TYPE_UNSPECIFIED` | The pattern type is unspecified - this is an invalid value. |
| `RE2` | RE2 - regular expression (<https://github.com/google/re2/wiki/Syntax)>. |
| `GLOB` | The pattern is a glob. |
| `PREFIX` | The pattern is a prefix. |

| ## Methods ||
|---|---|
| ### `https://firebase.google.com/docs/reference/apphosting/rest/v1/projects.locations.backends.traffic/get` | Gets information about a backend's traffic. |
| ### `https://firebase.google.com/docs/reference/apphosting/rest/v1/projects.locations.backends.traffic/patch` | Updates a backend's traffic. |