Skip to content

Commit 559bff1

Browse files
authored
code and test (Azure#28593)
Co-authored-by: PythonSdkPipelines <PythonSdkPipelines>
1 parent 229d62f commit 559bff1

File tree

116 files changed

+11225
-3496
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

116 files changed

+11225
-3496
lines changed

sdk/resources/azure-mgmt-msi/CHANGELOG.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,21 @@
11
# Release History
22

3+
## 7.0.0 (2023-02-02)
4+
5+
### Features Added
6+
7+
- Model FederatedIdentityCredential has a new parameter system_data
8+
- Model Identity has a new parameter system_data
9+
- Model IdentityUpdate has a new parameter system_data
10+
- Model ProxyResource has a new parameter system_data
11+
- Model Resource has a new parameter system_data
12+
- Model SystemAssignedIdentity has a new parameter system_data
13+
- Model TrackedResource has a new parameter system_data
14+
15+
### Breaking Changes
16+
17+
- Removed operation UserAssignedIdentitiesOperations.list_associated_resources
18+
319
## 6.1.0 (2022-06-29)
420

521
**Features**

sdk/resources/azure-mgmt-msi/MANIFEST.in

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
include _meta.json
2-
recursive-include tests *.py *.yaml
2+
recursive-include tests *.py *.json
3+
recursive-include samples *.py *.md
34
include *.md
45
include azure/__init__.py
56
include azure/mgmt/__init__.py

sdk/resources/azure-mgmt-msi/README.md

Lines changed: 41 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,59 @@
11
# Microsoft Azure SDK for Python
22

33
This is the Microsoft Azure Msi Management Client Library.
4-
This package has been tested with Python 3.6+.
4+
This package has been tested with Python 3.7+.
55
For a more complete view of Azure libraries, see the [azure sdk python release](https://aka.ms/azsdk/python/all).
66

77
## _Disclaimer_
88

99
_Azure SDK Python packages support for Python 2.7 has ended 01 January 2022. For more information and questions, please refer to https://github.com/Azure/azure-sdk-for-python/issues/20691_
1010

11-
# Usage
11+
## Getting started
1212

13+
### Prerequisites
1314

14-
To learn how to use this package, see the [quickstart guide](https://aka.ms/azsdk/python/mgmt)
15+
- Python 3.7+ is required to use this package.
16+
- [Azure subscription](https://azure.microsoft.com/free/)
1517

18+
### Install the package
1619

17-
18-
For docs and references, see [Python SDK References](https://docs.microsoft.com/python/api/overview/azure/)
19-
Code samples for this package can be found at [Msi Management](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com.
20-
Additional code samples for different Azure services are available at [Samples Repo](https://aka.ms/azsdk/python/mgmt/samples)
20+
```bash
21+
pip install azure-mgmt-msi
22+
pip install azure-identity
23+
```
2124

25+
### Authentication
2226

23-
# Provide Feedback
27+
By default, [Azure Active Directory](https://aka.ms/awps/aad) token authentication depends on correct configure of following environment variables.
28+
29+
- `AZURE_CLIENT_ID` for Azure client ID.
30+
- `AZURE_TENANT_ID` for Azure tenant ID.
31+
- `AZURE_CLIENT_SECRET` for Azure client secret.
32+
33+
In addition, Azure subscription ID can be configured via environment variable `AZURE_SUBSCRIPTION_ID`.
34+
35+
With above configuration, client can be authenticated by following code:
36+
37+
```python
38+
from azure.identity import DefaultAzureCredential
39+
from azure.mgmt.msi import ManagedServiceIdentityClient
40+
import os
41+
42+
sub_id = os.getenv("AZURE_SUBSCRIPTION_ID")
43+
client = ManagedServiceIdentityClient(credential=DefaultAzureCredential(), subscription_id=sub_id)
44+
```
45+
46+
## Examples
47+
48+
49+
Code samples for this package can be found at [Msi Management](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com and [Samples Repo](https://aka.ms/azsdk/python/mgmt/samples)
50+
51+
52+
## Troubleshooting
53+
54+
## Next steps
55+
56+
## Provide Feedback
2457

2558
If you encounter any bugs or have suggestions, please file an issue in the
2659
[Issues](https://github.com/Azure/azure-sdk-for-python/issues)
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
2-
"autorest": "3.7.2",
2+
"commit": "3d7a3848106b831a4a7f46976fe38aa605c4f44d",
3+
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
4+
"autorest": "3.9.2",
35
"use": [
4-
"@autorest/python@5.16.0",
5-
"@autorest/modelerfour@4.19.3"
6+
"@autorest/python@6.2.16",
7+
"@autorest/modelerfour@4.24.3"
68
],
7-
"commit": "fda2db441da3f1fab31bb235e97da3e33c8e3903",
8-
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
9-
"autorest_command": "autorest specification/msi/resource-manager/readme.md --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --python3-only --use=@autorest/python@5.16.0 --use=@autorest/modelerfour@4.19.3 --version=3.7.2",
9+
"autorest_command": "autorest specification/msi/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.2.16 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False",
1010
"readme": "specification/msi/resource-manager/readme.md"
1111
}

sdk/resources/azure-mgmt-msi/azure/mgmt/msi/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,7 @@
1414
patch_sdk()
1515
except ImportError:
1616
pass
17+
18+
from ._version import VERSION
19+
20+
__version__ = VERSION

sdk/resources/azure-mgmt-msi/azure/mgmt/msi/_configuration.py

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
# Changes may cause incorrect behavior and will be lost if the code is
99
# regenerated.
1010
# --------------------------------------------------------------------------
11-
from typing import TYPE_CHECKING
11+
from typing import Any, TYPE_CHECKING
1212

1313
from azure.core.configuration import Configuration
1414
from azure.core.pipeline import policies
@@ -18,8 +18,6 @@
1818

1919
if TYPE_CHECKING:
2020
# pylint: disable=unused-import,ungrouped-imports
21-
from typing import Any
22-
2321
from azure.core.credentials import TokenCredential
2422

2523
class ManagedServiceIdentityClientConfiguration(Configuration):
@@ -28,19 +26,18 @@ class ManagedServiceIdentityClientConfiguration(Configuration):
2826
Note that all parameters used to create this instance are saved as instance
2927
attributes.
3028
31-
:param credential: Credential needed for the client to connect to Azure.
29+
:param credential: Credential needed for the client to connect to Azure. Required.
3230
:type credential: ~azure.core.credentials.TokenCredential
33-
:param subscription_id: The Id of the Subscription to which the identity belongs.
31+
:param subscription_id: The Id of the Subscription to which the identity belongs. Required.
3432
:type subscription_id: str
3533
"""
3634

3735
def __init__(
3836
self,
39-
credential, # type: "TokenCredential"
40-
subscription_id, # type: str
41-
**kwargs # type: Any
37+
credential: "TokenCredential",
38+
subscription_id: str,
39+
**kwargs: Any
4240
):
43-
# type: (...) -> None
4441
if credential is None:
4542
raise ValueError("Parameter 'credential' must not be None.")
4643
if subscription_id is None:
@@ -55,9 +52,8 @@ def __init__(
5552

5653
def _configure(
5754
self,
58-
**kwargs # type: Any
55+
**kwargs: Any
5956
):
60-
# type: (...) -> None
6157
self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs)
6258
self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs)
6359
self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs)

sdk/resources/azure-mgmt-msi/azure/mgmt/msi/_managed_service_identity_client.py

Lines changed: 31 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,17 @@
99
# regenerated.
1010
# --------------------------------------------------------------------------
1111

12-
from typing import TYPE_CHECKING
13-
14-
from msrest import Deserializer, Serializer
12+
from typing import Any, Optional, TYPE_CHECKING
1513

1614
from azure.mgmt.core import ARMPipelineClient
1715
from azure.profiles import KnownProfiles, ProfileDefinition
1816
from azure.profiles.multiapiclient import MultiApiClientMixin
1917

2018
from ._configuration import ManagedServiceIdentityClientConfiguration
19+
from ._serialization import Deserializer, Serializer
2120

2221
if TYPE_CHECKING:
2322
# pylint: disable=unused-import,ungrouped-imports
24-
from typing import Any, Optional
25-
2623
from azure.core.credentials import TokenCredential
2724

2825
class _SDKClient(object):
@@ -43,9 +40,9 @@ class ManagedServiceIdentityClient(MultiApiClientMixin, _SDKClient):
4340
The api-version parameter sets the default API version if the operation
4441
group is not described in the profile.
4542
46-
:param credential: Credential needed for the client to connect to Azure.
43+
:param credential: Credential needed for the client to connect to Azure. Required.
4744
:type credential: ~azure.core.credentials.TokenCredential
48-
:param subscription_id: The Id of the Subscription to which the identity belongs.
45+
:param subscription_id: The Id of the Subscription to which the identity belongs. Required.
4946
:type subscription_id: str
5047
:param api_version: API version to use if no profile is provided, or if missing in profile.
5148
:type api_version: str
@@ -55,7 +52,7 @@ class ManagedServiceIdentityClient(MultiApiClientMixin, _SDKClient):
5552
:type profile: azure.profiles.KnownProfiles
5653
"""
5754

58-
DEFAULT_API_VERSION = '2018-11-30'
55+
DEFAULT_API_VERSION = '2023-01-31'
5956
_PROFILE_TAG = "azure.mgmt.msi.ManagedServiceIdentityClient"
6057
LATEST_PROFILE = ProfileDefinition({
6158
_PROFILE_TAG: {
@@ -66,12 +63,12 @@ class ManagedServiceIdentityClient(MultiApiClientMixin, _SDKClient):
6663

6764
def __init__(
6865
self,
69-
credential, # type: "TokenCredential"
70-
subscription_id, # type: str
71-
api_version=None, # type: Optional[str]
72-
base_url="https://management.azure.com", # type: str
73-
profile=KnownProfiles.default, # type: KnownProfiles
74-
**kwargs # type: Any
66+
credential: "TokenCredential",
67+
subscription_id: str,
68+
api_version: Optional[str]=None,
69+
base_url: str = "https://management.azure.com",
70+
profile: KnownProfiles=KnownProfiles.default,
71+
**kwargs: Any
7572
):
7673
self._config = ManagedServiceIdentityClientConfiguration(credential, subscription_id, **kwargs)
7774
self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
@@ -91,6 +88,7 @@ def models(cls, api_version=DEFAULT_API_VERSION):
9188
* 2018-11-30: :mod:`v2018_11_30.models<azure.mgmt.msi.v2018_11_30.models>`
9289
* 2021-09-30-preview: :mod:`v2021_09_30_preview.models<azure.mgmt.msi.v2021_09_30_preview.models>`
9390
* 2022-01-31-preview: :mod:`v2022_01_31_preview.models<azure.mgmt.msi.v2022_01_31_preview.models>`
91+
* 2023-01-31: :mod:`v2023_01_31.models<azure.mgmt.msi.v2023_01_31.models>`
9492
"""
9593
if api_version == '2018-11-30':
9694
from .v2018_11_30 import models
@@ -101,19 +99,26 @@ def models(cls, api_version=DEFAULT_API_VERSION):
10199
elif api_version == '2022-01-31-preview':
102100
from .v2022_01_31_preview import models
103101
return models
102+
elif api_version == '2023-01-31':
103+
from .v2023_01_31 import models
104+
return models
104105
raise ValueError("API version {} is not available".format(api_version))
105106

106107
@property
107108
def federated_identity_credentials(self):
108109
"""Instance depends on the API version:
109110
110111
* 2022-01-31-preview: :class:`FederatedIdentityCredentialsOperations<azure.mgmt.msi.v2022_01_31_preview.operations.FederatedIdentityCredentialsOperations>`
112+
* 2023-01-31: :class:`FederatedIdentityCredentialsOperations<azure.mgmt.msi.v2023_01_31.operations.FederatedIdentityCredentialsOperations>`
111113
"""
112114
api_version = self._get_api_version('federated_identity_credentials')
113115
if api_version == '2022-01-31-preview':
114116
from .v2022_01_31_preview.operations import FederatedIdentityCredentialsOperations as OperationClass
117+
elif api_version == '2023-01-31':
118+
from .v2023_01_31.operations import FederatedIdentityCredentialsOperations as OperationClass
115119
else:
116120
raise ValueError("API version {} does not have operation group 'federated_identity_credentials'".format(api_version))
121+
self._config.api_version = api_version
117122
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
118123

119124
@property
@@ -123,6 +128,7 @@ def operations(self):
123128
* 2018-11-30: :class:`Operations<azure.mgmt.msi.v2018_11_30.operations.Operations>`
124129
* 2021-09-30-preview: :class:`Operations<azure.mgmt.msi.v2021_09_30_preview.operations.Operations>`
125130
* 2022-01-31-preview: :class:`Operations<azure.mgmt.msi.v2022_01_31_preview.operations.Operations>`
131+
* 2023-01-31: :class:`Operations<azure.mgmt.msi.v2023_01_31.operations.Operations>`
126132
"""
127133
api_version = self._get_api_version('operations')
128134
if api_version == '2018-11-30':
@@ -131,8 +137,11 @@ def operations(self):
131137
from .v2021_09_30_preview.operations import Operations as OperationClass
132138
elif api_version == '2022-01-31-preview':
133139
from .v2022_01_31_preview.operations import Operations as OperationClass
140+
elif api_version == '2023-01-31':
141+
from .v2023_01_31.operations import Operations as OperationClass
134142
else:
135143
raise ValueError("API version {} does not have operation group 'operations'".format(api_version))
144+
self._config.api_version = api_version
136145
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
137146

138147
@property
@@ -142,6 +151,7 @@ def system_assigned_identities(self):
142151
* 2018-11-30: :class:`SystemAssignedIdentitiesOperations<azure.mgmt.msi.v2018_11_30.operations.SystemAssignedIdentitiesOperations>`
143152
* 2021-09-30-preview: :class:`SystemAssignedIdentitiesOperations<azure.mgmt.msi.v2021_09_30_preview.operations.SystemAssignedIdentitiesOperations>`
144153
* 2022-01-31-preview: :class:`SystemAssignedIdentitiesOperations<azure.mgmt.msi.v2022_01_31_preview.operations.SystemAssignedIdentitiesOperations>`
154+
* 2023-01-31: :class:`SystemAssignedIdentitiesOperations<azure.mgmt.msi.v2023_01_31.operations.SystemAssignedIdentitiesOperations>`
145155
"""
146156
api_version = self._get_api_version('system_assigned_identities')
147157
if api_version == '2018-11-30':
@@ -150,8 +160,11 @@ def system_assigned_identities(self):
150160
from .v2021_09_30_preview.operations import SystemAssignedIdentitiesOperations as OperationClass
151161
elif api_version == '2022-01-31-preview':
152162
from .v2022_01_31_preview.operations import SystemAssignedIdentitiesOperations as OperationClass
163+
elif api_version == '2023-01-31':
164+
from .v2023_01_31.operations import SystemAssignedIdentitiesOperations as OperationClass
153165
else:
154166
raise ValueError("API version {} does not have operation group 'system_assigned_identities'".format(api_version))
167+
self._config.api_version = api_version
155168
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
156169

157170
@property
@@ -161,6 +174,7 @@ def user_assigned_identities(self):
161174
* 2018-11-30: :class:`UserAssignedIdentitiesOperations<azure.mgmt.msi.v2018_11_30.operations.UserAssignedIdentitiesOperations>`
162175
* 2021-09-30-preview: :class:`UserAssignedIdentitiesOperations<azure.mgmt.msi.v2021_09_30_preview.operations.UserAssignedIdentitiesOperations>`
163176
* 2022-01-31-preview: :class:`UserAssignedIdentitiesOperations<azure.mgmt.msi.v2022_01_31_preview.operations.UserAssignedIdentitiesOperations>`
177+
* 2023-01-31: :class:`UserAssignedIdentitiesOperations<azure.mgmt.msi.v2023_01_31.operations.UserAssignedIdentitiesOperations>`
164178
"""
165179
api_version = self._get_api_version('user_assigned_identities')
166180
if api_version == '2018-11-30':
@@ -169,8 +183,11 @@ def user_assigned_identities(self):
169183
from .v2021_09_30_preview.operations import UserAssignedIdentitiesOperations as OperationClass
170184
elif api_version == '2022-01-31-preview':
171185
from .v2022_01_31_preview.operations import UserAssignedIdentitiesOperations as OperationClass
186+
elif api_version == '2023-01-31':
187+
from .v2023_01_31.operations import UserAssignedIdentitiesOperations as OperationClass
172188
else:
173189
raise ValueError("API version {} does not have operation group 'user_assigned_identities'".format(api_version))
190+
self._config.api_version = api_version
174191
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
175192

176193
def close(self):

0 commit comments

Comments
 (0)