Skip to content
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

[ReleasePR track2_azure-mgmt-commerce] remove - repo: azure-sdk-for-go-track2 config #24677

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions sdk/commerce/azure-mgmt-commerce/_meta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"autorest": "3.7.2",
"use": [
"@autorest/[email protected]",
"@autorest/[email protected]"
],
"commit": "c91c3499a3941d0bf8343850f8bac3e0b4f30aac",
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
"autorest_command": "autorest specification/commerce/resource-manager/readme.md --multiapi --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --python3-only --use=@autorest/[email protected] --use=@autorest/[email protected] --version=3.7.2",
"readme": "specification/commerce/resource-manager/readme.md"
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@
# --------------------------------------------------------------------------

from ._usage_management_client import UsageManagementClient
from ._version import VERSION

__version__ = VERSION
__all__ = ['UsageManagementClient']

try:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------

from typing import TYPE_CHECKING

from azure.core.configuration import Configuration
from azure.core.pipeline import policies
from azure.mgmt.core.policies import ARMHttpLoggingPolicy
from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy

from ._version import VERSION

Expand All @@ -20,7 +22,6 @@

from azure.core.credentials import TokenCredential


class UsageManagementClientConfiguration(Configuration):
"""Configuration for UsageManagementClient.

Expand Down Expand Up @@ -48,9 +49,8 @@ def __init__(

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

def _configure(
Expand All @@ -68,4 +68,4 @@ def _configure(
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 = policies.BearerTokenCredentialPolicy(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
@@ -1,74 +1,130 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------

from typing import TYPE_CHECKING

from azure.mgmt.core import ARMPipelineClient
from msrest import Deserializer, Serializer

from azure.mgmt.core import ARMPipelineClient
from azure.profiles import KnownProfiles, ProfileDefinition
from azure.profiles.multiapiclient import MultiApiClientMixin

from ._configuration import UsageManagementClientConfiguration

if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from typing import Any, Optional

from azure.core.credentials import TokenCredential

from ._configuration import UsageManagementClientConfiguration
from .operations import UsageAggregatesOperations
from .operations import RateCardOperations
from . import models

class _SDKClient(object):
def __init__(self, *args, **kwargs):
"""This is a fake class to support current implemetation of MultiApiClientMixin."
Will be removed in final version of multiapi azure-core based client
"""
pass

class UsageManagementClient(object):
class UsageManagementClient(MultiApiClientMixin, _SDKClient):
"""UsageManagementClient.

:ivar usage_aggregates: UsageAggregatesOperations operations
:vartype usage_aggregates: azure.mgmt.commerce.operations.UsageAggregatesOperations
:ivar rate_card: RateCardOperations operations
:vartype rate_card: azure.mgmt.commerce.operations.RateCardOperations
This ready contains multiple API versions, to help you deal with all of the Azure clouds
(Azure Stack, Azure Government, Azure China, etc.).
By default, it uses the latest API version available on public Azure.
For production, you should stick to a particular api-version and/or profile.
The profile sets a mapping between an operation group and its API version.
The api-version parameter sets the default API version if the operation
group is not described in the profile.

:param credential: Credential needed for the client to connect to Azure.
:type credential: ~azure.core.credentials.TokenCredential
:param subscription_id: It uniquely identifies Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.
:type subscription_id: str
:param str base_url: Service URL
:param api_version: API version to use if no profile is provided, or if missing in profile.
:type api_version: str
:param base_url: Service URL
:type base_url: str
:param profile: A profile definition, from KnownProfiles to dict.
:type profile: azure.profiles.KnownProfiles
"""

DEFAULT_API_VERSION = '2015-06-01-preview'
_PROFILE_TAG = "azure.mgmt.commerce.UsageManagementClient"
LATEST_PROFILE = ProfileDefinition({
_PROFILE_TAG: {
None: DEFAULT_API_VERSION,
}},
_PROFILE_TAG + " latest"
)

def __init__(
self,
credential, # type: "TokenCredential"
subscription_id, # type: str
base_url=None, # type: Optional[str]
api_version=None, # type: Optional[str]
base_url="https://management.azure.com", # type: str
profile=KnownProfiles.default, # type: KnownProfiles
**kwargs # type: Any
):
# type: (...) -> None
if not base_url:
base_url = 'https://management.azure.com'
self._config = UsageManagementClientConfiguration(credential, subscription_id, **kwargs)
self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
super(UsageManagementClient, self).__init__(
api_version=api_version,
profile=profile
)

@classmethod
def _models_dict(cls, api_version):
return {k: v for k, v in cls.models(api_version).__dict__.items() if isinstance(v, type)}

@classmethod
def models(cls, api_version=DEFAULT_API_VERSION):
"""Module depends on the API version:

* 2015-06-01-preview: :mod:`v2015_06_01_preview.models<azure.mgmt.commerce.v2015_06_01_preview.models>`
"""
if api_version == '2015-06-01-preview':
from .v2015_06_01_preview import models
return models
raise ValueError("API version {} is not available".format(api_version))

client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
self._serialize = Serializer(client_models)
self._serialize.client_side_validation = False
self._deserialize = Deserializer(client_models)
@property
def rate_card(self):
"""Instance depends on the API version:

self.usage_aggregates = UsageAggregatesOperations(
self._client, self._config, self._serialize, self._deserialize)
self.rate_card = RateCardOperations(
self._client, self._config, self._serialize, self._deserialize)
* 2015-06-01-preview: :class:`RateCardOperations<azure.mgmt.commerce.v2015_06_01_preview.operations.RateCardOperations>`
"""
api_version = self._get_api_version('rate_card')
if api_version == '2015-06-01-preview':
from .v2015_06_01_preview.operations import RateCardOperations as OperationClass
else:
raise ValueError("API version {} does not have operation group 'rate_card'".format(api_version))
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))

@property
def usage_aggregates(self):
"""Instance depends on the API version:

* 2015-06-01-preview: :class:`UsageAggregatesOperations<azure.mgmt.commerce.v2015_06_01_preview.operations.UsageAggregatesOperations>`
"""
api_version = self._get_api_version('usage_aggregates')
if api_version == '2015-06-01-preview':
from .v2015_06_01_preview.operations import UsageAggregatesOperations as OperationClass
else:
raise ValueError("API version {} does not have operation group 'usage_aggregates'".format(api_version))
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))

def close(self):
# type: () -> None
self._client.close()

def __enter__(self):
# type: () -> UsageManagementClient
self._client.__enter__()
return self

def __exit__(self, *exc_details):
# type: (Any) -> None
self._client.__exit__(*exc_details)
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------

from typing import Any, TYPE_CHECKING

from azure.core.configuration import Configuration
from azure.core.pipeline import policies
from azure.mgmt.core.policies import ARMHttpLoggingPolicy
from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy

from .._version import VERSION

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


class UsageManagementClientConfiguration(Configuration):
"""Configuration for UsageManagementClient.

Expand All @@ -35,7 +36,7 @@ def __init__(
self,
credential: "AsyncTokenCredential",
subscription_id: str,
**kwargs: Any
**kwargs # type: Any
) -> None:
if credential is None:
raise ValueError("Parameter 'credential' must not be None.")
Expand All @@ -45,9 +46,8 @@ def __init__(

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

def _configure(
Expand All @@ -64,4 +64,4 @@ def _configure(
self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs)
self.authentication_policy = kwargs.get('authentication_policy')
if self.credential and not self.authentication_policy:
self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs)
self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)
Loading