Skip to content

Commit c1a8870

Browse files
author
SDKAuto
committed
CodeGen from PR 3615 in openapi-env-test/azure-rest-api-specs
Update readme.md (Azure#3615)
1 parent 12306c5 commit c1a8870

Some content is hidden

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

49 files changed

+1819
-4315
lines changed
+6-6
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
2-
"autorest": "3.8.4",
2+
"commit": "de71653d69c279922cea68aa4c8034d9952fd300",
3+
"repository_url": "https://github.com/openapi-env-test/azure-rest-api-specs",
4+
"autorest": "3.9.2",
35
"use": [
4-
"@autorest/python@6.0.1",
5-
"@autorest/modelerfour@4.23.5"
6+
"@autorest/python@6.2.7",
7+
"@autorest/modelerfour@4.24.3"
68
],
7-
"commit": "6080b0126065467abbb3e096b25ed4ad6c22fa1f",
8-
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
9-
"autorest_command": "autorest specification/agrifood/resource-manager/readme.md --models-mode=msrest --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/[email protected] --use=@autorest/[email protected] --version=3.8.4 --version-tolerant=False",
9+
"autorest_command": "autorest specification/agrifood/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/[email protected] --use=@autorest/[email protected] --version=3.9.2 --version-tolerant=False",
1010
"readme": "specification/agrifood/resource-manager/readme.md"
1111
}

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

+5-3
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,21 @@
66
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
77
# --------------------------------------------------------------------------
88

9-
from ._agri_food_mgmt_client import AgriFoodMgmtClient
9+
from ._azure_agri_food_rp_service import AzureAgriFoodRPService
1010
from ._version import VERSION
1111

1212
__version__ = VERSION
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
2020

21-
__all__ = ["AgriFoodMgmtClient"]
21+
__all__ = [
22+
"AzureAgriFoodRPService",
23+
]
2224
__all__.extend([p for p in _patch_all if p not in __all__])
2325

2426
_patch_sdk()

sdk/agrifood/azure-mgmt-agrifood/azure/mgmt/agrifood/_agri_food_mgmt_client.py

-127
This file was deleted.

sdk/agrifood/azure-mgmt-agrifood/azure/mgmt/agrifood/_azure_agri_food_rp_service.py

+53-51
Original file line numberDiff line numberDiff line change
@@ -6,28 +6,29 @@
66
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
77
# --------------------------------------------------------------------------
88

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

12+
from azure.core.rest import HttpRequest, HttpResponse
1113
from azure.mgmt.core import ARMPipelineClient
12-
from msrest import Deserializer, Serializer
14+
15+
from . import models as _models
16+
from ._configuration import AzureAgriFoodRPServiceConfiguration
17+
from ._serialization import Deserializer, Serializer
18+
from .operations import (
19+
ExtensionsOperations,
20+
FarmBeatsExtensionsOperations,
21+
FarmBeatsModelsOperations,
22+
LocationsOperations,
23+
Operations,
24+
)
1325

1426
if TYPE_CHECKING:
1527
# pylint: disable=unused-import,ungrouped-imports
16-
from typing import Any, Optional
17-
1828
from azure.core.credentials import TokenCredential
19-
from azure.core.pipeline.transport import HttpRequest, HttpResponse
2029

21-
from ._configuration import AzureAgriFoodRPServiceConfiguration
22-
from .operations import ExtensionsOperations
23-
from .operations import FarmBeatsExtensionsOperations
24-
from .operations import FarmBeatsModelsOperations
25-
from .operations import LocationsOperations
26-
from .operations import Operations
27-
from . import models
2830

29-
30-
class AzureAgriFoodRPService(object):
31+
class AzureAgriFoodRPService: # pylint: disable=client-accepts-api-version-keyword
3132
"""APIs documentation for Azure AgriFood Resource Provider Service.
3233
3334
:ivar extensions: ExtensionsOperations operations
@@ -40,31 +41,33 @@ class AzureAgriFoodRPService(object):
4041
:vartype locations: azure.mgmt.agrifood.operations.LocationsOperations
4142
:ivar operations: Operations operations
4243
:vartype operations: azure.mgmt.agrifood.operations.Operations
43-
:param credential: Credential needed for the client to connect to Azure.
44+
:param credential: Credential needed for the client to connect to Azure. Required.
4445
:type credential: ~azure.core.credentials.TokenCredential
45-
:param subscription_id: The ID of the target subscription.
46+
:param subscription_id: The ID of the target subscription. Required.
4647
:type subscription_id: str
47-
:param str base_url: Service URL
48+
:param base_url: Service URL. Default value is "https://management.azure.com".
49+
:type base_url: str
50+
:keyword api_version: Api Version. Default value is "2020-05-12-preview". Note that overriding
51+
this default value may result in unsupported behavior.
52+
:paramtype api_version: str
4853
"""
4954

5055
def __init__(
5156
self,
52-
credential, # type: "TokenCredential"
53-
subscription_id, # type: str
54-
base_url=None, # type: Optional[str]
55-
**kwargs # type: Any
56-
):
57-
# type: (...) -> None
58-
if not base_url:
59-
base_url = "https://management.azure.com"
60-
self._config = AzureAgriFoodRPServiceConfiguration(credential, subscription_id, **kwargs)
57+
credential: "TokenCredential",
58+
subscription_id: str,
59+
base_url: str = "https://management.azure.com",
60+
**kwargs: Any
61+
) -> None:
62+
self._config = AzureAgriFoodRPServiceConfiguration(
63+
credential=credential, subscription_id=subscription_id, **kwargs
64+
)
6165
self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
6266

