diff --git a/cadl_to_sdk_config.json b/cadl_to_sdk_config.json new file mode 100644 index 000000000000..88df1835e836 --- /dev/null +++ b/cadl_to_sdk_config.json @@ -0,0 +1,13 @@ +{ + "dependencies": { + "@azure-tools/cadl-python": "0.4.16", + "@autorest/python": "6.2.15", + "@azure-tools/cadl-azure-core": "~0.24.0", + "@azure-tools/cadl-dpg": "~0.25.0-dev.8", + "@cadl-lang/compiler": "~0.38.5", + "@cadl-lang/eslint-config-cadl": "~0.5.0", + "@cadl-lang/openapi": "~0.38.0", + "@cadl-lang/rest": "~0.38.1", + "@cadl-lang/versioning": "~0.38.0" + } +} \ No newline at end of file diff --git a/sdk/agrifood/azure-mgmt-agrifood/_meta.json b/sdk/agrifood/azure-mgmt-agrifood/_meta.json index 8e1e4d466aa3..7bd99da8f1f6 100644 --- a/sdk/agrifood/azure-mgmt-agrifood/_meta.json +++ b/sdk/agrifood/azure-mgmt-agrifood/_meta.json @@ -1,11 +1,11 @@ { - "commit": "e37a57df67daaa82f9c3758fc450bc8655812a08", - "repository_url": "https://github.com/Azure/azure-rest-api-specs", + "commit": "f3cf16a6ef63dbe34ed161385aff1410430b8dda", + "repository_url": "https://github.com/openapi-env-test/azure-rest-api-specs", "autorest": "3.9.2", "use": [ "@autorest/python@6.2.7", "@autorest/modelerfour@4.24.3" ], - "autorest_command": "autorest specification/agrifood/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", + "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/python@6.2.7 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False", "readme": "specification/agrifood/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/agrifood/azure-mgmt-agrifood/azure/mgmt/agrifood/__init__.py b/sdk/agrifood/azure-mgmt-agrifood/azure/mgmt/agrifood/__init__.py index 279020354138..d60d22ac0e83 100644 --- a/sdk/agrifood/azure-mgmt-agrifood/azure/mgmt/agrifood/__init__.py +++ b/sdk/agrifood/azure-mgmt-agrifood/azure/mgmt/agrifood/__init__.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._agri_food_mgmt_client import AgriFoodMgmtClient +from ._azure_agri_food_rp_service import AzureAgriFoodRPService from ._version import VERSION __version__ = VERSION @@ -19,7 +19,7 @@ from ._patch import patch_sdk as _patch_sdk __all__ = [ - "AgriFoodMgmtClient", + "AzureAgriFoodRPService", ] __all__.extend([p for p in _patch_all if p not in __all__]) diff --git a/sdk/agrifood/azure-mgmt-agrifood/azure/mgmt/agrifood/_agri_food_mgmt_client.py b/sdk/agrifood/azure-mgmt-agrifood/azure/mgmt/agrifood/_azure_agri_food_rp_service.py similarity index 66% rename from sdk/agrifood/azure-mgmt-agrifood/azure/mgmt/agrifood/_agri_food_mgmt_client.py rename to sdk/agrifood/azure-mgmt-agrifood/azure/mgmt/agrifood/_azure_agri_food_rp_service.py index 4e1035f7d188..7695fc3de5ee 100644 --- a/sdk/agrifood/azure-mgmt-agrifood/azure/mgmt/agrifood/_agri_food_mgmt_client.py +++ b/sdk/agrifood/azure-mgmt-agrifood/azure/mgmt/agrifood/_azure_agri_food_rp_service.py @@ -13,7 +13,7 @@ from azure.mgmt.core import ARMPipelineClient from . import models as _models -from ._configuration import AgriFoodMgmtClientConfiguration +from ._configuration import AzureAgriFoodRPServiceConfiguration from ._serialization import Deserializer, Serializer from .operations import ( ExtensionsOperations, @@ -21,10 +21,6 @@ FarmBeatsModelsOperations, LocationsOperations, Operations, - PrivateEndpointConnectionsOperations, - PrivateLinkResourcesOperations, - SolutionsDiscoverabilityOperations, - SolutionsOperations, ) if TYPE_CHECKING: @@ -32,8 +28,8 @@ from azure.core.credentials import TokenCredential -class AgriFoodMgmtClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes - """APIs documentation for Azure AgFoodPlatform Resource Provider Service. +class AzureAgriFoodRPService: # pylint: disable=client-accepts-api-version-keyword + """APIs documentation for Azure AgriFood Resource Provider Service. :ivar extensions: ExtensionsOperations operations :vartype extensions: azure.mgmt.agrifood.operations.ExtensionsOperations @@ -45,41 +41,26 @@ class AgriFoodMgmtClient: # pylint: disable=client-accepts-api-version-keyword, :vartype locations: azure.mgmt.agrifood.operations.LocationsOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.agrifood.operations.Operations - :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations - :vartype private_endpoint_connections: - azure.mgmt.agrifood.operations.PrivateEndpointConnectionsOperations - :ivar private_link_resources: PrivateLinkResourcesOperations operations - :vartype private_link_resources: azure.mgmt.agrifood.operations.PrivateLinkResourcesOperations - :ivar solutions: SolutionsOperations operations - :vartype solutions: azure.mgmt.agrifood.operations.SolutionsOperations - :ivar solutions_discoverability: SolutionsDiscoverabilityOperations operations - :vartype solutions_discoverability: - azure.mgmt.agrifood.operations.SolutionsDiscoverabilityOperations :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential - :param solution_id: Solution Id of the solution. Required. - :type solution_id: str - :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. + :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str - :keyword api_version: Api Version. Default value is "2021-09-01-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2020-05-12-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. """ def __init__( self, credential: "TokenCredential", - solution_id: str, subscription_id: str, base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - self._config = AgriFoodMgmtClientConfiguration( - credential=credential, solution_id=solution_id, subscription_id=subscription_id, **kwargs + self._config = AzureAgriFoodRPServiceConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs ) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) @@ -96,16 +77,6 @@ def __init__( ) self.locations = LocationsOperations(self._client, self._config, self._serialize, self._deserialize) self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.private_endpoint_connections = PrivateEndpointConnectionsOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.private_link_resources = PrivateLinkResourcesOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.solutions = SolutionsOperations(self._client, self._config, self._serialize, self._deserialize) - self.solutions_discoverability = SolutionsDiscoverabilityOperations( - self._client, self._config, self._serialize, self._deserialize - ) def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. @@ -132,7 +103,7 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: def close(self) -> None: self._client.close() - def __enter__(self) -> "AgriFoodMgmtClient": + def __enter__(self) -> "AzureAgriFoodRPService": self._client.__enter__() return self diff --git a/sdk/agrifood/azure-mgmt-agrifood/azure/mgmt/agrifood/_configuration.py b/sdk/agrifood/azure-mgmt-agrifood/azure/mgmt/agrifood/_configuration.py index a1a4e42c2ea7..e35637f71769 100644 --- a/sdk/agrifood/azure-mgmt-agrifood/azure/mgmt/agrifood/_configuration.py +++ b/sdk/agrifood/azure-mgmt-agrifood/azure/mgmt/agrifood/_configuration.py @@ -25,36 +25,31 @@ from azure.core.credentials import TokenCredential -class AgriFoodMgmtClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes - """Configuration for AgriFoodMgmtClient. +class AzureAgriFoodRPServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes + """Configuration for AzureAgriFoodRPService. Note that all parameters used to create this instance are saved as instance attributes. :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential - :param solution_id: Solution Id of the solution. Required. - :type solution_id: str - :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. + :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2021-09-01-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2020-05-12-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ - def __init__(self, credential: "TokenCredential", solution_id: str, subscription_id: str, **kwargs: Any) -> None: - super(AgriFoodMgmtClientConfiguration, self).__init__(**kwargs) - api_version: Literal["2021-09-01-preview"] = kwargs.pop("api_version", "2021-09-01-preview") + def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: + super(AzureAgriFoodRPServiceConfiguration, self).__init__(**kwargs) + api_version: Literal["2020-05-12-preview"] = kwargs.pop("api_version", "2020-05-12-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") - if solution_id is None: - raise ValueError("Parameter 'solution_id' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") self.credential = credential - self.solution_id = solution_id self.subscription_id = subscription_id self.api_version = api_version self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) diff --git a/sdk/agrifood/azure-mgmt-agrifood/azure/mgmt/agrifood/_version.py b/sdk/agrifood/azure-mgmt-agrifood/azure/mgmt/agrifood/_version.py index 20971492f129..e5754a47ce68 100644 --- a/sdk/agrifood/azure-mgmt-agrifood/azure/mgmt/agrifood/_version.py +++ b/sdk/agrifood/azure-mgmt-agrifood/azure/mgmt/agrifood/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "1.0.0b3" +VERSION = "1.0.0b1" diff --git a/sdk/agrifood/azure-mgmt-agrifood/azure/mgmt/agrifood/aio/__init__.py b/sdk/agrifood/azure-mgmt-agrifood/azure/mgmt/agrifood/aio/__init__.py index 82957292041d..4442ff8c50da 100644 --- a/sdk/agrifood/azure-mgmt-agrifood/azure/mgmt/agrifood/aio/__init__.py +++ b/sdk/agrifood/azure-mgmt-agrifood/azure/mgmt/agrifood/aio/__init__.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._agri_food_mgmt_client import AgriFoodMgmtClient +from ._azure_agri_food_rp_service import AzureAgriFoodRPService try: from ._patch import __all__ as _patch_all @@ -16,7 +16,7 @@ from ._patch import patch_sdk as _patch_sdk __all__ = [ - "AgriFoodMgmtClient", + "AzureAgriFoodRPService", ] __all__.extend([p for p in _patch_all if p not in __all__]) diff --git a/sdk/agrifood/azure-mgmt-agrifood/azure/mgmt/agrifood/aio/_agri_food_mgmt_client.py b/sdk/agrifood/azure-mgmt-agrifood/azure/mgmt/agrifood/aio/_azure_agri_food_rp_service.py similarity index 66% rename from sdk/agrifood/azure-mgmt-agrifood/azure/mgmt/agrifood/aio/_agri_food_mgmt_client.py rename to sdk/agrifood/azure-mgmt-agrifood/azure/mgmt/agrifood/aio/_azure_agri_food_rp_service.py index 21cfca382af8..629a7daacbbc 100644 --- a/sdk/agrifood/azure-mgmt-agrifood/azure/mgmt/agrifood/aio/_agri_food_mgmt_client.py +++ b/sdk/agrifood/azure-mgmt-agrifood/azure/mgmt/agrifood/aio/_azure_agri_food_rp_service.py @@ -14,17 +14,13 @@ from .. import models as _models from .._serialization import Deserializer, Serializer -from ._configuration import AgriFoodMgmtClientConfiguration +from ._configuration import AzureAgriFoodRPServiceConfiguration from .operations import ( ExtensionsOperations, FarmBeatsExtensionsOperations, FarmBeatsModelsOperations, LocationsOperations, Operations, - PrivateEndpointConnectionsOperations, - PrivateLinkResourcesOperations, - SolutionsDiscoverabilityOperations, - SolutionsOperations, ) if TYPE_CHECKING: @@ -32,8 +28,8 @@ from azure.core.credentials_async import AsyncTokenCredential -class AgriFoodMgmtClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes - """APIs documentation for Azure AgFoodPlatform Resource Provider Service. +class AzureAgriFoodRPService: # pylint: disable=client-accepts-api-version-keyword + """APIs documentation for Azure AgriFood Resource Provider Service. :ivar extensions: ExtensionsOperations operations :vartype extensions: azure.mgmt.agrifood.aio.operations.ExtensionsOperations @@ -46,42 +42,26 @@ class AgriFoodMgmtClient: # pylint: disable=client-accepts-api-version-keyword, :vartype locations: azure.mgmt.agrifood.aio.operations.LocationsOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.agrifood.aio.operations.Operations - :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations - :vartype private_endpoint_connections: - azure.mgmt.agrifood.aio.operations.PrivateEndpointConnectionsOperations - :ivar private_link_resources: PrivateLinkResourcesOperations operations - :vartype private_link_resources: - azure.mgmt.agrifood.aio.operations.PrivateLinkResourcesOperations - :ivar solutions: SolutionsOperations operations - :vartype solutions: azure.mgmt.agrifood.aio.operations.SolutionsOperations - :ivar solutions_discoverability: SolutionsDiscoverabilityOperations operations - :vartype solutions_discoverability: - azure.mgmt.agrifood.aio.operations.SolutionsDiscoverabilityOperations :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param solution_id: Solution Id of the solution. Required. - :type solution_id: str - :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. + :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str - :keyword api_version: Api Version. Default value is "2021-09-01-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2020-05-12-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. """ def __init__( self, credential: "AsyncTokenCredential", - solution_id: str, subscription_id: str, base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - self._config = AgriFoodMgmtClientConfiguration( - credential=credential, solution_id=solution_id, subscription_id=subscription_id, **kwargs + self._config = AzureAgriFoodRPServiceConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs ) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) @@ -98,16 +78,6 @@ def __init__( ) self.locations = LocationsOperations(self._client, self._config, self._serialize, self._deserialize) self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.private_endpoint_connections = PrivateEndpointConnectionsOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.private_link_resources = PrivateLinkResourcesOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.solutions = SolutionsOperations(self._client, self._config, self._serialize, self._deserialize) - self.solutions_discoverability = SolutionsDiscoverabilityOperations( - self._client, self._config, self._serialize, self._deserialize - ) def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. @@ -134,7 +104,7 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncH async def close(self) -> None: await self._client.close() - async def __aenter__(self) -> "AgriFoodMgmtClient": + async def __aenter__(self) -> "AzureAgriFoodRPService": await self._client.__aenter__() return self diff --git a/sdk/agrifood/azure-mgmt-agrifood/azure/mgmt/agrifood/aio/_configuration.py b/sdk/agrifood/azure-mgmt-agrifood/azure/mgmt/agrifood/aio/_configuration.py index 3c076b11b962..91844d62171b 100644 --- a/sdk/agrifood/azure-mgmt-agrifood/azure/mgmt/agrifood/aio/_configuration.py +++ b/sdk/agrifood/azure-mgmt-agrifood/azure/mgmt/agrifood/aio/_configuration.py @@ -25,38 +25,31 @@ from azure.core.credentials_async import AsyncTokenCredential -class AgriFoodMgmtClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes - """Configuration for AgriFoodMgmtClient. +class AzureAgriFoodRPServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes + """Configuration for AzureAgriFoodRPService. Note that all parameters used to create this instance are saved as instance attributes. :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param solution_id: Solution Id of the solution. Required. - :type solution_id: str - :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. + :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2021-09-01-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2020-05-12-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ - def __init__( - self, credential: "AsyncTokenCredential", solution_id: str, subscription_id: str, **kwargs: Any - ) -> None: - super(AgriFoodMgmtClientConfiguration, self).__init__(**kwargs) - api_version: Literal["2021-09-01-preview"] = kwargs.pop("api_version", "2021-09-01-preview") + def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: + super(AzureAgriFoodRPServiceConfiguration, self).__init__(**kwargs) + api_version: Literal["2020-05-12-preview"] = kwargs.pop("api_version", "2020-05-12-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") - if solution_id is None: - raise ValueError("Parameter 'solution_id' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") self.credential = credential - self.solution_id = solution_id self.subscription_id = subscription_id self.api_version = api_version self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) diff --git a/sdk/agrifood/azure-mgmt-agrifood/azure/mgmt/agrifood/aio/operations/__init__.py b/sdk/agrifood/azure-mgmt-agrifood/azure/mgmt/agrifood/aio/operations/__init__.py index a699d321e568..c2d30e3e0459 100644 --- a/sdk/agrifood/azure-mgmt-agrifood/azure/mgmt/agrifood/aio/operations/__init__.py +++ b/sdk/agrifood/azure-mgmt-agrifood/azure/mgmt/agrifood/aio/operations/__init__.py @@ -11,10 +11,6 @@ from ._farm_beats_models_operations import FarmBeatsModelsOperations from ._locations_operations import LocationsOperations from ._operations import Operations -from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations -from ._private_link_resources_operations import PrivateLinkResourcesOperations -from ._solutions_operations import SolutionsOperations -from ._solutions_discoverability_operations import SolutionsDiscoverabilityOperations from ._patch import __all__ as _patch_all from ._patch import * # pylint: disable=unused-wildcard-import @@ -26,10 +22,6 @@ "FarmBeatsModelsOperations", "LocationsOperations", "Operations", - "PrivateEndpointConnectionsOperations", - "PrivateLinkResourcesOperations", - "SolutionsOperations", - "SolutionsDiscoverabilityOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/agrifood/azure-mgmt-agrifood/azure/mgmt/agrifood/aio/operations/_extensions_operations.py b/sdk/agrifood/azure-mgmt-agrifood/azure/mgmt/agrifood/aio/operations/_extensions_operations.py index 619d7707dc38..879d10206106 100644 --- a/sdk/agrifood/azure-mgmt-agrifood/azure/mgmt/agrifood/aio/operations/_extensions_operations.py +++ b/sdk/agrifood/azure-mgmt-agrifood/azure/mgmt/agrifood/aio/operations/_extensions_operations.py @@ -7,7 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, List, Optional, TypeVar, Union, overload +from typing import Any, AsyncIterable, Callable, Dict, List, Optional, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -30,10 +30,11 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._extensions_operations import ( - build_create_or_update_request, + build_create_request, build_delete_request, build_get_request, build_list_by_farm_beats_request, + build_update_request, ) if sys.version_info >= (3, 8): @@ -50,7 +51,7 @@ class ExtensionsOperations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.agrifood.aio.AgriFoodMgmtClient`'s + :class:`~azure.mgmt.agrifood.aio.AzureAgriFoodRPService`'s :attr:`extensions` attribute. """ @@ -63,98 +64,88 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @overload - async def create_or_update( - self, - resource_group_name: str, - farm_beats_resource_name: str, - extension_id: str, - request_body: Optional[_models.ExtensionInstallationRequest] = None, - *, - content_type: str = "application/json", - **kwargs: Any + @distributed_trace_async + async def create( + self, extension_id: str, farm_beats_resource_name: str, resource_group_name: str, **kwargs: Any ) -> _models.Extension: - """Install or Update extension. AdditionalApiProperties are merged patch and if the extension is - updated to a new version then the obsolete entries will be auto deleted from - AdditionalApiProperties. + """Install extension. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param farm_beats_resource_name: FarmBeats resource name. Required. - :type farm_beats_resource_name: str :param extension_id: Id of extension resource. Required. :type extension_id: str - :param request_body: Extension resource request body. Default value is None. - :type request_body: ~azure.mgmt.agrifood.models.ExtensionInstallationRequest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Extension or the result of cls(response) - :rtype: ~azure.mgmt.agrifood.models.Extension - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create_or_update( - self, - resource_group_name: str, - farm_beats_resource_name: str, - extension_id: str, - request_body: Optional[IO] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Extension: - """Install or Update extension. AdditionalApiProperties are merged patch and if the extension is - updated to a new version then the obsolete entries will be auto deleted from - AdditionalApiProperties. - + :param farm_beats_resource_name: FarmBeats resource name. Required. + :type farm_beats_resource_name: str :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param farm_beats_resource_name: FarmBeats resource name. Required. - :type farm_beats_resource_name: str - :param extension_id: Id of extension resource. Required. - :type extension_id: str - :param request_body: Extension resource request body. Default value is None. - :type request_body: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :return: Extension or the result of cls(response) :rtype: ~azure.mgmt.agrifood.models.Extension :raises ~azure.core.exceptions.HttpResponseError: """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2020-05-12-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.Extension] = kwargs.pop("cls", None) + + request = build_create_request( + extension_id=extension_id, + farm_beats_resource_name=farm_beats_resource_name, + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.create.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("Extension", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourcesGroups/{resourceGroupName}/providers/Microsoft.AgFoodPlatform/farmBeats/{farmBeatsResourceName}/extensions/{extensionId}" + } @distributed_trace_async - async def create_or_update( - self, - resource_group_name: str, - farm_beats_resource_name: str, - extension_id: str, - request_body: Optional[Union[_models.ExtensionInstallationRequest, IO]] = None, - **kwargs: Any + async def get( + self, extension_id: str, farm_beats_resource_name: str, resource_group_name: str, **kwargs: Any ) -> _models.Extension: - """Install or Update extension. AdditionalApiProperties are merged patch and if the extension is - updated to a new version then the obsolete entries will be auto deleted from - AdditionalApiProperties. + """Get installed extension details by extension id. + :param extension_id: Id of extension resource. Required. + :type extension_id: str + :param farm_beats_resource_name: FarmBeats resource name. Required. + :type farm_beats_resource_name: str :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param farm_beats_resource_name: FarmBeats resource name. Required. - :type farm_beats_resource_name: str - :param extension_id: Id of extension resource. Required. - :type extension_id: str - :param request_body: Extension resource request body. Is either a model type or a IO type. - Default value is None. - :type request_body: ~azure.mgmt.agrifood.models.ExtensionInstallationRequest or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :return: Extension or the result of cls(response) :rtype: ~azure.mgmt.agrifood.models.Extension @@ -168,36 +159,21 @@ async def create_or_update( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( + api_version: Literal["2020-05-12-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Extension] = kwargs.pop("cls", None) - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(request_body, (IO, bytes)): - _content = request_body - else: - if request_body is not None: - _json = self._serialize.body(request_body, "ExtensionInstallationRequest") - else: - _json = None - - request = build_create_or_update_request( - resource_group_name=resource_group_name, - farm_beats_resource_name=farm_beats_resource_name, + request = build_get_request( extension_id=extension_id, + farm_beats_resource_name=farm_beats_resource_name, + resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.create_or_update.metadata["url"], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -210,39 +186,35 @@ async def create_or_update( response = pipeline_response.http_response - if response.status_code not in [200, 201]: + if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Extension", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("Extension", pipeline_response) + deserialized = self._deserialize("Extension", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) - return deserialized # type: ignore + return deserialized - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgFoodPlatform/farmBeats/{farmBeatsResourceName}/extensions/{extensionId}" + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourcesGroups/{resourceGroupName}/providers/Microsoft.AgFoodPlatform/farmBeats/{farmBeatsResourceName}/extensions/{extensionId}" } @distributed_trace_async - async def get( - self, resource_group_name: str, farm_beats_resource_name: str, extension_id: str, **kwargs: Any + async def update( + self, extension_id: str, farm_beats_resource_name: str, resource_group_name: str, **kwargs: Any ) -> _models.Extension: - """Get installed extension details by extension id. + """Upgrade to latest extension. + :param extension_id: Id of extension resource. Required. + :type extension_id: str + :param farm_beats_resource_name: FarmBeats resource name. Required. + :type farm_beats_resource_name: str :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param farm_beats_resource_name: FarmBeats resource name. Required. - :type farm_beats_resource_name: str - :param extension_id: Id of extension resource. Required. - :type extension_id: str :keyword callable cls: A custom type or function that will be passed the direct response :return: Extension or the result of cls(response) :rtype: ~azure.mgmt.agrifood.models.Extension @@ -259,18 +231,18 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( + api_version: Literal["2020-05-12-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.Extension] = kwargs.pop("cls", None) - request = build_get_request( - resource_group_name=resource_group_name, - farm_beats_resource_name=farm_beats_resource_name, + request = build_update_request( extension_id=extension_id, + farm_beats_resource_name=farm_beats_resource_name, + resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], + template_url=self.update.metadata["url"], headers=_headers, params=_params, ) @@ -295,23 +267,23 @@ async def get( return deserialized - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgFoodPlatform/farmBeats/{farmBeatsResourceName}/extensions/{extensionId}" + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourcesGroups/{resourceGroupName}/providers/Microsoft.AgFoodPlatform/farmBeats/{farmBeatsResourceName}/extensions/{extensionId}" } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, farm_beats_resource_name: str, extension_id: str, **kwargs: Any + self, extension_id: str, farm_beats_resource_name: str, resource_group_name: str, **kwargs: Any ) -> None: """Uninstall extension. + :param extension_id: Id of extension resource. Required. + :type extension_id: str + :param farm_beats_resource_name: FarmBeats resource name. Required. + :type farm_beats_resource_name: str :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param farm_beats_resource_name: FarmBeats resource name. Required. - :type farm_beats_resource_name: str - :param extension_id: Id of extension resource. Required. - :type extension_id: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None @@ -328,15 +300,15 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( + api_version: Literal["2020-05-12-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( - resource_group_name=resource_group_name, - farm_beats_resource_name=farm_beats_resource_name, extension_id=extension_id, + farm_beats_resource_name=farm_beats_resource_name, + resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.delete.metadata["url"], @@ -361,7 +333,7 @@ async def delete( # pylint: disable=inconsistent-return-statements return cls(pipeline_response, None, {}) delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgFoodPlatform/farmBeats/{farmBeatsResourceName}/extensions/{extensionId}" + "url": "/subscriptions/{subscriptionId}/resourcesGroups/{resourceGroupName}/providers/Microsoft.AgFoodPlatform/farmBeats/{farmBeatsResourceName}/extensions/{extensionId}" } @distributed_trace @@ -399,7 +371,7 @@ def list_by_farm_beats( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( + api_version: Literal["2020-05-12-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.ExtensionListResponse] = kwargs.pop("cls", None) diff --git a/sdk/agrifood/azure-mgmt-agrifood/azure/mgmt/agrifood/aio/operations/_farm_beats_extensions_operations.py b/sdk/agrifood/azure-mgmt-agrifood/azure/mgmt/agrifood/aio/operations/_farm_beats_extensions_operations.py index 6e928ef680e8..730796424e44 100644 --- a/sdk/agrifood/azure-mgmt-agrifood/azure/mgmt/agrifood/aio/operations/_farm_beats_extensions_operations.py +++ b/sdk/agrifood/azure-mgmt-agrifood/azure/mgmt/agrifood/aio/operations/_farm_beats_extensions_operations.py @@ -45,7 +45,7 @@ class FarmBeatsExtensionsOperations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.agrifood.aio.AgriFoodMgmtClient`'s + :class:`~azure.mgmt.agrifood.aio.AzureAgriFoodRPService`'s :attr:`farm_beats_extensions` attribute. """ @@ -89,7 +89,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( + api_version: Literal["2020-05-12-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.FarmBeatsExtensionListResponse] = kwargs.pop("cls", None) @@ -185,7 +185,7 @@ async def get(self, farm_beats_extension_id: str, **kwargs: Any) -> _models.Farm _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( + api_version: Literal["2020-05-12-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.FarmBeatsExtension] = kwargs.pop("cls", None) diff --git a/sdk/agrifood/azure-mgmt-agrifood/azure/mgmt/agrifood/aio/operations/_farm_beats_models_operations.py b/sdk/agrifood/azure-mgmt-agrifood/azure/mgmt/agrifood/aio/operations/_farm_beats_models_operations.py index ea5bccff0434..bcdd1a97d10a 100644 --- a/sdk/agrifood/azure-mgmt-agrifood/azure/mgmt/agrifood/aio/operations/_farm_beats_models_operations.py +++ b/sdk/agrifood/azure-mgmt-agrifood/azure/mgmt/agrifood/aio/operations/_farm_beats_models_operations.py @@ -7,7 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -21,20 +21,17 @@ ) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models from ..._vendor import _convert_request from ...operations._farm_beats_models_operations import ( build_create_or_update_request, build_delete_request, - build_get_operation_result_request, build_get_request, build_list_by_resource_group_request, build_list_by_subscription_request, @@ -55,7 +52,7 @@ class FarmBeatsModelsOperations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.agrifood.aio.AgriFoodMgmtClient`'s + :class:`~azure.mgmt.agrifood.aio.AzureAgriFoodRPService`'s :attr:`farm_beats_models` attribute. """ @@ -93,7 +90,7 @@ async def get(self, resource_group_name: str, farm_beats_resource_name: str, **k _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( + api_version: Literal["2020-05-12-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.FarmBeats] = kwargs.pop("cls", None) @@ -135,8 +132,8 @@ async def get(self, resource_group_name: str, farm_beats_resource_name: str, **k @overload async def create_or_update( self, - resource_group_name: str, farm_beats_resource_name: str, + resource_group_name: str, body: _models.FarmBeats, *, content_type: str = "application/json", @@ -144,11 +141,11 @@ async def create_or_update( ) -> _models.FarmBeats: """Create or update FarmBeats resource. + :param farm_beats_resource_name: FarmBeats resource name. Required. + :type farm_beats_resource_name: str :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param farm_beats_resource_name: FarmBeats resource name. Required. - :type farm_beats_resource_name: str :param body: FarmBeats resource create or update request object. Required. :type body: ~azure.mgmt.agrifood.models.FarmBeats :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. @@ -163,8 +160,8 @@ async def create_or_update( @overload async def create_or_update( self, - resource_group_name: str, farm_beats_resource_name: str, + resource_group_name: str, body: IO, *, content_type: str = "application/json", @@ -172,11 +169,11 @@ async def create_or_update( ) -> _models.FarmBeats: """Create or update FarmBeats resource. + :param farm_beats_resource_name: FarmBeats resource name. Required. + :type farm_beats_resource_name: str :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param farm_beats_resource_name: FarmBeats resource name. Required. - :type farm_beats_resource_name: str :param body: FarmBeats resource create or update request object. Required. :type body: IO :keyword content_type: Body Parameter content-type. Content type parameter for binary body. @@ -190,15 +187,15 @@ async def create_or_update( @distributed_trace_async async def create_or_update( - self, resource_group_name: str, farm_beats_resource_name: str, body: Union[_models.FarmBeats, IO], **kwargs: Any + self, farm_beats_resource_name: str, resource_group_name: str, body: Union[_models.FarmBeats, IO], **kwargs: Any ) -> _models.FarmBeats: """Create or update FarmBeats resource. + :param farm_beats_resource_name: FarmBeats resource name. Required. + :type farm_beats_resource_name: str :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param farm_beats_resource_name: FarmBeats resource name. Required. - :type farm_beats_resource_name: str :param body: FarmBeats resource create or update request object. Is either a model type or a IO type. Required. :type body: ~azure.mgmt.agrifood.models.FarmBeats or IO @@ -221,7 +218,7 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( + api_version: Literal["2020-05-12-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -236,8 +233,8 @@ async def create_or_update( _json = self._serialize.body(body, "FarmBeats") request = build_create_or_update_request( - resource_group_name=resource_group_name, farm_beats_resource_name=farm_beats_resource_name, + resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, @@ -276,235 +273,146 @@ async def create_or_update( "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgFoodPlatform/farmBeats/{farmBeatsResourceName}" } - async def _update_initial( - self, - resource_group_name: str, - farm_beats_resource_name: str, - body: Union[_models.FarmBeatsUpdateRequestModel, IO], - **kwargs: Any - ) -> Optional[_models.FarmBeats]: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.FarmBeats]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(body, (IO, bytes)): - _content = body - else: - _json = self._serialize.body(body, "FarmBeatsUpdateRequestModel") - - request = build_update_request( - resource_group_name=resource_group_name, - farm_beats_resource_name=farm_beats_resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._update_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = None - response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("FarmBeats", pipeline_response) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized - - _update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgFoodPlatform/farmBeats/{farmBeatsResourceName}" - } - @overload - async def begin_update( + async def update( self, - resource_group_name: str, farm_beats_resource_name: str, + resource_group_name: str, body: _models.FarmBeatsUpdateRequestModel, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.FarmBeats]: + ) -> _models.FarmBeats: """Update a FarmBeats resource. + :param farm_beats_resource_name: FarmBeats resource name. Required. + :type farm_beats_resource_name: str :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param farm_beats_resource_name: FarmBeats resource name. Required. - :type farm_beats_resource_name: str :param body: Request object. Required. :type body: ~azure.mgmt.agrifood.models.FarmBeatsUpdateRequestModel :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either FarmBeats or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.agrifood.models.FarmBeats] + :return: FarmBeats or the result of cls(response) + :rtype: ~azure.mgmt.agrifood.models.FarmBeats :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_update( + async def update( self, - resource_group_name: str, farm_beats_resource_name: str, + resource_group_name: str, body: IO, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.FarmBeats]: + ) -> _models.FarmBeats: """Update a FarmBeats resource. + :param farm_beats_resource_name: FarmBeats resource name. Required. + :type farm_beats_resource_name: str :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param farm_beats_resource_name: FarmBeats resource name. Required. - :type farm_beats_resource_name: str :param body: Request object. Required. :type body: IO :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either FarmBeats or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.agrifood.models.FarmBeats] + :return: FarmBeats or the result of cls(response) + :rtype: ~azure.mgmt.agrifood.models.FarmBeats :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def begin_update( + async def update( self, - resource_group_name: str, farm_beats_resource_name: str, + resource_group_name: str, body: Union[_models.FarmBeatsUpdateRequestModel, IO], **kwargs: Any - ) -> AsyncLROPoller[_models.FarmBeats]: + ) -> _models.FarmBeats: """Update a FarmBeats resource. + :param farm_beats_resource_name: FarmBeats resource name. Required. + :type farm_beats_resource_name: str :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param farm_beats_resource_name: FarmBeats resource name. Required. - :type farm_beats_resource_name: str :param body: Request object. Is either a model type or a IO type. Required. :type body: ~azure.mgmt.agrifood.models.FarmBeatsUpdateRequestModel or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either FarmBeats or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.agrifood.models.FarmBeats] + :return: FarmBeats or the result of cls(response) + :rtype: ~azure.mgmt.agrifood.models.FarmBeats :raises ~azure.core.exceptions.HttpResponseError: """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( + api_version: Literal["2020-05-12-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.FarmBeats] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._update_initial( - resource_group_name=resource_group_name, - farm_beats_resource_name=farm_beats_resource_name, - body=body, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("FarmBeats", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IO, bytes)): + _content = body else: - polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + _json = self._serialize.body(body, "FarmBeatsUpdateRequestModel") + + request = build_update_request( + farm_beats_resource_name=farm_beats_resource_name, + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("FarmBeats", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized - begin_update.metadata = { + update.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgFoodPlatform/farmBeats/{farmBeatsResourceName}" } @@ -535,7 +443,7 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( + api_version: Literal["2020-05-12-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -589,7 +497,7 @@ def list_by_subscription( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( + api_version: Literal["2020-05-12-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.FarmBeatsListResponse] = kwargs.pop("cls", None) @@ -685,7 +593,7 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( + api_version: Literal["2020-05-12-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.FarmBeatsListResponse] = kwargs.pop("cls", None) @@ -759,72 +667,3 @@ async def get_next(next_link=None): list_by_resource_group.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgFoodPlatform/farmBeats" } - - @distributed_trace_async - async def get_operation_result( - self, resource_group_name: str, farm_beats_resource_name: str, operation_results_id: str, **kwargs: Any - ) -> _models.ArmAsyncOperation: - """Get operationResults for a FarmBeats resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param farm_beats_resource_name: FarmBeats resource name. Required. - :type farm_beats_resource_name: str - :param operation_results_id: The operation results id. Required. - :type operation_results_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ArmAsyncOperation or the result of cls(response) - :rtype: ~azure.mgmt.agrifood.models.ArmAsyncOperation - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.ArmAsyncOperation] = kwargs.pop("cls", None) - - request = build_get_operation_result_request( - resource_group_name=resource_group_name, - farm_beats_resource_name=farm_beats_resource_name, - operation_results_id=operation_results_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.get_operation_result.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ArmAsyncOperation", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_operation_result.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgFoodPlatform/farmBeats/{farmBeatsResourceName}/operationResults/{operationResultsId}" - } diff --git a/sdk/agrifood/azure-mgmt-agrifood/azure/mgmt/agrifood/aio/operations/_locations_operations.py b/sdk/agrifood/azure-mgmt-agrifood/azure/mgmt/agrifood/aio/operations/_locations_operations.py index fca6f6e1e4f4..a671616c5647 100644 --- a/sdk/agrifood/azure-mgmt-agrifood/azure/mgmt/agrifood/aio/operations/_locations_operations.py +++ b/sdk/agrifood/azure-mgmt-agrifood/azure/mgmt/agrifood/aio/operations/_locations_operations.py @@ -42,7 +42,7 @@ class LocationsOperations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.agrifood.aio.AgriFoodMgmtClient`'s + :class:`~azure.mgmt.agrifood.aio.AzureAgriFoodRPService`'s :attr:`locations` attribute. """ @@ -116,7 +116,7 @@ async def check_name_availability( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( + api_version: Literal["2020-05-12-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) diff --git a/sdk/agrifood/azure-mgmt-agrifood/azure/mgmt/agrifood/aio/operations/_operations.py b/sdk/agrifood/azure-mgmt-agrifood/azure/mgmt/agrifood/aio/operations/_operations.py index 0a41fd238739..d9a832523dad 100644 --- a/sdk/agrifood/azure-mgmt-agrifood/azure/mgmt/agrifood/aio/operations/_operations.py +++ b/sdk/agrifood/azure-mgmt-agrifood/azure/mgmt/agrifood/aio/operations/_operations.py @@ -44,7 +44,7 @@ class Operations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.agrifood.aio.AgriFoodMgmtClient`'s + :class:`~azure.mgmt.agrifood.aio.AzureAgriFoodRPService`'s :attr:`operations` attribute. """ @@ -69,7 +69,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( + api_version: Literal["2020-05-12-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) diff --git a/sdk/agrifood/azure-mgmt-agrifood/azure/mgmt/agrifood/aio/operations/_private_endpoint_connections_operations.py b/sdk/agrifood/azure-mgmt-agrifood/azure/mgmt/agrifood/aio/operations/_private_endpoint_connections_operations.py deleted file mode 100644 index 3069aecf3430..000000000000 --- a/sdk/agrifood/azure-mgmt-agrifood/azure/mgmt/agrifood/aio/operations/_private_endpoint_connections_operations.py +++ /dev/null @@ -1,524 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._private_endpoint_connections_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_by_resource_request, -) - -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class PrivateEndpointConnectionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.agrifood.aio.AgriFoodMgmtClient`'s - :attr:`private_endpoint_connections` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @overload - async def create_or_update( - self, - resource_group_name: str, - farm_beats_resource_name: str, - private_endpoint_connection_name: str, - body: _models.PrivateEndpointConnection, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.PrivateEndpointConnection: - """Approves or Rejects a Private endpoint connection request. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param farm_beats_resource_name: FarmBeats resource name. Required. - :type farm_beats_resource_name: str - :param private_endpoint_connection_name: Private endpoint connection name. Required. - :type private_endpoint_connection_name: str - :param body: Request object. Required. - :type body: ~azure.mgmt.agrifood.models.PrivateEndpointConnection - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection or the result of cls(response) - :rtype: ~azure.mgmt.agrifood.models.PrivateEndpointConnection - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create_or_update( - self, - resource_group_name: str, - farm_beats_resource_name: str, - private_endpoint_connection_name: str, - body: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.PrivateEndpointConnection: - """Approves or Rejects a Private endpoint connection request. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param farm_beats_resource_name: FarmBeats resource name. Required. - :type farm_beats_resource_name: str - :param private_endpoint_connection_name: Private endpoint connection name. Required. - :type private_endpoint_connection_name: str - :param body: Request object. Required. - :type body: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection or the result of cls(response) - :rtype: ~azure.mgmt.agrifood.models.PrivateEndpointConnection - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def create_or_update( - self, - resource_group_name: str, - farm_beats_resource_name: str, - private_endpoint_connection_name: str, - body: Union[_models.PrivateEndpointConnection, IO], - **kwargs: Any - ) -> _models.PrivateEndpointConnection: - """Approves or Rejects a Private endpoint connection request. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param farm_beats_resource_name: FarmBeats resource name. Required. - :type farm_beats_resource_name: str - :param private_endpoint_connection_name: Private endpoint connection name. Required. - :type private_endpoint_connection_name: str - :param body: Request object. Is either a model type or a IO type. Required. - :type body: ~azure.mgmt.agrifood.models.PrivateEndpointConnection or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection or the result of cls(response) - :rtype: ~azure.mgmt.agrifood.models.PrivateEndpointConnection - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(body, (IO, bytes)): - _content = body - else: - _json = self._serialize.body(body, "PrivateEndpointConnection") - - request = build_create_or_update_request( - resource_group_name=resource_group_name, - farm_beats_resource_name=farm_beats_resource_name, - private_endpoint_connection_name=private_endpoint_connection_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.create_or_update.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgFoodPlatform/farmBeats/{farmBeatsResourceName}/privateEndpointConnections/{privateEndpointConnectionName}" - } - - @distributed_trace_async - async def get( - self, - resource_group_name: str, - farm_beats_resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any - ) -> _models.PrivateEndpointConnection: - """Get Private endpoint connection object. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param farm_beats_resource_name: FarmBeats resource name. Required. - :type farm_beats_resource_name: str - :param private_endpoint_connection_name: Private endpoint connection name. Required. - :type private_endpoint_connection_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection or the result of cls(response) - :rtype: ~azure.mgmt.agrifood.models.PrivateEndpointConnection - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - 404: lambda response: ResourceNotFoundError( - response=response, model=self._deserialize(_models.ErrorResponse, response), error_format=ARMErrorFormat - ), - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) - - request = build_get_request( - resource_group_name=resource_group_name, - farm_beats_resource_name=farm_beats_resource_name, - private_endpoint_connection_name=private_endpoint_connection_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.get.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgFoodPlatform/farmBeats/{farmBeatsResourceName}/privateEndpointConnections/{privateEndpointConnectionName}" - } - - async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - farm_beats_resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any - ) -> None: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_request( - resource_group_name=resource_group_name, - farm_beats_resource_name=farm_beats_resource_name, - private_endpoint_connection_name=private_endpoint_connection_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self._delete_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - if cls: - return cls(pipeline_response, None, response_headers) - - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgFoodPlatform/farmBeats/{farmBeatsResourceName}/privateEndpointConnections/{privateEndpointConnectionName}" - } - - @distributed_trace_async - async def begin_delete( - self, - resource_group_name: str, - farm_beats_resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Delete Private endpoint connection request. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param farm_beats_resource_name: FarmBeats resource name. Required. - :type farm_beats_resource_name: str - :param private_endpoint_connection_name: Private endpoint connection name. Required. - :type private_endpoint_connection_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( # type: ignore - resource_group_name=resource_group_name, - farm_beats_resource_name=farm_beats_resource_name, - private_endpoint_connection_name=private_endpoint_connection_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgFoodPlatform/farmBeats/{farmBeatsResourceName}/privateEndpointConnections/{privateEndpointConnectionName}" - } - - @distributed_trace - def list_by_resource( - self, resource_group_name: str, farm_beats_resource_name: str, **kwargs: Any - ) -> AsyncIterable["_models.PrivateEndpointConnection"]: - """Get list of Private endpoint connections. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param farm_beats_resource_name: FarmBeats resource name. Required. - :type farm_beats_resource_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PrivateEndpointConnection or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.agrifood.models.PrivateEndpointConnection] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.PrivateEndpointConnectionListResult] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_resource_request( - resource_group_name=resource_group_name, - farm_beats_resource_name=farm_beats_resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_by_resource.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - list_by_resource.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgFoodPlatform/farmBeats/{farmBeatsResourceName}/privateEndpointConnections" - } diff --git a/sdk/agrifood/azure-mgmt-agrifood/azure/mgmt/agrifood/aio/operations/_private_link_resources_operations.py b/sdk/agrifood/azure-mgmt-agrifood/azure/mgmt/agrifood/aio/operations/_private_link_resources_operations.py deleted file mode 100644 index e5b823834474..000000000000 --- a/sdk/agrifood/azure-mgmt-agrifood/azure/mgmt/agrifood/aio/operations/_private_link_resources_operations.py +++ /dev/null @@ -1,224 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._private_link_resources_operations import build_get_request, build_list_by_resource_request - -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class PrivateLinkResourcesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.agrifood.aio.AgriFoodMgmtClient`'s - :attr:`private_link_resources` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_resource( - self, resource_group_name: str, farm_beats_resource_name: str, **kwargs: Any - ) -> AsyncIterable["_models.PrivateLinkResource"]: - """Get list of Private link resources. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param farm_beats_resource_name: FarmBeats resource name. Required. - :type farm_beats_resource_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PrivateLinkResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.agrifood.models.PrivateLinkResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.PrivateLinkResourceListResult] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_resource_request( - resource_group_name=resource_group_name, - farm_beats_resource_name=farm_beats_resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_by_resource.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - list_by_resource.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgFoodPlatform/farmBeats/{farmBeatsResourceName}/privateLinkResources" - } - - @distributed_trace_async - async def get( - self, resource_group_name: str, farm_beats_resource_name: str, sub_resource_name: str, **kwargs: Any - ) -> _models.PrivateLinkResource: - """Get Private link resource object. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param farm_beats_resource_name: FarmBeats resource name. Required. - :type farm_beats_resource_name: str - :param sub_resource_name: Sub resource name. Required. - :type sub_resource_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateLinkResource or the result of cls(response) - :rtype: ~azure.mgmt.agrifood.models.PrivateLinkResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - 404: lambda response: ResourceNotFoundError( - response=response, model=self._deserialize(_models.ErrorResponse, response), error_format=ARMErrorFormat - ), - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.PrivateLinkResource] = kwargs.pop("cls", None) - - request = build_get_request( - resource_group_name=resource_group_name, - farm_beats_resource_name=farm_beats_resource_name, - sub_resource_name=sub_resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.get.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("PrivateLinkResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgFoodPlatform/farmBeats/{farmBeatsResourceName}/privateLinkResources/{subResourceName}" - } diff --git a/sdk/agrifood/azure-mgmt-agrifood/azure/mgmt/agrifood/aio/operations/_solutions_discoverability_operations.py b/sdk/agrifood/azure-mgmt-agrifood/azure/mgmt/agrifood/aio/operations/_solutions_discoverability_operations.py deleted file mode 100644 index 54b8e451b26b..000000000000 --- a/sdk/agrifood/azure-mgmt-agrifood/azure/mgmt/agrifood/aio/operations/_solutions_discoverability_operations.py +++ /dev/null @@ -1,215 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, AsyncIterable, Callable, Dict, List, Optional, TypeVar -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._solutions_discoverability_operations import build_get_request, build_list_request - -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class SolutionsDiscoverabilityOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.agrifood.aio.AgriFoodMgmtClient`'s - :attr:`solutions_discoverability` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list( - self, - farm_beats_solution_ids: Optional[List[str]] = None, - farm_beats_solution_names: Optional[List[str]] = None, - max_page_size: int = 50, - **kwargs: Any - ) -> AsyncIterable["_models.FarmBeatsSolution"]: - """Get list of farmBeats solutions. - - :param farm_beats_solution_ids: Ids of FarmBeats Solutions which the customer requests to - fetch. Default value is None. - :type farm_beats_solution_ids: list[str] - :param farm_beats_solution_names: Names of FarmBeats Solutions which the customer requests to - fetch. Default value is None. - :type farm_beats_solution_names: list[str] - :param max_page_size: Maximum number of items needed (inclusive). - Minimum = 10, Maximum = 1000, Default value = 50. Default value is 50. - :type max_page_size: int - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either FarmBeatsSolution or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.agrifood.models.FarmBeatsSolution] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.FarmBeatsSolutionListResponse] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - farm_beats_solution_ids=farm_beats_solution_ids, - farm_beats_solution_names=farm_beats_solution_names, - max_page_size=max_page_size, - api_version=api_version, - template_url=self.list.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("FarmBeatsSolutionListResponse", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - list.metadata = {"url": "/providers/Microsoft.AgFoodPlatform/farmBeatsSolutionDefinitions"} - - @distributed_trace_async - async def get(self, farm_beats_solution_id: str, **kwargs: Any) -> _models.FarmBeatsSolution: - """Get farmBeats solution by id. - - :param farm_beats_solution_id: farmBeatsSolutionId to be queried. Required. - :type farm_beats_solution_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: FarmBeatsSolution or the result of cls(response) - :rtype: ~azure.mgmt.agrifood.models.FarmBeatsSolution - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.FarmBeatsSolution] = kwargs.pop("cls", None) - - request = build_get_request( - farm_beats_solution_id=farm_beats_solution_id, - api_version=api_version, - template_url=self.get.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("FarmBeatsSolution", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = {"url": "/providers/Microsoft.AgFoodPlatform/farmBeatsSolutionDefinitions/{farmBeatsSolutionId}"} diff --git a/sdk/agrifood/azure-mgmt-agrifood/azure/mgmt/agrifood/aio/operations/_solutions_operations.py b/sdk/agrifood/azure-mgmt-agrifood/azure/mgmt/agrifood/aio/operations/_solutions_operations.py deleted file mode 100644 index 25c422cac113..000000000000 --- a/sdk/agrifood/azure-mgmt-agrifood/azure/mgmt/agrifood/aio/operations/_solutions_operations.py +++ /dev/null @@ -1,491 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import datetime -import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, List, Optional, TypeVar, Union, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._solutions_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class SolutionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.agrifood.aio.AgriFoodMgmtClient`'s - :attr:`solutions` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @overload - async def create_or_update( - self, - resource_group_name: str, - farm_beats_resource_name: str, - body: Optional[_models.SolutionInstallationRequest] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Solution: - """Install Or Update Solution. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param farm_beats_resource_name: FarmBeats resource name. Required. - :type farm_beats_resource_name: str - :param body: Solution resource request body. Default value is None. - :type body: ~azure.mgmt.agrifood.models.SolutionInstallationRequest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Solution or the result of cls(response) - :rtype: ~azure.mgmt.agrifood.models.Solution - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create_or_update( - self, - resource_group_name: str, - farm_beats_resource_name: str, - body: Optional[IO] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Solution: - """Install Or Update Solution. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param farm_beats_resource_name: FarmBeats resource name. Required. - :type farm_beats_resource_name: str - :param body: Solution resource request body. Default value is None. - :type body: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Solution or the result of cls(response) - :rtype: ~azure.mgmt.agrifood.models.Solution - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def create_or_update( - self, - resource_group_name: str, - farm_beats_resource_name: str, - body: Optional[Union[_models.SolutionInstallationRequest, IO]] = None, - **kwargs: Any - ) -> _models.Solution: - """Install Or Update Solution. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param farm_beats_resource_name: FarmBeats resource name. Required. - :type farm_beats_resource_name: str - :param body: Solution resource request body. Is either a model type or a IO type. Default value - is None. - :type body: ~azure.mgmt.agrifood.models.SolutionInstallationRequest or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Solution or the result of cls(response) - :rtype: ~azure.mgmt.agrifood.models.Solution - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Solution] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(body, (IO, bytes)): - _content = body - else: - if body is not None: - _json = self._serialize.body(body, "SolutionInstallationRequest") - else: - _json = None - - request = build_create_or_update_request( - resource_group_name=resource_group_name, - farm_beats_resource_name=farm_beats_resource_name, - subscription_id=self._config.subscription_id, - solution_id=self._config.solution_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.create_or_update.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("Solution", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("Solution", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgFoodPlatform/farmBeats/{farmBeatsResourceName}/solutions/{solutionId}" - } - - @distributed_trace_async - async def get(self, resource_group_name: str, farm_beats_resource_name: str, **kwargs: Any) -> _models.Solution: - """Get installed Solution details by Solution id. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param farm_beats_resource_name: FarmBeats resource name. Required. - :type farm_beats_resource_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Solution or the result of cls(response) - :rtype: ~azure.mgmt.agrifood.models.Solution - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.Solution] = kwargs.pop("cls", None) - - request = build_get_request( - resource_group_name=resource_group_name, - farm_beats_resource_name=farm_beats_resource_name, - subscription_id=self._config.subscription_id, - solution_id=self._config.solution_id, - api_version=api_version, - template_url=self.get.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Solution", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgFoodPlatform/farmBeats/{farmBeatsResourceName}/solutions/{solutionId}" - } - - @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, farm_beats_resource_name: str, **kwargs: Any - ) -> None: - """Uninstall Solution. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param farm_beats_resource_name: FarmBeats resource name. Required. - :type farm_beats_resource_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_request( - resource_group_name=resource_group_name, - farm_beats_resource_name=farm_beats_resource_name, - subscription_id=self._config.subscription_id, - solution_id=self._config.solution_id, - api_version=api_version, - template_url=self.delete.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgFoodPlatform/farmBeats/{farmBeatsResourceName}/solutions/{solutionId}" - } - - @distributed_trace - def list( - self, - resource_group_name: str, - farm_beats_resource_name: str, - solution_ids: Optional[List[str]] = None, - ids: Optional[List[str]] = None, - names: Optional[List[str]] = None, - property_filters: Optional[List[str]] = None, - statuses: Optional[List[str]] = None, - min_created_date_time: Optional[datetime.datetime] = None, - max_created_date_time: Optional[datetime.datetime] = None, - min_last_modified_date_time: Optional[datetime.datetime] = None, - max_last_modified_date_time: Optional[datetime.datetime] = None, - max_page_size: int = 50, - skip_token: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterable["_models.Solution"]: - """Get installed Solutions details. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param farm_beats_resource_name: FarmBeats resource name. Required. - :type farm_beats_resource_name: str - :param solution_ids: Installed Solution ids. Default value is None. - :type solution_ids: list[str] - :param ids: Ids of the resource. Default value is None. - :type ids: list[str] - :param names: Names of the resource. Default value is None. - :type names: list[str] - :param property_filters: Filters on key-value pairs within the Properties object. - eg. "{testKey} eq {testValue}". Default value is None. - :type property_filters: list[str] - :param statuses: Statuses of the resource. Default value is None. - :type statuses: list[str] - :param min_created_date_time: Minimum creation date of resource (inclusive). Default value is - None. - :type min_created_date_time: ~datetime.datetime - :param max_created_date_time: Maximum creation date of resource (inclusive). Default value is - None. - :type max_created_date_time: ~datetime.datetime - :param min_last_modified_date_time: Minimum last modified date of resource (inclusive). Default - value is None. - :type min_last_modified_date_time: ~datetime.datetime - :param max_last_modified_date_time: Maximum last modified date of resource (inclusive). Default - value is None. - :type max_last_modified_date_time: ~datetime.datetime - :param max_page_size: Maximum number of items needed (inclusive). - Minimum = 10, Maximum = 1000, Default value = 50. Default value is 50. - :type max_page_size: int - :param skip_token: Skip token for getting next set of results. Default value is None. - :type skip_token: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either Solution or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.agrifood.models.Solution] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.SolutionListResponse] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - resource_group_name=resource_group_name, - farm_beats_resource_name=farm_beats_resource_name, - subscription_id=self._config.subscription_id, - solution_ids=solution_ids, - ids=ids, - names=names, - property_filters=property_filters, - statuses=statuses, - min_created_date_time=min_created_date_time, - max_created_date_time=max_created_date_time, - min_last_modified_date_time=min_last_modified_date_time, - max_last_modified_date_time=max_last_modified_date_time, - max_page_size=max_page_size, - skip_token=skip_token, - api_version=api_version, - template_url=self.list.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("SolutionListResponse", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgFoodPlatform/farmBeats/{farmBeatsResourceName}/solutions" - } diff --git a/sdk/agrifood/azure-mgmt-agrifood/azure/mgmt/agrifood/models/__init__.py b/sdk/agrifood/azure-mgmt-agrifood/azure/mgmt/agrifood/models/__init__.py index 2f0e54f90f6c..d0eef7cd8cfc 100644 --- a/sdk/agrifood/azure-mgmt-agrifood/azure/mgmt/agrifood/models/__init__.py +++ b/sdk/agrifood/azure-mgmt-agrifood/azure/mgmt/agrifood/models/__init__.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._models_py3 import ApiProperties -from ._models_py3 import ArmAsyncOperation from ._models_py3 import CheckNameAvailabilityRequest from ._models_py3 import CheckNameAvailabilityResponse from ._models_py3 import DetailedInformation @@ -15,59 +13,31 @@ from ._models_py3 import ErrorDetail from ._models_py3 import ErrorResponse from ._models_py3 import Extension -from ._models_py3 import ExtensionInstallationRequest from ._models_py3 import ExtensionListResponse from ._models_py3 import FarmBeats from ._models_py3 import FarmBeatsExtension from ._models_py3 import FarmBeatsExtensionListResponse from ._models_py3 import FarmBeatsListResponse -from ._models_py3 import FarmBeatsSolution -from ._models_py3 import FarmBeatsSolutionListResponse -from ._models_py3 import FarmBeatsSolutionProperties -from ._models_py3 import FarmBeatsUpdateProperties from ._models_py3 import FarmBeatsUpdateRequestModel -from ._models_py3 import Identity -from ._models_py3 import Insight -from ._models_py3 import InsightAttachment -from ._models_py3 import MarketplaceOfferDetails -from ._models_py3 import Measure from ._models_py3 import Operation from ._models_py3 import OperationDisplay from ._models_py3 import OperationListResult -from ._models_py3 import PrivateEndpoint -from ._models_py3 import PrivateEndpointConnection -from ._models_py3 import PrivateEndpointConnectionListResult -from ._models_py3 import PrivateLinkResource -from ._models_py3 import PrivateLinkResourceListResult -from ._models_py3 import PrivateLinkServiceConnectionState from ._models_py3 import ProxyResource from ._models_py3 import Resource -from ._models_py3 import ResourceParameter -from ._models_py3 import SensorIntegration -from ._models_py3 import Solution -from ._models_py3 import SolutionEvaluatedOutput -from ._models_py3 import SolutionInstallationRequest -from ._models_py3 import SolutionListResponse -from ._models_py3 import SolutionProperties from ._models_py3 import SystemData from ._models_py3 import TrackedResource from ._models_py3 import UnitSystemsInfo -from ._agri_food_mgmt_client_enums import ActionType -from ._agri_food_mgmt_client_enums import CheckNameAvailabilityReason -from ._agri_food_mgmt_client_enums import CreatedByType -from ._agri_food_mgmt_client_enums import Origin -from ._agri_food_mgmt_client_enums import PrivateEndpointConnectionProvisioningState -from ._agri_food_mgmt_client_enums import PrivateEndpointServiceConnectionStatus -from ._agri_food_mgmt_client_enums import ProvisioningState -from ._agri_food_mgmt_client_enums import PublicNetworkAccess +from ._azure_agri_food_rp_service_enums import ActionType +from ._azure_agri_food_rp_service_enums import CheckNameAvailabilityReason +from ._azure_agri_food_rp_service_enums import CreatedByType +from ._azure_agri_food_rp_service_enums import Origin +from ._azure_agri_food_rp_service_enums import ProvisioningState from ._patch import __all__ as _patch_all from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ - "ApiProperties", - "ArmAsyncOperation", "CheckNameAvailabilityRequest", "CheckNameAvailabilityResponse", "DetailedInformation", @@ -75,40 +45,17 @@ "ErrorDetail", "ErrorResponse", "Extension", - "ExtensionInstallationRequest", "ExtensionListResponse", "FarmBeats", "FarmBeatsExtension", "FarmBeatsExtensionListResponse", "FarmBeatsListResponse", - "FarmBeatsSolution", - "FarmBeatsSolutionListResponse", - "FarmBeatsSolutionProperties", - "FarmBeatsUpdateProperties", "FarmBeatsUpdateRequestModel", - "Identity", - "Insight", - "InsightAttachment", - "MarketplaceOfferDetails", - "Measure", "Operation", "OperationDisplay", "OperationListResult", - "PrivateEndpoint", - "PrivateEndpointConnection", - "PrivateEndpointConnectionListResult", - "PrivateLinkResource", - "PrivateLinkResourceListResult", - "PrivateLinkServiceConnectionState", "ProxyResource", "Resource", - "ResourceParameter", - "SensorIntegration", - "Solution", - "SolutionEvaluatedOutput", - "SolutionInstallationRequest", - "SolutionListResponse", - "SolutionProperties", "SystemData", "TrackedResource", "UnitSystemsInfo", @@ -116,10 +63,7 @@ "CheckNameAvailabilityReason", "CreatedByType", "Origin", - "PrivateEndpointConnectionProvisioningState", - "PrivateEndpointServiceConnectionStatus", "ProvisioningState", - "PublicNetworkAccess", ] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/agrifood/azure-mgmt-agrifood/azure/mgmt/agrifood/models/_agri_food_mgmt_client_enums.py b/sdk/agrifood/azure-mgmt-agrifood/azure/mgmt/agrifood/models/_azure_agri_food_rp_service_enums.py similarity index 66% rename from sdk/agrifood/azure-mgmt-agrifood/azure/mgmt/agrifood/models/_agri_food_mgmt_client_enums.py rename to sdk/agrifood/azure-mgmt-agrifood/azure/mgmt/agrifood/models/_azure_agri_food_rp_service_enums.py index 9ddd31d22ea8..6373ed1033da 100644 --- a/sdk/agrifood/azure-mgmt-agrifood/azure/mgmt/agrifood/models/_agri_food_mgmt_client_enums.py +++ b/sdk/agrifood/azure-mgmt-agrifood/azure/mgmt/agrifood/models/_azure_agri_food_rp_service_enums.py @@ -42,35 +42,8 @@ class Origin(str, Enum, metaclass=CaseInsensitiveEnumMeta): USER_SYSTEM = "user,system" -class PrivateEndpointConnectionProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The current provisioning state.""" - - SUCCEEDED = "Succeeded" - CREATING = "Creating" - DELETING = "Deleting" - FAILED = "Failed" - - -class PrivateEndpointServiceConnectionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The private endpoint connection status.""" - - PENDING = "Pending" - APPROVED = "Approved" - REJECTED = "Rejected" - - class ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Sensor integration instance provisioning state.""" + """FarmBeats instance provisioning state.""" - CREATING = "Creating" - UPDATING = "Updating" - DELETING = "Deleting" SUCCEEDED = "Succeeded" FAILED = "Failed" - - -class PublicNetworkAccess(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Property to allow or block public traffic for an Azure FarmBeats resource.""" - - ENABLED = "Enabled" - HYBRID = "Hybrid" diff --git a/sdk/agrifood/azure-mgmt-agrifood/azure/mgmt/agrifood/models/_models_py3.py b/sdk/agrifood/azure-mgmt-agrifood/azure/mgmt/agrifood/models/_models_py3.py index 2ea7c3a8a9aa..7e0d8b8a5b7c 100644 --- a/sdk/agrifood/azure-mgmt-agrifood/azure/mgmt/agrifood/models/_models_py3.py +++ b/sdk/agrifood/azure-mgmt-agrifood/azure/mgmt/agrifood/models/_models_py3.py @@ -8,68 +8,15 @@ # -------------------------------------------------------------------------- import datetime -import sys -from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union +from typing import Dict, List, Optional, TYPE_CHECKING, Union from .. import _serialization -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports - if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from .. import models as _models -class ApiProperties(_serialization.Model): - """Api properties. - - :ivar api_freshness_window_in_minutes: Interval in minutes for which the weather data for the - api needs to be refreshed. - :vartype api_freshness_window_in_minutes: int - """ - - _validation = { - "api_freshness_window_in_minutes": {"maximum": 10080, "minimum": 0}, - } - - _attribute_map = { - "api_freshness_window_in_minutes": {"key": "apiFreshnessWindowInMinutes", "type": "int"}, - } - - def __init__(self, *, api_freshness_window_in_minutes: Optional[int] = None, **kwargs): - """ - :keyword api_freshness_window_in_minutes: Interval in minutes for which the weather data for - the api needs to be refreshed. - :paramtype api_freshness_window_in_minutes: int - """ - super().__init__(**kwargs) - self.api_freshness_window_in_minutes = api_freshness_window_in_minutes - - -class ArmAsyncOperation(_serialization.Model): - """Arm async operation class. - Ref: https://docs.microsoft.com/en-us/azure/azure-resource-manager/management/async-operations. - - :ivar status: Status of the async operation. - :vartype status: str - """ - - _attribute_map = { - "status": {"key": "status", "type": "str"}, - } - - def __init__(self, *, status: Optional[str] = None, **kwargs): - """ - :keyword status: Status of the async operation. - :paramtype status: str - """ - super().__init__(**kwargs) - self.status = status - - class CheckNameAvailabilityRequest(_serialization.Model): """The check availability request body. @@ -286,31 +233,26 @@ class Resource(_serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource ID for the resource. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str :ivar name: The name of the resource. :vartype name: str :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.agrifood.models.SystemData """ _validation = { "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, - "system_data": {"readonly": True}, } _attribute_map = { "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, } def __init__(self, **kwargs): @@ -319,7 +261,6 @@ def __init__(self, **kwargs): self.id = None self.name = None self.type = None - self.system_data = None class ProxyResource(Resource): @@ -327,31 +268,26 @@ class ProxyResource(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource ID for the resource. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str :ivar name: The name of the resource. :vartype name: str :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.agrifood.models.SystemData """ _validation = { "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, - "system_data": {"readonly": True}, } _attribute_map = { "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, } def __init__(self, **kwargs): @@ -359,21 +295,20 @@ def __init__(self, **kwargs): super().__init__(**kwargs) -class Extension(ProxyResource): # pylint: disable=too-many-instance-attributes +class Extension(ProxyResource): """Extension resource. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource ID for the resource. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str :ivar name: The name of the resource. :vartype name: str :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. + :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.agrifood.models.SystemData :ivar e_tag: The ETag value to implement optimistic concurrency. :vartype e_tag: str @@ -387,8 +322,6 @@ class Extension(ProxyResource): # pylint: disable=too-many-instance-attributes :vartype extension_auth_link: str :ivar extension_api_docs_link: Extension api docs link. :vartype extension_api_docs_link: str - :ivar additional_api_properties: Additional api properties. - :vartype additional_api_properties: dict[str, ~azure.mgmt.agrifood.models.ApiProperties] """ _validation = { @@ -402,7 +335,6 @@ class Extension(ProxyResource): # pylint: disable=too-many-instance-attributes "installed_extension_version": {"readonly": True, "pattern": r"^([1-9]|10).\d$"}, "extension_auth_link": {"readonly": True}, "extension_api_docs_link": {"readonly": True}, - "additional_api_properties": {"readonly": True}, } _attribute_map = { @@ -416,55 +348,18 @@ class Extension(ProxyResource): # pylint: disable=too-many-instance-attributes "installed_extension_version": {"key": "properties.installedExtensionVersion", "type": "str"}, "extension_auth_link": {"key": "properties.extensionAuthLink", "type": "str"}, "extension_api_docs_link": {"key": "properties.extensionApiDocsLink", "type": "str"}, - "additional_api_properties": {"key": "properties.additionalApiProperties", "type": "{ApiProperties}"}, } def __init__(self, **kwargs): """ """ super().__init__(**kwargs) + self.system_data = None self.e_tag = None self.extension_id = None self.extension_category = None self.installed_extension_version = None self.extension_auth_link = None self.extension_api_docs_link = None - self.additional_api_properties = None - - -class ExtensionInstallationRequest(_serialization.Model): - """Extension Installation Request Body. - - :ivar extension_version: Extension Version. - :vartype extension_version: str - :ivar additional_api_properties: Additional Api Properties. - :vartype additional_api_properties: dict[str, ~azure.mgmt.agrifood.models.ApiProperties] - """ - - _validation = { - "extension_version": {"max_length": 10, "min_length": 3}, - } - - _attribute_map = { - "extension_version": {"key": "extensionVersion", "type": "str"}, - "additional_api_properties": {"key": "additionalApiProperties", "type": "{ApiProperties}"}, - } - - def __init__( - self, - *, - extension_version: Optional[str] = None, - additional_api_properties: Optional[Dict[str, "_models.ApiProperties"]] = None, - **kwargs - ): - """ - :keyword extension_version: Extension Version. - :paramtype extension_version: str - :keyword additional_api_properties: Additional Api Properties. - :paramtype additional_api_properties: dict[str, ~azure.mgmt.agrifood.models.ApiProperties] - """ - super().__init__(**kwargs) - self.extension_version = extension_version - self.additional_api_properties = additional_api_properties class ExtensionListResponse(_serialization.Model): @@ -504,17 +399,14 @@ class TrackedResource(Resource): All required parameters must be populated in order to send to Azure. - :ivar id: Fully qualified resource ID for the resource. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str :ivar name: The name of the resource. :vartype name: str :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.agrifood.models.SystemData :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar location: The geo-location where the resource lives. Required. @@ -525,7 +417,6 @@ class TrackedResource(Resource): "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, - "system_data": {"readonly": True}, "location": {"required": True}, } @@ -533,7 +424,6 @@ class TrackedResource(Resource): "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, "tags": {"key": "tags", "type": "{str}"}, "location": {"key": "location", "type": "str"}, } @@ -550,103 +440,66 @@ def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kw self.location = location -class FarmBeats(TrackedResource): # pylint: disable=too-many-instance-attributes +class FarmBeats(TrackedResource): """FarmBeats ARM Resource. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar id: Fully qualified resource ID for the resource. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str :ivar name: The name of the resource. :vartype name: str :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.agrifood.models.SystemData :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar location: The geo-location where the resource lives. Required. :vartype location: str - :ivar identity: Identity for the resource. - :vartype identity: ~azure.mgmt.agrifood.models.Identity + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.agrifood.models.SystemData :ivar instance_uri: Uri of the FarmBeats instance. :vartype instance_uri: str - :ivar provisioning_state: FarmBeats instance provisioning state. Known values are: "Creating", - "Updating", "Deleting", "Succeeded", and "Failed". - :vartype provisioning_state: str or ~azure.mgmt.agrifood.models.ProvisioningState - :ivar sensor_integration: Sensor integration request model. - :vartype sensor_integration: ~azure.mgmt.agrifood.models.SensorIntegration - :ivar public_network_access: Property to allow or block public traffic for an Azure FarmBeats - resource. Known values are: "Enabled" and "Hybrid". - :vartype public_network_access: str or ~azure.mgmt.agrifood.models.PublicNetworkAccess - :ivar private_endpoint_connections: The private endpoint connection resource. - :vartype private_endpoint_connections: ~azure.mgmt.agrifood.models.PrivateEndpointConnection + :ivar provisioning_state_sz: FarmBeats instance provisioning state. Known values are: + "Succeeded" and "Failed". + :vartype provisioning_state_sz: str or ~azure.mgmt.agrifood.models.ProvisioningState """ _validation = { "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, - "system_data": {"readonly": True}, "location": {"required": True}, + "system_data": {"readonly": True}, "instance_uri": {"readonly": True}, - "provisioning_state": {"readonly": True}, - "private_endpoint_connections": {"readonly": True}, + "provisioning_state_sz": {"readonly": True}, } _attribute_map = { "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, "tags": {"key": "tags", "type": "{str}"}, "location": {"key": "location", "type": "str"}, - "identity": {"key": "identity", "type": "Identity"}, + "system_data": {"key": "systemData", "type": "SystemData"}, "instance_uri": {"key": "properties.instanceUri", "type": "str"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "sensor_integration": {"key": "properties.sensorIntegration", "type": "SensorIntegration"}, - "public_network_access": {"key": "properties.publicNetworkAccess", "type": "str"}, - "private_endpoint_connections": { - "key": "properties.privateEndpointConnections", - "type": "PrivateEndpointConnection", - }, + "provisioning_state_sz": {"key": "properties.provisioningStateSz", "type": "str"}, } - def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - identity: Optional["_models.Identity"] = None, - sensor_integration: Optional["_models.SensorIntegration"] = None, - public_network_access: Optional[Union[str, "_models.PublicNetworkAccess"]] = None, - **kwargs - ): + def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs): """ :keyword tags: Resource tags. :paramtype tags: dict[str, str] :keyword location: The geo-location where the resource lives. Required. :paramtype location: str - :keyword identity: Identity for the resource. - :paramtype identity: ~azure.mgmt.agrifood.models.Identity - :keyword sensor_integration: Sensor integration request model. - :paramtype sensor_integration: ~azure.mgmt.agrifood.models.SensorIntegration - :keyword public_network_access: Property to allow or block public traffic for an Azure - FarmBeats resource. Known values are: "Enabled" and "Hybrid". - :paramtype public_network_access: str or ~azure.mgmt.agrifood.models.PublicNetworkAccess """ super().__init__(tags=tags, location=location, **kwargs) - self.identity = identity + self.system_data = None self.instance_uri = None - self.provisioning_state = None - self.sensor_integration = sensor_integration - self.public_network_access = public_network_access - self.private_endpoint_connections = None + self.provisioning_state_sz = None class FarmBeatsExtension(ProxyResource): # pylint: disable=too-many-instance-attributes @@ -654,16 +507,15 @@ class FarmBeatsExtension(ProxyResource): # pylint: disable=too-many-instance-at Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource ID for the resource. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str :ivar name: The name of the resource. :vartype name: str :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. + :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.agrifood.models.SystemData :ivar target_resource_type: Target ResourceType of the farmBeatsExtension. :vartype target_resource_type: str @@ -737,6 +589,7 @@ class FarmBeatsExtension(ProxyResource): # pylint: disable=too-many-instance-at def __init__(self, **kwargs): """ """ super().__init__(**kwargs) + self.system_data = None self.target_resource_type = None self.farm_beats_extension_id = None self.farm_beats_extension_name = None @@ -786,7 +639,7 @@ class FarmBeatsListResponse(_serialization.Model): :ivar value: List of requested objects. :vartype value: list[~azure.mgmt.agrifood.models.FarmBeats] - :ivar next_link: Continuation link (absolute URI) to the next page of results in the list. + :ivar next_link: Continuation link (absolute URI) to the next page of result in the list. :vartype next_link: str """ @@ -809,591 +662,32 @@ def __init__(self, *, value: Optional[List["_models.FarmBeats"]] = None, **kwarg self.next_link = None -class FarmBeatsSolution(ProxyResource): - """FarmBeats solution resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.agrifood.models.SystemData - :ivar properties: FarmBeatsSolution properties. - :vartype properties: ~azure.mgmt.agrifood.models.FarmBeatsSolutionProperties - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "properties": {"key": "properties", "type": "FarmBeatsSolutionProperties"}, - } - - def __init__(self, *, properties: Optional["_models.FarmBeatsSolutionProperties"] = None, **kwargs): - """ - :keyword properties: FarmBeatsSolution properties. - :paramtype properties: ~azure.mgmt.agrifood.models.FarmBeatsSolutionProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class FarmBeatsSolutionListResponse(_serialization.Model): - """Paged response contains list of requested objects and a URL link to get the next set of results. - - :ivar value: List of requested objects. - :vartype value: list[~azure.mgmt.agrifood.models.FarmBeatsSolution] - :ivar skip_token: Token used in retrieving the next page. If null, there are no additional - pages. - :vartype skip_token: str - :ivar next_link: Continuation link (absolute URI) to the next page of results in the list. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[FarmBeatsSolution]"}, - "skip_token": {"key": "$skipToken", "type": "str"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.FarmBeatsSolution"]] = None, - skip_token: Optional[str] = None, - next_link: Optional[str] = None, - **kwargs - ): - """ - :keyword value: List of requested objects. - :paramtype value: list[~azure.mgmt.agrifood.models.FarmBeatsSolution] - :keyword skip_token: Token used in retrieving the next page. If null, there are no additional - pages. - :paramtype skip_token: str - :keyword next_link: Continuation link (absolute URI) to the next page of results in the list. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.skip_token = skip_token - self.next_link = next_link - - -class FarmBeatsSolutionProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes - """FarmBeatsSolution properties. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar partner_id: Solution Partner Id. - :vartype partner_id: str - :ivar partner_tenant_id: Solution Partner Tenant Id. - :vartype partner_tenant_id: str - :ivar data_access_scopes: Gets scope of the FarmBeats data access that's required for - processing solution request to partner. - Example: For gdd they might need weatherScope and satelliteScope. - :vartype data_access_scopes: list[str] - :ivar marketplace_offer_details: - :vartype marketplace_offer_details: ~azure.mgmt.agrifood.models.MarketplaceOfferDetails - :ivar input_parameters_validation_scopes: Gets scope of the FarmBeats related parameters that - need to be validated in apiInputParameters. - Example: For if 'FarmHierarchy' is the input scope for 'WeatherScope' data access - For working with WeatherScope we need FarmHierarchy info implies 'farmerId', 'resourceId', - 'resourceType' in request body. - :vartype input_parameters_validation_scopes: - list[~azure.mgmt.agrifood.models.ResourceParameter] - :ivar open_api_specs_dictionary: Gets apiVersion: Swagger Document Dictionary to capture all - api versions of swagger exposed by partner to farmbeats. - :vartype open_api_specs_dictionary: dict[str, JSON] - :ivar evaluated_outputs_dictionary: Gets example name: insight sample response Dictionary to - capture all variations of computed results ingested by partner. - :vartype evaluated_outputs_dictionary: dict[str, - ~azure.mgmt.agrifood.models.SolutionEvaluatedOutput] - :ivar access_fb_application_id: Application id of the multi tenant application to be used by - partner to access FarmBeats data. - :vartype access_fb_application_id: str - :ivar role_id: Role Id of the SaaS multi tenant application to access relevant fb data. - :vartype role_id: str - :ivar role_name: Role Name of the SaaS multi tenant application to access relevant fb data. - :vartype role_name: str - :ivar access_fb_application_name: Application name of the multi tenant application to be used - by partner to access FarmBeatsData. - :vartype access_fb_application_name: str - """ - - _validation = { - "partner_id": {"readonly": True}, - "partner_tenant_id": {"readonly": True}, - "data_access_scopes": {"readonly": True}, - "input_parameters_validation_scopes": {"readonly": True}, - "open_api_specs_dictionary": {"readonly": True}, - "evaluated_outputs_dictionary": {"readonly": True}, - "access_fb_application_id": {"readonly": True}, - "role_id": {"readonly": True}, - "role_name": {"readonly": True}, - "access_fb_application_name": {"readonly": True}, - } - - _attribute_map = { - "partner_id": {"key": "partnerId", "type": "str"}, - "partner_tenant_id": {"key": "partnerTenantId", "type": "str"}, - "data_access_scopes": {"key": "dataAccessScopes", "type": "[str]"}, - "marketplace_offer_details": {"key": "marketplaceOfferDetails", "type": "MarketplaceOfferDetails"}, - "input_parameters_validation_scopes": {"key": "inputParametersValidationScopes", "type": "[ResourceParameter]"}, - "open_api_specs_dictionary": {"key": "openApiSpecsDictionary", "type": "{object}"}, - "evaluated_outputs_dictionary": {"key": "evaluatedOutputsDictionary", "type": "{SolutionEvaluatedOutput}"}, - "access_fb_application_id": {"key": "accessFBApplicationId", "type": "str"}, - "role_id": {"key": "roleId", "type": "str"}, - "role_name": {"key": "roleName", "type": "str"}, - "access_fb_application_name": {"key": "accessFBApplicationName", "type": "str"}, - } - - def __init__(self, *, marketplace_offer_details: Optional["_models.MarketplaceOfferDetails"] = None, **kwargs): - """ - :keyword marketplace_offer_details: - :paramtype marketplace_offer_details: ~azure.mgmt.agrifood.models.MarketplaceOfferDetails - """ - super().__init__(**kwargs) - self.partner_id = None - self.partner_tenant_id = None - self.data_access_scopes = None - self.marketplace_offer_details = marketplace_offer_details - self.input_parameters_validation_scopes = None - self.open_api_specs_dictionary = None - self.evaluated_outputs_dictionary = None - self.access_fb_application_id = None - self.role_id = None - self.role_name = None - self.access_fb_application_name = None - - -class FarmBeatsUpdateProperties(_serialization.Model): - """FarmBeats ARM Resource properties. - - :ivar sensor_integration: Sensor integration request model. - :vartype sensor_integration: ~azure.mgmt.agrifood.models.SensorIntegration - :ivar public_network_access: Property to allow or block public traffic for an Azure FarmBeats - resource. Known values are: "Enabled" and "Hybrid". - :vartype public_network_access: str or ~azure.mgmt.agrifood.models.PublicNetworkAccess - """ - - _attribute_map = { - "sensor_integration": {"key": "sensorIntegration", "type": "SensorIntegration"}, - "public_network_access": {"key": "publicNetworkAccess", "type": "str"}, - } - - def __init__( - self, - *, - sensor_integration: Optional["_models.SensorIntegration"] = None, - public_network_access: Optional[Union[str, "_models.PublicNetworkAccess"]] = None, - **kwargs - ): - """ - :keyword sensor_integration: Sensor integration request model. - :paramtype sensor_integration: ~azure.mgmt.agrifood.models.SensorIntegration - :keyword public_network_access: Property to allow or block public traffic for an Azure - FarmBeats resource. Known values are: "Enabled" and "Hybrid". - :paramtype public_network_access: str or ~azure.mgmt.agrifood.models.PublicNetworkAccess - """ - super().__init__(**kwargs) - self.sensor_integration = sensor_integration - self.public_network_access = public_network_access - - class FarmBeatsUpdateRequestModel(_serialization.Model): """FarmBeats update request. :ivar location: Geo-location where the resource lives. :vartype location: str - :ivar identity: Identity for the resource. - :vartype identity: ~azure.mgmt.agrifood.models.Identity - :ivar properties: FarmBeats ARM Resource properties. - :vartype properties: ~azure.mgmt.agrifood.models.FarmBeatsUpdateProperties :ivar tags: Resource tags. :vartype tags: dict[str, str] """ _attribute_map = { "location": {"key": "location", "type": "str"}, - "identity": {"key": "identity", "type": "Identity"}, - "properties": {"key": "properties", "type": "FarmBeatsUpdateProperties"}, "tags": {"key": "tags", "type": "{str}"}, } - def __init__( - self, - *, - location: Optional[str] = None, - identity: Optional["_models.Identity"] = None, - properties: Optional["_models.FarmBeatsUpdateProperties"] = None, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, **kwargs): """ :keyword location: Geo-location where the resource lives. :paramtype location: str - :keyword identity: Identity for the resource. - :paramtype identity: ~azure.mgmt.agrifood.models.Identity - :keyword properties: FarmBeats ARM Resource properties. - :paramtype properties: ~azure.mgmt.agrifood.models.FarmBeatsUpdateProperties :keyword tags: Resource tags. :paramtype tags: dict[str, str] """ super().__init__(**kwargs) self.location = location - self.identity = identity - self.properties = properties self.tags = tags -class Identity(_serialization.Model): - """Identity for the resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar principal_id: The principal ID of resource identity. The value must be an UUID. - :vartype principal_id: str - :ivar tenant_id: The tenant ID of resource. The value must be an UUID. - :vartype tenant_id: str - :ivar type: The identity type. Default value is "SystemAssigned". - :vartype type: str - """ - - _validation = { - "principal_id": {"readonly": True}, - "tenant_id": {"readonly": True}, - } - - _attribute_map = { - "principal_id": {"key": "principalId", "type": "str"}, - "tenant_id": {"key": "tenantId", "type": "str"}, - "type": {"key": "type", "type": "str"}, - } - - def __init__(self, *, type: Optional[Literal["SystemAssigned"]] = None, **kwargs): - """ - :keyword type: The identity type. Default value is "SystemAssigned". - :paramtype type: str - """ - super().__init__(**kwargs) - self.principal_id = None - self.tenant_id = None - self.type = type - - -class Insight(_serialization.Model): # pylint: disable=too-many-instance-attributes - """Insight. - - :ivar farmer_id: - :vartype farmer_id: str - :ivar model_id: - :vartype model_id: str - :ivar resource_type: - :vartype resource_type: str - :ivar resource_id: - :vartype resource_id: str - :ivar model_version: - :vartype model_version: str - :ivar insight_start_date_time: - :vartype insight_start_date_time: ~datetime.datetime - :ivar insight_end_date_time: - :vartype insight_end_date_time: ~datetime.datetime - :ivar measures: Dictionary of :code:``. - :vartype measures: dict[str, ~azure.mgmt.agrifood.models.Measure] - :ivar id: - :vartype id: str - :ivar status: - :vartype status: str - :ivar created_date_time: - :vartype created_date_time: ~datetime.datetime - :ivar modified_date_time: - :vartype modified_date_time: ~datetime.datetime - :ivar e_tag: - :vartype e_tag: str - :ivar name: - :vartype name: str - :ivar description: - :vartype description: str - :ivar properties: Dictionary of :code:``. - :vartype properties: dict[str, any] - """ - - _attribute_map = { - "farmer_id": {"key": "farmerId", "type": "str"}, - "model_id": {"key": "modelId", "type": "str"}, - "resource_type": {"key": "resourceType", "type": "str"}, - "resource_id": {"key": "resourceId", "type": "str"}, - "model_version": {"key": "modelVersion", "type": "str"}, - "insight_start_date_time": {"key": "insightStartDateTime", "type": "iso-8601"}, - "insight_end_date_time": {"key": "insightEndDateTime", "type": "iso-8601"}, - "measures": {"key": "measures", "type": "{Measure}"}, - "id": {"key": "id", "type": "str"}, - "status": {"key": "status", "type": "str"}, - "created_date_time": {"key": "createdDateTime", "type": "iso-8601"}, - "modified_date_time": {"key": "modifiedDateTime", "type": "iso-8601"}, - "e_tag": {"key": "eTag", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "description": {"key": "description", "type": "str"}, - "properties": {"key": "properties", "type": "{object}"}, - } - - def __init__( - self, - *, - farmer_id: Optional[str] = None, - model_id: Optional[str] = None, - resource_type: Optional[str] = None, - resource_id: Optional[str] = None, - model_version: Optional[str] = None, - insight_start_date_time: Optional[datetime.datetime] = None, - insight_end_date_time: Optional[datetime.datetime] = None, - measures: Optional[Dict[str, "_models.Measure"]] = None, - id: Optional[str] = None, # pylint: disable=redefined-builtin - status: Optional[str] = None, - created_date_time: Optional[datetime.datetime] = None, - modified_date_time: Optional[datetime.datetime] = None, - e_tag: Optional[str] = None, - name: Optional[str] = None, - description: Optional[str] = None, - properties: Optional[Dict[str, Any]] = None, - **kwargs - ): - """ - :keyword farmer_id: - :paramtype farmer_id: str - :keyword model_id: - :paramtype model_id: str - :keyword resource_type: - :paramtype resource_type: str - :keyword resource_id: - :paramtype resource_id: str - :keyword model_version: - :paramtype model_version: str - :keyword insight_start_date_time: - :paramtype insight_start_date_time: ~datetime.datetime - :keyword insight_end_date_time: - :paramtype insight_end_date_time: ~datetime.datetime - :keyword measures: Dictionary of :code:``. - :paramtype measures: dict[str, ~azure.mgmt.agrifood.models.Measure] - :keyword id: - :paramtype id: str - :keyword status: - :paramtype status: str - :keyword created_date_time: - :paramtype created_date_time: ~datetime.datetime - :keyword modified_date_time: - :paramtype modified_date_time: ~datetime.datetime - :keyword e_tag: - :paramtype e_tag: str - :keyword name: - :paramtype name: str - :keyword description: - :paramtype description: str - :keyword properties: Dictionary of :code:``. - :paramtype properties: dict[str, any] - """ - super().__init__(**kwargs) - self.farmer_id = farmer_id - self.model_id = model_id - self.resource_type = resource_type - self.resource_id = resource_id - self.model_version = model_version - self.insight_start_date_time = insight_start_date_time - self.insight_end_date_time = insight_end_date_time - self.measures = measures - self.id = id - self.status = status - self.created_date_time = created_date_time - self.modified_date_time = modified_date_time - self.e_tag = e_tag - self.name = name - self.description = description - self.properties = properties - - -class InsightAttachment(_serialization.Model): # pylint: disable=too-many-instance-attributes - """InsightAttachment. - - :ivar insight_id: - :vartype insight_id: str - :ivar model_id: - :vartype model_id: str - :ivar resource_type: - :vartype resource_type: str - :ivar resource_id: - :vartype resource_id: str - :ivar file_link: - :vartype file_link: str - :ivar original_file_name: - :vartype original_file_name: str - :ivar farmer_id: - :vartype farmer_id: str - :ivar id: - :vartype id: str - :ivar status: - :vartype status: str - :ivar created_date_time: - :vartype created_date_time: ~datetime.datetime - :ivar modified_date_time: - :vartype modified_date_time: ~datetime.datetime - :ivar name: - :vartype name: str - :ivar description: - :vartype description: str - :ivar e_tag: - :vartype e_tag: str - """ - - _attribute_map = { - "insight_id": {"key": "insightId", "type": "str"}, - "model_id": {"key": "modelId", "type": "str"}, - "resource_type": {"key": "resourceType", "type": "str"}, - "resource_id": {"key": "resourceId", "type": "str"}, - "file_link": {"key": "fileLink", "type": "str"}, - "original_file_name": {"key": "originalFileName", "type": "str"}, - "farmer_id": {"key": "farmerId", "type": "str"}, - "id": {"key": "id", "type": "str"}, - "status": {"key": "status", "type": "str"}, - "created_date_time": {"key": "createdDateTime", "type": "iso-8601"}, - "modified_date_time": {"key": "modifiedDateTime", "type": "iso-8601"}, - "name": {"key": "name", "type": "str"}, - "description": {"key": "description", "type": "str"}, - "e_tag": {"key": "eTag", "type": "str"}, - } - - def __init__( - self, - *, - insight_id: Optional[str] = None, - model_id: Optional[str] = None, - resource_type: Optional[str] = None, - resource_id: Optional[str] = None, - file_link: Optional[str] = None, - original_file_name: Optional[str] = None, - farmer_id: Optional[str] = None, - id: Optional[str] = None, # pylint: disable=redefined-builtin - status: Optional[str] = None, - created_date_time: Optional[datetime.datetime] = None, - modified_date_time: Optional[datetime.datetime] = None, - name: Optional[str] = None, - description: Optional[str] = None, - e_tag: Optional[str] = None, - **kwargs - ): - """ - :keyword insight_id: - :paramtype insight_id: str - :keyword model_id: - :paramtype model_id: str - :keyword resource_type: - :paramtype resource_type: str - :keyword resource_id: - :paramtype resource_id: str - :keyword file_link: - :paramtype file_link: str - :keyword original_file_name: - :paramtype original_file_name: str - :keyword farmer_id: - :paramtype farmer_id: str - :keyword id: - :paramtype id: str - :keyword status: - :paramtype status: str - :keyword created_date_time: - :paramtype created_date_time: ~datetime.datetime - :keyword modified_date_time: - :paramtype modified_date_time: ~datetime.datetime - :keyword name: - :paramtype name: str - :keyword description: - :paramtype description: str - :keyword e_tag: - :paramtype e_tag: str - """ - super().__init__(**kwargs) - self.insight_id = insight_id - self.model_id = model_id - self.resource_type = resource_type - self.resource_id = resource_id - self.file_link = file_link - self.original_file_name = original_file_name - self.farmer_id = farmer_id - self.id = id - self.status = status - self.created_date_time = created_date_time - self.modified_date_time = modified_date_time - self.name = name - self.description = description - self.e_tag = e_tag - - -class MarketplaceOfferDetails(_serialization.Model): - """MarketplaceOfferDetails. - - :ivar saas_offer_id: - :vartype saas_offer_id: str - :ivar publisher_id: - :vartype publisher_id: str - """ - - _attribute_map = { - "saas_offer_id": {"key": "saasOfferId", "type": "str"}, - "publisher_id": {"key": "publisherId", "type": "str"}, - } - - def __init__(self, *, saas_offer_id: Optional[str] = None, publisher_id: Optional[str] = None, **kwargs): - """ - :keyword saas_offer_id: - :paramtype saas_offer_id: str - :keyword publisher_id: - :paramtype publisher_id: str - """ - super().__init__(**kwargs) - self.saas_offer_id = saas_offer_id - self.publisher_id = publisher_id - - -class Measure(_serialization.Model): - """Measure. - - :ivar unit: - :vartype unit: str - :ivar value: - :vartype value: float - """ - - _attribute_map = { - "unit": {"key": "unit", "type": "str"}, - "value": {"key": "value", "type": "float"}, - } - - def __init__(self, *, unit: Optional[str] = None, value: Optional[float] = None, **kwargs): - """ - :keyword unit: - :paramtype unit: str - :keyword value: - :paramtype value: float - """ - super().__init__(**kwargs) - self.unit = unit - self.value = value - - class Operation(_serialization.Model): """Details of a REST API operation, returned from the Resource Provider Operations API. @@ -1514,544 +808,6 @@ def __init__(self, **kwargs): self.next_link = None -class PrivateEndpoint(_serialization.Model): - """The private endpoint resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The ARM identifier for private endpoint. - :vartype id: str - """ - - _validation = { - "id": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - } - - def __init__(self, **kwargs): - """ """ - super().__init__(**kwargs) - self.id = None - - -class PrivateEndpointConnection(Resource): - """The private endpoint connection resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.agrifood.models.SystemData - :ivar group_ids: The group ids for the private endpoint resource. - :vartype group_ids: list[str] - :ivar private_endpoint: The private endpoint resource. - :vartype private_endpoint: ~azure.mgmt.agrifood.models.PrivateEndpoint - :ivar private_link_service_connection_state: A collection of information about the state of the - connection between service consumer and provider. - :vartype private_link_service_connection_state: - ~azure.mgmt.agrifood.models.PrivateLinkServiceConnectionState - :ivar provisioning_state: The provisioning state of the private endpoint connection resource. - Known values are: "Succeeded", "Creating", "Deleting", and "Failed". - :vartype provisioning_state: str or - ~azure.mgmt.agrifood.models.PrivateEndpointConnectionProvisioningState - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "group_ids": {"readonly": True}, - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "group_ids": {"key": "properties.groupIds", "type": "[str]"}, - "private_endpoint": {"key": "properties.privateEndpoint", "type": "PrivateEndpoint"}, - "private_link_service_connection_state": { - "key": "properties.privateLinkServiceConnectionState", - "type": "PrivateLinkServiceConnectionState", - }, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - } - - def __init__( - self, - *, - private_endpoint: Optional["_models.PrivateEndpoint"] = None, - private_link_service_connection_state: Optional["_models.PrivateLinkServiceConnectionState"] = None, - **kwargs - ): - """ - :keyword private_endpoint: The private endpoint resource. - :paramtype private_endpoint: ~azure.mgmt.agrifood.models.PrivateEndpoint - :keyword private_link_service_connection_state: A collection of information about the state of - the connection between service consumer and provider. - :paramtype private_link_service_connection_state: - ~azure.mgmt.agrifood.models.PrivateLinkServiceConnectionState - """ - super().__init__(**kwargs) - self.group_ids = None - self.private_endpoint = private_endpoint - self.private_link_service_connection_state = private_link_service_connection_state - self.provisioning_state = None - - -class PrivateEndpointConnectionListResult(_serialization.Model): - """List of private endpoint connections associated with the specified resource. - - :ivar value: Array of private endpoint connections. - :vartype value: list[~azure.mgmt.agrifood.models.PrivateEndpointConnection] - """ - - _attribute_map = { - "value": {"key": "value", "type": "[PrivateEndpointConnection]"}, - } - - def __init__(self, *, value: Optional[List["_models.PrivateEndpointConnection"]] = None, **kwargs): - """ - :keyword value: Array of private endpoint connections. - :paramtype value: list[~azure.mgmt.agrifood.models.PrivateEndpointConnection] - """ - super().__init__(**kwargs) - self.value = value - - -class PrivateLinkResource(Resource): - """A private link resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.agrifood.models.SystemData - :ivar group_id: The private link resource group id. - :vartype group_id: str - :ivar required_members: The private link resource required member names. - :vartype required_members: list[str] - :ivar required_zone_names: The private link resource private link DNS zone name. - :vartype required_zone_names: list[str] - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "group_id": {"readonly": True}, - "required_members": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "group_id": {"key": "properties.groupId", "type": "str"}, - "required_members": {"key": "properties.requiredMembers", "type": "[str]"}, - "required_zone_names": {"key": "properties.requiredZoneNames", "type": "[str]"}, - } - - def __init__(self, *, required_zone_names: Optional[List[str]] = None, **kwargs): - """ - :keyword required_zone_names: The private link resource private link DNS zone name. - :paramtype required_zone_names: list[str] - """ - super().__init__(**kwargs) - self.group_id = None - self.required_members = None - self.required_zone_names = required_zone_names - - -class PrivateLinkResourceListResult(_serialization.Model): - """A list of private link resources. - - :ivar value: Array of private link resources. - :vartype value: list[~azure.mgmt.agrifood.models.PrivateLinkResource] - """ - - _attribute_map = { - "value": {"key": "value", "type": "[PrivateLinkResource]"}, - } - - def __init__(self, *, value: Optional[List["_models.PrivateLinkResource"]] = None, **kwargs): - """ - :keyword value: Array of private link resources. - :paramtype value: list[~azure.mgmt.agrifood.models.PrivateLinkResource] - """ - super().__init__(**kwargs) - self.value = value - - -class PrivateLinkServiceConnectionState(_serialization.Model): - """A collection of information about the state of the connection between service consumer and provider. - - :ivar status: Indicates whether the connection has been Approved/Rejected/Removed by the owner - of the service. Known values are: "Pending", "Approved", and "Rejected". - :vartype status: str or ~azure.mgmt.agrifood.models.PrivateEndpointServiceConnectionStatus - :ivar description: The reason for approval/rejection of the connection. - :vartype description: str - :ivar actions_required: A message indicating if changes on the service provider require any - updates on the consumer. - :vartype actions_required: str - """ - - _attribute_map = { - "status": {"key": "status", "type": "str"}, - "description": {"key": "description", "type": "str"}, - "actions_required": {"key": "actionsRequired", "type": "str"}, - } - - def __init__( - self, - *, - status: Optional[Union[str, "_models.PrivateEndpointServiceConnectionStatus"]] = None, - description: Optional[str] = None, - actions_required: Optional[str] = None, - **kwargs - ): - """ - :keyword status: Indicates whether the connection has been Approved/Rejected/Removed by the - owner of the service. Known values are: "Pending", "Approved", and "Rejected". - :paramtype status: str or ~azure.mgmt.agrifood.models.PrivateEndpointServiceConnectionStatus - :keyword description: The reason for approval/rejection of the connection. - :paramtype description: str - :keyword actions_required: A message indicating if changes on the service provider require any - updates on the consumer. - :paramtype actions_required: str - """ - super().__init__(**kwargs) - self.status = status - self.description = description - self.actions_required = actions_required - - -class ResourceParameter(_serialization.Model): - """ResourceParameter. - - :ivar resource_id_name: - :vartype resource_id_name: str - :ivar resource_type: - :vartype resource_type: str - """ - - _attribute_map = { - "resource_id_name": {"key": "resourceIdName", "type": "str"}, - "resource_type": {"key": "resourceType", "type": "str"}, - } - - def __init__(self, *, resource_id_name: Optional[str] = None, resource_type: Optional[str] = None, **kwargs): - """ - :keyword resource_id_name: - :paramtype resource_id_name: str - :keyword resource_type: - :paramtype resource_type: str - """ - super().__init__(**kwargs) - self.resource_id_name = resource_id_name - self.resource_type = resource_type - - -class SensorIntegration(_serialization.Model): - """Sensor integration request model. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar enabled: Sensor integration enable state. Allowed values are True, None. - :vartype enabled: str - :ivar provisioning_state: Sensor integration instance provisioning state. Known values are: - "Creating", "Updating", "Deleting", "Succeeded", and "Failed". - :vartype provisioning_state: str or ~azure.mgmt.agrifood.models.ProvisioningState - :ivar provisioning_info: Common error response for all Azure Resource Manager APIs to return - error details for failed operations. (This also follows the OData error response format.). - :vartype provisioning_info: ~azure.mgmt.agrifood.models.ErrorResponse - """ - - _validation = { - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "enabled": {"key": "enabled", "type": "str"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "provisioning_info": {"key": "provisioningInfo", "type": "ErrorResponse"}, - } - - def __init__( - self, *, enabled: Optional[str] = None, provisioning_info: Optional["_models.ErrorResponse"] = None, **kwargs - ): - """ - :keyword enabled: Sensor integration enable state. Allowed values are True, None. - :paramtype enabled: str - :keyword provisioning_info: Common error response for all Azure Resource Manager APIs to return - error details for failed operations. (This also follows the OData error response format.). - :paramtype provisioning_info: ~azure.mgmt.agrifood.models.ErrorResponse - """ - super().__init__(**kwargs) - self.enabled = enabled - self.provisioning_state = None - self.provisioning_info = provisioning_info - - -class Solution(ProxyResource): - """Solution resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.agrifood.models.SystemData - :ivar properties: Solution resource properties. - :vartype properties: ~azure.mgmt.agrifood.models.SolutionProperties - :ivar e_tag: The ETag value to implement optimistic concurrency. - :vartype e_tag: str - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "e_tag": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "properties": {"key": "properties", "type": "SolutionProperties"}, - "e_tag": {"key": "eTag", "type": "str"}, - } - - def __init__(self, *, properties: Optional["_models.SolutionProperties"] = None, **kwargs): - """ - :keyword properties: Solution resource properties. - :paramtype properties: ~azure.mgmt.agrifood.models.SolutionProperties - """ - super().__init__(**kwargs) - self.properties = properties - self.e_tag = None - - -class SolutionEvaluatedOutput(_serialization.Model): - """SolutionEvaluatedOutput. - - :ivar insight_response: - :vartype insight_response: ~azure.mgmt.agrifood.models.Insight - :ivar insight_attachment_response: - :vartype insight_attachment_response: ~azure.mgmt.agrifood.models.InsightAttachment - """ - - _attribute_map = { - "insight_response": {"key": "insightResponse", "type": "Insight"}, - "insight_attachment_response": {"key": "insightAttachmentResponse", "type": "InsightAttachment"}, - } - - def __init__( - self, - *, - insight_response: Optional["_models.Insight"] = None, - insight_attachment_response: Optional["_models.InsightAttachment"] = None, - **kwargs - ): - """ - :keyword insight_response: - :paramtype insight_response: ~azure.mgmt.agrifood.models.Insight - :keyword insight_attachment_response: - :paramtype insight_attachment_response: ~azure.mgmt.agrifood.models.InsightAttachment - """ - super().__init__(**kwargs) - self.insight_response = insight_response - self.insight_attachment_response = insight_attachment_response - - -class SolutionInstallationRequest(_serialization.Model): - """Solution Installation Request Body. - - :ivar properties: Solution resource properties. - :vartype properties: ~azure.mgmt.agrifood.models.SolutionProperties - """ - - _attribute_map = { - "properties": {"key": "properties", "type": "SolutionProperties"}, - } - - def __init__(self, *, properties: Optional["_models.SolutionProperties"] = None, **kwargs): - """ - :keyword properties: Solution resource properties. - :paramtype properties: ~azure.mgmt.agrifood.models.SolutionProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class SolutionListResponse(_serialization.Model): - """Paged response contains list of requested objects and a URL link to get the next set of results. - - :ivar value: List of requested objects. - :vartype value: list[~azure.mgmt.agrifood.models.Solution] - :ivar skip_token: Token used in retrieving the next page. If null, there are no additional - pages. - :vartype skip_token: str - :ivar next_link: Continuation link (absolute URI) to the next page of results in the list. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[Solution]"}, - "skip_token": {"key": "$skipToken", "type": "str"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.Solution"]] = None, - skip_token: Optional[str] = None, - next_link: Optional[str] = None, - **kwargs - ): - """ - :keyword value: List of requested objects. - :paramtype value: list[~azure.mgmt.agrifood.models.Solution] - :keyword skip_token: Token used in retrieving the next page. If null, there are no additional - pages. - :paramtype skip_token: str - :keyword next_link: Continuation link (absolute URI) to the next page of results in the list. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.skip_token = skip_token - self.next_link = next_link - - -class SolutionProperties(_serialization.Model): - """Solution resource properties. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar additional_properties: Unmatched properties from the message are deserialized to this - collection. - :vartype additional_properties: dict[str, any] - :ivar solution_id: Solution Id. - :vartype solution_id: str - :ivar partner_id: Partner Id of the Solution. - :vartype partner_id: str - :ivar saas_subscription_id: SaaS subscriptionId of the installed SaaS application. Required. - :vartype saas_subscription_id: str - :ivar saas_subscription_name: SaaS subscription name of the installed SaaS application. - Required. - :vartype saas_subscription_name: str - :ivar marketplace_publisher_id: SaaS application Publisher Id. Required. - :vartype marketplace_publisher_id: str - :ivar plan_id: SaaS application Plan Id. Required. - :vartype plan_id: str - :ivar offer_id: SaaS application Offer Id. Required. - :vartype offer_id: str - :ivar term_id: SaaS application Term Id. Required. - :vartype term_id: str - """ - - _validation = { - "solution_id": {"readonly": True}, - "partner_id": {"readonly": True}, - "saas_subscription_id": {"required": True, "min_length": 1}, - "saas_subscription_name": {"required": True, "min_length": 1}, - "marketplace_publisher_id": {"required": True, "min_length": 1}, - "plan_id": {"required": True, "min_length": 1}, - "offer_id": {"required": True, "min_length": 1}, - "term_id": {"required": True, "min_length": 1}, - } - - _attribute_map = { - "additional_properties": {"key": "", "type": "{object}"}, - "solution_id": {"key": "solutionId", "type": "str"}, - "partner_id": {"key": "partnerId", "type": "str"}, - "saas_subscription_id": {"key": "saasSubscriptionId", "type": "str"}, - "saas_subscription_name": {"key": "saasSubscriptionName", "type": "str"}, - "marketplace_publisher_id": {"key": "marketplacePublisherId", "type": "str"}, - "plan_id": {"key": "planId", "type": "str"}, - "offer_id": {"key": "offerId", "type": "str"}, - "term_id": {"key": "termId", "type": "str"}, - } - - def __init__( - self, - *, - saas_subscription_id: str, - saas_subscription_name: str, - marketplace_publisher_id: str, - plan_id: str, - offer_id: str, - term_id: str, - additional_properties: Optional[Dict[str, Any]] = None, - **kwargs - ): - """ - :keyword additional_properties: Unmatched properties from the message are deserialized to this - collection. - :paramtype additional_properties: dict[str, any] - :keyword saas_subscription_id: SaaS subscriptionId of the installed SaaS application. Required. - :paramtype saas_subscription_id: str - :keyword saas_subscription_name: SaaS subscription name of the installed SaaS application. - Required. - :paramtype saas_subscription_name: str - :keyword marketplace_publisher_id: SaaS application Publisher Id. Required. - :paramtype marketplace_publisher_id: str - :keyword plan_id: SaaS application Plan Id. Required. - :paramtype plan_id: str - :keyword offer_id: SaaS application Offer Id. Required. - :paramtype offer_id: str - :keyword term_id: SaaS application Term Id. Required. - :paramtype term_id: str - """ - super().__init__(**kwargs) - self.additional_properties = additional_properties - self.solution_id = None - self.partner_id = None - self.saas_subscription_id = saas_subscription_id - self.saas_subscription_name = saas_subscription_name - self.marketplace_publisher_id = marketplace_publisher_id - self.plan_id = plan_id - self.offer_id = offer_id - self.term_id = term_id - - class SystemData(_serialization.Model): """Metadata pertaining to creation and last modification of the resource. diff --git a/sdk/agrifood/azure-mgmt-agrifood/azure/mgmt/agrifood/operations/__init__.py b/sdk/agrifood/azure-mgmt-agrifood/azure/mgmt/agrifood/operations/__init__.py index a699d321e568..c2d30e3e0459 100644 --- a/sdk/agrifood/azure-mgmt-agrifood/azure/mgmt/agrifood/operations/__init__.py +++ b/sdk/agrifood/azure-mgmt-agrifood/azure/mgmt/agrifood/operations/__init__.py @@ -11,10 +11,6 @@ from ._farm_beats_models_operations import FarmBeatsModelsOperations from ._locations_operations import LocationsOperations from ._operations import Operations -from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations -from ._private_link_resources_operations import PrivateLinkResourcesOperations -from ._solutions_operations import SolutionsOperations -from ._solutions_discoverability_operations import SolutionsDiscoverabilityOperations from ._patch import __all__ as _patch_all from ._patch import * # pylint: disable=unused-wildcard-import @@ -26,10 +22,6 @@ "FarmBeatsModelsOperations", "LocationsOperations", "Operations", - "PrivateEndpointConnectionsOperations", - "PrivateLinkResourcesOperations", - "SolutionsOperations", - "SolutionsDiscoverabilityOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/agrifood/azure-mgmt-agrifood/azure/mgmt/agrifood/operations/_extensions_operations.py b/sdk/agrifood/azure-mgmt-agrifood/azure/mgmt/agrifood/operations/_extensions_operations.py index 1fe7371bef2d..47904823f061 100644 --- a/sdk/agrifood/azure-mgmt-agrifood/azure/mgmt/agrifood/operations/_extensions_operations.py +++ b/sdk/agrifood/azure-mgmt-agrifood/azure/mgmt/agrifood/operations/_extensions_operations.py @@ -7,7 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, IO, Iterable, List, Optional, TypeVar, Union, overload +from typing import Any, Callable, Dict, Iterable, List, Optional, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -41,30 +41,29 @@ _SERIALIZER.client_side_validation = False -def build_create_or_update_request( - resource_group_name: str, farm_beats_resource_name: str, extension_id: str, subscription_id: str, **kwargs: Any +def build_create_request( + extension_id: str, farm_beats_resource_name: str, resource_group_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") + api_version: Literal["2020-05-12-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-05-12-preview") ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgFoodPlatform/farmBeats/{farmBeatsResourceName}/extensions/{extensionId}", + "/subscriptions/{subscriptionId}/resourcesGroups/{resourceGroupName}/providers/Microsoft.AgFoodPlatform/farmBeats/{farmBeatsResourceName}/extensions/{extensionId}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "extensionId": _SERIALIZER.url("extension_id", extension_id, "str"), + "farmBeatsResourceName": _SERIALIZER.url("farm_beats_resource_name", farm_beats_resource_name, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "farmBeatsResourceName": _SERIALIZER.url("farm_beats_resource_name", farm_beats_resource_name, "str"), - "extensionId": _SERIALIZER.url("extension_id", extension_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore @@ -73,36 +72,34 @@ def build_create_or_update_request( _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( - resource_group_name: str, farm_beats_resource_name: str, extension_id: str, subscription_id: str, **kwargs: Any + extension_id: str, farm_beats_resource_name: str, resource_group_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") + api_version: Literal["2020-05-12-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-05-12-preview") ) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgFoodPlatform/farmBeats/{farmBeatsResourceName}/extensions/{extensionId}", + "/subscriptions/{subscriptionId}/resourcesGroups/{resourceGroupName}/providers/Microsoft.AgFoodPlatform/farmBeats/{farmBeatsResourceName}/extensions/{extensionId}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "extensionId": _SERIALIZER.url("extension_id", extension_id, "str"), + "farmBeatsResourceName": _SERIALIZER.url("farm_beats_resource_name", farm_beats_resource_name, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "farmBeatsResourceName": _SERIALIZER.url("farm_beats_resource_name", farm_beats_resource_name, "str"), - "extensionId": _SERIALIZER.url("extension_id", extension_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore @@ -116,29 +113,65 @@ def build_get_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_request( - resource_group_name: str, farm_beats_resource_name: str, extension_id: str, subscription_id: str, **kwargs: Any +def build_update_request( + extension_id: str, farm_beats_resource_name: str, resource_group_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") + api_version: Literal["2020-05-12-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-05-12-preview") ) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgFoodPlatform/farmBeats/{farmBeatsResourceName}/extensions/{extensionId}", + "/subscriptions/{subscriptionId}/resourcesGroups/{resourceGroupName}/providers/Microsoft.AgFoodPlatform/farmBeats/{farmBeatsResourceName}/extensions/{extensionId}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "extensionId": _SERIALIZER.url("extension_id", extension_id, "str"), + "farmBeatsResourceName": _SERIALIZER.url("farm_beats_resource_name", farm_beats_resource_name, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "farmBeatsResourceName": _SERIALIZER.url("farm_beats_resource_name", farm_beats_resource_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + extension_id: str, farm_beats_resource_name: str, resource_group_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2020-05-12-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-05-12-preview") + ) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourcesGroups/{resourceGroupName}/providers/Microsoft.AgFoodPlatform/farmBeats/{farmBeatsResourceName}/extensions/{extensionId}", + ) # pylint: disable=line-too-long + path_format_arguments = { "extensionId": _SERIALIZER.url("extension_id", extension_id, "str"), + "farmBeatsResourceName": _SERIALIZER.url("farm_beats_resource_name", farm_beats_resource_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore @@ -166,8 +199,8 @@ def build_list_by_farm_beats_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") + api_version: Literal["2020-05-12-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-05-12-preview") ) accept = _headers.pop("Accept", "application/json") @@ -177,10 +210,10 @@ def build_list_by_farm_beats_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgFoodPlatform/farmBeats/{farmBeatsResourceName}/extensions", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "farmBeatsResourceName": _SERIALIZER.url("farm_beats_resource_name", farm_beats_resource_name, "str"), } @@ -213,7 +246,7 @@ class ExtensionsOperations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.agrifood.AgriFoodMgmtClient`'s + :class:`~azure.mgmt.agrifood.AzureAgriFoodRPService`'s :attr:`extensions` attribute. """ @@ -226,98 +259,88 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @overload - def create_or_update( - self, - resource_group_name: str, - farm_beats_resource_name: str, - extension_id: str, - request_body: Optional[_models.ExtensionInstallationRequest] = None, - *, - content_type: str = "application/json", - **kwargs: Any + @distributed_trace + def create( + self, extension_id: str, farm_beats_resource_name: str, resource_group_name: str, **kwargs: Any ) -> _models.Extension: - """Install or Update extension. AdditionalApiProperties are merged patch and if the extension is - updated to a new version then the obsolete entries will be auto deleted from - AdditionalApiProperties. + """Install extension. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param farm_beats_resource_name: FarmBeats resource name. Required. - :type farm_beats_resource_name: str :param extension_id: Id of extension resource. Required. :type extension_id: str - :param request_body: Extension resource request body. Default value is None. - :type request_body: ~azure.mgmt.agrifood.models.ExtensionInstallationRequest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Extension or the result of cls(response) - :rtype: ~azure.mgmt.agrifood.models.Extension - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create_or_update( - self, - resource_group_name: str, - farm_beats_resource_name: str, - extension_id: str, - request_body: Optional[IO] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Extension: - """Install or Update extension. AdditionalApiProperties are merged patch and if the extension is - updated to a new version then the obsolete entries will be auto deleted from - AdditionalApiProperties. - + :param farm_beats_resource_name: FarmBeats resource name. Required. + :type farm_beats_resource_name: str :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param farm_beats_resource_name: FarmBeats resource name. Required. - :type farm_beats_resource_name: str - :param extension_id: Id of extension resource. Required. - :type extension_id: str - :param request_body: Extension resource request body. Default value is None. - :type request_body: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :return: Extension or the result of cls(response) :rtype: ~azure.mgmt.agrifood.models.Extension :raises ~azure.core.exceptions.HttpResponseError: """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2020-05-12-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.Extension] = kwargs.pop("cls", None) + + request = build_create_request( + extension_id=extension_id, + farm_beats_resource_name=farm_beats_resource_name, + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.create.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("Extension", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourcesGroups/{resourceGroupName}/providers/Microsoft.AgFoodPlatform/farmBeats/{farmBeatsResourceName}/extensions/{extensionId}" + } @distributed_trace - def create_or_update( - self, - resource_group_name: str, - farm_beats_resource_name: str, - extension_id: str, - request_body: Optional[Union[_models.ExtensionInstallationRequest, IO]] = None, - **kwargs: Any + def get( + self, extension_id: str, farm_beats_resource_name: str, resource_group_name: str, **kwargs: Any ) -> _models.Extension: - """Install or Update extension. AdditionalApiProperties are merged patch and if the extension is - updated to a new version then the obsolete entries will be auto deleted from - AdditionalApiProperties. + """Get installed extension details by extension id. + :param extension_id: Id of extension resource. Required. + :type extension_id: str + :param farm_beats_resource_name: FarmBeats resource name. Required. + :type farm_beats_resource_name: str :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param farm_beats_resource_name: FarmBeats resource name. Required. - :type farm_beats_resource_name: str - :param extension_id: Id of extension resource. Required. - :type extension_id: str - :param request_body: Extension resource request body. Is either a model type or a IO type. - Default value is None. - :type request_body: ~azure.mgmt.agrifood.models.ExtensionInstallationRequest or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :return: Extension or the result of cls(response) :rtype: ~azure.mgmt.agrifood.models.Extension @@ -331,36 +354,21 @@ def create_or_update( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( + api_version: Literal["2020-05-12-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Extension] = kwargs.pop("cls", None) - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(request_body, (IO, bytes)): - _content = request_body - else: - if request_body is not None: - _json = self._serialize.body(request_body, "ExtensionInstallationRequest") - else: - _json = None - - request = build_create_or_update_request( - resource_group_name=resource_group_name, - farm_beats_resource_name=farm_beats_resource_name, + request = build_get_request( extension_id=extension_id, + farm_beats_resource_name=farm_beats_resource_name, + resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.create_or_update.metadata["url"], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -373,39 +381,35 @@ def create_or_update( response = pipeline_response.http_response - if response.status_code not in [200, 201]: + if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Extension", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("Extension", pipeline_response) + deserialized = self._deserialize("Extension", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) - return deserialized # type: ignore + return deserialized - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgFoodPlatform/farmBeats/{farmBeatsResourceName}/extensions/{extensionId}" + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourcesGroups/{resourceGroupName}/providers/Microsoft.AgFoodPlatform/farmBeats/{farmBeatsResourceName}/extensions/{extensionId}" } @distributed_trace - def get( - self, resource_group_name: str, farm_beats_resource_name: str, extension_id: str, **kwargs: Any + def update( + self, extension_id: str, farm_beats_resource_name: str, resource_group_name: str, **kwargs: Any ) -> _models.Extension: - """Get installed extension details by extension id. + """Upgrade to latest extension. + :param extension_id: Id of extension resource. Required. + :type extension_id: str + :param farm_beats_resource_name: FarmBeats resource name. Required. + :type farm_beats_resource_name: str :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param farm_beats_resource_name: FarmBeats resource name. Required. - :type farm_beats_resource_name: str - :param extension_id: Id of extension resource. Required. - :type extension_id: str :keyword callable cls: A custom type or function that will be passed the direct response :return: Extension or the result of cls(response) :rtype: ~azure.mgmt.agrifood.models.Extension @@ -422,18 +426,18 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( + api_version: Literal["2020-05-12-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.Extension] = kwargs.pop("cls", None) - request = build_get_request( - resource_group_name=resource_group_name, - farm_beats_resource_name=farm_beats_resource_name, + request = build_update_request( extension_id=extension_id, + farm_beats_resource_name=farm_beats_resource_name, + resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], + template_url=self.update.metadata["url"], headers=_headers, params=_params, ) @@ -458,23 +462,23 @@ def get( return deserialized - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgFoodPlatform/farmBeats/{farmBeatsResourceName}/extensions/{extensionId}" + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourcesGroups/{resourceGroupName}/providers/Microsoft.AgFoodPlatform/farmBeats/{farmBeatsResourceName}/extensions/{extensionId}" } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, farm_beats_resource_name: str, extension_id: str, **kwargs: Any + self, extension_id: str, farm_beats_resource_name: str, resource_group_name: str, **kwargs: Any ) -> None: """Uninstall extension. + :param extension_id: Id of extension resource. Required. + :type extension_id: str + :param farm_beats_resource_name: FarmBeats resource name. Required. + :type farm_beats_resource_name: str :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param farm_beats_resource_name: FarmBeats resource name. Required. - :type farm_beats_resource_name: str - :param extension_id: Id of extension resource. Required. - :type extension_id: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None @@ -491,15 +495,15 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( + api_version: Literal["2020-05-12-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( - resource_group_name=resource_group_name, - farm_beats_resource_name=farm_beats_resource_name, extension_id=extension_id, + farm_beats_resource_name=farm_beats_resource_name, + resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.delete.metadata["url"], @@ -524,7 +528,7 @@ def delete( # pylint: disable=inconsistent-return-statements return cls(pipeline_response, None, {}) delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgFoodPlatform/farmBeats/{farmBeatsResourceName}/extensions/{extensionId}" + "url": "/subscriptions/{subscriptionId}/resourcesGroups/{resourceGroupName}/providers/Microsoft.AgFoodPlatform/farmBeats/{farmBeatsResourceName}/extensions/{extensionId}" } @distributed_trace @@ -562,7 +566,7 @@ def list_by_farm_beats( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( + api_version: Literal["2020-05-12-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.ExtensionListResponse] = kwargs.pop("cls", None) diff --git a/sdk/agrifood/azure-mgmt-agrifood/azure/mgmt/agrifood/operations/_farm_beats_extensions_operations.py b/sdk/agrifood/azure-mgmt-agrifood/azure/mgmt/agrifood/operations/_farm_beats_extensions_operations.py index f9ef40638350..82c2717501cd 100644 --- a/sdk/agrifood/azure-mgmt-agrifood/azure/mgmt/agrifood/operations/_farm_beats_extensions_operations.py +++ b/sdk/agrifood/azure-mgmt-agrifood/azure/mgmt/agrifood/operations/_farm_beats_extensions_operations.py @@ -53,8 +53,8 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") + api_version: Literal["2020-05-12-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-05-12-preview") ) accept = _headers.pop("Accept", "application/json") @@ -94,8 +94,8 @@ def build_get_request(farm_beats_extension_id: str, **kwargs: Any) -> HttpReques _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") + api_version: Literal["2020-05-12-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-05-12-preview") ) accept = _headers.pop("Accept", "application/json") @@ -126,7 +126,7 @@ class FarmBeatsExtensionsOperations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.agrifood.AgriFoodMgmtClient`'s + :class:`~azure.mgmt.agrifood.AzureAgriFoodRPService`'s :attr:`farm_beats_extensions` attribute. """ @@ -170,7 +170,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( + api_version: Literal["2020-05-12-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.FarmBeatsExtensionListResponse] = kwargs.pop("cls", None) @@ -266,7 +266,7 @@ def get(self, farm_beats_extension_id: str, **kwargs: Any) -> _models.FarmBeatsE _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( + api_version: Literal["2020-05-12-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.FarmBeatsExtension] = kwargs.pop("cls", None) diff --git a/sdk/agrifood/azure-mgmt-agrifood/azure/mgmt/agrifood/operations/_farm_beats_models_operations.py b/sdk/agrifood/azure-mgmt-agrifood/azure/mgmt/agrifood/operations/_farm_beats_models_operations.py index 4ac65808009e..311004553771 100644 --- a/sdk/agrifood/azure-mgmt-agrifood/azure/mgmt/agrifood/operations/_farm_beats_models_operations.py +++ b/sdk/agrifood/azure-mgmt-agrifood/azure/mgmt/agrifood/operations/_farm_beats_models_operations.py @@ -7,7 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -21,12 +21,10 @@ from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models from .._serialization import Serializer @@ -49,8 +47,8 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") + api_version: Literal["2020-05-12-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-05-12-preview") ) accept = _headers.pop("Accept", "application/json") @@ -60,10 +58,10 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgFoodPlatform/farmBeats/{farmBeatsResourceName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "farmBeatsResourceName": _SERIALIZER.url("farm_beats_resource_name", farm_beats_resource_name, "str"), } @@ -79,13 +77,13 @@ def build_get_request( def build_create_or_update_request( - resource_group_name: str, farm_beats_resource_name: str, subscription_id: str, **kwargs: Any + farm_beats_resource_name: str, resource_group_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") + api_version: Literal["2020-05-12-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-05-12-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -96,11 +94,11 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgFoodPlatform/farmBeats/{farmBeatsResourceName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "farmBeatsResourceName": _SERIALIZER.url("farm_beats_resource_name", farm_beats_resource_name, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "farmBeatsResourceName": _SERIALIZER.url("farm_beats_resource_name", farm_beats_resource_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore @@ -117,13 +115,13 @@ def build_create_or_update_request( def build_update_request( - resource_group_name: str, farm_beats_resource_name: str, subscription_id: str, **kwargs: Any + farm_beats_resource_name: str, resource_group_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") + api_version: Literal["2020-05-12-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-05-12-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -134,11 +132,11 @@ def build_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgFoodPlatform/farmBeats/{farmBeatsResourceName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "farmBeatsResourceName": _SERIALIZER.url("farm_beats_resource_name", farm_beats_resource_name, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "farmBeatsResourceName": _SERIALIZER.url("farm_beats_resource_name", farm_beats_resource_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore @@ -160,8 +158,8 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") + api_version: Literal["2020-05-12-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-05-12-preview") ) accept = _headers.pop("Accept", "application/json") @@ -171,10 +169,10 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgFoodPlatform/farmBeats/{farmBeatsResourceName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "farmBeatsResourceName": _SERIALIZER.url("farm_beats_resource_name", farm_beats_resource_name, "str"), } @@ -195,15 +193,15 @@ def build_list_by_subscription_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") + api_version: Literal["2020-05-12-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-05-12-preview") ) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.AgFoodPlatform/farmBeats") path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore @@ -232,8 +230,8 @@ def build_list_by_resource_group_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") + api_version: Literal["2020-05-12-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-05-12-preview") ) accept = _headers.pop("Accept", "application/json") @@ -246,7 +244,7 @@ def build_list_by_resource_group_request( "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore @@ -264,55 +262,13 @@ def build_list_by_resource_group_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_operation_result_request( - resource_group_name: str, - farm_beats_resource_name: str, - operation_results_id: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgFoodPlatform/farmBeats/{farmBeatsResourceName}/operationResults/{operationResultsId}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "farmBeatsResourceName": _SERIALIZER.url("farm_beats_resource_name", farm_beats_resource_name, "str"), - "operationResultsId": _SERIALIZER.url( - "operation_results_id", operation_results_id, "str", pattern=r"^[A-Za-z0-9]+(-[A-Za-z0-9]+)*$" - ), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - class FarmBeatsModelsOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.agrifood.AgriFoodMgmtClient`'s + :class:`~azure.mgmt.agrifood.AzureAgriFoodRPService`'s :attr:`farm_beats_models` attribute. """ @@ -350,7 +306,7 @@ def get(self, resource_group_name: str, farm_beats_resource_name: str, **kwargs: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( + api_version: Literal["2020-05-12-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.FarmBeats] = kwargs.pop("cls", None) @@ -392,8 +348,8 @@ def get(self, resource_group_name: str, farm_beats_resource_name: str, **kwargs: @overload def create_or_update( self, - resource_group_name: str, farm_beats_resource_name: str, + resource_group_name: str, body: _models.FarmBeats, *, content_type: str = "application/json", @@ -401,11 +357,11 @@ def create_or_update( ) -> _models.FarmBeats: """Create or update FarmBeats resource. + :param farm_beats_resource_name: FarmBeats resource name. Required. + :type farm_beats_resource_name: str :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param farm_beats_resource_name: FarmBeats resource name. Required. - :type farm_beats_resource_name: str :param body: FarmBeats resource create or update request object. Required. :type body: ~azure.mgmt.agrifood.models.FarmBeats :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. @@ -420,8 +376,8 @@ def create_or_update( @overload def create_or_update( self, - resource_group_name: str, farm_beats_resource_name: str, + resource_group_name: str, body: IO, *, content_type: str = "application/json", @@ -429,11 +385,11 @@ def create_or_update( ) -> _models.FarmBeats: """Create or update FarmBeats resource. + :param farm_beats_resource_name: FarmBeats resource name. Required. + :type farm_beats_resource_name: str :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param farm_beats_resource_name: FarmBeats resource name. Required. - :type farm_beats_resource_name: str :param body: FarmBeats resource create or update request object. Required. :type body: IO :keyword content_type: Body Parameter content-type. Content type parameter for binary body. @@ -447,15 +403,15 @@ def create_or_update( @distributed_trace def create_or_update( - self, resource_group_name: str, farm_beats_resource_name: str, body: Union[_models.FarmBeats, IO], **kwargs: Any + self, farm_beats_resource_name: str, resource_group_name: str, body: Union[_models.FarmBeats, IO], **kwargs: Any ) -> _models.FarmBeats: """Create or update FarmBeats resource. + :param farm_beats_resource_name: FarmBeats resource name. Required. + :type farm_beats_resource_name: str :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param farm_beats_resource_name: FarmBeats resource name. Required. - :type farm_beats_resource_name: str :param body: FarmBeats resource create or update request object. Is either a model type or a IO type. Required. :type body: ~azure.mgmt.agrifood.models.FarmBeats or IO @@ -478,7 +434,7 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( + api_version: Literal["2020-05-12-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -493,8 +449,8 @@ def create_or_update( _json = self._serialize.body(body, "FarmBeats") request = build_create_or_update_request( - resource_group_name=resource_group_name, farm_beats_resource_name=farm_beats_resource_name, + resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, @@ -533,232 +489,146 @@ def create_or_update( "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgFoodPlatform/farmBeats/{farmBeatsResourceName}" } - def _update_initial( - self, - resource_group_name: str, - farm_beats_resource_name: str, - body: Union[_models.FarmBeatsUpdateRequestModel, IO], - **kwargs: Any - ) -> Optional[_models.FarmBeats]: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.FarmBeats]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(body, (IO, bytes)): - _content = body - else: - _json = self._serialize.body(body, "FarmBeatsUpdateRequestModel") - - request = build_update_request( - resource_group_name=resource_group_name, - farm_beats_resource_name=farm_beats_resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._update_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = None - response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("FarmBeats", pipeline_response) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized - - _update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgFoodPlatform/farmBeats/{farmBeatsResourceName}" - } - @overload - def begin_update( + def update( self, - resource_group_name: str, farm_beats_resource_name: str, + resource_group_name: str, body: _models.FarmBeatsUpdateRequestModel, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.FarmBeats]: + ) -> _models.FarmBeats: """Update a FarmBeats resource. + :param farm_beats_resource_name: FarmBeats resource name. Required. + :type farm_beats_resource_name: str :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param farm_beats_resource_name: FarmBeats resource name. Required. - :type farm_beats_resource_name: str :param body: Request object. Required. :type body: ~azure.mgmt.agrifood.models.FarmBeatsUpdateRequestModel :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either FarmBeats or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.agrifood.models.FarmBeats] + :return: FarmBeats or the result of cls(response) + :rtype: ~azure.mgmt.agrifood.models.FarmBeats :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_update( + def update( self, - resource_group_name: str, farm_beats_resource_name: str, + resource_group_name: str, body: IO, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.FarmBeats]: + ) -> _models.FarmBeats: """Update a FarmBeats resource. + :param farm_beats_resource_name: FarmBeats resource name. Required. + :type farm_beats_resource_name: str :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param farm_beats_resource_name: FarmBeats resource name. Required. - :type farm_beats_resource_name: str :param body: Request object. Required. :type body: IO :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either FarmBeats or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.agrifood.models.FarmBeats] + :return: FarmBeats or the result of cls(response) + :rtype: ~azure.mgmt.agrifood.models.FarmBeats :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def begin_update( + def update( self, - resource_group_name: str, farm_beats_resource_name: str, + resource_group_name: str, body: Union[_models.FarmBeatsUpdateRequestModel, IO], **kwargs: Any - ) -> LROPoller[_models.FarmBeats]: + ) -> _models.FarmBeats: """Update a FarmBeats resource. + :param farm_beats_resource_name: FarmBeats resource name. Required. + :type farm_beats_resource_name: str :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param farm_beats_resource_name: FarmBeats resource name. Required. - :type farm_beats_resource_name: str :param body: Request object. Is either a model type or a IO type. Required. :type body: ~azure.mgmt.agrifood.models.FarmBeatsUpdateRequestModel or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either FarmBeats or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.agrifood.models.FarmBeats] + :return: FarmBeats or the result of cls(response) + :rtype: ~azure.mgmt.agrifood.models.FarmBeats :raises ~azure.core.exceptions.HttpResponseError: """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( + api_version: Literal["2020-05-12-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.FarmBeats] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._update_initial( - resource_group_name=resource_group_name, - farm_beats_resource_name=farm_beats_resource_name, - body=body, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("FarmBeats", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IO, bytes)): + _content = body else: - polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + _json = self._serialize.body(body, "FarmBeatsUpdateRequestModel") + + request = build_update_request( + farm_beats_resource_name=farm_beats_resource_name, + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("FarmBeats", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) - begin_update.metadata = { + return deserialized + + update.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgFoodPlatform/farmBeats/{farmBeatsResourceName}" } @@ -789,7 +659,7 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( + api_version: Literal["2020-05-12-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -843,7 +713,7 @@ def list_by_subscription( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( + api_version: Literal["2020-05-12-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.FarmBeatsListResponse] = kwargs.pop("cls", None) @@ -939,7 +809,7 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( + api_version: Literal["2020-05-12-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.FarmBeatsListResponse] = kwargs.pop("cls", None) @@ -1013,72 +883,3 @@ def get_next(next_link=None): list_by_resource_group.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgFoodPlatform/farmBeats" } - - @distributed_trace - def get_operation_result( - self, resource_group_name: str, farm_beats_resource_name: str, operation_results_id: str, **kwargs: Any - ) -> _models.ArmAsyncOperation: - """Get operationResults for a FarmBeats resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param farm_beats_resource_name: FarmBeats resource name. Required. - :type farm_beats_resource_name: str - :param operation_results_id: The operation results id. Required. - :type operation_results_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ArmAsyncOperation or the result of cls(response) - :rtype: ~azure.mgmt.agrifood.models.ArmAsyncOperation - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.ArmAsyncOperation] = kwargs.pop("cls", None) - - request = build_get_operation_result_request( - resource_group_name=resource_group_name, - farm_beats_resource_name=farm_beats_resource_name, - operation_results_id=operation_results_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.get_operation_result.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ArmAsyncOperation", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_operation_result.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgFoodPlatform/farmBeats/{farmBeatsResourceName}/operationResults/{operationResultsId}" - } diff --git a/sdk/agrifood/azure-mgmt-agrifood/azure/mgmt/agrifood/operations/_locations_operations.py b/sdk/agrifood/azure-mgmt-agrifood/azure/mgmt/agrifood/operations/_locations_operations.py index dd3937a138d1..8fccbe62c497 100644 --- a/sdk/agrifood/azure-mgmt-agrifood/azure/mgmt/agrifood/operations/_locations_operations.py +++ b/sdk/agrifood/azure-mgmt-agrifood/azure/mgmt/agrifood/operations/_locations_operations.py @@ -43,8 +43,8 @@ def build_check_name_availability_request(subscription_id: str, **kwargs: Any) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") + api_version: Literal["2020-05-12-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-05-12-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -54,7 +54,7 @@ def build_check_name_availability_request(subscription_id: str, **kwargs: Any) - "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.AgFoodPlatform/checkNameAvailability" ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore @@ -76,7 +76,7 @@ class LocationsOperations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.agrifood.AgriFoodMgmtClient`'s + :class:`~azure.mgmt.agrifood.AzureAgriFoodRPService`'s :attr:`locations` attribute. """ @@ -150,7 +150,7 @@ def check_name_availability( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( + api_version: Literal["2020-05-12-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) diff --git a/sdk/agrifood/azure-mgmt-agrifood/azure/mgmt/agrifood/operations/_operations.py b/sdk/agrifood/azure-mgmt-agrifood/azure/mgmt/agrifood/operations/_operations.py index f83495de7159..89e53323b352 100644 --- a/sdk/agrifood/azure-mgmt-agrifood/azure/mgmt/agrifood/operations/_operations.py +++ b/sdk/agrifood/azure-mgmt-agrifood/azure/mgmt/agrifood/operations/_operations.py @@ -45,8 +45,8 @@ def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") + api_version: Literal["2020-05-12-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2020-05-12-preview") ) accept = _headers.pop("Accept", "application/json") @@ -68,7 +68,7 @@ class Operations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.agrifood.AgriFoodMgmtClient`'s + :class:`~azure.mgmt.agrifood.AzureAgriFoodRPService`'s :attr:`operations` attribute. """ @@ -93,7 +93,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-09-01-preview"] = kwargs.pop( + api_version: Literal["2020-05-12-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) diff --git a/sdk/agrifood/azure-mgmt-agrifood/azure/mgmt/agrifood/operations/_private_endpoint_connections_operations.py b/sdk/agrifood/azure-mgmt-agrifood/azure/mgmt/agrifood/operations/_private_endpoint_connections_operations.py deleted file mode 100644 index 7064b71fa5b3..000000000000 --- a/sdk/agrifood/azure-mgmt-agrifood/azure/mgmt/agrifood/operations/_private_endpoint_connections_operations.py +++ /dev/null @@ -1,684 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section - -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_create_or_update_request( - resource_group_name: str, - farm_beats_resource_name: str, - private_endpoint_connection_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgFoodPlatform/farmBeats/{farmBeatsResourceName}/privateEndpointConnections/{privateEndpointConnectionName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "farmBeatsResourceName": _SERIALIZER.url("farm_beats_resource_name", farm_beats_resource_name, "str"), - "privateEndpointConnectionName": _SERIALIZER.url( - "private_endpoint_connection_name", private_endpoint_connection_name, "str" - ), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, - farm_beats_resource_name: str, - private_endpoint_connection_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgFoodPlatform/farmBeats/{farmBeatsResourceName}/privateEndpointConnections/{privateEndpointConnectionName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "farmBeatsResourceName": _SERIALIZER.url("farm_beats_resource_name", farm_beats_resource_name, "str"), - "privateEndpointConnectionName": _SERIALIZER.url( - "private_endpoint_connection_name", private_endpoint_connection_name, "str" - ), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - farm_beats_resource_name: str, - private_endpoint_connection_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgFoodPlatform/farmBeats/{farmBeatsResourceName}/privateEndpointConnections/{privateEndpointConnectionName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "farmBeatsResourceName": _SERIALIZER.url("farm_beats_resource_name", farm_beats_resource_name, "str"), - "privateEndpointConnectionName": _SERIALIZER.url( - "private_endpoint_connection_name", private_endpoint_connection_name, "str" - ), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_by_resource_request( - resource_group_name: str, farm_beats_resource_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgFoodPlatform/farmBeats/{farmBeatsResourceName}/privateEndpointConnections", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "farmBeatsResourceName": _SERIALIZER.url("farm_beats_resource_name", farm_beats_resource_name, "str"), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class PrivateEndpointConnectionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.agrifood.AgriFoodMgmtClient`'s - :attr:`private_endpoint_connections` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @overload - def create_or_update( - self, - resource_group_name: str, - farm_beats_resource_name: str, - private_endpoint_connection_name: str, - body: _models.PrivateEndpointConnection, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.PrivateEndpointConnection: - """Approves or Rejects a Private endpoint connection request. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param farm_beats_resource_name: FarmBeats resource name. Required. - :type farm_beats_resource_name: str - :param private_endpoint_connection_name: Private endpoint connection name. Required. - :type private_endpoint_connection_name: str - :param body: Request object. Required. - :type body: ~azure.mgmt.agrifood.models.PrivateEndpointConnection - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection or the result of cls(response) - :rtype: ~azure.mgmt.agrifood.models.PrivateEndpointConnection - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create_or_update( - self, - resource_group_name: str, - farm_beats_resource_name: str, - private_endpoint_connection_name: str, - body: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.PrivateEndpointConnection: - """Approves or Rejects a Private endpoint connection request. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param farm_beats_resource_name: FarmBeats resource name. Required. - :type farm_beats_resource_name: str - :param private_endpoint_connection_name: Private endpoint connection name. Required. - :type private_endpoint_connection_name: str - :param body: Request object. Required. - :type body: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection or the result of cls(response) - :rtype: ~azure.mgmt.agrifood.models.PrivateEndpointConnection - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create_or_update( - self, - resource_group_name: str, - farm_beats_resource_name: str, - private_endpoint_connection_name: str, - body: Union[_models.PrivateEndpointConnection, IO], - **kwargs: Any - ) -> _models.PrivateEndpointConnection: - """Approves or Rejects a Private endpoint connection request. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param farm_beats_resource_name: FarmBeats resource name. Required. - :type farm_beats_resource_name: str - :param private_endpoint_connection_name: Private endpoint connection name. Required. - :type private_endpoint_connection_name: str - :param body: Request object. Is either a model type or a IO type. Required. - :type body: ~azure.mgmt.agrifood.models.PrivateEndpointConnection or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection or the result of cls(response) - :rtype: ~azure.mgmt.agrifood.models.PrivateEndpointConnection - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(body, (IO, bytes)): - _content = body - else: - _json = self._serialize.body(body, "PrivateEndpointConnection") - - request = build_create_or_update_request( - resource_group_name=resource_group_name, - farm_beats_resource_name=farm_beats_resource_name, - private_endpoint_connection_name=private_endpoint_connection_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.create_or_update.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgFoodPlatform/farmBeats/{farmBeatsResourceName}/privateEndpointConnections/{privateEndpointConnectionName}" - } - - @distributed_trace - def get( - self, - resource_group_name: str, - farm_beats_resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any - ) -> _models.PrivateEndpointConnection: - """Get Private endpoint connection object. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param farm_beats_resource_name: FarmBeats resource name. Required. - :type farm_beats_resource_name: str - :param private_endpoint_connection_name: Private endpoint connection name. Required. - :type private_endpoint_connection_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection or the result of cls(response) - :rtype: ~azure.mgmt.agrifood.models.PrivateEndpointConnection - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - 404: lambda response: ResourceNotFoundError( - response=response, model=self._deserialize(_models.ErrorResponse, response), error_format=ARMErrorFormat - ), - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) - - request = build_get_request( - resource_group_name=resource_group_name, - farm_beats_resource_name=farm_beats_resource_name, - private_endpoint_connection_name=private_endpoint_connection_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.get.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgFoodPlatform/farmBeats/{farmBeatsResourceName}/privateEndpointConnections/{privateEndpointConnectionName}" - } - - def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - farm_beats_resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any - ) -> None: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_request( - resource_group_name=resource_group_name, - farm_beats_resource_name=farm_beats_resource_name, - private_endpoint_connection_name=private_endpoint_connection_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self._delete_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - if cls: - return cls(pipeline_response, None, response_headers) - - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgFoodPlatform/farmBeats/{farmBeatsResourceName}/privateEndpointConnections/{privateEndpointConnectionName}" - } - - @distributed_trace - def begin_delete( - self, - resource_group_name: str, - farm_beats_resource_name: str, - private_endpoint_connection_name: str, - **kwargs: Any - ) -> LROPoller[None]: - """Delete Private endpoint connection request. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param farm_beats_resource_name: FarmBeats resource name. Required. - :type farm_beats_resource_name: str - :param private_endpoint_connection_name: Private endpoint connection name. Required. - :type private_endpoint_connection_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( # type: ignore - resource_group_name=resource_group_name, - farm_beats_resource_name=farm_beats_resource_name, - private_endpoint_connection_name=private_endpoint_connection_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgFoodPlatform/farmBeats/{farmBeatsResourceName}/privateEndpointConnections/{privateEndpointConnectionName}" - } - - @distributed_trace - def list_by_resource( - self, resource_group_name: str, farm_beats_resource_name: str, **kwargs: Any - ) -> Iterable["_models.PrivateEndpointConnection"]: - """Get list of Private endpoint connections. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param farm_beats_resource_name: FarmBeats resource name. Required. - :type farm_beats_resource_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PrivateEndpointConnection or the result of - cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.agrifood.models.PrivateEndpointConnection] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.PrivateEndpointConnectionListResult] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_resource_request( - resource_group_name=resource_group_name, - farm_beats_resource_name=farm_beats_resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_by_resource.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - list_by_resource.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgFoodPlatform/farmBeats/{farmBeatsResourceName}/privateEndpointConnections" - } diff --git a/sdk/agrifood/azure-mgmt-agrifood/azure/mgmt/agrifood/operations/_private_link_resources_operations.py b/sdk/agrifood/azure-mgmt-agrifood/azure/mgmt/agrifood/operations/_private_link_resources_operations.py deleted file mode 100644 index bf324c15b990..000000000000 --- a/sdk/agrifood/azure-mgmt-agrifood/azure/mgmt/agrifood/operations/_private_link_resources_operations.py +++ /dev/null @@ -1,296 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section - -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_by_resource_request( - resource_group_name: str, farm_beats_resource_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgFoodPlatform/farmBeats/{farmBeatsResourceName}/privateLinkResources", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "farmBeatsResourceName": _SERIALIZER.url("farm_beats_resource_name", farm_beats_resource_name, "str"), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, farm_beats_resource_name: str, sub_resource_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgFoodPlatform/farmBeats/{farmBeatsResourceName}/privateLinkResources/{subResourceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "farmBeatsResourceName": _SERIALIZER.url("farm_beats_resource_name", farm_beats_resource_name, "str"), - "subResourceName": _SERIALIZER.url("sub_resource_name", sub_resource_name, "str"), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class PrivateLinkResourcesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.agrifood.AgriFoodMgmtClient`'s - :attr:`private_link_resources` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_resource( - self, resource_group_name: str, farm_beats_resource_name: str, **kwargs: Any - ) -> Iterable["_models.PrivateLinkResource"]: - """Get list of Private link resources. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param farm_beats_resource_name: FarmBeats resource name. Required. - :type farm_beats_resource_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PrivateLinkResource or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.agrifood.models.PrivateLinkResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.PrivateLinkResourceListResult] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_resource_request( - resource_group_name=resource_group_name, - farm_beats_resource_name=farm_beats_resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_by_resource.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - list_by_resource.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgFoodPlatform/farmBeats/{farmBeatsResourceName}/privateLinkResources" - } - - @distributed_trace - def get( - self, resource_group_name: str, farm_beats_resource_name: str, sub_resource_name: str, **kwargs: Any - ) -> _models.PrivateLinkResource: - """Get Private link resource object. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param farm_beats_resource_name: FarmBeats resource name. Required. - :type farm_beats_resource_name: str - :param sub_resource_name: Sub resource name. Required. - :type sub_resource_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateLinkResource or the result of cls(response) - :rtype: ~azure.mgmt.agrifood.models.PrivateLinkResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - 404: lambda response: ResourceNotFoundError( - response=response, model=self._deserialize(_models.ErrorResponse, response), error_format=ARMErrorFormat - ), - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.PrivateLinkResource] = kwargs.pop("cls", None) - - request = build_get_request( - resource_group_name=resource_group_name, - farm_beats_resource_name=farm_beats_resource_name, - sub_resource_name=sub_resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.get.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("PrivateLinkResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgFoodPlatform/farmBeats/{farmBeatsResourceName}/privateLinkResources/{subResourceName}" - } diff --git a/sdk/agrifood/azure-mgmt-agrifood/azure/mgmt/agrifood/operations/_solutions_discoverability_operations.py b/sdk/agrifood/azure-mgmt-agrifood/azure/mgmt/agrifood/operations/_solutions_discoverability_operations.py deleted file mode 100644 index 042db81dd18e..000000000000 --- a/sdk/agrifood/azure-mgmt-agrifood/azure/mgmt/agrifood/operations/_solutions_discoverability_operations.py +++ /dev/null @@ -1,286 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, Iterable, List, Optional, TypeVar -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section - -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_request( - *, - farm_beats_solution_ids: Optional[List[str]] = None, - farm_beats_solution_names: Optional[List[str]] = None, - max_page_size: int = 50, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/providers/Microsoft.AgFoodPlatform/farmBeatsSolutionDefinitions") - - # Construct parameters - if farm_beats_solution_ids is not None: - _params["farmBeatsSolutionIds"] = [ - _SERIALIZER.query("farm_beats_solution_ids", q, "str") if q is not None else "" - for q in farm_beats_solution_ids - ] - if farm_beats_solution_names is not None: - _params["farmBeatsSolutionNames"] = [ - _SERIALIZER.query("farm_beats_solution_names", q, "str") if q is not None else "" - for q in farm_beats_solution_names - ] - if max_page_size is not None: - _params["$maxPageSize"] = _SERIALIZER.query("max_page_size", max_page_size, "int", maximum=1000, minimum=10) - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request(farm_beats_solution_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", "/providers/Microsoft.AgFoodPlatform/farmBeatsSolutionDefinitions/{farmBeatsSolutionId}" - ) # pylint: disable=line-too-long - path_format_arguments = { - "farmBeatsSolutionId": _SERIALIZER.url( - "farm_beats_solution_id", farm_beats_solution_id, "str", pattern=r"^[a-zA-Z]{3,50}[.][a-zA-Z]{3,100}$" - ), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class SolutionsDiscoverabilityOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.agrifood.AgriFoodMgmtClient`'s - :attr:`solutions_discoverability` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list( - self, - farm_beats_solution_ids: Optional[List[str]] = None, - farm_beats_solution_names: Optional[List[str]] = None, - max_page_size: int = 50, - **kwargs: Any - ) -> Iterable["_models.FarmBeatsSolution"]: - """Get list of farmBeats solutions. - - :param farm_beats_solution_ids: Ids of FarmBeats Solutions which the customer requests to - fetch. Default value is None. - :type farm_beats_solution_ids: list[str] - :param farm_beats_solution_names: Names of FarmBeats Solutions which the customer requests to - fetch. Default value is None. - :type farm_beats_solution_names: list[str] - :param max_page_size: Maximum number of items needed (inclusive). - Minimum = 10, Maximum = 1000, Default value = 50. Default value is 50. - :type max_page_size: int - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either FarmBeatsSolution or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.agrifood.models.FarmBeatsSolution] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.FarmBeatsSolutionListResponse] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - farm_beats_solution_ids=farm_beats_solution_ids, - farm_beats_solution_names=farm_beats_solution_names, - max_page_size=max_page_size, - api_version=api_version, - template_url=self.list.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("FarmBeatsSolutionListResponse", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - list.metadata = {"url": "/providers/Microsoft.AgFoodPlatform/farmBeatsSolutionDefinitions"} - - @distributed_trace - def get(self, farm_beats_solution_id: str, **kwargs: Any) -> _models.FarmBeatsSolution: - """Get farmBeats solution by id. - - :param farm_beats_solution_id: farmBeatsSolutionId to be queried. Required. - :type farm_beats_solution_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: FarmBeatsSolution or the result of cls(response) - :rtype: ~azure.mgmt.agrifood.models.FarmBeatsSolution - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.FarmBeatsSolution] = kwargs.pop("cls", None) - - request = build_get_request( - farm_beats_solution_id=farm_beats_solution_id, - api_version=api_version, - template_url=self.get.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("FarmBeatsSolution", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = {"url": "/providers/Microsoft.AgFoodPlatform/farmBeatsSolutionDefinitions/{farmBeatsSolutionId}"} diff --git a/sdk/agrifood/azure-mgmt-agrifood/azure/mgmt/agrifood/operations/_solutions_operations.py b/sdk/agrifood/azure-mgmt-agrifood/azure/mgmt/agrifood/operations/_solutions_operations.py deleted file mode 100644 index 27b3833cbc31..000000000000 --- a/sdk/agrifood/azure-mgmt-agrifood/azure/mgmt/agrifood/operations/_solutions_operations.py +++ /dev/null @@ -1,679 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import datetime -import sys -from typing import Any, Callable, Dict, IO, Iterable, List, Optional, TypeVar, Union, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section - -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_create_or_update_request( - resource_group_name: str, farm_beats_resource_name: str, subscription_id: str, solution_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgFoodPlatform/farmBeats/{farmBeatsResourceName}/solutions/{solutionId}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "farmBeatsResourceName": _SERIALIZER.url("farm_beats_resource_name", farm_beats_resource_name, "str"), - "solutionId": _SERIALIZER.url("solution_id", solution_id, "str", pattern=r"^[a-zA-Z]{3,50}[.][a-zA-Z]{3,100}$"), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, farm_beats_resource_name: str, subscription_id: str, solution_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgFoodPlatform/farmBeats/{farmBeatsResourceName}/solutions/{solutionId}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "farmBeatsResourceName": _SERIALIZER.url("farm_beats_resource_name", farm_beats_resource_name, "str"), - "solutionId": _SERIALIZER.url("solution_id", solution_id, "str", pattern=r"^[a-zA-Z]{3,50}[.][a-zA-Z]{3,100}$"), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, farm_beats_resource_name: str, subscription_id: str, solution_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgFoodPlatform/farmBeats/{farmBeatsResourceName}/solutions/{solutionId}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "farmBeatsResourceName": _SERIALIZER.url("farm_beats_resource_name", farm_beats_resource_name, "str"), - "solutionId": _SERIALIZER.url("solution_id", solution_id, "str", pattern=r"^[a-zA-Z]{3,50}[.][a-zA-Z]{3,100}$"), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, - farm_beats_resource_name: str, - subscription_id: str, - *, - solution_ids: Optional[List[str]] = None, - ids: Optional[List[str]] = None, - names: Optional[List[str]] = None, - property_filters: Optional[List[str]] = None, - statuses: Optional[List[str]] = None, - min_created_date_time: Optional[datetime.datetime] = None, - max_created_date_time: Optional[datetime.datetime] = None, - min_last_modified_date_time: Optional[datetime.datetime] = None, - max_last_modified_date_time: Optional[datetime.datetime] = None, - max_page_size: int = 50, - skip_token: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-09-01-preview") - ) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgFoodPlatform/farmBeats/{farmBeatsResourceName}/solutions", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "farmBeatsResourceName": _SERIALIZER.url("farm_beats_resource_name", farm_beats_resource_name, "str"), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - if solution_ids is not None: - _params["solutionIds"] = [ - _SERIALIZER.query("solution_ids", q, "str") if q is not None else "" for q in solution_ids - ] - if ids is not None: - _params["ids"] = [_SERIALIZER.query("ids", q, "str") if q is not None else "" for q in ids] - if names is not None: - _params["names"] = [_SERIALIZER.query("names", q, "str") if q is not None else "" for q in names] - if property_filters is not None: - _params["propertyFilters"] = [ - _SERIALIZER.query("property_filters", q, "str") if q is not None else "" for q in property_filters - ] - if statuses is not None: - _params["statuses"] = [_SERIALIZER.query("statuses", q, "str") if q is not None else "" for q in statuses] - if min_created_date_time is not None: - _params["minCreatedDateTime"] = _SERIALIZER.query("min_created_date_time", min_created_date_time, "iso-8601") - if max_created_date_time is not None: - _params["maxCreatedDateTime"] = _SERIALIZER.query("max_created_date_time", max_created_date_time, "iso-8601") - if min_last_modified_date_time is not None: - _params["minLastModifiedDateTime"] = _SERIALIZER.query( - "min_last_modified_date_time", min_last_modified_date_time, "iso-8601" - ) - if max_last_modified_date_time is not None: - _params["maxLastModifiedDateTime"] = _SERIALIZER.query( - "max_last_modified_date_time", max_last_modified_date_time, "iso-8601" - ) - if max_page_size is not None: - _params["$maxPageSize"] = _SERIALIZER.query("max_page_size", max_page_size, "int", maximum=1000, minimum=10) - if skip_token is not None: - _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class SolutionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.agrifood.AgriFoodMgmtClient`'s - :attr:`solutions` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @overload - def create_or_update( - self, - resource_group_name: str, - farm_beats_resource_name: str, - body: Optional[_models.SolutionInstallationRequest] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Solution: - """Install Or Update Solution. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param farm_beats_resource_name: FarmBeats resource name. Required. - :type farm_beats_resource_name: str - :param body: Solution resource request body. Default value is None. - :type body: ~azure.mgmt.agrifood.models.SolutionInstallationRequest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Solution or the result of cls(response) - :rtype: ~azure.mgmt.agrifood.models.Solution - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create_or_update( - self, - resource_group_name: str, - farm_beats_resource_name: str, - body: Optional[IO] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Solution: - """Install Or Update Solution. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param farm_beats_resource_name: FarmBeats resource name. Required. - :type farm_beats_resource_name: str - :param body: Solution resource request body. Default value is None. - :type body: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Solution or the result of cls(response) - :rtype: ~azure.mgmt.agrifood.models.Solution - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create_or_update( - self, - resource_group_name: str, - farm_beats_resource_name: str, - body: Optional[Union[_models.SolutionInstallationRequest, IO]] = None, - **kwargs: Any - ) -> _models.Solution: - """Install Or Update Solution. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param farm_beats_resource_name: FarmBeats resource name. Required. - :type farm_beats_resource_name: str - :param body: Solution resource request body. Is either a model type or a IO type. Default value - is None. - :type body: ~azure.mgmt.agrifood.models.SolutionInstallationRequest or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Solution or the result of cls(response) - :rtype: ~azure.mgmt.agrifood.models.Solution - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Solution] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(body, (IO, bytes)): - _content = body - else: - if body is not None: - _json = self._serialize.body(body, "SolutionInstallationRequest") - else: - _json = None - - request = build_create_or_update_request( - resource_group_name=resource_group_name, - farm_beats_resource_name=farm_beats_resource_name, - subscription_id=self._config.subscription_id, - solution_id=self._config.solution_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.create_or_update.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("Solution", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("Solution", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgFoodPlatform/farmBeats/{farmBeatsResourceName}/solutions/{solutionId}" - } - - @distributed_trace - def get(self, resource_group_name: str, farm_beats_resource_name: str, **kwargs: Any) -> _models.Solution: - """Get installed Solution details by Solution id. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param farm_beats_resource_name: FarmBeats resource name. Required. - :type farm_beats_resource_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Solution or the result of cls(response) - :rtype: ~azure.mgmt.agrifood.models.Solution - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.Solution] = kwargs.pop("cls", None) - - request = build_get_request( - resource_group_name=resource_group_name, - farm_beats_resource_name=farm_beats_resource_name, - subscription_id=self._config.subscription_id, - solution_id=self._config.solution_id, - api_version=api_version, - template_url=self.get.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Solution", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgFoodPlatform/farmBeats/{farmBeatsResourceName}/solutions/{solutionId}" - } - - @distributed_trace - def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, farm_beats_resource_name: str, **kwargs: Any - ) -> None: - """Uninstall Solution. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param farm_beats_resource_name: FarmBeats resource name. Required. - :type farm_beats_resource_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_request( - resource_group_name=resource_group_name, - farm_beats_resource_name=farm_beats_resource_name, - subscription_id=self._config.subscription_id, - solution_id=self._config.solution_id, - api_version=api_version, - template_url=self.delete.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgFoodPlatform/farmBeats/{farmBeatsResourceName}/solutions/{solutionId}" - } - - @distributed_trace - def list( - self, - resource_group_name: str, - farm_beats_resource_name: str, - solution_ids: Optional[List[str]] = None, - ids: Optional[List[str]] = None, - names: Optional[List[str]] = None, - property_filters: Optional[List[str]] = None, - statuses: Optional[List[str]] = None, - min_created_date_time: Optional[datetime.datetime] = None, - max_created_date_time: Optional[datetime.datetime] = None, - min_last_modified_date_time: Optional[datetime.datetime] = None, - max_last_modified_date_time: Optional[datetime.datetime] = None, - max_page_size: int = 50, - skip_token: Optional[str] = None, - **kwargs: Any - ) -> Iterable["_models.Solution"]: - """Get installed Solutions details. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param farm_beats_resource_name: FarmBeats resource name. Required. - :type farm_beats_resource_name: str - :param solution_ids: Installed Solution ids. Default value is None. - :type solution_ids: list[str] - :param ids: Ids of the resource. Default value is None. - :type ids: list[str] - :param names: Names of the resource. Default value is None. - :type names: list[str] - :param property_filters: Filters on key-value pairs within the Properties object. - eg. "{testKey} eq {testValue}". Default value is None. - :type property_filters: list[str] - :param statuses: Statuses of the resource. Default value is None. - :type statuses: list[str] - :param min_created_date_time: Minimum creation date of resource (inclusive). Default value is - None. - :type min_created_date_time: ~datetime.datetime - :param max_created_date_time: Maximum creation date of resource (inclusive). Default value is - None. - :type max_created_date_time: ~datetime.datetime - :param min_last_modified_date_time: Minimum last modified date of resource (inclusive). Default - value is None. - :type min_last_modified_date_time: ~datetime.datetime - :param max_last_modified_date_time: Maximum last modified date of resource (inclusive). Default - value is None. - :type max_last_modified_date_time: ~datetime.datetime - :param max_page_size: Maximum number of items needed (inclusive). - Minimum = 10, Maximum = 1000, Default value = 50. Default value is 50. - :type max_page_size: int - :param skip_token: Skip token for getting next set of results. Default value is None. - :type skip_token: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either Solution or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.agrifood.models.Solution] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.SolutionListResponse] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - resource_group_name=resource_group_name, - farm_beats_resource_name=farm_beats_resource_name, - subscription_id=self._config.subscription_id, - solution_ids=solution_ids, - ids=ids, - names=names, - property_filters=property_filters, - statuses=statuses, - min_created_date_time=min_created_date_time, - max_created_date_time=max_created_date_time, - min_last_modified_date_time=min_last_modified_date_time, - max_last_modified_date_time=max_last_modified_date_time, - max_page_size=max_page_size, - skip_token=skip_token, - api_version=api_version, - template_url=self.list.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("SolutionListResponse", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgFoodPlatform/farmBeats/{farmBeatsResourceName}/solutions" - } diff --git a/sdk/agrifood/azure-mgmt-agrifood/generated_samples/solutions_get.py b/sdk/agrifood/azure-mgmt-agrifood/generated_samples/extensions_create.py similarity index 82% rename from sdk/agrifood/azure-mgmt-agrifood/generated_samples/solutions_get.py rename to sdk/agrifood/azure-mgmt-agrifood/generated_samples/extensions_create.py index eaea26aa3c9f..c5f8a79b40c2 100644 --- a/sdk/agrifood/azure-mgmt-agrifood/generated_samples/solutions_get.py +++ b/sdk/agrifood/azure-mgmt-agrifood/generated_samples/extensions_create.py @@ -7,14 +7,14 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.agrifood import AgriFoodMgmtClient +from azure.mgmt.agrifood import AzureAgriFoodRPService """ # PREREQUISITES pip install azure-identity pip install azure-mgmt-agrifood # USAGE - python solutions_get.py + python extensions_create.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -24,19 +24,19 @@ def main(): - client = AgriFoodMgmtClient( + client = AzureAgriFoodRPService( credential=DefaultAzureCredential(), - solution_id="provider.solution", subscription_id="11111111-2222-3333-4444-555555555555", ) - response = client.solutions.get( - resource_group_name="examples-rg", + response = client.extensions.create( + extension_id="provider.extension", farm_beats_resource_name="examples-farmbeatsResourceName", + resource_group_name="examples-rg", ) print(response) -# x-ms-original-file: specification/agrifood/resource-manager/Microsoft.AgFoodPlatform/preview/2021-09-01-preview/examples/Solutions_Get.json +# x-ms-original-file: specification/agrifood/resource-manager/Microsoft.AgFoodPlatform/preview/2020-05-12-preview/examples/Extensions_Create.json if __name__ == "__main__": main() diff --git a/sdk/agrifood/azure-mgmt-agrifood/generated_samples/extensions_create_or_update.py b/sdk/agrifood/azure-mgmt-agrifood/generated_samples/extensions_create_or_update.py deleted file mode 100644 index afd0156202af..000000000000 --- a/sdk/agrifood/azure-mgmt-agrifood/generated_samples/extensions_create_or_update.py +++ /dev/null @@ -1,43 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.agrifood import AgriFoodMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-agrifood -# USAGE - python extensions_create_or_update.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = AgriFoodMgmtClient( - credential=DefaultAzureCredential(), - solution_id="SOLUTION_ID", - subscription_id="11111111-2222-3333-4444-555555555555", - ) - - response = client.extensions.create_or_update( - resource_group_name="examples-rg", - farm_beats_resource_name="examples-farmbeatsResourceName", - extension_id="provider.extension", - ) - print(response) - - -# x-ms-original-file: specification/agrifood/resource-manager/Microsoft.AgFoodPlatform/preview/2021-09-01-preview/examples/Extensions_CreateOrUpdate.json -if __name__ == "__main__": - main() diff --git a/sdk/agrifood/azure-mgmt-agrifood/generated_samples/extensions_delete.py b/sdk/agrifood/azure-mgmt-agrifood/generated_samples/extensions_delete.py index 676b523c7ffa..8671f07deb38 100644 --- a/sdk/agrifood/azure-mgmt-agrifood/generated_samples/extensions_delete.py +++ b/sdk/agrifood/azure-mgmt-agrifood/generated_samples/extensions_delete.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.agrifood import AgriFoodMgmtClient +from azure.mgmt.agrifood import AzureAgriFoodRPService """ # PREREQUISITES @@ -24,20 +24,19 @@ def main(): - client = AgriFoodMgmtClient( + client = AzureAgriFoodRPService( credential=DefaultAzureCredential(), - solution_id="SOLUTION_ID", subscription_id="11111111-2222-3333-4444-555555555555", ) response = client.extensions.delete( - resource_group_name="examples-rg", - farm_beats_resource_name="examples-farmbeatsResourceName", extension_id="provider.extension", + farm_beats_resource_name="examples-farmbeatsResourceName", + resource_group_name="examples-rg", ) print(response) -# x-ms-original-file: specification/agrifood/resource-manager/Microsoft.AgFoodPlatform/preview/2021-09-01-preview/examples/Extensions_Delete.json +# x-ms-original-file: specification/agrifood/resource-manager/Microsoft.AgFoodPlatform/preview/2020-05-12-preview/examples/Extensions_Delete.json if __name__ == "__main__": main() diff --git a/sdk/agrifood/azure-mgmt-agrifood/generated_samples/extensions_get.py b/sdk/agrifood/azure-mgmt-agrifood/generated_samples/extensions_get.py index c1890d35b83a..a18d8c1ea9cb 100644 --- a/sdk/agrifood/azure-mgmt-agrifood/generated_samples/extensions_get.py +++ b/sdk/agrifood/azure-mgmt-agrifood/generated_samples/extensions_get.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.agrifood import AgriFoodMgmtClient +from azure.mgmt.agrifood import AzureAgriFoodRPService """ # PREREQUISITES @@ -24,20 +24,19 @@ def main(): - client = AgriFoodMgmtClient( + client = AzureAgriFoodRPService( credential=DefaultAzureCredential(), - solution_id="SOLUTION_ID", subscription_id="11111111-2222-3333-4444-555555555555", ) response = client.extensions.get( - resource_group_name="examples-rg", - farm_beats_resource_name="examples-farmbeatsResourceName", extension_id="provider.extension", + farm_beats_resource_name="examples-farmbeatsResourceName", + resource_group_name="examples-rg", ) print(response) -# x-ms-original-file: specification/agrifood/resource-manager/Microsoft.AgFoodPlatform/preview/2021-09-01-preview/examples/Extensions_Get.json +# x-ms-original-file: specification/agrifood/resource-manager/Microsoft.AgFoodPlatform/preview/2020-05-12-preview/examples/Extensions_Get.json if __name__ == "__main__": main() diff --git a/sdk/agrifood/azure-mgmt-agrifood/generated_samples/extensions_list_by_farm_beats.py b/sdk/agrifood/azure-mgmt-agrifood/generated_samples/extensions_list_by_farm_beats.py index 10765da24ccf..c705c0666236 100644 --- a/sdk/agrifood/azure-mgmt-agrifood/generated_samples/extensions_list_by_farm_beats.py +++ b/sdk/agrifood/azure-mgmt-agrifood/generated_samples/extensions_list_by_farm_beats.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.agrifood import AgriFoodMgmtClient +from azure.mgmt.agrifood import AzureAgriFoodRPService """ # PREREQUISITES @@ -24,9 +24,8 @@ def main(): - client = AgriFoodMgmtClient( + client = AzureAgriFoodRPService( credential=DefaultAzureCredential(), - solution_id="SOLUTION_ID", subscription_id="11111111-2222-3333-4444-555555555555", ) @@ -38,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/agrifood/resource-manager/Microsoft.AgFoodPlatform/preview/2021-09-01-preview/examples/Extensions_ListByFarmBeats.json +# x-ms-original-file: specification/agrifood/resource-manager/Microsoft.AgFoodPlatform/preview/2020-05-12-preview/examples/Extensions_ListByFarmBeats.json if __name__ == "__main__": main() diff --git a/sdk/agrifood/azure-mgmt-agrifood/generated_samples/solutions_delete.py b/sdk/agrifood/azure-mgmt-agrifood/generated_samples/extensions_update.py similarity index 82% rename from sdk/agrifood/azure-mgmt-agrifood/generated_samples/solutions_delete.py rename to sdk/agrifood/azure-mgmt-agrifood/generated_samples/extensions_update.py index ce0dcc10145c..fcd91c6eaf44 100644 --- a/sdk/agrifood/azure-mgmt-agrifood/generated_samples/solutions_delete.py +++ b/sdk/agrifood/azure-mgmt-agrifood/generated_samples/extensions_update.py @@ -7,14 +7,14 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.agrifood import AgriFoodMgmtClient +from azure.mgmt.agrifood import AzureAgriFoodRPService """ # PREREQUISITES pip install azure-identity pip install azure-mgmt-agrifood # USAGE - python solutions_delete.py + python extensions_update.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -24,19 +24,19 @@ def main(): - client = AgriFoodMgmtClient( + client = AzureAgriFoodRPService( credential=DefaultAzureCredential(), - solution_id="provider.solution", subscription_id="11111111-2222-3333-4444-555555555555", ) - response = client.solutions.delete( - resource_group_name="examples-rg", + response = client.extensions.update( + extension_id="provider.extension", farm_beats_resource_name="examples-farmbeatsResourceName", + resource_group_name="examples-rg", ) print(response) -# x-ms-original-file: specification/agrifood/resource-manager/Microsoft.AgFoodPlatform/preview/2021-09-01-preview/examples/Solutions_Delete.json +# x-ms-original-file: specification/agrifood/resource-manager/Microsoft.AgFoodPlatform/preview/2020-05-12-preview/examples/Extensions_Update.json if __name__ == "__main__": main() diff --git a/sdk/agrifood/azure-mgmt-agrifood/generated_samples/farm_beats_extensions_get.py b/sdk/agrifood/azure-mgmt-agrifood/generated_samples/farm_beats_extensions_get.py index bf600520b133..c29be640b9a8 100644 --- a/sdk/agrifood/azure-mgmt-agrifood/generated_samples/farm_beats_extensions_get.py +++ b/sdk/agrifood/azure-mgmt-agrifood/generated_samples/farm_beats_extensions_get.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.agrifood import AgriFoodMgmtClient +from azure.mgmt.agrifood import AzureAgriFoodRPService """ # PREREQUISITES @@ -24,9 +24,8 @@ def main(): - client = AgriFoodMgmtClient( + client = AzureAgriFoodRPService( credential=DefaultAzureCredential(), - solution_id="SOLUTION_ID", subscription_id="SUBSCRIPTION_ID", ) @@ -36,6 +35,6 @@ def main(): print(response) -# x-ms-original-file: specification/agrifood/resource-manager/Microsoft.AgFoodPlatform/preview/2021-09-01-preview/examples/FarmBeatsExtensions_Get.json +# x-ms-original-file: specification/agrifood/resource-manager/Microsoft.AgFoodPlatform/preview/2020-05-12-preview/examples/FarmBeatsExtensions_Get.json if __name__ == "__main__": main() diff --git a/sdk/agrifood/azure-mgmt-agrifood/generated_samples/farm_beats_extensions_list.py b/sdk/agrifood/azure-mgmt-agrifood/generated_samples/farm_beats_extensions_list.py index defa67c7e012..9ab78eb110f8 100644 --- a/sdk/agrifood/azure-mgmt-agrifood/generated_samples/farm_beats_extensions_list.py +++ b/sdk/agrifood/azure-mgmt-agrifood/generated_samples/farm_beats_extensions_list.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.agrifood import AgriFoodMgmtClient +from azure.mgmt.agrifood import AzureAgriFoodRPService """ # PREREQUISITES @@ -24,9 +24,8 @@ def main(): - client = AgriFoodMgmtClient( + client = AzureAgriFoodRPService( credential=DefaultAzureCredential(), - solution_id="SOLUTION_ID", subscription_id="SUBSCRIPTION_ID", ) @@ -35,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/agrifood/resource-manager/Microsoft.AgFoodPlatform/preview/2021-09-01-preview/examples/FarmBeatsExtensions_List.json +# x-ms-original-file: specification/agrifood/resource-manager/Microsoft.AgFoodPlatform/preview/2020-05-12-preview/examples/FarmBeatsExtensions_List.json if __name__ == "__main__": main() diff --git a/sdk/agrifood/azure-mgmt-agrifood/generated_samples/farm_beats_models_create_or_update.py b/sdk/agrifood/azure-mgmt-agrifood/generated_samples/farm_beats_models_create_or_update.py index 53e5b2f80231..71e567ef4fee 100644 --- a/sdk/agrifood/azure-mgmt-agrifood/generated_samples/farm_beats_models_create_or_update.py +++ b/sdk/agrifood/azure-mgmt-agrifood/generated_samples/farm_beats_models_create_or_update.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.agrifood import AgriFoodMgmtClient +from azure.mgmt.agrifood import AzureAgriFoodRPService """ # PREREQUISITES @@ -24,20 +24,19 @@ def main(): - client = AgriFoodMgmtClient( + client = AzureAgriFoodRPService( credential=DefaultAzureCredential(), - solution_id="SOLUTION_ID", subscription_id="11111111-2222-3333-4444-555555555555", ) response = client.farm_beats_models.create_or_update( - resource_group_name="examples-rg", farm_beats_resource_name="examples-farmbeatsResourceName", + resource_group_name="examples-rg", body={"location": "eastus2", "tags": {"key1": "value1", "key2": "value2"}}, ) print(response) -# x-ms-original-file: specification/agrifood/resource-manager/Microsoft.AgFoodPlatform/preview/2021-09-01-preview/examples/FarmBeatsModels_CreateOrUpdate.json +# x-ms-original-file: specification/agrifood/resource-manager/Microsoft.AgFoodPlatform/preview/2020-05-12-preview/examples/FarmBeatsModels_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/agrifood/azure-mgmt-agrifood/generated_samples/farm_beats_models_delete.py b/sdk/agrifood/azure-mgmt-agrifood/generated_samples/farm_beats_models_delete.py index 42a3ac5a5a4f..c7f8fa453056 100644 --- a/sdk/agrifood/azure-mgmt-agrifood/generated_samples/farm_beats_models_delete.py +++ b/sdk/agrifood/azure-mgmt-agrifood/generated_samples/farm_beats_models_delete.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.agrifood import AgriFoodMgmtClient +from azure.mgmt.agrifood import AzureAgriFoodRPService """ # PREREQUISITES @@ -24,9 +24,8 @@ def main(): - client = AgriFoodMgmtClient( + client = AzureAgriFoodRPService( credential=DefaultAzureCredential(), - solution_id="SOLUTION_ID", subscription_id="11111111-2222-3333-4444-555555555555", ) @@ -37,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/agrifood/resource-manager/Microsoft.AgFoodPlatform/preview/2021-09-01-preview/examples/FarmBeatsModels_Delete.json +# x-ms-original-file: specification/agrifood/resource-manager/Microsoft.AgFoodPlatform/preview/2020-05-12-preview/examples/FarmBeatsModels_Delete.json if __name__ == "__main__": main() diff --git a/sdk/agrifood/azure-mgmt-agrifood/generated_samples/farm_beats_models_get.py b/sdk/agrifood/azure-mgmt-agrifood/generated_samples/farm_beats_models_get.py index bb511f03e9bc..7225bfe9db37 100644 --- a/sdk/agrifood/azure-mgmt-agrifood/generated_samples/farm_beats_models_get.py +++ b/sdk/agrifood/azure-mgmt-agrifood/generated_samples/farm_beats_models_get.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.agrifood import AgriFoodMgmtClient +from azure.mgmt.agrifood import AzureAgriFoodRPService """ # PREREQUISITES @@ -24,9 +24,8 @@ def main(): - client = AgriFoodMgmtClient( + client = AzureAgriFoodRPService( credential=DefaultAzureCredential(), - solution_id="SOLUTION_ID", subscription_id="11111111-2222-3333-4444-555555555555", ) @@ -37,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/agrifood/resource-manager/Microsoft.AgFoodPlatform/preview/2021-09-01-preview/examples/FarmBeatsModels_Get.json +# x-ms-original-file: specification/agrifood/resource-manager/Microsoft.AgFoodPlatform/preview/2020-05-12-preview/examples/FarmBeatsModels_Get.json if __name__ == "__main__": main() diff --git a/sdk/agrifood/azure-mgmt-agrifood/generated_samples/farm_beats_models_get_operation_result.py b/sdk/agrifood/azure-mgmt-agrifood/generated_samples/farm_beats_models_get_operation_result.py deleted file mode 100644 index 1d525d6f195c..000000000000 --- a/sdk/agrifood/azure-mgmt-agrifood/generated_samples/farm_beats_models_get_operation_result.py +++ /dev/null @@ -1,43 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.agrifood import AgriFoodMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-agrifood -# USAGE - python farm_beats_models_get_operation_result.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = AgriFoodMgmtClient( - credential=DefaultAzureCredential(), - solution_id="SOLUTION_ID", - subscription_id="11111111-2222-3333-4444-555555555555", - ) - - response = client.farm_beats_models.get_operation_result( - resource_group_name="examples-rg", - farm_beats_resource_name="examples-farmBeatsResourceName", - operation_results_id="resource-provisioning-id-farmBeatsResourceName", - ) - print(response) - - -# x-ms-original-file: specification/agrifood/resource-manager/Microsoft.AgFoodPlatform/preview/2021-09-01-preview/examples/FarmBeatsModels_GetOperationResult.json -if __name__ == "__main__": - main() diff --git a/sdk/agrifood/azure-mgmt-agrifood/generated_samples/farm_beats_models_list_by_resource_group.py b/sdk/agrifood/azure-mgmt-agrifood/generated_samples/farm_beats_models_list_by_resource_group.py index 5c5f3e77bf4f..afc48b171893 100644 --- a/sdk/agrifood/azure-mgmt-agrifood/generated_samples/farm_beats_models_list_by_resource_group.py +++ b/sdk/agrifood/azure-mgmt-agrifood/generated_samples/farm_beats_models_list_by_resource_group.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.agrifood import AgriFoodMgmtClient +from azure.mgmt.agrifood import AzureAgriFoodRPService """ # PREREQUISITES @@ -24,9 +24,8 @@ def main(): - client = AgriFoodMgmtClient( + client = AzureAgriFoodRPService( credential=DefaultAzureCredential(), - solution_id="SOLUTION_ID", subscription_id="11111111-2222-3333-4444-555555555555", ) @@ -37,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/agrifood/resource-manager/Microsoft.AgFoodPlatform/preview/2021-09-01-preview/examples/FarmBeatsModels_ListByResourceGroup.json +# x-ms-original-file: specification/agrifood/resource-manager/Microsoft.AgFoodPlatform/preview/2020-05-12-preview/examples/FarmBeatsModels_ListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/agrifood/azure-mgmt-agrifood/generated_samples/farm_beats_models_list_by_subscription.py b/sdk/agrifood/azure-mgmt-agrifood/generated_samples/farm_beats_models_list_by_subscription.py index 047c313e49d2..65f0a40d152d 100644 --- a/sdk/agrifood/azure-mgmt-agrifood/generated_samples/farm_beats_models_list_by_subscription.py +++ b/sdk/agrifood/azure-mgmt-agrifood/generated_samples/farm_beats_models_list_by_subscription.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.agrifood import AgriFoodMgmtClient +from azure.mgmt.agrifood import AzureAgriFoodRPService """ # PREREQUISITES @@ -24,9 +24,8 @@ def main(): - client = AgriFoodMgmtClient( + client = AzureAgriFoodRPService( credential=DefaultAzureCredential(), - solution_id="SOLUTION_ID", subscription_id="11111111-2222-3333-4444-555555555555", ) @@ -35,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/agrifood/resource-manager/Microsoft.AgFoodPlatform/preview/2021-09-01-preview/examples/FarmBeatsModels_ListBySubscription.json +# x-ms-original-file: specification/agrifood/resource-manager/Microsoft.AgFoodPlatform/preview/2020-05-12-preview/examples/FarmBeatsModels_ListBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/agrifood/azure-mgmt-agrifood/generated_samples/farm_beats_models_update.py b/sdk/agrifood/azure-mgmt-agrifood/generated_samples/farm_beats_models_update.py index 53f001ca6515..6bc4246aac5a 100644 --- a/sdk/agrifood/azure-mgmt-agrifood/generated_samples/farm_beats_models_update.py +++ b/sdk/agrifood/azure-mgmt-agrifood/generated_samples/farm_beats_models_update.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.agrifood import AgriFoodMgmtClient +from azure.mgmt.agrifood import AzureAgriFoodRPService """ # PREREQUISITES @@ -24,20 +24,19 @@ def main(): - client = AgriFoodMgmtClient( + client = AzureAgriFoodRPService( credential=DefaultAzureCredential(), - solution_id="SOLUTION_ID", subscription_id="11111111-2222-3333-4444-555555555555", ) - response = client.farm_beats_models.begin_update( - resource_group_name="examples-rg", + response = client.farm_beats_models.update( farm_beats_resource_name="examples-farmBeatsResourceName", + resource_group_name="examples-rg", body={"tags": {"key1": "value1", "key2": "value2"}}, - ).result() + ) print(response) -# x-ms-original-file: specification/agrifood/resource-manager/Microsoft.AgFoodPlatform/preview/2021-09-01-preview/examples/FarmBeatsModels_Update.json +# x-ms-original-file: specification/agrifood/resource-manager/Microsoft.AgFoodPlatform/preview/2020-05-12-preview/examples/FarmBeatsModels_Update.json if __name__ == "__main__": main() diff --git a/sdk/agrifood/azure-mgmt-agrifood/generated_samples/farm_beats_models_update_with_sensor.py b/sdk/agrifood/azure-mgmt-agrifood/generated_samples/farm_beats_models_update_with_sensor.py deleted file mode 100644 index 733de9ff1936..000000000000 --- a/sdk/agrifood/azure-mgmt-agrifood/generated_samples/farm_beats_models_update_with_sensor.py +++ /dev/null @@ -1,47 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.agrifood import AgriFoodMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-agrifood -# USAGE - python farm_beats_models_update_with_sensor.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = AgriFoodMgmtClient( - credential=DefaultAzureCredential(), - solution_id="SOLUTION_ID", - subscription_id="11111111-2222-3333-4444-555555555555", - ) - - response = client.farm_beats_models.begin_update( - resource_group_name="examples-rg", - farm_beats_resource_name="examples-farmBeatsResourceName", - body={ - "identity": {"type": "SystemAssigned"}, - "properties": {"sensorIntegration": {"enabled": "True"}}, - "tags": {"key1": "value1", "key2": "value2"}, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/agrifood/resource-manager/Microsoft.AgFoodPlatform/preview/2021-09-01-preview/examples/FarmBeatsModels_UpdateWithSensor.json -if __name__ == "__main__": - main() diff --git a/sdk/agrifood/azure-mgmt-agrifood/generated_samples/locations_check_name_availability_already_exists.py b/sdk/agrifood/azure-mgmt-agrifood/generated_samples/locations_check_name_availability_already_exists.py index 97d29423ef67..28fa48d6398f 100644 --- a/sdk/agrifood/azure-mgmt-agrifood/generated_samples/locations_check_name_availability_already_exists.py +++ b/sdk/agrifood/azure-mgmt-agrifood/generated_samples/locations_check_name_availability_already_exists.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.agrifood import AgriFoodMgmtClient +from azure.mgmt.agrifood import AzureAgriFoodRPService """ # PREREQUISITES @@ -24,9 +24,8 @@ def main(): - client = AgriFoodMgmtClient( + client = AzureAgriFoodRPService( credential=DefaultAzureCredential(), - solution_id="SOLUTION_ID", subscription_id="11111111-2222-3333-4444-555555555555", ) @@ -36,6 +35,6 @@ def main(): print(response) -# x-ms-original-file: specification/agrifood/resource-manager/Microsoft.AgFoodPlatform/preview/2021-09-01-preview/examples/Locations_CheckNameAvailability_AlreadyExists.json +# x-ms-original-file: specification/agrifood/resource-manager/Microsoft.AgFoodPlatform/preview/2020-05-12-preview/examples/Locations_CheckNameAvailability_AlreadyExists.json if __name__ == "__main__": main() diff --git a/sdk/agrifood/azure-mgmt-agrifood/generated_samples/locations_check_name_availability_available.py b/sdk/agrifood/azure-mgmt-agrifood/generated_samples/locations_check_name_availability_available.py index 800d03955a0f..4ac1e3bf9547 100644 --- a/sdk/agrifood/azure-mgmt-agrifood/generated_samples/locations_check_name_availability_available.py +++ b/sdk/agrifood/azure-mgmt-agrifood/generated_samples/locations_check_name_availability_available.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.agrifood import AgriFoodMgmtClient +from azure.mgmt.agrifood import AzureAgriFoodRPService """ # PREREQUISITES @@ -24,9 +24,8 @@ def main(): - client = AgriFoodMgmtClient( + client = AzureAgriFoodRPService( credential=DefaultAzureCredential(), - solution_id="SOLUTION_ID", subscription_id="11111111-2222-3333-4444-555555555555", ) @@ -36,6 +35,6 @@ def main(): print(response) -# x-ms-original-file: specification/agrifood/resource-manager/Microsoft.AgFoodPlatform/preview/2021-09-01-preview/examples/Locations_CheckNameAvailability_Available.json +# x-ms-original-file: specification/agrifood/resource-manager/Microsoft.AgFoodPlatform/preview/2020-05-12-preview/examples/Locations_CheckNameAvailability_Available.json if __name__ == "__main__": main() diff --git a/sdk/agrifood/azure-mgmt-agrifood/generated_samples/operations_list.py b/sdk/agrifood/azure-mgmt-agrifood/generated_samples/operations_list.py index fe582f63f71d..dd37bff55c6a 100644 --- a/sdk/agrifood/azure-mgmt-agrifood/generated_samples/operations_list.py +++ b/sdk/agrifood/azure-mgmt-agrifood/generated_samples/operations_list.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.agrifood import AgriFoodMgmtClient +from azure.mgmt.agrifood import AzureAgriFoodRPService """ # PREREQUISITES @@ -24,9 +24,8 @@ def main(): - client = AgriFoodMgmtClient( + client = AzureAgriFoodRPService( credential=DefaultAzureCredential(), - solution_id="SOLUTION_ID", subscription_id="SUBSCRIPTION_ID", ) @@ -35,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/agrifood/resource-manager/Microsoft.AgFoodPlatform/preview/2021-09-01-preview/examples/Operations_List.json +# x-ms-original-file: specification/agrifood/resource-manager/Microsoft.AgFoodPlatform/preview/2020-05-12-preview/examples/Operations_List.json if __name__ == "__main__": main() diff --git a/sdk/agrifood/azure-mgmt-agrifood/generated_samples/private_endpoint_connections_create_or_update.py b/sdk/agrifood/azure-mgmt-agrifood/generated_samples/private_endpoint_connections_create_or_update.py deleted file mode 100644 index bb0fb59a9ff5..000000000000 --- a/sdk/agrifood/azure-mgmt-agrifood/generated_samples/private_endpoint_connections_create_or_update.py +++ /dev/null @@ -1,51 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.agrifood import AgriFoodMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-agrifood -# USAGE - python private_endpoint_connections_create_or_update.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = AgriFoodMgmtClient( - credential=DefaultAzureCredential(), - solution_id="SOLUTION_ID", - subscription_id="11111111-2222-3333-4444-555555555555", - ) - - response = client.private_endpoint_connections.create_or_update( - resource_group_name="examples-rg", - farm_beats_resource_name="examples-farmbeatsResourceName", - private_endpoint_connection_name="privateEndpointConnectionName", - body={ - "properties": { - "privateLinkServiceConnectionState": { - "description": "Approved by johndoe@contoso.com", - "status": "Approved", - } - } - }, - ) - print(response) - - -# x-ms-original-file: specification/agrifood/resource-manager/Microsoft.AgFoodPlatform/preview/2021-09-01-preview/examples/PrivateEndpointConnections_CreateOrUpdate.json -if __name__ == "__main__": - main() diff --git a/sdk/agrifood/azure-mgmt-agrifood/generated_samples/private_endpoint_connections_delete.py b/sdk/agrifood/azure-mgmt-agrifood/generated_samples/private_endpoint_connections_delete.py deleted file mode 100644 index 39cfc031b0bb..000000000000 --- a/sdk/agrifood/azure-mgmt-agrifood/generated_samples/private_endpoint_connections_delete.py +++ /dev/null @@ -1,43 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.agrifood import AgriFoodMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-agrifood -# USAGE - python private_endpoint_connections_delete.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = AgriFoodMgmtClient( - credential=DefaultAzureCredential(), - solution_id="SOLUTION_ID", - subscription_id="11111111-2222-3333-4444-555555555555", - ) - - response = client.private_endpoint_connections.begin_delete( - resource_group_name="examples-rg", - farm_beats_resource_name="examples-farmbeatsResourceName", - private_endpoint_connection_name="privateEndpointConnectionName", - ).result() - print(response) - - -# x-ms-original-file: specification/agrifood/resource-manager/Microsoft.AgFoodPlatform/preview/2021-09-01-preview/examples/PrivateEndpointConnections_Delete.json -if __name__ == "__main__": - main() diff --git a/sdk/agrifood/azure-mgmt-agrifood/generated_samples/private_endpoint_connections_get.py b/sdk/agrifood/azure-mgmt-agrifood/generated_samples/private_endpoint_connections_get.py deleted file mode 100644 index 952359030b85..000000000000 --- a/sdk/agrifood/azure-mgmt-agrifood/generated_samples/private_endpoint_connections_get.py +++ /dev/null @@ -1,43 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.agrifood import AgriFoodMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-agrifood -# USAGE - python private_endpoint_connections_get.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = AgriFoodMgmtClient( - credential=DefaultAzureCredential(), - solution_id="SOLUTION_ID", - subscription_id="11111111-2222-3333-4444-555555555555", - ) - - response = client.private_endpoint_connections.get( - resource_group_name="examples-rg", - farm_beats_resource_name="examples-farmbeatsResourceName", - private_endpoint_connection_name="privateEndpointConnectionName", - ) - print(response) - - -# x-ms-original-file: specification/agrifood/resource-manager/Microsoft.AgFoodPlatform/preview/2021-09-01-preview/examples/PrivateEndpointConnections_Get.json -if __name__ == "__main__": - main() diff --git a/sdk/agrifood/azure-mgmt-agrifood/generated_samples/private_endpoint_connections_list_by_resource.py b/sdk/agrifood/azure-mgmt-agrifood/generated_samples/private_endpoint_connections_list_by_resource.py deleted file mode 100644 index 5b3991089e10..000000000000 --- a/sdk/agrifood/azure-mgmt-agrifood/generated_samples/private_endpoint_connections_list_by_resource.py +++ /dev/null @@ -1,43 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.agrifood import AgriFoodMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-agrifood -# USAGE - python private_endpoint_connections_list_by_resource.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = AgriFoodMgmtClient( - credential=DefaultAzureCredential(), - solution_id="SOLUTION_ID", - subscription_id="11111111-2222-3333-4444-555555555555", - ) - - response = client.private_endpoint_connections.list_by_resource( - resource_group_name="examples-rg", - farm_beats_resource_name="examples-farmbeatsResourceName", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/agrifood/resource-manager/Microsoft.AgFoodPlatform/preview/2021-09-01-preview/examples/PrivateEndpointConnections_ListByResource.json -if __name__ == "__main__": - main() diff --git a/sdk/agrifood/azure-mgmt-agrifood/generated_samples/private_link_resources_get.py b/sdk/agrifood/azure-mgmt-agrifood/generated_samples/private_link_resources_get.py deleted file mode 100644 index 01e60c5f8c00..000000000000 --- a/sdk/agrifood/azure-mgmt-agrifood/generated_samples/private_link_resources_get.py +++ /dev/null @@ -1,43 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.agrifood import AgriFoodMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-agrifood -# USAGE - python private_link_resources_get.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = AgriFoodMgmtClient( - credential=DefaultAzureCredential(), - solution_id="SOLUTION_ID", - subscription_id="11111111-2222-3333-4444-555555555555", - ) - - response = client.private_link_resources.get( - resource_group_name="examples-rg", - farm_beats_resource_name="examples-farmbeatsResourceName", - sub_resource_name="farmbeats", - ) - print(response) - - -# x-ms-original-file: specification/agrifood/resource-manager/Microsoft.AgFoodPlatform/preview/2021-09-01-preview/examples/PrivateLinkResources_Get.json -if __name__ == "__main__": - main() diff --git a/sdk/agrifood/azure-mgmt-agrifood/generated_samples/private_link_resources_list_by_resource.py b/sdk/agrifood/azure-mgmt-agrifood/generated_samples/private_link_resources_list_by_resource.py deleted file mode 100644 index 86d3a2fa27b1..000000000000 --- a/sdk/agrifood/azure-mgmt-agrifood/generated_samples/private_link_resources_list_by_resource.py +++ /dev/null @@ -1,43 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.agrifood import AgriFoodMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-agrifood -# USAGE - python private_link_resources_list_by_resource.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = AgriFoodMgmtClient( - credential=DefaultAzureCredential(), - solution_id="SOLUTION_ID", - subscription_id="11111111-2222-3333-4444-555555555555", - ) - - response = client.private_link_resources.list_by_resource( - resource_group_name="examples-rg", - farm_beats_resource_name="examples-farmbeatsResourceName", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/agrifood/resource-manager/Microsoft.AgFoodPlatform/preview/2021-09-01-preview/examples/PrivateLinkResources_ListByResource.json -if __name__ == "__main__": - main() diff --git a/sdk/agrifood/azure-mgmt-agrifood/generated_samples/solutions_create_or_update.py b/sdk/agrifood/azure-mgmt-agrifood/generated_samples/solutions_create_or_update.py deleted file mode 100644 index b20f0b389393..000000000000 --- a/sdk/agrifood/azure-mgmt-agrifood/generated_samples/solutions_create_or_update.py +++ /dev/null @@ -1,42 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.agrifood import AgriFoodMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-agrifood -# USAGE - python solutions_create_or_update.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = AgriFoodMgmtClient( - credential=DefaultAzureCredential(), - solution_id="abc.partner", - subscription_id="11111111-2222-3333-4444-555555555555", - ) - - response = client.solutions.create_or_update( - resource_group_name="examples-rg", - farm_beats_resource_name="examples-farmbeatsResourceName", - ) - print(response) - - -# x-ms-original-file: specification/agrifood/resource-manager/Microsoft.AgFoodPlatform/preview/2021-09-01-preview/examples/Solutions_CreateOrUpdate.json -if __name__ == "__main__": - main() diff --git a/sdk/agrifood/azure-mgmt-agrifood/generated_samples/solutions_discoverability_get.py b/sdk/agrifood/azure-mgmt-agrifood/generated_samples/solutions_discoverability_get.py deleted file mode 100644 index 39a2f3736e8b..000000000000 --- a/sdk/agrifood/azure-mgmt-agrifood/generated_samples/solutions_discoverability_get.py +++ /dev/null @@ -1,41 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.agrifood import AgriFoodMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-agrifood -# USAGE - python solutions_discoverability_get.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = AgriFoodMgmtClient( - credential=DefaultAzureCredential(), - solution_id="SOLUTION_ID", - subscription_id="SUBSCRIPTION_ID", - ) - - response = client.solutions_discoverability.get( - farm_beats_solution_id="bayerAgPowered.gdu", - ) - print(response) - - -# x-ms-original-file: specification/agrifood/resource-manager/Microsoft.AgFoodPlatform/preview/2021-09-01-preview/examples/SolutionsDiscoverability_Get.json -if __name__ == "__main__": - main() diff --git a/sdk/agrifood/azure-mgmt-agrifood/generated_samples/solutions_discoverability_list.py b/sdk/agrifood/azure-mgmt-agrifood/generated_samples/solutions_discoverability_list.py deleted file mode 100644 index 0b480f416e65..000000000000 --- a/sdk/agrifood/azure-mgmt-agrifood/generated_samples/solutions_discoverability_list.py +++ /dev/null @@ -1,40 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.agrifood import AgriFoodMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-agrifood -# USAGE - python solutions_discoverability_list.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = AgriFoodMgmtClient( - credential=DefaultAzureCredential(), - solution_id="SOLUTION_ID", - subscription_id="SUBSCRIPTION_ID", - ) - - response = client.solutions_discoverability.list() - for item in response: - print(item) - - -# x-ms-original-file: specification/agrifood/resource-manager/Microsoft.AgFoodPlatform/preview/2021-09-01-preview/examples/SolutionsDiscoverability_List.json -if __name__ == "__main__": - main() diff --git a/sdk/agrifood/azure-mgmt-agrifood/generated_samples/solutions_list.py b/sdk/agrifood/azure-mgmt-agrifood/generated_samples/solutions_list.py deleted file mode 100644 index c0dc135cb12d..000000000000 --- a/sdk/agrifood/azure-mgmt-agrifood/generated_samples/solutions_list.py +++ /dev/null @@ -1,43 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.agrifood import AgriFoodMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-agrifood -# USAGE - python solutions_list.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = AgriFoodMgmtClient( - credential=DefaultAzureCredential(), - solution_id="SOLUTION_ID", - subscription_id="11111111-2222-3333-4444-555555555555", - ) - - response = client.solutions.list( - resource_group_name="examples-rg", - farm_beats_resource_name="examples-farmbeatsResourceName", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/agrifood/resource-manager/Microsoft.AgFoodPlatform/preview/2021-09-01-preview/examples/Solutions_List.json -if __name__ == "__main__": - main() diff --git a/tools/azure-sdk-tools/packaging_tools/generate_utils.py b/tools/azure-sdk-tools/packaging_tools/generate_utils.py index a64e67051246..e44b15290692 100644 --- a/tools/azure-sdk-tools/packaging_tools/generate_utils.py +++ b/tools/azure-sdk-tools/packaging_tools/generate_utils.py @@ -34,21 +34,34 @@ def get_package_names(sdk_folder): return package_names -def init_new_service(package_name, folder_name): - setup = Path(folder_name, package_name, "setup.py") - if not setup.exists(): - check_call( - f"python -m packaging_tools --build-conf {package_name} -o {folder_name}", - shell=True, +def init_new_service(package_name, folder_name, is_cadl = False): + if not is_cadl: + setup = Path(folder_name, package_name, "setup.py") + if not setup.exists(): + check_call( + f"python -m packaging_tools --build-conf {package_name} -o {folder_name}", + shell=True, + ) + ci = Path(folder_name, "ci.yml") + if not ci.exists(): + with open("ci_template.yml", "r") as file_in: + content = file_in.readlines() + name = package_name.replace("azure-", "").replace("mgmt-", "") + content = [line.replace("MyService", name) for line in content] + with open(str(ci), "w") as file_out: + file_out.writelines(content) + else: + output_path = Path(folder_name) / package_name + if not (output_path / "sdk_packaging.toml").exists(): + with open(output_path / "sdk_packaging.toml", "w") as file_out: + file_out.write("[packaging]\nauto_update = false") + + # add ci.yaml + generate_ci( + template_path=Path("scripts/quickstart_tooling_dpg/template_ci"), + folder_path=Path(folder_name), + package_name=package_name ) - ci = Path(folder_name, "ci.yml") - if not ci.exists(): - with open("ci_template.yml", "r") as file_in: - content = file_in.readlines() - name = package_name.replace("azure-", "").replace("mgmt-", "") - content = [line.replace("MyService", name) for line in content] - with open(str(ci), "w") as file_out: - file_out.writelines(content) def update_servicemetadata(sdk_folder, data, config, folder_name, package_name, spec_folder, input_readme): @@ -347,36 +360,27 @@ def generate_ci(template_path: Path, folder_path: Path, package_name: str) -> No file_out.writelines(content) def gen_cadl(cadl_relative_path: str, spec_folder: str) -> Dict[str, Any]: - # update config file cadl_python = "@azure-tools/cadl-python" autorest_python = "@autorest/python" - project_yaml_path = Path(spec_folder) / cadl_relative_path / "cadl-project.yaml" - with open(project_yaml_path, "r") as file_in: - project_yaml = yaml.safe_load(file_in) - if not project_yaml.get("emitters", {}).get(cadl_python): - return - if not project_yaml["emitters"][cadl_python].get("sdk-folder"): - raise Exception("no sdk-folder is defined") - output_path = Path(os.getcwd()) / project_yaml["emitters"][cadl_python]["sdk-folder"] - if not output_path.exists(): - os.makedirs(output_path) - - project_yaml["emitters"][cadl_python].pop("sdk-folder") - with open(project_yaml_path, "w") as file_out: - yaml.safe_dump(project_yaml, file_out) # npm install tool origin_path = os.getcwd() + with open("cadl_to_sdk_config.json", "r") as file_in: + cadl_python_dep = json.load(file_in) os.chdir(Path(spec_folder) / cadl_relative_path) + if Path("package.json").exists(): + with open("package.json", "r") as file_in: + cadl_tools = json.load(file_in) + else: + cadl_tools = {"dependencies:{}"} + cadl_tools["dependencies"].update(cadl_python_dep["dependencies"]) + with open("package.json", "w") as file_out: + json.dump(cadl_tools, file_out) check_call("npm install", shell=True) # generate code - check_call(f"npx cadl compile . --emit {cadl_python} --output-path={str(output_path)}", shell=True) - if (output_path / "output.yaml").exists(): - os.remove(output_path / "output.yaml") - if not (output_path / "sdk_packaging.toml").exists(): - with open(output_path / "sdk_packaging.toml", "w") as file_out: - file_out.write("[packaging]\nauto_update = false") + cadl_file = "client.cadl" if Path("client.cadl").exists() else "." + check_call(f"npx cadl compile {cadl_file} --emit {cadl_python} --arg \"python-sdk-folder={origin_path}\" ", shell=True) # get version of codegen used in generation npm_package_verstion = get_npm_package_version(autorest_python) @@ -384,11 +388,4 @@ def gen_cadl(cadl_relative_path: str, spec_folder: str) -> Dict[str, Any]: # return to original folder os.chdir(origin_path) - # add ci.yaml - generate_ci( - template_path=Path("scripts/quickstart_tooling_dpg/template_ci"), - folder_path=output_path.parent, - package_name=project_yaml["emitters"][cadl_python]["package-name"] - ) - - return npm_package_verstion \ No newline at end of file + return npm_package_verstion diff --git a/tools/azure-sdk-tools/packaging_tools/sdk_generator.py b/tools/azure-sdk-tools/packaging_tools/sdk_generator.py index 821cbc45906a..0d348f505afd 100644 --- a/tools/azure-sdk-tools/packaging_tools/sdk_generator.py +++ b/tools/azure-sdk-tools/packaging_tools/sdk_generator.py @@ -76,6 +76,7 @@ def main(generate_input, generate_output): for input_readme in readme_files: _LOGGER.info(f"[CODEGEN]({input_readme})codegen begin") + is_cadl = False if "resource-manager" in input_readme: relative_path_readme = str(Path(spec_folder, input_readme)) del_outdated_samples(relative_path_readme) @@ -92,6 +93,7 @@ def main(generate_input, generate_output): config = gen_dpg(input_readme, data.get("autorestConfig", ""), dpg_relative_folder(spec_folder)) else: config = gen_cadl(input_readme, spec_folder) + is_cadl = True package_names = get_package_names(sdk_folder) _LOGGER.info(f"[CODEGEN]({input_readme})codegen end. [(packages:{str(package_names)})]") @@ -113,7 +115,7 @@ def main(generate_input, generate_output): result[package_name][spec_word].append(input_readme) # Generate some necessary file for new service - init_new_service(package_name, folder_name) + init_new_service(package_name, folder_name, is_cadl) format_samples(sdk_code_path) # Update metadata