Skip to content

Commit 0f531e2

Browse files
[AutoRelease] t2-agrifood-2022-08-22-55643(Do not merge) (Azure#25798)
* code and test * Update CHANGELOG.md Co-authored-by: PythonSdkPipelines <PythonSdkPipelines> Co-authored-by: Jiefeng Chen <[email protected]>
1 parent 56ecbdc commit 0f531e2

Some content is hidden

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

43 files changed

+8094
-2374
lines changed

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

+23
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,28 @@
11
# Release History
22

3+
## 1.0.0b2 (2022-09-02)
4+
5+
### Features Added
6+
7+
- Added operation FarmBeatsModelsOperations.begin_update
8+
- Added operation FarmBeatsModelsOperations.get_operation_result
9+
- Added operation group PrivateEndpointConnectionsOperations
10+
- Added operation group PrivateLinkResourcesOperations
11+
- Model FarmBeats has a new parameter identity
12+
- Model FarmBeats has a new parameter private_endpoint_connections
13+
- Model FarmBeats has a new parameter public_network_access
14+
- Model FarmBeats has a new parameter sensor_integration
15+
- Model FarmBeatsUpdateRequestModel has a new parameter identity
16+
- Model FarmBeatsUpdateRequestModel has a new parameter properties
17+
- Model ProxyResource has a new parameter system_data
18+
- Model Resource has a new parameter system_data
19+
- Model TrackedResource has a new parameter system_data
20+
21+
### Breaking Changes
22+
23+
- Client name is changed to `AgriFoodMgmtClient`
24+
- Removed operation FarmBeatsModelsOperations.update
25+
326
## 1.0.0b1 (2021-06-09)
427

528
* Initial Release
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
include _meta.json
2-
recursive-include tests *.py *.yaml
2+
recursive-include tests *.py *.json
33
include *.md
44
include azure/__init__.py
55
include azure/mgmt/__init__.py
66
include LICENSE
7+
include azure/mgmt/agrifood/py.typed

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Microsoft Azure SDK for Python
22

33
This is the Microsoft Azure Agrifood 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_
+6-6
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
2-
"autorest": "3.4.2",
2+
"autorest": "3.8.4",
33
"use": [
4-
"@autorest/python@5.8.0",
5-
"@autorest/modelerfour@4.19.2"
4+
"@autorest/python@6.0.1",
5+
"@autorest/modelerfour@4.23.5"
66
],
7-
"commit": "5ee4aa771330a0120416c066386e6d86693978b4",
7+
"commit": "6080b0126065467abbb3e096b25ed4ad6c22fa1f",
88
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
9-
"autorest_command": "autorest specification/agfood/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --track2 --use=@autorest/python@5.8.0 --use=@autorest/modelerfour@4.19.2 --version=3.4.2",
10-
"readme": "specification/agfood/resource-manager/readme.md"
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/python@6.0.1 --use=@autorest/modelerfour@4.23.5 --version=3.8.4 --version-tolerant=False",
10+
"readme": "specification/agrifood/resource-manager/readme.md"
1111
}

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

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

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

1212
__version__ = VERSION
13-
__all__ = ['AzureAgriFoodRPService']
1413