63-
client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
67+
client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)}
6468
self._serialize = Serializer(client_models)
65-
self._serialize.client_side_validation = False
6669
self._deserialize = Deserializer(client_models)
67-
70+
self._serialize.client_side_validation = False
6871
self.extensions = ExtensionsOperations(self._client, self._config, self._serialize, self._deserialize)
6972
self.farm_beats_extensions = FarmBeatsExtensionsOperations(
7073
self._client, self._config, self._serialize, self._deserialize
@@ -75,35 +78,34 @@ def __init__(
7578
self.locations = LocationsOperations(self._client, self._config, self._serialize, self._deserialize)
7679
self.operations = Operations(self._client, self._config, self._serialize, self._deserialize)
7780

78-
def _send_request(self, http_request, **kwargs):
79-
# type: (HttpRequest, Any) -> HttpResponse
81+
def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
8082
"""Runs the network request through the client's chained policies.
8183
82-
:param http_request: The network request you want to make. Required.
83-
:type http_request: ~azure.core.pipeline.transport.HttpRequest
84-
:keyword bool stream: Whether the response payload will be streamed. Defaults to True.
84+
>>> from azure.core.rest import HttpRequest
85+
>>> request = HttpRequest("GET", "https://www.example.org/")
86+
<HttpRequest [GET], url: 'https://www.example.org/'>
87+
>>> response = client._send_request(request)
88+
<HttpResponse: 200 OK>
89+
90+
For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request
91+
92+
:param request: The network request you want to make. Required.
93+
:type request: ~azure.core.rest.HttpRequest
94+
:keyword bool stream: Whether the response payload will be streamed. Defaults to False.
8595
:return: The response of your network call. Does not do error handling on your response.
86-
:rtype: ~azure.core.pipeline.transport.HttpResponse
96+
:rtype: ~azure.core.rest.HttpResponse
8797
"""
88-
path_format_arguments = {
89-
"subscriptionId": self._serialize.url(
90-
"self._config.subscription_id", self._config.subscription_id, "str", min_length=1
91-
),
92-
}
93-
http_request.url = self._client.format_url(http_request.url, **path_format_arguments)
94-
stream = kwargs.pop("stream", True)
95-
pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs)
96-
return pipeline_response.http_response
97-
98-
def close(self):
99-
# type: () -> None
98+
99+
request_copy = deepcopy(request)
100+
request_copy.url = self._client.format_url(request_copy.url)
101+
return self._client.send_request(request_copy, **kwargs)
102+
103+
def close(self) -> None:
100104
self._client.close()
101105

102-
def __enter__(self):
103-
# type: () -> AzureAgriFoodRPService
106+
def __enter__(self) -> "AzureAgriFoodRPService":
104107
self._client.__enter__()
105108
return self
106109

107-
def __exit__(self, *exc_details):
108-
# type: (Any) -> None
110+
def __exit__(self, *exc_details) -> None:
109111
self._client.__exit__(*exc_details)

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

+12-9
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
77
# --------------------------------------------------------------------------
88

9+
import sys
910
from typing import Any, TYPE_CHECKING
1011

1112
from azure.core.configuration import Configuration
@@ -14,13 +15,18 @@
1415

1516
from ._version import VERSION
1617

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+
1723
if TYPE_CHECKING:
1824
# pylint: disable=unused-import,ungrouped-imports
1925
from azure.core.credentials import TokenCredential
2026

2127

22-
class AgriFoodMgmtClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
23-
"""Configuration for AgriFoodMgmtClient.
28+
class AzureAgriFoodRPServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
29+
"""Configuration for AzureAgriFoodRPService.
2430
2531
Note that all parameters used to create this instance are saved as instance
2632
attributes.
@@ -29,14 +35,14 @@ class AgriFoodMgmtClientConfiguration(Configuration): # pylint: disable=too-man
2935
:type credential: ~azure.core.credentials.TokenCredential
3036
:param subscription_id: The ID of the target subscription. Required.
3137
:type subscription_id: str
32-
:keyword api_version: Api Version. Default value is "2021-09-01-preview". Note that overriding
38+
:keyword api_version: Api Version. Default value is "2020-05-12-preview". Note that overriding
3339
this default value may result in unsupported behavior.
3440
:paramtype api_version: str
3541
"""
3642

3743
def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None:
38-
super(AgriFoodMgmtClientConfiguration, self).__init__(**kwargs)
39-
api_version = kwargs.pop("api_version", "2021-09-01-preview") # type: str
44+
super(AzureAgriFoodRPServiceConfiguration, self).__init__(**kwargs)
45+
api_version: Literal["2020-05-12-preview"] = kwargs.pop("api_version", "2020-05-12-preview")
4046

4147
if credential is None:
4248
raise ValueError("Parameter 'credential' must not be None.")
@@ -50,10 +56,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs
5056
kwargs.setdefault("sdk_moniker", "mgmt-agrifood/{}".format(VERSION))
5157
self._configure(**kwargs)
5258

53-
def _configure(
54-
self, **kwargs # type: Any
55-
):
56-
# type: (...) -> None
59+
def _configure(self, **kwargs: Any) -> None:
5760
self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs)
5861
self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs)
5962
self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs)

0 commit comments

Comments
 (0)