Skip to content

Commit

Permalink
modify _on to _time (#19546)
Browse files Browse the repository at this point in the history
* modify _on to _time

* update changelog
  • Loading branch information
xiangyan99 authored Jun 28, 2021
1 parent 5efa87d commit 9fdec48
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 28 deletions.
3 changes: 3 additions & 0 deletions sdk/metricsadvisor/azure-ai-metricsadvisor/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
- Renamed
- `DetectionConditionsOperator` -> `DetectionConditionOperator`
- `cross_conditions_operator` -> `condition_operator`
- `AnomalyAlert.created_on` -> `AnomalyAlert.created_time`
- `AnomalyAlert.modified_on` -> `AnomalyAlert.modified_time`
- `Anomaly.created_on` -> `Anomaly.created_time`

## 1.0.0b4 (2021-06-07)

Expand Down
4 changes: 2 additions & 2 deletions sdk/metricsadvisor/azure-ai-metricsadvisor/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -364,14 +364,14 @@ results = client.list_alerts(
)
for result in results:
print("Alert id: {}".format(result.id))
print("Create on: {}".format(result.created_on))
print("Create time: {}".format(result.created_time))

results = client.list_anomalies(
alert_configuration_id=alert_config_id,
alert_id=alert_id,
)
for result in results:
print("Create on: {}".format(result.created_on))
print("Create time: {}".format(result.created_time))
print("Severity: {}".format(result.severity))
print("Status: {}".format(result.status))
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,6 @@ class MetricsAdvisorClient(object):
which requires both subscription key and API key. Or an object which can provide an access
token for the vault, such as a credential from :mod:`azure.identity`
:type credential: ~azure.ai.metricsadvisor.MetricsAdvisorKeyCredential or ~azure.core.credentials.TokenCredential
:keyword Pipeline pipeline: If omitted, the standard pipeline is used.
:keyword HttpTransport transport: If omitted, the standard pipeline is used.
:keyword list[HTTPPolicy] policies: If omitted, the standard pipeline is used.
"""
def __init__(self, endpoint, credential, **kwargs):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,6 @@ class MetricsAdvisorClient(object):
which requires both subscription key and API key. Or an object which can provide an access
token for the vault, such as a credential from :mod:`azure.identity`
:type credential: ~azure.ai.metricsadvisor.MetricsAdvisorKeyCredential or ~azure.core.credentials.TokenCredential
:keyword Pipeline pipeline: If omitted, the standard pipeline is used.
:keyword HttpTransport transport: If omitted, the standard pipeline is used.
:keyword list[HTTPPolicy] policies: If omitted, the standard pipeline is used.
"""
def __init__(self, endpoint, credential, **kwargs):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2701,33 +2701,33 @@ class AnomalyAlert(object):
:vartype id: str
:ivar timestamp: anomaly time.
:vartype timestamp: ~datetime.datetime
:ivar created_on: created time.
:vartype created_on: ~datetime.datetime
:ivar modified_on: modified time.
:vartype modified_on: ~datetime.datetime
:ivar created_time: created time.
:vartype created_time: ~datetime.datetime
:ivar modified_time: modified time.
:vartype modified_time: ~datetime.datetime
"""

def __init__(self, **kwargs):
self.id = kwargs.get('id', None)
self.timestamp = kwargs.get('timestamp', None)
self.created_on = kwargs.get('created_on', None)
self.modified_on = kwargs.get('modified_on', None)
self.created_time = kwargs.get('created_time', None)
self.modified_time = kwargs.get('modified_time', None)

def __repr__(self):
return "AnomalyAlert(id={}, timestamp={}, created_on={}, modified_on={})".format(
return "AnomalyAlert(id={}, timestamp={}, created_time={}, modified_time={})".format(
self.id,
self.timestamp,
self.created_on,
self.modified_on
self.created_time,
self.modified_time
)[:1024]

@classmethod
def _from_generated(cls, alert):
return cls(
id=alert.alert_id,
timestamp=alert.timestamp,
created_on=alert.created_time,
modified_on=alert.modified_time
created_time=alert.created_time,
modified_time=alert.modified_time
)


Expand Down Expand Up @@ -2778,7 +2778,7 @@ class DataPointAnomaly(msrest.serialization.Model):
'metric_id': {'key': 'metricId', 'type': 'str'},
'detection_configuration_id': {'key': 'detectionConfigurationId', 'type': 'str'},
'timestamp': {'key': 'timestamp', 'type': 'iso-8601'},
'created_on': {'key': 'createdOn', 'type': 'iso-8601'},
'created_time': {'key': 'createdTime', 'type': 'iso-8601'},
'modified_time': {'key': 'modifiedTime', 'type': 'iso-8601'},
'dimension': {'key': 'dimension', 'type': '{str}'},
'severity': {'key': 'severity', 'type': 'str'},
Expand All @@ -2793,19 +2793,19 @@ def __init__(
self.metric_id = kwargs.get('metric_id', None)
self.detection_configuration_id = kwargs.get('detection_configuration_id', None)
self.timestamp = kwargs.get('timestamp', None)
self.created_on = kwargs.get('created_on', None)
self.created_time = kwargs.get('created_time', None)
self.modified_time = kwargs.get('modified_time', None)
self.dimension = kwargs.get('dimension', None)
self.severity = kwargs.get('severity', None)
self.status = kwargs.get('status', None)

def __repr__(self):
return "DataPointAnomaly(metric_id={}, detection_configuration_id={}, timestamp={}, created_on={}, " \
return "DataPointAnomaly(metric_id={}, detection_configuration_id={}, timestamp={}, created_time={}, " \
"modified_time={}, dimension={}, severity={}, status={})".format(
self.metric_id,
self.detection_configuration_id,
self.timestamp,
self.created_on,
self.created_time,
self.modified_time,
self.dimension,
self.severity,
Expand All @@ -2827,7 +2827,7 @@ def _from_generated(cls, anomaly_result):
metric_id=anomaly_result.metric_id,
detection_configuration_id=anomaly_result.anomaly_detection_configuration_id,
timestamp=anomaly_result.timestamp,
created_on=anomaly_result.created_time,
created_time=anomaly_result.created_time,
modified_time=anomaly_result.modified_time,
dimension=anomaly_result.dimension,
severity=severity,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ async def sample_list_alerts_async(alert_config_id):
async for result in results:
tolist.append(result)
print("Alert id: {}".format(result.id))
print("Create on: {}".format(result.created_on))
print("Create time: {}".format(result.created_time))
return tolist

# [END list_alerts_async]
Expand All @@ -225,7 +225,7 @@ async def sample_list_anomalies_for_alert_async(alert_config_id, alert_id):
alert_id=alert_id,
)
async for result in results:
print("Create on: {}".format(result.created_on))
print("Create time: {}".format(result.created_time))
print("Severity: {}".format(result.severity))
print("Status: {}".format(result.status))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ def sample_list_alerts(alert_config_id):
for result in results:
tolist.append(result)
print("Alert id: {}".format(result.id))
print("Create on: {}".format(result.created_on))
print("Create time: {}".format(result.created_time))
return tolist
# [END list_alerts]

Expand All @@ -214,7 +214,7 @@ def sample_list_anomalies_for_alert(alert_config_id, alert_id):
alert_id=alert_id,
)
for result in results:
print("Create on: {}".format(result.created_on))
print("Create time: {}".format(result.created_time))
print("Severity: {}".format(result.severity))
print("Status: {}".format(result.status))

Expand Down

0 comments on commit 9fdec48

Please sign in to comment.