diff --git a/sdk/advisor/azure-mgmt-advisor/CHANGELOG.md b/sdk/advisor/azure-mgmt-advisor/CHANGELOG.md index 56a47795e868..1edf0d2572d5 100644 --- a/sdk/advisor/azure-mgmt-advisor/CHANGELOG.md +++ b/sdk/advisor/azure-mgmt-advisor/CHANGELOG.md @@ -1,5 +1,11 @@ # Release History +## 9.0.0 (2020-12-22) + +**Features** + + - Model SuppressionContract has a new parameter expiration_time_stamp + ## 9.0.0b1 (2020-11-03) This is beta preview version. diff --git a/sdk/advisor/azure-mgmt-advisor/azure/mgmt/advisor/_version.py b/sdk/advisor/azure-mgmt-advisor/azure/mgmt/advisor/_version.py index 6dddc002d43d..b77ac9246082 100644 --- a/sdk/advisor/azure-mgmt-advisor/azure/mgmt/advisor/_version.py +++ b/sdk/advisor/azure-mgmt-advisor/azure/mgmt/advisor/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "9.0.0b1" +VERSION = "9.0.0" diff --git a/sdk/advisor/azure-mgmt-advisor/azure/mgmt/advisor/aio/operations/_configurations_operations.py b/sdk/advisor/azure-mgmt-advisor/azure/mgmt/advisor/aio/operations/_configurations_operations.py index c4934acfc99f..67e44455c615 100644 --- a/sdk/advisor/azure-mgmt-advisor/azure/mgmt/advisor/aio/operations/_configurations_operations.py +++ b/sdk/advisor/azure-mgmt-advisor/azure/mgmt/advisor/aio/operations/_configurations_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class ConfigurationsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -44,7 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: def list_by_subscription( self, **kwargs - ) -> AsyncIterable["models.ConfigurationListResult"]: + ) -> AsyncIterable["_models.ConfigurationListResult"]: """Retrieve Azure Advisor configurations. Retrieve Azure Advisor configurations and also retrieve configurations of contained resource @@ -55,7 +55,7 @@ def list_by_subscription( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.advisor.models.ConfigurationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ConfigurationListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigurationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -100,7 +100,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ArmErrorResponse, response) + error = self._deserialize(_models.ArmErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -113,10 +113,10 @@ async def get_next(next_link=None): async def create_in_subscription( self, - configuration_name: Union[str, "models.ConfigurationName"], - config_contract: "models.ConfigData", + configuration_name: Union[str, "_models.ConfigurationName"], + config_contract: "_models.ConfigData", **kwargs - ) -> "models.ConfigData": + ) -> "_models.ConfigData": """Create/Overwrite Azure Advisor configuration. Create/Overwrite Azure Advisor configuration and also delete all configurations of contained @@ -131,7 +131,7 @@ async def create_in_subscription( :rtype: ~azure.mgmt.advisor.models.ConfigData :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ConfigData"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigData"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -166,7 +166,7 @@ async def create_in_subscription( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ArmErrorResponse, response) + error = self._deserialize(_models.ArmErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ConfigData', pipeline_response) @@ -181,7 +181,7 @@ def list_by_resource_group( self, resource_group: str, **kwargs - ) -> AsyncIterable["models.ConfigurationListResult"]: + ) -> AsyncIterable["_models.ConfigurationListResult"]: """Retrieve Azure Advisor configurations. Retrieve Azure Advisor configurations. @@ -193,7 +193,7 @@ def list_by_resource_group( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.advisor.models.ConfigurationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ConfigurationListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigurationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -239,7 +239,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ArmErrorResponse, response) + error = self._deserialize(_models.ArmErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -252,11 +252,11 @@ async def get_next(next_link=None): async def create_in_resource_group( self, - configuration_name: Union[str, "models.ConfigurationName"], + configuration_name: Union[str, "_models.ConfigurationName"], resource_group: str, - config_contract: "models.ConfigData", + config_contract: "_models.ConfigData", **kwargs - ) -> "models.ConfigData": + ) -> "_models.ConfigData": """Create/Overwrite Azure Advisor configuration. Create/Overwrite Azure Advisor configuration. @@ -272,7 +272,7 @@ async def create_in_resource_group( :rtype: ~azure.mgmt.advisor.models.ConfigData :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ConfigData"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigData"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -308,7 +308,7 @@ async def create_in_resource_group( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ArmErrorResponse, response) + error = self._deserialize(_models.ArmErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ConfigData', pipeline_response) diff --git a/sdk/advisor/azure-mgmt-advisor/azure/mgmt/advisor/aio/operations/_operations.py b/sdk/advisor/azure-mgmt-advisor/azure/mgmt/advisor/aio/operations/_operations.py index 7e83da33ab56..3fe50c593ca2 100644 --- a/sdk/advisor/azure-mgmt-advisor/azure/mgmt/advisor/aio/operations/_operations.py +++ b/sdk/advisor/azure-mgmt-advisor/azure/mgmt/advisor/aio/operations/_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class Operations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -44,7 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: def list( self, **kwargs - ) -> AsyncIterable["models.OperationEntityListResult"]: + ) -> AsyncIterable["_models.OperationEntityListResult"]: """Lists all the available Advisor REST API operations. :keyword callable cls: A custom type or function that will be passed the direct response @@ -52,7 +52,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.advisor.models.OperationEntityListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.OperationEntityListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationEntityListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/advisor/azure-mgmt-advisor/azure/mgmt/advisor/aio/operations/_recommendation_metadata_operations.py b/sdk/advisor/azure-mgmt-advisor/azure/mgmt/advisor/aio/operations/_recommendation_metadata_operations.py index 5a49afaca00b..d27f76a07f7c 100644 --- a/sdk/advisor/azure-mgmt-advisor/azure/mgmt/advisor/aio/operations/_recommendation_metadata_operations.py +++ b/sdk/advisor/azure-mgmt-advisor/azure/mgmt/advisor/aio/operations/_recommendation_metadata_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class RecommendationMetadataOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -45,7 +45,7 @@ async def get( self, name: str, **kwargs - ) -> Union["models.MetadataEntity", "models.ARMErrorResponseBody"]: + ) -> Union["_models.MetadataEntity", "_models.ARMErrorResponseBody"]: """Gets the metadata entity. Gets the metadata entity. @@ -57,7 +57,7 @@ async def get( :rtype: ~azure.mgmt.advisor.models.MetadataEntity or ~azure.mgmt.advisor.models.ARMErrorResponseBody :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[Union["models.MetadataEntity", "models.ARMErrorResponseBody"]] + cls = kwargs.pop('cls', None) # type: ClsType[Union["_models.MetadataEntity", "_models.ARMErrorResponseBody"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -103,7 +103,7 @@ async def get( def list( self, **kwargs - ) -> AsyncIterable["models.MetadataEntityListResult"]: + ) -> AsyncIterable["_models.MetadataEntityListResult"]: """Gets the list of metadata entities. Gets the list of metadata entities. @@ -113,7 +113,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.advisor.models.MetadataEntityListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.MetadataEntityListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.MetadataEntityListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/advisor/azure-mgmt-advisor/azure/mgmt/advisor/aio/operations/_recommendations_operations.py b/sdk/advisor/azure-mgmt-advisor/azure/mgmt/advisor/aio/operations/_recommendations_operations.py index 9a6229b69ab3..2f99233dc3f7 100644 --- a/sdk/advisor/azure-mgmt-advisor/azure/mgmt/advisor/aio/operations/_recommendations_operations.py +++ b/sdk/advisor/azure-mgmt-advisor/azure/mgmt/advisor/aio/operations/_recommendations_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class RecommendationsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -150,7 +150,7 @@ def list( top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs - ) -> AsyncIterable["models.ResourceRecommendationBaseListResult"]: + ) -> AsyncIterable["_models.ResourceRecommendationBaseListResult"]: """Obtains cached recommendations for a subscription. The recommendations are generated or computed by invoking generateRecommendations. @@ -169,7 +169,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.advisor.models.ResourceRecommendationBaseListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceRecommendationBaseListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceRecommendationBaseListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -235,7 +235,7 @@ async def get( resource_uri: str, recommendation_id: str, **kwargs - ) -> "models.ResourceRecommendationBase": + ) -> "_models.ResourceRecommendationBase": """Obtains details of a cached recommendation. :param resource_uri: The fully qualified Azure Resource Manager identifier of the resource to @@ -248,7 +248,7 @@ async def get( :rtype: ~azure.mgmt.advisor.models.ResourceRecommendationBase :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceRecommendationBase"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceRecommendationBase"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/advisor/azure-mgmt-advisor/azure/mgmt/advisor/aio/operations/_suppressions_operations.py b/sdk/advisor/azure-mgmt-advisor/azure/mgmt/advisor/aio/operations/_suppressions_operations.py index 020d346cc514..99073a34d763 100644 --- a/sdk/advisor/azure-mgmt-advisor/azure/mgmt/advisor/aio/operations/_suppressions_operations.py +++ b/sdk/advisor/azure-mgmt-advisor/azure/mgmt/advisor/aio/operations/_suppressions_operations.py @@ -5,7 +5,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class SuppressionsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -47,7 +47,7 @@ async def get( recommendation_id: str, name: str, **kwargs - ) -> "models.SuppressionContract": + ) -> Union["_models.SuppressionContract", "_models.ArmErrorResponse"]: """Obtains the details of a suppression. :param resource_uri: The fully qualified Azure Resource Manager identifier of the resource to @@ -58,11 +58,11 @@ async def get( :param name: The name of the suppression. :type name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SuppressionContract, or the result of cls(response) - :rtype: ~azure.mgmt.advisor.models.SuppressionContract + :return: SuppressionContract or ArmErrorResponse, or the result of cls(response) + :rtype: ~azure.mgmt.advisor.models.SuppressionContract or ~azure.mgmt.advisor.models.ArmErrorResponse :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.SuppressionContract"] + cls = kwargs.pop('cls', None) # type: ClsType[Union["_models.SuppressionContract", "_models.ArmErrorResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -91,11 +91,15 @@ async def get( pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [200, 404]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('SuppressionContract', pipeline_response) + if response.status_code == 200: + deserialized = self._deserialize('SuppressionContract', pipeline_response) + + if response.status_code == 404: + deserialized = self._deserialize('ArmErrorResponse', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) @@ -108,9 +112,9 @@ async def create( resource_uri: str, recommendation_id: str, name: str, - suppression_contract: "models.SuppressionContract", + suppression_contract: "_models.SuppressionContract", **kwargs - ) -> "models.SuppressionContract": + ) -> Union["_models.SuppressionContract", "_models.ArmErrorResponse"]: """Enables the snoozed or dismissed attribute of a recommendation. The snoozed or dismissed attribute is referred to as a suppression. Use this API to create or update the snoozed or dismissed status of a recommendation. @@ -126,11 +130,11 @@ async def create( duration. :type suppression_contract: ~azure.mgmt.advisor.models.SuppressionContract :keyword callable cls: A custom type or function that will be passed the direct response - :return: SuppressionContract, or the result of cls(response) - :rtype: ~azure.mgmt.advisor.models.SuppressionContract + :return: SuppressionContract or ArmErrorResponse, or the result of cls(response) + :rtype: ~azure.mgmt.advisor.models.SuppressionContract or ~azure.mgmt.advisor.models.ArmErrorResponse :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.SuppressionContract"] + cls = kwargs.pop('cls', None) # type: ClsType[Union["_models.SuppressionContract", "_models.ArmErrorResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -164,11 +168,15 @@ async def create( pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [200, 404]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('SuppressionContract', pipeline_response) + if response.status_code == 200: + deserialized = self._deserialize('SuppressionContract', pipeline_response) + + if response.status_code == 404: + deserialized = self._deserialize('ArmErrorResponse', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) @@ -239,7 +247,7 @@ def list( top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs - ) -> AsyncIterable["models.SuppressionContractListResult"]: + ) -> AsyncIterable["_models.SuppressionContractListResult"]: """Retrieves the list of snoozed or dismissed suppressions for a subscription. The snoozed or dismissed attribute of a recommendation is referred to as a suppression. @@ -252,7 +260,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.advisor.models.SuppressionContractListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.SuppressionContractListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SuppressionContractListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/advisor/azure-mgmt-advisor/azure/mgmt/advisor/models/_models.py b/sdk/advisor/azure-mgmt-advisor/azure/mgmt/advisor/models/_models.py index 940582fd3c10..c61d143176dd 100644 --- a/sdk/advisor/azure-mgmt-advisor/azure/mgmt/advisor/models/_models.py +++ b/sdk/advisor/azure-mgmt-advisor/azure/mgmt/advisor/models/_models.py @@ -536,12 +536,15 @@ class SuppressionContract(Resource): :type suppression_id: str :param ttl: The duration for which the suppression is valid. :type ttl: str + :ivar expiration_time_stamp: Gets or sets the expiration time stamp. + :vartype expiration_time_stamp: ~datetime.datetime """ _validation = { 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, + 'expiration_time_stamp': {'readonly': True}, } _attribute_map = { @@ -550,6 +553,7 @@ class SuppressionContract(Resource): 'type': {'key': 'type', 'type': 'str'}, 'suppression_id': {'key': 'properties.suppressionId', 'type': 'str'}, 'ttl': {'key': 'properties.ttl', 'type': 'str'}, + 'expiration_time_stamp': {'key': 'properties.expirationTimeStamp', 'type': 'iso-8601'}, } def __init__( @@ -559,6 +563,7 @@ def __init__( super(SuppressionContract, self).__init__(**kwargs) self.suppression_id = kwargs.get('suppression_id', None) self.ttl = kwargs.get('ttl', None) + self.expiration_time_stamp = None class SuppressionContractListResult(msrest.serialization.Model): diff --git a/sdk/advisor/azure-mgmt-advisor/azure/mgmt/advisor/models/_models_py3.py b/sdk/advisor/azure-mgmt-advisor/azure/mgmt/advisor/models/_models_py3.py index db504de2b6c1..476150e82f26 100644 --- a/sdk/advisor/azure-mgmt-advisor/azure/mgmt/advisor/models/_models_py3.py +++ b/sdk/advisor/azure-mgmt-advisor/azure/mgmt/advisor/models/_models_py3.py @@ -607,12 +607,15 @@ class SuppressionContract(Resource): :type suppression_id: str :param ttl: The duration for which the suppression is valid. :type ttl: str + :ivar expiration_time_stamp: Gets or sets the expiration time stamp. + :vartype expiration_time_stamp: ~datetime.datetime """ _validation = { 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, + 'expiration_time_stamp': {'readonly': True}, } _attribute_map = { @@ -621,6 +624,7 @@ class SuppressionContract(Resource): 'type': {'key': 'type', 'type': 'str'}, 'suppression_id': {'key': 'properties.suppressionId', 'type': 'str'}, 'ttl': {'key': 'properties.ttl', 'type': 'str'}, + 'expiration_time_stamp': {'key': 'properties.expirationTimeStamp', 'type': 'iso-8601'}, } def __init__( @@ -633,6 +637,7 @@ def __init__( super(SuppressionContract, self).__init__(**kwargs) self.suppression_id = suppression_id self.ttl = ttl + self.expiration_time_stamp = None class SuppressionContractListResult(msrest.serialization.Model): diff --git a/sdk/advisor/azure-mgmt-advisor/azure/mgmt/advisor/operations/_configurations_operations.py b/sdk/advisor/azure-mgmt-advisor/azure/mgmt/advisor/operations/_configurations_operations.py index 047b251c788c..12a83d42a93b 100644 --- a/sdk/advisor/azure-mgmt-advisor/azure/mgmt/advisor/operations/_configurations_operations.py +++ b/sdk/advisor/azure-mgmt-advisor/azure/mgmt/advisor/operations/_configurations_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class ConfigurationsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -49,7 +49,7 @@ def list_by_subscription( self, **kwargs # type: Any ): - # type: (...) -> Iterable["models.ConfigurationListResult"] + # type: (...) -> Iterable["_models.ConfigurationListResult"] """Retrieve Azure Advisor configurations. Retrieve Azure Advisor configurations and also retrieve configurations of contained resource @@ -60,7 +60,7 @@ def list_by_subscription( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.advisor.models.ConfigurationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ConfigurationListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigurationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -105,7 +105,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ArmErrorResponse, response) + error = self._deserialize(_models.ArmErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -118,11 +118,11 @@ def get_next(next_link=None): def create_in_subscription( self, - configuration_name, # type: Union[str, "models.ConfigurationName"] - config_contract, # type: "models.ConfigData" + configuration_name, # type: Union[str, "_models.ConfigurationName"] + config_contract, # type: "_models.ConfigData" **kwargs # type: Any ): - # type: (...) -> "models.ConfigData" + # type: (...) -> "_models.ConfigData" """Create/Overwrite Azure Advisor configuration. Create/Overwrite Azure Advisor configuration and also delete all configurations of contained @@ -137,7 +137,7 @@ def create_in_subscription( :rtype: ~azure.mgmt.advisor.models.ConfigData :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ConfigData"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigData"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -172,7 +172,7 @@ def create_in_subscription( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ArmErrorResponse, response) + error = self._deserialize(_models.ArmErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ConfigData', pipeline_response) @@ -188,7 +188,7 @@ def list_by_resource_group( resource_group, # type: str **kwargs # type: Any ): - # type: (...) -> Iterable["models.ConfigurationListResult"] + # type: (...) -> Iterable["_models.ConfigurationListResult"] """Retrieve Azure Advisor configurations. Retrieve Azure Advisor configurations. @@ -200,7 +200,7 @@ def list_by_resource_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.advisor.models.ConfigurationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ConfigurationListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigurationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -246,7 +246,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ArmErrorResponse, response) + error = self._deserialize(_models.ArmErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -259,12 +259,12 @@ def get_next(next_link=None): def create_in_resource_group( self, - configuration_name, # type: Union[str, "models.ConfigurationName"] + configuration_name, # type: Union[str, "_models.ConfigurationName"] resource_group, # type: str - config_contract, # type: "models.ConfigData" + config_contract, # type: "_models.ConfigData" **kwargs # type: Any ): - # type: (...) -> "models.ConfigData" + # type: (...) -> "_models.ConfigData" """Create/Overwrite Azure Advisor configuration. Create/Overwrite Azure Advisor configuration. @@ -280,7 +280,7 @@ def create_in_resource_group( :rtype: ~azure.mgmt.advisor.models.ConfigData :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ConfigData"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigData"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -316,7 +316,7 @@ def create_in_resource_group( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ArmErrorResponse, response) + error = self._deserialize(_models.ArmErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ConfigData', pipeline_response) diff --git a/sdk/advisor/azure-mgmt-advisor/azure/mgmt/advisor/operations/_operations.py b/sdk/advisor/azure-mgmt-advisor/azure/mgmt/advisor/operations/_operations.py index 8ba879ff979c..f2745798f193 100644 --- a/sdk/advisor/azure-mgmt-advisor/azure/mgmt/advisor/operations/_operations.py +++ b/sdk/advisor/azure-mgmt-advisor/azure/mgmt/advisor/operations/_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class Operations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -49,7 +49,7 @@ def list( self, **kwargs # type: Any ): - # type: (...) -> Iterable["models.OperationEntityListResult"] + # type: (...) -> Iterable["_models.OperationEntityListResult"] """Lists all the available Advisor REST API operations. :keyword callable cls: A custom type or function that will be passed the direct response @@ -57,7 +57,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.advisor.models.OperationEntityListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.OperationEntityListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationEntityListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/advisor/azure-mgmt-advisor/azure/mgmt/advisor/operations/_recommendation_metadata_operations.py b/sdk/advisor/azure-mgmt-advisor/azure/mgmt/advisor/operations/_recommendation_metadata_operations.py index 587af4ac3dca..aa850acf7984 100644 --- a/sdk/advisor/azure-mgmt-advisor/azure/mgmt/advisor/operations/_recommendation_metadata_operations.py +++ b/sdk/advisor/azure-mgmt-advisor/azure/mgmt/advisor/operations/_recommendation_metadata_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class RecommendationMetadataOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -50,7 +50,7 @@ def get( name, # type: str **kwargs # type: Any ): - # type: (...) -> Union["models.MetadataEntity", "models.ARMErrorResponseBody"] + # type: (...) -> Union["_models.MetadataEntity", "_models.ARMErrorResponseBody"] """Gets the metadata entity. Gets the metadata entity. @@ -62,7 +62,7 @@ def get( :rtype: ~azure.mgmt.advisor.models.MetadataEntity or ~azure.mgmt.advisor.models.ARMErrorResponseBody :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[Union["models.MetadataEntity", "models.ARMErrorResponseBody"]] + cls = kwargs.pop('cls', None) # type: ClsType[Union["_models.MetadataEntity", "_models.ARMErrorResponseBody"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -109,7 +109,7 @@ def list( self, **kwargs # type: Any ): - # type: (...) -> Iterable["models.MetadataEntityListResult"] + # type: (...) -> Iterable["_models.MetadataEntityListResult"] """Gets the list of metadata entities. Gets the list of metadata entities. @@ -119,7 +119,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.advisor.models.MetadataEntityListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.MetadataEntityListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.MetadataEntityListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/advisor/azure-mgmt-advisor/azure/mgmt/advisor/operations/_recommendations_operations.py b/sdk/advisor/azure-mgmt-advisor/azure/mgmt/advisor/operations/_recommendations_operations.py index 4be960b3382f..13b4cf0fba58 100644 --- a/sdk/advisor/azure-mgmt-advisor/azure/mgmt/advisor/operations/_recommendations_operations.py +++ b/sdk/advisor/azure-mgmt-advisor/azure/mgmt/advisor/operations/_recommendations_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class RecommendationsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -157,7 +157,7 @@ def list( skip_token=None, # type: Optional[str] **kwargs # type: Any ): - # type: (...) -> Iterable["models.ResourceRecommendationBaseListResult"] + # type: (...) -> Iterable["_models.ResourceRecommendationBaseListResult"] """Obtains cached recommendations for a subscription. The recommendations are generated or computed by invoking generateRecommendations. @@ -176,7 +176,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.advisor.models.ResourceRecommendationBaseListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceRecommendationBaseListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceRecommendationBaseListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -243,7 +243,7 @@ def get( recommendation_id, # type: str **kwargs # type: Any ): - # type: (...) -> "models.ResourceRecommendationBase" + # type: (...) -> "_models.ResourceRecommendationBase" """Obtains details of a cached recommendation. :param resource_uri: The fully qualified Azure Resource Manager identifier of the resource to @@ -256,7 +256,7 @@ def get( :rtype: ~azure.mgmt.advisor.models.ResourceRecommendationBase :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceRecommendationBase"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceRecommendationBase"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -270,9 +270,7 @@ def get( 'resourceUri': self._serialize.url("resource_uri", resource_uri, 'str'), 'recommendationId': self._serialize.url("recommendation_id", recommendation_id, 'str'), } - print(path_format_arguments) url = self._client.format_url(url, **path_format_arguments) - print(url) # Construct parameters query_parameters = {} # type: Dict[str, Any] diff --git a/sdk/advisor/azure-mgmt-advisor/azure/mgmt/advisor/operations/_suppressions_operations.py b/sdk/advisor/azure-mgmt-advisor/azure/mgmt/advisor/operations/_suppressions_operations.py index ee4cae93680b..e6264f43763b 100644 --- a/sdk/advisor/azure-mgmt-advisor/azure/mgmt/advisor/operations/_suppressions_operations.py +++ b/sdk/advisor/azure-mgmt-advisor/azure/mgmt/advisor/operations/_suppressions_operations.py @@ -14,11 +14,11 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -37,7 +37,7 @@ class SuppressionsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -52,7 +52,7 @@ def get( name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.SuppressionContract" + # type: (...) -> Union["_models.SuppressionContract", "_models.ArmErrorResponse"] """Obtains the details of a suppression. :param resource_uri: The fully qualified Azure Resource Manager identifier of the resource to @@ -63,11 +63,11 @@ def get( :param name: The name of the suppression. :type name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SuppressionContract, or the result of cls(response) - :rtype: ~azure.mgmt.advisor.models.SuppressionContract + :return: SuppressionContract or ArmErrorResponse, or the result of cls(response) + :rtype: ~azure.mgmt.advisor.models.SuppressionContract or ~azure.mgmt.advisor.models.ArmErrorResponse :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.SuppressionContract"] + cls = kwargs.pop('cls', None) # type: ClsType[Union["_models.SuppressionContract", "_models.ArmErrorResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -96,11 +96,15 @@ def get( pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [200, 404]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('SuppressionContract', pipeline_response) + if response.status_code == 200: + deserialized = self._deserialize('SuppressionContract', pipeline_response) + + if response.status_code == 404: + deserialized = self._deserialize('ArmErrorResponse', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) @@ -113,10 +117,10 @@ def create( resource_uri, # type: str recommendation_id, # type: str name, # type: str - suppression_contract, # type: "models.SuppressionContract" + suppression_contract, # type: "_models.SuppressionContract" **kwargs # type: Any ): - # type: (...) -> "models.SuppressionContract" + # type: (...) -> Union["_models.SuppressionContract", "_models.ArmErrorResponse"] """Enables the snoozed or dismissed attribute of a recommendation. The snoozed or dismissed attribute is referred to as a suppression. Use this API to create or update the snoozed or dismissed status of a recommendation. @@ -132,11 +136,11 @@ def create( duration. :type suppression_contract: ~azure.mgmt.advisor.models.SuppressionContract :keyword callable cls: A custom type or function that will be passed the direct response - :return: SuppressionContract, or the result of cls(response) - :rtype: ~azure.mgmt.advisor.models.SuppressionContract + :return: SuppressionContract or ArmErrorResponse, or the result of cls(response) + :rtype: ~azure.mgmt.advisor.models.SuppressionContract or ~azure.mgmt.advisor.models.ArmErrorResponse :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.SuppressionContract"] + cls = kwargs.pop('cls', None) # type: ClsType[Union["_models.SuppressionContract", "_models.ArmErrorResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -170,11 +174,15 @@ def create( pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [200, 404]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('SuppressionContract', pipeline_response) + if response.status_code == 200: + deserialized = self._deserialize('SuppressionContract', pipeline_response) + + if response.status_code == 404: + deserialized = self._deserialize('ArmErrorResponse', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) @@ -247,7 +255,7 @@ def list( skip_token=None, # type: Optional[str] **kwargs # type: Any ): - # type: (...) -> Iterable["models.SuppressionContractListResult"] + # type: (...) -> Iterable["_models.SuppressionContractListResult"] """Retrieves the list of snoozed or dismissed suppressions for a subscription. The snoozed or dismissed attribute of a recommendation is referred to as a suppression. @@ -260,7 +268,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.advisor.models.SuppressionContractListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.SuppressionContractListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SuppressionContractListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/advisor/azure-mgmt-advisor/tests/recordings/test_mgmt_advisor.test_configurations_resourcegroup.yaml b/sdk/advisor/azure-mgmt-advisor/tests/recordings/test_mgmt_advisor.test_configurations_resourcegroup.yaml index a1a836a136de..4209b79ed972 100644 --- a/sdk/advisor/azure-mgmt-advisor/tests/recordings/test_mgmt_advisor.test_configurations_resourcegroup.yaml +++ b/sdk/advisor/azure-mgmt-advisor/tests/recordings/test_mgmt_advisor.test_configurations_resourcegroup.yaml @@ -13,7 +13,7 @@ interactions: Content-Type: - application/json User-Agent: - - azsdk-python-mgmt-advisor/9.0.0b1 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + - azsdk-python-mgmt-advisor/9.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) method: PUT uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_advisor_test_configurations_resourcegroup27471558/providers/Microsoft.Advisor/configurations/default?api-version=2020-01-01 response: @@ -27,7 +27,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Wed, 04 Nov 2020 02:48:53 GMT + - Tue, 22 Dec 2020 02:49:36 GMT expires: - '-1' pragma: @@ -57,7 +57,7 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-mgmt-advisor/9.0.0b1 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + - azsdk-python-mgmt-advisor/9.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_advisor_test_configurations_resourcegroup27471558/providers/Microsoft.Advisor/configurations?api-version=2020-01-01 response: @@ -71,7 +71,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Wed, 04 Nov 2020 02:48:53 GMT + - Tue, 22 Dec 2020 02:49:37 GMT expires: - '-1' pragma: @@ -105,7 +105,7 @@ interactions: Content-Type: - application/json User-Agent: - - azsdk-python-mgmt-advisor/9.0.0b1 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + - azsdk-python-mgmt-advisor/9.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) method: PUT uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_advisor_test_configurations_resourcegroup27471558/providers/Microsoft.Advisor/configurations/default?api-version=2020-01-01 response: @@ -119,7 +119,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Wed, 04 Nov 2020 02:48:54 GMT + - Tue, 22 Dec 2020 02:49:37 GMT expires: - '-1' pragma: @@ -149,7 +149,7 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-mgmt-advisor/9.0.0b1 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + - azsdk-python-mgmt-advisor/9.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_advisor_test_configurations_resourcegroup27471558/providers/Microsoft.Advisor/configurations?api-version=2020-01-01 response: @@ -163,7 +163,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Wed, 04 Nov 2020 02:48:54 GMT + - Tue, 22 Dec 2020 02:49:37 GMT expires: - '-1' pragma: diff --git a/sdk/advisor/azure-mgmt-advisor/tests/recordings/test_mgmt_advisor.test_generate_recommendations.yaml b/sdk/advisor/azure-mgmt-advisor/tests/recordings/test_mgmt_advisor.test_generate_recommendations.yaml index 3fa6c7f8c7c8..d28df2de4168 100644 --- a/sdk/advisor/azure-mgmt-advisor/tests/recordings/test_mgmt_advisor.test_generate_recommendations.yaml +++ b/sdk/advisor/azure-mgmt-advisor/tests/recordings/test_mgmt_advisor.test_generate_recommendations.yaml @@ -11,7 +11,7 @@ interactions: Content-Length: - '0' User-Agent: - - azsdk-python-mgmt-advisor/9.0.0b1 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + - azsdk-python-mgmt-advisor/9.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) method: POST uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Advisor/generateRecommendations?api-version=2020-01-01 response: @@ -23,11 +23,11 @@ interactions: content-length: - '0' date: - - Tue, 03 Nov 2020 08:39:13 GMT + - Tue, 22 Dec 2020 02:49:41 GMT expires: - '-1' location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Advisor/generateRecommendations/d9c3ceef-31e2-4875-9834-893f820c9e95?api-version=2020-01-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Advisor/generateRecommendations/6364424e-6d7a-438c-9825-7243edf47aa4?api-version=2020-01-01 pragma: - no-cache server: @@ -51,7 +51,7 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-mgmt-advisor/9.0.0b1 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + - azsdk-python-mgmt-advisor/9.0.0 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Advisor/generateRecommendations/00000000-0000-0000-0000-000000000000?api-version=2020-01-01 response: @@ -61,7 +61,7 @@ interactions: cache-control: - no-cache date: - - Tue, 03 Nov 2020 08:39:13 GMT + - Tue, 22 Dec 2020 02:49:42 GMT expires: - '-1' pragma: diff --git a/sdk/advisor/azure-mgmt-advisor/tests/recordings/test_mgmt_advisor.test_suppressions.yaml b/sdk/advisor/azure-mgmt-advisor/tests/recordings/test_mgmt_advisor.test_suppressions.yaml deleted file mode 100644 index c0f5428a2252..000000000000 --- a/sdk/advisor/azure-mgmt-advisor/tests/recordings/test_mgmt_advisor.test_suppressions.yaml +++ /dev/null @@ -1,110 +0,0 @@ -interactions: -- request: - body: null - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - User-Agent: - - azsdk-python-mgmt-advisor/9.0.0b1 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) - method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Advisor/recommendations?api-version=2020-01-01 - response: - body: - string: '{"value":[{"properties":{"category":"Security","impact":"High","impactedField":"Microsoft.Subscriptions/subscriptions","impactedValue":"00000000-0000-0000-0000-000000000000","lastUpdated":"2020-11-02T20:25:00.6196562Z","recommendationTypeId":"6f90a6d6-d4d6-0794-0ec1-98fa77878c2e","shortDescription":{"problem":"A - maximum of 3 owners should be designated for your subscription","solution":"A - maximum of 3 owners should be designated for your subscription"},"extendedProperties":{"assessmentKey":"6f90a6d6-d4d6-0794-0ec1-98fa77878c2e","score":"5"},"resourceMetadata":{"resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000","source":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Security/assessments/6f90a6d6-d4d6-0794-0ec1-98fa77878c2e"}},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Advisor/recommendations/e0d4cd66-48b7-343e-bf56-d97a06d80c18","type":"Microsoft.Advisor/recommendations","name":"e0d4cd66-48b7-343e-bf56-d97a06d80c18"},{"properties":{"category":"Security","impact":"High","impactedField":"Microsoft.Subscriptions/subscriptions","impactedValue":"00000000-0000-0000-0000-000000000000","lastUpdated":"2020-11-02T20:25:00.6196562Z","recommendationTypeId":"86ea1a79-29d3-4eac-a9f4-3541ace4e718","shortDescription":{"problem":"Azure - Defender for Kubernetes should be enabled","solution":"Azure Defender for - Kubernetes should be enabled"},"extendedProperties":{"assessmentKey":"86ea1a79-29d3-4eac-a9f4-3541ace4e718","score":"0"},"resourceMetadata":{"resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000","source":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Security/assessments/86ea1a79-29d3-4eac-a9f4-3541ace4e718"}},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Advisor/recommendations/c089755a-22a5-880b-9950-8140d427e3b3","type":"Microsoft.Advisor/recommendations","name":"c089755a-22a5-880b-9950-8140d427e3b3"},{"properties":{"category":"Security","impact":"High","impactedField":"Microsoft.HybridCompute/machines","impactedValue":"myvm","lastUpdated":"2020-11-02T20:25:00.6196562Z","recommendationTypeId":"720a3e77-0b9a-4fa9-98b6-ddf0fd7e32c1","shortDescription":{"problem":"Log - Analytics agent should be installed on your Linux-based Azure Arc machines","solution":"Log - Analytics agent should be installed on your Linux-based Azure Arc machines"},"extendedProperties":{"assessmentKey":"720a3e77-0b9a-4fa9-98b6-ddf0fd7e32c1","score":"30"},"resourceMetadata":{"resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/qiaozhatest/providers/microsoft.hybridcompute/machines/myvm","source":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/qiaozhatest/providers/microsoft.hybridcompute/machines/myvm/providers/Microsoft.Security/assessments/720a3e77-0b9a-4fa9-98b6-ddf0fd7e32c1"}},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/qiaozhatest/providers/microsoft.hybridcompute/machines/myvm/providers/Microsoft.Advisor/recommendations/1bdf57b3-f070-e9e3-0ea1-73171c63e0f6","type":"Microsoft.Advisor/recommendations","name":"1bdf57b3-f070-e9e3-0ea1-73171c63e0f6"},{"properties":{"category":"Security","impact":"High","impactedField":"Microsoft.Subscriptions/subscriptions","impactedValue":"00000000-0000-0000-0000-000000000000","lastUpdated":"2020-11-02T20:25:00.6196562Z","recommendationTypeId":"6ac66a74-761f-4a59-928a-d373eea3f028","shortDescription":{"problem":"Azure - Defender for SQL servers on machines should be enabled","solution":"Azure - Defender for SQL servers on machines should be enabled"},"extendedProperties":{"assessmentKey":"6ac66a74-761f-4a59-928a-d373eea3f028","score":"0"},"resourceMetadata":{"resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000","source":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Security/assessments/6ac66a74-761f-4a59-928a-d373eea3f028"}},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Advisor/recommendations/0d284250-e42b-f42a-f2d3-88551efbc4d2","type":"Microsoft.Advisor/recommendations","name":"0d284250-e42b-f42a-f2d3-88551efbc4d2"},{"properties":{"category":"Security","impact":"High","impactedField":"Microsoft.Subscriptions/subscriptions","impactedValue":"00000000-0000-0000-0000-000000000000","lastUpdated":"2020-11-02T20:25:00.6196562Z","recommendationTypeId":"53572822-d3fc-4363-bfb9-248645841612","shortDescription":{"problem":"Azure - Defender for container registries should be enabled","solution":"Azure Defender - for container registries should be enabled"},"extendedProperties":{"assessmentKey":"53572822-d3fc-4363-bfb9-248645841612","score":"0"},"resourceMetadata":{"resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000","source":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Security/assessments/53572822-d3fc-4363-bfb9-248645841612"}},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Advisor/recommendations/d4e0e1d0-661b-dee2-3340-3219ddc0546a","type":"Microsoft.Advisor/recommendations","name":"d4e0e1d0-661b-dee2-3340-3219ddc0546a"},{"properties":{"category":"Security","impact":"High","impactedField":"Microsoft.Subscriptions/subscriptions","impactedValue":"00000000-0000-0000-0000-000000000000","lastUpdated":"2020-11-02T20:25:00.6196562Z","recommendationTypeId":"b1af52e4-e968-4e2b-b6d0-6736c9651f0a","shortDescription":{"problem":"Azure - Defender for Key Vault should be enabled","solution":"Azure Defender for Key - Vault should be enabled"},"extendedProperties":{"assessmentKey":"b1af52e4-e968-4e2b-b6d0-6736c9651f0a","score":"0"},"resourceMetadata":{"resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000","source":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Security/assessments/b1af52e4-e968-4e2b-b6d0-6736c9651f0a"}},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Advisor/recommendations/9ee6cd6a-795f-28b7-bc1e-0a7ebc569be0","type":"Microsoft.Advisor/recommendations","name":"9ee6cd6a-795f-28b7-bc1e-0a7ebc569be0"},{"properties":{"category":"Security","impact":"High","impactedField":"Microsoft.Subscriptions/subscriptions","impactedValue":"00000000-0000-0000-0000-000000000000","lastUpdated":"2020-11-02T20:25:00.6196562Z","recommendationTypeId":"58d72d9d-0310-4792-9a3b-6dd111093cdb","shortDescription":{"problem":"Azure - Defender for Azure SQL Database servers should be enabled","solution":"Azure - Defender for Azure SQL Database servers should be enabled"},"extendedProperties":{"assessmentKey":"58d72d9d-0310-4792-9a3b-6dd111093cdb","score":"0"},"resourceMetadata":{"resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000","source":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Security/assessments/58d72d9d-0310-4792-9a3b-6dd111093cdb"}},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Advisor/recommendations/464201b5-1b5f-ebd0-21bf-e229fbb47f8f","type":"Microsoft.Advisor/recommendations","name":"464201b5-1b5f-ebd0-21bf-e229fbb47f8f"},{"properties":{"category":"Security","impact":"Medium","impactedField":"Microsoft.Compute/virtualMachines","impactedValue":"myvm","lastUpdated":"2020-11-02T20:25:00.6353195Z","recommendationTypeId":"ffff0522-1e88-47fc-8382-2a80ba848f5d","shortDescription":{"problem":"Enable - a vulnerability assessment solution on virtual machines","solution":"Enable - a vulnerability assessment solution on virtual machines"},"extendedProperties":{"assessmentKey":"ffff0522-1e88-47fc-8382-2a80ba848f5d","score":"30"},"resourceMetadata":{"resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/qiaozhatest/providers/microsoft.hybridcompute/machines/myvm","source":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/qiaozhatest/providers/Microsoft.HybridCompute/machines/MyVm/providers/Microsoft.Security/assessments/ffff0522-1e88-47fc-8382-2a80ba848f5d"}},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/qiaozhatest/providers/microsoft.hybridcompute/machines/myvm/providers/Microsoft.Advisor/recommendations/c2242fe5-86bb-d56b-6974-6461088a93d4","type":"Microsoft.Advisor/recommendations","name":"c2242fe5-86bb-d56b-6974-6461088a93d4"},{"properties":{"category":"Security","impact":"Low","impactedField":"Microsoft.ServiceBus/namespaces","impactedValue":"mynamespacexxyyzsecond","lastUpdated":"2020-11-02T20:25:00.6196562Z","recommendationTypeId":"f19ab7d9-5ff2-f8fd-ab3b-0bf95dcb6889","shortDescription":{"problem":"Diagnostic - logs in Service Bus should be enabled","solution":"Diagnostic logs in Service - Bus should be enabled"},"extendedProperties":{"assessmentKey":"f19ab7d9-5ff2-f8fd-ab3b-0bf95dcb6889","score":"5"},"resourceMetadata":{"resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/iyljd2wtoqh43dern43sawzmqxkeari3bcqiadgfste4outj7cdmmslvr4yfw2vmrsqeiogmitj/providers/microsoft.servicebus/namespaces/mynamespacexxyyzsecond","source":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/iyljd2wtoqh43dern43sawzmqxkeari3bcqiadgfste4outj7cdmmslvr4yfw2vmrsqeiogmitj/providers/microsoft.servicebus/namespaces/mynamespacexxyyzsecond/providers/Microsoft.Security/assessments/f19ab7d9-5ff2-f8fd-ab3b-0bf95dcb6889"}},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/iyljd2wtoqh43dern43sawzmqxkeari3bcqiadgfste4outj7cdmmslvr4yfw2vmrsqeiogmitj/providers/microsoft.servicebus/namespaces/mynamespacexxyyzsecond/providers/Microsoft.Advisor/recommendations/b9ee3ad3-2625-496d-55f2-de464001104d","type":"Microsoft.Advisor/recommendations","name":"b9ee3ad3-2625-496d-55f2-de464001104d"},{"properties":{"category":"Security","impact":"Low","impactedField":"Microsoft.ServiceBus/namespaces","impactedValue":"mynamespacexxyyz","lastUpdated":"2020-11-02T20:25:00.6196562Z","recommendationTypeId":"f19ab7d9-5ff2-f8fd-ab3b-0bf95dcb6889","shortDescription":{"problem":"Diagnostic - logs in Service Bus should be enabled","solution":"Diagnostic logs in Service - Bus should be enabled"},"extendedProperties":{"assessmentKey":"f19ab7d9-5ff2-f8fd-ab3b-0bf95dcb6889","score":"5"},"resourceMetadata":{"resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/iyljd2wtoqh43dern43sawzmqxkeari3bcqiadgfste4outj7cdmmslvr4yfw2vmrsqeiogmitj/providers/microsoft.servicebus/namespaces/mynamespacexxyyz","source":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/iyljd2wtoqh43dern43sawzmqxkeari3bcqiadgfste4outj7cdmmslvr4yfw2vmrsqeiogmitj/providers/microsoft.servicebus/namespaces/mynamespacexxyyz/providers/Microsoft.Security/assessments/f19ab7d9-5ff2-f8fd-ab3b-0bf95dcb6889"}},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/iyljd2wtoqh43dern43sawzmqxkeari3bcqiadgfste4outj7cdmmslvr4yfw2vmrsqeiogmitj/providers/microsoft.servicebus/namespaces/mynamespacexxyyz/providers/Microsoft.Advisor/recommendations/2aac2383-db35-6e1f-f28b-5f46cb269efe","type":"Microsoft.Advisor/recommendations","name":"2aac2383-db35-6e1f-f28b-5f46cb269efe"},{"properties":{"category":"Security","impact":"Low","impactedField":"Microsoft.EventHub/namespaces","impactedValue":"mynamespacexxyyzzy","lastUpdated":"2020-11-02T20:25:00.6196562Z","recommendationTypeId":"1597605a-0faf-5860-eb74-462ae2e9fc21","shortDescription":{"problem":"Diagnostic - logs in Event Hub should be enabled","solution":"Diagnostic logs in Event - Hub should be enabled"},"extendedProperties":{"assessmentKey":"1597605a-0faf-5860-eb74-462ae2e9fc21","score":"5"},"resourceMetadata":{"resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/test_cli_mgmt_servicebus_namespace_test_migration_configsa9a51771/providers/microsoft.eventhub/namespaces/mynamespacexxyyzzy","source":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/test_cli_mgmt_servicebus_namespace_test_migration_configsa9a51771/providers/microsoft.eventhub/namespaces/mynamespacexxyyzzy/providers/Microsoft.Security/assessments/1597605a-0faf-5860-eb74-462ae2e9fc21"}},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/test_cli_mgmt_servicebus_namespace_test_migration_configsa9a51771/providers/microsoft.eventhub/namespaces/mynamespacexxyyzzy/providers/Microsoft.Advisor/recommendations/62625752-71ea-6efb-183a-83e95d005ac0","type":"Microsoft.Advisor/recommendations","name":"62625752-71ea-6efb-183a-83e95d005ac0"},{"properties":{"category":"Security","impact":"Low","impactedField":"Microsoft.EventHub/namespaces","impactedValue":"mynamespacexxyyzzykk","lastUpdated":"2020-11-02T20:25:00.6196562Z","recommendationTypeId":"1597605a-0faf-5860-eb74-462ae2e9fc21","shortDescription":{"problem":"Diagnostic - logs in Event Hub should be enabled","solution":"Diagnostic logs in Event - Hub should be enabled"},"extendedProperties":{"assessmentKey":"1597605a-0faf-5860-eb74-462ae2e9fc21","score":"5"},"resourceMetadata":{"resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/7vx5onejribdkm3bpke5mddlz57worfeu7edc4sdd5xec2dng2m4hhit6yy7d5u6asotq6vmh6a/providers/microsoft.eventhub/namespaces/mynamespacexxyyzzykk","source":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/7vx5onejribdkm3bpke5mddlz57worfeu7edc4sdd5xec2dng2m4hhit6yy7d5u6asotq6vmh6a/providers/microsoft.eventhub/namespaces/mynamespacexxyyzzykk/providers/Microsoft.Security/assessments/1597605a-0faf-5860-eb74-462ae2e9fc21"}},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/7vx5onejribdkm3bpke5mddlz57worfeu7edc4sdd5xec2dng2m4hhit6yy7d5u6asotq6vmh6a/providers/microsoft.eventhub/namespaces/mynamespacexxyyzzykk/providers/Microsoft.Advisor/recommendations/c5ffe929-3d60-3b49-eb44-05add20a8e37","type":"Microsoft.Advisor/recommendations","name":"c5ffe929-3d60-3b49-eb44-05add20a8e37"}]}' - headers: - cache-control: - - no-cache - content-length: - - '13844' - content-type: - - application/json; charset=utf-8 - date: - - Tue, 03 Nov 2020 08:41:40 GMT - expires: - - '-1' - pragma: - - no-cache - server: - - Microsoft-HTTPAPI/2.0 - strict-transport-security: - - max-age=31536000; includeSubDomains - transfer-encoding: - - chunked - vary: - - Accept-Encoding - x-content-type-options: - - nosniff - x-ms-ratelimit-remaining-subscription-resource-requests: - - '599' - status: - code: 200 - message: OK -- request: - body: null - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - User-Agent: - - azsdk-python-mgmt-advisor/9.0.0b1 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) - method: GET - uri: https://management.azure.com/%2Fsubscriptions%2F00000000-0000-0000-0000-000000000000%2Fresourcegroups%2F7vx5onejribdkm3bpke5mddlz57worfeu7edc4sdd5xec2dng2m4hhit6yy7d5u6asotq6vmh6a%2Fproviders%2Fmicrosoft.eventhub%2Fnamespaces%2Fmynamespacexxyyzzykk/providers/Microsoft.Advisor/recommendations/c5ffe929-3d60-3b49-eb44-05add20a8e37?api-version=2020-01-01 - response: - body: - string: '{"error":{"code":"ResourceGroupNotFound","message":"Resource group - ''7vx5onejribdkm3bpke5mddlz57worfeu7edc4sdd5xec2dng2m4hhit6yy7d5u6asotq6vmh6a'' - could not be found."}}' - headers: - cache-control: - - no-cache - content-length: - - '167' - content-type: - - application/json; charset=utf-8 - date: - - Tue, 03 Nov 2020 08:41:40 GMT - expires: - - '-1' - pragma: - - no-cache - strict-transport-security: - - max-age=31536000; includeSubDomains - x-content-type-options: - - nosniff - x-ms-failure-cause: - - gateway - status: - code: 404 - message: Not Found -version: 1