mirror of
https://github.com/microsoft/onefuzz.git
synced 2025-06-16 11:58:09 +00:00
use the primitive types in more places (#514)
This commit is contained in:
@ -16,7 +16,7 @@ from azure.mgmt.subscription import SubscriptionClient
|
||||
from memoization import cached
|
||||
from msrestazure.azure_active_directory import MSIAuthentication
|
||||
from msrestazure.tools import parse_resource_id
|
||||
from onefuzztypes.primitives import Container
|
||||
from onefuzztypes.primitives import Container, Region
|
||||
|
||||
from .monkeypatch import allow_more_workers, reduce_logging
|
||||
|
||||
@ -41,12 +41,12 @@ def get_base_resource_group() -> Any: # should be str
|
||||
|
||||
|
||||
@cached
|
||||
def get_base_region() -> Any: # should be str
|
||||
def get_base_region() -> Region:
|
||||
client = ResourceManagementClient(
|
||||
credential=get_identity(), subscription_id=get_subscription()
|
||||
)
|
||||
group = client.resource_groups.get(get_base_resource_group())
|
||||
return group.location
|
||||
return Region(group.location)
|
||||
|
||||
|
||||
@cached
|
||||
@ -89,11 +89,11 @@ DAY_IN_SECONDS = 60 * 60 * 24
|
||||
|
||||
|
||||
@cached(ttl=DAY_IN_SECONDS)
|
||||
def get_regions() -> List[str]:
|
||||
def get_regions() -> List[Region]:
|
||||
subscription = get_subscription()
|
||||
client = SubscriptionClient(credential=get_identity())
|
||||
locations = client.subscriptions.list_locations(subscription)
|
||||
return sorted([x.name for x in locations])
|
||||
return sorted([Region(x.name) for x in locations])
|
||||
|
||||
|
||||
@cached
|
||||
|
Reference in New Issue
Block a user