Skip to content

Commit 841a77d

Browse files
authored
code and test (Azure#32454)
Co-authored-by: azure-sdk <PythonSdkPipelines>
1 parent f991dc8 commit 841a77d

File tree

128 files changed

+10415
-927
lines changed

Some content is hidden

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

128 files changed

+10415
-927
lines changed

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

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

3+
## 6.1.0b2 (2023-10-23)
4+
5+
### Features Added
6+
7+
- Added operation group ChatTranscriptsNoSubscriptionOperations
8+
- Added operation group ChatTranscriptsOperations
9+
- Added operation group CommunicationsNoSubscriptionOperations
10+
- Added operation group FileWorkspacesNoSubscriptionOperations
11+
- Added operation group FileWorkspacesOperations
12+
- Added operation group FilesNoSubscriptionOperations
13+
- Added operation group FilesOperations
14+
- Added operation group SupportTicketChatTranscriptsNoSubscriptionOperations
15+
- Added operation group SupportTicketCommunicationsNoSubscriptionOperations
16+
- Added operation group SupportTicketsNoSubscriptionOperations
17+
- Model ProblemClassification has a new parameter secondary_consent_enabled
18+
- Model SupportTicketDetails has a new parameter advanced_diagnostic_consent
19+
- Model SupportTicketDetails has a new parameter file_workspace_name
20+
- Model SupportTicketDetails has a new parameter problem_scoping_questions
21+
- Model SupportTicketDetails has a new parameter secondary_consent
22+
- Model SupportTicketDetails has a new parameter support_plan_display_name
23+
- Model SupportTicketDetails has a new parameter support_plan_id
24+
- Model UpdateSupportTicket has a new parameter advanced_diagnostic_consent
25+
- Model UpdateSupportTicket has a new parameter secondary_consent
26+
327
## 6.1.0b1 (2022-10-28)
428
### Other Changes
529

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

Lines changed: 43 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,54 @@ 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 [Support 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-support
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.support import MicrosoftSupport
40+
import os
41+
42+
sub_id = os.getenv("AZURE_SUBSCRIPTION_ID")
43+
client = MicrosoftSupport(credential=DefaultAzureCredential(), subscription_id=sub_id)
44+
```
45+
46+
## Examples
47+
48+
Code samples for this package can be found at:
49+
- [Search Support 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)
2561
section of the project.
26-
27-
28-
![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-python%2Fazure-mgmt-support%2FREADME.png)
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
2-
"commit": "e82a24def11ffc98cc263884f9f1742c99f2df5e",
2+
"commit": "59883fd93ea3f0911d2070a533a3724bf9c2516a",
33
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
4-
"autorest": "3.9.2",
4+
"autorest": "3.9.7",
55
"use": [
6-
"@autorest/python@6.2.1",
7-
"@autorest/modelerfour@4.24.3"
6+
"@autorest/python@6.7.1",
7+
"@autorest/modelerfour@4.26.2"
88
],
9-
"autorest_command": "autorest specification/support/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.1 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False",
9+
"autorest_command": "autorest specification/support/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.7.1 --use=@autorest/modelerfour@4.26.2 --version=3.9.7 --version-tolerant=False",
1010
"readme": "specification/support/resource-manager/readme.md"
1111
}

sdk/support/azure-mgmt-support/azure/mgmt/support/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
try:
1515
from ._patch import __all__ as _patch_all
16-
from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import
16+
from ._patch import * # pylint: disable=unused-wildcard-import
1717
except ImportError:
1818
_patch_all = []
1919
from ._patch import patch_sdk as _patch_sdk

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

Lines changed: 4 additions & 13 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 MicrosoftSupportConfiguration(Configuration): # pylint: disable=too-many-
3529
:type credential: ~azure.core.credentials.TokenCredential
3630
:param subscription_id: Azure subscription Id. Required.
3731
:type subscription_id: str
38-
:keyword api_version: Api Version. Default value is "2020-04-01". Note that overriding this
39-
default value may result in unsupported behavior.
32+
:keyword api_version: Api Version. Default value is "2022-09-01-preview". Note that overriding
33+
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(MicrosoftSupportConfiguration, self).__init__(**kwargs)
45-
api_version = kwargs.pop("api_version", "2020-04-01") # type: Literal["2020-04-01"]
39+
api_version: str = kwargs.pop("api_version", "2022-09-01-preview")
4640

4741
if credential is None:
4842
raise ValueError("Parameter 'credential' must not be None.")
@@ -56,10 +50,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs
5650
kwargs.setdefault("sdk_moniker", "mgmt-support/{}".format(VERSION))
5751
self._configure(**kwargs)
5852

59-
def _configure(
60-
self, **kwargs # type: Any
61-
):
62-
# type: (...) -> None
53+
def _configure(self, **kwargs: Any) -> None:
6354
self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs)
6455
self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs)
6556
self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs)

sdk/support/azure-mgmt-support/azure/mgmt/support/_microsoft_support.py

Lines changed: 73 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,24 @@
1212
from azure.core.rest import HttpRequest, HttpResponse
1313
from azure.mgmt.core import ARMPipelineClient
1414

15-
from . import models
15+
from . import models as _models
1616
from ._configuration import MicrosoftSupportConfiguration
1717
from ._serialization import Deserializer, Serializer
1818
from .operations import (
19+
ChatTranscriptsNoSubscriptionOperations,
20+
ChatTranscriptsOperations,
21+
CommunicationsNoSubscriptionOperations,
1922
CommunicationsOperations,
23+
FileWorkspacesNoSubscriptionOperations,
24+
FileWorkspacesOperations,
25+
FilesNoSubscriptionOperations,
26+
FilesOperations,
2027
Operations,
2128
ProblemClassificationsOperations,
2229
ServicesOperations,
30+
SupportTicketChatTranscriptsNoSubscriptionOperations,
31+
SupportTicketCommunicationsNoSubscriptionOperations,
32+
SupportTicketsNoSubscriptionOperations,
2333
SupportTicketsOperations,
2434
)
2535

@@ -28,7 +38,7 @@
2838
from azure.core.credentials import TokenCredential
2939

3040

31-
class MicrosoftSupport: # pylint: disable=client-accepts-api-version-keyword
41+
class MicrosoftSupport: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes
3242
"""Microsoft Azure Support Resource Provider.
3343
3444
:ivar operations: Operations operations
@@ -40,16 +50,44 @@ class MicrosoftSupport: # pylint: disable=client-accepts-api-version-keyword
4050
azure.mgmt.support.operations.ProblemClassificationsOperations
4151
:ivar support_tickets: SupportTicketsOperations operations
4252
:vartype support_tickets: azure.mgmt.support.operations.SupportTicketsOperations
53+
:ivar support_tickets_no_subscription: SupportTicketsNoSubscriptionOperations operations
54+
:vartype support_tickets_no_subscription:
55+
azure.mgmt.support.operations.SupportTicketsNoSubscriptionOperations
4356
:ivar communications: CommunicationsOperations operations
4457
:vartype communications: azure.mgmt.support.operations.CommunicationsOperations
58+
:ivar communications_no_subscription: CommunicationsNoSubscriptionOperations operations
59+
:vartype communications_no_subscription:
60+
azure.mgmt.support.operations.CommunicationsNoSubscriptionOperations
61+
:ivar support_ticket_communications_no_subscription:
62+
SupportTicketCommunicationsNoSubscriptionOperations operations
63+
:vartype support_ticket_communications_no_subscription:
64+
azure.mgmt.support.operations.SupportTicketCommunicationsNoSubscriptionOperations
65+
:ivar chat_transcripts: ChatTranscriptsOperations operations
66+
:vartype chat_transcripts: azure.mgmt.support.operations.ChatTranscriptsOperations
67+
:ivar support_ticket_chat_transcripts_no_subscription:
68+
SupportTicketChatTranscriptsNoSubscriptionOperations operations
69+
:vartype support_ticket_chat_transcripts_no_subscription:
70+
azure.mgmt.support.operations.SupportTicketChatTranscriptsNoSubscriptionOperations
71+
:ivar chat_transcripts_no_subscription: ChatTranscriptsNoSubscriptionOperations operations
72+
:vartype chat_transcripts_no_subscription:
73+
azure.mgmt.support.operations.ChatTranscriptsNoSubscriptionOperations
74+
:ivar file_workspaces: FileWorkspacesOperations operations
75+
:vartype file_workspaces: azure.mgmt.support.operations.FileWorkspacesOperations
76+
:ivar file_workspaces_no_subscription: FileWorkspacesNoSubscriptionOperations operations
77+
:vartype file_workspaces_no_subscription:
78+
azure.mgmt.support.operations.FileWorkspacesNoSubscriptionOperations
79+
:ivar files: FilesOperations operations
80+
:vartype files: azure.mgmt.support.operations.FilesOperations
81+
:ivar files_no_subscription: FilesNoSubscriptionOperations operations
82+
:vartype files_no_subscription: azure.mgmt.support.operations.FilesNoSubscriptionOperations
4583
:param credential: Credential needed for the client to connect to Azure. Required.
4684
:type credential: ~azure.core.credentials.TokenCredential
4785
:param subscription_id: Azure subscription Id. Required.
4886
:type subscription_id: str
4987
:param base_url: Service URL. Default value is "https://management.azure.com".
5088
:type base_url: str
51-
:keyword api_version: Api Version. Default value is "2020-04-01". Note that overriding this
52-
default value may result in unsupported behavior.
89+
:keyword api_version: Api Version. Default value is "2022-09-01-preview". Note that overriding
90+
this default value may result in unsupported behavior.
5391
:paramtype api_version: str
5492
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
5593
Retry-After header is present.
@@ -63,9 +101,9 @@ def __init__(
63101
**kwargs: Any
64102
) -> None:
65103
self._config = MicrosoftSupportConfiguration(credential=credential, subscription_id=subscription_id, **kwargs)
66-
self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
104+
self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
67105

68-
client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
106+
client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)}
69107
self._serialize = Serializer(client_models)
70108
self._deserialize = Deserializer(client_models)
71109
self._serialize.client_side_validation = False
@@ -75,7 +113,33 @@ def __init__(
75113
self._client, self._config, self._serialize, self._deserialize
76114
)
77115
self.support_tickets = SupportTicketsOperations(self._client, self._config, self._serialize, self._deserialize)
116+
self.support_tickets_no_subscription = SupportTicketsNoSubscriptionOperations(
117+
self._client, self._config, self._serialize, self._deserialize
118+
)
78119
self.communications = CommunicationsOperations(self._client, self._config, self._serialize, self._deserialize)
120+
self.communications_no_subscription = CommunicationsNoSubscriptionOperations(
121+
self._client, self._config, self._serialize, self._deserialize
122+
)
123+
self.support_ticket_communications_no_subscription = SupportTicketCommunicationsNoSubscriptionOperations(
124+
self._client, self._config, self._serialize, self._deserialize
125+
)
126+
self.chat_transcripts = ChatTranscriptsOperations(
127+
self._client, self._config, self._serialize, self._deserialize
128+
)
129+
self.support_ticket_chat_transcripts_no_subscription = SupportTicketChatTranscriptsNoSubscriptionOperations(
130+
self._client, self._config, self._serialize, self._deserialize
131+
)
132+
self.chat_transcripts_no_subscription = ChatTranscriptsNoSubscriptionOperations(
133+
self._client, self._config, self._serialize, self._deserialize
134+
)
135+
self.file_workspaces = FileWorkspacesOperations(self._client, self._config, self._serialize, self._deserialize)
136+
self.file_workspaces_no_subscription = FileWorkspacesNoSubscriptionOperations(
137+
self._client, self._config, self._serialize, self._deserialize
138+
)
139+
self.files = FilesOperations(self._client, self._config, self._serialize, self._deserialize)
140+
self.files_no_subscription = FilesNoSubscriptionOperations(
141+
self._client, self._config, self._serialize, self._deserialize
142+
)
79143

80144
def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
81145
"""Runs the network request through the client's chained policies.
@@ -99,15 +163,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
99163
request_copy.url = self._client.format_url(request_copy.url)
100164
return self._client.send_request(request_copy, **kwargs)
101165

102-
def close(self):
103-
# type: () -> None
166+
def close(self) -> None:
104167
self._client.close()
105168

106-
def __enter__(self):
107-
# type: () -> MicrosoftSupport
169+
def __enter__(self) -> "MicrosoftSupport":
108170
self._client.__enter__()
109171
return self
110172

111-
def __exit__(self, *exc_details):
112-
# type: (Any) -> None
173+
def __exit__(self, *exc_details: Any) -> None:
113174
self._client.__exit__(*exc_details)

0 commit comments

Comments
 (0)