From 58944b9abc84c85c8e45dcefbdb27300e37f723c Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Thu, 4 Feb 2021 08:11:24 +0000 Subject: [PATCH 1/3] CodeGen from PR 12835 in Azure/azure-rest-api-specs [T2] python track2 config for costmanagement (#12835) * add python track2 config for costmanagement * fix track2 pipeline --- .../costmanagement/_cost_management_client.py | 1 - .../azure/mgmt/costmanagement/_metadata.json | 55 +++++++++++++++++++ .../aio/_cost_management_client.py | 1 - .../mgmt/costmanagement/models/__init__.py | 2 + .../models/_cost_management_client_enums.py | 6 ++ .../mgmt/costmanagement/models/_models.py | 27 ++++----- .../mgmt/costmanagement/models/_models_py3.py | 32 +++++------ 7 files changed, 86 insertions(+), 38 deletions(-) create mode 100644 sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/_metadata.json diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/_cost_management_client.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/_cost_management_client.py index b3dc5950fac3..b723c5bf5563 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/_cost_management_client.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/_cost_management_client.py @@ -64,7 +64,6 @@ def __init__( 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.views = ViewsOperations( diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/_metadata.json b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/_metadata.json new file mode 100644 index 000000000000..4af5173a5c26 --- /dev/null +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/_metadata.json @@ -0,0 +1,55 @@ +{ + "chosen_version": "2020-06-01", + "total_api_version_list": ["2020-06-01"], + "client": { + "name": "CostManagementClient", + "filename": "_cost_management_client", + "description": "CostManagementClient.", + "base_url": "\u0027https://management.azure.com\u0027", + "custom_base_url": null, + "azure_arm": true, + "has_lro_operations": false, + "client_side_validation": true + }, + "global_parameters": { + "sync": { + "credential": { + "signature": "credential, # type: \"TokenCredential\"", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials.TokenCredential", + "required": true + } + }, + "async": { + "credential": { + "signature": "credential, # type: \"AsyncTokenCredential\"", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", + "required": true + } + }, + "constant": { + }, + "call": "credential" + }, + "config": { + "credential": true, + "credential_scopes": ["https://management.azure.com/.default"], + "credential_default_policy_type": "BearerTokenCredentialPolicy", + "credential_default_policy_type_has_async_version": true, + "credential_key_header_name": null + }, + "operation_groups": { + "views": "ViewsOperations", + "alerts": "AlertsOperations", + "forecast": "ForecastOperations", + "dimensions": "DimensionsOperations", + "query": "QueryOperations", + "operations": "Operations", + "exports": "ExportsOperations" + }, + "operation_mixins": { + }, + "sync_imports": "None", + "async_imports": "None" +} \ No newline at end of file diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/_cost_management_client.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/_cost_management_client.py index e31fb6a92def..06db2b2dd471 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/_cost_management_client.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/_cost_management_client.py @@ -61,7 +61,6 @@ def __init__( 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.views = ViewsOperations( diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/models/__init__.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/models/__init__.py index c85b765f8735..2afdd595d689 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/models/__init__.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/models/__init__.py @@ -143,6 +143,7 @@ OperatorType, PivotType, QueryColumnType, + QueryOperatorType, RecurrenceType, ReportConfigColumnType, ReportConfigSortingDirection, @@ -232,6 +233,7 @@ 'OperatorType', 'PivotType', 'QueryColumnType', + 'QueryOperatorType', 'RecurrenceType', 'ReportConfigColumnType', 'ReportConfigSortingDirection', diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/models/_cost_management_client_enums.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/models/_cost_management_client_enums.py index cf2cc99799b9..884450e0a1ce 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/models/_cost_management_client_enums.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/models/_cost_management_client_enums.py @@ -229,6 +229,12 @@ class QueryColumnType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): TAG = "Tag" DIMENSION = "Dimension" +class QueryOperatorType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The operator to use for comparison. + """ + + IN_ENUM = "In" + class RecurrenceType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """The schedule recurrence. """ diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/models/_models.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/models/_models.py index c23a9a7b0ed9..85527af7c2de 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/models/_models.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/models/_models.py @@ -795,7 +795,7 @@ def __init__( self.destination = kwargs['destination'] -class ExportExecution(Resource): +class ExportExecution(ProxyResource): """An export execution. Variables are only populated by the server, and will be ignored when sending a request. @@ -806,8 +806,9 @@ class ExportExecution(Resource): :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar tags: A set of tags. Resource tags. - :vartype tags: dict[str, str] + :param e_tag: eTag of the resource. To handle concurrent update scenario, this field will be + used to determine whether the user is updating the latest version or not. + :type e_tag: str :param execution_type: The type of the export execution. Possible values include: "OnDemand", "Scheduled". :type execution_type: str or ~azure.mgmt.costmanagement.models.ExecutionType @@ -836,14 +837,13 @@ class ExportExecution(Resource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'tags': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, + 'e_tag': {'key': 'eTag', 'type': 'str'}, 'execution_type': {'key': 'properties.executionType', 'type': 'str'}, 'status': {'key': 'properties.status', 'type': 'str'}, 'submitted_by': {'key': 'properties.submittedBy', 'type': 'str'}, @@ -999,23 +999,17 @@ def __init__( class ExportSchedule(msrest.serialization.Model): """The schedule associated with the export. - All required parameters must be populated in order to send to Azure. - :param status: The status of the export's schedule. If 'Inactive', the export's schedule is paused. Possible values include: "Active", "Inactive". :type status: str or ~azure.mgmt.costmanagement.models.StatusType - :param recurrence: Required. The schedule recurrence. Possible values include: "Daily", - "Weekly", "Monthly", "Annually". + :param recurrence: The schedule recurrence. Possible values include: "Daily", "Weekly", + "Monthly", "Annually". :type recurrence: str or ~azure.mgmt.costmanagement.models.RecurrenceType :param recurrence_period: Has start and end date of the recurrence. The start date must be in future. If present, the end date must be greater than start date. :type recurrence_period: ~azure.mgmt.costmanagement.models.ExportRecurrencePeriod """ - _validation = { - 'recurrence': {'required': True}, - } - _attribute_map = { 'status': {'key': 'status', 'type': 'str'}, 'recurrence': {'key': 'recurrence', 'type': 'str'}, @@ -1028,7 +1022,7 @@ def __init__( ): super(ExportSchedule, self).__init__(**kwargs) self.status = kwargs.get('status', None) - self.recurrence = kwargs['recurrence'] + self.recurrence = kwargs.get('recurrence', None) self.recurrence_period = kwargs.get('recurrence_period', None) @@ -1351,9 +1345,8 @@ class QueryComparisonExpression(msrest.serialization.Model): :param name: Required. The name of the column to use in comparison. :type name: str - :param operator: Required. The operator to use for comparison. Possible values include: "In", - "Contains". - :type operator: str or ~azure.mgmt.costmanagement.models.OperatorType + :param operator: Required. The operator to use for comparison. Possible values include: "In". + :type operator: str or ~azure.mgmt.costmanagement.models.QueryOperatorType :param values: Required. Array of values to use for comparison. :type values: list[str] """ diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/models/_models_py3.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/models/_models_py3.py index b9912797a815..ce1d68ae6c23 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/models/_models_py3.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/models/_models_py3.py @@ -879,7 +879,7 @@ def __init__( self.destination = destination -class ExportExecution(Resource): +class ExportExecution(ProxyResource): """An export execution. Variables are only populated by the server, and will be ignored when sending a request. @@ -890,8 +890,9 @@ class ExportExecution(Resource): :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar tags: A set of tags. Resource tags. - :vartype tags: dict[str, str] + :param e_tag: eTag of the resource. To handle concurrent update scenario, this field will be + used to determine whether the user is updating the latest version or not. + :type e_tag: str :param execution_type: The type of the export execution. Possible values include: "OnDemand", "Scheduled". :type execution_type: str or ~azure.mgmt.costmanagement.models.ExecutionType @@ -920,14 +921,13 @@ class ExportExecution(Resource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'tags': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, + 'e_tag': {'key': 'eTag', 'type': 'str'}, 'execution_type': {'key': 'properties.executionType', 'type': 'str'}, 'status': {'key': 'properties.status', 'type': 'str'}, 'submitted_by': {'key': 'properties.submittedBy', 'type': 'str'}, @@ -942,6 +942,7 @@ class ExportExecution(Resource): def __init__( self, *, + e_tag: Optional[str] = None, execution_type: Optional[Union[str, "ExecutionType"]] = None, status: Optional[Union[str, "ExecutionStatus"]] = None, submitted_by: Optional[str] = None, @@ -953,7 +954,7 @@ def __init__( error: Optional["ErrorDetails"] = None, **kwargs ): - super(ExportExecution, self).__init__(**kwargs) + super(ExportExecution, self).__init__(e_tag=e_tag, **kwargs) self.execution_type = execution_type self.status = status self.submitted_by = submitted_by @@ -1102,23 +1103,17 @@ def __init__( class ExportSchedule(msrest.serialization.Model): """The schedule associated with the export. - All required parameters must be populated in order to send to Azure. - :param status: The status of the export's schedule. If 'Inactive', the export's schedule is paused. Possible values include: "Active", "Inactive". :type status: str or ~azure.mgmt.costmanagement.models.StatusType - :param recurrence: Required. The schedule recurrence. Possible values include: "Daily", - "Weekly", "Monthly", "Annually". + :param recurrence: The schedule recurrence. Possible values include: "Daily", "Weekly", + "Monthly", "Annually". :type recurrence: str or ~azure.mgmt.costmanagement.models.RecurrenceType :param recurrence_period: Has start and end date of the recurrence. The start date must be in future. If present, the end date must be greater than start date. :type recurrence_period: ~azure.mgmt.costmanagement.models.ExportRecurrencePeriod """ - _validation = { - 'recurrence': {'required': True}, - } - _attribute_map = { 'status': {'key': 'status', 'type': 'str'}, 'recurrence': {'key': 'recurrence', 'type': 'str'}, @@ -1128,8 +1123,8 @@ class ExportSchedule(msrest.serialization.Model): def __init__( self, *, - recurrence: Union[str, "RecurrenceType"], status: Optional[Union[str, "StatusType"]] = None, + recurrence: Optional[Union[str, "RecurrenceType"]] = None, recurrence_period: Optional["ExportRecurrencePeriod"] = None, **kwargs ): @@ -1488,9 +1483,8 @@ class QueryComparisonExpression(msrest.serialization.Model): :param name: Required. The name of the column to use in comparison. :type name: str - :param operator: Required. The operator to use for comparison. Possible values include: "In", - "Contains". - :type operator: str or ~azure.mgmt.costmanagement.models.OperatorType + :param operator: Required. The operator to use for comparison. Possible values include: "In". + :type operator: str or ~azure.mgmt.costmanagement.models.QueryOperatorType :param values: Required. Array of values to use for comparison. :type values: list[str] """ @@ -1511,7 +1505,7 @@ def __init__( self, *, name: str, - operator: Union[str, "OperatorType"], + operator: Union[str, "QueryOperatorType"], values: List[str], **kwargs ): From 932d10867e6cd1f0cb5b76ebed2b23906ff5f0af Mon Sep 17 00:00:00 2001 From: 00Kai0 Date: Thu, 4 Feb 2021 16:40:11 +0800 Subject: [PATCH 2/3] test,version,CHANGELOG --- .../azure-mgmt-costmanagement/CHANGELOG.md | 10 ++++++++++ sdk/costmanagement/azure-mgmt-costmanagement/README.md | 10 ++++------ .../azure/mgmt/costmanagement/_version.py | 2 +- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/CHANGELOG.md b/sdk/costmanagement/azure-mgmt-costmanagement/CHANGELOG.md index e8d489e02f2a..ac40e1256d26 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/CHANGELOG.md +++ b/sdk/costmanagement/azure-mgmt-costmanagement/CHANGELOG.md @@ -1,5 +1,15 @@ # Release History +## 1.0.0b2 (2021-02-04) + +**Features** + + - Model ExportExecution has a new parameter e_tag + +**Breaking changes** + + - Model ExportExecution no longer has parameter tags + ## 1.0.0b1 (2020-12-09) This is beta preview version. diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/README.md b/sdk/costmanagement/azure-mgmt-costmanagement/README.md index 470017db7726..ea6f213a358c 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/README.md +++ b/sdk/costmanagement/azure-mgmt-costmanagement/README.md @@ -14,18 +14,16 @@ library. For a more complete set of Azure libraries, see the [azure sdk python release](https://aka.ms/azsdk/python/all). -## Usage +# Usage To learn how to use this package, see the [quickstart guide](https://aka.ms/azsdk/python/mgmt) - + For docs and references, see [Python SDK References](https://docs.microsoft.com/python/api/overview/azure/) -Code samples for this package can be found at [Cost Management Management](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com. -Additional code samples for different Azure services are available at [Samples Repo](https://aka.ms/azsdk/python/mgmt/samples - - +Code samples for this package can be found at [Costmanagement Management](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com. +Additional code samples for different Azure services are available at [Samples Repo](https://aka.ms/azsdk/python/mgmt/samples) ## Provide Feedback If you encounter any bugs or have suggestions, please file an issue in diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/_version.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/_version.py index e5754a47ce68..dfa6ee022f15 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/_version.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "1.0.0b1" +VERSION = "1.0.0b2" From 1fc173d98ecc25bae40ed264fc16d9ab8522523d Mon Sep 17 00:00:00 2001 From: 00Kai0 Date: Thu, 4 Feb 2021 17:00:17 +0800 Subject: [PATCH 3/3] fix changelog and version --- sdk/costmanagement/azure-mgmt-costmanagement/CHANGELOG.md | 2 +- .../azure/mgmt/costmanagement/_version.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/CHANGELOG.md b/sdk/costmanagement/azure-mgmt-costmanagement/CHANGELOG.md index ac40e1256d26..9884b9bdcbf3 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/CHANGELOG.md +++ b/sdk/costmanagement/azure-mgmt-costmanagement/CHANGELOG.md @@ -1,6 +1,6 @@ # Release History -## 1.0.0b2 (2021-02-04) +## 1.0.0 (2021-02-04) **Features** diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/_version.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/_version.py index dfa6ee022f15..c47f66669f1b 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/_version.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "1.0.0b2" +VERSION = "1.0.0"