Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ma arch feedback #16502

Merged
merged 2 commits into from
Feb 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion sdk/metricsadvisor/azure-ai-metricsadvisor/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Release History

## 1.0.0b3 (Unreleased)
## 1.0.0b3 (2021-02-09)

**New Features**

Expand All @@ -10,6 +10,8 @@
**Breaking Changes**

- `list_dimension_values` has been renamed to `list_anomaly_dimension_values`
- update methods now return None
- Updated DataFeed.metric_ids to be a dict rather than a list

## 1.0.0b2 (2020-11-10)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -708,7 +708,7 @@ def delete_hook(self, hook_id, **kwargs):
def update_data_feed(
self, data_feed, # type: Union[str, DataFeed]
**kwargs # type: Any
): # type: (...) -> DataFeed
): # type: (...) -> None
"""Update a data feed. Either pass the entire DataFeed object with the chosen updates
or the ID to your data feed with updates passed via keyword arguments. If you pass both
the DataFeed object and keyword arguments, the keyword arguments will take precedence.
Expand Down Expand Up @@ -754,8 +754,7 @@ def update_data_feed(
AzureDataExplorerDataFeed, AzureDataLakeStorageGen2DataFeed, AzureTableDataFeed, HttpRequestDataFeed,
InfluxDBDataFeed, MySqlDataFeed, PostgreSqlDataFeed, SQLServerDataFeed, MongoDBDataFeed,
ElasticsearchDataFeed]
:return: DataFeed
:rtype: ~azure.ai.metricsadvisor.models.DataFeed
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:

.. admonition:: Example:
Expand Down Expand Up @@ -802,16 +801,15 @@ def update_data_feed(
data_feed_patch_type = DATA_FEED_PATCH[data_feed.source.data_source_type]
data_feed_patch = data_feed._to_generated_patch(data_feed_patch_type, update)

self._client.update_data_feed(data_feed_id, data_feed_patch, **kwargs)
return self.get_data_feed(data_feed_id)
return self._client.update_data_feed(data_feed_id, data_feed_patch, **kwargs)

@distributed_trace
def update_alert_configuration(
self,
alert_configuration, # type: Union[str, AnomalyAlertConfiguration]
**kwargs # type: Any
):
# type: (...) -> AnomalyAlertConfiguration
# type: (...) -> None
"""Update anomaly alerting configuration. Either pass the entire AnomalyAlertConfiguration object
with the chosen updates or the ID to your alert configuration with updates passed via keyword arguments.
If you pass both the AnomalyAlertConfiguration object and keyword arguments, the keyword arguments
Expand All @@ -828,8 +826,7 @@ def update_alert_configuration(
:paramtype cross_metrics_operator: str or
~azure.ai.metricsadvisor.models.MetricAnomalyAlertConfigurationsOperator
:keyword str description: Anomaly alert configuration description.
:return: AnomalyAlertConfiguration
:rtype: ~azure.ai.metricsadvisor.models.AnomalyAlertConfiguration
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:

.. admonition:: Example:
Expand Down Expand Up @@ -865,20 +862,19 @@ def update_alert_configuration(
description=update.pop("description", None),
)

self._client.update_anomaly_alerting_configuration(
return self._client.update_anomaly_alerting_configuration(
alert_configuration_id,
alert_configuration_patch,
**kwargs
)
return self.get_alert_configuration(alert_configuration_id)

@distributed_trace
def update_detection_configuration(
self,
detection_configuration, # type: Union[str, AnomalyDetectionConfiguration]
**kwargs # type: Any
):
# type: (...) -> AnomalyDetectionConfiguration
# type: (...) -> None
"""Update anomaly metric detection configuration. Either pass the entire AnomalyDetectionConfiguration object
with the chosen updates or the ID to your detection configuration with updates passed via keyword arguments.
If you pass both the AnomalyDetectionConfiguration object and keyword arguments, the keyword arguments
Expand All @@ -899,8 +895,7 @@ def update_detection_configuration(
:keyword series_detection_conditions: detection configuration for specific series.
:paramtype series_detection_conditions:
list[~azure.ai.metricsadvisor.models.MetricSingleSeriesDetectionCondition]
:return: AnomalyDetectionConfiguration
:rtype: ~azure.ai.metricsadvisor.models.AnomalyDetectionConfiguration
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:

.. admonition:: Example:
Expand Down Expand Up @@ -936,20 +931,19 @@ def update_detection_configuration(
series_detection_conditions=update.pop("seriesOverrideConfigurations", None)
)

self._client.update_anomaly_detection_configuration(
return self._client.update_anomaly_detection_configuration(
detection_configuration_id,
detection_config_patch,
**kwargs
)
return self.get_detection_configuration(detection_configuration_id)

@distributed_trace
def update_hook(
self,
hook, # type: Union[str, EmailNotificationHook, WebNotificationHook]
**kwargs # type: Any
):
# type: (...) -> Union[NotificationHook, EmailNotificationHook, WebNotificationHook]
# type: (...) -> None
"""Update a hook. Either pass the entire EmailNotificationHook or WebNotificationHook object with the chosen
updates, or the ID to your hook configuration with the updates passed via keyword arguments.
If you pass both the hook object and keyword arguments, the keyword arguments will take precedence.
Expand All @@ -970,10 +964,7 @@ def update_hook(
:keyword str certificate_key: client certificate. Only should be passed to update WebNotificationHook.
:keyword str certificate_password: client certificate password. Only should be passed to update
WebNotificationHook.
:return: EmailNotificationHook or WebNotificationHook
:rtype: Union[~azure.ai.metricsadvisor.models.NotificationHook,
~azure.ai.metricsadvisor.models.EmailNotificationHook,
~azure.ai.metricsadvisor.models.WebNotificationHook]
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:

.. admonition:: Example:
Expand Down Expand Up @@ -1032,12 +1023,11 @@ def update_hook(
certificate_password=update.pop("certificatePassword", None)
)

self._client.update_hook(
return self._client.update_hook(
hook_id,
hook_patch,
**kwargs
)
return self.get_hook(hook_id)

@distributed_trace
def list_hooks(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -617,7 +617,7 @@ async def delete_hook(self, hook_id: str, **kwargs: Any) -> None:
async def update_data_feed(
self, data_feed: Union[str, DataFeed],
**kwargs: Any
) -> DataFeed:
) -> None:
"""Update a data feed. Either pass the entire DataFeed object with the chosen updates
or the ID to your data feed with updates passed via keyword arguments. If you pass both
the DataFeed object and keyword arguments, the keyword arguments will take precedence.
Expand Down Expand Up @@ -663,8 +663,7 @@ async def update_data_feed(
AzureDataExplorerDataFeed, AzureDataLakeStorageGen2DataFeed, AzureTableDataFeed, HttpRequestDataFeed,
InfluxDBDataFeed, MySqlDataFeed, PostgreSqlDataFeed, SQLServerDataFeed, MongoDBDataFeed,
ElasticsearchDataFeed]
:return: DataFeed
:rtype: ~azure.ai.metricsadvisor.models.DataFeed
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:

.. admonition:: Example:
Expand Down Expand Up @@ -711,15 +710,14 @@ async def update_data_feed(
data_feed_patch_type = DATA_FEED_PATCH[data_feed.source.data_source_type]
data_feed_patch = data_feed._to_generated_patch(data_feed_patch_type, update)

await self._client.update_data_feed(data_feed_id, data_feed_patch, **kwargs)
return await self.get_data_feed(data_feed_id)
return await self._client.update_data_feed(data_feed_id, data_feed_patch, **kwargs)

@distributed_trace_async
async def update_alert_configuration(
self,
alert_configuration: Union[str, AnomalyAlertConfiguration],
**kwargs: Any
) -> AnomalyAlertConfiguration:
) -> None:
"""Update anomaly alerting configuration. Either pass the entire AnomalyAlertConfiguration object
with the chosen updates or the ID to your alert configuration with updates passed via keyword arguments.
If you pass both the AnomalyAlertConfiguration object and keyword arguments, the keyword arguments
Expand All @@ -736,8 +734,7 @@ async def update_alert_configuration(
:paramtype cross_metrics_operator: str or
~azure.ai.metricsadvisor.models.MetricAnomalyAlertConfigurationsOperator
:keyword str description: Anomaly alert configuration description.
:return: AnomalyAlertConfiguration
:rtype: ~azure.ai.metricsadvisor.models.AnomalyAlertConfiguration
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:

.. admonition:: Example:
Expand Down Expand Up @@ -773,19 +770,18 @@ async def update_alert_configuration(
description=update.pop("description", None),
)

await self._client.update_anomaly_alerting_configuration(
return await self._client.update_anomaly_alerting_configuration(
alert_configuration_id,
alert_configuration_patch,
**kwargs
)
return await self.get_alert_configuration(alert_configuration_id)

@distributed_trace_async
async def update_detection_configuration(
self,
detection_configuration: Union[str, AnomalyDetectionConfiguration],
**kwargs: Any
) -> AnomalyDetectionConfiguration:
) -> None:
"""Update anomaly metric detection configuration. Either pass the entire AnomalyDetectionConfiguration object
with the chosen updates or the ID to your detection configuration with updates passed via keyword arguments.
If you pass both the AnomalyDetectionConfiguration object and keyword arguments, the keyword arguments
Expand Down Expand Up @@ -843,19 +839,18 @@ async def update_detection_configuration(
series_detection_conditions=update.pop("seriesOverrideConfigurations", None)
)

await self._client.update_anomaly_detection_configuration(
return await self._client.update_anomaly_detection_configuration(
detection_configuration_id,
detection_config_patch,
**kwargs
)
return await self.get_detection_configuration(detection_configuration_id)

@distributed_trace_async
async def update_hook(
self,
hook: Union[str, EmailNotificationHook, WebNotificationHook],
**kwargs: Any
) -> Union[NotificationHook, EmailNotificationHook, WebNotificationHook]:
) -> None:
"""Update a hook. Either pass the entire EmailNotificationHook or WebNotificationHook object with the
chosen updates, or the ID to your hook configuration with the updates passed via keyword arguments.
If you pass both the hook object and keyword arguments, the keyword arguments will take precedence.
Expand All @@ -876,10 +871,7 @@ async def update_hook(
:keyword str certificate_key: client certificate. Only should be passed to update WebNotificationHook.
:keyword str certificate_password: client certificate password. Only should be passed to update
WebNotificationHook.
:return: EmailNotificationHook or WebNotificationHook
:rtype: Union[~azure.ai.metricsadvisor.models.NotificationHook,
~azure.ai.metricsadvisor.models.EmailNotificationHook,
~azure.ai.metricsadvisor.models.WebNotificationHook]
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:

.. admonition:: Example:
Expand Down Expand Up @@ -938,12 +930,11 @@ async def update_hook(
certificate_password=update.pop("certificatePassword", None)
)

await self._client.update_hook(
return await self._client.update_hook(
hook_id,
hook_patch,
**kwargs
)
return await self.get_hook(hook_id)

@distributed_trace
def list_hooks(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ class DataFeed(object): # pylint:disable=too-many-instance-attributes
:ivar ingestion_settings: Data feed ingestion settings.
:vartype ingestion_settings: ~azure.ai.metricsadvisor.models.DataFeedIngestionSettings
:ivar bool is_admin: Whether the query user is one of data feed administrators or not.
:ivar list[str] metric_ids: List of metric ids
:ivar dict metric_ids: metric name and metric id dict
:ivar str name: Data feed name.
:ivar options: Data feed options
:vartype options: ~azure.ai.metricsadvisor.models.DataFeedOptions
Expand Down Expand Up @@ -404,7 +404,7 @@ def _from_generated(cls, data_feed):
stop_retry_after=data_feed.stop_retry_after_in_seconds
),
is_admin=data_feed.is_admin,
metric_ids=[metric.metric_id for metric in data_feed.metrics],
metric_ids={metric.metric_name: metric.metric_id for metric in data_feed.metrics},
name=data_feed.data_feed_name,
options=DataFeedOptions(
admin_emails=data_feed.admins,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -267,12 +267,12 @@ async def sample_update_alert_config_async(alert_config):
alert_config.metric_alert_configurations.append(additional_alert)

async with client:
updated = await client.update_alert_configuration(
await client.update_alert_configuration(
alert_config,
cross_metrics_operator="OR",
description="updated alert config"
)

updated = await client.get_alert_configuration(alert_config.id)
print("Updated alert name: {}".format(updated.name))
print("Updated alert description: {}".format(updated.description))
print("Updated cross metrics operator: {}".format(updated.cross_metrics_operator))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,13 +175,13 @@ async def sample_update_data_feed_async(data_feed):
data_feed.options.data_feed_description = "updated description for data feed"

async with client:
updated_data_feed = await client.update_data_feed(
await client.update_data_feed(
data_feed,
access_mode="Public",
fill_type="CustomValue",
custom_fill_value=1
)

updated_data_feed = await client.get_data_feed(data_feed.id)
print("Updated name: {}".format(updated_data_feed.name))
print("Updated description: {}".format(updated_data_feed.options.data_feed_description))
print("Updated access mode: {}".format(updated_data_feed.options.access_mode))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ async def sample_update_detection_config_async(detection_config):
)

async with client:
updated = await client.update_detection_configuration(
await client.update_detection_configuration(
detection_config,
series_group_detection_conditions=[
MetricSeriesGroupDetectionCondition(
Expand All @@ -214,6 +214,7 @@ async def sample_update_detection_config_async(detection_config):
)
]
)
updated = await client.get_detection_configuration(detection_config.id)
print("Updated detection name: {}".format(updated.name))
print("Updated detection description: {}".format(updated.description))
print("Updated detection condition for series group: {}".format(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,11 @@ async def sample_update_hook_async(hook):
hook.description = "updated hook description"

async with client:
updated = await client.update_hook(
await client.update_hook(
hook,
emails_to_alert=["newemail@alertme.com"]
)
updated = await client.get_hook(hook.id)
print("Updated name: {}".format(updated.name))
print("Updated description: {}".format(updated.description))
print("Updated emails: {}".format(updated.emails_to_alert))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -254,11 +254,12 @@ def sample_update_alert_config(alert_config):
)
alert_config.metric_alert_configurations.append(additional_alert)

updated = client.update_alert_configuration(
client.update_alert_configuration(
alert_config,
cross_metrics_operator="OR",
description="updated alert config"
)
updated = client.get_alert_configuration(alert_config.id)

print("Updated alert name: {}".format(updated.name))
print("Updated alert description: {}".format(updated.description))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,12 +167,13 @@ def sample_update_data_feed(data_feed):
data_feed.name = "updated name"
data_feed.options.data_feed_description = "updated description for data feed"

updated_data_feed = client.update_data_feed(
client.update_data_feed(
data_feed,
access_mode="Public",
fill_type="CustomValue",
custom_fill_value=1
)
updated_data_feed = client.get_data_feed(data_feed.id)

print("Updated name: {}".format(updated_data_feed.name))
print("Updated description: {}".format(updated_data_feed.options.data_feed_description))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ def sample_update_detection_config(detection_config):
)
)

updated = client.update_detection_configuration(
client.update_detection_configuration(
detection_config,
series_group_detection_conditions=[
MetricSeriesGroupDetectionCondition(
Expand All @@ -205,6 +205,7 @@ def sample_update_detection_config(detection_config):
)
]
)
updated = client.get_detection_configuration(detection_config.id)
print("Updated detection name: {}".format(updated.name))
print("Updated detection description: {}".format(updated.description))
print("Updated detection condition for series group: {}".format(
Expand Down
Loading