# Method: getEffectivePolicy

- [HTTP request](https://docs.cloud.google.com/service-usage/docs/reference/rest/v2beta/TopLevel/getEffectivePolicy#body.HTTP_TEMPLATE)
- [Path parameters](https://docs.cloud.google.com/service-usage/docs/reference/rest/v2beta/TopLevel/getEffectivePolicy#body.PATH_PARAMETERS)
- [Query parameters](https://docs.cloud.google.com/service-usage/docs/reference/rest/v2beta/TopLevel/getEffectivePolicy#body.QUERY_PARAMETERS)
- [Request body](https://docs.cloud.google.com/service-usage/docs/reference/rest/v2beta/TopLevel/getEffectivePolicy#body.request_body)
- [Response body](https://docs.cloud.google.com/service-usage/docs/reference/rest/v2beta/TopLevel/getEffectivePolicy#body.response_body)
  - [JSON representation](https://docs.cloud.google.com/service-usage/docs/reference/rest/v2beta/TopLevel/getEffectivePolicy#body.EffectivePolicy.SCHEMA_REPRESENTATION)
- [Authorization scopes](https://docs.cloud.google.com/service-usage/docs/reference/rest/v2beta/TopLevel/getEffectivePolicy#body.aspect)
- [EffectivePolicyView](https://docs.cloud.google.com/service-usage/docs/reference/rest/v2beta/TopLevel/getEffectivePolicy#EffectivePolicyView)
- [RuleSource](https://docs.cloud.google.com/service-usage/docs/reference/rest/v2beta/TopLevel/getEffectivePolicy#RuleSource)
  - [JSON representation](https://docs.cloud.google.com/service-usage/docs/reference/rest/v2beta/TopLevel/getEffectivePolicy#RuleSource.SCHEMA_REPRESENTATION)
- [PolicyList](https://docs.cloud.google.com/service-usage/docs/reference/rest/v2beta/TopLevel/getEffectivePolicy#PolicyList)
  - [JSON representation](https://docs.cloud.google.com/service-usage/docs/reference/rest/v2beta/TopLevel/getEffectivePolicy#PolicyList.SCHEMA_REPRESENTATION)

Get effective consumer policy for a resource, which contains enable rule information of consumer policies from the resource hierarchy.

### HTTP request

`GET https://serviceusage.googleapis.com/v2beta/{name=*/*/effectivePolicy}`

The URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.

### Path parameters

| Parameters ||
|---|---|
| `name` | `string` Required. The name of the effective policy to retrieve. Format: `projects/100/effectivePolicy`, `folders/101/effectivePolicy`, `organizations/102/effectivePolicy`. |

### Query parameters

| Parameters ||
|---|---|
| `view` | ``enum (`https://docs.cloud.google.com/service-usage/docs/reference/rest/v2beta/TopLevel/getEffectivePolicy#EffectivePolicyView`)`` The view of the effective policy to use. |

### Request body

The request body must be empty.

### Response body

Effective Policy is a singleton read-only resource modeling the collapsed policies and metadata effective at a particular point in the hierarchy.

If successful, the response body contains data with the following structure:

| JSON representation |
|---|
| ``` { "name": string, "updateTime": string, "enableRules": [ { object (`https://docs.cloud.google.com/service-usage/docs/reference/rest/v2beta/EnableRule`) } ], "enableRuleMetadata": [ { object (`https://docs.cloud.google.com/service-usage/docs/reference/rest/v2beta/TopLevel/getEffectivePolicy#RuleSource`) } ] } ``` |

| Fields ||
|---|---|
| `name` | `string` Output only. The name of the effective policy. Format: `projects/100/effectivePolicy`, `folders/101/effectivePolicy`, `organizations/102/effectivePolicy`. |
| `updateTime` | ``string (`https://protobuf.dev/reference/protobuf/google.protobuf#timestamp` format)`` Output only. The time the policy 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"`. |
| `enableRules[]` | ``object (`https://docs.cloud.google.com/service-usage/docs/reference/rest/v2beta/EnableRule`)`` Output only. Aggregated `EnableRule` objects grouped by any associated conditions. Conditions are not supported in `beta` and there will be exactly one rule present. |
| `enableRuleMetadata[]` | ``object (`https://docs.cloud.google.com/service-usage/docs/reference/rest/v2beta/TopLevel/getEffectivePolicy#RuleSource`)`` Output only. Metadata about enable rules in the same order as the `enableRules` objects. |

### Authorization scopes

Requires one of the following OAuth scopes:

- `https://www.googleapis.com/auth/cloud-platform.read-only`
- `https://www.googleapis.com/auth/cloud-platform`

For more information, see the [Authentication Overview](https://docs.cloud.google.com/docs/authentication#authorization-gcp).

## EffectivePolicyView

The view of the effective policy.

| Enums ||
|---|---|
| `EFFECTIVE_POLICY_VIEW_UNSPECIFIED` | The default / unset value. The API will default to the BASIC view. |
| `EFFECTIVE_POLICY_VIEW_BASIC` | Include basic metadata about the effective policy, but not the source of policy rules. This is the default value. |
| `EFFECTIVE_POLICY_VIEW_FULL` | Include everything. |

## RuleSource

`RuleSource` contains source information for where a rule was found.

| JSON representation |
|---|
| ``` { "serviceSources": { string: { object (`https://docs.cloud.google.com/service-usage/docs/reference/rest/v2beta/TopLevel/getEffectivePolicy#PolicyList`) }, ... } } ``` |

| Fields ||
|---|---|
| `serviceSources` | ``map (key: string, value: object (`https://docs.cloud.google.com/service-usage/docs/reference/rest/v2beta/TopLevel/getEffectivePolicy#PolicyList`))`` Map of enabled services as keys and the policy that enabled it as values. For example, the key can be `services/serviceusage.googleapis.com` and value can be `{"projects/123/consumerPolicies/default", "folders/456/consumerPolicies/default"}` where the service is enabled and the order of the resource list is nearest first in the hierarchy. An object containing a list of `"key": value` pairs. Example: `{ "name": "wrench", "mass": "1.3kg", "count": "3" }`. |

## PolicyList

`PolicyList` contains policy resources in the hierarchy ordered from leaf to root.

| JSON representation |
|---|
| ``` { "policies": [ string ] } ``` |

| Fields ||
|---|---|
| `policies[]` | `string` List of policy resources ordered from leaf to root. |