# Google Cloud Billing Budgets V1 Client - Class Filter (2.1.2)

2.1.2 (latest) 2.1.1 2.0.5 1.4.5 1.3.1 1.2.2 1.1.0 1.0.5 Reference documentation and code samples for the Google Cloud Billing Budgets V1 Client class Filter.

A filter for a budget, limiting the scope of the cost to calculate.

Generated from protobuf message `google.cloud.billing.budgets.v1.Filter`

## Namespace

Google \\ Cloud \\ Billing \\ Budgets \\ V1

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ projects` | `string[]` Optional. A set of projects of the form `projects/{project}`, specifying that usage from only this set of projects should be included in the budget. If omitted, the report includes all usage for the billing account, regardless of which project the usage occurred on. |
| `↳ resource_ancestors` | `string[]` Optional. A set of folder and organization names of the form `folders/{folderId}` or `organizations/{organizationId}`, specifying that usage from only this set of folders and organizations should be included in the budget. If omitted, the budget includes all usage that the billing account pays for. If the folder or organization contains projects that are paid for by a different Cloud Billing account, the budget *doesn't* apply to those projects. |
| `↳ credit_types` | `string[]` Optional. If [Filter.credit_types_treatment](https://docs.cloud.google.com/php/docs/reference/cloud-billing-budgets/latest/V1.Filter#_Google_Cloud_Billing_Budgets_V1_Filter__getCreditTypesTreatment__) is INCLUDE_SPECIFIED_CREDITS, this is a list of credit types to be subtracted from gross cost to determine the spend for threshold calculations. See [a list of acceptable credit type values](https://cloud.google.com/billing/docs/how-to/export-data-bigquery-tables#credits-type). If [Filter.credit_types_treatment](https://docs.cloud.google.com/php/docs/reference/cloud-billing-budgets/latest/V1.Filter#_Google_Cloud_Billing_Budgets_V1_Filter__getCreditTypesTreatment__) is **not** INCLUDE_SPECIFIED_CREDITS, this field must be empty. |
| `↳ credit_types_treatment` | `int` Optional. If not set, default behavior is `INCLUDE_ALL_CREDITS`. |
| `↳ services` | `string[]` Optional. A set of services of the form `services/{service_id}`, specifying that usage from only this set of services should be included in the budget. If omitted, the report includes usage for all the services. The service names are available through the Catalog API: <https://cloud.google.com/billing/v1/how-tos/catalog-api>. |
| `↳ subaccounts` | `string[]` Optional. A set of subaccounts of the form `billingAccounts/{account_id}`, specifying that usage from only this set of subaccounts should be included in the budget. If a subaccount is set to the name of the parent account, usage from the parent account is included. If the field is omitted, the report includes usage from the parent account and all subaccounts, if they exist. |
| `↳ labels` | `array|https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Internal/MapField` Optional. A single label and value pair specifying that usage from only this set of labeled resources should be included in the budget. If omitted, the report includes all labeled and unlabeled usage. An object containing a single `"key": value` pair. Example: `{ "name": "wrench" }`. *Currently, multiple entries or multiple values per entry are not allowed.* |
| `↳ calendar_period` | `int` Optional. Specifies to track usage for recurring calendar period. For example, assume that CalendarPeriod.QUARTER is set. The budget tracks usage from April 1 to June 30, when the current calendar month is April, May, June. After that, it tracks usage from July 1 to September 30 when the current calendar month is July, August, September, so on. |
| `↳ custom_period` | `https://docs.cloud.google.com/php/docs/reference/cloud-billing-budgets/latest/V1.CustomPeriod` Optional. Specifies to track usage from any start date (required) to any end date (optional). This time period is static, it does not recur. |

### getProjects

Optional. A set of projects of the form `projects/{project}`,
specifying that usage from only this set of projects should be
included in the budget. If omitted, the report includes all usage for
the billing account, regardless of which project the usage occurred on.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/RepeatedField<string>` |   |

### setProjects

Optional. A set of projects of the form `projects/{project}`,
specifying that usage from only this set of projects should be
included in the budget. If omitted, the report includes all usage for
the billing account, regardless of which project the usage occurred on.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string[]` |

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

### getResourceAncestors

Optional. A set of folder and organization names of the form
`folders/{folderId}` or `organizations/{organizationId}`, specifying that
usage from only this set of folders and organizations should be included in
the budget. If omitted, the budget includes all usage that the billing
account pays for. If the folder or organization contains projects that are
paid for by a different Cloud Billing account, the budget *doesn't* apply
to those projects.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/RepeatedField<string>` |   |

### setResourceAncestors

Optional. A set of folder and organization names of the form
`folders/{folderId}` or `organizations/{organizationId}`, specifying that
usage from only this set of folders and organizations should be included in
the budget. If omitted, the budget includes all usage that the billing
account pays for. If the folder or organization contains projects that are
paid for by a different Cloud Billing account, the budget *doesn't* apply
to those projects.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string[]` |

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

### getCreditTypes

