From 4172a9fd2ad1be8b03874ec7dc8993196d59810c Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Thu, 31 Jan 2019 13:18:25 +0000 Subject: [PATCH 1/4] Generated from c269df1b76e3ee31a0293ed2d8797c23757c86a0 fix file path; change class name; --- .../anomalyfinder/anomalyfinderapi/models.go | 24 ++ .../cognitiveservices/anomalyfinder/models.go | 56 +++++ .../anomalyfinder/anomalyfinderapi/models.go | 24 ++ .../cognitiveservices/anomalyfinder/models.go | 56 +++++ .../anomalyfinderapi/interfaces.go | 31 +++ .../v2.0/anomalyfinder/client.go | 235 ++++++++++++++++++ .../v2.0/anomalyfinder/models.go | 121 +++++++++ .../v2.0/anomalyfinder/version.go | 30 +++ 8 files changed, 577 insertions(+) create mode 100644 profiles/latest/cognitiveservices/anomalyfinder/anomalyfinderapi/models.go create mode 100644 profiles/latest/cognitiveservices/anomalyfinder/models.go create mode 100644 profiles/preview/cognitiveservices/anomalyfinder/anomalyfinderapi/models.go create mode 100644 profiles/preview/cognitiveservices/anomalyfinder/models.go create mode 100644 services/cognitiveservices/v2.0/anomalyfinder/anomalyfinderapi/interfaces.go create mode 100644 services/cognitiveservices/v2.0/anomalyfinder/client.go create mode 100644 services/cognitiveservices/v2.0/anomalyfinder/models.go create mode 100644 services/cognitiveservices/v2.0/anomalyfinder/version.go diff --git a/profiles/latest/cognitiveservices/anomalyfinder/anomalyfinderapi/models.go b/profiles/latest/cognitiveservices/anomalyfinder/anomalyfinderapi/models.go new file mode 100644 index 000000000000..497b8771a7f0 --- /dev/null +++ b/profiles/latest/cognitiveservices/anomalyfinder/anomalyfinderapi/models.go @@ -0,0 +1,24 @@ +// +build go1.9 + +// Copyright 2019 Microsoft Corporation +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// This code was auto-generated by: +// github.com/Azure/azure-sdk-for-go/tools/profileBuilder + +package anomalyfinderapi + +import original "github.com/Azure/azure-sdk-for-go/services/cognitiveservices/v2.0/anomalyfinder/anomalyfinderapi" + +type BaseClientAPI = original.BaseClientAPI diff --git a/profiles/latest/cognitiveservices/anomalyfinder/models.go b/profiles/latest/cognitiveservices/anomalyfinder/models.go new file mode 100644 index 000000000000..13cea3644e49 --- /dev/null +++ b/profiles/latest/cognitiveservices/anomalyfinder/models.go @@ -0,0 +1,56 @@ +// +build go1.9 + +// Copyright 2019 Microsoft Corporation +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// This code was auto-generated by: +// github.com/Azure/azure-sdk-for-go/tools/profileBuilder + +package anomalyfinder + +import original "github.com/Azure/azure-sdk-for-go/services/cognitiveservices/v2.0/anomalyfinder" + +type Granularity = original.Granularity + +const ( + Daily Granularity = original.Daily + Hourly Granularity = original.Hourly + Minutely Granularity = original.Minutely + Monthly Granularity = original.Monthly + Weekly Granularity = original.Weekly + Yearly Granularity = original.Yearly +) + +type APIError = original.APIError +type BaseClient = original.BaseClient +type EntireDetectResponse = original.EntireDetectResponse +type LastDetectResponse = original.LastDetectResponse +type Point = original.Point +type Request = original.Request + +func New(endpoint string) BaseClient { + return original.New(endpoint) +} +func NewWithoutDefaults(endpoint string) BaseClient { + return original.NewWithoutDefaults(endpoint) +} +func PossibleGranularityValues() []Granularity { + return original.PossibleGranularityValues() +} +func UserAgent() string { + return original.UserAgent() + " profiles/latest" +} +func Version() string { + return original.Version() +} diff --git a/profiles/preview/cognitiveservices/anomalyfinder/anomalyfinderapi/models.go b/profiles/preview/cognitiveservices/anomalyfinder/anomalyfinderapi/models.go new file mode 100644 index 000000000000..497b8771a7f0 --- /dev/null +++ b/profiles/preview/cognitiveservices/anomalyfinder/anomalyfinderapi/models.go @@ -0,0 +1,24 @@ +// +build go1.9 + +// Copyright 2019 Microsoft Corporation +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// This code was auto-generated by: +// github.com/Azure/azure-sdk-for-go/tools/profileBuilder + +package anomalyfinderapi + +import original "github.com/Azure/azure-sdk-for-go/services/cognitiveservices/v2.0/anomalyfinder/anomalyfinderapi" + +type BaseClientAPI = original.BaseClientAPI diff --git a/profiles/preview/cognitiveservices/anomalyfinder/models.go b/profiles/preview/cognitiveservices/anomalyfinder/models.go new file mode 100644 index 000000000000..a0cb7dd25a4f --- /dev/null +++ b/profiles/preview/cognitiveservices/anomalyfinder/models.go @@ -0,0 +1,56 @@ +// +build go1.9 + +// Copyright 2019 Microsoft Corporation +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// This code was auto-generated by: +// github.com/Azure/azure-sdk-for-go/tools/profileBuilder + +package anomalyfinder + +import original "github.com/Azure/azure-sdk-for-go/services/cognitiveservices/v2.0/anomalyfinder" + +type Granularity = original.Granularity + +const ( + Daily Granularity = original.Daily + Hourly Granularity = original.Hourly + Minutely Granularity = original.Minutely + Monthly Granularity = original.Monthly + Weekly Granularity = original.Weekly + Yearly Granularity = original.Yearly +) + +type APIError = original.APIError +type BaseClient = original.BaseClient +type EntireDetectResponse = original.EntireDetectResponse +type LastDetectResponse = original.LastDetectResponse +type Point = original.Point +type Request = original.Request + +func New(endpoint string) BaseClient { + return original.New(endpoint) +} +func NewWithoutDefaults(endpoint string) BaseClient { + return original.NewWithoutDefaults(endpoint) +} +func PossibleGranularityValues() []Granularity { + return original.PossibleGranularityValues() +} +func UserAgent() string { + return original.UserAgent() + " profiles/preview" +} +func Version() string { + return original.Version() +} diff --git a/services/cognitiveservices/v2.0/anomalyfinder/anomalyfinderapi/interfaces.go b/services/cognitiveservices/v2.0/anomalyfinder/anomalyfinderapi/interfaces.go new file mode 100644 index 000000000000..192bb260389a --- /dev/null +++ b/services/cognitiveservices/v2.0/anomalyfinder/anomalyfinderapi/interfaces.go @@ -0,0 +1,31 @@ +package anomalyfinderapi + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// 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/v2.0/anomalyfinder" +) + +// BaseClientAPI contains the set of methods on the BaseClient type. +type BaseClientAPI interface { + PostTimeseriesEntireDetect(ctx context.Context, body anomalyfinder.Request) (result anomalyfinder.EntireDetectResponse, err error) + PostTimeseriesLastDetect(ctx context.Context, body anomalyfinder.Request) (result anomalyfinder.LastDetectResponse, err error) +} + +var _ BaseClientAPI = (*anomalyfinder.BaseClient)(nil) diff --git a/services/cognitiveservices/v2.0/anomalyfinder/client.go b/services/cognitiveservices/v2.0/anomalyfinder/client.go new file mode 100644 index 000000000000..d637d9b436e4 --- /dev/null +++ b/services/cognitiveservices/v2.0/anomalyfinder/client.go @@ -0,0 +1,235 @@ +// Package anomalyfinder implements the Azure ARM Anomalyfinder service API version 2.0. +// +// The Anomaly Detection Service detects anomalies automatically in time series data. It supports two functionalities, +// one is for detecting the whole series with model trained by the timeseries, another is detecting last point with +// model trained by points before. By using this service, business customers can discover incidents and establish a +// logic flow for root cause analysis. Ensure online service quality is one of the main reasons we develop this +// service. Improving anomaly detection service to provide precise results will always be fundamental work of our team. +package anomalyfinder + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// 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/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 Anomalyfinder. +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.NewClientWithUserAgent(UserAgent()), + Endpoint: endpoint, + } +} + +// PostTimeseriesEntireDetect the operation will generate a model using the entire series, each point will be detected +// with the same model. In this method, points before and after a certain point will be used to determine whether it's +// 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) PostTimeseriesEntireDetect(ctx context.Context, body Request) (result EntireDetectResponse, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.PostTimeseriesEntireDetect") + 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: []validation.Constraint{{Target: "body.Series", Name: validation.MaxItems, Rule: 8640, Chain: nil}, + {Target: "body.Series", Name: validation.MinItems, Rule: 12, Chain: nil}, + }}, + {Target: "body.Period", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "body.Period", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}}}, + {Target: "body.MaxAnomalyRatio", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "body.MaxAnomalyRatio", Name: validation.ExclusiveMaximum, Rule: 0.5, Chain: nil}, + {Target: "body.MaxAnomalyRatio", Name: validation.ExclusiveMinimum, Rule: 0, Chain: nil}, + }}, + {Target: "body.Sensitivity", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "body.Sensitivity", Name: validation.InclusiveMaximum, Rule: int64(99), Chain: nil}, + {Target: "body.Sensitivity", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewError("anomalyfinder.BaseClient", "PostTimeseriesEntireDetect", err.Error()) + } + + req, err := client.PostTimeseriesEntireDetectPreparer(ctx, body) + if err != nil { + err = autorest.NewErrorWithError(err, "anomalyfinder.BaseClient", "PostTimeseriesEntireDetect", nil, "Failure preparing request") + return + } + + resp, err := client.PostTimeseriesEntireDetectSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "anomalyfinder.BaseClient", "PostTimeseriesEntireDetect", resp, "Failure sending request") + return + } + + result, err = client.PostTimeseriesEntireDetectResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "anomalyfinder.BaseClient", "PostTimeseriesEntireDetect", resp, "Failure responding to request") + } + + return +} + +// PostTimeseriesEntireDetectPreparer prepares the PostTimeseriesEntireDetect request. +func (client BaseClient) PostTimeseriesEntireDetectPreparer(ctx context.Context, body Request) (*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}/anomalyfinder/v2.0", urlParameters), + autorest.WithPath("/timeseries/entire/detect"), + autorest.WithJSON(body)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// PostTimeseriesEntireDetectSender sends the PostTimeseriesEntireDetect request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) PostTimeseriesEntireDetectSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// PostTimeseriesEntireDetectResponder handles the response to the PostTimeseriesEntireDetect request. The method always +// closes the http.Response Body. +func (client BaseClient) PostTimeseriesEntireDetectResponder(resp *http.Response) (result EntireDetectResponse, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// PostTimeseriesLastDetect the operation will generate a model using points before the latest one, In this method, +// only history points are used for determine whether the target point is an anomaly. Latest point detecting 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) PostTimeseriesLastDetect(ctx context.Context, body Request) (result LastDetectResponse, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.PostTimeseriesLastDetect") + 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: []validation.Constraint{{Target: "body.Series", Name: validation.MaxItems, Rule: 8640, Chain: nil}, + {Target: "body.Series", Name: validation.MinItems, Rule: 12, Chain: nil}, + }}, + {Target: "body.Period", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "body.Period", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}}}, + {Target: "body.MaxAnomalyRatio", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "body.MaxAnomalyRatio", Name: validation.ExclusiveMaximum, Rule: 0.5, Chain: nil}, + {Target: "body.MaxAnomalyRatio", Name: validation.ExclusiveMinimum, Rule: 0, Chain: nil}, + }}, + {Target: "body.Sensitivity", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "body.Sensitivity", Name: validation.InclusiveMaximum, Rule: int64(99), Chain: nil}, + {Target: "body.Sensitivity", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewError("anomalyfinder.BaseClient", "PostTimeseriesLastDetect", err.Error()) + } + + req, err := client.PostTimeseriesLastDetectPreparer(ctx, body) + if err != nil { + err = autorest.NewErrorWithError(err, "anomalyfinder.BaseClient", "PostTimeseriesLastDetect", nil, "Failure preparing request") + return + } + + resp, err := client.PostTimeseriesLastDetectSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "anomalyfinder.BaseClient", "PostTimeseriesLastDetect", resp, "Failure sending request") + return + } + + result, err = client.PostTimeseriesLastDetectResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "anomalyfinder.BaseClient", "PostTimeseriesLastDetect", resp, "Failure responding to request") + } + + return +} + +// PostTimeseriesLastDetectPreparer prepares the PostTimeseriesLastDetect request. +func (client BaseClient) PostTimeseriesLastDetectPreparer(ctx context.Context, body Request) (*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}/anomalyfinder/v2.0", urlParameters), + autorest.WithPath("/timeseries/last/detect"), + autorest.WithJSON(body)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// PostTimeseriesLastDetectSender sends the PostTimeseriesLastDetect request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) PostTimeseriesLastDetectSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// PostTimeseriesLastDetectResponder handles the response to the PostTimeseriesLastDetect request. The method always +// closes the http.Response Body. +func (client BaseClient) PostTimeseriesLastDetectResponder(resp *http.Response) (result LastDetectResponse, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/cognitiveservices/v2.0/anomalyfinder/models.go b/services/cognitiveservices/v2.0/anomalyfinder/models.go new file mode 100644 index 000000000000..87511b90925f --- /dev/null +++ b/services/cognitiveservices/v2.0/anomalyfinder/models.go @@ -0,0 +1,121 @@ +package anomalyfinder + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "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/v2.0/anomalyfinder" + +// Granularity enumerates the values for granularity. +type Granularity string + +const ( + // Daily ... + Daily Granularity = "daily" + // Hourly ... + Hourly Granularity = "hourly" + // Minutely ... + Minutely Granularity = "minutely" + // Monthly ... + Monthly Granularity = "monthly" + // Weekly ... + Weekly Granularity = "weekly" + // Yearly ... + Yearly Granularity = "yearly" +) + +// PossibleGranularityValues returns an array of possible values for the Granularity const type. +func PossibleGranularityValues() []Granularity { + return []Granularity{Daily, Hourly, Minutely, Monthly, Weekly, Yearly} +} + +// APIError error information returned by the API. +type APIError 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"` +} + +// 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 - sensitivity)*upperMargin. Anomalies in response can be filtered by upperBoundary and lowerBoundary. By adjusting sensitivity 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 - sensitivity)*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"` +} + +// 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 - sensitivity)*upperMargin. If the value of latest point is between upperBoudary and lowerBoudary, it should be treated as normal value. By adjusting sensitivity 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 - sensitivity)*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 anoamly 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"` +} + +// Point ... +type Point struct { + // Timestamp - Timestamp of a data point. Please make sure it aligns with the midnight, and use a UTC date time string, e.g., 2017-08-01T00:00:00Z. + Timestamp *date.Time `json:"Timestamp,omitempty"` + // Value - The measurement of that point, should be float. + Value *float64 `json:"Value,omitempty"` +} + +// Request ... +type Request 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 *[]Point `json:"Series,omitempty"` + // Granularity - Can only be one of yearly, monthly, weekly, daily, hourly or minutely. Granularity is used for verify whether input series is valid. Possible values include: 'Yearly', 'Monthly', 'Weekly', 'Daily', 'Hourly', 'Minutely' + Granularity Granularity `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. Must be between 0 and 0.5 (exclusive) + 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. Must be between 0 and 99 (inclusive) + Sensitivity *float64 `json:"Sensitivity,omitempty"` +} diff --git a/services/cognitiveservices/v2.0/anomalyfinder/version.go b/services/cognitiveservices/v2.0/anomalyfinder/version.go new file mode 100644 index 000000000000..1d6689bd944f --- /dev/null +++ b/services/cognitiveservices/v2.0/anomalyfinder/version.go @@ -0,0 +1,30 @@ +package anomalyfinder + +import "github.com/Azure/azure-sdk-for-go/version" + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// 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.Number + " anomalyfinder/2.0" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return version.Number +} From 240292a4500007c8d04e5f304356666f2962f905 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Thu, 31 Jan 2019 13:46:06 +0000 Subject: [PATCH 2/4] Generated from c1ca0b824a001098fdbed500175c046a9f4544b2 make camelCase style --- .../v2.0/anomalyfinder/models.go | 48 +++++++++---------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/services/cognitiveservices/v2.0/anomalyfinder/models.go b/services/cognitiveservices/v2.0/anomalyfinder/models.go index 87511b90925f..f31a9cbe8538 100644 --- a/services/cognitiveservices/v2.0/anomalyfinder/models.go +++ b/services/cognitiveservices/v2.0/anomalyfinder/models.go @@ -60,62 +60,62 @@ type APIError struct { 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"` + 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"` + 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 - sensitivity)*upperMargin. Anomalies in response can be filtered by upperBoundary and lowerBoundary. By adjusting sensitivity 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"` + 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 - sensitivity)*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"` + 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"` + 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"` + 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"` + IsPositiveAnomaly *[]bool `json:"isPositiveAnomaly,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"` + Period *int32 `json:"period,omitempty"` // SuggestedWindow - Suggested input series points needed for detecting the latest point. - SuggestedWindow *int32 `json:"SuggestedWindow,omitempty"` + SuggestedWindow *int32 `json:"suggestedWindow,omitempty"` // ExpectedValue - Expected value of the latest point. - ExpectedValue *float64 `json:"ExpectedValue,omitempty"` + ExpectedValue *float64 `json:"expectedValue,omitempty"` // UpperMargin - Upper margin of the latest point. UpperMargin is used to calculate upperBoundary, which equals to expectedValue + (100 - sensitivity)*upperMargin. If the value of latest point is between upperBoudary and lowerBoudary, it should be treated as normal value. By adjusting sensitivity value, anomaly status of latest point can be changed. - UpperMargin *float64 `json:"UpperMargin,omitempty"` + UpperMargin *float64 `json:"upperMargin,omitempty"` // LowerMargin - Lower margin of the latest point. LowerMargin is used to calculate lowerBoundary, which equals to expectedValue - (100 - sensitivity)*lowerMargin. - LowerMargin *float64 `json:"LowerMargin,omitempty"` + 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"` + IsAnomaly *bool `json:"isAnomaly,omitempty"` // IsNegativeAnomaly - Anomaly status in negative direction of the latest point. True means the latest point is an anoamly and its real value is smaller than the expected one. - IsNegativeAnomaly *bool `json:"IsNegativeAnomaly,omitempty"` + 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"` + IsPositiveAnomaly *bool `json:"isPositiveAnomaly,omitempty"` } // Point ... type Point struct { // Timestamp - Timestamp of a data point. Please make sure it aligns with the midnight, and use a UTC date time string, e.g., 2017-08-01T00:00:00Z. - Timestamp *date.Time `json:"Timestamp,omitempty"` + Timestamp *date.Time `json:"timestamp,omitempty"` // Value - The measurement of that point, should be float. - Value *float64 `json:"Value,omitempty"` + Value *float64 `json:"value,omitempty"` } // Request ... type Request 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 *[]Point `json:"Series,omitempty"` + Series *[]Point `json:"series,omitempty"` // Granularity - Can only be one of yearly, monthly, weekly, daily, hourly or minutely. Granularity is used for verify whether input series is valid. Possible values include: 'Yearly', 'Monthly', 'Weekly', 'Daily', 'Hourly', 'Minutely' - Granularity Granularity `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"` + Granularity Granularity `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"` + Period *int32 `json:"period,omitempty"` // MaxAnomalyRatio - Optional argument, advanced model parameter, max anomaly ratio in a time series. Must be between 0 and 0.5 (exclusive) - MaxAnomalyRatio *float64 `json:"MaxAnomalyRatio,omitempty"` + 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. Must be between 0 and 99 (inclusive) - Sensitivity *float64 `json:"Sensitivity,omitempty"` + Sensitivity *float64 `json:"sensitivity,omitempty"` } From 31a7f3a4adeda11d2c078378d460032b56a91573 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Fri, 1 Feb 2019 03:29:01 +0000 Subject: [PATCH 3/4] Generated from 8b927f42c4d2a40e4c8c62358e83bd3ccd28b6b9 fix typo; change operationId; remove hard code arg limitation; --- .../anomalyfinderapi/interfaces.go | 4 +- .../v2.0/anomalyfinder/client.go | 111 +++++++----------- .../v2.0/anomalyfinder/models.go | 8 +- 3 files changed, 48 insertions(+), 75 deletions(-) diff --git a/services/cognitiveservices/v2.0/anomalyfinder/anomalyfinderapi/interfaces.go b/services/cognitiveservices/v2.0/anomalyfinder/anomalyfinderapi/interfaces.go index 192bb260389a..8207746acb0f 100644 --- a/services/cognitiveservices/v2.0/anomalyfinder/anomalyfinderapi/interfaces.go +++ b/services/cognitiveservices/v2.0/anomalyfinder/anomalyfinderapi/interfaces.go @@ -24,8 +24,8 @@ import ( // BaseClientAPI contains the set of methods on the BaseClient type. type BaseClientAPI interface { - PostTimeseriesEntireDetect(ctx context.Context, body anomalyfinder.Request) (result anomalyfinder.EntireDetectResponse, err error) - PostTimeseriesLastDetect(ctx context.Context, body anomalyfinder.Request) (result anomalyfinder.LastDetectResponse, err error) + EntireDetect(ctx context.Context, body anomalyfinder.Request) (result anomalyfinder.EntireDetectResponse, err error) + LastDetect(ctx context.Context, body anomalyfinder.Request) (result anomalyfinder.LastDetectResponse, err error) } var _ BaseClientAPI = (*anomalyfinder.BaseClient)(nil) diff --git a/services/cognitiveservices/v2.0/anomalyfinder/client.go b/services/cognitiveservices/v2.0/anomalyfinder/client.go index d637d9b436e4..b02ba0768ddd 100644 --- a/services/cognitiveservices/v2.0/anomalyfinder/client.go +++ b/services/cognitiveservices/v2.0/anomalyfinder/client.go @@ -1,10 +1,9 @@ // Package anomalyfinder implements the Azure ARM Anomalyfinder service API version 2.0. // -// The Anomaly Detection Service detects anomalies automatically in time series data. It supports two functionalities, -// one is for detecting the whole series with model trained by the timeseries, another is detecting last point with -// model trained by points before. By using this service, business customers can discover incidents and establish a -// logic flow for root cause analysis. Ensure online service quality is one of the main reasons we develop this -// service. Improving anomaly detection service to provide precise results will always be fundamental work of our team. +// The Anomaly Finder API detects anomalies automatically in time series data. It supports two functionalities, one is +// for detecting the whole series with model trained by the timeseries, another is detecting last point with model +// trained by points before. By using this service, business customers can discover incidents and establish a logic +// flow for root cause analysis. package anomalyfinder // Copyright (c) Microsoft and contributors. All rights reserved. @@ -52,14 +51,14 @@ func NewWithoutDefaults(endpoint string) BaseClient { } } -// PostTimeseriesEntireDetect the operation will generate a model using the entire series, each point will be detected -// with the same model. In this method, points before and after a certain point will be used to determine whether it's -// an anomaly. The entire detection can give user an overall status of the time series. +// EntireDetect the operation will generate a model using the entire series, each point will be detected with the same +// model. In this method, points before and after a certain point will be used to determine whether it's 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) PostTimeseriesEntireDetect(ctx context.Context, body Request) (result EntireDetectResponse, err error) { +func (client BaseClient) EntireDetect(ctx context.Context, body Request) (result EntireDetectResponse, err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.PostTimeseriesEntireDetect") + ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.EntireDetect") defer func() { sc := -1 if result.Response.Response != nil { @@ -70,46 +69,33 @@ func (client BaseClient) PostTimeseriesEntireDetect(ctx context.Context, body Re } if err := validation.Validate([]validation.Validation{ {TargetValue: body, - Constraints: []validation.Constraint{{Target: "body.Series", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "body.Series", Name: validation.MaxItems, Rule: 8640, Chain: nil}, - {Target: "body.Series", Name: validation.MinItems, Rule: 12, Chain: nil}, - }}, - {Target: "body.Period", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "body.Period", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}}}, - {Target: "body.MaxAnomalyRatio", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "body.MaxAnomalyRatio", Name: validation.ExclusiveMaximum, Rule: 0.5, Chain: nil}, - {Target: "body.MaxAnomalyRatio", Name: validation.ExclusiveMinimum, Rule: 0, Chain: nil}, - }}, - {Target: "body.Sensitivity", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "body.Sensitivity", Name: validation.InclusiveMaximum, Rule: int64(99), Chain: nil}, - {Target: "body.Sensitivity", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("anomalyfinder.BaseClient", "PostTimeseriesEntireDetect", err.Error()) + Constraints: []validation.Constraint{{Target: "body.Series", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("anomalyfinder.BaseClient", "EntireDetect", err.Error()) } - req, err := client.PostTimeseriesEntireDetectPreparer(ctx, body) + req, err := client.EntireDetectPreparer(ctx, body) if err != nil { - err = autorest.NewErrorWithError(err, "anomalyfinder.BaseClient", "PostTimeseriesEntireDetect", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "anomalyfinder.BaseClient", "EntireDetect", nil, "Failure preparing request") return } - resp, err := client.PostTimeseriesEntireDetectSender(req) + resp, err := client.EntireDetectSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "anomalyfinder.BaseClient", "PostTimeseriesEntireDetect", resp, "Failure sending request") + err = autorest.NewErrorWithError(err, "anomalyfinder.BaseClient", "EntireDetect", resp, "Failure sending request") return } - result, err = client.PostTimeseriesEntireDetectResponder(resp) + result, err = client.EntireDetectResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "anomalyfinder.BaseClient", "PostTimeseriesEntireDetect", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "anomalyfinder.BaseClient", "EntireDetect", resp, "Failure responding to request") } return } -// PostTimeseriesEntireDetectPreparer prepares the PostTimeseriesEntireDetect request. -func (client BaseClient) PostTimeseriesEntireDetectPreparer(ctx context.Context, body Request) (*http.Request, error) { +// EntireDetectPreparer prepares the EntireDetect request. +func (client BaseClient) EntireDetectPreparer(ctx context.Context, body Request) (*http.Request, error) { urlParameters := map[string]interface{}{ "Endpoint": client.Endpoint, } @@ -123,16 +109,16 @@ func (client BaseClient) PostTimeseriesEntireDetectPreparer(ctx context.Context, return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// PostTimeseriesEntireDetectSender sends the PostTimeseriesEntireDetect request. The method will close the +// EntireDetectSender sends the EntireDetect request. The method will close the // http.Response Body if it receives an error. -func (client BaseClient) PostTimeseriesEntireDetectSender(req *http.Request) (*http.Response, error) { +func (client BaseClient) EntireDetectSender(req *http.Request) (*http.Response, error) { return autorest.SendWithSender(client, req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) } -// PostTimeseriesEntireDetectResponder handles the response to the PostTimeseriesEntireDetect request. The method always +// EntireDetectResponder handles the response to the EntireDetect request. The method always // closes the http.Response Body. -func (client BaseClient) PostTimeseriesEntireDetectResponder(resp *http.Response) (result EntireDetectResponse, err error) { +func (client BaseClient) EntireDetectResponder(resp *http.Response) (result EntireDetectResponse, err error) { err = autorest.Respond( resp, client.ByInspecting(), @@ -143,14 +129,14 @@ func (client BaseClient) PostTimeseriesEntireDetectResponder(resp *http.Response return } -// PostTimeseriesLastDetect the operation will generate a model using points before the latest one, In this method, -// only history points are used for determine whether the target point is an anomaly. Latest point detecting matches -// the scenario of real-time monitoring of business metrics. +// LastDetect the operation will generate a model using points before the latest one, In this method, only history +// points are used for determine whether the target point is an anomaly. Latest point detecting 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) PostTimeseriesLastDetect(ctx context.Context, body Request) (result LastDetectResponse, err error) { +func (client BaseClient) LastDetect(ctx context.Context, body Request) (result LastDetectResponse, err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.PostTimeseriesLastDetect") + ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.LastDetect") defer func() { sc := -1 if result.Response.Response != nil { @@ -161,46 +147,33 @@ func (client BaseClient) PostTimeseriesLastDetect(ctx context.Context, body Requ } if err := validation.Validate([]validation.Validation{ {TargetValue: body, - Constraints: []validation.Constraint{{Target: "body.Series", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "body.Series", Name: validation.MaxItems, Rule: 8640, Chain: nil}, - {Target: "body.Series", Name: validation.MinItems, Rule: 12, Chain: nil}, - }}, - {Target: "body.Period", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "body.Period", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}}}, - {Target: "body.MaxAnomalyRatio", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "body.MaxAnomalyRatio", Name: validation.ExclusiveMaximum, Rule: 0.5, Chain: nil}, - {Target: "body.MaxAnomalyRatio", Name: validation.ExclusiveMinimum, Rule: 0, Chain: nil}, - }}, - {Target: "body.Sensitivity", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "body.Sensitivity", Name: validation.InclusiveMaximum, Rule: int64(99), Chain: nil}, - {Target: "body.Sensitivity", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("anomalyfinder.BaseClient", "PostTimeseriesLastDetect", err.Error()) + Constraints: []validation.Constraint{{Target: "body.Series", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("anomalyfinder.BaseClient", "LastDetect", err.Error()) } - req, err := client.PostTimeseriesLastDetectPreparer(ctx, body) + req, err := client.LastDetectPreparer(ctx, body) if err != nil { - err = autorest.NewErrorWithError(err, "anomalyfinder.BaseClient", "PostTimeseriesLastDetect", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "anomalyfinder.BaseClient", "LastDetect", nil, "Failure preparing request") return } - resp, err := client.PostTimeseriesLastDetectSender(req) + resp, err := client.LastDetectSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "anomalyfinder.BaseClient", "PostTimeseriesLastDetect", resp, "Failure sending request") + err = autorest.NewErrorWithError(err, "anomalyfinder.BaseClient", "LastDetect", resp, "Failure sending request") return } - result, err = client.PostTimeseriesLastDetectResponder(resp) + result, err = client.LastDetectResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "anomalyfinder.BaseClient", "PostTimeseriesLastDetect", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "anomalyfinder.BaseClient", "LastDetect", resp, "Failure responding to request") } return } -// PostTimeseriesLastDetectPreparer prepares the PostTimeseriesLastDetect request. -func (client BaseClient) PostTimeseriesLastDetectPreparer(ctx context.Context, body Request) (*http.Request, error) { +// LastDetectPreparer prepares the LastDetect request. +func (client BaseClient) LastDetectPreparer(ctx context.Context, body Request) (*http.Request, error) { urlParameters := map[string]interface{}{ "Endpoint": client.Endpoint, } @@ -214,16 +187,16 @@ func (client BaseClient) PostTimeseriesLastDetectPreparer(ctx context.Context, b return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// PostTimeseriesLastDetectSender sends the PostTimeseriesLastDetect request. The method will close the +// LastDetectSender sends the LastDetect request. The method will close the // http.Response Body if it receives an error. -func (client BaseClient) PostTimeseriesLastDetectSender(req *http.Request) (*http.Response, error) { +func (client BaseClient) LastDetectSender(req *http.Request) (*http.Response, error) { return autorest.SendWithSender(client, req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) } -// PostTimeseriesLastDetectResponder handles the response to the PostTimeseriesLastDetect request. The method always +// LastDetectResponder handles the response to the LastDetect request. The method always // closes the http.Response Body. -func (client BaseClient) PostTimeseriesLastDetectResponder(resp *http.Response) (result LastDetectResponse, err error) { +func (client BaseClient) LastDetectResponder(resp *http.Response) (result LastDetectResponse, err error) { err = autorest.Respond( resp, client.ByInspecting(), diff --git a/services/cognitiveservices/v2.0/anomalyfinder/models.go b/services/cognitiveservices/v2.0/anomalyfinder/models.go index f31a9cbe8538..2050a29f115f 100644 --- a/services/cognitiveservices/v2.0/anomalyfinder/models.go +++ b/services/cognitiveservices/v2.0/anomalyfinder/models.go @@ -84,13 +84,13 @@ type LastDetectResponse struct { 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 - sensitivity)*upperMargin. If the value of latest point is between upperBoudary and lowerBoudary, it should be treated as normal value. By adjusting sensitivity value, anomaly status of latest point can be changed. + // UpperMargin - Upper margin of the latest point. UpperMargin is used to calculate upperBoundary, which equals to expectedValue + (100 - sensitivity)*upperMargin. If the value of latest point is between upperBoundary and lowerBoundary, it should be treated as normal value. By adjusting sensitivity 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 - sensitivity)*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 anoamly and its real value is smaller than the expected one. + // 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"` @@ -114,8 +114,8 @@ type Request struct { 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. Must be between 0 and 0.5 (exclusive) + // 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. Must be between 0 and 99 (inclusive) + // 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 *float64 `json:"sensitivity,omitempty"` } From eccf707c178215ce48ccf955870ea5ec386c4717 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Thu, 14 Feb 2019 06:19:08 +0000 Subject: [PATCH 4/4] Generated from bd7fbefc06352d5c28828840d4161b265a88700d fix type of "sensitivity"; change description of "timestamp"; --- services/cognitiveservices/v2.0/anomalyfinder/models.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/services/cognitiveservices/v2.0/anomalyfinder/models.go b/services/cognitiveservices/v2.0/anomalyfinder/models.go index 2050a29f115f..8ea88ea46f2b 100644 --- a/services/cognitiveservices/v2.0/anomalyfinder/models.go +++ b/services/cognitiveservices/v2.0/anomalyfinder/models.go @@ -98,7 +98,7 @@ type LastDetectResponse struct { // Point ... type Point struct { - // Timestamp - Timestamp of a data point. Please make sure it aligns with the midnight, and use a UTC date time string, e.g., 2017-08-01T00:00:00Z. + // Timestamp - 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"` @@ -117,5 +117,5 @@ type Request struct { // 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 *float64 `json:"sensitivity,omitempty"` + Sensitivity *int32 `json:"sensitivity,omitempty"` }