diff --git a/profiles/latest/appinsights/mgmt/insights/models.go b/profiles/latest/appinsights/mgmt/insights/models.go index 801cf1e6cf9b..14bf73a94f2e 100644 --- a/profiles/latest/appinsights/mgmt/insights/models.go +++ b/profiles/latest/appinsights/mgmt/insights/models.go @@ -21,7 +21,6 @@ package insights import original "github.com/Azure/azure-sdk-for-go/services/appinsights/mgmt/2015-05-01/insights" -type AnalyticsItemClient = original.AnalyticsItemClient type AnnotationsClient = original.AnnotationsClient type APIKeysClient = original.APIKeysClient @@ -80,39 +79,6 @@ const ( Bluefield FlowType = original.Bluefield ) -type ItemScope = original.ItemScope - -const ( - ItemScopeShared ItemScope = original.ItemScopeShared - ItemScopeUser ItemScope = original.ItemScopeUser -) - -type ItemScopePath = original.ItemScopePath - -const ( - AnalyticsItems ItemScopePath = original.AnalyticsItems - MyanalyticsItems ItemScopePath = original.MyanalyticsItems -) - -type ItemType = original.ItemType - -const ( - Folder ItemType = original.Folder - Function ItemType = original.Function - Query ItemType = original.Query - Recent ItemType = original.Recent -) - -type ItemTypeParameter = original.ItemTypeParameter - -const ( - ItemTypeParameterFolder ItemTypeParameter = original.ItemTypeParameterFolder - ItemTypeParameterFunction ItemTypeParameter = original.ItemTypeParameterFunction - ItemTypeParameterNone ItemTypeParameter = original.ItemTypeParameterNone - ItemTypeParameterQuery ItemTypeParameter = original.ItemTypeParameterQuery - ItemTypeParameterRecent ItemTypeParameter = original.ItemTypeParameterRecent -) - type PurgeState = original.PurgeState const ( @@ -144,8 +110,6 @@ type Annotation = original.Annotation type AnnotationError = original.AnnotationError type APIKeyRequest = original.APIKeyRequest type ApplicationInsightsComponent = original.ApplicationInsightsComponent -type ApplicationInsightsComponentAnalyticsItem = original.ApplicationInsightsComponentAnalyticsItem -type ApplicationInsightsComponentAnalyticsItemProperties = original.ApplicationInsightsComponentAnalyticsItemProperties type ApplicationInsightsComponentAPIKey = original.ApplicationInsightsComponentAPIKey type ApplicationInsightsComponentAPIKeyListResult = original.ApplicationInsightsComponentAPIKeyListResult type ApplicationInsightsComponentAvailableFeatures = original.ApplicationInsightsComponentAvailableFeatures @@ -170,17 +134,14 @@ type ComponentPurgeBody = original.ComponentPurgeBody type ComponentPurgeBodyFilters = original.ComponentPurgeBodyFilters type ComponentPurgeResponse = original.ComponentPurgeResponse type ComponentPurgeStatusResponse = original.ComponentPurgeStatusResponse -type ComponentsPurgeFuture = original.ComponentsPurgeFuture type ErrorFieldContract = original.ErrorFieldContract type ErrorResponse = original.ErrorResponse type InnerError = original.InnerError type LinkProperties = original.LinkProperties type ListAnnotation = original.ListAnnotation -type ListApplicationInsightsComponentAnalyticsItem = original.ListApplicationInsightsComponentAnalyticsItem type ListApplicationInsightsComponentExportConfiguration = original.ListApplicationInsightsComponentExportConfiguration type ListApplicationInsightsComponentFavorite = original.ListApplicationInsightsComponentFavorite type ListApplicationInsightsComponentProactiveDetectionConfiguration = original.ListApplicationInsightsComponentProactiveDetectionConfiguration -type ListWorkbook = original.ListWorkbook type ListWorkItemConfiguration = original.ListWorkItemConfiguration type Operation = original.Operation type OperationDisplay = original.OperationDisplay @@ -212,12 +173,6 @@ type WorkbookClient = original.WorkbookClient type WorkbooksClient = original.WorkbooksClient type WorkItemConfigurationsClient = original.WorkItemConfigurationsClient -func NewAnalyticsItemClient(subscriptionID string) AnalyticsItemClient { - return original.NewAnalyticsItemClient(subscriptionID) -} -func NewAnalyticsItemClientWithBaseURI(baseURI string, subscriptionID string) AnalyticsItemClient { - return original.NewAnalyticsItemClientWithBaseURI(baseURI, subscriptionID) -} func NewAnnotationsClient(subscriptionID string) AnnotationsClient { return original.NewAnnotationsClient(subscriptionID) } @@ -299,18 +254,6 @@ func PossibleFavoriteTypeValues() []FavoriteType { func PossibleFlowTypeValues() []FlowType { return original.PossibleFlowTypeValues() } -func PossibleItemScopeValues() []ItemScope { - return original.PossibleItemScopeValues() -} -func PossibleItemScopePathValues() []ItemScopePath { - return original.PossibleItemScopePathValues() -} -func PossibleItemTypeValues() []ItemType { - return original.PossibleItemTypeValues() -} -func PossibleItemTypeParameterValues() []ItemTypeParameter { - return original.PossibleItemTypeParameterValues() -} func PossiblePurgeStateValues() []PurgeState { return original.PossiblePurgeStateValues() } diff --git a/profiles/preview/appinsights/mgmt/insights/models.go b/profiles/preview/appinsights/mgmt/insights/models.go index 9c24f8de4fc0..ca1cb7d7a611 100644 --- a/profiles/preview/appinsights/mgmt/insights/models.go +++ b/profiles/preview/appinsights/mgmt/insights/models.go @@ -21,7 +21,6 @@ package insights import original "github.com/Azure/azure-sdk-for-go/services/appinsights/mgmt/2015-05-01/insights" -type AnalyticsItemClient = original.AnalyticsItemClient type AnnotationsClient = original.AnnotationsClient type APIKeysClient = original.APIKeysClient @@ -80,39 +79,6 @@ const ( Bluefield FlowType = original.Bluefield ) -type ItemScope = original.ItemScope - -const ( - ItemScopeShared ItemScope = original.ItemScopeShared - ItemScopeUser ItemScope = original.ItemScopeUser -) - -type ItemScopePath = original.ItemScopePath - -const ( - AnalyticsItems ItemScopePath = original.AnalyticsItems - MyanalyticsItems ItemScopePath = original.MyanalyticsItems -) - -type ItemType = original.ItemType - -const ( - Folder ItemType = original.Folder - Function ItemType = original.Function - Query ItemType = original.Query - Recent ItemType = original.Recent -) - -type ItemTypeParameter = original.ItemTypeParameter - -const ( - ItemTypeParameterFolder ItemTypeParameter = original.ItemTypeParameterFolder - ItemTypeParameterFunction ItemTypeParameter = original.ItemTypeParameterFunction - ItemTypeParameterNone ItemTypeParameter = original.ItemTypeParameterNone - ItemTypeParameterQuery ItemTypeParameter = original.ItemTypeParameterQuery - ItemTypeParameterRecent ItemTypeParameter = original.ItemTypeParameterRecent -) - type PurgeState = original.PurgeState const ( @@ -144,8 +110,6 @@ type Annotation = original.Annotation type AnnotationError = original.AnnotationError type APIKeyRequest = original.APIKeyRequest type ApplicationInsightsComponent = original.ApplicationInsightsComponent -type ApplicationInsightsComponentAnalyticsItem = original.ApplicationInsightsComponentAnalyticsItem -type ApplicationInsightsComponentAnalyticsItemProperties = original.ApplicationInsightsComponentAnalyticsItemProperties type ApplicationInsightsComponentAPIKey = original.ApplicationInsightsComponentAPIKey type ApplicationInsightsComponentAPIKeyListResult = original.ApplicationInsightsComponentAPIKeyListResult type ApplicationInsightsComponentAvailableFeatures = original.ApplicationInsightsComponentAvailableFeatures @@ -170,17 +134,14 @@ type ComponentPurgeBody = original.ComponentPurgeBody type ComponentPurgeBodyFilters = original.ComponentPurgeBodyFilters type ComponentPurgeResponse = original.ComponentPurgeResponse type ComponentPurgeStatusResponse = original.ComponentPurgeStatusResponse -type ComponentsPurgeFuture = original.ComponentsPurgeFuture type ErrorFieldContract = original.ErrorFieldContract type ErrorResponse = original.ErrorResponse type InnerError = original.InnerError type LinkProperties = original.LinkProperties type ListAnnotation = original.ListAnnotation -type ListApplicationInsightsComponentAnalyticsItem = original.ListApplicationInsightsComponentAnalyticsItem type ListApplicationInsightsComponentExportConfiguration = original.ListApplicationInsightsComponentExportConfiguration type ListApplicationInsightsComponentFavorite = original.ListApplicationInsightsComponentFavorite type ListApplicationInsightsComponentProactiveDetectionConfiguration = original.ListApplicationInsightsComponentProactiveDetectionConfiguration -type ListWorkbook = original.ListWorkbook type ListWorkItemConfiguration = original.ListWorkItemConfiguration type Operation = original.Operation type OperationDisplay = original.OperationDisplay @@ -212,12 +173,6 @@ type WorkbookClient = original.WorkbookClient type WorkbooksClient = original.WorkbooksClient type WorkItemConfigurationsClient = original.WorkItemConfigurationsClient -func NewAnalyticsItemClient(subscriptionID string) AnalyticsItemClient { - return original.NewAnalyticsItemClient(subscriptionID) -} -func NewAnalyticsItemClientWithBaseURI(baseURI string, subscriptionID string) AnalyticsItemClient { - return original.NewAnalyticsItemClientWithBaseURI(baseURI, subscriptionID) -} func NewAnnotationsClient(subscriptionID string) AnnotationsClient { return original.NewAnnotationsClient(subscriptionID) } @@ -299,18 +254,6 @@ func PossibleFavoriteTypeValues() []FavoriteType { func PossibleFlowTypeValues() []FlowType { return original.PossibleFlowTypeValues() } -func PossibleItemScopeValues() []ItemScope { - return original.PossibleItemScopeValues() -} -func PossibleItemScopePathValues() []ItemScopePath { - return original.PossibleItemScopePathValues() -} -func PossibleItemTypeValues() []ItemType { - return original.PossibleItemTypeValues() -} -func PossibleItemTypeParameterValues() []ItemTypeParameter { - return original.PossibleItemTypeParameterValues() -} func PossiblePurgeStateValues() []PurgeState { return original.PossiblePurgeStateValues() } diff --git a/services/appinsights/mgmt/2015-05-01/insights/analyticsitem.go b/services/appinsights/mgmt/2015-05-01/insights/analyticsitem.go deleted file mode 100644 index 0e15f4d03040..000000000000 --- a/services/appinsights/mgmt/2015-05-01/insights/analyticsitem.go +++ /dev/null @@ -1,355 +0,0 @@ -package insights - -// 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" - "net/http" -) - -// AnalyticsItemClient is the composite Swagger for Application Insights Management Client -type AnalyticsItemClient struct { - BaseClient -} - -// NewAnalyticsItemClient creates an instance of the AnalyticsItemClient client. -func NewAnalyticsItemClient(subscriptionID string) AnalyticsItemClient { - return NewAnalyticsItemClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewAnalyticsItemClientWithBaseURI creates an instance of the AnalyticsItemClient client. -func NewAnalyticsItemClientWithBaseURI(baseURI string, subscriptionID string) AnalyticsItemClient { - return AnalyticsItemClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Delete deletes a specific Analytics Items defined within an Application Insights component. -// -// resourceGroupName is the name of the resource group. resourceName is the name of the Application Insights -// component resource. scopePath is enum indicating if this item definition is owned by a specific user or is -// shared between all users with access to the Application Insights component. ID is the Id of a specific item -// defined in the Application Insights component name is the name of a specific item defined in the Application -// Insights component -func (client AnalyticsItemClient) Delete(ctx context.Context, resourceGroupName string, resourceName string, scopePath ItemScopePath, ID string, name string) (result autorest.Response, err error) { - req, err := client.DeletePreparer(ctx, resourceGroupName, resourceName, scopePath, ID, name) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AnalyticsItemClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "insights.AnalyticsItemClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AnalyticsItemClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client AnalyticsItemClient) DeletePreparer(ctx context.Context, resourceGroupName string, resourceName string, scopePath ItemScopePath, ID string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "scopePath": autorest.Encode("path", scopePath), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(ID) > 0 { - queryParameters["id"] = autorest.Encode("query", ID) - } - if len(name) > 0 { - queryParameters["name"] = autorest.Encode("query", name) - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components/{resourceName}/{scopePath}/item", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client AnalyticsItemClient) DeleteSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req, - azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client AnalyticsItemClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets a specific Analytics Items defined within an Application Insights component. -// -// resourceGroupName is the name of the resource group. resourceName is the name of the Application Insights -// component resource. scopePath is enum indicating if this item definition is owned by a specific user or is -// shared between all users with access to the Application Insights component. ID is the Id of a specific item -// defined in the Application Insights component name is the name of a specific item defined in the Application -// Insights component -func (client AnalyticsItemClient) Get(ctx context.Context, resourceGroupName string, resourceName string, scopePath ItemScopePath, ID string, name string) (result ApplicationInsightsComponentAnalyticsItem, err error) { - req, err := client.GetPreparer(ctx, resourceGroupName, resourceName, scopePath, ID, name) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AnalyticsItemClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.AnalyticsItemClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AnalyticsItemClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client AnalyticsItemClient) GetPreparer(ctx context.Context, resourceGroupName string, resourceName string, scopePath ItemScopePath, ID string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "scopePath": autorest.Encode("path", scopePath), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(ID) > 0 { - queryParameters["id"] = autorest.Encode("query", ID) - } - if len(name) > 0 { - queryParameters["name"] = autorest.Encode("query", name) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components/{resourceName}/{scopePath}/item", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client AnalyticsItemClient) GetSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req, - azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client AnalyticsItemClient) GetResponder(resp *http.Response) (result ApplicationInsightsComponentAnalyticsItem, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List gets a list of Analytics Items defined within an Application Insights component. -// -// resourceGroupName is the name of the resource group. resourceName is the name of the Application Insights -// component resource. scopePath is enum indicating if this item definition is owned by a specific user or is -// shared between all users with access to the Application Insights component. scope is enum indicating if this -// item definition is owned by a specific user or is shared between all users with access to the Application -// Insights component. typeParameter is enum indicating the type of the Analytics item. includeContent is flag -// indicating whether or not to return the content of each applicable item. If false, only return the item -// information. -func (client AnalyticsItemClient) List(ctx context.Context, resourceGroupName string, resourceName string, scopePath ItemScopePath, scope ItemScope, typeParameter ItemTypeParameter, includeContent *bool) (result ListApplicationInsightsComponentAnalyticsItem, err error) { - req, err := client.ListPreparer(ctx, resourceGroupName, resourceName, scopePath, scope, typeParameter, includeContent) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AnalyticsItemClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.AnalyticsItemClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AnalyticsItemClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client AnalyticsItemClient) ListPreparer(ctx context.Context, resourceGroupName string, resourceName string, scopePath ItemScopePath, scope ItemScope, typeParameter ItemTypeParameter, includeContent *bool) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "scopePath": autorest.Encode("path", scopePath), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(string(scope)) > 0 { - queryParameters["scope"] = autorest.Encode("query", scope) - } else { - queryParameters["scope"] = autorest.Encode("query", "shared") - } - if len(string(typeParameter)) > 0 { - queryParameters["type"] = autorest.Encode("query", typeParameter) - } else { - queryParameters["type"] = autorest.Encode("query", "none") - } - if includeContent != nil { - queryParameters["includeContent"] = autorest.Encode("query", *includeContent) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components/{resourceName}/{scopePath}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client AnalyticsItemClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req, - azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client AnalyticsItemClient) ListResponder(resp *http.Response) (result ListApplicationInsightsComponentAnalyticsItem, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Put adds or Updates a specific Analytics Item within an Application Insights component. -// -// resourceGroupName is the name of the resource group. resourceName is the name of the Application Insights -// component resource. scopePath is enum indicating if this item definition is owned by a specific user or is -// shared between all users with access to the Application Insights component. itemProperties is properties that -// need to be specified to create a new item and add it to an Application Insights component. overrideItem is flag -// indicating whether or not to force save an item. This allows overriding an item if it already exists. -func (client AnalyticsItemClient) Put(ctx context.Context, resourceGroupName string, resourceName string, scopePath ItemScopePath, itemProperties ApplicationInsightsComponentAnalyticsItem, overrideItem *bool) (result ApplicationInsightsComponentAnalyticsItem, err error) { - req, err := client.PutPreparer(ctx, resourceGroupName, resourceName, scopePath, itemProperties, overrideItem) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AnalyticsItemClient", "Put", nil, "Failure preparing request") - return - } - - resp, err := client.PutSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.AnalyticsItemClient", "Put", resp, "Failure sending request") - return - } - - result, err = client.PutResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AnalyticsItemClient", "Put", resp, "Failure responding to request") - } - - return -} - -// PutPreparer prepares the Put request. -func (client AnalyticsItemClient) PutPreparer(ctx context.Context, resourceGroupName string, resourceName string, scopePath ItemScopePath, itemProperties ApplicationInsightsComponentAnalyticsItem, overrideItem *bool) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "scopePath": autorest.Encode("path", scopePath), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if overrideItem != nil { - queryParameters["overrideItem"] = autorest.Encode("query", *overrideItem) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components/{resourceName}/{scopePath}/item", pathParameters), - autorest.WithJSON(itemProperties), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// PutSender sends the Put request. The method will close the -// http.Response Body if it receives an error. -func (client AnalyticsItemClient) PutSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req, - azure.DoRetryWithRegistration(client.Client)) -} - -// PutResponder handles the response to the Put request. The method always -// closes the http.Response Body. -func (client AnalyticsItemClient) PutResponder(resp *http.Response) (result ApplicationInsightsComponentAnalyticsItem, 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/appinsights/mgmt/2015-05-01/insights/components.go b/services/appinsights/mgmt/2015-05-01/insights/components.go index 4e5161e2b97a..b403b928518b 100644 --- a/services/appinsights/mgmt/2015-05-01/insights/components.go +++ b/services/appinsights/mgmt/2015-05-01/insights/components.go @@ -250,6 +250,76 @@ func (client ComponentsClient) GetResponder(resp *http.Response) (result Applica return } +// GetPurgeStatus gets the status of a previously submitted purge using the id returned from the original purge +// request. +// +// resourceGroupName is the name of the resource group. resourceName is the name of the Application Insights +// component resource. purgeID is in a purge status request, this is the Id of the operation the status of which is +// returned. +func (client ComponentsClient) GetPurgeStatus(ctx context.Context, resourceGroupName string, resourceName string, purgeID string) (result ComponentPurgeStatusResponse, err error) { + req, err := client.GetPurgeStatusPreparer(ctx, resourceGroupName, resourceName, purgeID) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ComponentsClient", "GetPurgeStatus", nil, "Failure preparing request") + return + } + + resp, err := client.GetPurgeStatusSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.ComponentsClient", "GetPurgeStatus", resp, "Failure sending request") + return + } + + result, err = client.GetPurgeStatusResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ComponentsClient", "GetPurgeStatus", resp, "Failure responding to request") + } + + return +} + +// GetPurgeStatusPreparer prepares the GetPurgeStatus request. +func (client ComponentsClient) GetPurgeStatusPreparer(ctx context.Context, resourceGroupName string, resourceName string, purgeID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "purgeId": autorest.Encode("path", purgeID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-05-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/operations/{purgeId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetPurgeStatusSender sends the GetPurgeStatus request. The method will close the +// http.Response Body if it receives an error. +func (client ComponentsClient) GetPurgeStatusSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// GetPurgeStatusResponder handles the response to the GetPurgeStatus request. The method always +// closes the http.Response Body. +func (client ComponentsClient) GetPurgeStatusResponder(resp *http.Response) (result ComponentPurgeStatusResponse, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + // List gets a list of all Application Insights components within a subscription. func (client ComponentsClient) List(ctx context.Context) (result ApplicationInsightsComponentListResultPage, err error) { result.fn = client.listNextResults @@ -438,7 +508,7 @@ func (client ComponentsClient) ListByResourceGroupComplete(ctx context.Context, // resourceGroupName is the name of the resource group. resourceName is the name of the Application Insights // component resource. body is describes the body of a request to purge data in a single table of an Application // Insights component -func (client ComponentsClient) Purge(ctx context.Context, resourceGroupName string, resourceName string, body ComponentPurgeBody) (result ComponentsPurgeFuture, err error) { +func (client ComponentsClient) Purge(ctx context.Context, resourceGroupName string, resourceName string, body ComponentPurgeBody) (result ComponentPurgeResponse, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: body, Constraints: []validation.Constraint{{Target: "body.Table", Name: validation.Null, Rule: true, Chain: nil}, @@ -452,12 +522,18 @@ func (client ComponentsClient) Purge(ctx context.Context, resourceGroupName stri return } - result, err = client.PurgeSender(req) + resp, err := client.PurgeSender(req) if err != nil { - err = autorest.NewErrorWithError(err, "insights.ComponentsClient", "Purge", result.Response(), "Failure sending request") + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.ComponentsClient", "Purge", resp, "Failure sending request") return } + result, err = client.PurgeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ComponentsClient", "Purge", resp, "Failure responding to request") + } + return } @@ -486,22 +562,14 @@ func (client ComponentsClient) PurgePreparer(ctx context.Context, resourceGroupN // PurgeSender sends the Purge request. The method will close the // http.Response Body if it receives an error. -func (client ComponentsClient) PurgeSender(req *http.Request) (future ComponentsPurgeFuture, err error) { - sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) - future.Future = azure.NewFuture(req) - future.req = req - _, err = future.Done(sender) - if err != nil { - return - } - err = autorest.Respond(future.Response(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) - return +func (client ComponentsClient) PurgeSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) } // PurgeResponder handles the response to the Purge request. The method always // closes the http.Response Body. -func (client ComponentsClient) PurgeResponder(resp *http.Response) (result SetObject, err error) { +func (client ComponentsClient) PurgeResponder(resp *http.Response) (result ComponentPurgeResponse, err error) { err = autorest.Respond( resp, client.ByInspecting(), diff --git a/services/appinsights/mgmt/2015-05-01/insights/models.go b/services/appinsights/mgmt/2015-05-01/insights/models.go index 0a4c6c28340d..e58f29b0898a 100644 --- a/services/appinsights/mgmt/2015-05-01/insights/models.go +++ b/services/appinsights/mgmt/2015-05-01/insights/models.go @@ -20,7 +20,6 @@ package insights import ( "encoding/json" "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" "github.com/Azure/go-autorest/autorest/date" "github.com/Azure/go-autorest/autorest/to" "net/http" @@ -115,76 +114,6 @@ func PossibleFlowTypeValues() []FlowType { return []FlowType{Bluefield} } -// ItemScope enumerates the values for item scope. -type ItemScope string - -const ( - // ItemScopeShared ... - ItemScopeShared ItemScope = "shared" - // ItemScopeUser ... - ItemScopeUser ItemScope = "user" -) - -// PossibleItemScopeValues returns an array of possible values for the ItemScope const type. -func PossibleItemScopeValues() []ItemScope { - return []ItemScope{ItemScopeShared, ItemScopeUser} -} - -// ItemScopePath enumerates the values for item scope path. -type ItemScopePath string - -const ( - // AnalyticsItems ... - AnalyticsItems ItemScopePath = "analyticsItems" - // MyanalyticsItems ... - MyanalyticsItems ItemScopePath = "myanalyticsItems" -) - -// PossibleItemScopePathValues returns an array of possible values for the ItemScopePath const type. -func PossibleItemScopePathValues() []ItemScopePath { - return []ItemScopePath{AnalyticsItems, MyanalyticsItems} -} - -// ItemType enumerates the values for item type. -type ItemType string - -const ( - // Folder ... - Folder ItemType = "folder" - // Function ... - Function ItemType = "function" - // Query ... - Query ItemType = "query" - // Recent ... - Recent ItemType = "recent" -) - -// PossibleItemTypeValues returns an array of possible values for the ItemType const type. -func PossibleItemTypeValues() []ItemType { - return []ItemType{Folder, Function, Query, Recent} -} - -// ItemTypeParameter enumerates the values for item type parameter. -type ItemTypeParameter string - -const ( - // ItemTypeParameterFolder ... - ItemTypeParameterFolder ItemTypeParameter = "folder" - // ItemTypeParameterFunction ... - ItemTypeParameterFunction ItemTypeParameter = "function" - // ItemTypeParameterNone ... - ItemTypeParameterNone ItemTypeParameter = "none" - // ItemTypeParameterQuery ... - ItemTypeParameterQuery ItemTypeParameter = "query" - // ItemTypeParameterRecent ... - ItemTypeParameterRecent ItemTypeParameter = "recent" -) - -// PossibleItemTypeParameterValues returns an array of possible values for the ItemTypeParameter const type. -func PossibleItemTypeParameterValues() []ItemTypeParameter { - return []ItemTypeParameter{ItemTypeParameterFolder, ItemTypeParameterFunction, ItemTypeParameterNone, ItemTypeParameterQuery, ItemTypeParameterRecent} -} - // PurgeState enumerates the values for purge state. type PurgeState string @@ -402,36 +331,6 @@ func (aic *ApplicationInsightsComponent) UnmarshalJSON(body []byte) error { return nil } -// ApplicationInsightsComponentAnalyticsItem properties that define an Analytics item that is associated to an -// Application Insights component. -type ApplicationInsightsComponentAnalyticsItem struct { - autorest.Response `json:"-"` - // ID - Internally assigned unique id of the item definition. - ID *string `json:"Id,omitempty"` - // Name - The user-defined name of the item. - Name *string `json:"Name,omitempty"` - // Content - The content of this item - Content *string `json:"Content,omitempty"` - // Version - This instance's version of the data model. This can change as new features are added. - Version *string `json:"Version,omitempty"` - // Scope - Enum indicating if this item definition is owned by a specific user or is shared between all users with access to the Application Insights component. Possible values include: 'ItemScopeShared', 'ItemScopeUser' - Scope ItemScope `json:"Scope,omitempty"` - // Type - Enum indicating the type of the Analytics item. Possible values include: 'Query', 'Function', 'Folder', 'Recent' - Type ItemType `json:"Type,omitempty"` - // TimeCreated - Date and time in UTC when this item was created. - TimeCreated *string `json:"TimeCreated,omitempty"` - // TimeModified - Date and time in UTC of the last modification that was made to this item. - TimeModified *string `json:"TimeModified,omitempty"` - Properties *ApplicationInsightsComponentAnalyticsItemProperties `json:"Properties,omitempty"` -} - -// ApplicationInsightsComponentAnalyticsItemProperties a set of properties that can be defined in the context of a -// specific item type. Each type may have its own properties. -type ApplicationInsightsComponentAnalyticsItemProperties struct { - // FunctionAlias - A function alias, used when the type of the item is Function - FunctionAlias *string `json:"functionAlias,omitempty"` -} - // ApplicationInsightsComponentAPIKey properties that define an API key of an Application Insights Component. type ApplicationInsightsComponentAPIKey struct { autorest.Response `json:"-"` @@ -868,72 +767,24 @@ type ComponentPurgeBody struct { type ComponentPurgeBodyFilters struct { // Column - The column of the table over which the given query should run Column *string `json:"column,omitempty"` - // Operator - A query operator to evaluate over the provided column and value(s). - Operator *string `json:"operator,omitempty"` - // Value - the value for the operator to function over. This can be a number (e.g., > 100), a string (timestamp >= '2017-09-01') or array of values. - Value interface{} `json:"value,omitempty"` + // Filter - A query to to run over the provided table and column to purge the corresponding data. + Filter *string `json:"filter,omitempty"` } // ComponentPurgeResponse response containing operationId for a specific purge action. type ComponentPurgeResponse struct { + autorest.Response `json:"-"` // OperationID - Id to use when querying for status for a particular purge operation. OperationID *string `json:"operationId,omitempty"` } // ComponentPurgeStatusResponse response containing status for a specific purge operation. type ComponentPurgeStatusResponse struct { + autorest.Response `json:"-"` // Status - Status of the operation represented by the requested Id. Possible values include: 'Pending', 'Completed' Status PurgeState `json:"status,omitempty"` } -// ComponentsPurgeFuture an abstraction for monitoring and retrieving the results of a long-running operation. -type ComponentsPurgeFuture struct { - azure.Future - req *http.Request -} - -// Result returns the result of the asynchronous operation. -// If the operation has not completed it will return an error. -func (future ComponentsPurgeFuture) Result(client ComponentsClient) (so SetObject, err error) { - var done bool - done, err = future.Done(client) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ComponentsPurgeFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - return so, azure.NewAsyncOpIncompleteError("insights.ComponentsPurgeFuture") - } - if future.PollingMethod() == azure.PollingLocation { - so, err = client.PurgeResponder(future.Response()) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ComponentsPurgeFuture", "Result", future.Response(), "Failure responding to request") - } - return - } - var req *http.Request - var resp *http.Response - if future.PollingURL() != "" { - req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) - if err != nil { - return - } - } else { - req = autorest.ChangeToGet(future.req) - } - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ComponentsPurgeFuture", "Result", resp, "Failure sending request") - return - } - so, err = client.PurgeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ComponentsPurgeFuture", "Result", resp, "Failure responding to request") - } - return -} - // ErrorFieldContract error Field contract. type ErrorFieldContract struct { // Code - Property level error code. @@ -977,12 +828,6 @@ type ListAnnotation struct { Value *[]Annotation `json:"value,omitempty"` } -// ListApplicationInsightsComponentAnalyticsItem ... -type ListApplicationInsightsComponentAnalyticsItem struct { - autorest.Response `json:"-"` - Value *[]ApplicationInsightsComponentAnalyticsItem `json:"value,omitempty"` -} - // ListApplicationInsightsComponentExportConfiguration ... type ListApplicationInsightsComponentExportConfiguration struct { autorest.Response `json:"-"` @@ -1001,12 +846,6 @@ type ListApplicationInsightsComponentProactiveDetectionConfiguration struct { Value *[]ApplicationInsightsComponentProactiveDetectionConfiguration `json:"value,omitempty"` } -// ListWorkbook ... -type ListWorkbook struct { - autorest.Response `json:"-"` - Value *[]Workbook `json:"value,omitempty"` -} - // ListWorkItemConfiguration ... type ListWorkItemConfiguration struct { autorest.Response `json:"-"` diff --git a/services/appinsights/mgmt/2015-05-01/insights/workbook.go b/services/appinsights/mgmt/2015-05-01/insights/workbook.go index e2822bc46b93..7640e08e244d 100644 --- a/services/appinsights/mgmt/2015-05-01/insights/workbook.go +++ b/services/appinsights/mgmt/2015-05-01/insights/workbook.go @@ -190,10 +190,10 @@ func (client WorkbookClient) DeleteResponder(resp *http.Response) (result autore // Get get a single workbook by its resourceName. // -// resourceName is the name of the Application Insights component resource. location is the name of location where -// workbook is stored. -func (client WorkbookClient) Get(ctx context.Context, resourceName string, location string) (result Workbook, err error) { - req, err := client.GetPreparer(ctx, resourceName, location) +// resourceGroupName is the name of the resource group. resourceName is the name of the Application Insights +// component resource. location is the name of location where workbook is stored. +func (client WorkbookClient) Get(ctx context.Context, resourceGroupName string, resourceName string, location string) (result Workbook, err error) { + req, err := client.GetPreparer(ctx, resourceGroupName, resourceName, location) if err != nil { err = autorest.NewErrorWithError(err, "insights.WorkbookClient", "Get", nil, "Failure preparing request") return @@ -215,10 +215,11 @@ func (client WorkbookClient) Get(ctx context.Context, resourceName string, locat } // GetPreparer prepares the Get request. -func (client WorkbookClient) GetPreparer(ctx context.Context, resourceName string, location string) (*http.Request, error) { +func (client WorkbookClient) GetPreparer(ctx context.Context, resourceGroupName string, resourceName string, location string) (*http.Request, error) { pathParameters := map[string]interface{}{ - "resourceName": autorest.Encode("path", resourceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), } const APIVersion = "2015-05-01" @@ -230,7 +231,7 @@ func (client WorkbookClient) GetPreparer(ctx context.Context, resourceName strin preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/workbooks/{resourceName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroup/{resourceGroupName}/providers/microsoft.insights/workbooks/{resourceName}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -255,80 +256,6 @@ func (client WorkbookClient) GetResponder(resp *http.Response) (result Workbook, return } -// List gets a list of workbooks by sourceId. -// -// sourceID is azure Resource Id that will fetch all linked workbooks. category is category of workbook to return. -// tags is tags presents on each workbook returned. canFetchContent is flag indicating whether or not to return the -// full content for each applicable workbook. If false, only return summary content for workbooks. -func (client WorkbookClient) List(ctx context.Context, sourceID string, category CategoryType, tags []string, canFetchContent *bool) (result ListWorkbook, err error) { - req, err := client.ListPreparer(ctx, sourceID, category, tags, canFetchContent) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.WorkbookClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.WorkbookClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.WorkbookClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client WorkbookClient) ListPreparer(ctx context.Context, sourceID string, category CategoryType, tags []string, canFetchContent *bool) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - "category": autorest.Encode("query", category), - "sourceId": autorest.Encode("query", sourceID), - } - if tags != nil && len(tags) > 0 { - queryParameters["tags"] = autorest.Encode("query", tags, ",") - } - if canFetchContent != nil { - queryParameters["canFetchContent"] = autorest.Encode("query", *canFetchContent) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/workbooks", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client WorkbookClient) ListSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req, - azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client WorkbookClient) ListResponder(resp *http.Response) (result ListWorkbook, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - // Update updates a workbook that has already been added. // // resourceGroupName is the name of the resource group. resourceName is the name of the Application Insights