Skip to content

Commit 822940e

Browse files
jeffyou543NateLehmanazure-sdk
authored
Release/digitaltwins/1.2.0 (Azure#24603)
* azure-digitaltwins-core prepare new release targeting api-version=2021-06-30-preview (Azure#23646) * initial changes * retargeted correct swagger and fix generation issue * regenerate sdk and re-record with latest autorest * remove bad test changes and tune tests to expect wus2 * attempt to fix new requirements * fix analyze errors and update changelog * remove unneeded sections from changelog * Increment package version after release of azure-digitaltwins-core (Azure#23770) * Adding changes to support api-version 2022-05-31 for Digital Twins Data Plane SDK Adding changes to support api-version 2022-05-31 for Digital Twins Data Plane SDK Adding changes to support api-version 2022-05-31 for Digital Twins Data Plane SDK Adding changes to support api-version 2022-05-31 for Digital Twins Data Plane SDK Adding changes to support api-version 2022-05-31 for Digital Twins Data Plane SDK Fixing prefix name Correcting recordings Updated Changelog with short description under 1.2.0 * Adding westus2 location for testing azuredigitaltwins Co-authored-by: Nate Lehman <[email protected]> Co-authored-by: Azure SDK Bot <[email protected]>
1 parent c259a9f commit 822940e

File tree

185 files changed

+13115
-8409
lines changed

Some content is hidden

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

185 files changed

+13115
-8409
lines changed

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

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
11
# Release History
22

3-
## 1.2.0 (Unreleased)
3+
## 1.2.0 (2022-05-31)
4+
- GA release
45

5-
### Features Added
6-
7-
### Breaking Changes
6+
## 1.2.0b1 (2022-03-31)
87

98
### Bugs Fixed
109

10+
- Update `azure-core` dependency to avoid inconsistent dependencies from being installed.
11+
1112
### Other Changes
1213

1314
- Python 2.7 and 3.6 are no longer supported. Please use Python version 3.7 or later.
1415

16+
1517
## 1.1.0 (2020-11-24)
1618

1719
- The is the GA release containing the following changes:

sdk/digitaltwins/azure-digitaltwins-core/azure/digitaltwins/core/_generated/__init__.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,12 @@
77
# --------------------------------------------------------------------------
88

99
from ._azure_digital_twins_api import AzureDigitalTwinsAPI
10+
from ._version import VERSION
11+
12+
__version__ = VERSION
1013
__all__ = ['AzureDigitalTwinsAPI']
1114

12-
try:
13-
from ._patch import patch_sdk # type: ignore
14-
patch_sdk()
15-
except ImportError:
16-
pass
15+
# `._patch.py` is used for handwritten extensions to the generated code
16+
# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md
17+
from ._patch import patch_sdk
18+
patch_sdk()

sdk/digitaltwins/azure-digitaltwins-core/azure/digitaltwins/core/_generated/_azure_digital_twins_api.py

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

9+
from copy import deepcopy
910
from typing import TYPE_CHECKING
1011

11-
from azure.core import PipelineClient
1212
from msrest import Deserializer, Serializer
1313

14+
from azure.core import PipelineClient
15+
16+
from . import models
17+
from ._configuration import AzureDigitalTwinsAPIConfiguration
18+
from .operations import DigitalTwinModelsOperations, DigitalTwinsOperations, EventRoutesOperations, QueryOperations
19+
1420
if TYPE_CHECKING:
1521
# pylint: disable=unused-import,ungrouped-imports
16-
from typing import Any, Optional
22+
from typing import Any
1723

1824
from azure.core.credentials import TokenCredential
19-
20-
from ._configuration import AzureDigitalTwinsAPIConfiguration
21-
from .operations import DigitalTwinModelsOperations
22-
from .operations import QueryOperations
23-
from .operations import DigitalTwinsOperations
24-
from .operations import EventRoutesOperations
25-
from . import models
26-
25+
from azure.core.rest import HttpRequest, HttpResponse
2726

2827
class AzureDigitalTwinsAPI(object):
2928
"""A service for managing and querying digital twins and digital twin models.
@@ -38,34 +37,59 @@ class AzureDigitalTwinsAPI(object):
3837
:vartype event_routes: azure.digitaltwins.core.operations.EventRoutesOperations
3938
:param credential: Credential needed for the client to connect to Azure.
4039
:type credential: ~azure.core.credentials.TokenCredential
41-
:param str base_url: Service URL
40+
:param base_url: Service URL. Default value is "https://digitaltwins-hostname".
41+
:type base_url: str
42+
:keyword api_version: Api Version. Default value is "2022-05-31". Note that overriding
43+
this default value may result in unsupported behavior.
44+
:paramtype api_version: str
4245
"""
4346

4447
def __init__(
4548
self,
4649
credential, # type: "TokenCredential"
47-
base_url=None, # type: Optional[str]
50+
base_url="https://digitaltwins-hostname", # type: str
4851
**kwargs # type: Any
4952
):
5053
# type: (...) -> None
51-
if not base_url:
52-
base_url = 'https://digitaltwins-name.digitaltwins.azure.net'
53-
self._config = AzureDigitalTwinsAPIConfiguration(credential, **kwargs)
54+
self._config = AzureDigitalTwinsAPIConfiguration(credential=credential, **kwargs)
5455
self._client = PipelineClient(base_url=base_url, config=self._config, **kwargs)
5556

5657
client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
5758
self._serialize = Serializer(client_models)
58-
self._serialize.client_side_validation = False
5959
self._deserialize = Deserializer(client_models)
60+
self._serialize.client_side_validation = False
61+
self.digital_twin_models = DigitalTwinModelsOperations(self._client, self._config, self._serialize, self._deserialize)
62+
self.query = QueryOperations(self._client, self._config, self._serialize, self._deserialize)
63+
self.digital_twins = DigitalTwinsOperations(self._client, self._config, self._serialize, self._deserialize)
64+
self.event_routes = EventRoutesOperations(self._client, self._config, self._serialize, self._deserialize)
65+
66+
67+
def _send_request(
68+
self,
69+
request, # type: HttpRequest
70+
**kwargs # type: Any
71+
):
72+
# type: (...) -> HttpResponse
73+
"""Runs the network request through the client's chained policies.
74+
75+
>>> from azure.core.rest import HttpRequest
76+
>>> request = HttpRequest("GET", "https://www.example.org/")
77+
<HttpRequest [GET], url: 'https://www.example.org/'>
78+
>>> response = client._send_request(request)
79+
<HttpResponse: 200 OK>
80+
81+
For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart
82+
83+
:param request: The network request you want to make. Required.
84+
:type request: ~azure.core.rest.HttpRequest
85+
:keyword bool stream: Whether the response payload will be streamed. Defaults to False.
86+
:return: The response of your network call. Does not do error handling on your response.
87+
:rtype: ~azure.core.rest.HttpResponse
88+
"""
6089

61-
self.digital_twin_models = DigitalTwinModelsOperations(
62-
self._client, self._config, self._serialize, self._deserialize)
63-
self.query = QueryOperations(
64-
self._client, self._config, self._serialize, self._deserialize)
65-
self.digital_twins = DigitalTwinsOperations(
66-
self._client, self._config, self._serialize, self._deserialize)
67-
self.event_routes = EventRoutesOperations(
68-
self._client, self._config, self._serialize, self._deserialize)
90+
request_copy = deepcopy(request)
91+
request_copy.url = self._client.format_url(request_copy.url)
92+
return self._client.send_request(request_copy, **kwargs)
6993

7094
def close(self):
7195
# type: () -> None

sdk/digitaltwins/azure-digitaltwins-core/azure/digitaltwins/core/_generated/_configuration.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,26 @@
1111
from azure.core.configuration import Configuration
1212
from azure.core.pipeline import policies
1313

14+
from ._version import VERSION
15+
1416
if TYPE_CHECKING:
1517
# pylint: disable=unused-import,ungrouped-imports
1618
from typing import Any
1719

1820
from azure.core.credentials import TokenCredential
1921

20-
VERSION = "unknown"
2122

22-
class AzureDigitalTwinsAPIConfiguration(Configuration):
23+
class AzureDigitalTwinsAPIConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
2324
"""Configuration for AzureDigitalTwinsAPI.
2425
2526
Note that all parameters used to create this instance are saved as instance
2627
attributes.
2728
2829
:param credential: Credential needed for the client to connect to Azure.
2930
:type credential: ~azure.core.credentials.TokenCredential
31+
:keyword api_version: Api Version. Default value is "2022-05-31". Note that overriding
32+
this default value may result in unsupported behavior.
33+
:paramtype api_version: str
3034
"""
3135

3236
def __init__(
@@ -35,12 +39,14 @@ def __init__(
3539
**kwargs # type: Any
3640
):
3741
# type: (...) -> None
42+
super(AzureDigitalTwinsAPIConfiguration, self).__init__(**kwargs)
43+
api_version = kwargs.pop('api_version', "2022-05-31") # type: str
44+
3845
if credential is None:
3946
raise ValueError("Parameter 'credential' must not be None.")
40-
super(AzureDigitalTwinsAPIConfiguration, self).__init__(**kwargs)
4147

4248
self.credential = credential
43-
self.api_version = "2020-10-31"
49+
self.api_version = api_version
4450
self.credential_scopes = kwargs.pop('credential_scopes', ['https://digitaltwins.azure.net/.default'])
4551
kwargs.setdefault('sdk_moniker', 'azuredigitaltwinsapi/{}'.format(VERSION))
4652
self._configure(**kwargs)
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# coding=utf-8
2+
# --------------------------------------------------------------------------
3+
#
4+
# Copyright (c) Microsoft Corporation. All rights reserved.
5+
#
6+
# The MIT License (MIT)
7+
#
8+
# Permission is hereby granted, free of charge, to any person obtaining a copy
9+
# of this software and associated documentation files (the ""Software""), to
10+
# deal in the Software without restriction, including without limitation the
11+
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
12+
# sell copies of the Software, and to permit persons to whom the Software is
13+
# furnished to do so, subject to the following conditions:
14+
#
15+
# The above copyright notice and this permission notice shall be included in
16+
# all copies or substantial portions of the Software.
17+
#
18+
# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23+
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
24+
# IN THE SOFTWARE.
25+
#
26+
# --------------------------------------------------------------------------
27+
28+
# This file is used for handwritten extensions to the generated code. Example:
29+
# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md
30+
def patch_sdk():
31+
pass
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# --------------------------------------------------------------------------
2+
# Copyright (c) Microsoft Corporation. All rights reserved.
3+
# Licensed under the MIT License. See License.txt in the project root for license information.
4+
# Code generated by Microsoft (R) AutoRest Code Generator.
5+
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
6+
# --------------------------------------------------------------------------
7+
8+
from azure.core.pipeline.transport import HttpRequest
9+
10+
def _convert_request(request, files=None):
11+
data = request.content if not files else None
12+
request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data)
13+
if files:
14+
request.set_formdata_body(files)
15+
return request
16+
17+
def _format_url_section(template, **kwargs):
18+
components = template.split("/")
19+
while components:
20+
try:
21+
return template.format(**kwargs)
22+
except KeyError as key:
23+
formatted_components = template.split("/")
24+
components = [
25+
c for c in formatted_components if "{}".format(key.args[0]) not in c
26+
]
27+
template = "/".join(components)
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# coding=utf-8
2+
# --------------------------------------------------------------------------
3+
# Copyright (c) Microsoft Corporation. All rights reserved.
4+
# Licensed under the MIT License. See License.txt in the project root for license information.
5+
# Code generated by Microsoft (R) AutoRest Code Generator.
6+
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
7+
# --------------------------------------------------------------------------
8+
9+
VERSION = "1.2.0"

sdk/digitaltwins/azure-digitaltwins-core/azure/digitaltwins/core/_generated/aio/__init__.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,8 @@
88

99
from ._azure_digital_twins_api import AzureDigitalTwinsAPI
1010
__all__ = ['AzureDigitalTwinsAPI']
11+
12+
# `._patch.py` is used for handwritten extensions to the generated code
13+
# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md
14+
from ._patch import patch_sdk
15+
patch_sdk()

sdk/digitaltwins/azure-digitaltwins-core/azure/digitaltwins/core/_generated/aio/_azure_digital_twins_api.py

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

9-
from typing import Any, Optional, TYPE_CHECKING
9+
from copy import deepcopy
10+
from typing import Any, Awaitable, TYPE_CHECKING
1011

11-
from azure.core import AsyncPipelineClient
1212
from msrest import Deserializer, Serializer
1313

14-
if TYPE_CHECKING:
15-
# pylint: disable=unused-import,ungrouped-imports
16-
from azure.core.credentials_async import AsyncTokenCredential
14+
from azure.core import AsyncPipelineClient
15+
from azure.core.rest import AsyncHttpResponse, HttpRequest
1716

18-
from ._configuration import AzureDigitalTwinsAPIConfiguration
19-
from .operations import DigitalTwinModelsOperations
20-
from .operations import QueryOperations
21-
from .operations import DigitalTwinsOperations
22-
from .operations import EventRoutesOperations
2317
from .. import models
18+
from ._configuration import AzureDigitalTwinsAPIConfiguration
19+
from .operations import DigitalTwinModelsOperations, DigitalTwinsOperations, EventRoutesOperations, QueryOperations
2420

21+
if TYPE_CHECKING:
22+
# pylint: disable=unused-import,ungrouped-imports
23+
from azure.core.credentials_async import AsyncTokenCredential
2524

26-
class AzureDigitalTwinsAPI(object):
25+
class AzureDigitalTwinsAPI:
2726
"""A service for managing and querying digital twins and digital twin models.
2827
2928
:ivar digital_twin_models: DigitalTwinModelsOperations operations
30-
:vartype digital_twin_models: azure.digitaltwins.core.aio.operations.DigitalTwinModelsOperations
29+
:vartype digital_twin_models:
30+
azure.digitaltwins.core.aio.operations.DigitalTwinModelsOperations
3131
:ivar query: QueryOperations operations
3232
:vartype query: azure.digitaltwins.core.aio.operations.QueryOperations
3333
:ivar digital_twins: DigitalTwinsOperations operations
@@ -36,33 +36,57 @@ class AzureDigitalTwinsAPI(object):
3636
:vartype event_routes: azure.digitaltwins.core.aio.operations.EventRoutesOperations
3737
:param credential: Credential needed for the client to connect to Azure.
3838
:type credential: ~azure.core.credentials_async.AsyncTokenCredential
39-
:param str base_url: Service URL
39+
:param base_url: Service URL. Default value is "https://digitaltwins-hostname".
40+
:type base_url: str
41+
:keyword api_version: Api Version. Default value is "2022-05-31". Note that overriding
42+
this default value may result in unsupported behavior.
43+
:paramtype api_version: str
4044
"""
4145

4246
def __init__(
4347
self,
4448
credential: "AsyncTokenCredential",
45-
base_url: Optional[str] = None,
49+
base_url: str = "https://digitaltwins-hostname",
4650
**kwargs: Any
4751
) -> None:
48-
if not base_url:
49-
base_url = 'https://digitaltwins-name.digitaltwins.azure.net'
50-
self._config = AzureDigitalTwinsAPIConfiguration(credential, **kwargs)
52+
self._config = AzureDigitalTwinsAPIConfiguration(credential=credential, **kwargs)
5153
self._client = AsyncPipelineClient(base_url=base_url, config=self._config, **kwargs)
5254

5355
client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
5456
self._serialize = Serializer(client_models)
55-
self._serialize.client_side_validation = False
5657
self._deserialize = Deserializer(client_models)
58+
self._serialize.client_side_validation = False
59+
self.digital_twin_models = DigitalTwinModelsOperations(self._client, self._config, self._serialize, self._deserialize)
60+
self.query = QueryOperations(self._client, self._config, self._serialize, self._deserialize)
61+
self.digital_twins = DigitalTwinsOperations(self._client, self._config, self._serialize, self._deserialize)
62+
self.event_routes = EventRoutesOperations(self._client, self._config, self._serialize, self._deserialize)
63+
64+
65+
def _send_request(
66+
self,
67+
request: HttpRequest,
68+
**kwargs: Any
69+
) -> Awaitable[AsyncHttpResponse]:
70+
"""Runs the network request through the client's chained policies.
71+
72+
>>> from azure.core.rest import HttpRequest
73+
>>> request = HttpRequest("GET", "https://www.example.org/")
74+
<HttpRequest [GET], url: 'https://www.example.org/'>
75+
>>> response = await client._send_request(request)
76+
<AsyncHttpResponse: 200 OK>
77+
78+
For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart
79+
80+
:param request: The network request you want to make. Required.
81+
:type request: ~azure.core.rest.HttpRequest
82+
:keyword bool stream: Whether the response payload will be streamed. Defaults to False.
83+
:return: The response of your network call. Does not do error handling on your response.
84+
:rtype: ~azure.core.rest.AsyncHttpResponse
85+
"""
5786

58-
self.digital_twin_models = DigitalTwinModelsOperations(
59-
self._client, self._config, self._serialize, self._deserialize)
60-
self.query = QueryOperations(
61-
self._client, self._config, self._serialize, self._deserialize)
62-
self.digital_twins = DigitalTwinsOperations(
63-
self._client, self._config, self._serialize, self._deserialize)
64-
self.event_routes = EventRoutesOperations(
65-
self._client, self._config, self._serialize, self._deserialize)
87+
request_copy = deepcopy(request)
88+
request_copy.url = self._client.format_url(request_copy.url)
89+
return self._client.send_request(request_copy, **kwargs)
6690

6791
async def close(self) -> None:
6892
await self._client.close()

0 commit comments

Comments
 (0)