-
Notifications
You must be signed in to change notification settings - Fork 3.2k
update pipeline #18238
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
update pipeline #18238
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
|
|
@@ -23,12 +23,8 @@ | |||
| # IN THE SOFTWARE. | ||||
| # | ||||
| # -------------------------------------------------------------------------- | ||||
| from collections.abc import Iterable | ||||
| from azure.core import AsyncPipelineClient | ||||
| from azure.core.pipeline.policies import ( | ||||
| ContentDecodePolicy, | ||||
| DistributedTracingPolicy, | ||||
| RequestIdPolicy, | ||||
| ) | ||||
| from .policies import AsyncARMAutoResourceProviderRegistrationPolicy, ARMHttpLoggingPolicy | ||||
|
|
||||
|
|
||||
|
|
@@ -37,8 +33,14 @@ class AsyncARMPipelineClient(AsyncPipelineClient): | |||
|
|
||||
| :param str base_url: URL for the request. | ||||
| :keyword AsyncPipeline pipeline: If omitted, a Pipeline object is created and returned. | ||||
| :keyword list[HTTPPolicy] policies: If omitted, the standard policies of the configuration object is used. | ||||
| :keyword HttpTransport transport: If omitted, RequestsTransport is used for synchronous transport. | ||||
| :keyword list[AsyncHTTPPolicy] policies: If omitted, the standard policies of the configuration object is used. | ||||
| :keyword per_call_policies: If specified, the policies will be added into the policy list before RetryPolicy | ||||
| :paramtype per_call_policies: Union[AsyncHTTPPolicy, SansIOHTTPPolicy, | ||||
| list[AsyncHTTPPolicy], list[SansIOHTTPPolicy]] | ||||
| :keyword per_retry_policies: If specified, the policies will be added into the policy list after RetryPolicy | ||||
| :paramtype per_retry_policies: Union[AsyncHTTPPolicy, SansIOHTTPPolicy, | ||||
| list[AsyncHTTPPolicy], list[SansIOHTTPPolicy]] | ||||
| :keyword AsyncHttpTransport transport: If omitted, AioHttpTransport is used for asynchronous transport. | ||||
| """ | ||||
|
|
||||
| def __init__(self, base_url, **kwargs): | ||||
|
|
@@ -47,23 +49,15 @@ def __init__(self, base_url, **kwargs): | |||
| raise ValueError( | ||||
| "Current implementation requires to pass 'config' if you don't pass 'policies'" | ||||
| ) | ||||
| kwargs["policies"] = self._default_policies(**kwargs) | ||||
| per_call_policies = kwargs.get('per_call_policies', []) | ||||
| if isinstance(per_call_policies, Iterable): | ||||
| per_call_policies.append(AsyncARMAutoResourceProviderRegistrationPolicy()) | ||||
| else: | ||||
| per_call_policies = [per_call_policies, | ||||
| AsyncARMAutoResourceProviderRegistrationPolicy()] | ||||
| kwargs["per_call_policies"] = per_call_policies | ||||
| config = kwargs.get('config') | ||||
| if not config.http_logging_policy: | ||||
| config.http_logging_policy = kwargs.get('http_logging_policy', ARMHttpLoggingPolicy(**kwargs)) | ||||
|
Comment on lines
+60
to
+61
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These lines are unnecessary as the client will always have Line 59 in 28545a0
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We need it because in your test case, you use the azure.core.configure which does not honor http_logging_policy. w/o it will fail the tests. |
||||
| kwargs["config"] = config | ||||
| super(AsyncARMPipelineClient, self).__init__(base_url, **kwargs) | ||||
|
|
||||
| @staticmethod | ||||
| def _default_policies(config, **kwargs): | ||||
| return [ | ||||
| RequestIdPolicy(**kwargs), | ||||
| AsyncARMAutoResourceProviderRegistrationPolicy(), | ||||
| config.headers_policy, | ||||
| config.user_agent_policy, | ||||
| config.proxy_policy, | ||||
| ContentDecodePolicy(**kwargs), | ||||
| config.redirect_policy, | ||||
| config.retry_policy, | ||||
| config.authentication_policy, | ||||
| config.custom_hook_policy, | ||||
| config.logging_policy, | ||||
| DistributedTracingPolicy(**kwargs), | ||||
| config.http_logging_policy or ARMHttpLoggingPolicy(**kwargs), | ||||
| ] | ||||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
appendwill fail ifper_call_policiesis atuple, instead of alist: