# Interface AllocationPolicy.LocationPolicyOrBuilder (0.16.0)

<button class="button button-with-icon cloud-select-dropdown__button " aria-haspopup="true">Version latest</button>

- [0.16.0 (latest)](https://docs.cloud.google.com/java/docs/reference/google-cloudevent-types/latest/com.google.events.cloud.batch.v1.AllocationPolicy.LocationPolicyOrBuilder)
- [0.15.0](https://docs.cloud.google.com/java/docs/reference/google-cloudevent-types/0.15.0/com.google.events.cloud.batch.v1.AllocationPolicy.LocationPolicyOrBuilder)
- [0.14.1](https://docs.cloud.google.com/java/docs/reference/google-cloudevent-types/0.14.1/com.google.events.cloud.batch.v1.AllocationPolicy.LocationPolicyOrBuilder)

    public static interface AllocationPolicy.LocationPolicyOrBuilder extends MessageOrBuilder

## Implements

[MessageOrBuilder](https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.MessageOrBuilder.html)

## Methods

### getAllowedLocations(int index)

    public abstract String getAllowedLocations(int index)

A list of allowed location names represented by internal URLs.
Each location can be a region or a zone.
Only one region or multiple zones in one region is supported now.
For example,
\["regions/us-central1"\] allow VMs in any zones in region us-central1.
\["zones/us-central1-a", "zones/us-central1-c"\] only allow VMs
in zones us-central1-a and us-central1-c.
All locations end up in different regions would cause errors.
For example,
\["regions/us-central1", "zones/us-central1-a", "zones/us-central1-b",
"zones/us-west1-a"\] contains 2 regions "us-central1" and
"us-west1". An error is expected in this case.

`repeated string allowed_locations = 1;`

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `index` | `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` The index of the element to return. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` | The allowedLocations at the given index. |

### getAllowedLocationsBytes(int index)

    public abstract ByteString getAllowedLocationsBytes(int index)

A list of allowed location names represented by internal URLs.
Each location can be a region or a zone.
Only one region or multiple zones in one region is supported now.
For example,
\["regions/us-central1"\] allow VMs in any zones in region us-central1.
\["zones/us-central1-a", "zones/us-central1-c"\] only allow VMs
in zones us-central1-a and us-central1-c.
All locations end up in different regions would cause errors.
For example,
\["regions/us-central1", "zones/us-central1-a", "zones/us-central1-b",
"zones/us-west1-a"\] contains 2 regions "us-central1" and
"us-west1". An error is expected in this case.

`repeated string allowed_locations = 1;`

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `index` | `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` The index of the value to return. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.ByteString.html` | The bytes of the allowedLocations at the given index. |

### getAllowedLocationsCount()

    public abstract int getAllowedLocationsCount()

A list of allowed location names represented by internal URLs.
Each location can be a region or a zone.
Only one region or multiple zones in one region is supported now.
For example,
\["regions/us-central1"\] allow VMs in any zones in region us-central1.
\["zones/us-central1-a", "zones/us-central1-c"\] only allow VMs
in zones us-central1-a and us-central1-c.
All locations end up in different regions would cause errors.
For example,
\["regions/us-central1", "zones/us-central1-a", "zones/us-central1-b",
"zones/us-west1-a"\] contains 2 regions "us-central1" and
"us-west1". An error is expected in this case.

`repeated string allowed_locations = 1;`

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` | The count of allowedLocations. |

### getAllowedLocationsList()

    public abstract List<String> getAllowedLocationsList()

A list of allowed location names represented by internal URLs.
Each location can be a region or a zone.
Only one region or multiple zones in one region is supported now.
For example,
\["regions/us-central1"\] allow VMs in any zones in region us-central1.
\["zones/us-central1-a", "zones/us-central1-c"\] only allow VMs
in zones us-central1-a and us-central1-c.
All locations end up in different regions would cause errors.
For example,
\["regions/us-central1", "zones/us-central1-a", "zones/us-central1-b",
"zones/us-west1-a"\] contains 2 regions "us-central1" and
"us-west1". An error is expected in this case.

`repeated string allowed_locations = 1;`

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/util/List.html<https://docs.oracle.com/javase/8/docs/api/java/lang/String.html>` | A list containing the allowedLocations. |