1514
try:
16-
from ._patch import patch_sdk # type: ignore
17-
patch_sdk()
15+
from ._patch import __all__ as _patch_all
16+
from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import
1817
except ImportError:
19-
pass
18+
_patch_all = []
19+
from ._patch import patch_sdk as _patch_sdk
20+
21+
__all__ = ["AgriFoodMgmtClient"]
22+
__all__.extend([p for p in _patch_all if p not in __all__])
23+
24+
_patch_sdk()
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
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+
from copy import deepcopy
10+
from typing import Any, TYPE_CHECKING
11+
12+
from azure.core.rest import HttpRequest, HttpResponse
13+
from azure.mgmt.core import ARMPipelineClient
14+
15+
from . import models
16+
from ._configuration import AgriFoodMgmtClientConfiguration
17+
from ._serialization import Deserializer, Serializer
18+
from .operations import (
19+
ExtensionsOperations,
20+
FarmBeatsExtensionsOperations,
21+
FarmBeatsModelsOperations,
22+
LocationsOperations,
23+
Operations,
24+
PrivateEndpointConnectionsOperations,
25+
PrivateLinkResourcesOperations,
26+
)
27+
28+
if TYPE_CHECKING:
29+
# pylint: disable=unused-import,ungrouped-imports
30+
from azure.core.credentials import TokenCredential
31+
32+
33+
class AgriFoodMgmtClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes
34+
"""APIs documentation for Azure AgFoodPlatform Resource Provider Service.
35+
36+
:ivar extensions: ExtensionsOperations operations
37+
:vartype extensions: azure.mgmt.agrifood.operations.ExtensionsOperations
38+
:ivar farm_beats_extensions: FarmBeatsExtensionsOperations operations
39+
:vartype farm_beats_extensions: azure.mgmt.agrifood.operations.FarmBeatsExtensionsOperations
40+
:ivar farm_beats_models: FarmBeatsModelsOperations operations
41+
:vartype farm_beats_models: azure.mgmt.agrifood.operations.FarmBeatsModelsOperations
42+
:ivar locations: LocationsOperations operations
43+
:vartype locations: azure.mgmt.agrifood.operations.LocationsOperations
44+
:ivar operations: Operations operations
45+
:vartype operations: azure.mgmt.agrifood.operations.Operations
46+
:ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations
47+
:vartype private_endpoint_connections:
48+
azure.mgmt.agrifood.operations.PrivateEndpointConnectionsOperations
49+
:ivar private_link_resources: PrivateLinkResourcesOperations operations
50+
:vartype private_link_resources: azure.mgmt.agrifood.operations.PrivateLinkResourcesOperations
51+
:param credential: Credential needed for the client to connect to Azure. Required.
52+
:type credential: ~azure.core.credentials.TokenCredential
53+
:param subscription_id: The ID of the target subscription. Required.
54+
:type subscription_id: str
55+
:param base_url: Service URL. Default value is "https://management.azure.com".
56+
:type base_url: str
57+
:keyword api_version: Api Version. Default value is "2021-09-01-preview". Note that overriding
58+
this default value may result in unsupported behavior.
59+
:paramtype api_version: str
60+
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
61+
Retry-After header is present.
62+
"""
63+
64+
def __init__(
65+
self,
66+
credential: "TokenCredential",
67+
subscription_id: str,
68+
base_url: str = "https://management.azure.com",
69+
**kwargs: Any
70+
) -> None:
71+
self._config = AgriFoodMgmtClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs)
72+
self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
73+
74+
client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
75+
self._serialize = Serializer(client_models)
76+
self._deserialize = Deserializer(client_models)
77+
self._serialize.client_side_validation = False
78+
self.extensions = ExtensionsOperations(self._client, self._config, self._serialize, self._deserialize)
79+
self.farm_beats_extensions = FarmBeatsExtensionsOperations(
80+
self._client, self._config, self._serialize, self._deserialize
81+
)
82+
self.farm_beats_models = FarmBeatsModelsOperations(
83+
self._client, self._config, self._serialize, self._deserialize
84+
)
85+
self.locations = LocationsOperations(self._client, self._config, self._serialize, self._deserialize)
86+
self.operations = Operations(self._client, self._config, self._serialize, self._deserialize)
87+
self.private_endpoint_connections = PrivateEndpointConnectionsOperations(
88+
self._client, self._config, self._serialize, self._deserialize
89+
)
90+
self.private_link_resources = PrivateLinkResourcesOperations(
91+
self._client, self._config, self._serialize, self._deserialize
92+
)
93+
94+
def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
95+
"""Runs the network request through the client's chained policies.
96+
97+
>>> from azure.core.rest import HttpRequest
98+
>>> request = HttpRequest("GET", "https://www.example.org/")
99+
<HttpRequest [GET], url: 'https://www.example.org/'>
100+
>>> response = client._send_request(request)
101+
<HttpResponse: 200 OK>
102+
103+
For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request
104+
105+
:param request: The network request you want to make. Required.
106+
:type request: ~azure.core.rest.HttpRequest
107+
:keyword bool stream: Whether the response payload will be streamed. Defaults to False.
108+
:return: The response of your network call. Does not do error handling on your response.
109+
:rtype: ~azure.core.rest.HttpResponse
110+
"""
111+
112+
request_copy = deepcopy(request)
113+
request_copy.url = self._client.format_url(request_copy.url)
114+
return self._client.send_request(request_copy, **kwargs)
115+
116+
def close(self):
117+
# type: () -> None
118+
self._client.close()
119+
120+
def __enter__(self):
121+
# type: () -> AgriFoodMgmtClient
122+
self._client.__enter__()
123+
return self
124+
125+
def __exit__(self, *exc_details):
126+
# type: (Any) -> None
127+
self._client.__exit__(*exc_details)

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

+11-10
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def __init__(
5656
):
5757
# type: (...) -> None
5858
if not base_url:
59-
base_url = 'https://management.azure.com'
59+
base_url = "https://management.azure.com"
6060
self._config = AzureAgriFoodRPServiceConfiguration(credential, subscription_id, **kwargs)
6161
self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
6262

@@ -65,16 +65,15 @@ def __init__(
6565
self._serialize.client_side_validation = False
6666
self._deserialize = Deserializer(client_models)
6767

68-
self.extensions = ExtensionsOperations(
69-
self._client, self._config, self._serialize, self._deserialize)
68+
self.extensions = ExtensionsOperations(self._client, self._config, self._serialize, self._deserialize)
7069
self.farm_beats_extensions = FarmBeatsExtensionsOperations(
71-
self._client, self._config, self._serialize, self._deserialize)
70+
self._client, self._config, self._serialize, self._deserialize
71+
)
7272
self.farm_beats_models = FarmBeatsModelsOperations(
73-
self._client, self._config, self._serialize, self._deserialize)
74-
self.locations = LocationsOperations(
75-
self._client, self._config, self._serialize, self._deserialize)
76-
self.operations = Operations(
77-
self._client, self._config, self._serialize, self._deserialize)
73+
self._client, self._config, self._serialize, self._deserialize
74+
)
75+
self.locations = LocationsOperations(self._client, self._config, self._serialize, self._deserialize)
76+
self.operations = Operations(self._client, self._config, self._serialize, self._deserialize)
7877

