Skip to content

Commit

Permalink
{Account} Bump up azure-mgmt-subscription SDK version to 3.1.1 (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
Jing-song authored Sep 28, 2022
1 parent e9f5bdf commit c270f9c
Show file tree
Hide file tree
Showing 38 changed files with 4,699 additions and 2,191 deletions.
5 changes: 5 additions & 0 deletions src/account/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
Release History
===============

0.2.5
+++++
* Update SDK `azure-mgmt-subscription` version to 3.1.1
* Add new command `az account accept-ownership-status` to support accept subscription ownership status

0.2.4
+++++
* Update `minCliCoreVersion` requirement from `2.3.1` to `2.38.0`.
Expand Down
4 changes: 4 additions & 0 deletions src/account/azext_account/manual/_client_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,7 @@ def cf_subscriptions(cli_ctx, *_):

def cf_tenants(cli_ctx, *_):
return cf_account(cli_ctx).tenants


def cf_subscription(cli_ctx, *_):
return cf_account(cli_ctx).subscription
7 changes: 7 additions & 0 deletions src/account/azext_account/manual/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,10 @@ def load_command_table(self, _):
client_factory=cf_tenants)
with self.command_group('account tenant', account_tenants, client_factory=cf_tenants, is_experimental=True) as g:
g.custom_command('list', 'account_tenant_list')

from azext_account.manual._client_factory import cf_subscription
account_subscription = CliCommandType(
operations_tmpl='azext_account.vendored_sdks.subscription.operations._subscription_operations#SubscriptionOperations.{}',
client_factory=cf_subscription)
with self.command_group('account', account_subscription, client_factory=cf_subscription) as g:
g.command('accept-ownership-status', 'accept_ownership_status')
16 changes: 11 additions & 5 deletions src/account/azext_account/vendored_sdks/subscription/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,15 @@
from ._version import VERSION

__version__ = VERSION
__all__ = ['SubscriptionClient']

# `._patch.py` is used for handwritten extensions to the generated code
# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md
from ._patch import patch_sdk
patch_sdk()
try:
from ._patch import __all__ as _patch_all
from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import
except ImportError:
_patch_all = []
from ._patch import patch_sdk as _patch_sdk

__all__ = ["SubscriptionClient"]
__all__.extend([p for p in _patch_all if p not in __all__])

_patch_sdk()
Original file line number Diff line number Diff line change
Expand Up @@ -19,43 +19,41 @@
from azure.core.credentials import TokenCredential


class SubscriptionClientConfiguration(Configuration):
class SubscriptionClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
"""Configuration for SubscriptionClient.
Note that all parameters used to create this instance are saved as instance
attributes.
:param credential: Credential needed for the client to connect to Azure.
:param credential: Credential needed for the client to connect to Azure. Required.
:type credential: ~azure.core.credentials.TokenCredential
"""

def __init__(
self,
credential: "TokenCredential",
**kwargs: Any
) -> None:
def __init__(self, credential: "TokenCredential", **kwargs: Any) -> None:
super(SubscriptionClientConfiguration, self).__init__(**kwargs)
if credential is None:
raise ValueError("Parameter 'credential' must not be None.")

self.api_version = "2021-10-01"
self.credential = credential
self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default'])
kwargs.setdefault('sdk_moniker', 'mgmt-subscription/{}'.format(VERSION))
self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"])
kwargs.setdefault("sdk_moniker", "mgmt-subscription/{}".format(VERSION))
self._configure(**kwargs)

def _configure(
self,
**kwargs # type: Any
self, **kwargs # type: Any
):
# type: (...) -> None
self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs)
self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs)
self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs)
self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs)
self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs)
self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs)
self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs)
self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs)
self.authentication_policy = kwargs.get('authentication_policy')
self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs)
self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs)
self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs)
self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs)
self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs)
self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs)
self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs)
self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs)
self.authentication_policy = kwargs.get("authentication_policy")
if self.credential and not self.authentication_policy:
self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)
self.authentication_policy = ARMChallengeAuthenticationPolicy(
self.credential, *self.credential_scopes, **kwargs
)
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@
# This file is used for handwritten extensions to the generated code. Example:
# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md
def patch_sdk():
pass
pass
Loading

0 comments on commit c270f9c

Please sign in to comment.