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

add base class for feedback #19265

Merged
merged 4 commits into from
Jun 15, 2021
Merged
Show file tree
Hide file tree
Changes from 2 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
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@
MetricSeriesData,
AnomalyAlert,
IncidentRootCause,
MetricEnrichedSeriesData
MetricEnrichedSeriesData,
AnomalyFeedback,
ChangePointFeedback,
CommentFeedback,
PeriodFeedback
)
from ._version import SDK_MONIKER

Expand All @@ -42,15 +46,17 @@
MetricSeriesItem as MetricSeriesDefinition,
TimeMode as AlertQueryTimeMode,
)
from .models._models import (
AnomalyFeedback,
ChangePointFeedback,
CommentFeedback,
PeriodFeedback
)
from .models._models import MetricFeedback
from ._metrics_advisor_key_credential import MetricsAdvisorKeyCredential
from azure.core.paging import ItemPaged

FeedbackUnion = Union[
AnomalyFeedback,
ChangePointFeedback,
CommentFeedback,
PeriodFeedback,
]

class MetricsAdvisorClient(object):
"""Represents an client that calls restful API of Azure Metrics Advisor service.

Expand Down Expand Up @@ -106,7 +112,7 @@ def close(self):

@distributed_trace
def add_feedback(self, feedback, **kwargs):
# type: (Union[AnomalyFeedback, ChangePointFeedback, CommentFeedback, PeriodFeedback], Any) -> None
# type: (FeedbackUnion, Any) -> None

"""Create a new metric feedback.

Expand All @@ -133,13 +139,14 @@ def add_feedback(self, feedback, **kwargs):

@distributed_trace
def get_feedback(self, feedback_id, **kwargs):
# type: (str, Any) -> Union[AnomalyFeedback, ChangePointFeedback, CommentFeedback, PeriodFeedback]
# type: (str, Any) -> Union[MetricFeedback, FeedbackUnion]

"""Get a metric feedback by its id.

:param str feedback_id: the id of the feedback.
:return: The feedback object
:rtype: ~azure.ai.metricsadvisor.models.AnomalyFeedback or
:rtype: ~azure.ai.metricsadvisor.models.MetricFeedback or
~azure.ai.metricsadvisor.models.AnomalyFeedback or
~azure.ai.metricsadvisor.models.ChangePointFeedback or
~azure.ai.metricsadvisor.models.CommentFeedback or
~azure.ai.metricsadvisor.models.PeriodFeedback
Expand All @@ -161,7 +168,7 @@ def get_feedback(self, feedback_id, **kwargs):

@distributed_trace
def list_feedback(self, metric_id, **kwargs):
# type: (str, Any) -> ItemPaged[Union[AnomalyFeedback, ChangePointFeedback, CommentFeedback, PeriodFeedback]]
# type: (str, Any) -> ItemPaged[Union[MetricFeedback, FeedbackUnion]]

"""List feedback on the given metric.

Expand All @@ -179,7 +186,7 @@ def list_feedback(self, metric_id, **kwargs):
:paramtype time_mode: str or ~azure.ai.metricsadvisor.models.FeedbackQueryTimeMode
:return: Pageable list of MetricFeedback
:rtype: ~azure.core.paging.ItemPaged[
Union[AnomalyFeedback, ChangePointFeedback, CommentFeedback, PeriodFeedback]]
Union[MetricFeedback, AnomalyFeedback, ChangePointFeedback, CommentFeedback, PeriodFeedback]]
:raises ~azure.core.exceptions.HttpResponseError:

.. admonition:: Example:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,10 @@
EnrichmentStatus,
MetricSeriesItem as MetricSeriesDefinition
)
from ..models._models import (
AnomalyFeedback,
ChangePointFeedback,
CommentFeedback,
PeriodFeedback
)
from ..models._models import MetricFeedback
from .._metrics_advisor_key_credential import MetricsAdvisorKeyCredential
from azure.core.credentials_async import AsyncTokenCredential
from .._metrics_advisor_client import FeedbackUnion

class MetricsAdvisorClient(object):
"""Represents an client that calls restful API of Azure Metrics Advisor service.
Expand Down Expand Up @@ -107,7 +103,7 @@ async def close(self) -> None:

@distributed_trace_async
async def add_feedback(self, feedback, **kwargs):
# type: (Union[AnomalyFeedback, ChangePointFeedback, CommentFeedback, PeriodFeedback], Any) -> None
# type: (FeedbackUnion, Any) -> None

"""Create a new metric feedback.

Expand All @@ -134,13 +130,14 @@ async def add_feedback(self, feedback, **kwargs):

@distributed_trace_async
async def get_feedback(self, feedback_id, **kwargs):
# type: (str, Any) -> Union[AnomalyFeedback, ChangePointFeedback, CommentFeedback, PeriodFeedback]
# type: (str, Any) -> Union[MetricFeedback, FeedbackUnion]

"""Get a metric feedback by its id.

:param str feedback_id: the id of the feedback.
:return: The feedback object
:rtype: ~azure.ai.metricsadvisor.models.AnomalyFeedback or
:rtype: ~azure.ai.metricsadvisor.models.MetricFeedback or
~azure.ai.metricsadvisor.models.AnomalyFeedback or
~azure.ai.metricsadvisor.models.ChangePointFeedback or
~azure.ai.metricsadvisor.models.CommentFeedback or
~azure.ai.metricsadvisor.models.PeriodFeedback
Expand All @@ -167,7 +164,7 @@ def list_feedback(
self, metric_id, # type: str
**kwargs # type: Any
):
# type: (...) -> AsyncItemPaged[Union[AnomalyFeedback, ChangePointFeedback, CommentFeedback, PeriodFeedback]]
# type: (...) -> AsyncItemPaged[Union[MetricFeedback, FeedbackUnion]]

"""List feedback on the given metric.

Expand All @@ -185,7 +182,7 @@ def list_feedback(
:paramtype time_mode: str or ~azure.ai.metricsadvisor.models.FeedbackQueryTimeMode
:return: Pageable list of MetricFeedback
:rtype: ~azure.core.async_paging.AsyncItemPaged[
Union[AnomalyFeedback, ChangePointFeedback, CommentFeedback, PeriodFeedback]]
Union[MetricFeedback, AnomalyFeedback, ChangePointFeedback, CommentFeedback, PeriodFeedback]]
:raises ~azure.core.exceptions.HttpResponseError:

.. admonition:: Example:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@
PeriodType,
FeedbackType,
TimeMode as AlertQueryTimeMode,
DataSourceCredentialType,
AuthenticationTypeEnum as DataSourceAuthenticationType
DataSourceCredentialType as DatasourceCredentialType,
AuthenticationTypeEnum as DatasourceAuthenticationType
)

from .._generated.models import (
Expand All @@ -58,6 +58,7 @@
)

from ._models import (
MetricFeedback,
AnomalyFeedback,
ChangePointFeedback,
CommentFeedback,
Expand Down Expand Up @@ -123,6 +124,7 @@


__all__ = (
"MetricFeedback",
"AnomalyFeedback",
"ChangePointFeedback",
"CommentFeedback",
Expand Down Expand Up @@ -207,8 +209,8 @@
"DatasourceDataLakeGen2SharedKey",
"DatasourceServicePrincipal",
"DatasourceServicePrincipalInKeyVault",
"DataSourceCredentialType",
"DataSourceAuthenticationType",
"DatasourceCredentialType",
"DatasourceAuthenticationType",
"DatasourceCredential",
"DataFeedSource",
)
Loading