Skip to content

Commit

Permalink
CodeGen from PR 15436 in Azure/azure-rest-api-specs
Browse files Browse the repository at this point in the history
Fix audience in AzureMetrics IngestMetrics (Azure#15436)

* Fix audience in AzureMetrics metrics

* remove Go from auto codegen

Co-authored-by: Joel Hendrix <jhendrix@microsoft.com>
  • Loading branch information
SDKAuto and jhendrixMSFT committed Aug 6, 2021
1 parent 03516c3 commit 11cf9d5
Show file tree
Hide file tree
Showing 9 changed files with 728 additions and 0 deletions.
19 changes: 19 additions & 0 deletions sdk/azure-monitor/azure/monitor/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# 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.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------

from ._configuration import AzureMetricsClientConfiguration
from ._azure_metrics_client import AzureMetricsClient
__all__ = ['AzureMetricsClient', 'AzureMetricsClientConfiguration']

from .version import VERSION

__version__ = VERSION

47 changes: 47 additions & 0 deletions sdk/azure-monitor/azure/monitor/_azure_metrics_client.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# 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.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------

from msrest.service_client import SDKClient
from msrest import Serializer, Deserializer

from ._configuration import AzureMetricsClientConfiguration
from .operations import MetricsOperations
from . import models


class AzureMetricsClient(SDKClient):
"""Monitor Management Client
:ivar config: Configuration for client.
:vartype config: AzureMetricsClientConfiguration
:ivar metrics: Metrics operations
:vartype metrics: azure.monitor.operations.MetricsOperations
:param credentials: Credentials needed for the client to connect to Azure.
:type credentials: :mod:`A msrestazure Credentials
object<msrestazure.azure_active_directory>`
:param str base_url: Service URL
"""

def __init__(
self, credentials, base_url=None):

self.config = AzureMetricsClientConfiguration(credentials, base_url)
super(AzureMetricsClient, self).__init__(self.config.credentials, self.config)

client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
self.api_version = '2018-09-01-preview'
self._serialize = Serializer(client_models)
self._deserialize = Deserializer(client_models)

self.metrics = MetricsOperations(
self._client, self.config, self._serialize, self._deserialize)
43 changes: 43 additions & 0 deletions sdk/azure-monitor/azure/monitor/_configuration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# 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.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------
from msrestazure import AzureConfiguration

from .version import VERSION


class AzureMetricsClientConfiguration(AzureConfiguration):
"""Configuration for AzureMetricsClient
Note that all parameters used to create this instance are saved as instance
attributes.
:param credentials: Credentials needed for the client to connect to Azure.
:type credentials: :mod:`A msrestazure Credentials
object<msrestazure.azure_active_directory>`
:param str base_url: Service URL
"""

def __init__(
self, credentials, base_url=None):

if credentials is None:
raise ValueError("Parameter 'credentials' must not be None.")
if not base_url:
base_url = 'https://monitoring.azure.com'

super(AzureMetricsClientConfiguration, self).__init__(base_url)

# Starting Autorest.Python 4.0.64, make connection pool activated by default
self.keep_alive = True

self.add_user_agent('azure-monitor/{}'.format(VERSION))
self.add_user_agent('Azure-SDK-For-Python')

self.credentials = credentials
37 changes: 37 additions & 0 deletions sdk/azure-monitor/azure/monitor/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# 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.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------

try:
from ._models_py3 import ApiError
from ._models_py3 import ApiFailureResponse
from ._models_py3 import AzureMetricsBaseData
from ._models_py3 import AzureMetricsData
from ._models_py3 import AzureMetricsDocument
from ._models_py3 import AzureMetricsResult, AzureMetricsResultException
from ._models_py3 import AzureTimeSeriesData
except (SyntaxError, ImportError):
from ._models import ApiError
from ._models import ApiFailureResponse
from ._models import AzureMetricsBaseData
from ._models import AzureMetricsData
from ._models import AzureMetricsDocument
from ._models import AzureMetricsResult, AzureMetricsResultException
from ._models import AzureTimeSeriesData

__all__ = [
'ApiError',
'ApiFailureResponse',
'AzureMetricsBaseData',
'AzureMetricsData',
'AzureMetricsDocument',
'AzureMetricsResult', 'AzureMetricsResultException',
'AzureTimeSeriesData',
]
216 changes: 216 additions & 0 deletions sdk/azure-monitor/azure/monitor/models/_models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,216 @@
# 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.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------

from msrest.serialization import Model
from msrest.exceptions import HttpOperationError


class ApiError(Model):
"""ApiError.
:param code: Gets or sets the azure metrics error code
:type code: str
:param message: Gets or sets the azure metrics error message
:type message: str
"""

_attribute_map = {
'code': {'key': 'code', 'type': 'str'},
'message': {'key': 'message', 'type': 'str'},
}

def __init__(self, **kwargs):
super(ApiError, self).__init__(**kwargs)
self.code = kwargs.get('code', None)
self.message = kwargs.get('message', None)


class ApiFailureResponse(Model):
"""ApiFailureResponse.
:param error:
:type error: ~azure.monitor.models.ApiError
"""

_attribute_map = {
'error': {'key': 'error', 'type': 'ApiError'},
}

def __init__(self, **kwargs):
super(ApiFailureResponse, self).__init__(**kwargs)
self.error = kwargs.get('error', None)


class AzureMetricsBaseData(Model):
"""AzureMetricsBaseData.
All required parameters must be populated in order to send to Azure.
:param metric: Required. Gets or sets the Metric name
:type metric: str
:param namespace: Required. Gets or sets the Metric namespace
:type namespace: str
:param dim_names: Gets or sets the list of dimension names (optional)
:type dim_names: list[str]
:param series: Required. Gets or sets the list of time series data for the
metric (one per unique dimension combination)
:type series: list[~azure.monitor.models.AzureTimeSeriesData]
"""

_validation = {
'metric': {'required': True},
'namespace': {'required': True},
'series': {'required': True},
}

_attribute_map = {
'metric': {'key': 'metric', 'type': 'str'},
'namespace': {'key': 'namespace', 'type': 'str'},
'dim_names': {'key': 'dimNames', 'type': '[str]'},
'series': {'key': 'series', 'type': '[AzureTimeSeriesData]'},
}

def __init__(self, **kwargs):
super(AzureMetricsBaseData, self).__init__(**kwargs)
self.metric = kwargs.get('metric', None)
self.namespace = kwargs.get('namespace', None)
self.dim_names = kwargs.get('dim_names', None)
self.series = kwargs.get('series', None)


class AzureMetricsData(Model):
"""AzureMetricsData.
All required parameters must be populated in order to send to Azure.
:param base_data: Required.
:type base_data: ~azure.monitor.models.AzureMetricsBaseData
"""

_validation = {
'base_data': {'required': True},
}

_attribute_map = {
'base_data': {'key': 'baseData', 'type': 'AzureMetricsBaseData'},
}

def __init__(self, **kwargs):
super(AzureMetricsData, self).__init__(**kwargs)
self.base_data = kwargs.get('base_data', None)


class AzureMetricsDocument(Model):
"""AzureMetricsDocument.
All required parameters must be populated in order to send to Azure.
:param time: Required. Gets or sets Time property (in ISO 8601 format)
:type time: str
:param data: Required.
:type data: ~azure.monitor.models.AzureMetricsData
"""

_validation = {
'time': {'required': True},
'data': {'required': True},
}

_attribute_map = {
'time': {'key': 'time', 'type': 'str'},
'data': {'key': 'data', 'type': 'AzureMetricsData'},
}

def __init__(self, **kwargs):
super(AzureMetricsDocument, self).__init__(**kwargs)
self.time = kwargs.get('time', None)
self.data = kwargs.get('data', None)


class AzureMetricsResult(Model):
"""AzureMetricsResult.
:param status_code: Http status code response
:type status_code: int
:param api_failure_response:
:type api_failure_response: ~azure.monitor.models.ApiFailureResponse
"""

_attribute_map = {
'status_code': {'key': 'statusCode', 'type': 'int'},
'api_failure_response': {'key': 'apiFailureResponse', 'type': 'ApiFailureResponse'},
}

def __init__(self, **kwargs):
super(AzureMetricsResult, self).__init__(**kwargs)
self.status_code = kwargs.get('status_code', None)
self.api_failure_response = kwargs.get('api_failure_response', None)


class AzureMetricsResultException(HttpOperationError):
"""Server responsed with exception of type: 'AzureMetricsResult'.
:param deserialize: A deserializer
:param response: Server response to be deserialized.
"""

def __init__(self, deserialize, response, *args):

super(AzureMetricsResultException, self).__init__(deserialize, response, 'AzureMetricsResult', *args)


class AzureTimeSeriesData(Model):
"""AzureTimeSeriesData.
All required parameters must be populated in order to send to Azure.
:param dim_values: Gets or sets dimension values
:type dim_values: list[str]
:param min: Required. Gets or sets Min value
:type min: float
:param max: Required. Gets or sets Max value
:type max: float
:param sum: Required. Gets or sets Sum value
:type sum: float
:param count: Required. Gets or sets Count value
:type count: int
"""

_validation = {
'min': {'required': True},
'max': {'required': True},
'sum': {'required': True},
'count': {'required': True},
}

_attribute_map = {
'dim_values': {'key': 'dimValues', 'type': '[str]'},
'min': {'key': 'min', 'type': 'float'},
'max': {'key': 'max', 'type': 'float'},
'sum': {'key': 'sum', 'type': 'float'},
'count': {'key': 'count', 'type': 'int'},
}

def __init__(self, **kwargs):
super(AzureTimeSeriesData, self).__init__(**kwargs)
self.dim_values = kwargs.get('dim_values', None)
self.min = kwargs.get('min', None)
self.max = kwargs.get('max', None)
self.sum = kwargs.get('sum', None)
self.count = kwargs.get('count', None)


class CloudError(Model):
"""CloudError.
"""

_attribute_map = {
}
Loading

0 comments on commit 11cf9d5

Please sign in to comment.