Skip to content

Commit 53b2dbd

Browse files
author
SDKAuto
committed
CodeGen from PR 13177 in Azure/azure-rest-api-specs
[Hub Generated] Review request for Microsoft.Advisor to add version stable/2020-01-01 (Azure#13177) * Update advisor.json Add additional property * Update GetRecommendationDetail.json * Update ListRecommendations.json * Update GetRecommendationDetail.json * Update advisor.json * move property to botton
1 parent 5bc7fb0 commit 53b2dbd

File tree

6 files changed

+152
-59
lines changed

6 files changed

+152
-59
lines changed

sdk/advisor/azure-mgmt-advisor/azure/mgmt/advisor/models/_models.py

+51
Original file line numberDiff line numberDiff line change
@@ -310,17 +310,31 @@ class ResourceMetadata(Model):
310310
:type resource_id: str
311311
:param source: Source from which recommendation is generated
312312
:type source: str
313+
:param action: The action to view resource.
314+
:type action: dict[str, object]
315+
:param singular: The singular user friendly name of resource type. eg:
316+
virtual machine
317+
:type singular: str
318+
:param plural: The plural user friendly name of resource type. eg: virtual
319+
machines
320+
:type plural: str
313321
"""
314322

315323
_attribute_map = {
316324
'resource_id': {'key': 'resourceId', 'type': 'str'},
317325
'source': {'key': 'source', 'type': 'str'},
326+
'action': {'key': 'action', 'type': '{object}'},
327+
'singular': {'key': 'singular', 'type': 'str'},
328+
'plural': {'key': 'plural', 'type': 'str'},
318329
}
319330

320331
def __init__(self, **kwargs):
321332
super(ResourceMetadata, self).__init__(**kwargs)
322333
self.resource_id = kwargs.get('resource_id', None)
323334
self.source = kwargs.get('source', None)
335+
self.action = kwargs.get('action', None)
336+
self.singular = kwargs.get('singular', None)
337+
self.plural = kwargs.get('plural', None)
324338

325339

326340
class ResourceRecommendationBase(Resource):
@@ -365,6 +379,24 @@ class ResourceRecommendationBase(Resource):
365379
:type extended_properties: dict[str, str]
366380
:param resource_metadata: Metadata of resource that was assessed
367381
:type resource_metadata: ~azure.mgmt.advisor.models.ResourceMetadata
382+
:param description: The detailed description of recommendation.
383+
:type description: str
384+
:param label: The label of recommendation.
385+
:type label: str
386+
:param learn_more_link: The link to learn more about recommendation and
387+
generation logic.
388+
:type learn_more_link: str
389+
:param potential_benefits: The potential benefit of implementing
390+
recommendation.
391+
:type potential_benefits: str
392+
:param actions: The list of recommended actions to implement
393+
recommendation.
394+
:type actions: list[dict[str, object]]
395+
:param remediation: The automated way to apply recommendation.
396+
:type remediation: dict[str, object]
397+
:param exposed_metadata_properties: The recommendation metadata properties
398+
exposed to customer to provide additional information.
399+
:type exposed_metadata_properties: dict[str, object]
368400
"""
369401

370402
_validation = {
@@ -389,6 +421,13 @@ class ResourceRecommendationBase(Resource):
389421
'suppression_ids': {'key': 'properties.suppressionIds', 'type': '[str]'},
390422
'extended_properties': {'key': 'properties.extendedProperties', 'type': '{str}'},
391423
'resource_metadata': {'key': 'properties.resourceMetadata', 'type': 'ResourceMetadata'},
424+
'description': {'key': 'properties.description', 'type': 'str'},
425+
'label': {'key': 'properties.label', 'type': 'str'},
426+
'learn_more_link': {'key': 'properties.learnMoreLink', 'type': 'str'},
427+
'potential_benefits': {'key': 'properties.potentialBenefits', 'type': 'str'},
428+
'actions': {'key': 'properties.actions', 'type': '[{object}]'},
429+
'remediation': {'key': 'properties.remediation', 'type': '{object}'},
430+
'exposed_metadata_properties': {'key': 'properties.exposedMetadataProperties', 'type': '{object}'},
392431
}
393432

394433
def __init__(self, **kwargs):
@@ -405,6 +444,13 @@ def __init__(self, **kwargs):
405444
self.suppression_ids = kwargs.get('suppression_ids', None)
406445
self.extended_properties = kwargs.get('extended_properties', None)
407446
self.resource_metadata = kwargs.get('resource_metadata', None)
447+
self.description = kwargs.get('description', None)
448+
self.label = kwargs.get('label', None)
449+
self.learn_more_link = kwargs.get('learn_more_link', None)
450+
self.potential_benefits = kwargs.get('potential_benefits', None)
451+
self.actions = kwargs.get('actions', None)
452+
self.remediation = kwargs.get('remediation', None)
453+
self.exposed_metadata_properties = kwargs.get('exposed_metadata_properties', None)
408454

409455

410456
class ShortDescription(Model):
@@ -444,12 +490,15 @@ class SuppressionContract(Resource):
444490
:type suppression_id: str
445491
:param ttl: The duration for which the suppression is valid.
446492
:type ttl: str
493+
:ivar expiration_time_stamp: Gets or sets the expiration time stamp.
494+
:vartype expiration_time_stamp: datetime
447495
"""
448496

449497
_validation = {
450498
'id': {'readonly': True},
451499
'name': {'readonly': True},
452500
'type': {'readonly': True},
501+
'expiration_time_stamp': {'readonly': True},
453502
}
454503

455504
_attribute_map = {
@@ -458,9 +507,11 @@ class SuppressionContract(Resource):
458507
'type': {'key': 'type', 'type': 'str'},
459508
'suppression_id': {'key': 'properties.suppressionId', 'type': 'str'},
460509
'ttl': {'key': 'properties.ttl', 'type': 'str'},
510+
'expiration_time_stamp': {'key': 'properties.expirationTimeStamp', 'type': 'iso-8601'},
461511
}
462512

463513
def __init__(self, **kwargs):
464514
super(SuppressionContract, self).__init__(**kwargs)
465515
self.suppression_id = kwargs.get('suppression_id', None)
466516
self.ttl = kwargs.get('ttl', None)
517+
self.expiration_time_stamp = None

sdk/advisor/azure-mgmt-advisor/azure/mgmt/advisor/models/_models_py3.py

+53-2
Original file line numberDiff line numberDiff line change
@@ -310,17 +310,31 @@ class ResourceMetadata(Model):
310310
:type resource_id: str
311311
:param source: Source from which recommendation is generated
312312
:type source: str
313+
:param action: The action to view resource.
314+
:type action: dict[str, object]
315+
:param singular: The singular user friendly name of resource type. eg:
316+
virtual machine
317+
:type singular: str
318+
:param plural: The plural user friendly name of resource type. eg: virtual
319+
machines
320+
:type plural: str
313321
"""
314322

315323
_attribute_map = {
316324
'resource_id': {'key': 'resourceId', 'type': 'str'},
317325
'source': {'key': 'source', 'type': 'str'},
326+
'action': {'key': 'action', 'type': '{object}'},
327+
'singular': {'key': 'singular', 'type': 'str'},
328+
'plural': {'key': 'plural', 'type': 'str'},
318329
}
319330

320-
def __init__(self, *, resource_id: str=None, source: str=None, **kwargs) -> None:
331+
def __init__(self, *, resource_id: str=None, source: str=None, action=None, singular: str=None, plural: str=None, **kwargs) -> None:
321332
super(ResourceMetadata, self).__init__(**kwargs)
322333
self.resource_id = resource_id
323334
self.source = source
335+
self.action = action
336+
self.singular = singular
337+
self.plural = plural
324338

325339

326340
class ResourceRecommendationBase(Resource):
@@ -365,6 +379,24 @@ class ResourceRecommendationBase(Resource):
365379
:type extended_properties: dict[str, str]
366380
:param resource_metadata: Metadata of resource that was assessed
367381
:type resource_metadata: ~azure.mgmt.advisor.models.ResourceMetadata
382+
:param description: The detailed description of recommendation.
383+
:type description: str
384+
:param label: The label of recommendation.
385+
:type label: str
386+
:param learn_more_link: The link to learn more about recommendation and
387+
generation logic.
388+
:type learn_more_link: str
389+
:param potential_benefits: The potential benefit of implementing
390+
recommendation.
391+
:type potential_benefits: str
392+
:param actions: The list of recommended actions to implement
393+
recommendation.
394+
:type actions: list[dict[str, object]]
395+
:param remediation: The automated way to apply recommendation.
396+
:type remediation: dict[str, object]
397+
:param exposed_metadata_properties: The recommendation metadata properties
398+
exposed to customer to provide additional information.
399+
:type exposed_metadata_properties: dict[str, object]
368400
"""
369401

370402
_validation = {
@@ -389,9 +421,16 @@ class ResourceRecommendationBase(Resource):
389421
'suppression_ids': {'key': 'properties.suppressionIds', 'type': '[str]'},
390422
'extended_properties': {'key': 'properties.extendedProperties', 'type': '{str}'},
391423
'resource_metadata': {'key': 'properties.resourceMetadata', 'type': 'ResourceMetadata'},
424+
'description': {'key': 'properties.description', 'type': 'str'},
425+
'label': {'key': 'properties.label', 'type': 'str'},
426+
'learn_more_link': {'key': 'properties.learnMoreLink', 'type': 'str'},
427+
'potential_benefits': {'key': 'properties.potentialBenefits', 'type': 'str'},
428+
'actions': {'key': 'properties.actions', 'type': '[{object}]'},
429+
'remediation': {'key': 'properties.remediation', 'type': '{object}'},
430+
'exposed_metadata_properties': {'key': 'properties.exposedMetadataProperties', 'type': '{object}'},
392431
}
393432

394-
def __init__(self, *, category=None, impact=None, impacted_field: str=None, impacted_value: str=None, last_updated=None, metadata=None, recommendation_type_id: str=None, risk=None, short_description=None, suppression_ids=None, extended_properties=None, resource_metadata=None, **kwargs) -> None:
433+
def __init__(self, *, category=None, impact=None, impacted_field: str=None, impacted_value: str=None, last_updated=None, metadata=None, recommendation_type_id: str=None, risk=None, short_description=None, suppression_ids=None, extended_properties=None, resource_metadata=None, description: str=None, label: str=None, learn_more_link: str=None, potential_benefits: str=None, actions=None, remediation=None, exposed_metadata_properties=None, **kwargs) -> None:
395434
super(ResourceRecommendationBase, self).__init__(**kwargs)
396435
self.category = category
397436
self.impact = impact
@@ -405,6 +444,13 @@ def __init__(self, *, category=None, impact=None, impacted_field: str=None, impa
405444
self.suppression_ids = suppression_ids
406445
self.extended_properties = extended_properties
407446
self.resource_metadata = resource_metadata
447+
self.description = description
448+
self.label = label
449+
self.learn_more_link = learn_more_link
450+
self.potential_benefits = potential_benefits
451+
self.actions = actions
452+
self.remediation = remediation
453+
self.exposed_metadata_properties = exposed_metadata_properties
408454

409455

410456
class ShortDescription(Model):
@@ -444,12 +490,15 @@ class SuppressionContract(Resource):
444490
:type suppression_id: str
445491
:param ttl: The duration for which the suppression is valid.
446492
:type ttl: str
493+
:ivar expiration_time_stamp: Gets or sets the expiration time stamp.
494+
:vartype expiration_time_stamp: datetime
447495
"""
448496

449497
_validation = {
450498
'id': {'readonly': True},
451499
'name': {'readonly': True},
452500
'type': {'readonly': True},
501+
'expiration_time_stamp': {'readonly': True},
453502
}
454503

455504
_attribute_map = {
@@ -458,9 +507,11 @@ class SuppressionContract(Resource):
458507
'type': {'key': 'type', 'type': 'str'},
459508
'suppression_id': {'key': 'properties.suppressionId', 'type': 'str'},
460509
'ttl': {'key': 'properties.ttl', 'type': 'str'},
510+
'expiration_time_stamp': {'key': 'properties.expirationTimeStamp', 'type': 'iso-8601'},
461511
}
462512

463513
def __init__(self, *, suppression_id: str=None, ttl: str=None, **kwargs) -> None:
464514
super(SuppressionContract, self).__init__(**kwargs)
465515
self.suppression_id = suppression_id
466516
self.ttl = ttl
517+
self.expiration_time_stamp = None

sdk/advisor/azure-mgmt-advisor/azure/mgmt/advisor/operations/_operations.py

+3-5
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
import uuid
1313
from msrest.pipeline import ClientRawResponse
14-
from msrestazure.azure_exceptions import CloudError
1514

1615
from .. import models
1716

@@ -51,7 +50,8 @@ def list(
5150
:return: An iterator like instance of OperationEntity
5251
:rtype:
5352
~azure.mgmt.advisor.models.OperationEntityPaged[~azure.mgmt.advisor.models.OperationEntity]
54-
:raises: :class:`CloudError<msrestazure.azure_exceptions.CloudError>`
53+
:raises:
54+
:class:`ArmErrorResponseException<azure.mgmt.advisor.models.ArmErrorResponseException>`
5555
"""
5656
def prepare_request(next_link=None):
5757
if not next_link:
@@ -86,9 +86,7 @@ def internal_paging(next_link=None):
8686
response = self._client.send(request, stream=False, **operation_config)
8787

8888
if response.status_code not in [200]:
89-
exp = CloudError(response)
90-
exp.request_id = response.headers.get('x-ms-request-id')
91-
raise exp
89+
raise models.ArmErrorResponseException(self._deserialize, response)
9290

9391
return response
9492

sdk/advisor/azure-mgmt-advisor/azure/mgmt/advisor/operations/_recommendation_metadata_operations.py

+6-9
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
import uuid
1313
from msrest.pipeline import ClientRawResponse
14-
from msrestazure.azure_exceptions import CloudError
1514

1615
from .. import models
1716

@@ -52,7 +51,8 @@ def get(
5251
overrides<msrest:optionsforoperations>`.
5352
:return: object or ClientRawResponse if raw=true
5453
:rtype: object or ~msrest.pipeline.ClientRawResponse
55-
:raises: :class:`CloudError<msrestazure.azure_exceptions.CloudError>`
54+
:raises:
55+
:class:`ArmErrorResponseException<azure.mgmt.advisor.models.ArmErrorResponseException>`
5656
"""
5757
# Construct URL
5858
url = self.get.metadata['url']
@@ -80,9 +80,7 @@ def get(
8080
response = self._client.send(request, stream=False, **operation_config)
8181

8282
if response.status_code not in [200, 404]:
83-
exp = CloudError(response)
84-
exp.request_id = response.headers.get('x-ms-request-id')
85-
raise exp
83+
raise models.ArmErrorResponseException(self._deserialize, response)
8684

8785
deserialized = None
8886
if response.status_code == 200:
@@ -109,7 +107,8 @@ def list(
109107
:return: An iterator like instance of MetadataEntity
110108
:rtype:
111109
~azure.mgmt.advisor.models.MetadataEntityPaged[~azure.mgmt.advisor.models.MetadataEntity]
112-
:raises: :class:`CloudError<msrestazure.azure_exceptions.CloudError>`
110+
:raises:
111+
:class:`ArmErrorResponseException<azure.mgmt.advisor.models.ArmErrorResponseException>`
113112
"""
114113
def prepare_request(next_link=None):
115114
if not next_link:
@@ -144,9 +143,7 @@ def internal_paging(next_link=None):
144143
response = self._client.send(request, stream=False, **operation_config)
145144

146145
if response.status_code not in [200]:
147-
exp = CloudError(response)
148-
exp.request_id = response.headers.get('x-ms-request-id')
149-
raise exp
146+
raise models.ArmErrorResponseException(self._deserialize, response)
150147

151148
return response
152149

0 commit comments

Comments
 (0)