diff --git a/services/cognitiveservices/v1.0/anomalydetector/CHANGELOG.md b/services/cognitiveservices/v1.0/anomalydetector/CHANGELOG.md new file mode 100644 index 000000000000..a1ecf841edb0 --- /dev/null +++ b/services/cognitiveservices/v1.0/anomalydetector/CHANGELOG.md @@ -0,0 +1,2 @@ +# Unreleased + diff --git a/services/cognitiveservices/v1.0/anomalydetector/_meta.json b/services/cognitiveservices/v1.0/anomalydetector/_meta.json new file mode 100644 index 000000000000..5ed095f74dc7 --- /dev/null +++ b/services/cognitiveservices/v1.0/anomalydetector/_meta.json @@ -0,0 +1,11 @@ +{ + "commit": "725b20c866d7f4a6512adff8d0647f0fe3baa069", + "readme": "/_/azure-rest-api-specs/specification/cognitiveservices/data-plane/AnomalyDetector/readme.md", + "tag": "release_1_0", + "use": "@microsoft.azure/autorest.go@2.1.187", + "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", + "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=release_1_0 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=V2 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/cognitiveservices/data-plane/AnomalyDetector/readme.md", + "additional_properties": { + "additional_options": "--go --verbose --use-onever --version=V2 --go.license-header=MICROSOFT_MIT_NO_VERSION" + } +} \ No newline at end of file diff --git a/services/cognitiveservices/v1.0/anomalydetector/anomalydetectorapi/interfaces.go b/services/cognitiveservices/v1.0/anomalydetector/anomalydetectorapi/interfaces.go new file mode 100644 index 000000000000..15d3f3ec890b --- /dev/null +++ b/services/cognitiveservices/v1.0/anomalydetector/anomalydetectorapi/interfaces.go @@ -0,0 +1,21 @@ +package anomalydetectorapi + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/services/cognitiveservices/v1.0/anomalydetector" +) + +// BaseClientAPI contains the set of methods on the BaseClient type. +type BaseClientAPI interface { + DetectChangePoint(ctx context.Context, body anomalydetector.ChangePointDetectRequest) (result anomalydetector.ChangePointDetectResponse, err error) + DetectEntireSeries(ctx context.Context, body anomalydetector.DetectRequest) (result anomalydetector.EntireDetectResponse, err error) + DetectLastPoint(ctx context.Context, body anomalydetector.DetectRequest) (result anomalydetector.LastDetectResponse, err error) +} + +var _ BaseClientAPI = (*anomalydetector.BaseClient)(nil) diff --git a/services/cognitiveservices/v1.0/anomalydetector/client.go b/services/cognitiveservices/v1.0/anomalydetector/client.go new file mode 100644 index 000000000000..ae51dc7beba8 --- /dev/null +++ b/services/cognitiveservices/v1.0/anomalydetector/client.go @@ -0,0 +1,279 @@ +// Package anomalydetector implements the Azure ARM Anomalydetector service API version 1.0. +// +// The Anomaly Detector API detects anomalies automatically in time series data. It supports two kinds of mode, one is +// for stateless using, another is for stateful using. In stateless mode, there are three functionalities. Entire +// Detect is for detecting the whole series with model trained by the time series, Last Detect is detecting last point +// with model trained by points before. ChangePoint Detect is for detecting trend changes in time series. In stateful +// mode, user can store time series, the stored time series will be used for detection anomalies. Under this mode, user +// can still use the above three functionalities by only giving a time range without preparing time series in client +// side. Besides the above three functionalities, stateful model also provide group based detection and labeling +// service. By leveraging labeling service user can provide labels for each detection result, these labels will be used +// for retuning or regenerating detection models. Inconsistency detection is a kind of group based detection, this +// detection will find inconsistency ones in a set of time series. By using anomaly detector service, business +// customers can discover incidents and establish a logic flow for root cause analysis. +package anomalydetector + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "crypto/tls" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// BaseClient is the base client for Anomalydetector. +type BaseClient struct { + autorest.Client + Endpoint string +} + +// New creates an instance of the BaseClient client. +func New(endpoint string) BaseClient { + return NewWithoutDefaults(endpoint) +} + +// NewWithoutDefaults creates an instance of the BaseClient client. +func NewWithoutDefaults(endpoint string) BaseClient { + return BaseClient{ + Client: autorest.NewClientWithOptions(autorest.ClientOptions{UserAgent: UserAgent(), Renegotiation: tls.RenegotiateFreelyAsClient}), + Endpoint: endpoint, + } +} + +// DetectChangePoint evaluate change point score of every series point +// Parameters: +// body - time series points and granularity is needed. Advanced model parameters can also be set in the +// request if needed. +func (client BaseClient) DetectChangePoint(ctx context.Context, body ChangePointDetectRequest) (result ChangePointDetectResponse, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.DetectChangePoint") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: body, + Constraints: []validation.Constraint{{Target: "body.Series", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("anomalydetector.BaseClient", "DetectChangePoint", err.Error()) + } + + req, err := client.DetectChangePointPreparer(ctx, body) + if err != nil { + err = autorest.NewErrorWithError(err, "anomalydetector.BaseClient", "DetectChangePoint", nil, "Failure preparing request") + return + } + + resp, err := client.DetectChangePointSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "anomalydetector.BaseClient", "DetectChangePoint", resp, "Failure sending request") + return + } + + result, err = client.DetectChangePointResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "anomalydetector.BaseClient", "DetectChangePoint", resp, "Failure responding to request") + return + } + + return +} + +// DetectChangePointPreparer prepares the DetectChangePoint request. +func (client BaseClient) DetectChangePointPreparer(ctx context.Context, body ChangePointDetectRequest) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithCustomBaseURL("{Endpoint}/anomalydetector/v1.0", urlParameters), + autorest.WithPath("/timeseries/changepoint/detect"), + autorest.WithJSON(body)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DetectChangePointSender sends the DetectChangePoint request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) DetectChangePointSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// DetectChangePointResponder handles the response to the DetectChangePoint request. The method always +// closes the http.Response Body. +func (client BaseClient) DetectChangePointResponder(resp *http.Response) (result ChangePointDetectResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// DetectEntireSeries this operation generates a model with an entire series, each point is detected with the same +// model. With this method, points before and after a certain point are used to determine whether it is an anomaly. The +// entire detection can give user an overall status of the time series. +// Parameters: +// body - time series points and period if needed. Advanced model parameters can also be set in the request. +func (client BaseClient) DetectEntireSeries(ctx context.Context, body DetectRequest) (result EntireDetectResponse, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.DetectEntireSeries") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: body, + Constraints: []validation.Constraint{{Target: "body.Series", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("anomalydetector.BaseClient", "DetectEntireSeries", err.Error()) + } + + req, err := client.DetectEntireSeriesPreparer(ctx, body) + if err != nil { + err = autorest.NewErrorWithError(err, "anomalydetector.BaseClient", "DetectEntireSeries", nil, "Failure preparing request") + return + } + + resp, err := client.DetectEntireSeriesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "anomalydetector.BaseClient", "DetectEntireSeries", resp, "Failure sending request") + return + } + + result, err = client.DetectEntireSeriesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "anomalydetector.BaseClient", "DetectEntireSeries", resp, "Failure responding to request") + return + } + + return +} + +// DetectEntireSeriesPreparer prepares the DetectEntireSeries request. +func (client BaseClient) DetectEntireSeriesPreparer(ctx context.Context, body DetectRequest) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithCustomBaseURL("{Endpoint}/anomalydetector/v1.0", urlParameters), + autorest.WithPath("/timeseries/entire/detect"), + autorest.WithJSON(body)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DetectEntireSeriesSender sends the DetectEntireSeries request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) DetectEntireSeriesSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// DetectEntireSeriesResponder handles the response to the DetectEntireSeries request. The method always +// closes the http.Response Body. +func (client BaseClient) DetectEntireSeriesResponder(resp *http.Response) (result EntireDetectResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// DetectLastPoint this operation generates a model using points before the latest one. With this method, only +// historical points are used to determine whether the target point is an anomaly. The latest point detecting operation +// matches the scenario of real-time monitoring of business metrics. +// Parameters: +// body - time series points and period if needed. Advanced model parameters can also be set in the request. +func (client BaseClient) DetectLastPoint(ctx context.Context, body DetectRequest) (result LastDetectResponse, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.DetectLastPoint") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: body, + Constraints: []validation.Constraint{{Target: "body.Series", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("anomalydetector.BaseClient", "DetectLastPoint", err.Error()) + } + + req, err := client.DetectLastPointPreparer(ctx, body) + if err != nil { + err = autorest.NewErrorWithError(err, "anomalydetector.BaseClient", "DetectLastPoint", nil, "Failure preparing request") + return + } + + resp, err := client.DetectLastPointSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "anomalydetector.BaseClient", "DetectLastPoint", resp, "Failure sending request") + return + } + + result, err = client.DetectLastPointResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "anomalydetector.BaseClient", "DetectLastPoint", resp, "Failure responding to request") + return + } + + return +} + +// DetectLastPointPreparer prepares the DetectLastPoint request. +func (client BaseClient) DetectLastPointPreparer(ctx context.Context, body DetectRequest) (*http.Request, error) { + urlParameters := map[string]interface{}{ + "Endpoint": client.Endpoint, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithCustomBaseURL("{Endpoint}/anomalydetector/v1.0", urlParameters), + autorest.WithPath("/timeseries/last/detect"), + autorest.WithJSON(body)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DetectLastPointSender sends the DetectLastPoint request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) DetectLastPointSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// DetectLastPointResponder handles the response to the DetectLastPoint request. The method always +// closes the http.Response Body. +func (client BaseClient) DetectLastPointResponder(resp *http.Response) (result LastDetectResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/cognitiveservices/v1.0/anomalydetector/enums.go b/services/cognitiveservices/v1.0/anomalydetector/enums.go new file mode 100644 index 000000000000..ca5b4cadaa5d --- /dev/null +++ b/services/cognitiveservices/v1.0/anomalydetector/enums.go @@ -0,0 +1,36 @@ +package anomalydetector + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// TimeGranularity enumerates the values for time granularity. +type TimeGranularity string + +const ( + // Daily ... + Daily TimeGranularity = "daily" + // Hourly ... + Hourly TimeGranularity = "hourly" + // Microsecond ... + Microsecond TimeGranularity = "microsecond" + // Monthly ... + Monthly TimeGranularity = "monthly" + // None ... + None TimeGranularity = "none" + // PerMinute ... + PerMinute TimeGranularity = "minutely" + // PerSecond ... + PerSecond TimeGranularity = "secondly" + // Weekly ... + Weekly TimeGranularity = "weekly" + // Yearly ... + Yearly TimeGranularity = "yearly" +) + +// PossibleTimeGranularityValues returns an array of possible values for the TimeGranularity const type. +func PossibleTimeGranularityValues() []TimeGranularity { + return []TimeGranularity{Daily, Hourly, Microsecond, Monthly, None, PerMinute, PerSecond, Weekly, Yearly} +} diff --git a/services/cognitiveservices/v1.0/anomalydetector/models.go b/services/cognitiveservices/v1.0/anomalydetector/models.go new file mode 100644 index 000000000000..9a81502bb018 --- /dev/null +++ b/services/cognitiveservices/v1.0/anomalydetector/models.go @@ -0,0 +1,127 @@ +package anomalydetector + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "encoding/json" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/date" +) + +// The package's fully qualified name. +const fqdn = "github.com/Azure/azure-sdk-for-go/services/cognitiveservices/v1.0/anomalydetector" + +// ChangePointDetectRequest ... +type ChangePointDetectRequest struct { + // Series - Time series data points. Points should be sorted by timestamp in ascending order to match the change point detection result. + Series *[]TimeSeriesPoint `json:"series,omitempty"` + // Granularity - Can only be one of yearly, monthly, weekly, daily, hourly, minutely or secondly. Granularity is used for verify whether input series is valid. Possible values include: 'Yearly', 'Monthly', 'Weekly', 'Daily', 'Hourly', 'PerMinute', 'PerSecond', 'Microsecond', 'None' + Granularity TimeGranularity `json:"granularity,omitempty"` + // CustomInterval - Custom Interval is used to set non-standard time interval, for example, if the series is 5 minutes, request can be set as {"granularity":"minutely", "customInterval":5}. + CustomInterval *int32 `json:"customInterval,omitempty"` + // Period - Optional argument, periodic value of a time series. If the value is null or does not present, the API will determine the period automatically. + Period *int32 `json:"period,omitempty"` + // StableTrendWindow - Optional argument, advanced model parameter, a default stableTrendWindow will be used in detection. + StableTrendWindow *int32 `json:"stableTrendWindow,omitempty"` + // Threshold - Optional argument, advanced model parameter, between 0.0-1.0, the lower the value is, the larger the trend error will be which means less change point will be accepted. + Threshold *float64 `json:"threshold,omitempty"` +} + +// ChangePointDetectResponse ... +type ChangePointDetectResponse struct { + autorest.Response `json:"-"` + // Period - READ-ONLY; Frequency extracted from the series, zero means no recurrent pattern has been found. + Period *int32 `json:"period,omitempty"` + // IsChangePoint - isChangePoint contains change point properties for each input point. True means an anomaly either negative or positive has been detected. The index of the array is consistent with the input series. + IsChangePoint *[]bool `json:"isChangePoint,omitempty"` + // ConfidenceScores - the change point confidence of each point + ConfidenceScores *[]float64 `json:"confidenceScores,omitempty"` +} + +// MarshalJSON is the custom marshaler for ChangePointDetectResponse. +func (cpdr ChangePointDetectResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cpdr.IsChangePoint != nil { + objectMap["isChangePoint"] = cpdr.IsChangePoint + } + if cpdr.ConfidenceScores != nil { + objectMap["confidenceScores"] = cpdr.ConfidenceScores + } + return json.Marshal(objectMap) +} + +// DetectRequest ... +type DetectRequest struct { + // Series - Time series data points. Points should be sorted by timestamp in ascending order to match the anomaly detection result. If the data is not sorted correctly or there is duplicated timestamp, the API will not work. In such case, an error message will be returned. + Series *[]TimeSeriesPoint `json:"series,omitempty"` + // Granularity - Possible values include: 'Yearly', 'Monthly', 'Weekly', 'Daily', 'Hourly', 'PerMinute', 'PerSecond', 'Microsecond', 'None' + Granularity TimeGranularity `json:"granularity,omitempty"` + // CustomInterval - Custom Interval is used to set non-standard time interval, for example, if the series is 5 minutes, request can be set as {"granularity":"minutely", "customInterval":5}. + CustomInterval *int32 `json:"customInterval,omitempty"` + // Period - Optional argument, periodic value of a time series. If the value is null or does not present, the API will determine the period automatically. + Period *int32 `json:"period,omitempty"` + // MaxAnomalyRatio - Optional argument, advanced model parameter, max anomaly ratio in a time series. + MaxAnomalyRatio *float64 `json:"maxAnomalyRatio,omitempty"` + // Sensitivity - Optional argument, advanced model parameter, between 0-99, the lower the value is, the larger the margin value will be which means less anomalies will be accepted. + Sensitivity *int32 `json:"sensitivity,omitempty"` +} + +// EntireDetectResponse ... +type EntireDetectResponse struct { + autorest.Response `json:"-"` + // Period - Frequency extracted from the series, zero means no recurrent pattern has been found. + Period *int32 `json:"period,omitempty"` + // ExpectedValues - ExpectedValues contain expected value for each input point. The index of the array is consistent with the input series. + ExpectedValues *[]float64 `json:"expectedValues,omitempty"` + // UpperMargins - UpperMargins contain upper margin of each input point. UpperMargin is used to calculate upperBoundary, which equals to expectedValue + (100 - marginScale)*upperMargin. Anomalies in response can be filtered by upperBoundary and lowerBoundary. By adjusting marginScale value, less significant anomalies can be filtered in client side. The index of the array is consistent with the input series. + UpperMargins *[]float64 `json:"upperMargins,omitempty"` + // LowerMargins - LowerMargins contain lower margin of each input point. LowerMargin is used to calculate lowerBoundary, which equals to expectedValue - (100 - marginScale)*lowerMargin. Points between the boundary can be marked as normal ones in client side. The index of the array is consistent with the input series. + LowerMargins *[]float64 `json:"lowerMargins,omitempty"` + // IsAnomaly - IsAnomaly contains anomaly properties for each input point. True means an anomaly either negative or positive has been detected. The index of the array is consistent with the input series. + IsAnomaly *[]bool `json:"isAnomaly,omitempty"` + // IsNegativeAnomaly - IsNegativeAnomaly contains anomaly status in negative direction for each input point. True means a negative anomaly has been detected. A negative anomaly means the point is detected as an anomaly and its real value is smaller than the expected one. The index of the array is consistent with the input series. + IsNegativeAnomaly *[]bool `json:"isNegativeAnomaly,omitempty"` + // IsPositiveAnomaly - IsPositiveAnomaly contain anomaly status in positive direction for each input point. True means a positive anomaly has been detected. A positive anomaly means the point is detected as an anomaly and its real value is larger than the expected one. The index of the array is consistent with the input series. + IsPositiveAnomaly *[]bool `json:"isPositiveAnomaly,omitempty"` +} + +// Error error information returned by the API. +type Error struct { + // Code - The error code. + Code interface{} `json:"code,omitempty"` + // Message - A message explaining the error reported by the service. + Message *string `json:"message,omitempty"` +} + +// LastDetectResponse ... +type LastDetectResponse struct { + autorest.Response `json:"-"` + // Period - Frequency extracted from the series, zero means no recurrent pattern has been found. + Period *int32 `json:"period,omitempty"` + // SuggestedWindow - Suggested input series points needed for detecting the latest point. + SuggestedWindow *int32 `json:"suggestedWindow,omitempty"` + // ExpectedValue - Expected value of the latest point. + ExpectedValue *float64 `json:"expectedValue,omitempty"` + // UpperMargin - Upper margin of the latest point. UpperMargin is used to calculate upperBoundary, which equals to expectedValue + (100 - marginScale)*upperMargin. If the value of latest point is between upperBoundary and lowerBoundary, it should be treated as normal value. By adjusting marginScale value, anomaly status of latest point can be changed. + UpperMargin *float64 `json:"upperMargin,omitempty"` + // LowerMargin - Lower margin of the latest point. LowerMargin is used to calculate lowerBoundary, which equals to expectedValue - (100 - marginScale)*lowerMargin. + LowerMargin *float64 `json:"lowerMargin,omitempty"` + // IsAnomaly - Anomaly status of the latest point, true means the latest point is an anomaly either in negative direction or positive direction. + IsAnomaly *bool `json:"isAnomaly,omitempty"` + // IsNegativeAnomaly - Anomaly status in negative direction of the latest point. True means the latest point is an anomaly and its real value is smaller than the expected one. + IsNegativeAnomaly *bool `json:"isNegativeAnomaly,omitempty"` + // IsPositiveAnomaly - Anomaly status in positive direction of the latest point. True means the latest point is an anomaly and its real value is larger than the expected one. + IsPositiveAnomaly *bool `json:"isPositiveAnomaly,omitempty"` +} + +// TimeSeriesPoint ... +type TimeSeriesPoint struct { + // Timestamp - Optional argument, timestamp of a data point (ISO8601 format). + Timestamp *date.Time `json:"timestamp,omitempty"` + // Value - The measurement of that point, should be float. + Value *float64 `json:"value,omitempty"` +} diff --git a/services/cognitiveservices/v1.0/anomalydetector/version.go b/services/cognitiveservices/v1.0/anomalydetector/version.go new file mode 100644 index 000000000000..4b875d7b1a90 --- /dev/null +++ b/services/cognitiveservices/v1.0/anomalydetector/version.go @@ -0,0 +1,19 @@ +package anomalydetector + +import "github.com/Azure/azure-sdk-for-go/version" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// UserAgent returns the UserAgent string to use when sending http.Requests. +func UserAgent() string { + return "Azure-SDK-For-Go/" + Version() + " anomalydetector/1.0" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return version.Number +}