From a6eaad68d7b8734ed78f26d6eaebf35fb62e1a90 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Thu, 28 Feb 2019 09:31:59 +0000 Subject: [PATCH 1/4] Generated from b1be7ff4445823533a85f8ea5decf66b2c6c0fd9 add md and swagger files --- .../anomalydetectorapi/models.go | 24 ++ .../anomalydetector/models.go | 56 +++++ .../anomalydetectorapi/models.go | 24 ++ .../anomalydetector/models.go | 56 +++++ .../anomalydetectorapi/interfaces.go | 31 +++ .../v1.0/anomalydetector/client.go | 208 ++++++++++++++++++ .../v1.0/anomalydetector/models.go | 121 ++++++++++ .../v1.0/anomalydetector/version.go | 30 +++ 8 files changed, 550 insertions(+) create mode 100644 profiles/latest/cognitiveservices/anomalydetector/anomalydetectorapi/models.go create mode 100644 profiles/latest/cognitiveservices/anomalydetector/models.go create mode 100644 profiles/preview/cognitiveservices/anomalydetector/anomalydetectorapi/models.go create mode 100644 profiles/preview/cognitiveservices/anomalydetector/models.go create mode 100644 services/cognitiveservices/v1.0/anomalydetector/anomalydetectorapi/interfaces.go create mode 100644 services/cognitiveservices/v1.0/anomalydetector/client.go create mode 100644 services/cognitiveservices/v1.0/anomalydetector/models.go create mode 100644 services/cognitiveservices/v1.0/anomalydetector/version.go diff --git a/profiles/latest/cognitiveservices/anomalydetector/anomalydetectorapi/models.go b/profiles/latest/cognitiveservices/anomalydetector/anomalydetectorapi/models.go new file mode 100644 index 000000000000..7bbcd5c96bbb --- /dev/null +++ b/profiles/latest/cognitiveservices/anomalydetector/anomalydetectorapi/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 anomalydetectorapi + +import original "github.com/Azure/azure-sdk-for-go/services/cognitiveservices/v1.0/anomalydetector/anomalydetectorapi" + +type BaseClientAPI = original.BaseClientAPI diff --git a/profiles/latest/cognitiveservices/anomalydetector/models.go b/profiles/latest/cognitiveservices/anomalydetector/models.go new file mode 100644 index 000000000000..178e40e8e540 --- /dev/null +++ b/profiles/latest/cognitiveservices/anomalydetector/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 anomalydetector + +import original "github.com/Azure/azure-sdk-for-go/services/cognitiveservices/v1.0/anomalydetector" + +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/anomalydetector/anomalydetectorapi/models.go b/profiles/preview/cognitiveservices/anomalydetector/anomalydetectorapi/models.go new file mode 100644 index 000000000000..7bbcd5c96bbb --- /dev/null +++ b/profiles/preview/cognitiveservices/anomalydetector/anomalydetectorapi/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 anomalydetectorapi + +import original "github.com/Azure/azure-sdk-for-go/services/cognitiveservices/v1.0/anomalydetector/anomalydetectorapi" + +type BaseClientAPI = original.BaseClientAPI diff --git a/profiles/preview/cognitiveservices/anomalydetector/models.go b/profiles/preview/cognitiveservices/anomalydetector/models.go new file mode 100644 index 000000000000..42771586336f --- /dev/null +++ b/profiles/preview/cognitiveservices/anomalydetector/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 anomalydetector + +import original "github.com/Azure/azure-sdk-for-go/services/cognitiveservices/v1.0/anomalydetector" + +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/v1.0/anomalydetector/anomalydetectorapi/interfaces.go b/services/cognitiveservices/v1.0/anomalydetector/anomalydetectorapi/interfaces.go new file mode 100644 index 000000000000..9af528d1e4f7 --- /dev/null +++ b/services/cognitiveservices/v1.0/anomalydetector/anomalydetectorapi/interfaces.go @@ -0,0 +1,31 @@ +package anomalydetectorapi + +// 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/v1.0/anomalydetector" +) + +// BaseClientAPI contains the set of methods on the BaseClient type. +type BaseClientAPI interface { + EntireDetect(ctx context.Context, body anomalydetector.Request) (result anomalydetector.EntireDetectResponse, err error) + LastDetect(ctx context.Context, body anomalydetector.Request) (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..a7f9c10fc8d4 --- /dev/null +++ b/services/cognitiveservices/v1.0/anomalydetector/client.go @@ -0,0 +1,208 @@ +// 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 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 anomalydetector + +// 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 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.NewClientWithUserAgent(UserAgent()), + Endpoint: endpoint, + } +} + +// EntireDetect this operation generates a model using 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) EntireDetect(ctx context.Context, body Request) (result EntireDetectResponse, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.EntireDetect") + 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", "EntireDetect", err.Error()) + } + + req, err := client.EntireDetectPreparer(ctx, body) + if err != nil { + err = autorest.NewErrorWithError(err, "anomalydetector.BaseClient", "EntireDetect", nil, "Failure preparing request") + return + } + + resp, err := client.EntireDetectSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "anomalydetector.BaseClient", "EntireDetect", resp, "Failure sending request") + return + } + + result, err = client.EntireDetectResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "anomalydetector.BaseClient", "EntireDetect", resp, "Failure responding to request") + } + + return +} + +// EntireDetectPreparer prepares the EntireDetect request. +func (client BaseClient) EntireDetectPreparer(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}/anomalydetector/v1.0", urlParameters), + autorest.WithPath("/timeseries/entire/detect"), + autorest.WithJSON(body)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// EntireDetectSender sends the EntireDetect request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) EntireDetectSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// EntireDetectResponder handles the response to the EntireDetect request. The method always +// closes the http.Response Body. +func (client BaseClient) EntireDetectResponder(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 +} + +// LastDetect 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) LastDetect(ctx context.Context, body Request) (result LastDetectResponse, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.LastDetect") + 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", "LastDetect", err.Error()) + } + + req, err := client.LastDetectPreparer(ctx, body) + if err != nil { + err = autorest.NewErrorWithError(err, "anomalydetector.BaseClient", "LastDetect", nil, "Failure preparing request") + return + } + + resp, err := client.LastDetectSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "anomalydetector.BaseClient", "LastDetect", resp, "Failure sending request") + return + } + + result, err = client.LastDetectResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "anomalydetector.BaseClient", "LastDetect", resp, "Failure responding to request") + } + + return +} + +// LastDetectPreparer prepares the LastDetect request. +func (client BaseClient) LastDetectPreparer(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}/anomalydetector/v1.0", urlParameters), + autorest.WithPath("/timeseries/last/detect"), + autorest.WithJSON(body)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// LastDetectSender sends the LastDetect request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) LastDetectSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// LastDetectResponder handles the response to the LastDetect request. The method always +// closes the http.Response Body. +func (client BaseClient) LastDetectResponder(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/v1.0/anomalydetector/models.go b/services/cognitiveservices/v1.0/anomalydetector/models.go new file mode 100644 index 000000000000..7a1fc60096b5 --- /dev/null +++ b/services/cognitiveservices/v1.0/anomalydetector/models.go @@ -0,0 +1,121 @@ +package anomalydetector + +// 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/v1.0/anomalydetector" + +// 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 - 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"` +} + +// 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"` +} + +// Point ... +type Point struct { + // 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"` +} + +// 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. + 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"` +} diff --git a/services/cognitiveservices/v1.0/anomalydetector/version.go b/services/cognitiveservices/v1.0/anomalydetector/version.go new file mode 100644 index 000000000000..7ba25aa0af9e --- /dev/null +++ b/services/cognitiveservices/v1.0/anomalydetector/version.go @@ -0,0 +1,30 @@ +package anomalydetector + +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 + " anomalydetector/1.0" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return version.Number +} From 58e40f4a67ce7c7228d76fd56e824cf4e5a4e445 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Thu, 28 Feb 2019 18:47:20 +0000 Subject: [PATCH 2/4] Generated from f7a8f712fd5cc29cecc008984b5fe740a4e07774 fix go sdk output folder because this is public preview --- .../anomalydetectorapi/models.go | 24 ++ .../anomalydetector/models.go | 56 +++++ .../anomalydetectorapi/interfaces.go | 31 +++ .../v1.0/anomalydetector/client.go | 208 ++++++++++++++++++ .../v1.0/anomalydetector/models.go | 121 ++++++++++ .../v1.0/anomalydetector/version.go | 30 +++ 6 files changed, 470 insertions(+) create mode 100644 profiles/preview/preview/cognitiveservices/anomalydetector/anomalydetectorapi/models.go create mode 100644 profiles/preview/preview/cognitiveservices/anomalydetector/models.go create mode 100644 services/preview/cognitiveservices/v1.0/anomalydetector/anomalydetectorapi/interfaces.go create mode 100644 services/preview/cognitiveservices/v1.0/anomalydetector/client.go create mode 100644 services/preview/cognitiveservices/v1.0/anomalydetector/models.go create mode 100644 services/preview/cognitiveservices/v1.0/anomalydetector/version.go diff --git a/profiles/preview/preview/cognitiveservices/anomalydetector/anomalydetectorapi/models.go b/profiles/preview/preview/cognitiveservices/anomalydetector/anomalydetectorapi/models.go new file mode 100644 index 000000000000..59baf9caf7bb --- /dev/null +++ b/profiles/preview/preview/cognitiveservices/anomalydetector/anomalydetectorapi/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 anomalydetectorapi + +import original "github.com/Azure/azure-sdk-for-go/services/preview/cognitiveservices/v1.0/anomalydetector/anomalydetectorapi" + +type BaseClientAPI = original.BaseClientAPI diff --git a/profiles/preview/preview/cognitiveservices/anomalydetector/models.go b/profiles/preview/preview/cognitiveservices/anomalydetector/models.go new file mode 100644 index 000000000000..5eb8fb76e4e3 --- /dev/null +++ b/profiles/preview/preview/cognitiveservices/anomalydetector/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 anomalydetector + +import original "github.com/Azure/azure-sdk-for-go/services/preview/cognitiveservices/v1.0/anomalydetector" + +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/preview/cognitiveservices/v1.0/anomalydetector/anomalydetectorapi/interfaces.go b/services/preview/cognitiveservices/v1.0/anomalydetector/anomalydetectorapi/interfaces.go new file mode 100644 index 000000000000..f57b8a48443e --- /dev/null +++ b/services/preview/cognitiveservices/v1.0/anomalydetector/anomalydetectorapi/interfaces.go @@ -0,0 +1,31 @@ +package anomalydetectorapi + +// 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/preview/cognitiveservices/v1.0/anomalydetector" +) + +// BaseClientAPI contains the set of methods on the BaseClient type. +type BaseClientAPI interface { + EntireDetect(ctx context.Context, body anomalydetector.Request) (result anomalydetector.EntireDetectResponse, err error) + LastDetect(ctx context.Context, body anomalydetector.Request) (result anomalydetector.LastDetectResponse, err error) +} + +var _ BaseClientAPI = (*anomalydetector.BaseClient)(nil) diff --git a/services/preview/cognitiveservices/v1.0/anomalydetector/client.go b/services/preview/cognitiveservices/v1.0/anomalydetector/client.go new file mode 100644 index 000000000000..a7f9c10fc8d4 --- /dev/null +++ b/services/preview/cognitiveservices/v1.0/anomalydetector/client.go @@ -0,0 +1,208 @@ +// 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 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 anomalydetector + +// 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 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.NewClientWithUserAgent(UserAgent()), + Endpoint: endpoint, + } +} + +// EntireDetect this operation generates a model using 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) EntireDetect(ctx context.Context, body Request) (result EntireDetectResponse, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.EntireDetect") + 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", "EntireDetect", err.Error()) + } + + req, err := client.EntireDetectPreparer(ctx, body) + if err != nil { + err = autorest.NewErrorWithError(err, "anomalydetector.BaseClient", "EntireDetect", nil, "Failure preparing request") + return + } + + resp, err := client.EntireDetectSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "anomalydetector.BaseClient", "EntireDetect", resp, "Failure sending request") + return + } + + result, err = client.EntireDetectResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "anomalydetector.BaseClient", "EntireDetect", resp, "Failure responding to request") + } + + return +} + +// EntireDetectPreparer prepares the EntireDetect request. +func (client BaseClient) EntireDetectPreparer(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}/anomalydetector/v1.0", urlParameters), + autorest.WithPath("/timeseries/entire/detect"), + autorest.WithJSON(body)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// EntireDetectSender sends the EntireDetect request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) EntireDetectSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// EntireDetectResponder handles the response to the EntireDetect request. The method always +// closes the http.Response Body. +func (client BaseClient) EntireDetectResponder(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 +} + +// LastDetect 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) LastDetect(ctx context.Context, body Request) (result LastDetectResponse, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.LastDetect") + 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", "LastDetect", err.Error()) + } + + req, err := client.LastDetectPreparer(ctx, body) + if err != nil { + err = autorest.NewErrorWithError(err, "anomalydetector.BaseClient", "LastDetect", nil, "Failure preparing request") + return + } + + resp, err := client.LastDetectSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "anomalydetector.BaseClient", "LastDetect", resp, "Failure sending request") + return + } + + result, err = client.LastDetectResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "anomalydetector.BaseClient", "LastDetect", resp, "Failure responding to request") + } + + return +} + +// LastDetectPreparer prepares the LastDetect request. +func (client BaseClient) LastDetectPreparer(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}/anomalydetector/v1.0", urlParameters), + autorest.WithPath("/timeseries/last/detect"), + autorest.WithJSON(body)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// LastDetectSender sends the LastDetect request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) LastDetectSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// LastDetectResponder handles the response to the LastDetect request. The method always +// closes the http.Response Body. +func (client BaseClient) LastDetectResponder(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/preview/cognitiveservices/v1.0/anomalydetector/models.go b/services/preview/cognitiveservices/v1.0/anomalydetector/models.go new file mode 100644 index 000000000000..e82f87857fdb --- /dev/null +++ b/services/preview/cognitiveservices/v1.0/anomalydetector/models.go @@ -0,0 +1,121 @@ +package anomalydetector + +// 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/preview/cognitiveservices/v1.0/anomalydetector" + +// 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 - 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"` +} + +// 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"` +} + +// Point ... +type Point struct { + // 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"` +} + +// 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. + 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"` +} diff --git a/services/preview/cognitiveservices/v1.0/anomalydetector/version.go b/services/preview/cognitiveservices/v1.0/anomalydetector/version.go new file mode 100644 index 000000000000..7ba25aa0af9e --- /dev/null +++ b/services/preview/cognitiveservices/v1.0/anomalydetector/version.go @@ -0,0 +1,30 @@ +package anomalydetector + +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 + " anomalydetector/1.0" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return version.Number +} From 42d22e44c7634a2aae1d94d1901f346ae1030a7e Mon Sep 17 00:00:00 2001 From: Joel Hendrix Date: Thu, 28 Feb 2019 11:39:20 -0800 Subject: [PATCH 3/4] remove bad packages --- .../anomalydetectorapi/models.go | 24 -- .../anomalydetector/models.go | 56 ----- .../anomalyfinder/anomalyfinderapi/models.go | 24 -- .../cognitiveservices/anomalyfinder/models.go | 56 ----- .../anomalydetectorapi/models.go | 24 -- .../anomalydetector/models.go | 56 ----- .../anomalyfinder/anomalyfinderapi/models.go | 24 -- .../cognitiveservices/anomalyfinder/models.go | 56 ----- .../iotspaces/mgmt/iotspaces/models.go | 2 +- .../anomalydetectorapi/interfaces.go | 31 --- .../v1.0/anomalydetector/client.go | 208 ------------------ .../v1.0/anomalydetector/models.go | 121 ---------- .../v1.0/anomalydetector/version.go | 30 --- .../anomalyfinderapi/interfaces.go | 31 --- .../v2.0/anomalyfinder/client.go | 208 ------------------ .../v2.0/anomalyfinder/models.go | 121 ---------- .../v2.0/anomalyfinder/version.go | 30 --- 17 files changed, 1 insertion(+), 1101 deletions(-) delete mode 100644 profiles/latest/cognitiveservices/anomalydetector/anomalydetectorapi/models.go delete mode 100644 profiles/latest/cognitiveservices/anomalydetector/models.go delete mode 100644 profiles/latest/cognitiveservices/anomalyfinder/anomalyfinderapi/models.go delete mode 100644 profiles/latest/cognitiveservices/anomalyfinder/models.go delete mode 100644 profiles/preview/cognitiveservices/anomalydetector/anomalydetectorapi/models.go delete mode 100644 profiles/preview/cognitiveservices/anomalydetector/models.go delete mode 100644 profiles/preview/cognitiveservices/anomalyfinder/anomalyfinderapi/models.go delete mode 100644 profiles/preview/cognitiveservices/anomalyfinder/models.go delete mode 100644 services/cognitiveservices/v1.0/anomalydetector/anomalydetectorapi/interfaces.go delete mode 100644 services/cognitiveservices/v1.0/anomalydetector/client.go delete mode 100644 services/cognitiveservices/v1.0/anomalydetector/models.go delete mode 100644 services/cognitiveservices/v1.0/anomalydetector/version.go delete mode 100644 services/cognitiveservices/v2.0/anomalyfinder/anomalyfinderapi/interfaces.go delete mode 100644 services/cognitiveservices/v2.0/anomalyfinder/client.go delete mode 100644 services/cognitiveservices/v2.0/anomalyfinder/models.go delete mode 100644 services/cognitiveservices/v2.0/anomalyfinder/version.go diff --git a/profiles/latest/cognitiveservices/anomalydetector/anomalydetectorapi/models.go b/profiles/latest/cognitiveservices/anomalydetector/anomalydetectorapi/models.go deleted file mode 100644 index 7bbcd5c96bbb..000000000000 --- a/profiles/latest/cognitiveservices/anomalydetector/anomalydetectorapi/models.go +++ /dev/null @@ -1,24 +0,0 @@ -// +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 anomalydetectorapi - -import original "github.com/Azure/azure-sdk-for-go/services/cognitiveservices/v1.0/anomalydetector/anomalydetectorapi" - -type BaseClientAPI = original.BaseClientAPI diff --git a/profiles/latest/cognitiveservices/anomalydetector/models.go b/profiles/latest/cognitiveservices/anomalydetector/models.go deleted file mode 100644 index 178e40e8e540..000000000000 --- a/profiles/latest/cognitiveservices/anomalydetector/models.go +++ /dev/null @@ -1,56 +0,0 @@ -// +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 anomalydetector - -import original "github.com/Azure/azure-sdk-for-go/services/cognitiveservices/v1.0/anomalydetector" - -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/latest/cognitiveservices/anomalyfinder/anomalyfinderapi/models.go b/profiles/latest/cognitiveservices/anomalyfinder/anomalyfinderapi/models.go deleted file mode 100644 index 497b8771a7f0..000000000000 --- a/profiles/latest/cognitiveservices/anomalyfinder/anomalyfinderapi/models.go +++ /dev/null @@ -1,24 +0,0 @@ -// +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 deleted file mode 100644 index 13cea3644e49..000000000000 --- a/profiles/latest/cognitiveservices/anomalyfinder/models.go +++ /dev/null @@ -1,56 +0,0 @@ -// +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/anomalydetector/anomalydetectorapi/models.go b/profiles/preview/cognitiveservices/anomalydetector/anomalydetectorapi/models.go deleted file mode 100644 index 7bbcd5c96bbb..000000000000 --- a/profiles/preview/cognitiveservices/anomalydetector/anomalydetectorapi/models.go +++ /dev/null @@ -1,24 +0,0 @@ -// +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 anomalydetectorapi - -import original "github.com/Azure/azure-sdk-for-go/services/cognitiveservices/v1.0/anomalydetector/anomalydetectorapi" - -type BaseClientAPI = original.BaseClientAPI diff --git a/profiles/preview/cognitiveservices/anomalydetector/models.go b/profiles/preview/cognitiveservices/anomalydetector/models.go deleted file mode 100644 index 42771586336f..000000000000 --- a/profiles/preview/cognitiveservices/anomalydetector/models.go +++ /dev/null @@ -1,56 +0,0 @@ -// +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 anomalydetector - -import original "github.com/Azure/azure-sdk-for-go/services/cognitiveservices/v1.0/anomalydetector" - -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/profiles/preview/cognitiveservices/anomalyfinder/anomalyfinderapi/models.go b/profiles/preview/cognitiveservices/anomalyfinder/anomalyfinderapi/models.go deleted file mode 100644 index 497b8771a7f0..000000000000 --- a/profiles/preview/cognitiveservices/anomalyfinder/anomalyfinderapi/models.go +++ /dev/null @@ -1,24 +0,0 @@ -// +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 deleted file mode 100644 index a0cb7dd25a4f..000000000000 --- a/profiles/preview/cognitiveservices/anomalyfinder/models.go +++ /dev/null @@ -1,56 +0,0 @@ -// +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/profiles/preview/preview/iotspaces/mgmt/iotspaces/models.go b/profiles/preview/preview/iotspaces/mgmt/iotspaces/models.go index 6b6c901de55e..2a3a6894448b 100644 --- a/profiles/preview/preview/iotspaces/mgmt/iotspaces/models.go +++ b/profiles/preview/preview/iotspaces/mgmt/iotspaces/models.go @@ -23,7 +23,7 @@ import ( "context" original "github.com/Azure/azure-sdk-for-go/services/preview/iotspaces/mgmt/2017-10-01-preview/iotspaces" - uuid "github.com/satori/go.uuid" + "github.com/gofrs/uuid" ) const ( diff --git a/services/cognitiveservices/v1.0/anomalydetector/anomalydetectorapi/interfaces.go b/services/cognitiveservices/v1.0/anomalydetector/anomalydetectorapi/interfaces.go deleted file mode 100644 index 9af528d1e4f7..000000000000 --- a/services/cognitiveservices/v1.0/anomalydetector/anomalydetectorapi/interfaces.go +++ /dev/null @@ -1,31 +0,0 @@ -package anomalydetectorapi - -// 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/v1.0/anomalydetector" -) - -// BaseClientAPI contains the set of methods on the BaseClient type. -type BaseClientAPI interface { - EntireDetect(ctx context.Context, body anomalydetector.Request) (result anomalydetector.EntireDetectResponse, err error) - LastDetect(ctx context.Context, body anomalydetector.Request) (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 deleted file mode 100644 index a7f9c10fc8d4..000000000000 --- a/services/cognitiveservices/v1.0/anomalydetector/client.go +++ /dev/null @@ -1,208 +0,0 @@ -// 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 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 anomalydetector - -// 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 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.NewClientWithUserAgent(UserAgent()), - Endpoint: endpoint, - } -} - -// EntireDetect this operation generates a model using 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) EntireDetect(ctx context.Context, body Request) (result EntireDetectResponse, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.EntireDetect") - 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", "EntireDetect", err.Error()) - } - - req, err := client.EntireDetectPreparer(ctx, body) - if err != nil { - err = autorest.NewErrorWithError(err, "anomalydetector.BaseClient", "EntireDetect", nil, "Failure preparing request") - return - } - - resp, err := client.EntireDetectSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "anomalydetector.BaseClient", "EntireDetect", resp, "Failure sending request") - return - } - - result, err = client.EntireDetectResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "anomalydetector.BaseClient", "EntireDetect", resp, "Failure responding to request") - } - - return -} - -// EntireDetectPreparer prepares the EntireDetect request. -func (client BaseClient) EntireDetectPreparer(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}/anomalydetector/v1.0", urlParameters), - autorest.WithPath("/timeseries/entire/detect"), - autorest.WithJSON(body)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// EntireDetectSender sends the EntireDetect request. The method will close the -// http.Response Body if it receives an error. -func (client BaseClient) EntireDetectSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// EntireDetectResponder handles the response to the EntireDetect request. The method always -// closes the http.Response Body. -func (client BaseClient) EntireDetectResponder(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 -} - -// LastDetect 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) LastDetect(ctx context.Context, body Request) (result LastDetectResponse, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.LastDetect") - 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", "LastDetect", err.Error()) - } - - req, err := client.LastDetectPreparer(ctx, body) - if err != nil { - err = autorest.NewErrorWithError(err, "anomalydetector.BaseClient", "LastDetect", nil, "Failure preparing request") - return - } - - resp, err := client.LastDetectSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "anomalydetector.BaseClient", "LastDetect", resp, "Failure sending request") - return - } - - result, err = client.LastDetectResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "anomalydetector.BaseClient", "LastDetect", resp, "Failure responding to request") - } - - return -} - -// LastDetectPreparer prepares the LastDetect request. -func (client BaseClient) LastDetectPreparer(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}/anomalydetector/v1.0", urlParameters), - autorest.WithPath("/timeseries/last/detect"), - autorest.WithJSON(body)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// LastDetectSender sends the LastDetect request. The method will close the -// http.Response Body if it receives an error. -func (client BaseClient) LastDetectSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// LastDetectResponder handles the response to the LastDetect request. The method always -// closes the http.Response Body. -func (client BaseClient) LastDetectResponder(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/v1.0/anomalydetector/models.go b/services/cognitiveservices/v1.0/anomalydetector/models.go deleted file mode 100644 index 7a1fc60096b5..000000000000 --- a/services/cognitiveservices/v1.0/anomalydetector/models.go +++ /dev/null @@ -1,121 +0,0 @@ -package anomalydetector - -// 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/v1.0/anomalydetector" - -// 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 - 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"` -} - -// 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"` -} - -// Point ... -type Point struct { - // 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"` -} - -// 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. - 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"` -} diff --git a/services/cognitiveservices/v1.0/anomalydetector/version.go b/services/cognitiveservices/v1.0/anomalydetector/version.go deleted file mode 100644 index 7ba25aa0af9e..000000000000 --- a/services/cognitiveservices/v1.0/anomalydetector/version.go +++ /dev/null @@ -1,30 +0,0 @@ -package anomalydetector - -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 + " anomalydetector/1.0" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return version.Number -} diff --git a/services/cognitiveservices/v2.0/anomalyfinder/anomalyfinderapi/interfaces.go b/services/cognitiveservices/v2.0/anomalyfinder/anomalyfinderapi/interfaces.go deleted file mode 100644 index 8207746acb0f..000000000000 --- a/services/cognitiveservices/v2.0/anomalyfinder/anomalyfinderapi/interfaces.go +++ /dev/null @@ -1,31 +0,0 @@ -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 { - 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 deleted file mode 100644 index b02ba0768ddd..000000000000 --- a/services/cognitiveservices/v2.0/anomalyfinder/client.go +++ /dev/null @@ -1,208 +0,0 @@ -// Package anomalyfinder implements the Azure ARM Anomalyfinder service API version 2.0. -// -// 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. -// -// 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, - } -} - -// 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) EntireDetect(ctx context.Context, body Request) (result EntireDetectResponse, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.EntireDetect") - 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("anomalyfinder.BaseClient", "EntireDetect", err.Error()) - } - - req, err := client.EntireDetectPreparer(ctx, body) - if err != nil { - err = autorest.NewErrorWithError(err, "anomalyfinder.BaseClient", "EntireDetect", nil, "Failure preparing request") - return - } - - resp, err := client.EntireDetectSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "anomalyfinder.BaseClient", "EntireDetect", resp, "Failure sending request") - return - } - - result, err = client.EntireDetectResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "anomalyfinder.BaseClient", "EntireDetect", resp, "Failure responding to request") - } - - return -} - -// EntireDetectPreparer prepares the EntireDetect request. -func (client BaseClient) EntireDetectPreparer(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)) -} - -// EntireDetectSender sends the EntireDetect request. The method will close the -// http.Response Body if it receives an error. -func (client BaseClient) EntireDetectSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// EntireDetectResponder handles the response to the EntireDetect request. The method always -// closes the http.Response Body. -func (client BaseClient) EntireDetectResponder(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 -} - -// 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) LastDetect(ctx context.Context, body Request) (result LastDetectResponse, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.LastDetect") - 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("anomalyfinder.BaseClient", "LastDetect", err.Error()) - } - - req, err := client.LastDetectPreparer(ctx, body) - if err != nil { - err = autorest.NewErrorWithError(err, "anomalyfinder.BaseClient", "LastDetect", nil, "Failure preparing request") - return - } - - resp, err := client.LastDetectSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "anomalyfinder.BaseClient", "LastDetect", resp, "Failure sending request") - return - } - - result, err = client.LastDetectResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "anomalyfinder.BaseClient", "LastDetect", resp, "Failure responding to request") - } - - return -} - -// LastDetectPreparer prepares the LastDetect request. -func (client BaseClient) LastDetectPreparer(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)) -} - -// LastDetectSender sends the LastDetect request. The method will close the -// http.Response Body if it receives an error. -func (client BaseClient) LastDetectSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// LastDetectResponder handles the response to the LastDetect request. The method always -// closes the http.Response Body. -func (client BaseClient) LastDetectResponder(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 deleted file mode 100644 index 8ea88ea46f2b..000000000000 --- a/services/cognitiveservices/v2.0/anomalyfinder/models.go +++ /dev/null @@ -1,121 +0,0 @@ -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 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 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"` -} - -// Point ... -type Point struct { - // 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"` -} - -// 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. - 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"` -} diff --git a/services/cognitiveservices/v2.0/anomalyfinder/version.go b/services/cognitiveservices/v2.0/anomalyfinder/version.go deleted file mode 100644 index 1d6689bd944f..000000000000 --- a/services/cognitiveservices/v2.0/anomalyfinder/version.go +++ /dev/null @@ -1,30 +0,0 @@ -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 9076602cbf13fb7a585be1380a13a1172ba1dcad Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Fri, 15 Mar 2019 15:54:43 +0000 Subject: [PATCH 4/4] Generated from f7a8f712fd5cc29cecc008984b5fe740a4e07774 fix go sdk output folder because this is public preview --- Gopkg.lock | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Gopkg.lock b/Gopkg.lock index 78017f1ee6b6..0435d05bffa5 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -82,6 +82,14 @@ pruneopts = "" revision = "eeefdecb41b842af6dc652aaea4026e8403e62df" +[[projects]] + digest = "1:141cc9fc6279592458b304038bd16a05ef477d125c6dad281216345a11746fd7" + name = "github.com/gofrs/uuid" + packages = ["."] + pruneopts = "" + revision = "6b08a5c5172ba18946672b49749cde22873dd7c2" + version = "v3.2.0" + [[projects]] digest = "1:3dd078fda7500c341bc26cfbc6c6a34614f295a2457149fc1045cab767cbcf18" name = "github.com/golang/protobuf" @@ -383,6 +391,7 @@ "github.com/dnaeon/go-vcr/cassette", "github.com/dnaeon/go-vcr/recorder", "github.com/globalsign/mgo", + "github.com/gofrs/uuid", "github.com/marstr/collection", "github.com/marstr/guid", "github.com/pkg/errors",