Skip to content

Commit b6f06d8

Browse files
authored
code and test (Azure#31225)
Co-authored-by: PythonSdkPipelines <PythonSdkPipelines>
1 parent 753969c commit b6f06d8

Some content is hidden

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

50 files changed

+1121
-597
lines changed

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

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

3+
## 1.0.0b7 (2023-08-18)
4+
5+
### Features Added
6+
7+
- Added operation ExperimentsOperations.update
8+
- Model CapabilityType has a new parameter azure_rbac_actions
9+
- Model CapabilityType has a new parameter azure_rbac_data_actions
10+
- Model ResourceIdentity has a new parameter user_assigned_identities
11+
- Model Selector has a new parameter additional_properties
12+
13+
### Breaking Changes
14+
15+
- Model Selector no longer has parameter targets
16+
317
## 1.0.0b6 (2022-12-14)
418

519
### Features Added

sdk/chaos/azure-mgmt-chaos/README.md

Lines changed: 43 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,53 @@ For a more complete view of Azure libraries, see the [azure sdk python release](
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-
16-
For docs and references, see [Python SDK References](https://docs.microsoft.com/python/api/overview/azure/)
17-
Code samples for this package can be found at [Chaos Management](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com.
18-
Additional code samples for different Azure services are available at [Samples Repo](https://aka.ms/azsdk/python/mgmt/samples)
15+
- Python 3.7+ is required to use this package.
16+
- [Azure subscription](https://azure.microsoft.com/free/)
1917

18+
### Install the package
2019

21-
# Provide Feedback
20+
```bash
21+
pip install azure-mgmt-chaos
22+
pip install azure-identity
23+
```
24+
25+
### Authentication
26+
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.chaos import ChaosManagementClient
40+
import os
41+
42+
sub_id = os.getenv("AZURE_SUBSCRIPTION_ID")
43+
client = ChaosManagementClient(credential=DefaultAzureCredential(), subscription_id=sub_id)
44+
```
45+
46+
## Examples
47+
48+
Code samples for this package can be found at:
49+
- [Search Chaos Management](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com
50+
- [Azure Python Mgmt SDK Samples Repo](https://aka.ms/azsdk/python/mgmt/samples)
51+
52+
53+
## Troubleshooting
54+
55+
## Next steps
56+
57+
## Provide Feedback
2258

2359
If you encounter any bugs or have suggestions, please file an issue in the
2460
[Issues](https://github.com/Azure/azure-sdk-for-python/issues)
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
2-
"commit": "2647ee494ecbe4668bdf16486207fecd67843e57",
2+
"commit": "e680f9bf4f154ec427ba7feac432ed8efd9665d0",
33
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
44
"autorest": "3.9.2",
55
"use": [
6-
"@autorest/python@6.2.7",
6+
"@autorest/python@6.6.0",
77
"@autorest/modelerfour@4.24.3"
88
],
9-
"autorest_command": "autorest specification/chaos/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.7 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False",
9+
"autorest_command": "autorest specification/chaos/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.6.0 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False",
1010
"readme": "specification/chaos/resource-manager/readme.md"
1111
}

sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/_chaos_management_client.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ class ChaosManagementClient: # pylint: disable=client-accepts-api-version-keywo
5050
:type subscription_id: str
5151
:param base_url: Service URL. Default value is "https://management.azure.com".
5252
:type base_url: str
53-
:keyword api_version: Api Version. Default value is "2022-10-01-preview". Note that overriding
53+
:keyword api_version: Api Version. Default value is "2023-04-15-preview". Note that overriding
5454
this default value may result in unsupported behavior.
5555
:paramtype api_version: str
5656
"""
@@ -65,7 +65,7 @@ def __init__(
6565
self._config = ChaosManagementClientConfiguration(
6666
credential=credential, subscription_id=subscription_id, **kwargs
6767
)
68-
self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
68+
self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
6969

7070
client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)}
7171
self._serialize = Serializer(client_models)
@@ -109,5 +109,5 @@ def __enter__(self) -> "ChaosManagementClient":
109109
self._client.__enter__()
110110
return self
111111

112-
def __exit__(self, *exc_details) -> None:
112+
def __exit__(self, *exc_details: Any) -> None:
113113
self._client.__exit__(*exc_details)

sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/_configuration.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
77
# --------------------------------------------------------------------------
88

9-
import sys
109
from typing import Any, TYPE_CHECKING
1110

1211
from azure.core.configuration import Configuration
@@ -15,11 +14,6 @@
1514

1615
from ._version import VERSION
1716

18-
if sys.version_info >= (3, 8):
19-
from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports
20-
else:
21-
from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports
22-
2317
if TYPE_CHECKING:
2418
# pylint: disable=unused-import,ungrouped-imports
2519
from azure.core.credentials import TokenCredential
@@ -35,14 +29,14 @@ class ChaosManagementClientConfiguration(Configuration): # pylint: disable=too-
3529
:type credential: ~azure.core.credentials.TokenCredential
3630
:param subscription_id: GUID that represents an Azure subscription ID. Required.
3731
:type subscription_id: str
38-
:keyword api_version: Api Version. Default value is "2022-10-01-preview". Note that overriding
32+
:keyword api_version: Api Version. Default value is "2023-04-15-preview". Note that overriding
3933
this default value may result in unsupported behavior.
4034
:paramtype api_version: str
4135
"""
4236

4337
def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None:
4438
super(ChaosManagementClientConfiguration, self).__init__(**kwargs)
45-
api_version: Literal["2022-10-01-preview"] = kwargs.pop("api_version", "2022-10-01-preview")
39+
api_version: str = kwargs.pop("api_version", "2023-04-15-preview")
4640

4741
if credential is None:
4842
raise ValueError("Parameter 'credential' must not be None.")

0 commit comments

Comments
 (0)