Skip to content

Commit

Permalink
CodeGen from PR 17013 in Azure/azure-rest-api-specs
Browse files Browse the repository at this point in the history
Merge 820ec8c25dd830791584efd3a54b75ff24f6775a into 7eaed22
  • Loading branch information
SDKAuto committed Dec 16, 2021
1 parent 8801ffd commit 3e31317
Show file tree
Hide file tree
Showing 54 changed files with 6,004 additions and 2,604 deletions.
11 changes: 11 additions & 0 deletions sdk/consumption/azure-mgmt-consumption/_meta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"autorest": "3.7.2",
"use": [
"@autorest/python@5.12.0",
"@autorest/modelerfour@4.19.3"
],
"commit": "509d8e6c2a6304417038192a9a5d2d0bea7b4756",
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
"autorest_command": "autorest specification/consumption/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/python@5.12.0 --use=@autorest/modelerfour@4.19.3 --version=3.7.2",
"readme": "specification/consumption/resource-manager/readme.md"
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
__version__ = VERSION
__all__ = ['ConsumptionManagementClient']

try:
from ._patch import patch_sdk # type: ignore
patch_sdk()
except ImportError:
pass
# `._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()
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

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 Down Expand Up @@ -40,15 +40,15 @@ def __init__(
**kwargs # type: Any
):
# type: (...) -> None
super(ConsumptionManagementClientConfiguration, self).__init__(**kwargs)
if credential is None:
raise ValueError("Parameter 'credential' must not be None.")
if subscription_id is None:
raise ValueError("Parameter 'subscription_id' must not be None.")
super(ConsumptionManagementClientConfiguration, self).__init__(**kwargs)

self.credential = credential
self.subscription_id = subscription_id
self.api_version = "2019-10-01"
self.api_version = "2021-10-01"
self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default'])
kwargs.setdefault('sdk_moniker', 'mgmt-consumption/{}'.format(VERSION))
self._configure(**kwargs)
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
Expand Up @@ -6,38 +6,22 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

from copy import deepcopy
from typing import TYPE_CHECKING

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

from . import models
from ._configuration import ConsumptionManagementClientConfiguration
from .operations import AggregatedCostOperations, BalancesOperations, BudgetsOperations, ChargesOperations, CreditsOperations, EventsOperations, LotsOperations, MarketplacesOperations, Operations, PriceSheetOperations, ReservationRecommendationDetailsOperations, ReservationRecommendationsOperations, ReservationTransactionsOperations, ReservationsDetailsOperations, ReservationsSummariesOperations, TagsOperations, UsageDetailsOperations

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

from azure.core.credentials import TokenCredential

from ._configuration import ConsumptionManagementClientConfiguration
from .operations import UsageDetailsOperations
from .operations import MarketplacesOperations
from .operations import BudgetsOperations
from .operations import TagsOperations
from .operations import ChargesOperations
from .operations import BalancesOperations
from .operations import ReservationsSummariesOperations
from .operations import ReservationsDetailsOperations
from .operations import ReservationRecommendationsOperations
from .operations import ReservationRecommendationDetailsOperations
from .operations import ReservationTransactionsOperations
from .operations import PriceSheetOperations
from .operations import ForecastsOperations
from .operations import Operations
from .operations import AggregatedCostOperations
from .operations import EventsOperations
from .operations import LotsOperations
from .operations import CreditsOperations
from . import models

from azure.core.rest import HttpRequest, HttpResponse

class ConsumptionManagementClient(object):
"""Consumption management client provides access to consumption resources for Azure Enterprise Subscriptions.
Expand All @@ -55,19 +39,21 @@ class ConsumptionManagementClient(object):
:ivar balances: BalancesOperations operations
:vartype balances: azure.mgmt.consumption.operations.BalancesOperations
:ivar reservations_summaries: ReservationsSummariesOperations operations
:vartype reservations_summaries: azure.mgmt.consumption.operations.ReservationsSummariesOperations
:vartype reservations_summaries:
azure.mgmt.consumption.operations.ReservationsSummariesOperations
:ivar reservations_details: ReservationsDetailsOperations operations
:vartype reservations_details: azure.mgmt.consumption.operations.ReservationsDetailsOperations
:ivar reservation_recommendations: ReservationRecommendationsOperations operations
:vartype reservation_recommendations: azure.mgmt.consumption.operations.ReservationRecommendationsOperations
:vartype reservation_recommendations:
azure.mgmt.consumption.operations.ReservationRecommendationsOperations
:ivar reservation_recommendation_details: ReservationRecommendationDetailsOperations operations
:vartype reservation_recommendation_details: azure.mgmt.consumption.operations.ReservationRecommendationDetailsOperations
:vartype reservation_recommendation_details:
azure.mgmt.consumption.operations.ReservationRecommendationDetailsOperations
:ivar reservation_transactions: ReservationTransactionsOperations operations
:vartype reservation_transactions: azure.mgmt.consumption.operations.ReservationTransactionsOperations
:vartype reservation_transactions:
azure.mgmt.consumption.operations.ReservationTransactionsOperations
:ivar price_sheet: PriceSheetOperations operations
:vartype price_sheet: azure.mgmt.consumption.operations.PriceSheetOperations
:ivar forecasts: ForecastsOperations operations
:vartype forecasts: azure.mgmt.consumption.operations.ForecastsOperations
:ivar operations: Operations operations
:vartype operations: azure.mgmt.consumption.operations.Operations
:ivar aggregated_cost: AggregatedCostOperations operations
Expand All @@ -82,63 +68,70 @@ class ConsumptionManagementClient(object):
:type credential: ~azure.core.credentials.TokenCredential
:param subscription_id: Azure Subscription ID.
:type subscription_id: str
:param str base_url: Service URL
:param base_url: Service URL. Default value is 'https://management.azure.com'.
:type base_url: str
"""

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

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)
self._serialize.client_side_validation = False
self.usage_details = UsageDetailsOperations(self._client, self._config, self._serialize, self._deserialize)
self.marketplaces = MarketplacesOperations(self._client, self._config, self._serialize, self._deserialize)
self.budgets = BudgetsOperations(self._client, self._config, self._serialize, self._deserialize)
self.tags = TagsOperations(self._client, self._config, self._serialize, self._deserialize)
self.charges = ChargesOperations(self._client, self._config, self._serialize, self._deserialize)
self.balances = BalancesOperations(self._client, self._config, self._serialize, self._deserialize)
self.reservations_summaries = ReservationsSummariesOperations(self._client, self._config, self._serialize, self._deserialize)
self.reservations_details = ReservationsDetailsOperations(self._client, self._config, self._serialize, self._deserialize)
self.reservation_recommendations = ReservationRecommendationsOperations(self._client, self._config, self._serialize, self._deserialize)
self.reservation_recommendation_details = ReservationRecommendationDetailsOperations(self._client, self._config, self._serialize, self._deserialize)
self.reservation_transactions = ReservationTransactionsOperations(self._client, self._config, self._serialize, self._deserialize)
self.price_sheet = PriceSheetOperations(self._client, self._config, self._serialize, self._deserialize)
self.operations = Operations(self._client, self._config, self._serialize, self._deserialize)
self.aggregated_cost = AggregatedCostOperations(self._client, self._config, self._serialize, self._deserialize)
self.events = EventsOperations(self._client, self._config, self._serialize, self._deserialize)
self.lots = LotsOperations(self._client, self._config, self._serialize, self._deserialize)
self.credits = CreditsOperations(self._client, self._config, self._serialize, self._deserialize)


def _send_request(
self,
request, # type: HttpRequest
**kwargs # type: Any
):
# type: (...) -> HttpResponse
"""Runs the network request through the client's chained policies.
>>> from azure.core.rest import HttpRequest
>>> request = HttpRequest("GET", "https://www.example.org/")
<HttpRequest [GET], url: 'https://www.example.org/'>
>>> response = client._send_request(request)
<HttpResponse: 200 OK>
For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart
:param request: The network request you want to make. Required.
:type request: ~azure.core.rest.HttpRequest
:keyword bool stream: Whether the response payload will be streamed. Defaults to False.
:return: The response of your network call. Does not do error handling on your response.
:rtype: ~azure.core.rest.HttpResponse
"""

self.usage_details = UsageDetailsOperations(
self._client, self._config, self._serialize, self._deserialize)
self.marketplaces = MarketplacesOperations(
self._client, self._config, self._serialize, self._deserialize)
self.budgets = BudgetsOperations(
self._client, self._config, self._serialize, self._deserialize)
self.tags = TagsOperations(
self._client, self._config, self._serialize, self._deserialize)
self.charges = ChargesOperations(
self._client, self._config, self._serialize, self._deserialize)
self.balances = BalancesOperations(
self._client, self._config, self._serialize, self._deserialize)
self.reservations_summaries = ReservationsSummariesOperations(
self._client, self._config, self._serialize, self._deserialize)
self.reservations_details = ReservationsDetailsOperations(
self._client, self._config, self._serialize, self._deserialize)
self.reservation_recommendations = ReservationRecommendationsOperations(
self._client, self._config, self._serialize, self._deserialize)
self.reservation_recommendation_details = ReservationRecommendationDetailsOperations(
self._client, self._config, self._serialize, self._deserialize)
self.reservation_transactions = ReservationTransactionsOperations(
self._client, self._config, self._serialize, self._deserialize)
self.price_sheet = PriceSheetOperations(
self._client, self._config, self._serialize, self._deserialize)
self.forecasts = ForecastsOperations(
self._client, self._config, self._serialize, self._deserialize)
self.operations = Operations(
self._client, self._config, self._serialize, self._deserialize)
self.aggregated_cost = AggregatedCostOperations(
self._client, self._config, self._serialize, self._deserialize)
self.events = EventsOperations(
self._client, self._config, self._serialize, self._deserialize)
self.lots = LotsOperations(
self._client, self._config, self._serialize, self._deserialize)
self.credits = CreditsOperations(
self._client, self._config, self._serialize, self._deserialize)
request_copy = deepcopy(request)
request_copy.url = self._client.format_url(request_copy.url)
return self._client.send_request(request_copy, **kwargs)

def close(self):
# type: () -> None
Expand Down
Loading

0 comments on commit 3e31317

Please sign in to comment.