Skip to content

Commit

Permalink
CodeGen from PR 3612 in openapi-env-test/azure-rest-api-specs
Browse files Browse the repository at this point in the history
Update readme.md (Azure#3612)
  • Loading branch information
SDKAuto committed Dec 5, 2022
1 parent 12306c5 commit 62c4c5c
Show file tree
Hide file tree
Showing 49 changed files with 1,819 additions and 4,315 deletions.
12 changes: 6 additions & 6 deletions sdk/agrifood/azure-mgmt-agrifood/_meta.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"autorest": "3.8.4",
"commit": "d882758512bd806d3d2712190adea44fce3bdbb2",
"repository_url": "https://github.com/openapi-env-test/azure-rest-api-specs",
"autorest": "3.9.2",
"use": [
"@autorest/python@6.0.1",
"@autorest/modelerfour@4.23.5"
"@autorest/python@6.2.7",
"@autorest/modelerfour@4.24.3"
],
"commit": "6080b0126065467abbb3e096b25ed4ad6c22fa1f",
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
"autorest_command": "autorest specification/agrifood/resource-manager/readme.md --models-mode=msrest --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.0.1 --use=@autorest/modelerfour@4.23.5 --version=3.8.4 --version-tolerant=False",
"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"
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,21 @@
# 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

try:
from ._patch import __all__ as _patch_all
from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import
from ._patch import * # pylint: disable=unused-wildcard-import
except ImportError:
_patch_all = []
from ._patch import patch_sdk as _patch_sdk

__all__ = ["AgriFoodMgmtClient"]
__all__ = [
"AzureAgriFoodRPService",
]
__all__.extend([p for p in _patch_all if p not in __all__])

_patch_sdk()

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,29 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

from typing import TYPE_CHECKING
from copy import deepcopy
from typing import Any, TYPE_CHECKING

from azure.core.rest import HttpRequest, HttpResponse
from azure.mgmt.core import ARMPipelineClient
from msrest import Deserializer, Serializer

from . import models as _models
from ._configuration import AzureAgriFoodRPServiceConfiguration
from ._serialization import Deserializer, Serializer
from .operations import (
ExtensionsOperations,
FarmBeatsExtensionsOperations,
FarmBeatsModelsOperations,
LocationsOperations,
Operations,
)

if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from typing import Any, Optional

from azure.core.credentials import TokenCredential
from azure.core.pipeline.transport import HttpRequest, HttpResponse

from ._configuration import AzureAgriFoodRPServiceConfiguration
from .operations import ExtensionsOperations
from .operations import FarmBeatsExtensionsOperations
from .operations import FarmBeatsModelsOperations
from .operations import LocationsOperations
from .operations import Operations
from . import models


class AzureAgriFoodRPService(object):
class AzureAgriFoodRPService: # pylint: disable=client-accepts-api-version-keyword
"""APIs documentation for Azure AgriFood Resource Provider Service.
:ivar extensions: ExtensionsOperations operations
Expand All @@ -40,31 +41,33 @@ class AzureAgriFoodRPService(object):
:vartype locations: azure.mgmt.agrifood.operations.LocationsOperations
:ivar operations: Operations operations
:vartype operations: azure.mgmt.agrifood.operations.Operations
:param credential: Credential needed for the client to connect to Azure.
:param credential: Credential needed for the client to connect to Azure. Required.
:type credential: ~azure.core.credentials.TokenCredential
:param subscription_id: The ID of the target subscription.
:param subscription_id: The ID of the target subscription. Required.
:type subscription_id: str
:param str base_url: Service URL
:param base_url: Service URL. Default value is "https://management.azure.com".
:type base_url: str
: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, # type: "TokenCredential"
subscription_id, # type: str
base_url=None, # type: Optional[str]
**kwargs # type: Any
):
# type: (...) -> None
if not base_url:
base_url = "https://management.azure.com"
self._config = AzureAgriFoodRPServiceConfiguration(credential, subscription_id, **kwargs)
credential: "TokenCredential",
subscription_id: str,
base_url: str = "https://management.azure.com",
**kwargs: Any
) -> None:
self._config = AzureAgriFoodRPServiceConfiguration(
credential=credential, subscription_id=subscription_id, **kwargs
)
self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs)

client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)}
self._serialize = Serializer(client_models)
self._serialize.client_side_validation = False
self._deserialize = Deserializer(client_models)

self._serialize.client_side_validation = False
self.extensions = ExtensionsOperations(self._client, self._config, self._serialize, self._deserialize)
self.farm_beats_extensions = FarmBeatsExtensionsOperations(
self._client, self._config, self._serialize, self._deserialize
Expand All @@ -75,35 +78,34 @@ def __init__(
self.locations = LocationsOperations(self._client, self._config, self._serialize, self._deserialize)
self.operations = Operations(self._client, self._config, self._serialize, self._deserialize)

def _send_request(self, http_request, **kwargs):
# type: (HttpRequest, Any) -> HttpResponse
def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
"""Runs the network request through the client's chained policies.
:param http_request: The network request you want to make. Required.
:type http_request: ~azure.core.pipeline.transport.HttpRequest
:keyword bool stream: Whether the response payload will be streamed. Defaults to True.
>>> from azure.core.rest import HttpRequest
>>> request = HttpRequest("GET", "https://www.example.org/")
<HttpRequest [GET], url: 'https://www.example.org/'>
>>> response = client._send_request(request)
<HttpResponse: 200 OK>
For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request
:param request: The network request you want to make. Required.
:type request: ~azure.core.rest.HttpRequest
:keyword bool stream: Whether the response payload will be streamed. Defaults to False.
:return: The response of your network call. Does not do error handling on your response.
:rtype: ~azure.core.pipeline.transport.HttpResponse
:rtype: ~azure.core.rest.HttpResponse
"""
path_format_arguments = {
"subscriptionId": self._serialize.url(
"self._config.subscription_id", self._config.subscription_id, "str", min_length=1
),
}
http_request.url = self._client.format_url(http_request.url, **path_format_arguments)
stream = kwargs.pop("stream", True)
pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs)
return pipeline_response.http_response

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

request_copy = deepcopy(request)
request_copy.url = self._client.format_url(request_copy.url)
return self._client.send_request(request_copy, **kwargs)

def close(self) -> None:
self._client.close()

def __enter__(self):
# type: () -> AzureAgriFoodRPService
def __enter__(self) -> "AzureAgriFoodRPService":
self._client.__enter__()
return self

def __exit__(self, *exc_details):
# type: (Any) -> None
def __exit__(self, *exc_details) -> None:
self._client.__exit__(*exc_details)
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

import sys
from typing import Any, TYPE_CHECKING

from azure.core.configuration import Configuration
Expand All @@ -14,13 +15,18 @@

from ._version import VERSION

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 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.
Expand All @@ -29,14 +35,14 @@ class AgriFoodMgmtClientConfiguration(Configuration): # pylint: disable=too-man
:type credential: ~azure.core.credentials.TokenCredential
: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", subscription_id: str, **kwargs: Any) -> None:
super(AgriFoodMgmtClientConfiguration, self).__init__(**kwargs)
api_version = kwargs.pop("api_version", "2021-09-01-preview") # type: str
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.")
Expand All @@ -50,10 +56,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs
kwargs.setdefault("sdk_moniker", "mgmt-agrifood/{}".format(VERSION))
self._configure(**kwargs)

def _configure(
self, **kwargs # type: Any
):
# type: (...) -> None
def _configure(self, **kwargs: Any) -> None:
self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs)
self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs)
self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs)
Expand Down
Loading

0 comments on commit 62c4c5c

Please sign in to comment.