Skip to content

Commit 5649d97

Browse files
author
SDKAuto
committed
CodeGen from PR 32632 in Azure/azure-rest-api-specs
Merge d4f796ea6470118889be3d57a9fe529b96aafae2 into eb18e6dd159fe03abb1250f90a3844058a248b19
1 parent 063ad13 commit 5649d97

File tree

886 files changed

+19095
-11384
lines changed

Some content is hidden

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

886 files changed

+19095
-11384
lines changed

sdk/resources/azure-mgmt-resource/_meta.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
{
2-
"commit": "34424077cae09522361ea641761dc37941603383",
2+
"commit": "4887134a2d7234f6ee5f901bb3fe473b72f4ad40",
33
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
44
"autorest": "3.10.2",
55
"use": [
6-
"@autorest/python@6.19.0",
6+
"@autorest/python@6.27.4",
77
"@autorest/[email protected]"
88
],
9-
"autorest_command": "autorest specification/resources/resource-manager/readme.md --generate-sample=True --generate-test=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.19.0 --use=@autorest/[email protected] --version=3.10.2 --version-tolerant=False",
9+
"autorest_command": "autorest specification/resources/resource-manager/readme.md --generate-sample=True --generate-test=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.27.4 --use=@autorest/[email protected] --version=3.10.2 --version-tolerant=False",
1010
"readme": "specification/resources/resource-manager/readme.md",
1111
"package-privatelinks-2020-05": "2022-03-18 16:14:07 -0700 2c68b6f0c9566d97d9d590a31b0d46997622eef7 Microsoft.Authorization/stable/2020-05-01/privateLinks.json",
1212
"package-features-2021-07": "2022-03-06 17:36:42 -0800 6a57e9cedc87cafd2dc9e4f3e8af62b5725e3d22 Microsoft.Features/stable/2021-07-01/features.json",
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# coding=utf-8
2+
# --------------------------------------------------------------------------
3+
# Copyright (c) Microsoft Corporation. All rights reserved.
4+
# Licensed under the MIT License. See License.txt in the project root for license information.
5+
# Code generated by Microsoft (R) AutoRest Code Generator.
6+
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
7+
# --------------------------------------------------------------------------
8+
9+
from ._bicep_client import BicepClient
10+
__all__ = ['BicepClient']
11+
12+
try:
13+
from ._patch import patch_sdk # type: ignore
14+
patch_sdk()
15+
except ImportError:
16+
pass
17+
18+
from ._version import VERSION
19+
20+
__version__ = VERSION
Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
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
5+
# license information.
6+
#
7+
# Code generated by Microsoft (R) AutoRest Code Generator.
8+
# Changes may cause incorrect behavior and will be lost if the code is
9+
# regenerated.
10+
# --------------------------------------------------------------------------
11+
12+
from typing import Any, Optional, TYPE_CHECKING
13+
from typing_extensions import Self
14+
15+
from azure.core.pipeline import policies
16+
from azure.mgmt.core import ARMPipelineClient
17+
from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy
18+
from azure.profiles import KnownProfiles, ProfileDefinition
19+
from azure.profiles.multiapiclient import MultiApiClientMixin
20+
21+
from ._configuration import BicepClientConfiguration
22+
from ._serialization import Deserializer, Serializer
23+
24+
if TYPE_CHECKING:
25+
# pylint: disable=unused-import,ungrouped-imports
26+
from azure.core.credentials import TokenCredential
27+
28+
class _SDKClient(object):
29+
def __init__(self, *args, **kwargs):
30+
"""This is a fake class to support current implemetation of MultiApiClientMixin."
31+
Will be removed in final version of multiapi azure-core based client
32+
"""
33+
pass
34+
35+
class BicepClient(MultiApiClientMixin, _SDKClient):
36+
"""The APIs listed in this specification can be used to manage Bicep related operations through the Azure Resource Manager.
37+
38+
This ready contains multiple API versions, to help you deal with all of the Azure clouds
39+
(Azure Stack, Azure Government, Azure China, etc.).
40+
By default, it uses the latest API version available on public Azure.
41+
For production, you should stick to a particular api-version and/or profile.
42+
The profile sets a mapping between an operation group and its API version.
43+
The api-version parameter sets the default API version if the operation
44+
group is not described in the profile.
45+
46+
:param credential: Credential needed for the client to connect to Azure. Required.
47+
:type credential: ~azure.core.credentials.TokenCredential
48+
:param subscription_id: The ID of the target subscription. The value must be an UUID. Required.
49+
:type subscription_id: str
50+
:param api_version: API version to use if no profile is provided, or if missing in profile.
51+
:type api_version: str
52+
:param base_url: Service URL
53+
:type base_url: str
54+
:param profile: A profile definition, from KnownProfiles to dict.
55+
:type profile: azure.profiles.KnownProfiles
56+
"""
57+
58+
DEFAULT_API_VERSION = '2023-11-01'
59+
_PROFILE_TAG = "azure.mgmt.resource.bicep.BicepClient"
60+
LATEST_PROFILE = ProfileDefinition({
61+
_PROFILE_TAG: {
62+
None: DEFAULT_API_VERSION,
63+
}},
64+
_PROFILE_TAG + " latest"
65+
)
66+
67+
def __init__(
68+
self,
69+
credential: "TokenCredential",
70+
subscription_id: str,
71+
api_version: Optional[str]=None,
72+
base_url: str = "https://management.azure.com",
73+
profile: KnownProfiles=KnownProfiles.default,
74+
**kwargs: Any
75+
):
76+
if api_version:
77+
kwargs.setdefault('api_version', api_version)
78+
self._config = BicepClientConfiguration(credential, subscription_id, **kwargs)
79+
_policies = kwargs.pop("policies", None)
80+
if _policies is None:
81+
_policies = [
82+
policies.RequestIdPolicy(**kwargs),
83+
self._config.headers_policy,
84+
self._config.user_agent_policy,
85+
self._config.proxy_policy,
86+
policies.ContentDecodePolicy(**kwargs),
87+
ARMAutoResourceProviderRegistrationPolicy(),
88+
self._config.redirect_policy,
89+
self._config.retry_policy,
90+
self._config.authentication_policy,
91+
self._config.custom_hook_policy,
92+
self._config.logging_policy,
93+
policies.DistributedTracingPolicy(**kwargs),
94+
policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None,
95+
self._config.http_logging_policy,
96+
]
97+
self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs)
98+
super(BicepClient, self).__init__(
99+
api_version=api_version,
100+
profile=profile
101+
)
102+
103+
@classmethod
104+
def _models_dict(cls, api_version):
105+
return {k: v for k, v in cls.models(api_version).__dict__.items() if isinstance(v, type)}
106+
107+
@classmethod
108+
def models(cls, api_version=DEFAULT_API_VERSION):
109+
"""Module depends on the API version:
110+
111+
* 2023-11-01: :mod:`v2023_11_01.models<azure.mgmt.resource.bicep.v2023_11_01.models>`
112+
"""
113+
if api_version == '2023-11-01':
114+
from .v2023_11_01 import models
115+
return models
116+
raise ValueError("API version {} is not available".format(api_version))
117+
118+
@property
119+
def decompile(self):
120+
"""Instance depends on the API version:
121+
122+
* 2023-11-01: :class:`DecompileOperations<azure.mgmt.resource.bicep.v2023_11_01.operations.DecompileOperations>`
123+
"""
124+
api_version = self._get_api_version('decompile')
125+
if api_version == '2023-11-01':
126+
from .v2023_11_01.operations import DecompileOperations as OperationClass
127+
else:
128+
raise ValueError("API version {} does not have operation group 'decompile'".format(api_version))
129+
self._config.api_version = api_version
130+
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version)
131+
132+
def close(self):
133+
self._client.close()
134+
def __enter__(self):
135+
self._client.__enter__()
136+
return self
137+
def __exit__(self, *exc_details):
138+
self._client.__exit__(*exc_details)
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
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
5+
# license information.
6+
#
7+
# Code generated by Microsoft (R) AutoRest Code Generator.
8+
# Changes may cause incorrect behavior and will be lost if the code is
9+
# regenerated.
10+
# --------------------------------------------------------------------------
11+
from typing import Any, TYPE_CHECKING
12+
13+
from azure.core.pipeline import policies
14+
from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy
15+
16+
from ._version import VERSION
17+
18+
if TYPE_CHECKING:
19+
# pylint: disable=unused-import,ungrouped-imports
20+
from azure.core.credentials import TokenCredential
21+
22+
class BicepClientConfiguration:
23+
"""Configuration for BicepClient.
24+
25+
Note that all parameters used to create this instance are saved as instance
26+
attributes.
27+
28+
:param credential: Credential needed for the client to connect to Azure. Required.
29+
:type credential: ~azure.core.credentials.TokenCredential
30+
:param subscription_id: The ID of the target subscription. The value must be an UUID. Required.
31+
:type subscription_id: str
32+
"""
33+
34+
def __init__(
35+
self,
36+
credential: "TokenCredential",
37+
subscription_id: str,
38+
**kwargs: Any
39+
):
40+
if credential is None:
41+
raise ValueError("Parameter 'credential' must not be None.")
42+
if subscription_id is None:
43+
raise ValueError("Parameter 'subscription_id' must not be None.")
44+
45+
self.credential = credential
46+
self.subscription_id = subscription_id
47+
self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default'])
48+
kwargs.setdefault('sdk_moniker', 'azure-mgmt-resource/{}'.format(VERSION))
49+
self.polling_interval = kwargs.get("polling_interval", 30)
50+
self._configure(**kwargs)
51+
52+
def _configure(
53+
self,
54+
**kwargs: Any
55+
):
56+
self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs)
57+
self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs)
58+
self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs)
59+
self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs)
60+
self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs)
61+
self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs)
62+
self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs)
63+
self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs)
64+
self.authentication_policy = kwargs.get('authentication_policy')
65+
if self.credential and not self.authentication_policy:
66+
self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)

0 commit comments

Comments
 (0)