Skip to content

Commit 2a1d728

Browse files
[AutoRelease] t2-imagebuilder-2022-11-28-46274(can only be merged by SDK owner) (Azure#27697)
* code and test * Update CHANGELOG.md * Update _version.py Co-authored-by: PythonSdkPipelines <PythonSdkPipelines> Co-authored-by: zhenbiao wei <[email protected]>
1 parent 2169171 commit 2a1d728

Some content is hidden

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

43 files changed

+5153
-2022
lines changed

sdk/compute/azure-mgmt-imagebuilder/CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# Release History
22

3+
## 1.2.0b1 (2022-11-28)
4+
5+
### Other Changes
6+
7+
- Added generated samples in github repo
8+
- Drop support for python<3.7.0
9+
310
## 1.1.0 (2022-06-07)
411

512
**Features**

sdk/compute/azure-mgmt-imagebuilder/MANIFEST.in

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
include _meta.json
2-
recursive-include tests *.py *.yaml
2+
recursive-include tests *.py *.json
3+
recursive-include samples *.py *.md
34
include *.md
45
include azure/__init__.py
56
include azure/mgmt/__init__.py

sdk/compute/azure-mgmt-imagebuilder/README.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Microsoft Azure SDK for Python
22

33
This is the Microsoft Azure Image Builder Client Library.
4-
This package has been tested with Python 3.6+.
4+
This package has been tested with Python 3.7+.
55
For a more complete view of Azure libraries, see the [azure sdk python release](https://aka.ms/azsdk/python/all).
66

77
## _Disclaimer_
@@ -12,8 +12,6 @@ _Azure SDK Python packages support for Python 2.7 has ended 01 January 2022. For
1212

1313

1414
To learn how to use this package, see the [quickstart guide](https://aka.ms/azsdk/python/mgmt)
15-
16-
1715

1816
For docs and references, see [Python SDK References](https://docs.microsoft.com/python/api/overview/azure/)
1917
Code samples for this package can be found at [Image Builder](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com.
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
2-
"autorest": "3.7.2",
2+
"commit": "1fefe3f5cee88319b17c08a2dbf95e1e983a9f8c",
3+
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
4+
"autorest": "3.9.2",
35
"use": [
4-
"@autorest/python@5.13.0",
5-
"@autorest/modelerfour@4.19.3"
6+
"@autorest/python@6.2.7",
7+
"@autorest/modelerfour@4.24.3"
68
],
7-
"commit": "725f4ca360426a32d20e81eb945065e62c285d6a",
8-
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
9-
"autorest_command": "autorest specification/imagebuilder/resource-manager/readme.md --multiapi --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --python3-only --use=@autorest/[email protected] --use=@autorest/[email protected] --version=3.7.2",
9+
"autorest_command": "autorest specification/imagebuilder/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/[email protected] --use=@autorest/[email protected] --version=3.9.2 --version-tolerant=False",
1010
"readme": "specification/imagebuilder/resource-manager/readme.md"
1111
}

sdk/compute/azure-mgmt-imagebuilder/azure/mgmt/imagebuilder/__init__.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,17 @@
1010
from ._version import VERSION
1111

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

15-
# `._patch.py` is used for handwritten extensions to the generated code
16-
# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md
17-
from ._patch import patch_sdk
18-
patch_sdk()
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+
"ImageBuilderClient",
23+
]
24+
__all__.extend([p for p in _patch_all if p not in __all__])
25+
26+
_patch_sdk()

sdk/compute/azure-mgmt-imagebuilder/azure/mgmt/imagebuilder/_configuration.py

Lines changed: 25 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
77
# --------------------------------------------------------------------------
88

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

1112
from azure.core.configuration import Configuration
@@ -14,6 +15,11 @@
1415

1516
from ._version import VERSION
1617

18+
if sys.version_info >= (3, 8):
19+
from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports
20+
else:
21+
from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports
22+
1723
if TYPE_CHECKING:
1824
# pylint: disable=unused-import,ungrouped-imports
1925
from azure.core.credentials import TokenCredential
@@ -25,24 +31,19 @@ class ImageBuilderClientConfiguration(Configuration): # pylint: disable=too-man
2531
Note that all parameters used to create this instance are saved as instance
2632
attributes.
2733
28-
:param credential: Credential needed for the client to connect to Azure.
34+
:param credential: Credential needed for the client to connect to Azure. Required.
2935
:type credential: ~azure.core.credentials.TokenCredential
3036
:param subscription_id: Subscription credentials which uniquely identify Microsoft Azure
31-
subscription. The subscription Id forms part of the URI for every service call.
37+
subscription. The subscription Id forms part of the URI for every service call. Required.
3238
:type subscription_id: str
3339
:keyword api_version: Api Version. Default value is "2022-02-14". Note that overriding this
3440
default value may result in unsupported behavior.
3541
:paramtype api_version: str
3642
"""
3743

38-
def __init__(
39-
self,
40-
credential: "TokenCredential",
41-
subscription_id: str,
42-
**kwargs: Any
43-
) -> None:
44+
def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None:
4445
super(ImageBuilderClientConfiguration, self).__init__(**kwargs)
45-
api_version = kwargs.pop('api_version', "2022-02-14") # type: str
46+
api_version: Literal["2022-02-14"] = kwargs.pop("api_version", "2022-02-14")
4647

4748
if credential is None:
4849
raise ValueError("Parameter 'credential' must not be None.")
@@ -52,23 +53,21 @@ def __init__(
5253
self.credential = credential
5354
self.subscription_id = subscription_id
5455
self.api_version = api_version
55-
self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default'])
56-
kwargs.setdefault('sdk_moniker', 'mgmt-imagebuilder/{}'.format(VERSION))
56+
self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"])
57+
kwargs.setdefault("sdk_moniker", "mgmt-imagebuilder/{}".format(VERSION))
5758
self._configure(**kwargs)
5859

59-
def _configure(
60-
self,
61-
**kwargs # type: Any
62-
):
63-
# type: (...) -> None
64-
self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs)
65-
self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs)
66-
self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs)
67-
self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs)
68-
self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs)
69-
self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs)
70-
self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs)
71-
self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs)
72-
self.authentication_policy = kwargs.get('authentication_policy')
60+
def _configure(self, **kwargs: Any) -> None:
61+
self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs)
62+
self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs)
63+
self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs)
64+
self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs)
65+
self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs)
66+
self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs)
67+
self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs)
68+
self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs)
69+
self.authentication_policy = kwargs.get("authentication_policy")
7370
if self.credential and not self.authentication_policy:
74-
self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)
71+
self.authentication_policy = ARMChallengeAuthenticationPolicy(
72+
self.credential, *self.credential_scopes, **kwargs
73+
)

sdk/compute/azure-mgmt-imagebuilder/azure/mgmt/imagebuilder/_image_builder_client.py

Lines changed: 15 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -9,31 +9,31 @@
99
from copy import deepcopy
1010
from typing import Any, TYPE_CHECKING
1111

12-
from msrest import Deserializer, Serializer
13-
1412
from azure.core.rest import HttpRequest, HttpResponse
1513
from azure.mgmt.core import ARMPipelineClient
1614

17-
from . import models
15+
from . import models as _models
1816
from ._configuration import ImageBuilderClientConfiguration
17+
from ._serialization import Deserializer, Serializer
1918
from .operations import Operations, VirtualMachineImageTemplatesOperations
2019

2120
if TYPE_CHECKING:
2221
# pylint: disable=unused-import,ungrouped-imports
2322
from azure.core.credentials import TokenCredential
2423

25-
class ImageBuilderClient:
24+
25+
class ImageBuilderClient: # pylint: disable=client-accepts-api-version-keyword
2626
"""Azure Virtual Machine Image Builder Client.
2727
2828
:ivar virtual_machine_image_templates: VirtualMachineImageTemplatesOperations operations
2929
:vartype virtual_machine_image_templates:
3030
azure.mgmt.imagebuilder.operations.VirtualMachineImageTemplatesOperations
3131
:ivar operations: Operations operations
3232
:vartype operations: azure.mgmt.imagebuilder.operations.Operations
33-
:param credential: Credential needed for the client to connect to Azure.
33+
:param credential: Credential needed for the client to connect to Azure. Required.
3434
:type credential: ~azure.core.credentials.TokenCredential
3535
:param subscription_id: Subscription credentials which uniquely identify Microsoft Azure
36-
subscription. The subscription Id forms part of the URI for every service call.
36+
subscription. The subscription Id forms part of the URI for every service call. Required.
3737
:type subscription_id: str
3838
:param base_url: Service URL. Default value is "https://management.azure.com".
3939
:type base_url: str
@@ -54,19 +54,16 @@ def __init__(
5454
self._config = ImageBuilderClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs)
5555
self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
5656

57-
client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
57+
client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)}
5858
self._serialize = Serializer(client_models)
5959
self._deserialize = Deserializer(client_models)
6060
self._serialize.client_side_validation = False
61-
self.virtual_machine_image_templates = VirtualMachineImageTemplatesOperations(self._client, self._config, self._serialize, self._deserialize)
61+
self.virtual_machine_image_templates = VirtualMachineImageTemplatesOperations(
62+
self._client, self._config, self._serialize, self._deserialize
63+
)
6264
self.operations = Operations(self._client, self._config, self._serialize, self._deserialize)
6365

64-
65-
def _send_request(
66-
self,
67-
request: HttpRequest,
68-
**kwargs: Any
69-
) -> HttpResponse:
66+
def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
7067
"""Runs the network request through the client's chained policies.
7168
7269
>>> from azure.core.rest import HttpRequest
@@ -75,7 +72,7 @@ def _send_request(
7572
>>> response = client._send_request(request)
7673
<HttpResponse: 200 OK>
7774
78-
For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart
75+
For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request
7976
8077
:param request: The network request you want to make. Required.
8178
:type request: ~azure.core.rest.HttpRequest
@@ -88,15 +85,12 @@ def _send_request(
8885
request_copy.url = self._client.format_url(request_copy.url)
8986
return self._client.send_request(request_copy, **kwargs)
9087

91-
def close(self):
92-
# type: () -> None
88+
def close(self) -> None:
9389
self._client.close()
9490

95-
def __enter__(self):
96-
# type: () -> ImageBuilderClient
91+
def __enter__(self) -> "ImageBuilderClient":
9792
self._client.__enter__()
9893
return self
9994

100-
def __exit__(self, *exc_details):
101-
# type: (Any) -> None
95+
def __exit__(self, *exc_details) -> None:
10296
self._client.__exit__(*exc_details)

sdk/compute/azure-mgmt-imagebuilder/azure/mgmt/imagebuilder/_metadata.json

Lines changed: 0 additions & 103 deletions
This file was deleted.

sdk/compute/azure-mgmt-imagebuilder/azure/mgmt/imagebuilder/_patch.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,4 @@
2828
# This file is used for handwritten extensions to the generated code. Example:
2929
# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md
3030
def patch_sdk():
31-
pass
31+
pass

0 commit comments

Comments
 (0)