diff --git a/profiles/latest/appinsights/mgmt/insights/models.go b/profiles/latest/appinsights/mgmt/insights/models.go index 205048b5f81b..c06bb7af5f78 100644 --- a/profiles/latest/appinsights/mgmt/insights/models.go +++ b/profiles/latest/appinsights/mgmt/insights/models.go @@ -21,7 +21,7 @@ package insights import original "github.com/Azure/azure-sdk-for-go/services/appinsights/mgmt/2015-05-01/insights" -type AnalyticsItemClient = original.AnalyticsItemClient +type AnalyticsItemsClient = original.AnalyticsItemsClient type AnnotationsClient = original.AnnotationsClient type APIKeysClient = original.APIKeysClient @@ -36,7 +36,6 @@ type ComponentFeatureCapabilitiesClient = original.ComponentFeatureCapabilitiesC type ComponentQuotaStatusClient = original.ComponentQuotaStatusClient type ComponentsClient = original.ComponentsClient type ExportConfigurationsClient = original.ExportConfigurationsClient -type FavoriteClient = original.FavoriteClient type FavoritesClient = original.FavoritesClient type ApplicationType = original.ApplicationType @@ -142,6 +141,7 @@ const ( type Annotation = original.Annotation type AnnotationError = original.AnnotationError +type AnnotationsListResult = original.AnnotationsListResult type APIKeyRequest = original.APIKeyRequest type ApplicationInsightsComponent = original.ApplicationInsightsComponent type ApplicationInsightsComponentAnalyticsItem = original.ApplicationInsightsComponentAnalyticsItem @@ -180,7 +180,6 @@ type ListApplicationInsightsComponentAnalyticsItem = original.ListApplicationIns type ListApplicationInsightsComponentExportConfiguration = original.ListApplicationInsightsComponentExportConfiguration type ListApplicationInsightsComponentFavorite = original.ListApplicationInsightsComponentFavorite type ListApplicationInsightsComponentProactiveDetectionConfiguration = original.ListApplicationInsightsComponentProactiveDetectionConfiguration -type ListWorkItemConfiguration = original.ListWorkItemConfiguration type Operation = original.Operation type OperationDisplay = original.OperationDisplay type OperationListResult = original.OperationListResult @@ -200,23 +199,23 @@ type Workbook = original.Workbook type WorkbookError = original.WorkbookError type WorkbookProperties = original.WorkbookProperties type WorkbookResource = original.WorkbookResource -type Workbooks = original.Workbooks +type WorkbooksListResult = original.WorkbooksListResult type WorkItemConfiguration = original.WorkItemConfiguration type WorkItemConfigurationError = original.WorkItemConfigurationError +type WorkItemConfigurationsListResult = original.WorkItemConfigurationsListResult type WorkItemCreateConfiguration = original.WorkItemCreateConfiguration type OperationsClient = original.OperationsClient type ProactiveDetectionConfigurationsClient = original.ProactiveDetectionConfigurationsClient type WebTestLocationsClient = original.WebTestLocationsClient type WebTestsClient = original.WebTestsClient -type WorkbookClient = original.WorkbookClient type WorkbooksClient = original.WorkbooksClient type WorkItemConfigurationsClient = original.WorkItemConfigurationsClient -func NewAnalyticsItemClient(subscriptionID string) AnalyticsItemClient { - return original.NewAnalyticsItemClient(subscriptionID) +func NewAnalyticsItemsClient(subscriptionID string) AnalyticsItemsClient { + return original.NewAnalyticsItemsClient(subscriptionID) } -func NewAnalyticsItemClientWithBaseURI(baseURI string, subscriptionID string) AnalyticsItemClient { - return original.NewAnalyticsItemClientWithBaseURI(baseURI, subscriptionID) +func NewAnalyticsItemsClientWithBaseURI(baseURI string, subscriptionID string) AnalyticsItemsClient { + return original.NewAnalyticsItemsClientWithBaseURI(baseURI, subscriptionID) } func NewAnnotationsClient(subscriptionID string) AnnotationsClient { return original.NewAnnotationsClient(subscriptionID) @@ -272,12 +271,6 @@ func NewExportConfigurationsClient(subscriptionID string) ExportConfigurationsCl func NewExportConfigurationsClientWithBaseURI(baseURI string, subscriptionID string) ExportConfigurationsClient { return original.NewExportConfigurationsClientWithBaseURI(baseURI, subscriptionID) } -func NewFavoriteClient(subscriptionID string) FavoriteClient { - return original.NewFavoriteClient(subscriptionID) -} -func NewFavoriteClientWithBaseURI(baseURI string, subscriptionID string) FavoriteClient { - return original.NewFavoriteClientWithBaseURI(baseURI, subscriptionID) -} func NewFavoritesClient(subscriptionID string) FavoritesClient { return original.NewFavoritesClient(subscriptionID) } @@ -353,12 +346,6 @@ func NewWebTestsClient(subscriptionID string) WebTestsClient { func NewWebTestsClientWithBaseURI(baseURI string, subscriptionID string) WebTestsClient { return original.NewWebTestsClientWithBaseURI(baseURI, subscriptionID) } -func NewWorkbookClient(subscriptionID string) WorkbookClient { - return original.NewWorkbookClient(subscriptionID) -} -func NewWorkbookClientWithBaseURI(baseURI string, subscriptionID string) WorkbookClient { - return original.NewWorkbookClientWithBaseURI(baseURI, subscriptionID) -} func NewWorkbooksClient(subscriptionID string) WorkbooksClient { return original.NewWorkbooksClient(subscriptionID) } diff --git a/profiles/preview/appinsights/mgmt/insights/models.go b/profiles/preview/appinsights/mgmt/insights/models.go index cc37794e599b..d88d1a980050 100644 --- a/profiles/preview/appinsights/mgmt/insights/models.go +++ b/profiles/preview/appinsights/mgmt/insights/models.go @@ -21,7 +21,7 @@ package insights import original "github.com/Azure/azure-sdk-for-go/services/appinsights/mgmt/2015-05-01/insights" -type AnalyticsItemClient = original.AnalyticsItemClient +type AnalyticsItemsClient = original.AnalyticsItemsClient type AnnotationsClient = original.AnnotationsClient type APIKeysClient = original.APIKeysClient @@ -36,7 +36,6 @@ type ComponentFeatureCapabilitiesClient = original.ComponentFeatureCapabilitiesC type ComponentQuotaStatusClient = original.ComponentQuotaStatusClient type ComponentsClient = original.ComponentsClient type ExportConfigurationsClient = original.ExportConfigurationsClient -type FavoriteClient = original.FavoriteClient type FavoritesClient = original.FavoritesClient type ApplicationType = original.ApplicationType @@ -142,6 +141,7 @@ const ( type Annotation = original.Annotation type AnnotationError = original.AnnotationError +type AnnotationsListResult = original.AnnotationsListResult type APIKeyRequest = original.APIKeyRequest type ApplicationInsightsComponent = original.ApplicationInsightsComponent type ApplicationInsightsComponentAnalyticsItem = original.ApplicationInsightsComponentAnalyticsItem @@ -180,7 +180,6 @@ type ListApplicationInsightsComponentAnalyticsItem = original.ListApplicationIns type ListApplicationInsightsComponentExportConfiguration = original.ListApplicationInsightsComponentExportConfiguration type ListApplicationInsightsComponentFavorite = original.ListApplicationInsightsComponentFavorite type ListApplicationInsightsComponentProactiveDetectionConfiguration = original.ListApplicationInsightsComponentProactiveDetectionConfiguration -type ListWorkItemConfiguration = original.ListWorkItemConfiguration type Operation = original.Operation type OperationDisplay = original.OperationDisplay type OperationListResult = original.OperationListResult @@ -200,23 +199,23 @@ type Workbook = original.Workbook type WorkbookError = original.WorkbookError type WorkbookProperties = original.WorkbookProperties type WorkbookResource = original.WorkbookResource -type Workbooks = original.Workbooks +type WorkbooksListResult = original.WorkbooksListResult type WorkItemConfiguration = original.WorkItemConfiguration type WorkItemConfigurationError = original.WorkItemConfigurationError +type WorkItemConfigurationsListResult = original.WorkItemConfigurationsListResult type WorkItemCreateConfiguration = original.WorkItemCreateConfiguration type OperationsClient = original.OperationsClient type ProactiveDetectionConfigurationsClient = original.ProactiveDetectionConfigurationsClient type WebTestLocationsClient = original.WebTestLocationsClient type WebTestsClient = original.WebTestsClient -type WorkbookClient = original.WorkbookClient type WorkbooksClient = original.WorkbooksClient type WorkItemConfigurationsClient = original.WorkItemConfigurationsClient -func NewAnalyticsItemClient(subscriptionID string) AnalyticsItemClient { - return original.NewAnalyticsItemClient(subscriptionID) +func NewAnalyticsItemsClient(subscriptionID string) AnalyticsItemsClient { + return original.NewAnalyticsItemsClient(subscriptionID) } -func NewAnalyticsItemClientWithBaseURI(baseURI string, subscriptionID string) AnalyticsItemClient { - return original.NewAnalyticsItemClientWithBaseURI(baseURI, subscriptionID) +func NewAnalyticsItemsClientWithBaseURI(baseURI string, subscriptionID string) AnalyticsItemsClient { + return original.NewAnalyticsItemsClientWithBaseURI(baseURI, subscriptionID) } func NewAnnotationsClient(subscriptionID string) AnnotationsClient { return original.NewAnnotationsClient(subscriptionID) @@ -272,12 +271,6 @@ func NewExportConfigurationsClient(subscriptionID string) ExportConfigurationsCl func NewExportConfigurationsClientWithBaseURI(baseURI string, subscriptionID string) ExportConfigurationsClient { return original.NewExportConfigurationsClientWithBaseURI(baseURI, subscriptionID) } -func NewFavoriteClient(subscriptionID string) FavoriteClient { - return original.NewFavoriteClient(subscriptionID) -} -func NewFavoriteClientWithBaseURI(baseURI string, subscriptionID string) FavoriteClient { - return original.NewFavoriteClientWithBaseURI(baseURI, subscriptionID) -} func NewFavoritesClient(subscriptionID string) FavoritesClient { return original.NewFavoritesClient(subscriptionID) } @@ -353,12 +346,6 @@ func NewWebTestsClient(subscriptionID string) WebTestsClient { func NewWebTestsClientWithBaseURI(baseURI string, subscriptionID string) WebTestsClient { return original.NewWebTestsClientWithBaseURI(baseURI, subscriptionID) } -func NewWorkbookClient(subscriptionID string) WorkbookClient { - return original.NewWorkbookClient(subscriptionID) -} -func NewWorkbookClientWithBaseURI(baseURI string, subscriptionID string) WorkbookClient { - return original.NewWorkbookClientWithBaseURI(baseURI, subscriptionID) -} func NewWorkbooksClient(subscriptionID string) WorkbooksClient { return original.NewWorkbooksClient(subscriptionID) } diff --git a/services/appinsights/mgmt/2015-05-01/insights/analyticsitem.go b/services/appinsights/mgmt/2015-05-01/insights/analyticsitems.go similarity index 71% rename from services/appinsights/mgmt/2015-05-01/insights/analyticsitem.go rename to services/appinsights/mgmt/2015-05-01/insights/analyticsitems.go index a3a3c27d658d..c4949b0fa0bc 100644 --- a/services/appinsights/mgmt/2015-05-01/insights/analyticsitem.go +++ b/services/appinsights/mgmt/2015-05-01/insights/analyticsitems.go @@ -24,19 +24,19 @@ import ( "net/http" ) -// AnalyticsItemClient is the composite Swagger for Application Insights Management Client -type AnalyticsItemClient struct { +// AnalyticsItemsClient is the composite Swagger for Application Insights Management Client +type AnalyticsItemsClient struct { BaseClient } -// NewAnalyticsItemClient creates an instance of the AnalyticsItemClient client. -func NewAnalyticsItemClient(subscriptionID string) AnalyticsItemClient { - return NewAnalyticsItemClientWithBaseURI(DefaultBaseURI, subscriptionID) +// NewAnalyticsItemsClient creates an instance of the AnalyticsItemsClient client. +func NewAnalyticsItemsClient(subscriptionID string) AnalyticsItemsClient { + return NewAnalyticsItemsClientWithBaseURI(DefaultBaseURI, subscriptionID) } -// NewAnalyticsItemClientWithBaseURI creates an instance of the AnalyticsItemClient client. -func NewAnalyticsItemClientWithBaseURI(baseURI string, subscriptionID string) AnalyticsItemClient { - return AnalyticsItemClient{NewWithBaseURI(baseURI, subscriptionID)} +// NewAnalyticsItemsClientWithBaseURI creates an instance of the AnalyticsItemsClient client. +func NewAnalyticsItemsClientWithBaseURI(baseURI string, subscriptionID string) AnalyticsItemsClient { + return AnalyticsItemsClient{NewWithBaseURI(baseURI, subscriptionID)} } // Delete deletes a specific Analytics Items defined within an Application Insights component. @@ -47,30 +47,30 @@ func NewAnalyticsItemClientWithBaseURI(baseURI string, subscriptionID string) An // users with access to the Application Insights component. // ID - the Id of a specific item defined in the Application Insights component // name - 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) { +func (client AnalyticsItemsClient) 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") + err = autorest.NewErrorWithError(err, "insights.AnalyticsItemsClient", "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") + err = autorest.NewErrorWithError(err, "insights.AnalyticsItemsClient", "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") + err = autorest.NewErrorWithError(err, "insights.AnalyticsItemsClient", "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) { +func (client AnalyticsItemsClient) 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), @@ -99,14 +99,14 @@ func (client AnalyticsItemClient) DeletePreparer(ctx context.Context, resourceGr // 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) { +func (client AnalyticsItemsClient) 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) { +func (client AnalyticsItemsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { err = autorest.Respond( resp, client.ByInspecting(), @@ -124,30 +124,30 @@ func (client AnalyticsItemClient) DeleteResponder(resp *http.Response) (result a // users with access to the Application Insights component. // ID - the Id of a specific item defined in the Application Insights component // name - 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) { +func (client AnalyticsItemsClient) 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") + err = autorest.NewErrorWithError(err, "insights.AnalyticsItemsClient", "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") + err = autorest.NewErrorWithError(err, "insights.AnalyticsItemsClient", "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") + err = autorest.NewErrorWithError(err, "insights.AnalyticsItemsClient", "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) { +func (client AnalyticsItemsClient) 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), @@ -176,14 +176,14 @@ func (client AnalyticsItemClient) GetPreparer(ctx context.Context, resourceGroup // 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) { +func (client AnalyticsItemsClient) 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) { +func (client AnalyticsItemsClient) GetResponder(resp *http.Response) (result ApplicationInsightsComponentAnalyticsItem, err error) { err = autorest.Respond( resp, client.ByInspecting(), @@ -205,30 +205,30 @@ func (client AnalyticsItemClient) GetResponder(resp *http.Response) (result Appl // typeParameter - enum indicating the type of the Analytics item. // includeContent - 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) { +func (client AnalyticsItemsClient) 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") + err = autorest.NewErrorWithError(err, "insights.AnalyticsItemsClient", "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") + err = autorest.NewErrorWithError(err, "insights.AnalyticsItemsClient", "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") + err = autorest.NewErrorWithError(err, "insights.AnalyticsItemsClient", "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) { +func (client AnalyticsItemsClient) 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), @@ -264,14 +264,14 @@ func (client AnalyticsItemClient) ListPreparer(ctx context.Context, resourceGrou // 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) { +func (client AnalyticsItemsClient) 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) { +func (client AnalyticsItemsClient) ListResponder(resp *http.Response) (result ListApplicationInsightsComponentAnalyticsItem, err error) { err = autorest.Respond( resp, client.ByInspecting(), @@ -292,30 +292,30 @@ func (client AnalyticsItemClient) ListResponder(resp *http.Response) (result Lis // Insights component. // overrideItem - 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) { +func (client AnalyticsItemsClient) 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") + err = autorest.NewErrorWithError(err, "insights.AnalyticsItemsClient", "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") + err = autorest.NewErrorWithError(err, "insights.AnalyticsItemsClient", "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") + err = autorest.NewErrorWithError(err, "insights.AnalyticsItemsClient", "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) { +func (client AnalyticsItemsClient) 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), @@ -343,14 +343,14 @@ func (client AnalyticsItemClient) PutPreparer(ctx context.Context, resourceGroup // 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) { +func (client AnalyticsItemsClient) 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) { +func (client AnalyticsItemsClient) PutResponder(resp *http.Response) (result ApplicationInsightsComponentAnalyticsItem, err error) { err = autorest.Respond( resp, client.ByInspecting(), diff --git a/services/appinsights/mgmt/2015-05-01/insights/annotations.go b/services/appinsights/mgmt/2015-05-01/insights/annotations.go index 7e548ea9ad83..fab37ef31a3c 100644 --- a/services/appinsights/mgmt/2015-05-01/insights/annotations.go +++ b/services/appinsights/mgmt/2015-05-01/insights/annotations.go @@ -254,7 +254,7 @@ func (client AnnotationsClient) GetResponder(resp *http.Response) (result ListAn // resourceName - the name of the Application Insights component resource. // start - the start time to query from for annotations, cannot be older than 90 days from current date. // end - the end time to query for annotations. -func (client AnnotationsClient) List(ctx context.Context, resourceGroupName string, resourceName string, start string, end string) (result ListAnnotation, err error) { +func (client AnnotationsClient) List(ctx context.Context, resourceGroupName string, resourceName string, start string, end string) (result AnnotationsListResult, err error) { req, err := client.ListPreparer(ctx, resourceGroupName, resourceName, start, end) if err != nil { err = autorest.NewErrorWithError(err, "insights.AnnotationsClient", "List", nil, "Failure preparing request") @@ -308,12 +308,12 @@ func (client AnnotationsClient) ListSender(req *http.Request) (*http.Response, e // ListResponder handles the response to the List request. The method always // closes the http.Response Body. -func (client AnnotationsClient) ListResponder(resp *http.Response) (result ListAnnotation, err error) { +func (client AnnotationsClient) ListResponder(resp *http.Response) (result AnnotationsListResult, err error) { err = autorest.Respond( resp, client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) result.Response = autorest.Response{Response: resp} return diff --git a/services/appinsights/mgmt/2015-05-01/insights/favorite.go b/services/appinsights/mgmt/2015-05-01/insights/favorite.go deleted file mode 100644 index 298cbefb4801..000000000000 --- a/services/appinsights/mgmt/2015-05-01/insights/favorite.go +++ /dev/null @@ -1,322 +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" -) - -// FavoriteClient is the composite Swagger for Application Insights Management Client -type FavoriteClient struct { - BaseClient -} - -// NewFavoriteClient creates an instance of the FavoriteClient client. -func NewFavoriteClient(subscriptionID string) FavoriteClient { - return NewFavoriteClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewFavoriteClientWithBaseURI creates an instance of the FavoriteClient client. -func NewFavoriteClientWithBaseURI(baseURI string, subscriptionID string) FavoriteClient { - return FavoriteClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Add adds a new favorites to an Application Insights component. -// Parameters: -// resourceGroupName - the name of the resource group. -// resourceName - the name of the Application Insights component resource. -// favoriteID - the Id of a specific favorite defined in the Application Insights component -// favoriteProperties - properties that need to be specified to create a new favorite and add it to an -// Application Insights component. -func (client FavoriteClient) Add(ctx context.Context, resourceGroupName string, resourceName string, favoriteID string, favoriteProperties ApplicationInsightsComponentFavorite) (result ApplicationInsightsComponentFavorite, err error) { - req, err := client.AddPreparer(ctx, resourceGroupName, resourceName, favoriteID, favoriteProperties) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.FavoriteClient", "Add", nil, "Failure preparing request") - return - } - - resp, err := client.AddSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.FavoriteClient", "Add", resp, "Failure sending request") - return - } - - result, err = client.AddResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.FavoriteClient", "Add", resp, "Failure responding to request") - } - - return -} - -// AddPreparer prepares the Add request. -func (client FavoriteClient) AddPreparer(ctx context.Context, resourceGroupName string, resourceName string, favoriteID string, favoriteProperties ApplicationInsightsComponentFavorite) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "favoriteId": autorest.Encode("path", favoriteID), - "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.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/favorites/{favoriteId}", pathParameters), - autorest.WithJSON(favoriteProperties), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// AddSender sends the Add request. The method will close the -// http.Response Body if it receives an error. -func (client FavoriteClient) AddSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req, - azure.DoRetryWithRegistration(client.Client)) -} - -// AddResponder handles the response to the Add request. The method always -// closes the http.Response Body. -func (client FavoriteClient) AddResponder(resp *http.Response) (result ApplicationInsightsComponentFavorite, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete remove a favorite that is associated to an Application Insights component. -// Parameters: -// resourceGroupName - the name of the resource group. -// resourceName - the name of the Application Insights component resource. -// favoriteID - the Id of a specific favorite defined in the Application Insights component -func (client FavoriteClient) Delete(ctx context.Context, resourceGroupName string, resourceName string, favoriteID string) (result autorest.Response, err error) { - req, err := client.DeletePreparer(ctx, resourceGroupName, resourceName, favoriteID) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.FavoriteClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "insights.FavoriteClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.FavoriteClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client FavoriteClient) DeletePreparer(ctx context.Context, resourceGroupName string, resourceName string, favoriteID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "favoriteId": autorest.Encode("path", favoriteID), - "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.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/favorites/{favoriteId}", 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 FavoriteClient) 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 FavoriteClient) 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 get a single favorite by its FavoriteId, defined within an Application Insights component. -// Parameters: -// resourceGroupName - the name of the resource group. -// resourceName - the name of the Application Insights component resource. -// favoriteID - the Id of a specific favorite defined in the Application Insights component -func (client FavoriteClient) Get(ctx context.Context, resourceGroupName string, resourceName string, favoriteID string) (result ApplicationInsightsComponentFavorite, err error) { - req, err := client.GetPreparer(ctx, resourceGroupName, resourceName, favoriteID) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.FavoriteClient", "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.FavoriteClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.FavoriteClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client FavoriteClient) GetPreparer(ctx context.Context, resourceGroupName string, resourceName string, favoriteID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "favoriteId": autorest.Encode("path", favoriteID), - "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}/favorites/{favoriteId}", 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 FavoriteClient) 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 FavoriteClient) GetResponder(resp *http.Response) (result ApplicationInsightsComponentFavorite, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Update updates a favorite that has already been added to an Application Insights component. -// Parameters: -// resourceGroupName - the name of the resource group. -// resourceName - the name of the Application Insights component resource. -// favoriteID - the Id of a specific favorite defined in the Application Insights component -// favoriteProperties - properties that need to be specified to update the existing favorite. -func (client FavoriteClient) Update(ctx context.Context, resourceGroupName string, resourceName string, favoriteID string, favoriteProperties ApplicationInsightsComponentFavorite) (result ApplicationInsightsComponentFavorite, err error) { - req, err := client.UpdatePreparer(ctx, resourceGroupName, resourceName, favoriteID, favoriteProperties) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.FavoriteClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.FavoriteClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.FavoriteClient", "Update", resp, "Failure responding to request") - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client FavoriteClient) UpdatePreparer(ctx context.Context, resourceGroupName string, resourceName string, favoriteID string, favoriteProperties ApplicationInsightsComponentFavorite) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "favoriteId": autorest.Encode("path", favoriteID), - "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.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/favorites/{favoriteId}", pathParameters), - autorest.WithJSON(favoriteProperties), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client FavoriteClient) UpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req, - azure.DoRetryWithRegistration(client.Client)) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client FavoriteClient) UpdateResponder(resp *http.Response) (result ApplicationInsightsComponentFavorite, 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/favorites.go b/services/appinsights/mgmt/2015-05-01/insights/favorites.go index 644e74980cd6..3da83bbe489d 100644 --- a/services/appinsights/mgmt/2015-05-01/insights/favorites.go +++ b/services/appinsights/mgmt/2015-05-01/insights/favorites.go @@ -39,6 +39,216 @@ func NewFavoritesClientWithBaseURI(baseURI string, subscriptionID string) Favori return FavoritesClient{NewWithBaseURI(baseURI, subscriptionID)} } +// Add adds a new favorites to an Application Insights component. +// Parameters: +// resourceGroupName - the name of the resource group. +// resourceName - the name of the Application Insights component resource. +// favoriteID - the Id of a specific favorite defined in the Application Insights component +// favoriteProperties - properties that need to be specified to create a new favorite and add it to an +// Application Insights component. +func (client FavoritesClient) Add(ctx context.Context, resourceGroupName string, resourceName string, favoriteID string, favoriteProperties ApplicationInsightsComponentFavorite) (result ApplicationInsightsComponentFavorite, err error) { + req, err := client.AddPreparer(ctx, resourceGroupName, resourceName, favoriteID, favoriteProperties) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.FavoritesClient", "Add", nil, "Failure preparing request") + return + } + + resp, err := client.AddSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.FavoritesClient", "Add", resp, "Failure sending request") + return + } + + result, err = client.AddResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.FavoritesClient", "Add", resp, "Failure responding to request") + } + + return +} + +// AddPreparer prepares the Add request. +func (client FavoritesClient) AddPreparer(ctx context.Context, resourceGroupName string, resourceName string, favoriteID string, favoriteProperties ApplicationInsightsComponentFavorite) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "favoriteId": autorest.Encode("path", favoriteID), + "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.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/favorites/{favoriteId}", pathParameters), + autorest.WithJSON(favoriteProperties), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// AddSender sends the Add request. The method will close the +// http.Response Body if it receives an error. +func (client FavoritesClient) AddSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// AddResponder handles the response to the Add request. The method always +// closes the http.Response Body. +func (client FavoritesClient) AddResponder(resp *http.Response) (result ApplicationInsightsComponentFavorite, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete remove a favorite that is associated to an Application Insights component. +// Parameters: +// resourceGroupName - the name of the resource group. +// resourceName - the name of the Application Insights component resource. +// favoriteID - the Id of a specific favorite defined in the Application Insights component +func (client FavoritesClient) Delete(ctx context.Context, resourceGroupName string, resourceName string, favoriteID string) (result autorest.Response, err error) { + req, err := client.DeletePreparer(ctx, resourceGroupName, resourceName, favoriteID) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.FavoritesClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "insights.FavoritesClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.FavoritesClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client FavoritesClient) DeletePreparer(ctx context.Context, resourceGroupName string, resourceName string, favoriteID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "favoriteId": autorest.Encode("path", favoriteID), + "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.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/favorites/{favoriteId}", 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 FavoritesClient) 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 FavoritesClient) 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 get a single favorite by its FavoriteId, defined within an Application Insights component. +// Parameters: +// resourceGroupName - the name of the resource group. +// resourceName - the name of the Application Insights component resource. +// favoriteID - the Id of a specific favorite defined in the Application Insights component +func (client FavoritesClient) Get(ctx context.Context, resourceGroupName string, resourceName string, favoriteID string) (result ApplicationInsightsComponentFavorite, err error) { + req, err := client.GetPreparer(ctx, resourceGroupName, resourceName, favoriteID) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.FavoritesClient", "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.FavoritesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.FavoritesClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client FavoritesClient) GetPreparer(ctx context.Context, resourceGroupName string, resourceName string, favoriteID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "favoriteId": autorest.Encode("path", favoriteID), + "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}/favorites/{favoriteId}", 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 FavoritesClient) 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 FavoritesClient) GetResponder(resp *http.Response) (result ApplicationInsightsComponentFavorite, 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 favorites defined within an Application Insights component. // Parameters: // resourceGroupName - the name of the resource group. @@ -125,3 +335,75 @@ func (client FavoritesClient) ListResponder(resp *http.Response) (result ListApp result.Response = autorest.Response{Response: resp} return } + +// Update updates a favorite that has already been added to an Application Insights component. +// Parameters: +// resourceGroupName - the name of the resource group. +// resourceName - the name of the Application Insights component resource. +// favoriteID - the Id of a specific favorite defined in the Application Insights component +// favoriteProperties - properties that need to be specified to update the existing favorite. +func (client FavoritesClient) Update(ctx context.Context, resourceGroupName string, resourceName string, favoriteID string, favoriteProperties ApplicationInsightsComponentFavorite) (result ApplicationInsightsComponentFavorite, err error) { + req, err := client.UpdatePreparer(ctx, resourceGroupName, resourceName, favoriteID, favoriteProperties) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.FavoritesClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.FavoritesClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.FavoritesClient", "Update", resp, "Failure responding to request") + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client FavoritesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, resourceName string, favoriteID string, favoriteProperties ApplicationInsightsComponentFavorite) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "favoriteId": autorest.Encode("path", favoriteID), + "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.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/favorites/{favoriteId}", pathParameters), + autorest.WithJSON(favoriteProperties), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client FavoritesClient) UpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client FavoritesClient) UpdateResponder(resp *http.Response) (result ApplicationInsightsComponentFavorite, 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/models.go b/services/appinsights/mgmt/2015-05-01/insights/models.go index 0af1f21dc105..3222af87998d 100644 --- a/services/appinsights/mgmt/2015-05-01/insights/models.go +++ b/services/appinsights/mgmt/2015-05-01/insights/models.go @@ -267,6 +267,13 @@ type AnnotationError struct { Innererror *InnerError `json:"innererror,omitempty"` } +// AnnotationsListResult annotations list result. +type AnnotationsListResult struct { + autorest.Response `json:"-"` + // Value - An array of annotations. + Value *[]Annotation `json:"value,omitempty"` +} + // APIKeyRequest an Application Insights component API Key createion request definition. type APIKeyRequest struct { // Name - The name of the API Key. @@ -989,12 +996,6 @@ type ListApplicationInsightsComponentProactiveDetectionConfiguration struct { Value *[]ApplicationInsightsComponentProactiveDetectionConfiguration `json:"value,omitempty"` } -// ListWorkItemConfiguration ... -type ListWorkItemConfiguration struct { - autorest.Response `json:"-"` - Value *[]WorkItemConfiguration `json:"value,omitempty"` -} - // Operation CDN REST API operation type Operation struct { // Name - Operation name: {provider}/{resource}/{operation} @@ -1631,8 +1632,8 @@ func (wr WorkbookResource) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// Workbooks workbook list result. -type Workbooks struct { +// WorkbooksListResult workbook list result. +type WorkbooksListResult struct { autorest.Response `json:"-"` // Value - An array of workbooks. Value *[]Workbook `json:"value,omitempty"` @@ -1662,6 +1663,13 @@ type WorkItemConfigurationError struct { Innererror *InnerError `json:"innererror,omitempty"` } +// WorkItemConfigurationsListResult work item configuration list result. +type WorkItemConfigurationsListResult struct { + autorest.Response `json:"-"` + // Value - An array of work item configurations. + Value *[]WorkItemConfiguration `json:"value,omitempty"` +} + // WorkItemCreateConfiguration work item configuration creation payload type WorkItemCreateConfiguration struct { // ConnectorID - Unique connector id diff --git a/services/appinsights/mgmt/2015-05-01/insights/workbook.go b/services/appinsights/mgmt/2015-05-01/insights/workbook.go deleted file mode 100644 index 65e002ea71fb..000000000000 --- a/services/appinsights/mgmt/2015-05-01/insights/workbook.go +++ /dev/null @@ -1,326 +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" - "github.com/Azure/go-autorest/autorest/validation" - "net/http" -) - -// WorkbookClient is the composite Swagger for Application Insights Management Client -type WorkbookClient struct { - BaseClient -} - -// NewWorkbookClient creates an instance of the WorkbookClient client. -func NewWorkbookClient(subscriptionID string) WorkbookClient { - return NewWorkbookClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWorkbookClientWithBaseURI creates an instance of the WorkbookClient client. -func NewWorkbookClientWithBaseURI(baseURI string, subscriptionID string) WorkbookClient { - return WorkbookClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create a new workbook. -// Parameters: -// resourceGroupName - the name of the resource group. -// resourceName - the name of the Application Insights component resource. -// workbookProperties - properties that need to be specified to create a new workbook. -func (client WorkbookClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, workbookProperties Workbook) (result Workbook, err error) { - if err := validation.Validate([]validation.Validation{ - {TargetValue: workbookProperties, - Constraints: []validation.Constraint{{Target: "workbookProperties.WorkbookProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "workbookProperties.WorkbookProperties.Name", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "workbookProperties.WorkbookProperties.SerializedData", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "workbookProperties.WorkbookProperties.WorkbookID", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "workbookProperties.WorkbookProperties.Category", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "workbookProperties.WorkbookProperties.UserID", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("insights.WorkbookClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, resourceName, workbookProperties) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.WorkbookClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.WorkbookClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.WorkbookClient", "CreateOrUpdate", resp, "Failure responding to request") - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client WorkbookClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, resourceName string, workbookProperties Workbook) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "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.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroup/{resourceGroupName}/providers/microsoft.insights/workbooks/{resourceName}", pathParameters), - autorest.WithJSON(workbookProperties), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client WorkbookClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req, - azure.DoRetryWithRegistration(client.Client)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client WorkbookClient) CreateOrUpdateResponder(resp *http.Response) (result Workbook, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete a workbook. -// Parameters: -// resourceGroupName - the name of the resource group. -// resourceName - the name of the Application Insights component resource. -func (client WorkbookClient) Delete(ctx context.Context, resourceGroupName string, resourceName string) (result autorest.Response, err error) { - req, err := client.DeletePreparer(ctx, resourceGroupName, resourceName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.WorkbookClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "insights.WorkbookClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.WorkbookClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client WorkbookClient) DeletePreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "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.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroup/{resourceGroupName}/providers/microsoft.insights/workbooks/{resourceName}", 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 WorkbookClient) 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 WorkbookClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get get a single workbook by its resourceName. -// Parameters: -// resourceGroupName - the name of the resource group. -// resourceName - the name of the Application Insights component resource. -func (client WorkbookClient) Get(ctx context.Context, resourceGroupName string, resourceName string) (result Workbook, err error) { - req, err := client.GetPreparer(ctx, resourceGroupName, resourceName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.WorkbookClient", "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.WorkbookClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.WorkbookClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client WorkbookClient) GetPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "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}/resourceGroup/{resourceGroupName}/providers/microsoft.insights/workbooks/{resourceName}", 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 WorkbookClient) 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 WorkbookClient) GetResponder(resp *http.Response) (result Workbook, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Update updates a workbook that has already been added. -// Parameters: -// resourceGroupName - the name of the resource group. -// resourceName - the name of the Application Insights component resource. -// workbookProperties - properties that need to be specified to create a new workbook. -func (client WorkbookClient) Update(ctx context.Context, resourceGroupName string, resourceName string, workbookProperties Workbook) (result Workbook, err error) { - req, err := client.UpdatePreparer(ctx, resourceGroupName, resourceName, workbookProperties) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.WorkbookClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.WorkbookClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.WorkbookClient", "Update", resp, "Failure responding to request") - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client WorkbookClient) UpdatePreparer(ctx context.Context, resourceGroupName string, resourceName string, workbookProperties Workbook) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "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.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroup/{resourceGroupName}/providers/microsoft.insights/workbooks/{resourceName}", pathParameters), - autorest.WithJSON(workbookProperties), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client WorkbookClient) UpdateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req, - azure.DoRetryWithRegistration(client.Client)) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client WorkbookClient) UpdateResponder(resp *http.Response) (result Workbook, 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/workbooks.go b/services/appinsights/mgmt/2015-05-01/insights/workbooks.go index 46e4f0d82c87..7dc771d3813d 100644 --- a/services/appinsights/mgmt/2015-05-01/insights/workbooks.go +++ b/services/appinsights/mgmt/2015-05-01/insights/workbooks.go @@ -21,6 +21,7 @@ import ( "context" "github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" "net/http" ) @@ -39,6 +40,221 @@ func NewWorkbooksClientWithBaseURI(baseURI string, subscriptionID string) Workbo return WorkbooksClient{NewWithBaseURI(baseURI, subscriptionID)} } +// CreateOrUpdate create a new workbook. +// Parameters: +// resourceGroupName - the name of the resource group. +// resourceName - the name of the Application Insights component resource. +// workbookProperties - properties that need to be specified to create a new workbook. +func (client WorkbooksClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, workbookProperties Workbook) (result Workbook, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: workbookProperties, + Constraints: []validation.Constraint{{Target: "workbookProperties.WorkbookProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "workbookProperties.WorkbookProperties.Name", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "workbookProperties.WorkbookProperties.SerializedData", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "workbookProperties.WorkbookProperties.WorkbookID", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "workbookProperties.WorkbookProperties.Category", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "workbookProperties.WorkbookProperties.UserID", Name: validation.Null, Rule: true, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewError("insights.WorkbooksClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, resourceName, workbookProperties) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.WorkbooksClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.WorkbooksClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.WorkbooksClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client WorkbooksClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, resourceName string, workbookProperties Workbook) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "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.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroup/{resourceGroupName}/providers/microsoft.insights/workbooks/{resourceName}", pathParameters), + autorest.WithJSON(workbookProperties), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client WorkbooksClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client WorkbooksClient) CreateOrUpdateResponder(resp *http.Response) (result Workbook, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete delete a workbook. +// Parameters: +// resourceGroupName - the name of the resource group. +// resourceName - the name of the Application Insights component resource. +func (client WorkbooksClient) Delete(ctx context.Context, resourceGroupName string, resourceName string) (result autorest.Response, err error) { + req, err := client.DeletePreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.WorkbooksClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "insights.WorkbooksClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.WorkbooksClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client WorkbooksClient) DeletePreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "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.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroup/{resourceGroupName}/providers/microsoft.insights/workbooks/{resourceName}", 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 WorkbooksClient) 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 WorkbooksClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get a single workbook by its resourceName. +// Parameters: +// resourceGroupName - the name of the resource group. +// resourceName - the name of the Application Insights component resource. +func (client WorkbooksClient) Get(ctx context.Context, resourceGroupName string, resourceName string) (result Workbook, err error) { + req, err := client.GetPreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.WorkbooksClient", "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.WorkbooksClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.WorkbooksClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client WorkbooksClient) GetPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "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}/resourceGroup/{resourceGroupName}/providers/microsoft.insights/workbooks/{resourceName}", 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 WorkbooksClient) 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 WorkbooksClient) GetResponder(resp *http.Response) (result Workbook, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + // ListByResourceGroup get all Workbooks defined within a specified resource group and category. // Parameters: // resourceGroupName - the name of the resource group. @@ -46,7 +262,7 @@ func NewWorkbooksClientWithBaseURI(baseURI string, subscriptionID string) Workbo // tags - tags presents on each workbook returned. // canFetchContent - flag indicating whether or not to return the full content for each applicable workbook. If // false, only return summary content for workbooks. -func (client WorkbooksClient) ListByResourceGroup(ctx context.Context, resourceGroupName string, category CategoryType, tags []string, canFetchContent *bool) (result Workbooks, err error) { +func (client WorkbooksClient) ListByResourceGroup(ctx context.Context, resourceGroupName string, category CategoryType, tags []string, canFetchContent *bool) (result WorkbooksListResult, err error) { req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName, category, tags, canFetchContent) if err != nil { err = autorest.NewErrorWithError(err, "insights.WorkbooksClient", "ListByResourceGroup", nil, "Failure preparing request") @@ -104,7 +320,77 @@ func (client WorkbooksClient) ListByResourceGroupSender(req *http.Request) (*htt // ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always // closes the http.Response Body. -func (client WorkbooksClient) ListByResourceGroupResponder(resp *http.Response) (result Workbooks, err error) { +func (client WorkbooksClient) ListByResourceGroupResponder(resp *http.Response) (result WorkbooksListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Update updates a workbook that has already been added. +// Parameters: +// resourceGroupName - the name of the resource group. +// resourceName - the name of the Application Insights component resource. +// workbookProperties - properties that need to be specified to create a new workbook. +func (client WorkbooksClient) Update(ctx context.Context, resourceGroupName string, resourceName string, workbookProperties Workbook) (result Workbook, err error) { + req, err := client.UpdatePreparer(ctx, resourceGroupName, resourceName, workbookProperties) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.WorkbooksClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.WorkbooksClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.WorkbooksClient", "Update", resp, "Failure responding to request") + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client WorkbooksClient) UpdatePreparer(ctx context.Context, resourceGroupName string, resourceName string, workbookProperties Workbook) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "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.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroup/{resourceGroupName}/providers/microsoft.insights/workbooks/{resourceName}", pathParameters), + autorest.WithJSON(workbookProperties), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client WorkbooksClient) UpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client WorkbooksClient) UpdateResponder(resp *http.Response) (result Workbook, err error) { err = autorest.Respond( resp, client.ByInspecting(), diff --git a/services/appinsights/mgmt/2015-05-01/insights/workitemconfigurations.go b/services/appinsights/mgmt/2015-05-01/insights/workitemconfigurations.go index a8bab87a38b5..1c4e259ec45f 100644 --- a/services/appinsights/mgmt/2015-05-01/insights/workitemconfigurations.go +++ b/services/appinsights/mgmt/2015-05-01/insights/workitemconfigurations.go @@ -251,7 +251,7 @@ func (client WorkItemConfigurationsClient) GetDefaultResponder(resp *http.Respon // Parameters: // resourceGroupName - the name of the resource group. // resourceName - the name of the Application Insights component resource. -func (client WorkItemConfigurationsClient) List(ctx context.Context, resourceGroupName string, resourceName string) (result ListWorkItemConfiguration, err error) { +func (client WorkItemConfigurationsClient) List(ctx context.Context, resourceGroupName string, resourceName string) (result WorkItemConfigurationsListResult, err error) { req, err := client.ListPreparer(ctx, resourceGroupName, resourceName) if err != nil { err = autorest.NewErrorWithError(err, "insights.WorkItemConfigurationsClient", "List", nil, "Failure preparing request") @@ -303,12 +303,12 @@ func (client WorkItemConfigurationsClient) ListSender(req *http.Request) (*http. // ListResponder handles the response to the List request. The method always // closes the http.Response Body. -func (client WorkItemConfigurationsClient) ListResponder(resp *http.Response) (result ListWorkItemConfiguration, err error) { +func (client WorkItemConfigurationsClient) ListResponder(resp *http.Response) (result WorkItemConfigurationsListResult, err error) { err = autorest.Respond( resp, client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) result.Response = autorest.Response{Response: resp} return