Skip to content

Commit e3852f6

Browse files
xiangyan99allenkim0129
authored andcommitted
Added get_arm_info (Azure#38018)
* Added get_arm_info * update * update * Update * Update release date * update
1 parent b214335 commit e3852f6

File tree

5 files changed

+37
-4
lines changed

5 files changed

+37
-4
lines changed

sdk/core/azure-core/CHANGELOG.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Release History
22

3-
## 1.32.0 (Unreleased)
3+
## 1.32.0 (2024-10-31)
44

55
### Features Added
66

sdk/core/azure-mgmt-core/CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Release History
22

3+
## 1.5.0 (2024-10-31)
4+
5+
### Features Added
6+
7+
- Added helper function `get_arm_endpoints` to get the ARM endpoint and credential scopes from the cloud setting.
8+
39
## 1.4.0 (2023-04-06)
410

511
### Features

sdk/core/azure-mgmt-core/azure/mgmt/core/_version.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@
99
# regenerated.
1010
# --------------------------------------------------------------------------
1111

12-
VERSION = "1.4.0"
12+
VERSION = "1.5.0"

sdk/core/azure-mgmt-core/azure/mgmt/core/tools.py

+28-1
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,10 @@
2323
# IN THE SOFTWARE.
2424
#
2525
# --------------------------------------------------------------------------
26-
from typing import Mapping, MutableMapping, Optional, Type, Union, cast
26+
from typing import Mapping, MutableMapping, Optional, Type, Union, cast, Dict, Any
2727
import re
2828
import logging
29+
from azure.core import AzureClouds
2930

3031

3132
_LOGGER = logging.getLogger(__name__)
@@ -217,3 +218,29 @@ def is_valid_resource_name(rname: str, exception_type: Optional[Type[BaseExcepti
217218
if exception_type:
218219
raise exception_type()
219220
return False
221+
222+
223+
def get_arm_endpoints(cloud_setting: AzureClouds) -> Dict[str, Any]:
224+
"""Get the ARM endpoint and ARM credential scopes for the given cloud setting.
225+
226+
:param cloud_setting: The cloud setting for which to get the ARM endpoint.
227+
:type cloud_setting: AzureClouds
228+
:return: The ARM endpoint and ARM credential scopes.
229+
:rtype: dict[str, Any]
230+
"""
231+
if cloud_setting == AzureClouds.AZURE_CHINA_CLOUD:
232+
return {
233+
"resource_manager": "https://management.chinacloudapi.cn",
234+
"credential_scopes": ["https://management.chinacloudapi.cn/.default"],
235+
}
236+
if cloud_setting == AzureClouds.AZURE_US_GOVERNMENT:
237+
return {
238+
"resource_manager": "https://management.usgovcloudapi.net/",
239+
"credential_scopes": ["https://management.core.usgovcloudapi.net/.default"],
240+
}
241+
if cloud_setting == AzureClouds.AZURE_PUBLIC_CLOUD:
242+
return {
243+
"resource_manager": "https://management.azure.com/",
244+
"credential_scopes": ["https://management.azure.com/.default"],
245+
}
246+
raise ValueError("Unknown cloud setting: {}".format(cloud_setting))

sdk/core/azure-mgmt-core/setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
"pytyped": ["py.typed"],
7070
},
7171
install_requires=[
72-
"azure-core>=1.29.0",
72+
"azure-core>=1.31.0",
7373
],
7474
python_requires=">=3.8",
7575
)

0 commit comments

Comments
 (0)