Optional. If
[Filter.credit_types_treatment](https://docs.cloud.google.com/php/docs/reference/cloud-billing-budgets/latest/V1.Filter#_Google_Cloud_Billing_Budgets_V1_Filter__getCreditTypesTreatment__)
is INCLUDE_SPECIFIED_CREDITS, this is a list of credit types to be
subtracted from gross cost to determine the spend for threshold
calculations. See [a list of acceptable credit type
values](https://cloud.google.com/billing/docs/how-to/export-data-bigquery-tables#credits-type).

If
[Filter.credit_types_treatment](https://docs.cloud.google.com/php/docs/reference/cloud-billing-budgets/latest/V1.Filter#_Google_Cloud_Billing_Budgets_V1_Filter__getCreditTypesTreatment__)
is **not** INCLUDE_SPECIFIED_CREDITS, this field must be empty.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/RepeatedField<string>` |   |

### setCreditTypes

Optional. If
[Filter.credit_types_treatment](https://docs.cloud.google.com/php/docs/reference/cloud-billing-budgets/latest/V1.Filter#_Google_Cloud_Billing_Budgets_V1_Filter__getCreditTypesTreatment__)
is INCLUDE_SPECIFIED_CREDITS, this is a list of credit types to be
subtracted from gross cost to determine the spend for threshold
calculations. See [a list of acceptable credit type
values](https://cloud.google.com/billing/docs/how-to/export-data-bigquery-tables#credits-type).

If
[Filter.credit_types_treatment](https://docs.cloud.google.com/php/docs/reference/cloud-billing-budgets/latest/V1.Filter#_Google_Cloud_Billing_Budgets_V1_Filter__getCreditTypesTreatment__)
is **not** INCLUDE_SPECIFIED_CREDITS, this field must be empty.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string[]` |

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

### getCreditTypesTreatment

Optional. If not set, default behavior is `INCLUDE_ALL_CREDITS`.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `int` | Enum of type [CreditTypesTreatment](https://docs.cloud.google.com/php/docs/reference/cloud-billing-budgets/latest/V1.Filter.CreditTypesTreatment). |

### setCreditTypesTreatment

Optional. If not set, default behavior is `INCLUDE_ALL_CREDITS`.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `int` Enum of type [CreditTypesTreatment](https://docs.cloud.google.com/php/docs/reference/cloud-billing-budgets/latest/V1.Filter.CreditTypesTreatment). |

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

### getServices

Optional. A set of services of the form `services/{service_id}`,
specifying that usage from only this set of services should be
included in the budget. If omitted, the report includes usage for
all the services.

The service names are available through the Catalog API:
<https://cloud.google.com/billing/v1/how-tos/catalog-api>.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/RepeatedField<string>` |   |

### setServices

Optional. A set of services of the form `services/{service_id}`,
specifying that usage from only this set of services should be
included in the budget. If omitted, the report includes usage for
all the services.

The service names are available through the Catalog API:
<https://cloud.google.com/billing/v1/how-tos/catalog-api>.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string[]` |

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

### getSubaccounts

Optional. A set of subaccounts of the form `billingAccounts/{account_id}`,
specifying that usage from only this set of subaccounts should be included
in the budget. If a subaccount is set to the name of the parent account,
usage from the parent account is included. If the field is omitted,
the report includes usage from the parent account and all subaccounts,
if they exist.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/RepeatedField<string>` |   |

### setSubaccounts

Optional. A set of subaccounts of the form `billingAccounts/{account_id}`,
specifying that usage from only this set of subaccounts should be included
in the budget. If a subaccount is set to the name of the parent account,
usage from the parent account is included. If the field is omitted,
the report includes usage from the parent account and all subaccounts,
if they exist.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string[]` |

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

### getLabels

Optional. A single label and value pair specifying that usage from only
this set of labeled resources should be included in the budget. If omitted,
the report includes all labeled and unlabeled usage.

An object containing a single `"key": value` pair. Example: `{ "name":
"wrench" }`.
*Currently, multiple entries or multiple values per entry are not
allowed.*

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

### setLabels

Optional. A single label and value pair specifying that usage from only
this set of labeled resources should be included in the budget. If omitted,
the report includes all labeled and unlabeled usage.

An object containing a single `"key": value` pair. Example: `{ "name":
"wrench" }`.
*Currently, multiple entries or multiple values per entry are not
allowed.*

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

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

### getCalendarPeriod

Optional. Specifies to track usage for recurring calendar period.

For example, assume that CalendarPeriod.QUARTER is set. The budget
tracks usage from April 1 to June 30, when the current calendar month is
April, May, June. After that, it tracks usage from July 1 to
September 30 when the current calendar month is July, August, September,
so on.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `int` | Enum of type [CalendarPeriod](https://docs.cloud.google.com/php/docs/reference/cloud-billing-budgets/latest/V1.CalendarPeriod). |

### hasCalendarPeriod

### setCalendarPeriod

Optional. Specifies to track usage for recurring calendar period.

For example, assume that CalendarPeriod.QUARTER is set. The budget
tracks usage from April 1 to June 30, when the current calendar month is
April, May, June. After that, it tracks usage from July 1 to
September 30 when the current calendar month is July, August, September,
so on.

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

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

### getCustomPeriod

Optional. Specifies to track usage from any start date (required) to any
end date (optional). This time period is static, it does not recur.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-billing-budgets/latest/V1.CustomPeriod|null` |   |

### hasCustomPeriod

### setCustomPeriod

Optional. Specifies to track usage from any start date (required) to any
end date (optional). This time period is static, it does not recur.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/cloud-billing-budgets/latest/V1.CustomPeriod` |

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

### getUsagePeriod

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |