Skip to content
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
6 changes: 3 additions & 3 deletions sdk/commerce/azure-mgmt-commerce/_meta.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"commit": "18e0a756cd948b08cec7d4264f2dbbbfa53246ac",
"commit": "1234ae72090cafe16212c9ece9595e17134c4b93",
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
"autorest": "3.9.2",
"use": [
"@autorest/[email protected].0",
"@autorest/[email protected].6",
"@autorest/[email protected]"
],
"autorest_command": "autorest specification/commerce/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/[email protected].0 --use=@autorest/[email protected] --version=3.9.2 --version-tolerant=False",
"autorest_command": "autorest specification/commerce/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/[email protected].6 --use=@autorest/[email protected] --version=3.9.2 --version-tolerant=False",
"readme": "specification/commerce/resource-manager/readme.md"
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

import sys
from typing import Any, TYPE_CHECKING

from azure.core.configuration import Configuration
Expand All @@ -15,11 +14,6 @@

from ._version import VERSION

if sys.version_info >= (3, 8):
from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports
else:
from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports

if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials import TokenCredential
Expand All @@ -43,7 +37,7 @@ class UsageManagementClientConfiguration(Configuration): # pylint: disable=too-

def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None:
super(UsageManagementClientConfiguration, self).__init__(**kwargs)
api_version: Literal["2015-06-01-preview"] = kwargs.pop("api_version", "2015-06-01-preview")
api_version: str = kwargs.pop("api_version", "2015-06-01-preview")

if credential is None:
raise ValueError("Parameter 'credential' must not be None.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -629,7 +629,7 @@ def _serialize(self, target_obj, data_type=None, **kwargs):
if xml_desc.get("attr", False):
if xml_ns:
ET.register_namespace(xml_prefix, xml_ns)
xml_name = "{}{}".format(xml_ns, xml_name)
xml_name = "{{{}}}{}".format(xml_ns, xml_name)
serialized.set(xml_name, new_attr) # type: ignore
continue
if xml_desc.get("text", False):
Expand Down Expand Up @@ -1271,7 +1271,7 @@ def _extract_name_from_internal_type(internal_type):
xml_name = internal_type_xml_map.get("name", internal_type.__name__)
xml_ns = internal_type_xml_map.get("ns", None)
if xml_ns:
xml_name = "{}{}".format(xml_ns, xml_name)
xml_name = "{{{}}}{}".format(xml_ns, xml_name)
return xml_name


Expand All @@ -1295,7 +1295,7 @@ def xml_key_extractor(attr, attr_desc, data):
# Integrate namespace if necessary
xml_ns = xml_desc.get("ns", internal_type_xml_map.get("ns", None))
if xml_ns:
xml_name = "{}{}".format(xml_ns, xml_name)
xml_name = "{{{}}}{}".format(xml_ns, xml_name)

# If it's an attribute, that's simple
if xml_desc.get("attr", False):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def __init__(
self._config = UsageManagementClientConfiguration(
credential=credential, subscription_id=subscription_id, **kwargs
)
self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
self._client: ARMPipelineClient = 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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

VERSION = "6.1.0b1"
VERSION = "1.0.0b1"
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

import sys
from typing import Any, TYPE_CHECKING

from azure.core.configuration import Configuration
Expand All @@ -15,11 +14,6 @@

from .._version import VERSION

if sys.version_info >= (3, 8):
from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports
else:
from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports

if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials_async import AsyncTokenCredential
Expand All @@ -43,7 +37,7 @@ class UsageManagementClientConfiguration(Configuration): # pylint: disable=too-

def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None:
super(UsageManagementClientConfiguration, self).__init__(**kwargs)
api_version: Literal["2015-06-01-preview"] = kwargs.pop("api_version", "2015-06-01-preview")
api_version: str = kwargs.pop("api_version", "2015-06-01-preview")

if credential is None:
raise ValueError("Parameter 'credential' must not be None.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def __init__(
self._config = UsageManagementClientConfiguration(
credential=credential, subscription_id=subscription_id, **kwargs
)
self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
import sys
from typing import Any, Callable, Dict, Optional, TypeVar

from azure.core.exceptions import (
Expand All @@ -28,10 +27,6 @@
from ..._vendor import _convert_request
from ...operations._rate_card_operations import build_get_request

if sys.version_info >= (3, 8):
from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports
else:
from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]

Expand Down Expand Up @@ -88,9 +83,7 @@ async def get(self, filter: str, **kwargs: Any) -> _models.ResourceRateCardInfo:
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})

api_version: Literal["2015-06-01-preview"] = kwargs.pop(
"api_version", _params.pop("api-version", self._config.api_version)
)
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ResourceRateCardInfo] = kwargs.pop("cls", None)

request = build_get_request(
Expand All @@ -104,8 +97,9 @@ async def get(self, filter: str, **kwargs: Any) -> _models.ResourceRateCardInfo:
request = _convert_request(request)
request.url = self._client.format_url(request.url)

_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=False, **kwargs
request, stream=_stream, **kwargs
)

response = pipeline_response.http_response
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
import datetime
import sys
from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union
import urllib.parse

Expand All @@ -31,10 +30,6 @@
from ..._vendor import _convert_request
from ...operations._usage_aggregates_operations import build_list_request

if sys.version_info >= (3, 8):
from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports
else:
from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]

Expand Down Expand Up @@ -101,9 +96,7 @@ def list(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})

api_version: Literal["2015-06-01-preview"] = kwargs.pop(
"api_version", _params.pop("api-version", self._config.api_version)
)
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.UsageAggregationListResult] = kwargs.pop("cls", None)

