blob: 2a8e8053e31789987347d27976800946e77d2185 (
about) (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
# ---------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# ---------------------------------------------------------
import logging
from typing import Optional
from azure.ai.ml._azure_environments import _get_base_url_from_metadata
from azure.ai.ml._vendor.azure_resources._resource_management_client import ResourceManagementClient
from azure.ai.ml._vendor.azure_resources.operations import DeploymentsOperations
from azure.ai.ml.constants._common import ArmConstants
from azure.core.credentials import TokenCredential
module_logger = logging.getLogger(__name__)
def get_deployments_operation(credentials: TokenCredential, subscription_id: str) -> Optional[DeploymentsOperations]:
if subscription_id is None:
return None
client = ResourceManagementClient(
credential=credentials,
subscription_id=subscription_id,
base_url=_get_base_url_from_metadata(),
api_version=ArmConstants.AZURE_MGMT_RESOURCE_API_VERSION,
)
return client.deployments
|