Skip to content

Commit 0222d90

Browse files
author
SDKAuto
committed
CodeGen from PR 16847 in Azure/azure-rest-api-specs
Merge 00eb338b0fb5d1e0e07a3e1fff50f1f7137a36d8 into 47b551f
1 parent fe37155 commit 0222d90

23 files changed

+743
-504
lines changed

sdk/automanage/azure-mgmt-automanage/MANIFEST.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
include _meta.json
12
recursive-include tests *.py *.yaml
23
include *.md
34
include azure/__init__.py
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"autorest": "3.4.5",
3+
"use": [
4+
"@autorest/[email protected]",
5+
"@autorest/[email protected]"
6+
],
7+
"commit": "342d36417c0c2c4aff9227ad1925f971966a9181",
8+
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
9+
"autorest_command": "autorest specification/automanage/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --track2 --use=@autorest/[email protected] --use=@autorest/[email protected] --version=3.4.5",
10+
"readme": "specification/automanage/resource-manager/readme.md"
11+
}

sdk/automanage/azure-mgmt-automanage/azure/mgmt/automanage/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
__all__ = ['AutomanageClient']
1414

1515
try:
16-
from ._patch import patch_sdk
16+
from ._patch import patch_sdk # type: ignore
1717
patch_sdk()
1818
except ImportError:
1919
pass

sdk/automanage/azure-mgmt-automanage/azure/mgmt/automanage/_automanage_client.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
from typing import Any, Optional
1717

1818
from azure.core.credentials import TokenCredential
19+
from azure.core.pipeline.transport import HttpRequest, HttpResponse
1920

2021
from ._configuration import AutomanageClientConfiguration
2122
from .operations import AccountsOperations
@@ -59,6 +60,7 @@ def __init__(
5960

6061
client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
6162
self._serialize = Serializer(client_models)
63+
self._serialize.client_side_validation = False
6264
self._deserialize = Deserializer(client_models)
6365

6466
self.accounts = AccountsOperations(
@@ -70,6 +72,24 @@ def __init__(
7072
self.operations = Operations(
7173
self._client, self._config, self._serialize, self._deserialize)
7274

75+
def _send_request(self, http_request, **kwargs):
76+
# type: (HttpRequest, Any) -> HttpResponse
77+
"""Runs the network request through the client's chained policies.
78+
79+
:param http_request: The network request you want to make. Required.
80+
:type http_request: ~azure.core.pipeline.transport.HttpRequest
81+
:keyword bool stream: Whether the response payload will be streamed. Defaults to True.
82+
:return: The response of your network call. Does not do error handling on your response.
83+
:rtype: ~azure.core.pipeline.transport.HttpResponse
84+
"""
85+
path_format_arguments = {
86+
'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1),
87+
}
88+
http_request.url = self._client.format_url(http_request.url, **path_format_arguments)
89+
stream = kwargs.pop("stream", True)
90+
pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs)
91+
return pipeline_response.http_response
92+
7393
def close(self):
7494
# type: () -> None
7595
self._client.close()

sdk/automanage/azure-mgmt-automanage/azure/mgmt/automanage/_configuration.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
from azure.core.configuration import Configuration
1212
from azure.core.pipeline import policies
13+
from azure.mgmt.core.policies import ARMHttpLoggingPolicy
1314

1415
from ._version import VERSION
1516

@@ -48,8 +49,7 @@ def __init__(
4849
self.credential = credential
4950
self.subscription_id = subscription_id
5051
self.api_version = "2020-06-30-preview"
51-
self.credential_scopes = ['https://management.azure.com/.default']
52-
self.credential_scopes.extend(kwargs.pop('credential_scopes', []))
52+
self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default'])
5353
kwargs.setdefault('sdk_moniker', 'mgmt-automanage/{}'.format(VERSION))
5454
self._configure(**kwargs)
5555

@@ -62,6 +62,7 @@ def _configure(
6262
self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs)
6363
self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs)
6464
self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs)
65+
self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs)
6566
self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs)
6667
self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs)
6768
self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs)

sdk/automanage/azure-mgmt-automanage/azure/mgmt/automanage/_metadata.json

