Skip to content

Commit 8a25b76

Browse files
author
SDKAuto
committed
CodeGen from PR 22145 in Azure/azure-rest-api-specs
Merge e3704e2174edb3b3b46f488980315e4e893f9c9c into c0f92082a788895368a738a9200e24971157d7ca
1 parent 202c522 commit 8a25b76

35 files changed

+4981
-0
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Release History
2+
3+
## 1.0.0b1 (1970-01-01)
4+
5+
- Initial version
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
Copyright (c) Microsoft Corporation.
2+
3+
MIT License
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
include *.md
2+
include LICENSE
3+
include azure/template/contoso/py.typed
4+
recursive-include tests *.py
5+
recursive-include samples *.py *.md
6+
include azure/__init__.py
7+
include azure/template/__init__.py
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
2+
# None client library for Python
3+
<!-- write necessary description of service -->
4+
5+
## Getting started
6+
7+
### Installating the package
8+
9+
```bash
10+
python -m pip install azure-template-contoso
11+
```
12+
13+
#### Prequisites
14+
15+
- Python 3.7 or later is required to use this package.
16+
- You need an [Azure subscription][azure_sub] to use this package.
17+
- An existing None instance.
18+
19+
## Contributing
20+
21+
This project welcomes contributions and suggestions. Most contributions require
22+
you to agree to a Contributor License Agreement (CLA) declaring that you have
23+
the right to, and actually do, grant us the rights to use your contribution.
24+
For details, visit https://cla.microsoft.com.
25+
26+
When you submit a pull request, a CLA-bot will automatically determine whether
27+
you need to provide a CLA and decorate the PR appropriately (e.g., label,
28+
comment). Simply follow the instructions provided by the bot. You will only
29+
need to do this once across all repos using our CLA.
30+
31+
This project has adopted the
32+
[Microsoft Open Source Code of Conduct][code_of_conduct]. For more information,
33+
see the Code of Conduct FAQ or contact [email protected] with any
34+
additional questions or comments.
35+
36+
<!-- LINKS -->
37+
[code_of_conduct]: https://opensource.microsoft.com/codeofconduct/
38+
[authenticate_with_token]: https://docs.microsoft.com/azure/cognitive-services/authentication?tabs=powershell#authenticate-with-an-authentication-token
39+
[azure_identity_credentials]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#credentials
40+
[azure_identity_pip]: https://pypi.org/project/azure-identity/
41+
[default_azure_credential]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#defaultazurecredential
42+
[pip]: https://pypi.org/project/pip/
43+
[azure_sub]: https://azure.microsoft.com/free/
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"commit": "dde6499a85015c851b4b617e6f21fa9331eabd79",
3+
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
4+
"cadl_src": "specification/contoso/Contoso",
5+
"@autorest/python": {
6+
"version": "6.2.15",
7+
"resolved": "https://registry.npmjs.org/@autorest/python/-/python-6.2.15.tgz"
8+
},
9+
"@azure-tools/cadl-python": {
10+
"version": "0.4.16",
11+
"resolved": "https://registry.npmjs.org/@azure-tools/cadl-python/-/cadl-python-0.4.16.tgz",
12+
"dependencies": {
13+
"@autorest/python": {
14+
"version": "6.2.15"
15+
}
16+
}
17+
}
18+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# coding=utf-8
2+
# --------------------------------------------------------------------------
3+
# Copyright (c) Microsoft Corporation. All rights reserved.
4+
# Licensed under the MIT License. See License.txt in the project root for license information.
5+
# Code generated by Microsoft (R) Python Code Generator.
6+
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
7+
# --------------------------------------------------------------------------
8+
9+
from ._client import ContosoClient
10+
from ._version import VERSION
11+
12+
__version__ = VERSION
13+
14+
try:
15+
from ._patch import __all__ as _patch_all
16+
from ._patch import * # pylint: disable=unused-wildcard-import
17+
except ImportError:
18+
_patch_all = []
19+
from ._patch import patch_sdk as _patch_sdk
20+
21+
__all__ = [
22+
"ContosoClient",
23+
]
24+
__all__.extend([p for p in _patch_all if p not in __all__])
25+
26+
_patch_sdk()
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
# coding=utf-8
2+
# --------------------------------------------------------------------------
3+
# Copyright (c) Microsoft Corporation. All rights reserved.
4+
# Licensed under the MIT License. See License.txt in the project root for license information.
5+
# Code generated by Microsoft (R) Python Code Generator.
6+
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
7+
# --------------------------------------------------------------------------
8+
9+
from copy import deepcopy
10+
from typing import Any
11+
12+
from azure.core import PipelineClient
13+
from azure.core.rest import HttpRequest, HttpResponse
14+
15+
from ._configuration import ContosoClientConfiguration
16+
from ._operations import ContosoClientOperationsMixin
17+
from ._serialization import Deserializer, Serializer
18+
19+
20+
class ContosoClient(ContosoClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword
21+
"""ContosoClient.
22+
23+
:keyword endpoint: Service host. Required.
24+
:paramtype endpoint: str
25+
:keyword api_version: The API version to use for this operation. Default value is
26+
"2022-11-01-preview". Note that overriding this default value may result in unsupported
27+
behavior.
28+
:paramtype api_version: str
29+
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
30+
Retry-After header is present.
31+
"""
32+
33+
def __init__( # pylint: disable=missing-client-constructor-parameter-credential
34+
self, *, endpoint: str, **kwargs: Any
35+
) -> None:
36+
self._config = ContosoClientConfiguration(**kwargs)
37+
self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs)
38+
39+
self._serialize = Serializer()
40+
self._deserialize = Deserializer()
41+
self._serialize.client_side_validation = False
42+
43+
def send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
44+
"""Runs the network request through the client's chained policies.
45+
46+
>>> from azure.core.rest import HttpRequest
47+
>>> request = HttpRequest("GET", "https://www.example.org/")
48+
<HttpRequest [GET], url: 'https://www.example.org/'>
49+
>>> response = client.send_request(request)
50+
<HttpResponse: 200 OK>
51+
52+
For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request
53+
54+
:param request: The network request you want to make. Required.
55+
:type request: ~azure.core.rest.HttpRequest
56+
:keyword bool stream: Whether the response payload will be streamed. Defaults to False.
57+
:return: The response of your network call. Does not do error handling on your response.
58+
:rtype: ~azure.core.rest.HttpResponse
59+
"""
60+
61+
request_copy = deepcopy(request)
62+
request_copy.url = self._client.format_url(request_copy.url)
63+
return self._client.send_request(request_copy, **kwargs)
64+
65+
def close(self) -> None:
66+
self._client.close()
67+
68+
def __enter__(self) -> "ContosoClient":
69+
self._client.__enter__()
70+
return self
71+
72+
def __exit__(self, *exc_details) -> None:
73+
self._client.__exit__(*exc_details)
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# coding=utf-8
2+
# --------------------------------------------------------------------------
3+
# Copyright (c) Microsoft Corporation. All rights reserved.
4+
# Licensed under the MIT License. See License.txt in the project root for license information.
5+
# Code generated by Microsoft (R) Python Code Generator.
6+
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
7+
# --------------------------------------------------------------------------
8+
9+
import sys
10+
from typing import Any
11+
12+
from azure.core.configuration import Configuration
13+
from azure.core.pipeline import policies
14+
15+
from ._version import VERSION
16+
17+
if sys.version_info >= (3, 8):
18+
from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports
19+
else:
20+
from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports
21+
22+
23+
class ContosoClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
24+
"""Configuration for ContosoClient.
25+
26+
Note that all parameters used to create this instance are saved as instance
27+
attributes.
28+
29+
:keyword api_version: The API version to use for this operation. Default value is
30+
"2022-11-01-preview". Note that overriding this default value may result in unsupported
31+
behavior.
32+
:paramtype api_version: str
33+
"""
34+
35+
def __init__(self, **kwargs: Any) -> None:
36+
super(ContosoClientConfiguration, self).__init__(**kwargs)
37+
api_version: Literal["2022-11-01-preview"] = kwargs.pop("api_version", "2022-11-01-preview")
38+
39+
self.api_version = api_version
40+
kwargs.setdefault("sdk_moniker", "template-contoso/{}".format(VERSION))
41+
self._configure(**kwargs)
42+
43+
def _configure(self, **kwargs: Any) -> None:
44+
self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs)
45+
self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs)
46+
self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs)
47+
self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs)
48+
self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs)
49+
self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs)
50+
self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs)
51+
self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs)
52+
self.authentication_policy = kwargs.get("authentication_policy")

0 commit comments

Comments
 (0)