7978
def _send_request(self, http_request, **kwargs):
8079
# type: (HttpRequest, Any) -> HttpResponse
@@ -87,7 +86,9 @@ def _send_request(self, http_request, **kwargs):
8786
:rtype: ~azure.core.pipeline.transport.HttpResponse
8887
"""
8988
path_format_arguments = {
90-
'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1),
89+
"subscriptionId": self._serialize.url(
90+
"self._config.subscription_id", self._config.subscription_id, "str", min_length=1
91+
),
9192
}
9293
http_request.url = self._client.format_url(http_request.url, **path_format_arguments)
9394
stream = kwargs.pop("stream", True)

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

+29-31
Original file line numberDiff line numberDiff line change
@@ -6,66 +6,64 @@
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 typing import Any, TYPE_CHECKING
1010

1111
from azure.core.configuration import Configuration
1212
from azure.core.pipeline import policies
13-
from azure.mgmt.core.policies import ARMHttpLoggingPolicy
13+
from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy
1414

1515
from ._version import VERSION
1616

1717
if TYPE_CHECKING:
1818
# pylint: disable=unused-import,ungrouped-imports
19-
from typing import Any
20-
2119
from azure.core.credentials import TokenCredential
2220

2321

24-
class AzureAgriFoodRPServiceConfiguration(Configuration):
25-
"""Configuration for AzureAgriFoodRPService.
22+
class AgriFoodMgmtClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
23+
"""Configuration for AgriFoodMgmtClient.
2624
2725
Note that all parameters used to create this instance are saved as instance
2826
attributes.
2927
30-
:param credential: Credential needed for the client to connect to Azure.
28+
:param credential: Credential needed for the client to connect to Azure. Required.
3129
:type credential: ~azure.core.credentials.TokenCredential
32-
:param subscription_id: The ID of the target subscription.
30+
:param subscription_id: The ID of the target subscription. Required.
3331
:type subscription_id: str
32+
:keyword api_version: Api Version. Default value is "2021-09-01-preview". Note that overriding
33+
this default value may result in unsupported behavior.
34+
:paramtype api_version: str
3435
"""
3536

36-
def __init__(
37-
self,
38-
credential, # type: "TokenCredential"
39-
subscription_id, # type: str
40-
**kwargs # type: Any
41-
):
42-
# type: (...) -> None
37+
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
40+
4341
if credential is None:
4442
raise ValueError("Parameter 'credential' must not be None.")
4543
if subscription_id is None:
4644
raise ValueError("Parameter 'subscription_id' must not be None.")
47-
super(AzureAgriFoodRPServiceConfiguration, self).__init__(**kwargs)
4845

4946
self.credential = credential
5047
self.subscription_id = subscription_id
51-
self.api_version = "2020-05-12-preview"
52-
self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default'])
53-
kwargs.setdefault('sdk_moniker', 'mgmt-agrifood/{}'.format(VERSION))
48+
self.api_version = api_version
49+
self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"])
50+
kwargs.setdefault("sdk_moniker", "mgmt-agrifood/{}".format(VERSION))
5451
self._configure(**kwargs)
5552

5653
def _configure(
57-
self,
58-
**kwargs # type: Any
54+
self, **kwargs # type: Any
5955
):
6056
# type: (...) -> None
61-
self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs)
62-
self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs)
63-
self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs)
64-
self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs)
65-
self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs)
66-
self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs)
67-
self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs)
68-
self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs)
69-
self.authentication_policy = kwargs.get('authentication_policy')
57+
self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs)
58+
self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs)
59+
self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs)
60+
self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs)
61+
self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs)
62+
self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs)
63+
self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs)
64+
self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs)
65+
self.authentication_policy = kwargs.get("authentication_policy")
7066
if self.credential and not self.authentication_policy:
71-
self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs)
67+
self.authentication_policy = ARMChallengeAuthenticationPolicy(
68+
self.credential, *self.credential_scopes, **kwargs
69+
)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# ------------------------------------
2+
# Copyright (c) Microsoft Corporation.
3+
# Licensed under the MIT License.
4+
# ------------------------------------
5+
"""Customize generated code here.
6+
7+
Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize
8+
"""
9+
from typing import List
10+
11+
__all__: List[str] = [] # Add all objects you want publicly available to users at this package level
12+
13+
14+
def patch_sdk():
15+
"""Do not remove from this file.
16+
17+
`patch_sdk` is a last resort escape hatch that allows you to do customizations
18+
you can't accomplish using the techniques described in
19+
https://aka.ms/azsdk/python/dpcodegen/python/customize
20+
"""

0 commit comments

Comments
 (0)