Skip to content

Commit

Permalink
Update google_cloud.py
Browse files Browse the repository at this point in the history
  • Loading branch information
viniciusdc authored Oct 9, 2024
1 parent 098eb42 commit 0218338
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/_nebari/provider/cloud/google_cloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,20 @@ def regions() -> Set[str]:

return {region.name for region in response}

@functools.lru_cache()
def instances(region: str) -> Set[str]:
"""Return a set of available compute instances in a region."""
credentials, project_id = load_credentials()
zones_client = compute_v1.services.region_zones.RegionZonesClient(
credentials=credentials
)
instances_client = compute_v1.InstancesClient(credentials=credentials)

return {
instance.machine_type.split("/")[-1]
for zone in zones_client.list(project=project_id, region=region)
for instance in instances_client.list(project=project_id, zone=zone.name)
}

@functools.lru_cache()
def kubernetes_versions(region: str) -> List[str]:
Expand Down

0 comments on commit 0218338

Please sign in to comment.