Lines changed: 64 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,53 +4,103 @@
44
"client": {
55
"name": "AutomanageClient",
66
"filename": "_automanage_client",
7-
"description": "Automanage Client."
7+
"description": "Automanage Client.",
8+
"base_url": "\u0027https://management.azure.com\u0027",
9+
"custom_base_url": null,
10+
"azure_arm": true,
11+
"has_lro_operations": true,
12+
"client_side_validation": false,
13+
"sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"AutomanageClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}",
14+
"async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"AutomanageClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}"
815
},
916
"global_parameters": {
10-
"sync_method": {
17+
"sync": {
1118
"credential": {
12-
"method_signature": "credential, # type: \"TokenCredential\"",
19+
"signature": "credential, # type: \"TokenCredential\"",
1320
"description": "Credential needed for the client to connect to Azure.",
1421
"docstring_type": "~azure.core.credentials.TokenCredential",
1522
"required": true
1623
},
1724
"subscription_id": {
18-
"method_signature": "subscription_id, # type: str",
25+
"signature": "subscription_id, # type: str",
1926
"description": "The ID of the target subscription.",
2027
"docstring_type": "str",
2128
"required": true
2229
}
2330
},
24-
"async_method": {
31+
"async": {
2532
"credential": {
26-
"method_signature": "credential, # type: \"AsyncTokenCredential\"",
33+
"signature": "credential: \"AsyncTokenCredential\",",
2734
"description": "Credential needed for the client to connect to Azure.",
2835
"docstring_type": "~azure.core.credentials_async.AsyncTokenCredential",
2936
"required": true
3037
},
3138
"subscription_id": {
32-
"method_signature": "subscription_id, # type: str",
39+
"signature": "subscription_id: str,",
3340
"description": "The ID of the target subscription.",
3441
"docstring_type": "str",
3542
"required": true
3643
}
3744
},
3845
"constant": {
3946
},
40-
"call": "credential, subscription_id"
47+
"call": "credential, subscription_id",
48+
"service_client_specific": {
49+
"sync": {
50+
"api_version": {
51+
"signature": "api_version=None, # type: Optional[str]",
52+
"description": "API version to use if no profile is provided, or if missing in profile.",
53+
"docstring_type": "str",
54+
"required": false
55+
},
56+
"base_url": {
57+
"signature": "base_url=None, # type: Optional[str]",
58+
"description": "Service URL",
59+
"docstring_type": "str",
60+
"required": false
61+
},
62+
"profile": {
63+
"signature": "profile=KnownProfiles.default, # type: KnownProfiles",
64+
"description": "A profile definition, from KnownProfiles to dict.",
65+
"docstring_type": "azure.profiles.KnownProfiles",
66+
"required": false
67+
}
68+
},
69+
"async": {
70+
"api_version": {
71+
"signature": "api_version: Optional[str] = None,",
72+
"description": "API version to use if no profile is provided, or if missing in profile.",
73+
"docstring_type": "str",
74+
"required": false
75+
},
76+
"base_url": {
77+
"signature": "base_url: Optional[str] = None,",
78+
"description": "Service URL",
79+
"docstring_type": "str",
80+
"required": false
81+
},
82+
"profile": {
83+
"signature": "profile: KnownProfiles = KnownProfiles.default,",
84+
"description": "A profile definition, from KnownProfiles to dict.",
85+
"docstring_type": "azure.profiles.KnownProfiles",
86+
"required": false
87+
}
88+
}
89+
}
4190
},
4291
"config": {
4392
"credential": true,
44-
"credential_scopes": ["https://management.azure.com/.default"]
93+
"credential_scopes": ["https://management.azure.com/.default"],
94+
"credential_default_policy_type": "BearerTokenCredentialPolicy",
95+
"credential_default_policy_type_has_async_version": true,
96+
"credential_key_header_name": null,
97+
"sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}",
98+
"async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}"
4599
},
46100
"operation_groups": {
47101
"accounts": "AccountsOperations",
48102
"configuration_profile_assignments": "ConfigurationProfileAssignmentsOperations",
49103
"configuration_profile_preferences": "ConfigurationProfilePreferencesOperations",
50104
"operations": "Operations"
51-
},
52-
"operation_mixins": {
53-
},
54-
"sync_imports": "None",
55-
"async_imports": "None"
105+
}
56106
}

sdk/automanage/azure-mgmt-automanage/azure/mgmt/automanage/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@
66
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
77
# --------------------------------------------------------------------------
88

9-
VERSION = "1.0.0b2"
9+
VERSION = "0.1.0-preview"

sdk/automanage/azure-mgmt-automanage/azure/mgmt/automanage/aio/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@
66
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
77
# --------------------------------------------------------------------------
88

9-
from ._automanage_client_async import AutomanageClient
9+
from ._automanage_client import AutomanageClient
1010
__all__ = ['AutomanageClient']
Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,32 +8,33 @@
88