error_map = {
Expand Down Expand Up @@ -160,14 +153,15 @@ async def extract_data(pipeline_response):
async def get_next(next_link=None):
request = prepare_request(next_link)

_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=False, **kwargs
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response

if response.status_code not in [200]:
if response.status_code not in [200, 202]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
error = self._deserialize.failsafe_deserialize(_models.ErrorObjectResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)

return pipeline_response
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

from ._models_py3 import ErrorObjectResponse
from ._models_py3 import ErrorResponse
from ._models_py3 import InfoField
from ._models_py3 import MeterInfo
from ._models_py3 import MonetaryCommitment
from ._models_py3 import MonetaryCredit
Expand All @@ -25,8 +25,8 @@
from ._patch import patch_sdk as _patch_sdk

__all__ = [
"ErrorObjectResponse",
"ErrorResponse",
"InfoField",
"MeterInfo",
"MonetaryCommitment",
"MonetaryCredit",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,26 @@
from .. import models as _models


class ErrorObjectResponse(_serialization.Model):
"""Describes the format of Error response with a wrapper object.

:ivar error: Wrapper object for error information.
:vartype error: ~azure.mgmt.commerce.models.ErrorResponse
"""

_attribute_map = {
"error": {"key": "error", "type": "ErrorResponse"},
}

def __init__(self, *, error: Optional["_models.ErrorResponse"] = None, **kwargs: Any) -> None:
"""
:keyword error: Wrapper object for error information.
:paramtype error: ~azure.mgmt.commerce.models.ErrorResponse
"""
super().__init__(**kwargs)
self.error = error


class ErrorResponse(_serialization.Model):
"""Describes the format of Error response.

Expand All @@ -43,26 +63,6 @@ def __init__(self, *, code: Optional[str] = None, message: Optional[str] = None,
self.message = message


class InfoField(_serialization.Model):
"""Key-value pairs of instance details in the legacy format.

:ivar project: Identifies the name of the instance provisioned by the user.
:vartype project: str
"""

_attribute_map = {
"project": {"key": "project", "type": "str"},
}

def __init__(self, *, project: Optional[str] = None, **kwargs: Any) -> None:
"""
:keyword project: Identifies the name of the instance provisioned by the user.
:paramtype project: str
"""
super().__init__(**kwargs)
self.project = project


class MeterInfo(_serialization.Model):
"""Detailed information about the meter.

Expand Down Expand Up @@ -485,7 +485,7 @@ class UsageAggregation(_serialization.Model): # pylint: disable=too-many-instan
:ivar meter_region: Region of the meterId used for billing purposes.
:vartype meter_region: str
:ivar info_fields: Key-value pairs of instance details (legacy format).
:vartype info_fields: ~azure.mgmt.commerce.models.InfoField
:vartype info_fields: any
:ivar instance_data: Key-value pairs of instance details represented as a string.
:vartype instance_data: str
"""
Expand All @@ -504,7 +504,7 @@ class UsageAggregation(_serialization.Model): # pylint: disable=too-many-instan
"meter_category": {"key": "properties.meterCategory", "type": "str"},
"meter_sub_category": {"key": "properties.meterSubCategory", "type": "str"},
"meter_region": {"key": "properties.meterRegion", "type": "str"},
"info_fields": {"key": "properties.infoFields", "type": "InfoField"},
"info_fields": {"key": "properties.infoFields", "type": "object"},
"instance_data": {"key": "properties.instanceData", "type": "str"},
}

Expand All @@ -524,7 +524,7 @@ def __init__(
meter_category: Optional[str] = None,
meter_sub_category: Optional[str] = None,
meter_region: Optional[str] = None,
info_fields: Optional["_models.InfoField"] = None,
info_fields: Optional[Any] = None,
instance_data: Optional[str] = None,
**kwargs: Any
) -> None:
Expand Down Expand Up @@ -558,7 +558,7 @@ def __init__(
:keyword meter_region: Region of the meterId used for billing purposes.
:paramtype meter_region: str
:keyword info_fields: Key-value pairs of instance details (legacy format).
:paramtype info_fields: ~azure.mgmt.commerce.models.InfoField
:paramtype info_fields: any
:keyword instance_data: Key-value pairs of instance details represented as a string.
:paramtype instance_data: str
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
import sys
from typing import Any, Callable, Dict, Optional, TypeVar

from azure.core.exceptions import (
Expand All @@ -28,10 +27,6 @@
from .._serialization import Serializer
from .._vendor import _convert_request, _format_url_section

if sys.version_info >= (3, 8):
from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports
else:
from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]

Expand All @@ -43,9 +38,7 @@ def build_get_request(subscription_id: str, *, filter: str, **kwargs: Any) -> Ht
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})

api_version: Literal["2015-06-01-preview"] = kwargs.pop(
"api_version", _params.pop("api-version", "2015-06-01-preview")
)
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-06-01-preview"))
accept = _headers.pop("Accept", "application/json, text/json")

# Construct URL
Expand Down Expand Up @@ -118,9 +111,7 @@ def get(self, filter: str, **kwargs: Any) -> _models.ResourceRateCardInfo:
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})

api_version: Literal["2015-06-01-preview"] = kwargs.pop(
"api_version", _params.pop("api-version", self._config.api_version)
)
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ResourceRateCardInfo] = kwargs.pop("cls", None)

request = build_get_request(
Expand All @@ -134,8 +125,9 @@ def get(self, filter: str, **kwargs: Any) -> _models.ResourceRateCardInfo:
request = _convert_request(request)
request.url = self._client.format_url(request.url)

_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=False, **kwargs
request, stream=_stream, **kwargs
)

response = pipeline_response.http_response
Expand Down
Loading