99
from typing import Any, Optional, TYPE_CHECKING
1010

11+
from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest
1112
from azure.mgmt.core import AsyncARMPipelineClient
1213
from msrest import Deserializer, Serializer
1314

1415
if TYPE_CHECKING:
1516
# pylint: disable=unused-import,ungrouped-imports
1617
from azure.core.credentials_async import AsyncTokenCredential
1718

18-
from ._configuration_async import AutomanageClientConfiguration
19-
from .operations_async import AccountsOperations
20-
from .operations_async import ConfigurationProfileAssignmentsOperations
21-
from .operations_async import ConfigurationProfilePreferencesOperations
22-
from .operations_async import Operations
19+
from ._configuration import AutomanageClientConfiguration
20+
from .operations import AccountsOperations
21+
from .operations import ConfigurationProfileAssignmentsOperations
22+
from .operations import ConfigurationProfilePreferencesOperations
23+
from .operations import Operations
2324
from .. import models
2425

2526

2627
class AutomanageClient(object):
2728
"""Automanage Client.
2829
2930
:ivar accounts: AccountsOperations operations
30-
:vartype accounts: automanage_client.aio.operations_async.AccountsOperations
31+
:vartype accounts: automanage_client.aio.operations.AccountsOperations
3132
:ivar configuration_profile_assignments: ConfigurationProfileAssignmentsOperations operations
32-
:vartype configuration_profile_assignments: automanage_client.aio.operations_async.ConfigurationProfileAssignmentsOperations
33+
:vartype configuration_profile_assignments: automanage_client.aio.operations.ConfigurationProfileAssignmentsOperations
3334
:ivar configuration_profile_preferences: ConfigurationProfilePreferencesOperations operations
34-
:vartype configuration_profile_preferences: automanage_client.aio.operations_async.ConfigurationProfilePreferencesOperations
35+
:vartype configuration_profile_preferences: automanage_client.aio.operations.ConfigurationProfilePreferencesOperations
3536
:ivar operations: Operations operations
36-
:vartype operations: automanage_client.aio.operations_async.Operations
37+
:vartype operations: automanage_client.aio.operations.Operations
3738
:param credential: Credential needed for the client to connect to Azure.
3839
:type credential: ~azure.core.credentials_async.AsyncTokenCredential
3940
:param subscription_id: The ID of the target subscription.
@@ -56,6 +57,7 @@ def __init__(
5657

5758
client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
5859
self._serialize = Serializer(client_models)
60+
self._serialize.client_side_validation = False
5961
self._deserialize = Deserializer(client_models)
6062

6163
self.accounts = AccountsOperations(
@@ -67,6 +69,23 @@ def __init__(
6769
self.operations = Operations(
6870
self._client, self._config, self._serialize, self._deserialize)
6971

72+
async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse:
73+
"""Runs the network request through the client's chained policies.
74+
75+
:param http_request: The network request you want to make. Required.
76+
:type http_request: ~azure.core.pipeline.transport.HttpRequest
77+
:keyword bool stream: Whether the response payload will be streamed. Defaults to True.
78+
:return: The response of your network call. Does not do error handling on your response.
79+
:rtype: ~azure.core.pipeline.transport.AsyncHttpResponse
80+
"""
81+
path_format_arguments = {
82+
'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1),
83+
}
84+
http_request.url = self._client.format_url(http_request.url, **path_format_arguments)
85+
stream = kwargs.pop("stream", True)
86+
pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs)
87+
return pipeline_response.http_response
88+
7089
async def close(self) -> None:
7190
await self._client.close()
7291

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
from azure.core.configuration import Configuration
1212
from azure.core.pipeline import policies
13+
from azure.mgmt.core.policies import ARMHttpLoggingPolicy
1314

1415
from .._version import VERSION
1516

@@ -45,8 +46,7 @@ def __init__(
4546
self.credential = credential
4647
self.subscription_id = subscription_id
4748
self.api_version = "2020-06-30-preview"
48-
self.credential_scopes = ['https://management.azure.com/.default']
49-
self.credential_scopes.extend(kwargs.pop('credential_scopes', []))
49+
self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default'])
5050
kwargs.setdefault('sdk_moniker', 'mgmt-automanage/{}'.format(VERSION))
5151
self._configure(**kwargs)
5252

@@ -58,6 +58,7 @@ def _configure(
5858
self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs)
5959
self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs)
6060
self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs)
61+
self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs)
6162
self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs)
6263
self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs)
6364
self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs)

0 commit comments

Comments
 (0)