From f27ebdfa2957244bd99e734170cd3b80ebb99184 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Wed, 14 Mar 2018 20:44:17 +0000 Subject: [PATCH 1/3] Generated from eb38dfb11ce4b0c6be5838c0dfc05dc0b5782180 Added Swagger entry for Workbook resource --- .../mgmt/2015-05-01/insights/favorite.go | 318 ++++++++++++++++++ .../mgmt/2015-05-01/insights/favorites.go | 125 +++++++ .../mgmt/2015-05-01/insights/models.go | 118 +++++++ .../2015-05-01/insights/webtestlocations.go | 107 ++++++ 4 files changed, 668 insertions(+) create mode 100644 services/appinsights/mgmt/2015-05-01/insights/favorite.go create mode 100644 services/appinsights/mgmt/2015-05-01/insights/favorites.go create mode 100644 services/appinsights/mgmt/2015-05-01/insights/webtestlocations.go diff --git a/services/appinsights/mgmt/2015-05-01/insights/favorite.go b/services/appinsights/mgmt/2015-05-01/insights/favorite.go new file mode 100644 index 000000000000..5f004eeb1412 --- /dev/null +++ b/services/appinsights/mgmt/2015-05-01/insights/favorite.go @@ -0,0 +1,318 @@ +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, purgeID string) FavoriteClient { + return NewFavoriteClientWithBaseURI(DefaultBaseURI, subscriptionID, purgeID) +} + +// NewFavoriteClientWithBaseURI creates an instance of the FavoriteClient client. +func NewFavoriteClientWithBaseURI(baseURI string, subscriptionID string, purgeID string) FavoriteClient { + return FavoriteClient{NewWithBaseURI(baseURI, subscriptionID, purgeID)} +} + +// Add adds a new favorites to an Application Insights component. +// +// resourceGroupName is the name of the resource group. resourceName is the name of the Application Insights +// component resource. favoriteID is the Id of a specific favorite defined in the Application Insights component +// favoriteProperties is 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.AsJSON(), + 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. +// +// resourceGroupName is the name of the resource group. resourceName is the name of the Application Insights +// component resource. favoriteID is 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. +// +// resourceGroupName is the name of the resource group. resourceName is the name of the Application Insights +// component resource. favoriteID is 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. +// +// resourceGroupName is the name of the resource group. resourceName is the name of the Application Insights +// component resource. favoriteID is the Id of a specific favorite defined in the Application Insights component +// favoriteProperties is 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.AsJSON(), + 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 new file mode 100644 index 000000000000..90d4ca373b0b --- /dev/null +++ b/services/appinsights/mgmt/2015-05-01/insights/favorites.go @@ -0,0 +1,125 @@ +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" +) + +// FavoritesClient is the composite Swagger for Application Insights Management Client +type FavoritesClient struct { + BaseClient +} + +// NewFavoritesClient creates an instance of the FavoritesClient client. +func NewFavoritesClient(subscriptionID string, purgeID string) FavoritesClient { + return NewFavoritesClientWithBaseURI(DefaultBaseURI, subscriptionID, purgeID) +} + +// NewFavoritesClientWithBaseURI creates an instance of the FavoritesClient client. +func NewFavoritesClientWithBaseURI(baseURI string, subscriptionID string, purgeID string) FavoritesClient { + return FavoritesClient{NewWithBaseURI(baseURI, subscriptionID, purgeID)} +} + +// List gets a list of favorites defined within an Application Insights component. +// +// resourceGroupName is the name of the resource group. resourceName is the name of the Application Insights +// component resource. favoriteType is the type of favorite. Value can be either shared or user. sourceType is +// source type of favorite to return. When left out, the source type defaults to 'other' (not present in this +// enum). canFetchContent is flag indicating whether or not to return the full content for each applicable +// favorite. If false, only return summary content for favorites. tags is tags that must be present on each +// favorite returned. +func (client FavoritesClient) List(ctx context.Context, resourceGroupName string, resourceName string, favoriteType FavoriteType, sourceType FavoriteSourceType, canFetchContent *bool, tags []string) (result ListApplicationInsightsComponentFavorite, err error) { + req, err := client.ListPreparer(ctx, resourceGroupName, resourceName, favoriteType, sourceType, canFetchContent, tags) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.FavoritesClient", "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.FavoritesClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.FavoritesClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client FavoritesClient) ListPreparer(ctx context.Context, resourceGroupName string, resourceName string, favoriteType FavoriteType, sourceType FavoriteSourceType, canFetchContent *bool, tags []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, + } + if len(string(favoriteType)) > 0 { + queryParameters["favoriteType"] = autorest.Encode("query", favoriteType) + } else { + queryParameters["favoriteType"] = autorest.Encode("query", "shared") + } + if len(string(sourceType)) > 0 { + queryParameters["sourceType"] = autorest.Encode("query", sourceType) + } + if canFetchContent != nil { + queryParameters["canFetchContent"] = autorest.Encode("query", *canFetchContent) + } + if tags != nil && len(tags) > 0 { + queryParameters["tags"] = autorest.Encode("query", tags, ",") + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components/{resourceName}/favorites", 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 FavoritesClient) 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 FavoritesClient) ListResponder(resp *http.Response) (result ListApplicationInsightsComponentFavorite, 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 +} diff --git a/services/appinsights/mgmt/2015-05-01/insights/models.go b/services/appinsights/mgmt/2015-05-01/insights/models.go index f1940b579603..e56893239d50 100644 --- a/services/appinsights/mgmt/2015-05-01/insights/models.go +++ b/services/appinsights/mgmt/2015-05-01/insights/models.go @@ -35,6 +35,53 @@ const ( Web ApplicationType = "web" ) +// PossibleApplicationTypeValues returns an array of possible values for the ApplicationType const type. +func PossibleApplicationTypeValues() [2]ApplicationType { + return [2]ApplicationType{Other, Web} +} + +// FavoriteSourceType enumerates the values for favorite source type. +type FavoriteSourceType string + +const ( + // Events ... + Events FavoriteSourceType = "events" + // Funnel ... + Funnel FavoriteSourceType = "funnel" + // Impact ... + Impact FavoriteSourceType = "impact" + // Notebook ... + Notebook FavoriteSourceType = "notebook" + // Retention ... + Retention FavoriteSourceType = "retention" + // Segmentation ... + Segmentation FavoriteSourceType = "segmentation" + // Sessions ... + Sessions FavoriteSourceType = "sessions" + // Userflows ... + Userflows FavoriteSourceType = "userflows" +) + +// PossibleFavoriteSourceTypeValues returns an array of possible values for the FavoriteSourceType const type. +func PossibleFavoriteSourceTypeValues() [8]FavoriteSourceType { + return [8]FavoriteSourceType{Events, Funnel, Impact, Notebook, Retention, Segmentation, Sessions, Userflows} +} + +// FavoriteType enumerates the values for favorite type. +type FavoriteType string + +const ( + // Shared ... + Shared FavoriteType = "shared" + // User ... + User FavoriteType = "user" +) + +// PossibleFavoriteTypeValues returns an array of possible values for the FavoriteType const type. +func PossibleFavoriteTypeValues() [2]FavoriteType { + return [2]FavoriteType{Shared, User} +} + // FlowType enumerates the values for flow type. type FlowType string @@ -43,6 +90,11 @@ const ( Bluefield FlowType = "Bluefield" ) +// PossibleFlowTypeValues returns an array of possible values for the FlowType const type. +func PossibleFlowTypeValues() [1]FlowType { + return [1]FlowType{Bluefield} +} + // PurgeState enumerates the values for purge state. type PurgeState string @@ -53,6 +105,11 @@ const ( Pending PurgeState = "Pending" ) +// PossiblePurgeStateValues returns an array of possible values for the PurgeState const type. +func PossiblePurgeStateValues() [2]PurgeState { + return [2]PurgeState{Completed, Pending} +} + // RequestSource enumerates the values for request source. type RequestSource string @@ -61,6 +118,11 @@ const ( Rest RequestSource = "rest" ) +// PossibleRequestSourceValues returns an array of possible values for the RequestSource const type. +func PossibleRequestSourceValues() [1]RequestSource { + return [1]RequestSource{Rest} +} + // WebTestKind enumerates the values for web test kind. type WebTestKind string @@ -71,6 +133,11 @@ const ( Ping WebTestKind = "ping" ) +// PossibleWebTestKindValues returns an array of possible values for the WebTestKind const type. +func PossibleWebTestKindValues() [2]WebTestKind { + return [2]WebTestKind{Multistep, Ping} +} + // Annotation annotation associated with an application insights resource. type Annotation struct { // AnnotationName - Name of annotation @@ -353,6 +420,34 @@ type ApplicationInsightsComponentExportRequest struct { DestinationAccountID *string `json:"DestinationAccountId,omitempty"` } +// ApplicationInsightsComponentFavorite properties that define a favorite that is associated to an Application +// Insights component. +type ApplicationInsightsComponentFavorite struct { + autorest.Response `json:"-"` + // Name - The user-defined name of the favorite. + Name *string `json:"Name,omitempty"` + // Config - Configuration of this particular favorite, which are driven by the Azure portal UX. Configuration data is a string containing valid JSON + Config *string `json:"Config,omitempty"` + // Version - This instance's version of the data model. This can change as new features are added that can be marked favorite. Current examples include MetricsExplorer (ME) and Search. + Version *string `json:"Version,omitempty"` + // FavoriteID - Internally assigned unique id of the favorite definition. + FavoriteID *string `json:"FavoriteId,omitempty"` + // FavoriteType - Enum indicating if this favorite definition is owned by a specific user or is shared between all users with access to the Application Insights component. Possible values include: 'Shared', 'User' + FavoriteType FavoriteType `json:"FavoriteType,omitempty"` + // SourceType - The source of the favorite definition. + SourceType *string `json:"SourceType,omitempty"` + // TimeModified - Date and time in UTC of the last modification that was made to this favorite definition. + TimeModified *string `json:"TimeModified,omitempty"` + // Tags - A list of 0 or more tags that are associated with this favorite definition + Tags *[]string `json:"Tags,omitempty"` + // Category - Favorite category, as defined by the user at creation time. + Category *string `json:"Category,omitempty"` + // IsGeneratedFromTemplate - Flag denoting wether or not this favorite was generated from a template. + IsGeneratedFromTemplate *bool `json:"IsGeneratedFromTemplate,omitempty"` + // UserID - Unique user id of the specific user that owns this favorite. + UserID *string `json:"UserId,omitempty"` +} + // ApplicationInsightsComponentFeature an Application Insights component daily data volume cap status type ApplicationInsightsComponentFeature struct { // FeatureName - The pricing feature name. @@ -609,6 +704,23 @@ type ApplicationInsightsComponentQuotaStatus struct { ExpirationTime *string `json:"ExpirationTime,omitempty"` } +// ApplicationInsightsComponentWebTestLocation properties that define a web test location available to an +// Application Insights Component. +type ApplicationInsightsComponentWebTestLocation struct { + // DisplayName - The display name of the web test location. + DisplayName *string `json:"DisplayName,omitempty"` + // Tag - Internally defined geographic location tag. + Tag *string `json:"Tag,omitempty"` +} + +// ApplicationInsightsWebTestLocationsListResult describes the list of web test locations available to an +// Application Insights Component. +type ApplicationInsightsWebTestLocationsListResult struct { + autorest.Response `json:"-"` + // Value - List of web test locations. + Value *[]ApplicationInsightsComponentWebTestLocation `json:"value,omitempty"` +} + // ComponentPurgeBody describes the body of a purge request for an App Insights component type ComponentPurgeBody struct { // Table - Table from which to purge data. @@ -668,6 +780,12 @@ type ListApplicationInsightsComponentExportConfiguration struct { Value *[]ApplicationInsightsComponentExportConfiguration `json:"value,omitempty"` } +// ListApplicationInsightsComponentFavorite ... +type ListApplicationInsightsComponentFavorite struct { + autorest.Response `json:"-"` + Value *[]ApplicationInsightsComponentFavorite `json:"value,omitempty"` +} + // ListApplicationInsightsComponentProactiveDetectionConfiguration ... type ListApplicationInsightsComponentProactiveDetectionConfiguration struct { autorest.Response `json:"-"` diff --git a/services/appinsights/mgmt/2015-05-01/insights/webtestlocations.go b/services/appinsights/mgmt/2015-05-01/insights/webtestlocations.go new file mode 100644 index 000000000000..cd222634fdd5 --- /dev/null +++ b/services/appinsights/mgmt/2015-05-01/insights/webtestlocations.go @@ -0,0 +1,107 @@ +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" +) + +// WebTestLocationsClient is the composite Swagger for Application Insights Management Client +type WebTestLocationsClient struct { + BaseClient +} + +// NewWebTestLocationsClient creates an instance of the WebTestLocationsClient client. +func NewWebTestLocationsClient(subscriptionID string, purgeID string) WebTestLocationsClient { + return NewWebTestLocationsClientWithBaseURI(DefaultBaseURI, subscriptionID, purgeID) +} + +// NewWebTestLocationsClientWithBaseURI creates an instance of the WebTestLocationsClient client. +func NewWebTestLocationsClientWithBaseURI(baseURI string, subscriptionID string, purgeID string) WebTestLocationsClient { + return WebTestLocationsClient{NewWithBaseURI(baseURI, subscriptionID, purgeID)} +} + +// List gets a list of web test locations available to this Application Insights component. +// +// resourceGroupName is the name of the resource group. resourceName is the name of the Application Insights +// component resource. +func (client WebTestLocationsClient) List(ctx context.Context, resourceGroupName string, resourceName string) (result ApplicationInsightsWebTestLocationsListResult, err error) { + req, err := client.ListPreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.WebTestLocationsClient", "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.WebTestLocationsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.WebTestLocationsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client WebTestLocationsClient) ListPreparer(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}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components/{resourceName}/syntheticmonitorlocations", 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 WebTestLocationsClient) 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 WebTestLocationsClient) ListResponder(resp *http.Response) (result ApplicationInsightsWebTestLocationsListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} From b50ab05db1fda1a351c77c67c724a892364042ab Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Thu, 15 Mar 2018 01:13:33 +0000 Subject: [PATCH 2/3] Generated from 397df4fbac9183dc17ae2afa2ab7d3e8632e5488 Updated more on serializedData to use workbook content --- .../mgmt/2015-05-01/insights/annotations.go | 8 ++++---- .../mgmt/2015-05-01/insights/apikeys.go | 8 ++++---- .../insights/componentavailablefeatures.go | 2 +- .../insights/componentcurrentbillingfeatures.go | 4 ++-- .../insights/componentfeaturecapabilities.go | 2 +- .../2015-05-01/insights/componentquotastatus.go | 2 +- .../mgmt/2015-05-01/insights/components.go | 16 ++++++++-------- .../2015-05-01/insights/exportconfigurations.go | 10 +++++----- .../mgmt/2015-05-01/insights/favorite.go | 8 ++++---- .../mgmt/2015-05-01/insights/favorites.go | 2 +- .../mgmt/2015-05-01/insights/operations.go | 2 +- .../insights/proactivedetectionconfigurations.go | 6 +++--- .../mgmt/2015-05-01/insights/webtestlocations.go | 2 +- .../mgmt/2015-05-01/insights/webtests.go | 12 ++++++------ .../insights/workitemconfigurations.go | 8 ++++---- 15 files changed, 46 insertions(+), 46 deletions(-) diff --git a/services/appinsights/mgmt/2015-05-01/insights/annotations.go b/services/appinsights/mgmt/2015-05-01/insights/annotations.go index d7dc46edfa81..e0bc355469bd 100644 --- a/services/appinsights/mgmt/2015-05-01/insights/annotations.go +++ b/services/appinsights/mgmt/2015-05-01/insights/annotations.go @@ -83,7 +83,7 @@ func (client AnnotationsClient) CreatePreparer(ctx context.Context, resourceGrou autorest.AsJSON(), autorest.AsPut(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components/{resourceName}/Annotations", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/Annotations", pathParameters), autorest.WithJSON(annotationProperties), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) @@ -153,7 +153,7 @@ func (client AnnotationsClient) DeletePreparer(ctx context.Context, resourceGrou preparer := autorest.CreatePreparer( autorest.AsDelete(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components/{resourceName}/Annotations/{annotationId}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/Annotations/{annotationId}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -222,7 +222,7 @@ func (client AnnotationsClient) GetPreparer(ctx context.Context, resourceGroupNa preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components/{resourceName}/Annotations/{annotationId}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/Annotations/{annotationId}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -292,7 +292,7 @@ func (client AnnotationsClient) ListPreparer(ctx context.Context, resourceGroupN preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components/{resourceName}/Annotations", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/Annotations", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } diff --git a/services/appinsights/mgmt/2015-05-01/insights/apikeys.go b/services/appinsights/mgmt/2015-05-01/insights/apikeys.go index 640cd9d372c3..eb6dc982f1de 100644 --- a/services/appinsights/mgmt/2015-05-01/insights/apikeys.go +++ b/services/appinsights/mgmt/2015-05-01/insights/apikeys.go @@ -83,7 +83,7 @@ func (client APIKeysClient) CreatePreparer(ctx context.Context, resourceGroupNam autorest.AsJSON(), autorest.AsPost(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components/{resourceName}/ApiKeys", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/ApiKeys", pathParameters), autorest.WithJSON(APIKeyProperties), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) @@ -152,7 +152,7 @@ func (client APIKeysClient) DeletePreparer(ctx context.Context, resourceGroupNam preparer := autorest.CreatePreparer( autorest.AsDelete(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components/{resourceName}/APIKeys/{keyId}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/APIKeys/{keyId}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -220,7 +220,7 @@ func (client APIKeysClient) GetPreparer(ctx context.Context, resourceGroupName s preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components/{resourceName}/APIKeys/{keyId}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/APIKeys/{keyId}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -287,7 +287,7 @@ func (client APIKeysClient) ListPreparer(ctx context.Context, resourceGroupName preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components/{resourceName}/ApiKeys", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/ApiKeys", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } diff --git a/services/appinsights/mgmt/2015-05-01/insights/componentavailablefeatures.go b/services/appinsights/mgmt/2015-05-01/insights/componentavailablefeatures.go index 6fbfe2239fa1..3c7929da2716 100644 --- a/services/appinsights/mgmt/2015-05-01/insights/componentavailablefeatures.go +++ b/services/appinsights/mgmt/2015-05-01/insights/componentavailablefeatures.go @@ -81,7 +81,7 @@ func (client ComponentAvailableFeaturesClient) GetPreparer(ctx context.Context, preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components/{resourceName}/getavailablebillingfeatures", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/getavailablebillingfeatures", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } diff --git a/services/appinsights/mgmt/2015-05-01/insights/componentcurrentbillingfeatures.go b/services/appinsights/mgmt/2015-05-01/insights/componentcurrentbillingfeatures.go index 3c29e249d52c..1775b7865d5c 100644 --- a/services/appinsights/mgmt/2015-05-01/insights/componentcurrentbillingfeatures.go +++ b/services/appinsights/mgmt/2015-05-01/insights/componentcurrentbillingfeatures.go @@ -82,7 +82,7 @@ func (client ComponentCurrentBillingFeaturesClient) GetPreparer(ctx context.Cont preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components/{resourceName}/currentbillingfeatures", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/currentbillingfeatures", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -151,7 +151,7 @@ func (client ComponentCurrentBillingFeaturesClient) UpdatePreparer(ctx context.C autorest.AsJSON(), autorest.AsPut(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components/{resourceName}/currentbillingfeatures", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/currentbillingfeatures", pathParameters), autorest.WithJSON(billingFeaturesProperties), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) diff --git a/services/appinsights/mgmt/2015-05-01/insights/componentfeaturecapabilities.go b/services/appinsights/mgmt/2015-05-01/insights/componentfeaturecapabilities.go index 1b05ad3d7261..99b716a3aa2b 100644 --- a/services/appinsights/mgmt/2015-05-01/insights/componentfeaturecapabilities.go +++ b/services/appinsights/mgmt/2015-05-01/insights/componentfeaturecapabilities.go @@ -82,7 +82,7 @@ func (client ComponentFeatureCapabilitiesClient) GetPreparer(ctx context.Context preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components/{resourceName}/featurecapabilities", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/featurecapabilities", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } diff --git a/services/appinsights/mgmt/2015-05-01/insights/componentquotastatus.go b/services/appinsights/mgmt/2015-05-01/insights/componentquotastatus.go index 87e7285bb4cc..e506c693d174 100644 --- a/services/appinsights/mgmt/2015-05-01/insights/componentquotastatus.go +++ b/services/appinsights/mgmt/2015-05-01/insights/componentquotastatus.go @@ -81,7 +81,7 @@ func (client ComponentQuotaStatusClient) GetPreparer(ctx context.Context, resour preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components/{resourceName}/quotastatus", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/quotastatus", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } diff --git a/services/appinsights/mgmt/2015-05-01/insights/components.go b/services/appinsights/mgmt/2015-05-01/insights/components.go index 7b833941f892..d95ce81abd03 100644 --- a/services/appinsights/mgmt/2015-05-01/insights/components.go +++ b/services/appinsights/mgmt/2015-05-01/insights/components.go @@ -91,7 +91,7 @@ func (client ComponentsClient) CreateOrUpdatePreparer(ctx context.Context, resou autorest.AsJSON(), autorest.AsPut(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components/{resourceName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}", pathParameters), autorest.WithJSON(insightProperties), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) @@ -159,7 +159,7 @@ func (client ComponentsClient) DeletePreparer(ctx context.Context, resourceGroup preparer := autorest.CreatePreparer( autorest.AsDelete(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components/{resourceName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -225,7 +225,7 @@ func (client ComponentsClient) GetPreparer(ctx context.Context, resourceGroupNam preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components/{resourceName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -294,7 +294,7 @@ func (client ComponentsClient) GetPurgeStatusPreparer(ctx context.Context, resou preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components/{resourceName}/operations/{purgeId}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/operations/{purgeId}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -357,7 +357,7 @@ func (client ComponentsClient) ListPreparer(ctx context.Context) (*http.Request, preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/components", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/components", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -450,7 +450,7 @@ func (client ComponentsClient) ListByResourceGroupPreparer(ctx context.Context, preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -553,7 +553,7 @@ func (client ComponentsClient) PurgePreparer(ctx context.Context, resourceGroupN autorest.AsJSON(), autorest.AsPost(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components/{resourceName}/purge", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/purge", pathParameters), autorest.WithJSON(body), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) @@ -622,7 +622,7 @@ func (client ComponentsClient) UpdateTagsPreparer(ctx context.Context, resourceG autorest.AsJSON(), autorest.AsPatch(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components/{resourceName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}", pathParameters), autorest.WithJSON(componentTags), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) diff --git a/services/appinsights/mgmt/2015-05-01/insights/exportconfigurations.go b/services/appinsights/mgmt/2015-05-01/insights/exportconfigurations.go index 6dd4bd23f252..baa54b9b0c87 100644 --- a/services/appinsights/mgmt/2015-05-01/insights/exportconfigurations.go +++ b/services/appinsights/mgmt/2015-05-01/insights/exportconfigurations.go @@ -83,7 +83,7 @@ func (client ExportConfigurationsClient) CreatePreparer(ctx context.Context, res autorest.AsJSON(), autorest.AsPost(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components/{resourceName}/exportconfiguration", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/exportconfiguration", pathParameters), autorest.WithJSON(exportProperties), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) @@ -153,7 +153,7 @@ func (client ExportConfigurationsClient) DeletePreparer(ctx context.Context, res preparer := autorest.CreatePreparer( autorest.AsDelete(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components/{resourceName}/exportconfiguration/{exportId}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/exportconfiguration/{exportId}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -222,7 +222,7 @@ func (client ExportConfigurationsClient) GetPreparer(ctx context.Context, resour preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components/{resourceName}/exportconfiguration/{exportId}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/exportconfiguration/{exportId}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -289,7 +289,7 @@ func (client ExportConfigurationsClient) ListPreparer(ctx context.Context, resou preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components/{resourceName}/exportconfiguration", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/exportconfiguration", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -360,7 +360,7 @@ func (client ExportConfigurationsClient) UpdatePreparer(ctx context.Context, res autorest.AsJSON(), autorest.AsPut(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components/{resourceName}/exportconfiguration/{exportId}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/exportconfiguration/{exportId}", pathParameters), autorest.WithJSON(exportProperties), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) diff --git a/services/appinsights/mgmt/2015-05-01/insights/favorite.go b/services/appinsights/mgmt/2015-05-01/insights/favorite.go index 5f004eeb1412..b3f5df189f94 100644 --- a/services/appinsights/mgmt/2015-05-01/insights/favorite.go +++ b/services/appinsights/mgmt/2015-05-01/insights/favorite.go @@ -85,7 +85,7 @@ func (client FavoriteClient) AddPreparer(ctx context.Context, resourceGroupName autorest.AsJSON(), autorest.AsPut(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components/{resourceName}/favorites/{favoriteId}", pathParameters), + 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)) @@ -154,7 +154,7 @@ func (client FavoriteClient) DeletePreparer(ctx context.Context, resourceGroupNa preparer := autorest.CreatePreparer( autorest.AsDelete(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components/{resourceName}/favorites/{favoriteId}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/favorites/{favoriteId}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -221,7 +221,7 @@ func (client FavoriteClient) GetPreparer(ctx context.Context, resourceGroupName preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components/{resourceName}/favorites/{favoriteId}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/favorites/{favoriteId}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -291,7 +291,7 @@ func (client FavoriteClient) UpdatePreparer(ctx context.Context, resourceGroupNa autorest.AsJSON(), autorest.AsPatch(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components/{resourceName}/favorites/{favoriteId}", pathParameters), + 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)) diff --git a/services/appinsights/mgmt/2015-05-01/insights/favorites.go b/services/appinsights/mgmt/2015-05-01/insights/favorites.go index 90d4ca373b0b..cdeb9763fc2f 100644 --- a/services/appinsights/mgmt/2015-05-01/insights/favorites.go +++ b/services/appinsights/mgmt/2015-05-01/insights/favorites.go @@ -99,7 +99,7 @@ func (client FavoritesClient) ListPreparer(ctx context.Context, resourceGroupNam preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components/{resourceName}/favorites", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/favorites", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } diff --git a/services/appinsights/mgmt/2015-05-01/insights/operations.go b/services/appinsights/mgmt/2015-05-01/insights/operations.go index a8ee742853e7..1a59a7fd677e 100644 --- a/services/appinsights/mgmt/2015-05-01/insights/operations.go +++ b/services/appinsights/mgmt/2015-05-01/insights/operations.go @@ -73,7 +73,7 @@ func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/microsoft.insights/operations"), + autorest.WithPath("/providers/Microsoft.Insights/operations"), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } diff --git a/services/appinsights/mgmt/2015-05-01/insights/proactivedetectionconfigurations.go b/services/appinsights/mgmt/2015-05-01/insights/proactivedetectionconfigurations.go index f9b9607d7acf..1af83d40dc35 100644 --- a/services/appinsights/mgmt/2015-05-01/insights/proactivedetectionconfigurations.go +++ b/services/appinsights/mgmt/2015-05-01/insights/proactivedetectionconfigurations.go @@ -84,7 +84,7 @@ func (client ProactiveDetectionConfigurationsClient) GetPreparer(ctx context.Con preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components/{resourceName}/ProactiveDetectionConfigs/{ConfigurationId}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/ProactiveDetectionConfigs/{ConfigurationId}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -151,7 +151,7 @@ func (client ProactiveDetectionConfigurationsClient) ListPreparer(ctx context.Co preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components/{resourceName}/ProactiveDetectionConfigs", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/ProactiveDetectionConfigs", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -222,7 +222,7 @@ func (client ProactiveDetectionConfigurationsClient) UpdatePreparer(ctx context. autorest.AsJSON(), autorest.AsPut(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components/{resourceName}/ProactiveDetectionConfigs/{ConfigurationId}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/ProactiveDetectionConfigs/{ConfigurationId}", pathParameters), autorest.WithJSON(proactiveDetectionProperties), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) diff --git a/services/appinsights/mgmt/2015-05-01/insights/webtestlocations.go b/services/appinsights/mgmt/2015-05-01/insights/webtestlocations.go index cd222634fdd5..da0a7435ea0c 100644 --- a/services/appinsights/mgmt/2015-05-01/insights/webtestlocations.go +++ b/services/appinsights/mgmt/2015-05-01/insights/webtestlocations.go @@ -81,7 +81,7 @@ func (client WebTestLocationsClient) ListPreparer(ctx context.Context, resourceG preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components/{resourceName}/syntheticmonitorlocations", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/syntheticmonitorlocations", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } diff --git a/services/appinsights/mgmt/2015-05-01/insights/webtests.go b/services/appinsights/mgmt/2015-05-01/insights/webtests.go index f5e0d08dafdd..1b64aa546f81 100644 --- a/services/appinsights/mgmt/2015-05-01/insights/webtests.go +++ b/services/appinsights/mgmt/2015-05-01/insights/webtests.go @@ -94,7 +94,7 @@ func (client WebTestsClient) CreateOrUpdatePreparer(ctx context.Context, resourc autorest.AsJSON(), autorest.AsPut(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/webtests/{webTestName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/webtests/{webTestName}", pathParameters), autorest.WithJSON(webTestDefinition), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) @@ -162,7 +162,7 @@ func (client WebTestsClient) DeletePreparer(ctx context.Context, resourceGroupNa preparer := autorest.CreatePreparer( autorest.AsDelete(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/webtests/{webTestName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/webtests/{webTestName}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -228,7 +228,7 @@ func (client WebTestsClient) GetPreparer(ctx context.Context, resourceGroupName preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/webtests/{webTestName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/webtests/{webTestName}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -291,7 +291,7 @@ func (client WebTestsClient) ListPreparer(ctx context.Context) (*http.Request, e preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/webtests", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/webtests", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -384,7 +384,7 @@ func (client WebTestsClient) ListByResourceGroupPreparer(ctx context.Context, re preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/webtests", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/webtests", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -479,7 +479,7 @@ func (client WebTestsClient) UpdateTagsPreparer(ctx context.Context, resourceGro autorest.AsJSON(), autorest.AsPatch(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/webtests/{webTestName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/webtests/{webTestName}", pathParameters), autorest.WithJSON(webTestTags), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) diff --git a/services/appinsights/mgmt/2015-05-01/insights/workitemconfigurations.go b/services/appinsights/mgmt/2015-05-01/insights/workitemconfigurations.go index d5912c75d0d9..85dd935c76d7 100644 --- a/services/appinsights/mgmt/2015-05-01/insights/workitemconfigurations.go +++ b/services/appinsights/mgmt/2015-05-01/insights/workitemconfigurations.go @@ -83,7 +83,7 @@ func (client WorkItemConfigurationsClient) CreatePreparer(ctx context.Context, r autorest.AsJSON(), autorest.AsPost(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components/{resourceName}/WorkItemConfigs", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/WorkItemConfigs", pathParameters), autorest.WithJSON(workItemConfigurationProperties), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) @@ -153,7 +153,7 @@ func (client WorkItemConfigurationsClient) DeletePreparer(ctx context.Context, r preparer := autorest.CreatePreparer( autorest.AsDelete(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components/{resourceName}/WorkItemConfigs/{workItemConfigId}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/WorkItemConfigs/{workItemConfigId}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -220,7 +220,7 @@ func (client WorkItemConfigurationsClient) GetDefaultPreparer(ctx context.Contex preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components/{resourceName}/DefaultWorkItemConfig", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/DefaultWorkItemConfig", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -287,7 +287,7 @@ func (client WorkItemConfigurationsClient) ListPreparer(ctx context.Context, res preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components/{resourceName}/WorkItemConfigs", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/WorkItemConfigs", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } From 5023113f5c140f0c7baa66ecb72c873289f885f5 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Thu, 15 Mar 2018 02:06:52 +0000 Subject: [PATCH 3/3] Generated from 0f294895d920e5716a0f602873bdff43ee6e8536 Added workbooks type into OperationList --- .../insights/actiongroups.go | 12 +- .../insights/activitylogalerts.go | 2 +- .../insights/alertruleincidents.go | 4 +- .../2017-05-01-preview/insights/alertrules.go | 6 +- .../insights/autoscalesettings.go | 6 +- .../insights/diagnosticsettings.go | 4 +- .../insights/logprofiles.go | 2 +- .../2017-05-01-preview/insights/models.go | 1896 +++++---- .../2017-05-01-preview/insights/version.go | 6 +- .../2018-03-01/insights/actiongroupsgroup.go | 521 +++ .../insights/activitylogalertsgroup.go | 448 +++ .../mgmt/2018-03-01/insights/activitylogs.go | 152 + .../insights/alertruleincidentsgroup.go | 174 + .../2018-03-01/insights/alertrulesgroup.go | 385 ++ .../insights/autoscalesettingsgroup.go | 412 ++ .../mgmt/2018-03-01/insights/client.go | 51 + .../diagnosticsettingscategorygroup.go | 170 + .../insights/diagnosticsettingsgroup.go | 301 ++ .../2018-03-01/insights/eventcategories.go | 99 + .../2018-03-01/insights/logprofilesgroup.go | 380 ++ .../2018-03-01/insights/metricbaseline.go | 206 + .../2018-03-01/insights/metricdefinitions.go | 104 + .../mgmt/2018-03-01/insights/metrics.go | 142 + .../mgmt/2018-03-01/insights/models.go | 3389 +++++++++++++++++ .../2018-03-01/insights/operationsgroup.go | 98 + .../2018-03-01/insights/tenantactivitylogs.go | 152 + .../mgmt/2018-03-01/insights/version.go | 28 + 27 files changed, 8339 insertions(+), 811 deletions(-) create mode 100644 services/monitor/mgmt/2018-03-01/insights/actiongroupsgroup.go create mode 100644 services/monitor/mgmt/2018-03-01/insights/activitylogalertsgroup.go create mode 100644 services/monitor/mgmt/2018-03-01/insights/activitylogs.go create mode 100644 services/monitor/mgmt/2018-03-01/insights/alertruleincidentsgroup.go create mode 100644 services/monitor/mgmt/2018-03-01/insights/alertrulesgroup.go create mode 100644 services/monitor/mgmt/2018-03-01/insights/autoscalesettingsgroup.go create mode 100644 services/monitor/mgmt/2018-03-01/insights/client.go create mode 100644 services/monitor/mgmt/2018-03-01/insights/diagnosticsettingscategorygroup.go create mode 100644 services/monitor/mgmt/2018-03-01/insights/diagnosticsettingsgroup.go create mode 100644 services/monitor/mgmt/2018-03-01/insights/eventcategories.go create mode 100644 services/monitor/mgmt/2018-03-01/insights/logprofilesgroup.go create mode 100644 services/monitor/mgmt/2018-03-01/insights/metricbaseline.go create mode 100644 services/monitor/mgmt/2018-03-01/insights/metricdefinitions.go create mode 100644 services/monitor/mgmt/2018-03-01/insights/metrics.go create mode 100644 services/monitor/mgmt/2018-03-01/insights/models.go create mode 100644 services/monitor/mgmt/2018-03-01/insights/operationsgroup.go create mode 100644 services/monitor/mgmt/2018-03-01/insights/tenantactivitylogs.go create mode 100644 services/monitor/mgmt/2018-03-01/insights/version.go diff --git a/services/monitor/mgmt/2017-05-01-preview/insights/actiongroups.go b/services/monitor/mgmt/2017-05-01-preview/insights/actiongroups.go index d66cfb9c9b82..93e5dc5ff472 100644 --- a/services/monitor/mgmt/2017-05-01-preview/insights/actiongroups.go +++ b/services/monitor/mgmt/2017-05-01-preview/insights/actiongroups.go @@ -42,8 +42,8 @@ func NewActionGroupsClientWithBaseURI(baseURI string, subscriptionID string) Act // CreateOrUpdate create a new action group or update an existing one. // -// resourceGroupName is the name of the resource group. actionGroupName is the name of the action group. actionGroup is -// the action group to create or use for the update. +// resourceGroupName is the name of the resource group. actionGroupName is the name of the action group. +// actionGroup is the action group to create or use for the update. func (client ActionGroupsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, actionGroupName string, actionGroup ActionGroupResource) (result ActionGroupResource, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: actionGroup, @@ -52,7 +52,7 @@ func (client ActionGroupsClient) CreateOrUpdate(ctx context.Context, resourceGro Chain: []validation.Constraint{{Target: "actionGroup.ActionGroup.GroupShortName", Name: validation.MaxLength, Rule: 15, Chain: nil}}}, {Target: "actionGroup.ActionGroup.Enabled", Name: validation.Null, Rule: true, Chain: nil}, }}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "insights.ActionGroupsClient", "CreateOrUpdate") + return result, validation.NewError("insights.ActionGroupsClient", "CreateOrUpdate", err.Error()) } req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, actionGroupName, actionGroup) @@ -186,13 +186,13 @@ func (client ActionGroupsClient) DeleteResponder(resp *http.Response) (result au // EnableReceiver enable a receiver in an action group. This changes the receiver's status from Disabled to Enabled. // -// resourceGroupName is the name of the resource group. actionGroupName is the name of the action group. enableRequest -// is the receiver to re-enable. +// resourceGroupName is the name of the resource group. actionGroupName is the name of the action group. +// enableRequest is the receiver to re-enable. func (client ActionGroupsClient) EnableReceiver(ctx context.Context, resourceGroupName string, actionGroupName string, enableRequest EnableRequest) (result autorest.Response, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: enableRequest, Constraints: []validation.Constraint{{Target: "enableRequest.ReceiverName", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "insights.ActionGroupsClient", "EnableReceiver") + return result, validation.NewError("insights.ActionGroupsClient", "EnableReceiver", err.Error()) } req, err := client.EnableReceiverPreparer(ctx, resourceGroupName, actionGroupName, enableRequest) diff --git a/services/monitor/mgmt/2017-05-01-preview/insights/activitylogalerts.go b/services/monitor/mgmt/2017-05-01-preview/insights/activitylogalerts.go index 137bacfa340e..2bec8ef818a6 100644 --- a/services/monitor/mgmt/2017-05-01-preview/insights/activitylogalerts.go +++ b/services/monitor/mgmt/2017-05-01-preview/insights/activitylogalerts.go @@ -53,7 +53,7 @@ func (client ActivityLogAlertsClient) CreateOrUpdate(ctx context.Context, resour Chain: []validation.Constraint{{Target: "activityLogAlert.ActivityLogAlert.Condition.AllOf", Name: validation.Null, Rule: true, Chain: nil}}}, {Target: "activityLogAlert.ActivityLogAlert.Actions", Name: validation.Null, Rule: true, Chain: nil}, }}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "insights.ActivityLogAlertsClient", "CreateOrUpdate") + return result, validation.NewError("insights.ActivityLogAlertsClient", "CreateOrUpdate", err.Error()) } req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, activityLogAlertName, activityLogAlert) diff --git a/services/monitor/mgmt/2017-05-01-preview/insights/alertruleincidents.go b/services/monitor/mgmt/2017-05-01-preview/insights/alertruleincidents.go index 9d1508ec1bca..f3d8fc8b20ab 100644 --- a/services/monitor/mgmt/2017-05-01-preview/insights/alertruleincidents.go +++ b/services/monitor/mgmt/2017-05-01-preview/insights/alertruleincidents.go @@ -41,8 +41,8 @@ func NewAlertRuleIncidentsClientWithBaseURI(baseURI string, subscriptionID strin // Get gets an incident associated to an alert rule // -// resourceGroupName is the name of the resource group. ruleName is the name of the rule. incidentName is the name of -// the incident to retrieve. +// resourceGroupName is the name of the resource group. ruleName is the name of the rule. incidentName is the name +// of the incident to retrieve. func (client AlertRuleIncidentsClient) Get(ctx context.Context, resourceGroupName string, ruleName string, incidentName string) (result Incident, err error) { req, err := client.GetPreparer(ctx, resourceGroupName, ruleName, incidentName) if err != nil { diff --git a/services/monitor/mgmt/2017-05-01-preview/insights/alertrules.go b/services/monitor/mgmt/2017-05-01-preview/insights/alertrules.go index 7d8a19dd6e20..31d6b5b551f6 100644 --- a/services/monitor/mgmt/2017-05-01-preview/insights/alertrules.go +++ b/services/monitor/mgmt/2017-05-01-preview/insights/alertrules.go @@ -42,8 +42,8 @@ func NewAlertRulesClientWithBaseURI(baseURI string, subscriptionID string) Alert // CreateOrUpdate creates or updates an alert rule. // -// resourceGroupName is the name of the resource group. ruleName is the name of the rule. parameters is the parameters -// of the rule to create or update. +// resourceGroupName is the name of the resource group. ruleName is the name of the rule. parameters is the +// parameters of the rule to create or update. func (client AlertRulesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, ruleName string, parameters AlertRuleResource) (result AlertRuleResource, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: parameters, @@ -52,7 +52,7 @@ func (client AlertRulesClient) CreateOrUpdate(ctx context.Context, resourceGroup {Target: "parameters.AlertRule.IsEnabled", Name: validation.Null, Rule: true, Chain: nil}, {Target: "parameters.AlertRule.Condition", Name: validation.Null, Rule: true, Chain: nil}, }}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "insights.AlertRulesClient", "CreateOrUpdate") + return result, validation.NewError("insights.AlertRulesClient", "CreateOrUpdate", err.Error()) } req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, ruleName, parameters) diff --git a/services/monitor/mgmt/2017-05-01-preview/insights/autoscalesettings.go b/services/monitor/mgmt/2017-05-01-preview/insights/autoscalesettings.go index a3be3075a55f..228d77427fb1 100644 --- a/services/monitor/mgmt/2017-05-01-preview/insights/autoscalesettings.go +++ b/services/monitor/mgmt/2017-05-01-preview/insights/autoscalesettings.go @@ -42,8 +42,8 @@ func NewAutoscaleSettingsClientWithBaseURI(baseURI string, subscriptionID string // CreateOrUpdate creates or updates an autoscale setting. // -// resourceGroupName is the name of the resource group. autoscaleSettingName is the autoscale setting name. parameters -// is parameters supplied to the operation. +// resourceGroupName is the name of the resource group. autoscaleSettingName is the autoscale setting name. +// parameters is parameters supplied to the operation. func (client AutoscaleSettingsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, autoscaleSettingName string, parameters AutoscaleSettingResource) (result AutoscaleSettingResource, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: parameters, @@ -51,7 +51,7 @@ func (client AutoscaleSettingsClient) CreateOrUpdate(ctx context.Context, resour Chain: []validation.Constraint{{Target: "parameters.AutoscaleSetting.Profiles", Name: validation.Null, Rule: true, Chain: []validation.Constraint{{Target: "parameters.AutoscaleSetting.Profiles", Name: validation.MaxItems, Rule: 20, Chain: nil}}}, }}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "insights.AutoscaleSettingsClient", "CreateOrUpdate") + return result, validation.NewError("insights.AutoscaleSettingsClient", "CreateOrUpdate", err.Error()) } req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, autoscaleSettingName, parameters) diff --git a/services/monitor/mgmt/2017-05-01-preview/insights/diagnosticsettings.go b/services/monitor/mgmt/2017-05-01-preview/insights/diagnosticsettings.go index c938435a013a..e2301fb9f1ed 100644 --- a/services/monitor/mgmt/2017-05-01-preview/insights/diagnosticsettings.go +++ b/services/monitor/mgmt/2017-05-01-preview/insights/diagnosticsettings.go @@ -41,8 +41,8 @@ func NewDiagnosticSettingsClientWithBaseURI(baseURI string, subscriptionID strin // CreateOrUpdate creates or updates diagnostic settings for the specified resource. // -// resourceURI is the identifier of the resource. parameters is parameters supplied to the operation. name is the name -// of the diagnostic setting. +// resourceURI is the identifier of the resource. parameters is parameters supplied to the operation. name is the +// name of the diagnostic setting. func (client DiagnosticSettingsClient) CreateOrUpdate(ctx context.Context, resourceURI string, parameters DiagnosticSettingsResource, name string) (result DiagnosticSettingsResource, err error) { req, err := client.CreateOrUpdatePreparer(ctx, resourceURI, parameters, name) if err != nil { diff --git a/services/monitor/mgmt/2017-05-01-preview/insights/logprofiles.go b/services/monitor/mgmt/2017-05-01-preview/insights/logprofiles.go index 91342d2467a7..95a9cb0ec03f 100644 --- a/services/monitor/mgmt/2017-05-01-preview/insights/logprofiles.go +++ b/services/monitor/mgmt/2017-05-01-preview/insights/logprofiles.go @@ -55,7 +55,7 @@ func (client LogProfilesClient) CreateOrUpdate(ctx context.Context, logProfileNa Chain: []validation.Constraint{{Target: "parameters.LogProfileProperties.RetentionPolicy.Days", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}}}, }}, }}}}}); err != nil { - return result, validation.NewErrorWithValidationError(err, "insights.LogProfilesClient", "CreateOrUpdate") + return result, validation.NewError("insights.LogProfilesClient", "CreateOrUpdate", err.Error()) } req, err := client.CreateOrUpdatePreparer(ctx, logProfileName, parameters) diff --git a/services/monitor/mgmt/2017-05-01-preview/insights/models.go b/services/monitor/mgmt/2017-05-01-preview/insights/models.go index 92e727037be4..7ae23a051e2c 100644 --- a/services/monitor/mgmt/2017-05-01-preview/insights/models.go +++ b/services/monitor/mgmt/2017-05-01-preview/insights/models.go @@ -35,6 +35,11 @@ const ( Metrics CategoryType = "Metrics" ) +// PossibleCategoryTypeValues returns an array of possible values for the CategoryType const type. +func PossibleCategoryTypeValues() [2]CategoryType { + return [2]CategoryType{Logs, Metrics} +} + // ComparisonOperationType enumerates the values for comparison operation type. type ComparisonOperationType string @@ -53,6 +58,11 @@ const ( NotEquals ComparisonOperationType = "NotEquals" ) +// PossibleComparisonOperationTypeValues returns an array of possible values for the ComparisonOperationType const type. +func PossibleComparisonOperationTypeValues() [6]ComparisonOperationType { + return [6]ComparisonOperationType{Equals, GreaterThan, GreaterThanOrEqual, LessThan, LessThanOrEqual, NotEquals} +} + // ConditionOperator enumerates the values for condition operator. type ConditionOperator string @@ -67,6 +77,11 @@ const ( ConditionOperatorLessThanOrEqual ConditionOperator = "LessThanOrEqual" ) +// PossibleConditionOperatorValues returns an array of possible values for the ConditionOperator const type. +func PossibleConditionOperatorValues() [4]ConditionOperator { + return [4]ConditionOperator{ConditionOperatorGreaterThan, ConditionOperatorGreaterThanOrEqual, ConditionOperatorLessThan, ConditionOperatorLessThanOrEqual} +} + // MetricStatisticType enumerates the values for metric statistic type. type MetricStatisticType string @@ -81,6 +96,11 @@ const ( Sum MetricStatisticType = "Sum" ) +// PossibleMetricStatisticTypeValues returns an array of possible values for the MetricStatisticType const type. +func PossibleMetricStatisticTypeValues() [4]MetricStatisticType { + return [4]MetricStatisticType{Average, Max, Min, Sum} +} + // OdataType enumerates the values for odata type. type OdataType string @@ -93,6 +113,11 @@ const ( OdataTypeRuleDataSource OdataType = "RuleDataSource" ) +// PossibleOdataTypeValues returns an array of possible values for the OdataType const type. +func PossibleOdataTypeValues() [3]OdataType { + return [3]OdataType{OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource, OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource, OdataTypeRuleDataSource} +} + // OdataTypeBasicRuleAction enumerates the values for odata type basic rule action. type OdataTypeBasicRuleAction string @@ -105,6 +130,11 @@ const ( OdataTypeRuleAction OdataTypeBasicRuleAction = "RuleAction" ) +// PossibleOdataTypeBasicRuleActionValues returns an array of possible values for the OdataTypeBasicRuleAction const type. +func PossibleOdataTypeBasicRuleActionValues() [3]OdataTypeBasicRuleAction { + return [3]OdataTypeBasicRuleAction{OdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction, OdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction, OdataTypeRuleAction} +} + // OdataTypeBasicRuleCondition enumerates the values for odata type basic rule condition. type OdataTypeBasicRuleCondition string @@ -119,6 +149,11 @@ const ( OdataTypeRuleCondition OdataTypeBasicRuleCondition = "RuleCondition" ) +// PossibleOdataTypeBasicRuleConditionValues returns an array of possible values for the OdataTypeBasicRuleCondition const type. +func PossibleOdataTypeBasicRuleConditionValues() [4]OdataTypeBasicRuleCondition { + return [4]OdataTypeBasicRuleCondition{OdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition, OdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition, OdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition, OdataTypeRuleCondition} +} + // ReceiverStatus enumerates the values for receiver status. type ReceiverStatus string @@ -131,6 +166,11 @@ const ( NotSpecified ReceiverStatus = "NotSpecified" ) +// PossibleReceiverStatusValues returns an array of possible values for the ReceiverStatus const type. +func PossibleReceiverStatusValues() [3]ReceiverStatus { + return [3]ReceiverStatus{Disabled, Enabled, NotSpecified} +} + // RecurrenceFrequency enumerates the values for recurrence frequency. type RecurrenceFrequency string @@ -153,6 +193,11 @@ const ( Year RecurrenceFrequency = "Year" ) +// PossibleRecurrenceFrequencyValues returns an array of possible values for the RecurrenceFrequency const type. +func PossibleRecurrenceFrequencyValues() [8]RecurrenceFrequency { + return [8]RecurrenceFrequency{Day, Hour, Minute, Month, None, Second, Week, Year} +} + // ScaleDirection enumerates the values for scale direction. type ScaleDirection string @@ -165,6 +210,11 @@ const ( ScaleDirectionNone ScaleDirection = "None" ) +// PossibleScaleDirectionValues returns an array of possible values for the ScaleDirection const type. +func PossibleScaleDirectionValues() [3]ScaleDirection { + return [3]ScaleDirection{ScaleDirectionDecrease, ScaleDirectionIncrease, ScaleDirectionNone} +} + // ScaleType enumerates the values for scale type. type ScaleType string @@ -177,6 +227,11 @@ const ( PercentChangeCount ScaleType = "PercentChangeCount" ) +// PossibleScaleTypeValues returns an array of possible values for the ScaleType const type. +func PossibleScaleTypeValues() [3]ScaleType { + return [3]ScaleType{ChangeCount, ExactCount, PercentChangeCount} +} + // TimeAggregationOperator enumerates the values for time aggregation operator. type TimeAggregationOperator string @@ -193,6 +248,11 @@ const ( TimeAggregationOperatorTotal TimeAggregationOperator = "Total" ) +// PossibleTimeAggregationOperatorValues returns an array of possible values for the TimeAggregationOperator const type. +func PossibleTimeAggregationOperatorValues() [5]TimeAggregationOperator { + return [5]TimeAggregationOperator{TimeAggregationOperatorAverage, TimeAggregationOperatorLast, TimeAggregationOperatorMaximum, TimeAggregationOperatorMinimum, TimeAggregationOperatorTotal} +} + // TimeAggregationType enumerates the values for time aggregation type. type TimeAggregationType string @@ -209,6 +269,11 @@ const ( TimeAggregationTypeTotal TimeAggregationType = "Total" ) +// PossibleTimeAggregationTypeValues returns an array of possible values for the TimeAggregationType const type. +func PossibleTimeAggregationTypeValues() [5]TimeAggregationType { + return [5]TimeAggregationType{TimeAggregationTypeAverage, TimeAggregationTypeCount, TimeAggregationTypeMaximum, TimeAggregationTypeMinimum, TimeAggregationTypeTotal} +} + // ActionGroup an Azure action group. type ActionGroup struct { // GroupShortName - The short name of the action group. This will be used in SMS messages. @@ -247,11 +312,23 @@ type ActionGroupPatch struct { // ActionGroupPatchBody an action group object for the body of patch operations. type ActionGroupPatchBody struct { // Tags - Resource tags - Tags *map[string]*string `json:"tags,omitempty"` + Tags map[string]*string `json:"tags"` // ActionGroupPatch - The action group settings for an update operation. *ActionGroupPatch `json:"properties,omitempty"` } +// MarshalJSON is the custom marshaler for ActionGroupPatchBody. +func (agpb ActionGroupPatchBody) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if agpb.Tags != nil { + objectMap["tags"] = agpb.Tags + } + if agpb.ActionGroupPatch != nil { + objectMap["properties"] = agpb.ActionGroupPatch + } + return json.Marshal(objectMap) +} + // UnmarshalJSON is the custom unmarshaler for ActionGroupPatchBody struct. func (agpb *ActionGroupPatchBody) UnmarshalJSON(body []byte) error { var m map[string]*json.RawMessage @@ -259,26 +336,27 @@ func (agpb *ActionGroupPatchBody) UnmarshalJSON(body []byte) error { if err != nil { return err } - var v *json.RawMessage - - v = m["tags"] - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*m["tags"], &tags) - if err != nil { - return err - } - agpb.Tags = &tags - } - - v = m["properties"] - if v != nil { - var properties ActionGroupPatch - err = json.Unmarshal(*m["properties"], &properties) - if err != nil { - return err + for k, v := range m { + switch k { + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + agpb.Tags = tags + } + case "properties": + if v != nil { + var actionGroupPatch ActionGroupPatch + err = json.Unmarshal(*v, &actionGroupPatch) + if err != nil { + return err + } + agpb.ActionGroupPatch = &actionGroupPatch + } } - agpb.ActionGroupPatch = &properties } return nil @@ -287,6 +365,8 @@ func (agpb *ActionGroupPatchBody) UnmarshalJSON(body []byte) error { // ActionGroupResource an action group resource. type ActionGroupResource struct { autorest.Response `json:"-"` + // ActionGroup - The action groups properties of the resource. + *ActionGroup `json:"properties,omitempty"` // ID - Azure resource Id ID *string `json:"id,omitempty"` // Name - Azure resource name @@ -296,78 +376,97 @@ type ActionGroupResource struct { // Location - Resource location Location *string `json:"location,omitempty"` // Tags - Resource tags - Tags *map[string]*string `json:"tags,omitempty"` - // ActionGroup - The action groups properties of the resource. - *ActionGroup `json:"properties,omitempty"` + Tags map[string]*string `json:"tags"` } -// UnmarshalJSON is the custom unmarshaler for ActionGroupResource struct. -func (agr *ActionGroupResource) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err +// MarshalJSON is the custom marshaler for ActionGroupResource. +func (agr ActionGroupResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if agr.ActionGroup != nil { + objectMap["properties"] = agr.ActionGroup } - var v *json.RawMessage - - v = m["properties"] - if v != nil { - var properties ActionGroup - err = json.Unmarshal(*m["properties"], &properties) - if err != nil { - return err - } - agr.ActionGroup = &properties + if agr.ID != nil { + objectMap["id"] = agr.ID } - - v = m["id"] - if v != nil { - var ID string - err = json.Unmarshal(*m["id"], &ID) - if err != nil { - return err - } - agr.ID = &ID + if agr.Name != nil { + objectMap["name"] = agr.Name } - - v = m["name"] - if v != nil { - var name string - err = json.Unmarshal(*m["name"], &name) - if err != nil { - return err - } - agr.Name = &name + if agr.Type != nil { + objectMap["type"] = agr.Type } - - v = m["type"] - if v != nil { - var typeVar string - err = json.Unmarshal(*m["type"], &typeVar) - if err != nil { - return err - } - agr.Type = &typeVar + if agr.Location != nil { + objectMap["location"] = agr.Location } - - v = m["location"] - if v != nil { - var location string - err = json.Unmarshal(*m["location"], &location) - if err != nil { - return err - } - agr.Location = &location + if agr.Tags != nil { + objectMap["tags"] = agr.Tags } + return json.Marshal(objectMap) +} - v = m["tags"] - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*m["tags"], &tags) - if err != nil { - return err +// UnmarshalJSON is the custom unmarshaler for ActionGroupResource struct. +func (agr *ActionGroupResource) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var actionGroup ActionGroup + err = json.Unmarshal(*v, &actionGroup) + if err != nil { + return err + } + agr.ActionGroup = &actionGroup + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + agr.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + agr.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + agr.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + agr.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + agr.Tags = tags + } } - agr.Tags = &tags } return nil @@ -392,7 +491,19 @@ type ActivityLogAlertActionGroup struct { // ActionGroupID - The resourceId of the action group. This cannot be null or empty. ActionGroupID *string `json:"actionGroupId,omitempty"` // WebhookProperties - the dictionary of custom properties to include with the post operation. These data are appended to the webhook payload. - WebhookProperties *map[string]*string `json:"webhookProperties,omitempty"` + WebhookProperties map[string]*string `json:"webhookProperties"` +} + +// MarshalJSON is the custom marshaler for ActivityLogAlertActionGroup. +func (alaag ActivityLogAlertActionGroup) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if alaag.ActionGroupID != nil { + objectMap["actionGroupId"] = alaag.ActionGroupID + } + if alaag.WebhookProperties != nil { + objectMap["webhookProperties"] = alaag.WebhookProperties + } + return json.Marshal(objectMap) } // ActivityLogAlertActionList a list of activity log alert actions. @@ -401,7 +512,8 @@ type ActivityLogAlertActionList struct { ActionGroups *[]ActivityLogAlertActionGroup `json:"actionGroups,omitempty"` } -// ActivityLogAlertAllOfCondition an Activity Log alert condition that is met when all its member conditions are met. +// ActivityLogAlertAllOfCondition an Activity Log alert condition that is met when all its member conditions are +// met. type ActivityLogAlertAllOfCondition struct { // AllOf - The list of activity log alert conditions. AllOf *[]ActivityLogAlertLeafCondition `json:"allOf,omitempty"` @@ -434,11 +546,23 @@ type ActivityLogAlertPatch struct { // ActivityLogAlertPatchBody an activity log alert object for the body of patch operations. type ActivityLogAlertPatchBody struct { // Tags - Resource tags - Tags *map[string]*string `json:"tags,omitempty"` + Tags map[string]*string `json:"tags"` // ActivityLogAlertPatch - The activity log alert settings for an update operation. *ActivityLogAlertPatch `json:"properties,omitempty"` } +// MarshalJSON is the custom marshaler for ActivityLogAlertPatchBody. +func (alapb ActivityLogAlertPatchBody) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if alapb.Tags != nil { + objectMap["tags"] = alapb.Tags + } + if alapb.ActivityLogAlertPatch != nil { + objectMap["properties"] = alapb.ActivityLogAlertPatch + } + return json.Marshal(objectMap) +} + // UnmarshalJSON is the custom unmarshaler for ActivityLogAlertPatchBody struct. func (alapb *ActivityLogAlertPatchBody) UnmarshalJSON(body []byte) error { var m map[string]*json.RawMessage @@ -446,26 +570,27 @@ func (alapb *ActivityLogAlertPatchBody) UnmarshalJSON(body []byte) error { if err != nil { return err } - var v *json.RawMessage - - v = m["tags"] - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*m["tags"], &tags) - if err != nil { - return err - } - alapb.Tags = &tags - } - - v = m["properties"] - if v != nil { - var properties ActivityLogAlertPatch - err = json.Unmarshal(*m["properties"], &properties) - if err != nil { - return err + for k, v := range m { + switch k { + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + alapb.Tags = tags + } + case "properties": + if v != nil { + var activityLogAlertPatch ActivityLogAlertPatch + err = json.Unmarshal(*v, &activityLogAlertPatch) + if err != nil { + return err + } + alapb.ActivityLogAlertPatch = &activityLogAlertPatch + } } - alapb.ActivityLogAlertPatch = &properties } return nil @@ -474,6 +599,8 @@ func (alapb *ActivityLogAlertPatchBody) UnmarshalJSON(body []byte) error { // ActivityLogAlertResource an activity log alert resource. type ActivityLogAlertResource struct { autorest.Response `json:"-"` + // ActivityLogAlert - The activity log alert properties of the resource. + *ActivityLogAlert `json:"properties,omitempty"` // ID - Azure resource Id ID *string `json:"id,omitempty"` // Name - Azure resource name @@ -483,78 +610,97 @@ type ActivityLogAlertResource struct { // Location - Resource location Location *string `json:"location,omitempty"` // Tags - Resource tags - Tags *map[string]*string `json:"tags,omitempty"` - // ActivityLogAlert - The activity log alert properties of the resource. - *ActivityLogAlert `json:"properties,omitempty"` + Tags map[string]*string `json:"tags"` } -// UnmarshalJSON is the custom unmarshaler for ActivityLogAlertResource struct. -func (alar *ActivityLogAlertResource) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err +// MarshalJSON is the custom marshaler for ActivityLogAlertResource. +func (alar ActivityLogAlertResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if alar.ActivityLogAlert != nil { + objectMap["properties"] = alar.ActivityLogAlert } - var v *json.RawMessage - - v = m["properties"] - if v != nil { - var properties ActivityLogAlert - err = json.Unmarshal(*m["properties"], &properties) - if err != nil { - return err - } - alar.ActivityLogAlert = &properties + if alar.ID != nil { + objectMap["id"] = alar.ID } - - v = m["id"] - if v != nil { - var ID string - err = json.Unmarshal(*m["id"], &ID) - if err != nil { - return err - } - alar.ID = &ID + if alar.Name != nil { + objectMap["name"] = alar.Name } - - v = m["name"] - if v != nil { - var name string - err = json.Unmarshal(*m["name"], &name) - if err != nil { - return err - } - alar.Name = &name + if alar.Type != nil { + objectMap["type"] = alar.Type } - - v = m["type"] - if v != nil { - var typeVar string - err = json.Unmarshal(*m["type"], &typeVar) - if err != nil { - return err - } - alar.Type = &typeVar + if alar.Location != nil { + objectMap["location"] = alar.Location } - - v = m["location"] - if v != nil { - var location string - err = json.Unmarshal(*m["location"], &location) - if err != nil { - return err - } - alar.Location = &location + if alar.Tags != nil { + objectMap["tags"] = alar.Tags } + return json.Marshal(objectMap) +} - v = m["tags"] - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*m["tags"], &tags) - if err != nil { - return err +// UnmarshalJSON is the custom unmarshaler for ActivityLogAlertResource struct. +func (alar *ActivityLogAlertResource) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var activityLogAlert ActivityLogAlert + err = json.Unmarshal(*v, &activityLogAlert) + if err != nil { + return err + } + alar.ActivityLogAlert = &activityLogAlert + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + alar.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + alar.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + alar.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + alar.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + alar.Tags = tags + } } - alar.Tags = &tags } return nil @@ -583,64 +729,61 @@ func (ar *AlertRule) UnmarshalJSON(body []byte) error { if err != nil { return err } - var v *json.RawMessage - - v = m["name"] - if v != nil { - var name string - err = json.Unmarshal(*m["name"], &name) - if err != nil { - return err - } - ar.Name = &name - } - - v = m["description"] - if v != nil { - var description string - err = json.Unmarshal(*m["description"], &description) - if err != nil { - return err - } - ar.Description = &description - } - - v = m["isEnabled"] - if v != nil { - var isEnabled bool - err = json.Unmarshal(*m["isEnabled"], &isEnabled) - if err != nil { - return err - } - ar.IsEnabled = &isEnabled - } - - v = m["condition"] - if v != nil { - condition, err := unmarshalBasicRuleCondition(*m["condition"]) - if err != nil { - return err - } - ar.Condition = condition - } - - v = m["actions"] - if v != nil { - actions, err := unmarshalBasicRuleActionArray(*m["actions"]) - if err != nil { - return err - } - ar.Actions = &actions - } - - v = m["lastUpdatedTime"] - if v != nil { - var lastUpdatedTime date.Time - err = json.Unmarshal(*m["lastUpdatedTime"], &lastUpdatedTime) - if err != nil { - return err + for k, v := range m { + switch k { + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + ar.Name = &name + } + case "description": + if v != nil { + var description string + err = json.Unmarshal(*v, &description) + if err != nil { + return err + } + ar.Description = &description + } + case "isEnabled": + if v != nil { + var isEnabled bool + err = json.Unmarshal(*v, &isEnabled) + if err != nil { + return err + } + ar.IsEnabled = &isEnabled + } + case "condition": + if v != nil { + condition, err := unmarshalBasicRuleCondition(*v) + if err != nil { + return err + } + ar.Condition = condition + } + case "actions": + if v != nil { + actions, err := unmarshalBasicRuleActionArray(*v) + if err != nil { + return err + } + ar.Actions = &actions + } + case "lastUpdatedTime": + if v != nil { + var lastUpdatedTime date.Time + err = json.Unmarshal(*v, &lastUpdatedTime) + if err != nil { + return err + } + ar.LastUpdatedTime = &lastUpdatedTime + } } - ar.LastUpdatedTime = &lastUpdatedTime } return nil @@ -649,6 +792,8 @@ func (ar *AlertRule) UnmarshalJSON(body []byte) error { // AlertRuleResource the alert rule resource. type AlertRuleResource struct { autorest.Response `json:"-"` + // AlertRule - The alert rule properties of the resource. + *AlertRule `json:"properties,omitempty"` // ID - Azure resource Id ID *string `json:"id,omitempty"` // Name - Azure resource name @@ -658,78 +803,97 @@ type AlertRuleResource struct { // Location - Resource location Location *string `json:"location,omitempty"` // Tags - Resource tags - Tags *map[string]*string `json:"tags,omitempty"` - // AlertRule - The alert rule properties of the resource. - *AlertRule `json:"properties,omitempty"` + Tags map[string]*string `json:"tags"` } -// UnmarshalJSON is the custom unmarshaler for AlertRuleResource struct. -func (arr *AlertRuleResource) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err +// MarshalJSON is the custom marshaler for AlertRuleResource. +func (arr AlertRuleResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if arr.AlertRule != nil { + objectMap["properties"] = arr.AlertRule } - var v *json.RawMessage - - v = m["properties"] - if v != nil { - var properties AlertRule - err = json.Unmarshal(*m["properties"], &properties) - if err != nil { - return err - } - arr.AlertRule = &properties + if arr.ID != nil { + objectMap["id"] = arr.ID } - - v = m["id"] - if v != nil { - var ID string - err = json.Unmarshal(*m["id"], &ID) - if err != nil { - return err - } - arr.ID = &ID + if arr.Name != nil { + objectMap["name"] = arr.Name } - - v = m["name"] - if v != nil { - var name string - err = json.Unmarshal(*m["name"], &name) - if err != nil { - return err - } - arr.Name = &name + if arr.Type != nil { + objectMap["type"] = arr.Type } - - v = m["type"] - if v != nil { - var typeVar string - err = json.Unmarshal(*m["type"], &typeVar) - if err != nil { - return err - } - arr.Type = &typeVar + if arr.Location != nil { + objectMap["location"] = arr.Location } - - v = m["location"] - if v != nil { - var location string - err = json.Unmarshal(*m["location"], &location) - if err != nil { - return err - } - arr.Location = &location + if arr.Tags != nil { + objectMap["tags"] = arr.Tags } + return json.Marshal(objectMap) +} - v = m["tags"] - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*m["tags"], &tags) - if err != nil { - return err +// UnmarshalJSON is the custom unmarshaler for AlertRuleResource struct. +func (arr *AlertRuleResource) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var alertRule AlertRule + err = json.Unmarshal(*v, &alertRule) + if err != nil { + return err + } + arr.AlertRule = &alertRule + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + arr.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + arr.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + arr.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + arr.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + arr.Tags = tags + } } - arr.Tags = &tags } return nil @@ -745,11 +909,23 @@ type AlertRuleResourceCollection struct { // AlertRuleResourcePatch the alert rule object for patch operations. type AlertRuleResourcePatch struct { // Tags - Resource tags - Tags *map[string]*string `json:"tags,omitempty"` + Tags map[string]*string `json:"tags"` // AlertRule - The properties of an alert rule. *AlertRule `json:"properties,omitempty"` } +// MarshalJSON is the custom marshaler for AlertRuleResourcePatch. +func (arrp AlertRuleResourcePatch) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if arrp.Tags != nil { + objectMap["tags"] = arrp.Tags + } + if arrp.AlertRule != nil { + objectMap["properties"] = arrp.AlertRule + } + return json.Marshal(objectMap) +} + // UnmarshalJSON is the custom unmarshaler for AlertRuleResourcePatch struct. func (arrp *AlertRuleResourcePatch) UnmarshalJSON(body []byte) error { var m map[string]*json.RawMessage @@ -757,26 +933,27 @@ func (arrp *AlertRuleResourcePatch) UnmarshalJSON(body []byte) error { if err != nil { return err } - var v *json.RawMessage - - v = m["tags"] - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*m["tags"], &tags) - if err != nil { - return err - } - arrp.Tags = &tags - } - - v = m["properties"] - if v != nil { - var properties AlertRule - err = json.Unmarshal(*m["properties"], &properties) - if err != nil { - return err + for k, v := range m { + switch k { + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + arrp.Tags = tags + } + case "properties": + if v != nil { + var alertRule AlertRule + err = json.Unmarshal(*v, &alertRule) + if err != nil { + return err + } + arrp.AlertRule = &alertRule + } } - arrp.AlertRule = &properties } return nil @@ -839,6 +1016,8 @@ type AutoscaleSetting struct { // AutoscaleSettingResource the autoscale setting resource. type AutoscaleSettingResource struct { autorest.Response `json:"-"` + // AutoscaleSetting - The autoscale setting of the resource. + *AutoscaleSetting `json:"properties,omitempty"` // ID - Azure resource Id ID *string `json:"id,omitempty"` // Name - Azure resource name @@ -848,78 +1027,97 @@ type AutoscaleSettingResource struct { // Location - Resource location Location *string `json:"location,omitempty"` // Tags - Resource tags - Tags *map[string]*string `json:"tags,omitempty"` - // AutoscaleSetting - The autoscale setting of the resource. - *AutoscaleSetting `json:"properties,omitempty"` + Tags map[string]*string `json:"tags"` } -// UnmarshalJSON is the custom unmarshaler for AutoscaleSettingResource struct. -func (asr *AutoscaleSettingResource) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err +// MarshalJSON is the custom marshaler for AutoscaleSettingResource. +func (asr AutoscaleSettingResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if asr.AutoscaleSetting != nil { + objectMap["properties"] = asr.AutoscaleSetting } - var v *json.RawMessage - - v = m["properties"] - if v != nil { - var properties AutoscaleSetting - err = json.Unmarshal(*m["properties"], &properties) - if err != nil { - return err - } - asr.AutoscaleSetting = &properties + if asr.ID != nil { + objectMap["id"] = asr.ID } - - v = m["id"] - if v != nil { - var ID string - err = json.Unmarshal(*m["id"], &ID) - if err != nil { - return err - } - asr.ID = &ID + if asr.Name != nil { + objectMap["name"] = asr.Name } - - v = m["name"] - if v != nil { - var name string - err = json.Unmarshal(*m["name"], &name) - if err != nil { - return err - } - asr.Name = &name + if asr.Type != nil { + objectMap["type"] = asr.Type } - - v = m["type"] - if v != nil { - var typeVar string - err = json.Unmarshal(*m["type"], &typeVar) - if err != nil { - return err - } - asr.Type = &typeVar + if asr.Location != nil { + objectMap["location"] = asr.Location } - - v = m["location"] - if v != nil { - var location string - err = json.Unmarshal(*m["location"], &location) - if err != nil { - return err - } - asr.Location = &location + if asr.Tags != nil { + objectMap["tags"] = asr.Tags } + return json.Marshal(objectMap) +} - v = m["tags"] - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*m["tags"], &tags) - if err != nil { - return err +// UnmarshalJSON is the custom unmarshaler for AutoscaleSettingResource struct. +func (asr *AutoscaleSettingResource) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var autoscaleSetting AutoscaleSetting + err = json.Unmarshal(*v, &autoscaleSetting) + if err != nil { + return err + } + asr.AutoscaleSetting = &autoscaleSetting + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + asr.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + asr.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + asr.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + asr.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + asr.Tags = tags + } } - asr.Tags = &tags } return nil @@ -934,7 +1132,8 @@ type AutoscaleSettingResourceCollection struct { NextLink *string `json:"nextLink,omitempty"` } -// AutoscaleSettingResourceCollectionIterator provides access to a complete listing of AutoscaleSettingResource values. +// AutoscaleSettingResourceCollectionIterator provides access to a complete listing of AutoscaleSettingResource +// values. type AutoscaleSettingResourceCollectionIterator struct { i int page AutoscaleSettingResourceCollectionPage @@ -1030,11 +1229,23 @@ func (page AutoscaleSettingResourceCollectionPage) Values() []AutoscaleSettingRe // AutoscaleSettingResourcePatch the autoscale setting object for patch operations. type AutoscaleSettingResourcePatch struct { // Tags - Resource tags - Tags *map[string]*string `json:"tags,omitempty"` + Tags map[string]*string `json:"tags"` // AutoscaleSetting - The autoscale setting properties of the update operation. *AutoscaleSetting `json:"properties,omitempty"` } +// MarshalJSON is the custom marshaler for AutoscaleSettingResourcePatch. +func (asrp AutoscaleSettingResourcePatch) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if asrp.Tags != nil { + objectMap["tags"] = asrp.Tags + } + if asrp.AutoscaleSetting != nil { + objectMap["properties"] = asrp.AutoscaleSetting + } + return json.Marshal(objectMap) +} + // UnmarshalJSON is the custom unmarshaler for AutoscaleSettingResourcePatch struct. func (asrp *AutoscaleSettingResourcePatch) UnmarshalJSON(body []byte) error { var m map[string]*json.RawMessage @@ -1042,26 +1253,27 @@ func (asrp *AutoscaleSettingResourcePatch) UnmarshalJSON(body []byte) error { if err != nil { return err } - var v *json.RawMessage - - v = m["tags"] - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*m["tags"], &tags) - if err != nil { - return err - } - asrp.Tags = &tags - } - - v = m["properties"] - if v != nil { - var properties AutoscaleSetting - err = json.Unmarshal(*m["properties"], &properties) - if err != nil { - return err + for k, v := range m { + switch k { + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + asrp.Tags = tags + } + case "properties": + if v != nil { + var autoscaleSetting AutoscaleSetting + err = json.Unmarshal(*v, &autoscaleSetting) + if err != nil { + return err + } + asrp.AutoscaleSetting = &autoscaleSetting + } } - asrp.AutoscaleSetting = &properties } return nil @@ -1099,14 +1311,14 @@ type DiagnosticSettingsCategory struct { // DiagnosticSettingsCategoryResource the diagnostic settings category resource. type DiagnosticSettingsCategoryResource struct { - autorest.Response `json:"-"` + autorest.Response `json:"-"` + *DiagnosticSettingsCategory `json:"properties,omitempty"` // ID - Azure resource Id ID *string `json:"id,omitempty"` // Name - Azure resource name Name *string `json:"name,omitempty"` // Type - Azure resource type - Type *string `json:"type,omitempty"` - *DiagnosticSettingsCategory `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` } // UnmarshalJSON is the custom unmarshaler for DiagnosticSettingsCategoryResource struct. @@ -1116,46 +1328,45 @@ func (dscr *DiagnosticSettingsCategoryResource) UnmarshalJSON(body []byte) error if err != nil { return err } - var v *json.RawMessage - - v = m["properties"] - if v != nil { - var properties DiagnosticSettingsCategory - err = json.Unmarshal(*m["properties"], &properties) - if err != nil { - return err - } - dscr.DiagnosticSettingsCategory = &properties - } - - v = m["id"] - if v != nil { - var ID string - err = json.Unmarshal(*m["id"], &ID) - if err != nil { - return err - } - dscr.ID = &ID - } - - v = m["name"] - if v != nil { - var name string - err = json.Unmarshal(*m["name"], &name) - if err != nil { - return err + for k, v := range m { + switch k { + case "properties": + if v != nil { + var diagnosticSettingsCategory DiagnosticSettingsCategory + err = json.Unmarshal(*v, &diagnosticSettingsCategory) + if err != nil { + return err + } + dscr.DiagnosticSettingsCategory = &diagnosticSettingsCategory + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + dscr.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + dscr.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + dscr.Type = &typeVar + } } - dscr.Name = &name - } - - v = m["type"] - if v != nil { - var typeVar string - err = json.Unmarshal(*m["type"], &typeVar) - if err != nil { - return err - } - dscr.Type = &typeVar } return nil @@ -1170,14 +1381,14 @@ type DiagnosticSettingsCategoryResourceCollection struct { // DiagnosticSettingsResource the diagnostic setting resource. type DiagnosticSettingsResource struct { - autorest.Response `json:"-"` + autorest.Response `json:"-"` + *DiagnosticSettings `json:"properties,omitempty"` // ID - Azure resource Id ID *string `json:"id,omitempty"` // Name - Azure resource name Name *string `json:"name,omitempty"` // Type - Azure resource type - Type *string `json:"type,omitempty"` - *DiagnosticSettings `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` } // UnmarshalJSON is the custom unmarshaler for DiagnosticSettingsResource struct. @@ -1187,46 +1398,45 @@ func (dsr *DiagnosticSettingsResource) UnmarshalJSON(body []byte) error { if err != nil { return err } - var v *json.RawMessage - - v = m["properties"] - if v != nil { - var properties DiagnosticSettings - err = json.Unmarshal(*m["properties"], &properties) - if err != nil { - return err - } - dsr.DiagnosticSettings = &properties - } - - v = m["id"] - if v != nil { - var ID string - err = json.Unmarshal(*m["id"], &ID) - if err != nil { - return err + for k, v := range m { + switch k { + case "properties": + if v != nil { + var diagnosticSettings DiagnosticSettings + err = json.Unmarshal(*v, &diagnosticSettings) + if err != nil { + return err + } + dsr.DiagnosticSettings = &diagnosticSettings + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + dsr.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + dsr.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + dsr.Type = &typeVar + } } - dsr.ID = &ID - } - - v = m["name"] - if v != nil { - var name string - err = json.Unmarshal(*m["name"], &name) - if err != nil { - return err - } - dsr.Name = &name - } - - v = m["type"] - if v != nil { - var typeVar string - err = json.Unmarshal(*m["type"], &typeVar) - if err != nil { - return err - } - dsr.Type = &typeVar } return nil @@ -1311,25 +1521,29 @@ type ItsmReceiver struct { // LocationThresholdRuleCondition a rule condition based on a certain number of locations failing. type LocationThresholdRuleCondition struct { - // DataSource - the resource from which the rule collects its data. For this type dataSource will always be of type RuleMetricDataSource. - DataSource BasicRuleDataSource `json:"dataSource,omitempty"` - // OdataType - Possible values include: 'OdataTypeRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition' - OdataType OdataTypeBasicRuleCondition `json:"odata.type,omitempty"` // WindowSize - the period of time (in ISO 8601 duration format) that is used to monitor alert activity based on the threshold. If specified then it must be between 5 minutes and 1 day. WindowSize *string `json:"windowSize,omitempty"` // FailedLocationCount - the number of locations that must fail to activate the alert. FailedLocationCount *int32 `json:"failedLocationCount,omitempty"` + // DataSource - the resource from which the rule collects its data. For this type dataSource will always be of type RuleMetricDataSource. + DataSource BasicRuleDataSource `json:"dataSource,omitempty"` + // OdataType - Possible values include: 'OdataTypeRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition' + OdataType OdataTypeBasicRuleCondition `json:"odata.type,omitempty"` } // MarshalJSON is the custom marshaler for LocationThresholdRuleCondition. func (ltrc LocationThresholdRuleCondition) MarshalJSON() ([]byte, error) { ltrc.OdataType = OdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition - type Alias LocationThresholdRuleCondition - return json.Marshal(&struct { - Alias - }{ - Alias: (Alias)(ltrc), - }) + objectMap := make(map[string]interface{}) + if ltrc.WindowSize != nil { + objectMap["windowSize"] = ltrc.WindowSize + } + if ltrc.FailedLocationCount != nil { + objectMap["failedLocationCount"] = ltrc.FailedLocationCount + } + objectMap["dataSource"] = ltrc.DataSource + objectMap["odata.type"] = ltrc.OdataType + return json.Marshal(objectMap) } // AsThresholdRuleCondition is the BasicRuleCondition implementation for LocationThresholdRuleCondition. @@ -1364,45 +1578,44 @@ func (ltrc *LocationThresholdRuleCondition) UnmarshalJSON(body []byte) error { if err != nil { return err } - var v *json.RawMessage - - v = m["windowSize"] - if v != nil { - var windowSize string - err = json.Unmarshal(*m["windowSize"], &windowSize) - if err != nil { - return err - } - ltrc.WindowSize = &windowSize - } - - v = m["failedLocationCount"] - if v != nil { - var failedLocationCount int32 - err = json.Unmarshal(*m["failedLocationCount"], &failedLocationCount) - if err != nil { - return err - } - ltrc.FailedLocationCount = &failedLocationCount - } - - v = m["dataSource"] - if v != nil { - dataSource, err := unmarshalBasicRuleDataSource(*m["dataSource"]) - if err != nil { - return err + for k, v := range m { + switch k { + case "windowSize": + if v != nil { + var windowSize string + err = json.Unmarshal(*v, &windowSize) + if err != nil { + return err + } + ltrc.WindowSize = &windowSize + } + case "failedLocationCount": + if v != nil { + var failedLocationCount int32 + err = json.Unmarshal(*v, &failedLocationCount) + if err != nil { + return err + } + ltrc.FailedLocationCount = &failedLocationCount + } + case "dataSource": + if v != nil { + dataSource, err := unmarshalBasicRuleDataSource(*v) + if err != nil { + return err + } + ltrc.DataSource = dataSource + } + case "odata.type": + if v != nil { + var odataType OdataTypeBasicRuleCondition + err = json.Unmarshal(*v, &odataType) + if err != nil { + return err + } + ltrc.OdataType = odataType + } } - ltrc.DataSource = dataSource - } - - v = m["odata.type"] - if v != nil { - var odatatype OdataTypeBasicRuleCondition - err = json.Unmarshal(*m["odata.type"], &odatatype) - if err != nil { - return err - } - ltrc.OdataType = odatatype } return nil @@ -1432,6 +1645,8 @@ type LogProfileProperties struct { // LogProfileResource the log profile resource. type LogProfileResource struct { autorest.Response `json:"-"` + // LogProfileProperties - The log profile properties of the resource. + *LogProfileProperties `json:"properties,omitempty"` // ID - Azure resource Id ID *string `json:"id,omitempty"` // Name - Azure resource name @@ -1441,78 +1656,97 @@ type LogProfileResource struct { // Location - Resource location Location *string `json:"location,omitempty"` // Tags - Resource tags - Tags *map[string]*string `json:"tags,omitempty"` - // LogProfileProperties - The log profile properties of the resource. - *LogProfileProperties `json:"properties,omitempty"` + Tags map[string]*string `json:"tags"` } -// UnmarshalJSON is the custom unmarshaler for LogProfileResource struct. -func (lpr *LogProfileResource) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err +// MarshalJSON is the custom marshaler for LogProfileResource. +func (lpr LogProfileResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if lpr.LogProfileProperties != nil { + objectMap["properties"] = lpr.LogProfileProperties } - var v *json.RawMessage - - v = m["properties"] - if v != nil { - var properties LogProfileProperties - err = json.Unmarshal(*m["properties"], &properties) - if err != nil { - return err - } - lpr.LogProfileProperties = &properties + if lpr.ID != nil { + objectMap["id"] = lpr.ID } - - v = m["id"] - if v != nil { - var ID string - err = json.Unmarshal(*m["id"], &ID) - if err != nil { - return err - } - lpr.ID = &ID + if lpr.Name != nil { + objectMap["name"] = lpr.Name } - - v = m["name"] - if v != nil { - var name string - err = json.Unmarshal(*m["name"], &name) - if err != nil { - return err - } - lpr.Name = &name + if lpr.Type != nil { + objectMap["type"] = lpr.Type } - - v = m["type"] - if v != nil { - var typeVar string - err = json.Unmarshal(*m["type"], &typeVar) - if err != nil { - return err - } - lpr.Type = &typeVar + if lpr.Location != nil { + objectMap["location"] = lpr.Location } - - v = m["location"] - if v != nil { - var location string - err = json.Unmarshal(*m["location"], &location) - if err != nil { - return err - } - lpr.Location = &location + if lpr.Tags != nil { + objectMap["tags"] = lpr.Tags } + return json.Marshal(objectMap) +} - v = m["tags"] - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*m["tags"], &tags) - if err != nil { - return err +// UnmarshalJSON is the custom unmarshaler for LogProfileResource struct. +func (lpr *LogProfileResource) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var logProfileProperties LogProfileProperties + err = json.Unmarshal(*v, &logProfileProperties) + if err != nil { + return err + } + lpr.LogProfileProperties = &logProfileProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + lpr.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + lpr.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + lpr.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + lpr.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + lpr.Tags = tags + } } - lpr.Tags = &tags } return nil @@ -1521,11 +1755,23 @@ func (lpr *LogProfileResource) UnmarshalJSON(body []byte) error { // LogProfileResourcePatch the log profile resource for patch operations. type LogProfileResourcePatch struct { // Tags - Resource tags - Tags *map[string]*string `json:"tags,omitempty"` + Tags map[string]*string `json:"tags"` // LogProfileProperties - The log profile properties for an update operation. *LogProfileProperties `json:"properties,omitempty"` } +// MarshalJSON is the custom marshaler for LogProfileResourcePatch. +func (lprp LogProfileResourcePatch) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if lprp.Tags != nil { + objectMap["tags"] = lprp.Tags + } + if lprp.LogProfileProperties != nil { + objectMap["properties"] = lprp.LogProfileProperties + } + return json.Marshal(objectMap) +} + // UnmarshalJSON is the custom unmarshaler for LogProfileResourcePatch struct. func (lprp *LogProfileResourcePatch) UnmarshalJSON(body []byte) error { var m map[string]*json.RawMessage @@ -1533,26 +1779,27 @@ func (lprp *LogProfileResourcePatch) UnmarshalJSON(body []byte) error { if err != nil { return err } - var v *json.RawMessage - - v = m["tags"] - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*m["tags"], &tags) - if err != nil { - return err + for k, v := range m { + switch k { + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + lprp.Tags = tags + } + case "properties": + if v != nil { + var logProfileProperties LogProfileProperties + err = json.Unmarshal(*v, &logProfileProperties) + if err != nil { + return err + } + lprp.LogProfileProperties = &logProfileProperties + } } - lprp.Tags = &tags - } - - v = m["properties"] - if v != nil { - var properties LogProfileProperties - err = json.Unmarshal(*m["properties"], &properties) - if err != nil { - return err - } - lprp.LogProfileProperties = &properties } return nil @@ -1580,23 +1827,24 @@ type ManagementEventAggregationCondition struct { // ManagementEventRuleCondition a management event rule condition. type ManagementEventRuleCondition struct { + // Aggregation - How the data that is collected should be combined over time and when the alert is activated. Note that for management event alerts aggregation is optional – if it is not provided then any event will cause the alert to activate. + Aggregation *ManagementEventAggregationCondition `json:"aggregation,omitempty"` // DataSource - the resource from which the rule collects its data. For this type dataSource will always be of type RuleMetricDataSource. DataSource BasicRuleDataSource `json:"dataSource,omitempty"` // OdataType - Possible values include: 'OdataTypeRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition' OdataType OdataTypeBasicRuleCondition `json:"odata.type,omitempty"` - // Aggregation - How the data that is collected should be combined over time and when the alert is activated. Note that for management event alerts aggregation is optional – if it is not provided then any event will cause the alert to activate. - Aggregation *ManagementEventAggregationCondition `json:"aggregation,omitempty"` } // MarshalJSON is the custom marshaler for ManagementEventRuleCondition. func (merc ManagementEventRuleCondition) MarshalJSON() ([]byte, error) { merc.OdataType = OdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition - type Alias ManagementEventRuleCondition - return json.Marshal(&struct { - Alias - }{ - Alias: (Alias)(merc), - }) + objectMap := make(map[string]interface{}) + if merc.Aggregation != nil { + objectMap["aggregation"] = merc.Aggregation + } + objectMap["dataSource"] = merc.DataSource + objectMap["odata.type"] = merc.OdataType + return json.Marshal(objectMap) } // AsThresholdRuleCondition is the BasicRuleCondition implementation for ManagementEventRuleCondition. @@ -1631,35 +1879,35 @@ func (merc *ManagementEventRuleCondition) UnmarshalJSON(body []byte) error { if err != nil { return err } - var v *json.RawMessage - - v = m["aggregation"] - if v != nil { - var aggregation ManagementEventAggregationCondition - err = json.Unmarshal(*m["aggregation"], &aggregation) - if err != nil { - return err + for k, v := range m { + switch k { + case "aggregation": + if v != nil { + var aggregation ManagementEventAggregationCondition + err = json.Unmarshal(*v, &aggregation) + if err != nil { + return err + } + merc.Aggregation = &aggregation + } + case "dataSource": + if v != nil { + dataSource, err := unmarshalBasicRuleDataSource(*v) + if err != nil { + return err + } + merc.DataSource = dataSource + } + case "odata.type": + if v != nil { + var odataType OdataTypeBasicRuleCondition + err = json.Unmarshal(*v, &odataType) + if err != nil { + return err + } + merc.OdataType = odataType + } } - merc.Aggregation = &aggregation - } - - v = m["dataSource"] - if v != nil { - dataSource, err := unmarshalBasicRuleDataSource(*m["dataSource"]) - if err != nil { - return err - } - merc.DataSource = dataSource - } - - v = m["odata.type"] - if v != nil { - var odatatype OdataTypeBasicRuleCondition - err = json.Unmarshal(*m["odata.type"], &odatatype) - if err != nil { - return err - } - merc.OdataType = odatatype } return nil @@ -1715,8 +1963,8 @@ type OperationDisplay struct { Operation *string `json:"operation,omitempty"` } -// OperationListResult result of the request to list Microsoft.Insights operations. It contains a list of operations -// and a URL link to get the next set of results. +// OperationListResult result of the request to list Microsoft.Insights operations. It contains a list of +// operations and a URL link to get the next set of results. type OperationListResult struct { autorest.Response `json:"-"` // Value - List of operations supported by the Microsoft.Insights provider. @@ -1735,8 +1983,8 @@ type ProxyOnlyResource struct { Type *string `json:"type,omitempty"` } -// Recurrence the repeating times at which this profile begins. This element is not used if the FixedDate element is -// used. +// Recurrence the repeating times at which this profile begins. This element is not used if the FixedDate element +// is used. type Recurrence struct { // Frequency - the recurrence frequency. How often the schedule profile should take effect. This value must be Week, meaning each week will have the same set of profiles. Possible values include: 'None', 'Second', 'Minute', 'Hour', 'Day', 'Week', 'Month', 'Year' Frequency RecurrenceFrequency `json:"frequency,omitempty"` @@ -1767,7 +2015,28 @@ type Resource struct { // Location - Resource location Location *string `json:"location,omitempty"` // Tags - Resource tags - Tags *map[string]*string `json:"tags,omitempty"` + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for Resource. +func (r Resource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if r.ID != nil { + objectMap["id"] = r.ID + } + if r.Name != nil { + objectMap["name"] = r.Name + } + if r.Type != nil { + objectMap["type"] = r.Type + } + if r.Location != nil { + objectMap["location"] = r.Location + } + if r.Tags != nil { + objectMap["tags"] = r.Tags + } + return json.Marshal(objectMap) } // RetentionPolicy specifies the retention policy for the log. @@ -1786,7 +2055,8 @@ type BasicRuleAction interface { AsRuleAction() (*RuleAction, bool) } -// RuleAction the action that is performed when the alert rule becomes active, and when an alert condition is resolved. +// RuleAction the action that is performed when the alert rule becomes active, and when an alert condition is +// resolved. type RuleAction struct { // OdataType - Possible values include: 'OdataTypeRuleAction', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction' OdataType OdataTypeBasicRuleAction `json:"odata.type,omitempty"` @@ -1836,12 +2106,9 @@ func unmarshalBasicRuleActionArray(body []byte) ([]BasicRuleAction, error) { // MarshalJSON is the custom marshaler for RuleAction. func (ra RuleAction) MarshalJSON() ([]byte, error) { ra.OdataType = OdataTypeRuleAction - type Alias RuleAction - return json.Marshal(&struct { - Alias - }{ - Alias: (Alias)(ra), - }) + objectMap := make(map[string]interface{}) + objectMap["odata.type"] = ra.OdataType + return json.Marshal(objectMap) } // AsRuleEmailAction is the BasicRuleAction implementation for RuleAction. @@ -1928,12 +2195,10 @@ func unmarshalBasicRuleConditionArray(body []byte) ([]BasicRuleCondition, error) // MarshalJSON is the custom marshaler for RuleCondition. func (rc RuleCondition) MarshalJSON() ([]byte, error) { rc.OdataType = OdataTypeRuleCondition - type Alias RuleCondition - return json.Marshal(&struct { - Alias - }{ - Alias: (Alias)(rc), - }) + objectMap := make(map[string]interface{}) + objectMap["dataSource"] = rc.DataSource + objectMap["odata.type"] = rc.OdataType + return json.Marshal(objectMap) } // AsThresholdRuleCondition is the BasicRuleCondition implementation for RuleCondition. @@ -1968,25 +2233,26 @@ func (rc *RuleCondition) UnmarshalJSON(body []byte) error { if err != nil { return err } - var v *json.RawMessage - - v = m["dataSource"] - if v != nil { - dataSource, err := unmarshalBasicRuleDataSource(*m["dataSource"]) - if err != nil { - return err - } - rc.DataSource = dataSource - } - - v = m["odata.type"] - if v != nil { - var odatatype OdataTypeBasicRuleCondition - err = json.Unmarshal(*m["odata.type"], &odatatype) - if err != nil { - return err + for k, v := range m { + switch k { + case "dataSource": + if v != nil { + dataSource, err := unmarshalBasicRuleDataSource(*v) + if err != nil { + return err + } + rc.DataSource = dataSource + } + case "odata.type": + if v != nil { + var odataType OdataTypeBasicRuleCondition + err = json.Unmarshal(*v, &odataType) + if err != nil { + return err + } + rc.OdataType = odataType + } } - rc.OdataType = odatatype } return nil @@ -2051,12 +2317,12 @@ func unmarshalBasicRuleDataSourceArray(body []byte) ([]BasicRuleDataSource, erro // MarshalJSON is the custom marshaler for RuleDataSource. func (rds RuleDataSource) MarshalJSON() ([]byte, error) { rds.OdataType = OdataTypeRuleDataSource - type Alias RuleDataSource - return json.Marshal(&struct { - Alias - }{ - Alias: (Alias)(rds), - }) + objectMap := make(map[string]interface{}) + if rds.ResourceURI != nil { + objectMap["resourceUri"] = rds.ResourceURI + } + objectMap["odata.type"] = rds.OdataType + return json.Marshal(objectMap) } // AsRuleMetricDataSource is the BasicRuleDataSource implementation for RuleDataSource. @@ -2079,26 +2345,29 @@ func (rds RuleDataSource) AsBasicRuleDataSource() (BasicRuleDataSource, bool) { return &rds, true } -// RuleEmailAction specifies the action to send email when the rule condition is evaluated. The discriminator is always -// RuleEmailAction in this case. +// RuleEmailAction specifies the action to send email when the rule condition is evaluated. The discriminator is +// always RuleEmailAction in this case. type RuleEmailAction struct { - // OdataType - Possible values include: 'OdataTypeRuleAction', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction' - OdataType OdataTypeBasicRuleAction `json:"odata.type,omitempty"` // SendToServiceOwners - Whether the administrators (service and co-administrators) of the service should be notified when the alert is activated. SendToServiceOwners *bool `json:"sendToServiceOwners,omitempty"` // CustomEmails - the list of administrator's custom email addresses to notify of the activation of the alert. CustomEmails *[]string `json:"customEmails,omitempty"` + // OdataType - Possible values include: 'OdataTypeRuleAction', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction' + OdataType OdataTypeBasicRuleAction `json:"odata.type,omitempty"` } // MarshalJSON is the custom marshaler for RuleEmailAction. func (rea RuleEmailAction) MarshalJSON() ([]byte, error) { rea.OdataType = OdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction - type Alias RuleEmailAction - return json.Marshal(&struct { - Alias - }{ - Alias: (Alias)(rea), - }) + objectMap := make(map[string]interface{}) + if rea.SendToServiceOwners != nil { + objectMap["sendToServiceOwners"] = rea.SendToServiceOwners + } + if rea.CustomEmails != nil { + objectMap["customEmails"] = rea.CustomEmails + } + objectMap["odata.type"] = rea.OdataType + return json.Marshal(objectMap) } // AsRuleEmailAction is the BasicRuleAction implementation for RuleEmailAction. @@ -2130,10 +2399,6 @@ type RuleManagementEventClaimsDataSource struct { // RuleManagementEventDataSource a rule management event data source. The discriminator fields is always // RuleManagementEventDataSource in this case. type RuleManagementEventDataSource struct { - // ResourceURI - the resource identifier of the resource the rule monitors. **NOTE**: this property cannot be updated for an existing rule. - ResourceURI *string `json:"resourceUri,omitempty"` - // OdataType - Possible values include: 'OdataTypeRuleDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource' - OdataType OdataType `json:"odata.type,omitempty"` // EventName - the event name. EventName *string `json:"eventName,omitempty"` // EventSource - the event source. @@ -2152,17 +2417,48 @@ type RuleManagementEventDataSource struct { SubStatus *string `json:"subStatus,omitempty"` // Claims - the claims. Claims *RuleManagementEventClaimsDataSource `json:"claims,omitempty"` + // ResourceURI - the resource identifier of the resource the rule monitors. **NOTE**: this property cannot be updated for an existing rule. + ResourceURI *string `json:"resourceUri,omitempty"` + // OdataType - Possible values include: 'OdataTypeRuleDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource' + OdataType OdataType `json:"odata.type,omitempty"` } // MarshalJSON is the custom marshaler for RuleManagementEventDataSource. func (rmeds RuleManagementEventDataSource) MarshalJSON() ([]byte, error) { rmeds.OdataType = OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource - type Alias RuleManagementEventDataSource - return json.Marshal(&struct { - Alias - }{ - Alias: (Alias)(rmeds), - }) + objectMap := make(map[string]interface{}) + if rmeds.EventName != nil { + objectMap["eventName"] = rmeds.EventName + } + if rmeds.EventSource != nil { + objectMap["eventSource"] = rmeds.EventSource + } + if rmeds.Level != nil { + objectMap["level"] = rmeds.Level + } + if rmeds.OperationName != nil { + objectMap["operationName"] = rmeds.OperationName + } + if rmeds.ResourceGroupName != nil { + objectMap["resourceGroupName"] = rmeds.ResourceGroupName + } + if rmeds.ResourceProviderName != nil { + objectMap["resourceProviderName"] = rmeds.ResourceProviderName + } + if rmeds.Status != nil { + objectMap["status"] = rmeds.Status + } + if rmeds.SubStatus != nil { + objectMap["subStatus"] = rmeds.SubStatus + } + if rmeds.Claims != nil { + objectMap["claims"] = rmeds.Claims + } + if rmeds.ResourceURI != nil { + objectMap["resourceUri"] = rmeds.ResourceURI + } + objectMap["odata.type"] = rmeds.OdataType + return json.Marshal(objectMap) } // AsRuleMetricDataSource is the BasicRuleDataSource implementation for RuleManagementEventDataSource. @@ -2185,25 +2481,29 @@ func (rmeds RuleManagementEventDataSource) AsBasicRuleDataSource() (BasicRuleDat return &rmeds, true } -// RuleMetricDataSource a rule metric data source. The discriminator value is always RuleMetricDataSource in this case. +// RuleMetricDataSource a rule metric data source. The discriminator value is always RuleMetricDataSource in this +// case. type RuleMetricDataSource struct { + // MetricName - the name of the metric that defines what the rule monitors. + MetricName *string `json:"metricName,omitempty"` // ResourceURI - the resource identifier of the resource the rule monitors. **NOTE**: this property cannot be updated for an existing rule. ResourceURI *string `json:"resourceUri,omitempty"` // OdataType - Possible values include: 'OdataTypeRuleDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource' OdataType OdataType `json:"odata.type,omitempty"` - // MetricName - the name of the metric that defines what the rule monitors. - MetricName *string `json:"metricName,omitempty"` } // MarshalJSON is the custom marshaler for RuleMetricDataSource. func (rmds RuleMetricDataSource) MarshalJSON() ([]byte, error) { rmds.OdataType = OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource - type Alias RuleMetricDataSource - return json.Marshal(&struct { - Alias - }{ - Alias: (Alias)(rmds), - }) + objectMap := make(map[string]interface{}) + if rmds.MetricName != nil { + objectMap["metricName"] = rmds.MetricName + } + if rmds.ResourceURI != nil { + objectMap["resourceUri"] = rmds.ResourceURI + } + objectMap["odata.type"] = rmds.OdataType + return json.Marshal(objectMap) } // AsRuleMetricDataSource is the BasicRuleDataSource implementation for RuleMetricDataSource. @@ -2226,26 +2526,29 @@ func (rmds RuleMetricDataSource) AsBasicRuleDataSource() (BasicRuleDataSource, b return &rmds, true } -// RuleWebhookAction specifies the action to post to service when the rule condition is evaluated. The discriminator is -// always RuleWebhookAction in this case. +// RuleWebhookAction specifies the action to post to service when the rule condition is evaluated. The +// discriminator is always RuleWebhookAction in this case. type RuleWebhookAction struct { - // OdataType - Possible values include: 'OdataTypeRuleAction', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction' - OdataType OdataTypeBasicRuleAction `json:"odata.type,omitempty"` // ServiceURI - the service uri to Post the notification when the alert activates or resolves. ServiceURI *string `json:"serviceUri,omitempty"` // Properties - the dictionary of custom properties to include with the post operation. These data are appended to the webhook payload. - Properties *map[string]*string `json:"properties,omitempty"` + Properties map[string]*string `json:"properties"` + // OdataType - Possible values include: 'OdataTypeRuleAction', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction' + OdataType OdataTypeBasicRuleAction `json:"odata.type,omitempty"` } // MarshalJSON is the custom marshaler for RuleWebhookAction. func (rwa RuleWebhookAction) MarshalJSON() ([]byte, error) { rwa.OdataType = OdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction - type Alias RuleWebhookAction - return json.Marshal(&struct { - Alias - }{ - Alias: (Alias)(rwa), - }) + objectMap := make(map[string]interface{}) + if rwa.ServiceURI != nil { + objectMap["serviceUri"] = rwa.ServiceURI + } + if rwa.Properties != nil { + objectMap["properties"] = rwa.Properties + } + objectMap["odata.type"] = rwa.OdataType + return json.Marshal(objectMap) } // AsRuleEmailAction is the BasicRuleAction implementation for RuleWebhookAction. @@ -2312,10 +2615,6 @@ type SmsReceiver struct { // ThresholdRuleCondition a rule condition based on a metric crossing a threshold. type ThresholdRuleCondition struct { - // DataSource - the resource from which the rule collects its data. For this type dataSource will always be of type RuleMetricDataSource. - DataSource BasicRuleDataSource `json:"dataSource,omitempty"` - // OdataType - Possible values include: 'OdataTypeRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition' - OdataType OdataTypeBasicRuleCondition `json:"odata.type,omitempty"` // Operator - the operator used to compare the data and the threshold. Possible values include: 'ConditionOperatorGreaterThan', 'ConditionOperatorGreaterThanOrEqual', 'ConditionOperatorLessThan', 'ConditionOperatorLessThanOrEqual' Operator ConditionOperator `json:"operator,omitempty"` // Threshold - the threshold value that activates the alert. @@ -2324,17 +2623,27 @@ type ThresholdRuleCondition struct { WindowSize *string `json:"windowSize,omitempty"` // TimeAggregation - the time aggregation operator. How the data that are collected should be combined over time. The default value is the PrimaryAggregationType of the Metric. Possible values include: 'TimeAggregationOperatorAverage', 'TimeAggregationOperatorMinimum', 'TimeAggregationOperatorMaximum', 'TimeAggregationOperatorTotal', 'TimeAggregationOperatorLast' TimeAggregation TimeAggregationOperator `json:"timeAggregation,omitempty"` + // DataSource - the resource from which the rule collects its data. For this type dataSource will always be of type RuleMetricDataSource. + DataSource BasicRuleDataSource `json:"dataSource,omitempty"` + // OdataType - Possible values include: 'OdataTypeRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition' + OdataType OdataTypeBasicRuleCondition `json:"odata.type,omitempty"` } // MarshalJSON is the custom marshaler for ThresholdRuleCondition. func (trc ThresholdRuleCondition) MarshalJSON() ([]byte, error) { trc.OdataType = OdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition - type Alias ThresholdRuleCondition - return json.Marshal(&struct { - Alias - }{ - Alias: (Alias)(trc), - }) + objectMap := make(map[string]interface{}) + objectMap["operator"] = trc.Operator + if trc.Threshold != nil { + objectMap["threshold"] = trc.Threshold + } + if trc.WindowSize != nil { + objectMap["windowSize"] = trc.WindowSize + } + objectMap["timeAggregation"] = trc.TimeAggregation + objectMap["dataSource"] = trc.DataSource + objectMap["odata.type"] = trc.OdataType + return json.Marshal(objectMap) } // AsThresholdRuleCondition is the BasicRuleCondition implementation for ThresholdRuleCondition. @@ -2369,65 +2678,62 @@ func (trc *ThresholdRuleCondition) UnmarshalJSON(body []byte) error { if err != nil { return err } - var v *json.RawMessage - - v = m["operator"] - if v != nil { - var operator ConditionOperator - err = json.Unmarshal(*m["operator"], &operator) - if err != nil { - return err - } - trc.Operator = operator - } - - v = m["threshold"] - if v != nil { - var threshold float64 - err = json.Unmarshal(*m["threshold"], &threshold) - if err != nil { - return err - } - trc.Threshold = &threshold - } - - v = m["windowSize"] - if v != nil { - var windowSize string - err = json.Unmarshal(*m["windowSize"], &windowSize) - if err != nil { - return err + for k, v := range m { + switch k { + case "operator": + if v != nil { + var operator ConditionOperator + err = json.Unmarshal(*v, &operator) + if err != nil { + return err + } + trc.Operator = operator + } + case "threshold": + if v != nil { + var threshold float64 + err = json.Unmarshal(*v, &threshold) + if err != nil { + return err + } + trc.Threshold = &threshold + } + case "windowSize": + if v != nil { + var windowSize string + err = json.Unmarshal(*v, &windowSize) + if err != nil { + return err + } + trc.WindowSize = &windowSize + } + case "timeAggregation": + if v != nil { + var timeAggregation TimeAggregationOperator + err = json.Unmarshal(*v, &timeAggregation) + if err != nil { + return err + } + trc.TimeAggregation = timeAggregation + } + case "dataSource": + if v != nil { + dataSource, err := unmarshalBasicRuleDataSource(*v) + if err != nil { + return err + } + trc.DataSource = dataSource + } + case "odata.type": + if v != nil { + var odataType OdataTypeBasicRuleCondition + err = json.Unmarshal(*v, &odataType) + if err != nil { + return err + } + trc.OdataType = odataType + } } - trc.WindowSize = &windowSize - } - - v = m["timeAggregation"] - if v != nil { - var timeAggregation TimeAggregationOperator - err = json.Unmarshal(*m["timeAggregation"], &timeAggregation) - if err != nil { - return err - } - trc.TimeAggregation = timeAggregation - } - - v = m["dataSource"] - if v != nil { - dataSource, err := unmarshalBasicRuleDataSource(*m["dataSource"]) - if err != nil { - return err - } - trc.DataSource = dataSource - } - - v = m["odata.type"] - if v != nil { - var odatatype OdataTypeBasicRuleCondition - err = json.Unmarshal(*m["odata.type"], &odatatype) - if err != nil { - return err - } - trc.OdataType = odatatype } return nil @@ -2448,7 +2754,19 @@ type WebhookNotification struct { // ServiceURI - the service address to receive the notification. ServiceURI *string `json:"serviceUri,omitempty"` // Properties - a property bag of settings. This value can be empty. - Properties *map[string]*string `json:"properties,omitempty"` + Properties map[string]*string `json:"properties"` +} + +// MarshalJSON is the custom marshaler for WebhookNotification. +func (wn WebhookNotification) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if wn.ServiceURI != nil { + objectMap["serviceUri"] = wn.ServiceURI + } + if wn.Properties != nil { + objectMap["properties"] = wn.Properties + } + return json.Marshal(objectMap) } // WebhookReceiver a webhook receiver. diff --git a/services/monitor/mgmt/2017-05-01-preview/insights/version.go b/services/monitor/mgmt/2017-05-01-preview/insights/version.go index c33ff9d7cbc9..fdeb26fe1aec 100644 --- a/services/monitor/mgmt/2017-05-01-preview/insights/version.go +++ b/services/monitor/mgmt/2017-05-01-preview/insights/version.go @@ -1,7 +1,5 @@ package insights -import "github.com/Azure/azure-sdk-for-go/version" - // Copyright (c) Microsoft and contributors. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); @@ -21,10 +19,10 @@ import "github.com/Azure/azure-sdk-for-go/version" // UserAgent returns the UserAgent string to use when sending http.Requests. func UserAgent() string { - return "Azure-SDK-For-Go/" + version.Number + " insights/2017-05-01-preview" + return "Azure-SDK-For-Go/latest services" } // Version returns the semantic version (see http://semver.org) of the client. func Version() string { - return version.Number + return "latest" } diff --git a/services/monitor/mgmt/2018-03-01/insights/actiongroupsgroup.go b/services/monitor/mgmt/2018-03-01/insights/actiongroupsgroup.go new file mode 100644 index 000000000000..dbe8898ce258 --- /dev/null +++ b/services/monitor/mgmt/2018-03-01/insights/actiongroupsgroup.go @@ -0,0 +1,521 @@ +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" +) + +// ActionGroupsGroupClient is the monitor Management Client +type ActionGroupsGroupClient struct { + BaseClient +} + +// NewActionGroupsGroupClient creates an instance of the ActionGroupsGroupClient client. +func NewActionGroupsGroupClient(subscriptionID string) ActionGroupsGroupClient { + return NewActionGroupsGroupClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewActionGroupsGroupClientWithBaseURI creates an instance of the ActionGroupsGroupClient client. +func NewActionGroupsGroupClientWithBaseURI(baseURI string, subscriptionID string) ActionGroupsGroupClient { + return ActionGroupsGroupClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create a new action group or update an existing one. +// +// resourceGroupName is the name of the resource group. actionGroupName is the name of the action group. +// actionGroup is the action group to create or use for the update. +func (client ActionGroupsGroupClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, actionGroupName string, actionGroup ActionGroupResource) (result ActionGroupResource, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: actionGroup, + Constraints: []validation.Constraint{{Target: "actionGroup.ActionGroup", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "actionGroup.ActionGroup.GroupShortName", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "actionGroup.ActionGroup.GroupShortName", Name: validation.MaxLength, Rule: 15, Chain: nil}}}, + {Target: "actionGroup.ActionGroup.Enabled", Name: validation.Null, Rule: true, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewError("insights.ActionGroupsGroupClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, actionGroupName, actionGroup) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ActionGroupsGroupClient", "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.ActionGroupsGroupClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ActionGroupsGroupClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client ActionGroupsGroupClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, actionGroupName string, actionGroup ActionGroupResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "actionGroupName": autorest.Encode("path", actionGroupName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}", pathParameters), + autorest.WithJSON(actionGroup), + 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 ActionGroupsGroupClient) 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 ActionGroupsGroupClient) CreateOrUpdateResponder(resp *http.Response) (result ActionGroupResource, 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 an action group. +// +// resourceGroupName is the name of the resource group. actionGroupName is the name of the action group. +func (client ActionGroupsGroupClient) Delete(ctx context.Context, resourceGroupName string, actionGroupName string) (result autorest.Response, err error) { + req, err := client.DeletePreparer(ctx, resourceGroupName, actionGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ActionGroupsGroupClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "insights.ActionGroupsGroupClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ActionGroupsGroupClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ActionGroupsGroupClient) DeletePreparer(ctx context.Context, resourceGroupName string, actionGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "actionGroupName": autorest.Encode("path", actionGroupName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-03-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/actionGroups/{actionGroupName}", 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 ActionGroupsGroupClient) 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 ActionGroupsGroupClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// EnableReceiver enable a receiver in an action group. This changes the receiver's status from Disabled to Enabled. +// +// resourceGroupName is the name of the resource group. actionGroupName is the name of the action group. +// enableRequest is the receiver to re-enable. +func (client ActionGroupsGroupClient) EnableReceiver(ctx context.Context, resourceGroupName string, actionGroupName string, enableRequest EnableRequest) (result autorest.Response, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: enableRequest, + Constraints: []validation.Constraint{{Target: "enableRequest.ReceiverName", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ActionGroupsGroupClient", "EnableReceiver", err.Error()) + } + + req, err := client.EnableReceiverPreparer(ctx, resourceGroupName, actionGroupName, enableRequest) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ActionGroupsGroupClient", "EnableReceiver", nil, "Failure preparing request") + return + } + + resp, err := client.EnableReceiverSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "insights.ActionGroupsGroupClient", "EnableReceiver", resp, "Failure sending request") + return + } + + result, err = client.EnableReceiverResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ActionGroupsGroupClient", "EnableReceiver", resp, "Failure responding to request") + } + + return +} + +// EnableReceiverPreparer prepares the EnableReceiver request. +func (client ActionGroupsGroupClient) EnableReceiverPreparer(ctx context.Context, resourceGroupName string, actionGroupName string, enableRequest EnableRequest) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "actionGroupName": autorest.Encode("path", actionGroupName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}/subscribe", pathParameters), + autorest.WithJSON(enableRequest), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// EnableReceiverSender sends the EnableReceiver request. The method will close the +// http.Response Body if it receives an error. +func (client ActionGroupsGroupClient) EnableReceiverSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// EnableReceiverResponder handles the response to the EnableReceiver request. The method always +// closes the http.Response Body. +func (client ActionGroupsGroupClient) EnableReceiverResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusConflict), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get an action group. +// +// resourceGroupName is the name of the resource group. actionGroupName is the name of the action group. +func (client ActionGroupsGroupClient) Get(ctx context.Context, resourceGroupName string, actionGroupName string) (result ActionGroupResource, err error) { + req, err := client.GetPreparer(ctx, resourceGroupName, actionGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ActionGroupsGroupClient", "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.ActionGroupsGroupClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ActionGroupsGroupClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client ActionGroupsGroupClient) GetPreparer(ctx context.Context, resourceGroupName string, actionGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "actionGroupName": autorest.Encode("path", actionGroupName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-03-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/actionGroups/{actionGroupName}", 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 ActionGroupsGroupClient) 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 ActionGroupsGroupClient) GetResponder(resp *http.Response) (result ActionGroupResource, 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 a list of all action groups in a resource group. +// +// resourceGroupName is the name of the resource group. +func (client ActionGroupsGroupClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ActionGroupList, err error) { + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ActionGroupsGroupClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.ActionGroupsGroupClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ActionGroupsGroupClient", "ListByResourceGroup", resp, "Failure responding to request") + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client ActionGroupsGroupClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-03-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/actionGroups", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client ActionGroupsGroupClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client ActionGroupsGroupClient) ListByResourceGroupResponder(resp *http.Response) (result ActionGroupList, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListBySubscriptionID get a list of all action groups in a subscription. +func (client ActionGroupsGroupClient) ListBySubscriptionID(ctx context.Context) (result ActionGroupList, err error) { + req, err := client.ListBySubscriptionIDPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ActionGroupsGroupClient", "ListBySubscriptionID", nil, "Failure preparing request") + return + } + + resp, err := client.ListBySubscriptionIDSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.ActionGroupsGroupClient", "ListBySubscriptionID", resp, "Failure sending request") + return + } + + result, err = client.ListBySubscriptionIDResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ActionGroupsGroupClient", "ListBySubscriptionID", resp, "Failure responding to request") + } + + return +} + +// ListBySubscriptionIDPreparer prepares the ListBySubscriptionID request. +func (client ActionGroupsGroupClient) ListBySubscriptionIDPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/actionGroups", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListBySubscriptionIDSender sends the ListBySubscriptionID request. The method will close the +// http.Response Body if it receives an error. +func (client ActionGroupsGroupClient) ListBySubscriptionIDSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListBySubscriptionIDResponder handles the response to the ListBySubscriptionID request. The method always +// closes the http.Response Body. +func (client ActionGroupsGroupClient) ListBySubscriptionIDResponder(resp *http.Response) (result ActionGroupList, 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 an existing action group's tags. To update other fields use the CreateOrUpdate method. +// +// resourceGroupName is the name of the resource group. actionGroupName is the name of the action group. +// actionGroupPatch is parameters supplied to the operation. +func (client ActionGroupsGroupClient) Update(ctx context.Context, resourceGroupName string, actionGroupName string, actionGroupPatch ActionGroupPatchBody) (result ActionGroupResource, err error) { + req, err := client.UpdatePreparer(ctx, resourceGroupName, actionGroupName, actionGroupPatch) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ActionGroupsGroupClient", "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.ActionGroupsGroupClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ActionGroupsGroupClient", "Update", resp, "Failure responding to request") + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client ActionGroupsGroupClient) UpdatePreparer(ctx context.Context, resourceGroupName string, actionGroupName string, actionGroupPatch ActionGroupPatchBody) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "actionGroupName": autorest.Encode("path", actionGroupName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}", pathParameters), + autorest.WithJSON(actionGroupPatch), + 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 ActionGroupsGroupClient) 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 ActionGroupsGroupClient) UpdateResponder(resp *http.Response) (result ActionGroupResource, 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/monitor/mgmt/2018-03-01/insights/activitylogalertsgroup.go b/services/monitor/mgmt/2018-03-01/insights/activitylogalertsgroup.go new file mode 100644 index 000000000000..735fb3445519 --- /dev/null +++ b/services/monitor/mgmt/2018-03-01/insights/activitylogalertsgroup.go @@ -0,0 +1,448 @@ +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" +) + +// ActivityLogAlertsGroupClient is the monitor Management Client +type ActivityLogAlertsGroupClient struct { + BaseClient +} + +// NewActivityLogAlertsGroupClient creates an instance of the ActivityLogAlertsGroupClient client. +func NewActivityLogAlertsGroupClient(subscriptionID string) ActivityLogAlertsGroupClient { + return NewActivityLogAlertsGroupClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewActivityLogAlertsGroupClientWithBaseURI creates an instance of the ActivityLogAlertsGroupClient client. +func NewActivityLogAlertsGroupClientWithBaseURI(baseURI string, subscriptionID string) ActivityLogAlertsGroupClient { + return ActivityLogAlertsGroupClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create a new activity log alert or update an existing one. +// +// resourceGroupName is the name of the resource group. activityLogAlertName is the name of the activity log alert. +// activityLogAlert is the activity log alert to create or use for the update. +func (client ActivityLogAlertsGroupClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, activityLogAlertName string, activityLogAlert ActivityLogAlertResource) (result ActivityLogAlertResource, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: activityLogAlert, + Constraints: []validation.Constraint{{Target: "activityLogAlert.ActivityLogAlert", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "activityLogAlert.ActivityLogAlert.Scopes", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "activityLogAlert.ActivityLogAlert.Condition", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "activityLogAlert.ActivityLogAlert.Condition.AllOf", Name: validation.Null, Rule: true, Chain: nil}}}, + {Target: "activityLogAlert.ActivityLogAlert.Actions", Name: validation.Null, Rule: true, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewError("insights.ActivityLogAlertsGroupClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, activityLogAlertName, activityLogAlert) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsGroupClient", "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.ActivityLogAlertsGroupClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsGroupClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client ActivityLogAlertsGroupClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, activityLogAlertName string, activityLogAlert ActivityLogAlertResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "activityLogAlertName": autorest.Encode("path", activityLogAlertName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/activityLogAlerts/{activityLogAlertName}", pathParameters), + autorest.WithJSON(activityLogAlert), + 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 ActivityLogAlertsGroupClient) 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 ActivityLogAlertsGroupClient) CreateOrUpdateResponder(resp *http.Response) (result ActivityLogAlertResource, 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 an activity log alert. +// +// resourceGroupName is the name of the resource group. activityLogAlertName is the name of the activity log alert. +func (client ActivityLogAlertsGroupClient) Delete(ctx context.Context, resourceGroupName string, activityLogAlertName string) (result autorest.Response, err error) { + req, err := client.DeletePreparer(ctx, resourceGroupName, activityLogAlertName) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsGroupClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsGroupClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsGroupClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ActivityLogAlertsGroupClient) DeletePreparer(ctx context.Context, resourceGroupName string, activityLogAlertName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "activityLogAlertName": autorest.Encode("path", activityLogAlertName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-04-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/activityLogAlerts/{activityLogAlertName}", 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 ActivityLogAlertsGroupClient) 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 ActivityLogAlertsGroupClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get an activity log alert. +// +// resourceGroupName is the name of the resource group. activityLogAlertName is the name of the activity log alert. +func (client ActivityLogAlertsGroupClient) Get(ctx context.Context, resourceGroupName string, activityLogAlertName string) (result ActivityLogAlertResource, err error) { + req, err := client.GetPreparer(ctx, resourceGroupName, activityLogAlertName) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsGroupClient", "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.ActivityLogAlertsGroupClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsGroupClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client ActivityLogAlertsGroupClient) GetPreparer(ctx context.Context, resourceGroupName string, activityLogAlertName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "activityLogAlertName": autorest.Encode("path", activityLogAlertName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-04-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/activityLogAlerts/{activityLogAlertName}", 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 ActivityLogAlertsGroupClient) 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 ActivityLogAlertsGroupClient) GetResponder(resp *http.Response) (result ActivityLogAlertResource, 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 a list of all activity log alerts in a resource group. +// +// resourceGroupName is the name of the resource group. +func (client ActivityLogAlertsGroupClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ActivityLogAlertList, err error) { + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsGroupClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsGroupClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsGroupClient", "ListByResourceGroup", resp, "Failure responding to request") + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client ActivityLogAlertsGroupClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-04-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/activityLogAlerts", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client ActivityLogAlertsGroupClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client ActivityLogAlertsGroupClient) ListByResourceGroupResponder(resp *http.Response) (result ActivityLogAlertList, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListBySubscriptionID get a list of all activity log alerts in a subscription. +func (client ActivityLogAlertsGroupClient) ListBySubscriptionID(ctx context.Context) (result ActivityLogAlertList, err error) { + req, err := client.ListBySubscriptionIDPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsGroupClient", "ListBySubscriptionID", nil, "Failure preparing request") + return + } + + resp, err := client.ListBySubscriptionIDSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsGroupClient", "ListBySubscriptionID", resp, "Failure sending request") + return + } + + result, err = client.ListBySubscriptionIDResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsGroupClient", "ListBySubscriptionID", resp, "Failure responding to request") + } + + return +} + +// ListBySubscriptionIDPreparer prepares the ListBySubscriptionID request. +func (client ActivityLogAlertsGroupClient) ListBySubscriptionIDPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/activityLogAlerts", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListBySubscriptionIDSender sends the ListBySubscriptionID request. The method will close the +// http.Response Body if it receives an error. +func (client ActivityLogAlertsGroupClient) ListBySubscriptionIDSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListBySubscriptionIDResponder handles the response to the ListBySubscriptionID request. The method always +// closes the http.Response Body. +func (client ActivityLogAlertsGroupClient) ListBySubscriptionIDResponder(resp *http.Response) (result ActivityLogAlertList, 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 an existing ActivityLogAlertResource's tags. To update other fields use the CreateOrUpdate method. +// +// resourceGroupName is the name of the resource group. activityLogAlertName is the name of the activity log alert. +// activityLogAlertPatch is parameters supplied to the operation. +func (client ActivityLogAlertsGroupClient) Update(ctx context.Context, resourceGroupName string, activityLogAlertName string, activityLogAlertPatch ActivityLogAlertPatchBody) (result ActivityLogAlertResource, err error) { + req, err := client.UpdatePreparer(ctx, resourceGroupName, activityLogAlertName, activityLogAlertPatch) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsGroupClient", "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.ActivityLogAlertsGroupClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsGroupClient", "Update", resp, "Failure responding to request") + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client ActivityLogAlertsGroupClient) UpdatePreparer(ctx context.Context, resourceGroupName string, activityLogAlertName string, activityLogAlertPatch ActivityLogAlertPatchBody) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "activityLogAlertName": autorest.Encode("path", activityLogAlertName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/activityLogAlerts/{activityLogAlertName}", pathParameters), + autorest.WithJSON(activityLogAlertPatch), + 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 ActivityLogAlertsGroupClient) 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 ActivityLogAlertsGroupClient) UpdateResponder(resp *http.Response) (result ActivityLogAlertResource, 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/monitor/mgmt/2018-03-01/insights/activitylogs.go b/services/monitor/mgmt/2018-03-01/insights/activitylogs.go new file mode 100644 index 000000000000..9c77eca5114b --- /dev/null +++ b/services/monitor/mgmt/2018-03-01/insights/activitylogs.go @@ -0,0 +1,152 @@ +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" +) + +// ActivityLogsClient is the monitor Management Client +type ActivityLogsClient struct { + BaseClient +} + +// NewActivityLogsClient creates an instance of the ActivityLogsClient client. +func NewActivityLogsClient(subscriptionID string) ActivityLogsClient { + return NewActivityLogsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewActivityLogsClientWithBaseURI creates an instance of the ActivityLogsClient client. +func NewActivityLogsClientWithBaseURI(baseURI string, subscriptionID string) ActivityLogsClient { + return ActivityLogsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List provides the list of records from the activity logs. +// +// filter is reduces the set of data collected.
The **$filter** argument is very restricted and allows only the +// following patterns.
- *List events for a resource group*: $filter=eventTimestamp ge +// '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' and resourceGroupName eq +// 'resourceGroupName'.
- *List events for resource*: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' +// and eventTimestamp le '2014-07-20T04:36:37.6407898Z' and resourceUri eq 'resourceURI'.
- *List events for a +// subscription in a time range*: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le +// '2014-07-20T04:36:37.6407898Z'.
- *List events for a resource provider*: $filter=eventTimestamp ge +// '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' and resourceProvider eq +// 'resourceProviderName'.
- *List events for a correlation Id*: $filter=eventTimestamp ge +// '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' and correlationId eq +// 'correlationID'.

**NOTE**: No other syntax is allowed. selectParameter is used to fetch events with only +// the given properties.
The **$select** argument is a comma separated list of property names to be returned. +// Possible values are: *authorization*, *claims*, *correlationId*, *description*, *eventDataId*, *eventName*, +// *eventTimestamp*, *httpRequest*, *level*, *operationId*, *operationName*, *properties*, *resourceGroupName*, +// *resourceProviderName*, *resourceId*, *status*, *submissionTimestamp*, *subStatus*, *subscriptionId* +func (client ActivityLogsClient) List(ctx context.Context, filter string, selectParameter string) (result EventDataCollectionPage, err error) { + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, filter, selectParameter) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ActivityLogsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.edc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.ActivityLogsClient", "List", resp, "Failure sending request") + return + } + + result.edc, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ActivityLogsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client ActivityLogsClient) ListPreparer(ctx context.Context, filter string, selectParameter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if len(selectParameter) > 0 { + queryParameters["$select"] = autorest.Encode("query", selectParameter) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/eventtypes/management/values", 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 ActivityLogsClient) 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 ActivityLogsClient) ListResponder(resp *http.Response) (result EventDataCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client ActivityLogsClient) listNextResults(lastResults EventDataCollection) (result EventDataCollection, err error) { + req, err := lastResults.eventDataCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "insights.ActivityLogsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "insights.ActivityLogsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ActivityLogsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client ActivityLogsClient) ListComplete(ctx context.Context, filter string, selectParameter string) (result EventDataCollectionIterator, err error) { + result.page, err = client.List(ctx, filter, selectParameter) + return +} diff --git a/services/monitor/mgmt/2018-03-01/insights/alertruleincidentsgroup.go b/services/monitor/mgmt/2018-03-01/insights/alertruleincidentsgroup.go new file mode 100644 index 000000000000..c23ee46a13d1 --- /dev/null +++ b/services/monitor/mgmt/2018-03-01/insights/alertruleincidentsgroup.go @@ -0,0 +1,174 @@ +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" +) + +// AlertRuleIncidentsGroupClient is the monitor Management Client +type AlertRuleIncidentsGroupClient struct { + BaseClient +} + +// NewAlertRuleIncidentsGroupClient creates an instance of the AlertRuleIncidentsGroupClient client. +func NewAlertRuleIncidentsGroupClient(subscriptionID string) AlertRuleIncidentsGroupClient { + return NewAlertRuleIncidentsGroupClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewAlertRuleIncidentsGroupClientWithBaseURI creates an instance of the AlertRuleIncidentsGroupClient client. +func NewAlertRuleIncidentsGroupClientWithBaseURI(baseURI string, subscriptionID string) AlertRuleIncidentsGroupClient { + return AlertRuleIncidentsGroupClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get gets an incident associated to an alert rule +// +// resourceGroupName is the name of the resource group. ruleName is the name of the rule. incidentName is the name +// of the incident to retrieve. +func (client AlertRuleIncidentsGroupClient) Get(ctx context.Context, resourceGroupName string, ruleName string, incidentName string) (result Incident, err error) { + req, err := client.GetPreparer(ctx, resourceGroupName, ruleName, incidentName) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.AlertRuleIncidentsGroupClient", "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.AlertRuleIncidentsGroupClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.AlertRuleIncidentsGroupClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client AlertRuleIncidentsGroupClient) GetPreparer(ctx context.Context, resourceGroupName string, ruleName string, incidentName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "incidentName": autorest.Encode("path", incidentName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "ruleName": autorest.Encode("path", ruleName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-03-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/alertrules/{ruleName}/incidents/{incidentName}", 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 AlertRuleIncidentsGroupClient) 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 AlertRuleIncidentsGroupClient) GetResponder(resp *http.Response) (result Incident, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByAlertRule gets a list of incidents associated to an alert rule +// +// resourceGroupName is the name of the resource group. ruleName is the name of the rule. +func (client AlertRuleIncidentsGroupClient) ListByAlertRule(ctx context.Context, resourceGroupName string, ruleName string) (result IncidentListResult, err error) { + req, err := client.ListByAlertRulePreparer(ctx, resourceGroupName, ruleName) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.AlertRuleIncidentsGroupClient", "ListByAlertRule", nil, "Failure preparing request") + return + } + + resp, err := client.ListByAlertRuleSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.AlertRuleIncidentsGroupClient", "ListByAlertRule", resp, "Failure sending request") + return + } + + result, err = client.ListByAlertRuleResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.AlertRuleIncidentsGroupClient", "ListByAlertRule", resp, "Failure responding to request") + } + + return +} + +// ListByAlertRulePreparer prepares the ListByAlertRule request. +func (client AlertRuleIncidentsGroupClient) ListByAlertRulePreparer(ctx context.Context, resourceGroupName string, ruleName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "ruleName": autorest.Encode("path", ruleName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-03-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/alertrules/{ruleName}/incidents", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByAlertRuleSender sends the ListByAlertRule request. The method will close the +// http.Response Body if it receives an error. +func (client AlertRuleIncidentsGroupClient) ListByAlertRuleSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListByAlertRuleResponder handles the response to the ListByAlertRule request. The method always +// closes the http.Response Body. +func (client AlertRuleIncidentsGroupClient) ListByAlertRuleResponder(resp *http.Response) (result IncidentListResult, 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/monitor/mgmt/2018-03-01/insights/alertrulesgroup.go b/services/monitor/mgmt/2018-03-01/insights/alertrulesgroup.go new file mode 100644 index 000000000000..0e15a2eed728 --- /dev/null +++ b/services/monitor/mgmt/2018-03-01/insights/alertrulesgroup.go @@ -0,0 +1,385 @@ +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" +) + +// AlertRulesGroupClient is the monitor Management Client +type AlertRulesGroupClient struct { + BaseClient +} + +// NewAlertRulesGroupClient creates an instance of the AlertRulesGroupClient client. +func NewAlertRulesGroupClient(subscriptionID string) AlertRulesGroupClient { + return NewAlertRulesGroupClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewAlertRulesGroupClientWithBaseURI creates an instance of the AlertRulesGroupClient client. +func NewAlertRulesGroupClientWithBaseURI(baseURI string, subscriptionID string) AlertRulesGroupClient { + return AlertRulesGroupClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates an alert rule. +// +// resourceGroupName is the name of the resource group. ruleName is the name of the rule. parameters is the +// parameters of the rule to create or update. +func (client AlertRulesGroupClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, ruleName string, parameters AlertRuleResource) (result AlertRuleResource, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.AlertRule", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.AlertRule.Name", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.AlertRule.IsEnabled", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.AlertRule.Condition", Name: validation.Null, Rule: true, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewError("insights.AlertRulesGroupClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, ruleName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.AlertRulesGroupClient", "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.AlertRulesGroupClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.AlertRulesGroupClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client AlertRulesGroupClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, ruleName string, parameters AlertRuleResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "ruleName": autorest.Encode("path", ruleName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules/{ruleName}", pathParameters), + autorest.WithJSON(parameters), + 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 AlertRulesGroupClient) 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 AlertRulesGroupClient) CreateOrUpdateResponder(resp *http.Response) (result AlertRuleResource, 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 deletes an alert rule +// +// resourceGroupName is the name of the resource group. ruleName is the name of the rule. +func (client AlertRulesGroupClient) Delete(ctx context.Context, resourceGroupName string, ruleName string) (result autorest.Response, err error) { + req, err := client.DeletePreparer(ctx, resourceGroupName, ruleName) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.AlertRulesGroupClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "insights.AlertRulesGroupClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.AlertRulesGroupClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client AlertRulesGroupClient) DeletePreparer(ctx context.Context, resourceGroupName string, ruleName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "ruleName": autorest.Encode("path", ruleName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-03-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/alertrules/{ruleName}", 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 AlertRulesGroupClient) 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 AlertRulesGroupClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets an alert rule +// +// resourceGroupName is the name of the resource group. ruleName is the name of the rule. +func (client AlertRulesGroupClient) Get(ctx context.Context, resourceGroupName string, ruleName string) (result AlertRuleResource, err error) { + req, err := client.GetPreparer(ctx, resourceGroupName, ruleName) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.AlertRulesGroupClient", "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.AlertRulesGroupClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.AlertRulesGroupClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client AlertRulesGroupClient) GetPreparer(ctx context.Context, resourceGroupName string, ruleName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "ruleName": autorest.Encode("path", ruleName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-03-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/alertrules/{ruleName}", 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 AlertRulesGroupClient) 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 AlertRulesGroupClient) GetResponder(resp *http.Response) (result AlertRuleResource, 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 list the alert rules within a resource group. +// +// resourceGroupName is the name of the resource group. +func (client AlertRulesGroupClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result AlertRuleResourceCollection, err error) { + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.AlertRulesGroupClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.AlertRulesGroupClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.AlertRulesGroupClient", "ListByResourceGroup", resp, "Failure responding to request") + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client AlertRulesGroupClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-03-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/alertrules", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client AlertRulesGroupClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client AlertRulesGroupClient) ListByResourceGroupResponder(resp *http.Response) (result AlertRuleResourceCollection, 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 an existing AlertRuleResource. To update other fields use the CreateOrUpdate method. +// +// resourceGroupName is the name of the resource group. ruleName is the name of the rule. alertRulesResource is +// parameters supplied to the operation. +func (client AlertRulesGroupClient) Update(ctx context.Context, resourceGroupName string, ruleName string, alertRulesResource AlertRuleResourcePatch) (result AlertRuleResource, err error) { + req, err := client.UpdatePreparer(ctx, resourceGroupName, ruleName, alertRulesResource) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.AlertRulesGroupClient", "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.AlertRulesGroupClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.AlertRulesGroupClient", "Update", resp, "Failure responding to request") + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client AlertRulesGroupClient) UpdatePreparer(ctx context.Context, resourceGroupName string, ruleName string, alertRulesResource AlertRuleResourcePatch) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "ruleName": autorest.Encode("path", ruleName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules/{ruleName}", pathParameters), + autorest.WithJSON(alertRulesResource), + 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 AlertRulesGroupClient) 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 AlertRulesGroupClient) UpdateResponder(resp *http.Response) (result AlertRuleResource, 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 +} diff --git a/services/monitor/mgmt/2018-03-01/insights/autoscalesettingsgroup.go b/services/monitor/mgmt/2018-03-01/insights/autoscalesettingsgroup.go new file mode 100644 index 000000000000..9f8857e244ea --- /dev/null +++ b/services/monitor/mgmt/2018-03-01/insights/autoscalesettingsgroup.go @@ -0,0 +1,412 @@ +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" +) + +// AutoscaleSettingsGroupClient is the monitor Management Client +type AutoscaleSettingsGroupClient struct { + BaseClient +} + +// NewAutoscaleSettingsGroupClient creates an instance of the AutoscaleSettingsGroupClient client. +func NewAutoscaleSettingsGroupClient(subscriptionID string) AutoscaleSettingsGroupClient { + return NewAutoscaleSettingsGroupClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewAutoscaleSettingsGroupClientWithBaseURI creates an instance of the AutoscaleSettingsGroupClient client. +func NewAutoscaleSettingsGroupClientWithBaseURI(baseURI string, subscriptionID string) AutoscaleSettingsGroupClient { + return AutoscaleSettingsGroupClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates an autoscale setting. +// +// resourceGroupName is the name of the resource group. autoscaleSettingName is the autoscale setting name. +// parameters is parameters supplied to the operation. +func (client AutoscaleSettingsGroupClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, autoscaleSettingName string, parameters AutoscaleSettingResource) (result AutoscaleSettingResource, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.AutoscaleSetting", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.AutoscaleSetting.Profiles", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.AutoscaleSetting.Profiles", Name: validation.MaxItems, Rule: 20, Chain: nil}}}, + }}}}}); err != nil { + return result, validation.NewError("insights.AutoscaleSettingsGroupClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, autoscaleSettingName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsGroupClient", "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.AutoscaleSettingsGroupClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsGroupClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client AutoscaleSettingsGroupClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, autoscaleSettingName string, parameters AutoscaleSettingResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "autoscaleSettingName": autorest.Encode("path", autoscaleSettingName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/autoscalesettings/{autoscaleSettingName}", pathParameters), + autorest.WithJSON(parameters), + 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 AutoscaleSettingsGroupClient) 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 AutoscaleSettingsGroupClient) CreateOrUpdateResponder(resp *http.Response) (result AutoscaleSettingResource, 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 deletes and autoscale setting +// +// resourceGroupName is the name of the resource group. autoscaleSettingName is the autoscale setting name. +func (client AutoscaleSettingsGroupClient) Delete(ctx context.Context, resourceGroupName string, autoscaleSettingName string) (result autorest.Response, err error) { + req, err := client.DeletePreparer(ctx, resourceGroupName, autoscaleSettingName) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsGroupClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsGroupClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsGroupClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client AutoscaleSettingsGroupClient) DeletePreparer(ctx context.Context, resourceGroupName string, autoscaleSettingName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "autoscaleSettingName": autorest.Encode("path", autoscaleSettingName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-04-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/autoscalesettings/{autoscaleSettingName}", 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 AutoscaleSettingsGroupClient) 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 AutoscaleSettingsGroupClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets an autoscale setting +// +// resourceGroupName is the name of the resource group. autoscaleSettingName is the autoscale setting name. +func (client AutoscaleSettingsGroupClient) Get(ctx context.Context, resourceGroupName string, autoscaleSettingName string) (result AutoscaleSettingResource, err error) { + req, err := client.GetPreparer(ctx, resourceGroupName, autoscaleSettingName) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsGroupClient", "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.AutoscaleSettingsGroupClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsGroupClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client AutoscaleSettingsGroupClient) GetPreparer(ctx context.Context, resourceGroupName string, autoscaleSettingName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "autoscaleSettingName": autorest.Encode("path", autoscaleSettingName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-04-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/autoscalesettings/{autoscaleSettingName}", 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 AutoscaleSettingsGroupClient) 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 AutoscaleSettingsGroupClient) GetResponder(resp *http.Response) (result AutoscaleSettingResource, 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 lists the autoscale settings for a resource group +// +// resourceGroupName is the name of the resource group. +func (client AutoscaleSettingsGroupClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result AutoscaleSettingResourceCollectionPage, err error) { + result.fn = client.listByResourceGroupNextResults + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsGroupClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.asrc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsGroupClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.asrc, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsGroupClient", "ListByResourceGroup", resp, "Failure responding to request") + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client AutoscaleSettingsGroupClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-04-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/autoscalesettings", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client AutoscaleSettingsGroupClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client AutoscaleSettingsGroupClient) ListByResourceGroupResponder(resp *http.Response) (result AutoscaleSettingResourceCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByResourceGroupNextResults retrieves the next set of results, if any. +func (client AutoscaleSettingsGroupClient) listByResourceGroupNextResults(lastResults AutoscaleSettingResourceCollection) (result AutoscaleSettingResourceCollection, err error) { + req, err := lastResults.autoscaleSettingResourceCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "insights.AutoscaleSettingsGroupClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "insights.AutoscaleSettingsGroupClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsGroupClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client AutoscaleSettingsGroupClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result AutoscaleSettingResourceCollectionIterator, err error) { + result.page, err = client.ListByResourceGroup(ctx, resourceGroupName) + return +} + +// Update updates an existing AutoscaleSettingsResource. To update other fields use the CreateOrUpdate method. +// +// resourceGroupName is the name of the resource group. autoscaleSettingName is the autoscale setting name. +// autoscaleSettingResource is parameters supplied to the operation. +func (client AutoscaleSettingsGroupClient) Update(ctx context.Context, resourceGroupName string, autoscaleSettingName string, autoscaleSettingResource AutoscaleSettingResourcePatch) (result AutoscaleSettingResource, err error) { + req, err := client.UpdatePreparer(ctx, resourceGroupName, autoscaleSettingName, autoscaleSettingResource) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsGroupClient", "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.AutoscaleSettingsGroupClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsGroupClient", "Update", resp, "Failure responding to request") + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client AutoscaleSettingsGroupClient) UpdatePreparer(ctx context.Context, resourceGroupName string, autoscaleSettingName string, autoscaleSettingResource AutoscaleSettingResourcePatch) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "autoscaleSettingName": autorest.Encode("path", autoscaleSettingName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/autoscalesettings/{autoscaleSettingName}", pathParameters), + autorest.WithJSON(autoscaleSettingResource), + 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 AutoscaleSettingsGroupClient) 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 AutoscaleSettingsGroupClient) UpdateResponder(resp *http.Response) (result AutoscaleSettingResource, 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/monitor/mgmt/2018-03-01/insights/client.go b/services/monitor/mgmt/2018-03-01/insights/client.go new file mode 100644 index 000000000000..5ed388022a2b --- /dev/null +++ b/services/monitor/mgmt/2018-03-01/insights/client.go @@ -0,0 +1,51 @@ +// Package insights implements the Azure ARM Insights service API version . +// +// Monitor Management Client +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 ( + "github.com/Azure/go-autorest/autorest" +) + +const ( + // DefaultBaseURI is the default URI used for the service Insights + DefaultBaseURI = "https://management.azure.com" +) + +// BaseClient is the base client for Insights. +type BaseClient struct { + autorest.Client + BaseURI string + SubscriptionID string +} + +// New creates an instance of the BaseClient client. +func New(subscriptionID string) BaseClient { + return NewWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWithBaseURI creates an instance of the BaseClient client. +func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { + return BaseClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + SubscriptionID: subscriptionID, + } +} diff --git a/services/monitor/mgmt/2018-03-01/insights/diagnosticsettingscategorygroup.go b/services/monitor/mgmt/2018-03-01/insights/diagnosticsettingscategorygroup.go new file mode 100644 index 000000000000..60ccaff1a3ae --- /dev/null +++ b/services/monitor/mgmt/2018-03-01/insights/diagnosticsettingscategorygroup.go @@ -0,0 +1,170 @@ +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" +) + +// DiagnosticSettingsCategoryGroupClient is the monitor Management Client +type DiagnosticSettingsCategoryGroupClient struct { + BaseClient +} + +// NewDiagnosticSettingsCategoryGroupClient creates an instance of the DiagnosticSettingsCategoryGroupClient client. +func NewDiagnosticSettingsCategoryGroupClient(subscriptionID string) DiagnosticSettingsCategoryGroupClient { + return NewDiagnosticSettingsCategoryGroupClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewDiagnosticSettingsCategoryGroupClientWithBaseURI creates an instance of the DiagnosticSettingsCategoryGroupClient +// client. +func NewDiagnosticSettingsCategoryGroupClientWithBaseURI(baseURI string, subscriptionID string) DiagnosticSettingsCategoryGroupClient { + return DiagnosticSettingsCategoryGroupClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get gets the diagnostic settings category for the specified resource. +// +// resourceURI is the identifier of the resource. name is the name of the diagnostic setting. +func (client DiagnosticSettingsCategoryGroupClient) Get(ctx context.Context, resourceURI string, name string) (result DiagnosticSettingsCategoryResource, err error) { + req, err := client.GetPreparer(ctx, resourceURI, name) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsCategoryGroupClient", "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.DiagnosticSettingsCategoryGroupClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsCategoryGroupClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client DiagnosticSettingsCategoryGroupClient) GetPreparer(ctx context.Context, resourceURI string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceUri": resourceURI, + } + + const APIVersion = "2017-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/diagnosticSettingsCategories/{name}", 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 DiagnosticSettingsCategoryGroupClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client DiagnosticSettingsCategoryGroupClient) GetResponder(resp *http.Response) (result DiagnosticSettingsCategoryResource, 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 lists the diagnostic settings categories for the specified resource. +// +// resourceURI is the identifier of the resource. +func (client DiagnosticSettingsCategoryGroupClient) List(ctx context.Context, resourceURI string) (result DiagnosticSettingsCategoryResourceCollection, err error) { + req, err := client.ListPreparer(ctx, resourceURI) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsCategoryGroupClient", "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.DiagnosticSettingsCategoryGroupClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsCategoryGroupClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client DiagnosticSettingsCategoryGroupClient) ListPreparer(ctx context.Context, resourceURI string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceUri": resourceURI, + } + + const APIVersion = "2017-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/diagnosticSettingsCategories", 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 DiagnosticSettingsCategoryGroupClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client DiagnosticSettingsCategoryGroupClient) ListResponder(resp *http.Response) (result DiagnosticSettingsCategoryResourceCollection, 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/monitor/mgmt/2018-03-01/insights/diagnosticsettingsgroup.go b/services/monitor/mgmt/2018-03-01/insights/diagnosticsettingsgroup.go new file mode 100644 index 000000000000..fea23e6f5f26 --- /dev/null +++ b/services/monitor/mgmt/2018-03-01/insights/diagnosticsettingsgroup.go @@ -0,0 +1,301 @@ +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" +) + +// DiagnosticSettingsGroupClient is the monitor Management Client +type DiagnosticSettingsGroupClient struct { + BaseClient +} + +// NewDiagnosticSettingsGroupClient creates an instance of the DiagnosticSettingsGroupClient client. +func NewDiagnosticSettingsGroupClient(subscriptionID string) DiagnosticSettingsGroupClient { + return NewDiagnosticSettingsGroupClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewDiagnosticSettingsGroupClientWithBaseURI creates an instance of the DiagnosticSettingsGroupClient client. +func NewDiagnosticSettingsGroupClientWithBaseURI(baseURI string, subscriptionID string) DiagnosticSettingsGroupClient { + return DiagnosticSettingsGroupClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates diagnostic settings for the specified resource. +// +// resourceURI is the identifier of the resource. parameters is parameters supplied to the operation. name is the +// name of the diagnostic setting. +func (client DiagnosticSettingsGroupClient) CreateOrUpdate(ctx context.Context, resourceURI string, parameters DiagnosticSettingsResource, name string) (result DiagnosticSettingsResource, err error) { + req, err := client.CreateOrUpdatePreparer(ctx, resourceURI, parameters, name) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsGroupClient", "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.DiagnosticSettingsGroupClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsGroupClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client DiagnosticSettingsGroupClient) CreateOrUpdatePreparer(ctx context.Context, resourceURI string, parameters DiagnosticSettingsResource, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceUri": resourceURI, + } + + const APIVersion = "2017-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/diagnosticSettings/{name}", pathParameters), + autorest.WithJSON(parameters), + 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 DiagnosticSettingsGroupClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client DiagnosticSettingsGroupClient) CreateOrUpdateResponder(resp *http.Response) (result DiagnosticSettingsResource, 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 deletes existing diagnostic settings for the specified resource. +// +// resourceURI is the identifier of the resource. name is the name of the diagnostic setting. +func (client DiagnosticSettingsGroupClient) Delete(ctx context.Context, resourceURI string, name string) (result autorest.Response, err error) { + req, err := client.DeletePreparer(ctx, resourceURI, name) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsGroupClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsGroupClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsGroupClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client DiagnosticSettingsGroupClient) DeletePreparer(ctx context.Context, resourceURI string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceUri": resourceURI, + } + + const APIVersion = "2017-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/diagnosticSettings/{name}", 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 DiagnosticSettingsGroupClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client DiagnosticSettingsGroupClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets the active diagnostic settings for the specified resource. +// +// resourceURI is the identifier of the resource. name is the name of the diagnostic setting. +func (client DiagnosticSettingsGroupClient) Get(ctx context.Context, resourceURI string, name string) (result DiagnosticSettingsResource, err error) { + req, err := client.GetPreparer(ctx, resourceURI, name) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsGroupClient", "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.DiagnosticSettingsGroupClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsGroupClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client DiagnosticSettingsGroupClient) GetPreparer(ctx context.Context, resourceURI string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceUri": resourceURI, + } + + const APIVersion = "2017-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/diagnosticSettings/{name}", 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 DiagnosticSettingsGroupClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client DiagnosticSettingsGroupClient) GetResponder(resp *http.Response) (result DiagnosticSettingsResource, 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 the active diagnostic settings list for the specified resource. +// +// resourceURI is the identifier of the resource. +func (client DiagnosticSettingsGroupClient) List(ctx context.Context, resourceURI string) (result DiagnosticSettingsResourceCollection, err error) { + req, err := client.ListPreparer(ctx, resourceURI) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsGroupClient", "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.DiagnosticSettingsGroupClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsGroupClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client DiagnosticSettingsGroupClient) ListPreparer(ctx context.Context, resourceURI string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceUri": resourceURI, + } + + const APIVersion = "2017-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/diagnosticSettings", 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 DiagnosticSettingsGroupClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client DiagnosticSettingsGroupClient) ListResponder(resp *http.Response) (result DiagnosticSettingsResourceCollection, 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/monitor/mgmt/2018-03-01/insights/eventcategories.go b/services/monitor/mgmt/2018-03-01/insights/eventcategories.go new file mode 100644 index 000000000000..fe2200db92cf --- /dev/null +++ b/services/monitor/mgmt/2018-03-01/insights/eventcategories.go @@ -0,0 +1,99 @@ +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" +) + +// EventCategoriesClient is the monitor Management Client +type EventCategoriesClient struct { + BaseClient +} + +// NewEventCategoriesClient creates an instance of the EventCategoriesClient client. +func NewEventCategoriesClient(subscriptionID string) EventCategoriesClient { + return NewEventCategoriesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewEventCategoriesClientWithBaseURI creates an instance of the EventCategoriesClient client. +func NewEventCategoriesClientWithBaseURI(baseURI string, subscriptionID string) EventCategoriesClient { + return EventCategoriesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List get the list of available event categories supported in the Activity Logs Service.
The current list includes +// the following: Administrative, Security, ServiceHealth, Alert, Recommendation, Policy. +func (client EventCategoriesClient) List(ctx context.Context) (result EventCategoryCollection, err error) { + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.EventCategoriesClient", "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.EventCategoriesClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.EventCategoriesClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client EventCategoriesClient) ListPreparer(ctx context.Context) (*http.Request, error) { + const APIVersion = "2015-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/microsoft.insights/eventcategories"), + 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 EventCategoriesClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client EventCategoriesClient) ListResponder(resp *http.Response) (result EventCategoryCollection, 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/monitor/mgmt/2018-03-01/insights/logprofilesgroup.go b/services/monitor/mgmt/2018-03-01/insights/logprofilesgroup.go new file mode 100644 index 000000000000..f32eba6d3ab1 --- /dev/null +++ b/services/monitor/mgmt/2018-03-01/insights/logprofilesgroup.go @@ -0,0 +1,380 @@ +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" +) + +// LogProfilesGroupClient is the monitor Management Client +type LogProfilesGroupClient struct { + BaseClient +} + +// NewLogProfilesGroupClient creates an instance of the LogProfilesGroupClient client. +func NewLogProfilesGroupClient(subscriptionID string) LogProfilesGroupClient { + return NewLogProfilesGroupClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewLogProfilesGroupClientWithBaseURI creates an instance of the LogProfilesGroupClient client. +func NewLogProfilesGroupClientWithBaseURI(baseURI string, subscriptionID string) LogProfilesGroupClient { + return LogProfilesGroupClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create or update a log profile in Azure Monitoring REST API. +// +// logProfileName is the name of the log profile. parameters is parameters supplied to the operation. +func (client LogProfilesGroupClient) CreateOrUpdate(ctx context.Context, logProfileName string, parameters LogProfileResource) (result LogProfileResource, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.LogProfileProperties", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.LogProfileProperties.Locations", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.LogProfileProperties.Categories", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.LogProfileProperties.RetentionPolicy", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.LogProfileProperties.RetentionPolicy.Enabled", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.LogProfileProperties.RetentionPolicy.Days", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.LogProfileProperties.RetentionPolicy.Days", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}}}, + }}, + }}}}}); err != nil { + return result, validation.NewError("insights.LogProfilesGroupClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, logProfileName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.LogProfilesGroupClient", "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.LogProfilesGroupClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.LogProfilesGroupClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client LogProfilesGroupClient) CreateOrUpdatePreparer(ctx context.Context, logProfileName string, parameters LogProfileResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "logProfileName": autorest.Encode("path", logProfileName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/logprofiles/{logProfileName}", pathParameters), + autorest.WithJSON(parameters), + 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 LogProfilesGroupClient) 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 LogProfilesGroupClient) CreateOrUpdateResponder(resp *http.Response) (result LogProfileResource, 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 deletes the log profile. +// +// logProfileName is the name of the log profile. +func (client LogProfilesGroupClient) Delete(ctx context.Context, logProfileName string) (result autorest.Response, err error) { + req, err := client.DeletePreparer(ctx, logProfileName) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.LogProfilesGroupClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "insights.LogProfilesGroupClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.LogProfilesGroupClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client LogProfilesGroupClient) DeletePreparer(ctx context.Context, logProfileName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "logProfileName": autorest.Encode("path", logProfileName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/logprofiles/{logProfileName}", 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 LogProfilesGroupClient) 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 LogProfilesGroupClient) 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 the log profile. +// +// logProfileName is the name of the log profile. +func (client LogProfilesGroupClient) Get(ctx context.Context, logProfileName string) (result LogProfileResource, err error) { + req, err := client.GetPreparer(ctx, logProfileName) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.LogProfilesGroupClient", "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.LogProfilesGroupClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.LogProfilesGroupClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client LogProfilesGroupClient) GetPreparer(ctx context.Context, logProfileName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "logProfileName": autorest.Encode("path", logProfileName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/logprofiles/{logProfileName}", 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 LogProfilesGroupClient) 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 LogProfilesGroupClient) GetResponder(resp *http.Response) (result LogProfileResource, 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 list the log profiles. +func (client LogProfilesGroupClient) List(ctx context.Context) (result LogProfileCollection, err error) { + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.LogProfilesGroupClient", "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.LogProfilesGroupClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.LogProfilesGroupClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client LogProfilesGroupClient) ListPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/logprofiles", 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 LogProfilesGroupClient) 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 LogProfilesGroupClient) ListResponder(resp *http.Response) (result LogProfileCollection, 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 an existing LogProfilesResource. To update other fields use the CreateOrUpdate method. +// +// logProfileName is the name of the log profile. logProfilesResource is parameters supplied to the operation. +func (client LogProfilesGroupClient) Update(ctx context.Context, logProfileName string, logProfilesResource LogProfileResourcePatch) (result LogProfileResource, err error) { + req, err := client.UpdatePreparer(ctx, logProfileName, logProfilesResource) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.LogProfilesGroupClient", "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.LogProfilesGroupClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.LogProfilesGroupClient", "Update", resp, "Failure responding to request") + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client LogProfilesGroupClient) UpdatePreparer(ctx context.Context, logProfileName string, logProfilesResource LogProfileResourcePatch) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "logProfileName": autorest.Encode("path", logProfileName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/logprofiles/{logProfileName}", pathParameters), + autorest.WithJSON(logProfilesResource), + 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 LogProfilesGroupClient) 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 LogProfilesGroupClient) UpdateResponder(resp *http.Response) (result LogProfileResource, 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/monitor/mgmt/2018-03-01/insights/metricbaseline.go b/services/monitor/mgmt/2018-03-01/insights/metricbaseline.go new file mode 100644 index 000000000000..3e812be44903 --- /dev/null +++ b/services/monitor/mgmt/2018-03-01/insights/metricbaseline.go @@ -0,0 +1,206 @@ +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" +) + +// MetricBaselineClient is the monitor Management Client +type MetricBaselineClient struct { + BaseClient +} + +// NewMetricBaselineClient creates an instance of the MetricBaselineClient client. +func NewMetricBaselineClient(subscriptionID string) MetricBaselineClient { + return NewMetricBaselineClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewMetricBaselineClientWithBaseURI creates an instance of the MetricBaselineClient client. +func NewMetricBaselineClientWithBaseURI(baseURI string, subscriptionID string) MetricBaselineClient { + return MetricBaselineClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CalculateBaseline **Lists the baseline values for a resource**. +// +// resourceURI is the identifier of the resource. It has the following structure: +// subscriptions/{subscriptionName}/resourceGroups/{resourceGroupName}/providers/{providerName}/{resourceName}. For +// example: +// subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1 +// timeSeriesInformation is information that need to be specified to calculate a baseline on a time series. +func (client MetricBaselineClient) CalculateBaseline(ctx context.Context, resourceURI string, timeSeriesInformation TimeSeriesInformation) (result CalculateBaselineResponse, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: timeSeriesInformation, + Constraints: []validation.Constraint{{Target: "timeSeriesInformation.Sensitivities", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "timeSeriesInformation.Values", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.MetricBaselineClient", "CalculateBaseline", err.Error()) + } + + req, err := client.CalculateBaselinePreparer(ctx, resourceURI, timeSeriesInformation) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.MetricBaselineClient", "CalculateBaseline", nil, "Failure preparing request") + return + } + + resp, err := client.CalculateBaselineSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.MetricBaselineClient", "CalculateBaseline", resp, "Failure sending request") + return + } + + result, err = client.CalculateBaselineResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.MetricBaselineClient", "CalculateBaseline", resp, "Failure responding to request") + } + + return +} + +// CalculateBaselinePreparer prepares the CalculateBaseline request. +func (client MetricBaselineClient) CalculateBaselinePreparer(ctx context.Context, resourceURI string, timeSeriesInformation TimeSeriesInformation) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceUri": resourceURI, + } + + const APIVersion = "2017-11-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsJSON(), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/calculatebaseline", pathParameters), + autorest.WithJSON(timeSeriesInformation), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CalculateBaselineSender sends the CalculateBaseline request. The method will close the +// http.Response Body if it receives an error. +func (client MetricBaselineClient) CalculateBaselineSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// CalculateBaselineResponder handles the response to the CalculateBaseline request. The method always +// closes the http.Response Body. +func (client MetricBaselineClient) CalculateBaselineResponder(resp *http.Response) (result CalculateBaselineResponse, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Get **Gets the baseline values for a specific metric**. +// +// resourceURI is the identifier of the resource. It has the following structure: +// subscriptions/{subscriptionName}/resourceGroups/{resourceGroupName}/providers/{providerName}/{resourceName}. For +// example: +// subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1 +// metricName is the name of the metric to retrieve the baseline for. timespan is the timespan of the query. It is +// a string with the following format 'startDateTime_ISO/endDateTime_ISO'. interval is the interval (i.e. +// timegrain) of the query. aggregation is the aggregation type of the metric to retrieve the baseline for. +// sensitivities is the list of sensitivities (comma separated) to retrieve. resultType is allows retrieving only +// metadata of the baseline. On data request all information is retrieved. +func (client MetricBaselineClient) Get(ctx context.Context, resourceURI string, metricName string, timespan string, interval *string, aggregation string, sensitivities string, resultType ResultType) (result BaselineResponse, err error) { + req, err := client.GetPreparer(ctx, resourceURI, metricName, timespan, interval, aggregation, sensitivities, resultType) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.MetricBaselineClient", "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.MetricBaselineClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.MetricBaselineClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client MetricBaselineClient) GetPreparer(ctx context.Context, resourceURI string, metricName string, timespan string, interval *string, aggregation string, sensitivities string, resultType ResultType) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "metricName": autorest.Encode("path", metricName), + "resourceUri": resourceURI, + } + + const APIVersion = "2017-11-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(timespan) > 0 { + queryParameters["timespan"] = autorest.Encode("query", timespan) + } + if interval != nil { + queryParameters["interval"] = autorest.Encode("query", *interval) + } + if len(aggregation) > 0 { + queryParameters["aggregation"] = autorest.Encode("query", aggregation) + } + if len(sensitivities) > 0 { + queryParameters["sensitivities"] = autorest.Encode("query", sensitivities) + } + if len(string(resultType)) > 0 { + queryParameters["resultType"] = autorest.Encode("query", resultType) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/baseline/{metricName}", 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 MetricBaselineClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client MetricBaselineClient) GetResponder(resp *http.Response) (result BaselineResponse, 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/monitor/mgmt/2018-03-01/insights/metricdefinitions.go b/services/monitor/mgmt/2018-03-01/insights/metricdefinitions.go new file mode 100644 index 000000000000..bcb023ded893 --- /dev/null +++ b/services/monitor/mgmt/2018-03-01/insights/metricdefinitions.go @@ -0,0 +1,104 @@ +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" +) + +// MetricDefinitionsClient is the monitor Management Client +type MetricDefinitionsClient struct { + BaseClient +} + +// NewMetricDefinitionsClient creates an instance of the MetricDefinitionsClient client. +func NewMetricDefinitionsClient(subscriptionID string) MetricDefinitionsClient { + return NewMetricDefinitionsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewMetricDefinitionsClientWithBaseURI creates an instance of the MetricDefinitionsClient client. +func NewMetricDefinitionsClientWithBaseURI(baseURI string, subscriptionID string) MetricDefinitionsClient { + return MetricDefinitionsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List lists the metric definitions for the resource. +// +// resourceURI is the identifier of the resource. +func (client MetricDefinitionsClient) List(ctx context.Context, resourceURI string) (result MetricDefinitionCollection, err error) { + req, err := client.ListPreparer(ctx, resourceURI) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.MetricDefinitionsClient", "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.MetricDefinitionsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.MetricDefinitionsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client MetricDefinitionsClient) ListPreparer(ctx context.Context, resourceURI string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceUri": resourceURI, + } + + const APIVersion = "2017-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/metricDefinitions", 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 MetricDefinitionsClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client MetricDefinitionsClient) ListResponder(resp *http.Response) (result MetricDefinitionCollection, 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/monitor/mgmt/2018-03-01/insights/metrics.go b/services/monitor/mgmt/2018-03-01/insights/metrics.go new file mode 100644 index 000000000000..de5406300161 --- /dev/null +++ b/services/monitor/mgmt/2018-03-01/insights/metrics.go @@ -0,0 +1,142 @@ +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" +) + +// MetricsClient is the monitor Management Client +type MetricsClient struct { + BaseClient +} + +// NewMetricsClient creates an instance of the MetricsClient client. +func NewMetricsClient(subscriptionID string) MetricsClient { + return NewMetricsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewMetricsClientWithBaseURI creates an instance of the MetricsClient client. +func NewMetricsClientWithBaseURI(baseURI string, subscriptionID string) MetricsClient { + return MetricsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List **Lists the metric values for a resource**. +// +// resourceURI is the identifier of the resource. timespan is the timespan of the query. It is a string with the +// following format 'startDateTime_ISO/endDateTime_ISO'. interval is the interval (i.e. timegrain) of the query. +// metric is the name of the metric to retrieve. aggregation is the list of aggregation types (comma separated) to +// retrieve. top is the maximum number of records to retrieve. +// Valid only if $filter is specified. +// Defaults to 10. orderby is the aggregation to use for sorting results and the direction of the sort. +// Only one order can be specified. +// Examples: sum asc. filter is the **$filter** is used to reduce the set of metric data +// returned.
Example:
Metric contains metadata A, B and C.
- Return all time series of C where A = a1 and +// B = b1 or b2
**$filter=A eq ‘a1’ and B eq ‘b1’ or B eq ‘b2’ and C eq ‘*’**
- Invalid +// variant:
**$filter=A eq ‘a1’ and B eq ‘b1’ and C eq ‘*’ or B = ‘b2’**
This is invalid because the logical +// or operator cannot separate two different metadata names.
- Return all time series where A = a1, B = b1 and C +// = c1:
**$filter=A eq ‘a1’ and B eq ‘b1’ and C eq ‘c1’**
- Return all time series where A = +// a1
**$filter=A eq ‘a1’ and B eq ‘*’ and C eq ‘*’**. resultType is reduces the set of data collected. The +// syntax allowed depends on the operation. See the operation's description for details. +func (client MetricsClient) List(ctx context.Context, resourceURI string, timespan string, interval *string, metric string, aggregation string, top *float64, orderby string, filter string, resultType ResultType) (result Response, err error) { + req, err := client.ListPreparer(ctx, resourceURI, timespan, interval, metric, aggregation, top, orderby, filter, resultType) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.MetricsClient", "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.MetricsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.MetricsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client MetricsClient) ListPreparer(ctx context.Context, resourceURI string, timespan string, interval *string, metric string, aggregation string, top *float64, orderby string, filter string, resultType ResultType) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceUri": resourceURI, + } + + const APIVersion = "2017-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(timespan) > 0 { + queryParameters["timespan"] = autorest.Encode("query", timespan) + } + if interval != nil { + queryParameters["interval"] = autorest.Encode("query", *interval) + } + if len(metric) > 0 { + queryParameters["metric"] = autorest.Encode("query", metric) + } + if len(aggregation) > 0 { + queryParameters["aggregation"] = autorest.Encode("query", aggregation) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if len(orderby) > 0 { + queryParameters["$orderby"] = autorest.Encode("query", orderby) + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if len(string(resultType)) > 0 { + queryParameters["resultType"] = autorest.Encode("query", resultType) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/metrics", 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 MetricsClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client MetricsClient) ListResponder(resp *http.Response) (result Response, 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/monitor/mgmt/2018-03-01/insights/models.go b/services/monitor/mgmt/2018-03-01/insights/models.go new file mode 100644 index 000000000000..aa19775bbf7a --- /dev/null +++ b/services/monitor/mgmt/2018-03-01/insights/models.go @@ -0,0 +1,3389 @@ +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 ( + "encoding/json" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/date" + "github.com/Azure/go-autorest/autorest/to" + "net/http" +) + +// AggregationType enumerates the values for aggregation type. +type AggregationType string + +const ( + // Average ... + Average AggregationType = "Average" + // Count ... + Count AggregationType = "Count" + // Maximum ... + Maximum AggregationType = "Maximum" + // Minimum ... + Minimum AggregationType = "Minimum" + // None ... + None AggregationType = "None" + // Total ... + Total AggregationType = "Total" +) + +// PossibleAggregationTypeValues returns an array of possible values for the AggregationType const type. +func PossibleAggregationTypeValues() [6]AggregationType { + return [6]AggregationType{Average, Count, Maximum, Minimum, None, Total} +} + +// CategoryType enumerates the values for category type. +type CategoryType string + +const ( + // Logs ... + Logs CategoryType = "Logs" + // Metrics ... + Metrics CategoryType = "Metrics" +) + +// PossibleCategoryTypeValues returns an array of possible values for the CategoryType const type. +func PossibleCategoryTypeValues() [2]CategoryType { + return [2]CategoryType{Logs, Metrics} +} + +// ComparisonOperationType enumerates the values for comparison operation type. +type ComparisonOperationType string + +const ( + // Equals ... + Equals ComparisonOperationType = "Equals" + // GreaterThan ... + GreaterThan ComparisonOperationType = "GreaterThan" + // GreaterThanOrEqual ... + GreaterThanOrEqual ComparisonOperationType = "GreaterThanOrEqual" + // LessThan ... + LessThan ComparisonOperationType = "LessThan" + // LessThanOrEqual ... + LessThanOrEqual ComparisonOperationType = "LessThanOrEqual" + // NotEquals ... + NotEquals ComparisonOperationType = "NotEquals" +) + +// PossibleComparisonOperationTypeValues returns an array of possible values for the ComparisonOperationType const type. +func PossibleComparisonOperationTypeValues() [6]ComparisonOperationType { + return [6]ComparisonOperationType{Equals, GreaterThan, GreaterThanOrEqual, LessThan, LessThanOrEqual, NotEquals} +} + +// ConditionOperator enumerates the values for condition operator. +type ConditionOperator string + +const ( + // ConditionOperatorGreaterThan ... + ConditionOperatorGreaterThan ConditionOperator = "GreaterThan" + // ConditionOperatorGreaterThanOrEqual ... + ConditionOperatorGreaterThanOrEqual ConditionOperator = "GreaterThanOrEqual" + // ConditionOperatorLessThan ... + ConditionOperatorLessThan ConditionOperator = "LessThan" + // ConditionOperatorLessThanOrEqual ... + ConditionOperatorLessThanOrEqual ConditionOperator = "LessThanOrEqual" +) + +// PossibleConditionOperatorValues returns an array of possible values for the ConditionOperator const type. +func PossibleConditionOperatorValues() [4]ConditionOperator { + return [4]ConditionOperator{ConditionOperatorGreaterThan, ConditionOperatorGreaterThanOrEqual, ConditionOperatorLessThan, ConditionOperatorLessThanOrEqual} +} + +// EventLevel enumerates the values for event level. +type EventLevel string + +const ( + // Critical ... + Critical EventLevel = "Critical" + // Error ... + Error EventLevel = "Error" + // Informational ... + Informational EventLevel = "Informational" + // Verbose ... + Verbose EventLevel = "Verbose" + // Warning ... + Warning EventLevel = "Warning" +) + +// PossibleEventLevelValues returns an array of possible values for the EventLevel const type. +func PossibleEventLevelValues() [5]EventLevel { + return [5]EventLevel{Critical, Error, Informational, Verbose, Warning} +} + +// MetricStatisticType enumerates the values for metric statistic type. +type MetricStatisticType string + +const ( + // MetricStatisticTypeAverage ... + MetricStatisticTypeAverage MetricStatisticType = "Average" + // MetricStatisticTypeMax ... + MetricStatisticTypeMax MetricStatisticType = "Max" + // MetricStatisticTypeMin ... + MetricStatisticTypeMin MetricStatisticType = "Min" + // MetricStatisticTypeSum ... + MetricStatisticTypeSum MetricStatisticType = "Sum" +) + +// PossibleMetricStatisticTypeValues returns an array of possible values for the MetricStatisticType const type. +func PossibleMetricStatisticTypeValues() [4]MetricStatisticType { + return [4]MetricStatisticType{MetricStatisticTypeAverage, MetricStatisticTypeMax, MetricStatisticTypeMin, MetricStatisticTypeSum} +} + +// OdataType enumerates the values for odata type. +type OdataType string + +const ( + // OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource ... + OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource OdataType = "Microsoft.Azure.Management.Insights.Models.RuleManagementEventDataSource" + // OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource ... + OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource OdataType = "Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource" + // OdataTypeRuleDataSource ... + OdataTypeRuleDataSource OdataType = "RuleDataSource" +) + +// PossibleOdataTypeValues returns an array of possible values for the OdataType const type. +func PossibleOdataTypeValues() [3]OdataType { + return [3]OdataType{OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource, OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource, OdataTypeRuleDataSource} +} + +// OdataTypeBasicRuleAction enumerates the values for odata type basic rule action. +type OdataTypeBasicRuleAction string + +const ( + // OdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction ... + OdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction OdataTypeBasicRuleAction = "Microsoft.Azure.Management.Insights.Models.RuleEmailAction" + // OdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction ... + OdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction OdataTypeBasicRuleAction = "Microsoft.Azure.Management.Insights.Models.RuleWebhookAction" + // OdataTypeRuleAction ... + OdataTypeRuleAction OdataTypeBasicRuleAction = "RuleAction" +) + +// PossibleOdataTypeBasicRuleActionValues returns an array of possible values for the OdataTypeBasicRuleAction const type. +func PossibleOdataTypeBasicRuleActionValues() [3]OdataTypeBasicRuleAction { + return [3]OdataTypeBasicRuleAction{OdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction, OdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction, OdataTypeRuleAction} +} + +// OdataTypeBasicRuleCondition enumerates the values for odata type basic rule condition. +type OdataTypeBasicRuleCondition string + +const ( + // OdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition ... + OdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition OdataTypeBasicRuleCondition = "Microsoft.Azure.Management.Insights.Models.LocationThresholdRuleCondition" + // OdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition ... + OdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition OdataTypeBasicRuleCondition = "Microsoft.Azure.Management.Insights.Models.ManagementEventRuleCondition" + // OdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition ... + OdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition OdataTypeBasicRuleCondition = "Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition" + // OdataTypeRuleCondition ... + OdataTypeRuleCondition OdataTypeBasicRuleCondition = "RuleCondition" +) + +// PossibleOdataTypeBasicRuleConditionValues returns an array of possible values for the OdataTypeBasicRuleCondition const type. +func PossibleOdataTypeBasicRuleConditionValues() [4]OdataTypeBasicRuleCondition { + return [4]OdataTypeBasicRuleCondition{OdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition, OdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition, OdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition, OdataTypeRuleCondition} +} + +// ReceiverStatus enumerates the values for receiver status. +type ReceiverStatus string + +const ( + // Disabled ... + Disabled ReceiverStatus = "Disabled" + // Enabled ... + Enabled ReceiverStatus = "Enabled" + // NotSpecified ... + NotSpecified ReceiverStatus = "NotSpecified" +) + +// PossibleReceiverStatusValues returns an array of possible values for the ReceiverStatus const type. +func PossibleReceiverStatusValues() [3]ReceiverStatus { + return [3]ReceiverStatus{Disabled, Enabled, NotSpecified} +} + +// RecurrenceFrequency enumerates the values for recurrence frequency. +type RecurrenceFrequency string + +const ( + // RecurrenceFrequencyDay ... + RecurrenceFrequencyDay RecurrenceFrequency = "Day" + // RecurrenceFrequencyHour ... + RecurrenceFrequencyHour RecurrenceFrequency = "Hour" + // RecurrenceFrequencyMinute ... + RecurrenceFrequencyMinute RecurrenceFrequency = "Minute" + // RecurrenceFrequencyMonth ... + RecurrenceFrequencyMonth RecurrenceFrequency = "Month" + // RecurrenceFrequencyNone ... + RecurrenceFrequencyNone RecurrenceFrequency = "None" + // RecurrenceFrequencySecond ... + RecurrenceFrequencySecond RecurrenceFrequency = "Second" + // RecurrenceFrequencyWeek ... + RecurrenceFrequencyWeek RecurrenceFrequency = "Week" + // RecurrenceFrequencyYear ... + RecurrenceFrequencyYear RecurrenceFrequency = "Year" +) + +// PossibleRecurrenceFrequencyValues returns an array of possible values for the RecurrenceFrequency const type. +func PossibleRecurrenceFrequencyValues() [8]RecurrenceFrequency { + return [8]RecurrenceFrequency{RecurrenceFrequencyDay, RecurrenceFrequencyHour, RecurrenceFrequencyMinute, RecurrenceFrequencyMonth, RecurrenceFrequencyNone, RecurrenceFrequencySecond, RecurrenceFrequencyWeek, RecurrenceFrequencyYear} +} + +// ResultType enumerates the values for result type. +type ResultType string + +const ( + // Data ... + Data ResultType = "Data" + // Metadata ... + Metadata ResultType = "Metadata" +) + +// PossibleResultTypeValues returns an array of possible values for the ResultType const type. +func PossibleResultTypeValues() [2]ResultType { + return [2]ResultType{Data, Metadata} +} + +// ScaleDirection enumerates the values for scale direction. +type ScaleDirection string + +const ( + // ScaleDirectionDecrease ... + ScaleDirectionDecrease ScaleDirection = "Decrease" + // ScaleDirectionIncrease ... + ScaleDirectionIncrease ScaleDirection = "Increase" + // ScaleDirectionNone ... + ScaleDirectionNone ScaleDirection = "None" +) + +// PossibleScaleDirectionValues returns an array of possible values for the ScaleDirection const type. +func PossibleScaleDirectionValues() [3]ScaleDirection { + return [3]ScaleDirection{ScaleDirectionDecrease, ScaleDirectionIncrease, ScaleDirectionNone} +} + +// ScaleType enumerates the values for scale type. +type ScaleType string + +const ( + // ChangeCount ... + ChangeCount ScaleType = "ChangeCount" + // ExactCount ... + ExactCount ScaleType = "ExactCount" + // PercentChangeCount ... + PercentChangeCount ScaleType = "PercentChangeCount" +) + +// PossibleScaleTypeValues returns an array of possible values for the ScaleType const type. +func PossibleScaleTypeValues() [3]ScaleType { + return [3]ScaleType{ChangeCount, ExactCount, PercentChangeCount} +} + +// Sensitivity enumerates the values for sensitivity. +type Sensitivity string + +const ( + // High ... + High Sensitivity = "High" + // Low ... + Low Sensitivity = "Low" + // Medium ... + Medium Sensitivity = "Medium" +) + +// PossibleSensitivityValues returns an array of possible values for the Sensitivity const type. +func PossibleSensitivityValues() [3]Sensitivity { + return [3]Sensitivity{High, Low, Medium} +} + +// TimeAggregationOperator enumerates the values for time aggregation operator. +type TimeAggregationOperator string + +const ( + // TimeAggregationOperatorAverage ... + TimeAggregationOperatorAverage TimeAggregationOperator = "Average" + // TimeAggregationOperatorLast ... + TimeAggregationOperatorLast TimeAggregationOperator = "Last" + // TimeAggregationOperatorMaximum ... + TimeAggregationOperatorMaximum TimeAggregationOperator = "Maximum" + // TimeAggregationOperatorMinimum ... + TimeAggregationOperatorMinimum TimeAggregationOperator = "Minimum" + // TimeAggregationOperatorTotal ... + TimeAggregationOperatorTotal TimeAggregationOperator = "Total" +) + +// PossibleTimeAggregationOperatorValues returns an array of possible values for the TimeAggregationOperator const type. +func PossibleTimeAggregationOperatorValues() [5]TimeAggregationOperator { + return [5]TimeAggregationOperator{TimeAggregationOperatorAverage, TimeAggregationOperatorLast, TimeAggregationOperatorMaximum, TimeAggregationOperatorMinimum, TimeAggregationOperatorTotal} +} + +// TimeAggregationType enumerates the values for time aggregation type. +type TimeAggregationType string + +const ( + // TimeAggregationTypeAverage ... + TimeAggregationTypeAverage TimeAggregationType = "Average" + // TimeAggregationTypeCount ... + TimeAggregationTypeCount TimeAggregationType = "Count" + // TimeAggregationTypeMaximum ... + TimeAggregationTypeMaximum TimeAggregationType = "Maximum" + // TimeAggregationTypeMinimum ... + TimeAggregationTypeMinimum TimeAggregationType = "Minimum" + // TimeAggregationTypeTotal ... + TimeAggregationTypeTotal TimeAggregationType = "Total" +) + +// PossibleTimeAggregationTypeValues returns an array of possible values for the TimeAggregationType const type. +func PossibleTimeAggregationTypeValues() [5]TimeAggregationType { + return [5]TimeAggregationType{TimeAggregationTypeAverage, TimeAggregationTypeCount, TimeAggregationTypeMaximum, TimeAggregationTypeMinimum, TimeAggregationTypeTotal} +} + +// Unit enumerates the values for unit. +type Unit string + +const ( + // UnitBytes ... + UnitBytes Unit = "Bytes" + // UnitByteSeconds ... + UnitByteSeconds Unit = "ByteSeconds" + // UnitBytesPerSecond ... + UnitBytesPerSecond Unit = "BytesPerSecond" + // UnitCount ... + UnitCount Unit = "Count" + // UnitCountPerSecond ... + UnitCountPerSecond Unit = "CountPerSecond" + // UnitMilliSeconds ... + UnitMilliSeconds Unit = "MilliSeconds" + // UnitPercent ... + UnitPercent Unit = "Percent" + // UnitSeconds ... + UnitSeconds Unit = "Seconds" + // UnitUnspecified ... + UnitUnspecified Unit = "Unspecified" +) + +// PossibleUnitValues returns an array of possible values for the Unit const type. +func PossibleUnitValues() [9]Unit { + return [9]Unit{UnitBytes, UnitByteSeconds, UnitBytesPerSecond, UnitCount, UnitCountPerSecond, UnitMilliSeconds, UnitPercent, UnitSeconds, UnitUnspecified} +} + +// ActionGroup an Azure action group. +type ActionGroup struct { + // GroupShortName - The short name of the action group. This will be used in SMS messages. + GroupShortName *string `json:"groupShortName,omitempty"` + // Enabled - Indicates whether this action group is enabled. If an action group is not enabled, then none of its receivers will receive communications. + Enabled *bool `json:"enabled,omitempty"` + // EmailReceivers - The list of email receivers that are part of this action group. + EmailReceivers *[]EmailReceiver `json:"emailReceivers,omitempty"` + // SmsReceivers - The list of SMS receivers that are part of this action group. + SmsReceivers *[]SmsReceiver `json:"smsReceivers,omitempty"` + // WebhookReceivers - The list of webhook receivers that are part of this action group. + WebhookReceivers *[]WebhookReceiver `json:"webhookReceivers,omitempty"` + // ItsmReceivers - The list of ITSM receivers that are part of this action group. + ItsmReceivers *[]ItsmReceiver `json:"itsmReceivers,omitempty"` + // AzureAppPushReceivers - The list of AzureAppPush receivers that are part of this action group. + AzureAppPushReceivers *[]AzureAppPushReceiver `json:"azureAppPushReceivers,omitempty"` + // AutomationRunbookReceivers - The list of AutomationRunbook receivers that are part of this action group. + AutomationRunbookReceivers *[]AutomationRunbookReceiver `json:"automationRunbookReceivers,omitempty"` + // VoiceReceivers - The list of voice receivers that are part of this action group. + VoiceReceivers *[]VoiceReceiver `json:"voiceReceivers,omitempty"` + // LogicAppReceivers - The list of logic app receivers that are part of this action group. + LogicAppReceivers *[]LogicAppReceiver `json:"logicAppReceivers,omitempty"` +} + +// ActionGroupList a list of action groups. +type ActionGroupList struct { + autorest.Response `json:"-"` + // Value - The list of action groups. + Value *[]ActionGroupResource `json:"value,omitempty"` + // NextLink - Provides the link to retrieve the next set of elements. + NextLink *string `json:"nextLink,omitempty"` +} + +// ActionGroupPatch an Azure action group for patch operations. +type ActionGroupPatch struct { + // Enabled - Indicates whether this action group is enabled. If an action group is not enabled, then none of its actions will be activated. + Enabled *bool `json:"enabled,omitempty"` +} + +// ActionGroupPatchBody an action group object for the body of patch operations. +type ActionGroupPatchBody struct { + // Tags - Resource tags + Tags map[string]*string `json:"tags"` + // ActionGroupPatch - The action group settings for an update operation. + *ActionGroupPatch `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for ActionGroupPatchBody. +func (agpb ActionGroupPatchBody) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if agpb.Tags != nil { + objectMap["tags"] = agpb.Tags + } + if agpb.ActionGroupPatch != nil { + objectMap["properties"] = agpb.ActionGroupPatch + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ActionGroupPatchBody struct. +func (agpb *ActionGroupPatchBody) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + agpb.Tags = tags + } + case "properties": + if v != nil { + var actionGroupPatch ActionGroupPatch + err = json.Unmarshal(*v, &actionGroupPatch) + if err != nil { + return err + } + agpb.ActionGroupPatch = &actionGroupPatch + } + } + } + + return nil +} + +// ActionGroupResource an action group resource. +type ActionGroupResource struct { + autorest.Response `json:"-"` + // ActionGroup - The action groups properties of the resource. + *ActionGroup `json:"properties,omitempty"` + // ID - Azure resource Id + ID *string `json:"id,omitempty"` + // Name - Azure resource name + Name *string `json:"name,omitempty"` + // Type - Azure resource type + Type *string `json:"type,omitempty"` + // Location - Resource location + Location *string `json:"location,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for ActionGroupResource. +func (agr ActionGroupResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if agr.ActionGroup != nil { + objectMap["properties"] = agr.ActionGroup + } + if agr.ID != nil { + objectMap["id"] = agr.ID + } + if agr.Name != nil { + objectMap["name"] = agr.Name + } + if agr.Type != nil { + objectMap["type"] = agr.Type + } + if agr.Location != nil { + objectMap["location"] = agr.Location + } + if agr.Tags != nil { + objectMap["tags"] = agr.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ActionGroupResource struct. +func (agr *ActionGroupResource) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var actionGroup ActionGroup + err = json.Unmarshal(*v, &actionGroup) + if err != nil { + return err + } + agr.ActionGroup = &actionGroup + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + agr.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + agr.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + agr.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + agr.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + agr.Tags = tags + } + } + } + + return nil +} + +// ActivityLogAlert an Azure activity log alert. +type ActivityLogAlert struct { + // Scopes - A list of resourceIds that will be used as prefixes. The alert will only apply to activityLogs with resourceIds that fall under one of these prefixes. This list must include at least one item. + Scopes *[]string `json:"scopes,omitempty"` + // Enabled - Indicates whether this activity log alert is enabled. If an activity log alert is not enabled, then none of its actions will be activated. + Enabled *bool `json:"enabled,omitempty"` + // Condition - The condition that will cause this alert to activate. + Condition *ActivityLogAlertAllOfCondition `json:"condition,omitempty"` + // Actions - The actions that will activate when the condition is met. + Actions *ActivityLogAlertActionList `json:"actions,omitempty"` + // Description - A description of this activity log alert. + Description *string `json:"description,omitempty"` +} + +// ActivityLogAlertActionGroup a pointer to an Azure Action Group. +type ActivityLogAlertActionGroup struct { + // ActionGroupID - The resourceId of the action group. This cannot be null or empty. + ActionGroupID *string `json:"actionGroupId,omitempty"` + // WebhookProperties - the dictionary of custom properties to include with the post operation. These data are appended to the webhook payload. + WebhookProperties map[string]*string `json:"webhookProperties"` +} + +// MarshalJSON is the custom marshaler for ActivityLogAlertActionGroup. +func (alaag ActivityLogAlertActionGroup) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if alaag.ActionGroupID != nil { + objectMap["actionGroupId"] = alaag.ActionGroupID + } + if alaag.WebhookProperties != nil { + objectMap["webhookProperties"] = alaag.WebhookProperties + } + return json.Marshal(objectMap) +} + +// ActivityLogAlertActionList a list of activity log alert actions. +type ActivityLogAlertActionList struct { + // ActionGroups - The list of activity log alerts. + ActionGroups *[]ActivityLogAlertActionGroup `json:"actionGroups,omitempty"` +} + +// ActivityLogAlertAllOfCondition an Activity Log alert condition that is met when all its member conditions are +// met. +type ActivityLogAlertAllOfCondition struct { + // AllOf - The list of activity log alert conditions. + AllOf *[]ActivityLogAlertLeafCondition `json:"allOf,omitempty"` +} + +// ActivityLogAlertLeafCondition an Activity Log alert condition that is met by comparing an activity log field and +// value. +type ActivityLogAlertLeafCondition struct { + // Field - The name of the field that this condition will examine. The possible values for this field are (case-insensitive): 'resourceId', 'category', 'caller', 'level', 'operationName', 'resourceGroup', 'resourceProvider', 'status', 'subStatus', 'resourceType', or anything beginning with 'properties.'. + Field *string `json:"field,omitempty"` + // Equals - The field value will be compared to this value (case-insensitive) to determine if the condition is met. + Equals *string `json:"equals,omitempty"` +} + +// ActivityLogAlertList a list of activity log alerts. +type ActivityLogAlertList struct { + autorest.Response `json:"-"` + // Value - The list of activity log alerts. + Value *[]ActivityLogAlertResource `json:"value,omitempty"` + // NextLink - Provides the link to retrieve the next set of elements. + NextLink *string `json:"nextLink,omitempty"` +} + +// ActivityLogAlertPatch an Azure activity log alert for patch operations. +type ActivityLogAlertPatch struct { + // Enabled - Indicates whether this activity log alert is enabled. If an activity log alert is not enabled, then none of its actions will be activated. + Enabled *bool `json:"enabled,omitempty"` +} + +// ActivityLogAlertPatchBody an activity log alert object for the body of patch operations. +type ActivityLogAlertPatchBody struct { + // Tags - Resource tags + Tags map[string]*string `json:"tags"` + // ActivityLogAlertPatch - The activity log alert settings for an update operation. + *ActivityLogAlertPatch `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for ActivityLogAlertPatchBody. +func (alapb ActivityLogAlertPatchBody) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if alapb.Tags != nil { + objectMap["tags"] = alapb.Tags + } + if alapb.ActivityLogAlertPatch != nil { + objectMap["properties"] = alapb.ActivityLogAlertPatch + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ActivityLogAlertPatchBody struct. +func (alapb *ActivityLogAlertPatchBody) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + alapb.Tags = tags + } + case "properties": + if v != nil { + var activityLogAlertPatch ActivityLogAlertPatch + err = json.Unmarshal(*v, &activityLogAlertPatch) + if err != nil { + return err + } + alapb.ActivityLogAlertPatch = &activityLogAlertPatch + } + } + } + + return nil +} + +// ActivityLogAlertResource an activity log alert resource. +type ActivityLogAlertResource struct { + autorest.Response `json:"-"` + // ActivityLogAlert - The activity log alert properties of the resource. + *ActivityLogAlert `json:"properties,omitempty"` + // ID - Azure resource Id + ID *string `json:"id,omitempty"` + // Name - Azure resource name + Name *string `json:"name,omitempty"` + // Type - Azure resource type + Type *string `json:"type,omitempty"` + // Location - Resource location + Location *string `json:"location,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for ActivityLogAlertResource. +func (alar ActivityLogAlertResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if alar.ActivityLogAlert != nil { + objectMap["properties"] = alar.ActivityLogAlert + } + if alar.ID != nil { + objectMap["id"] = alar.ID + } + if alar.Name != nil { + objectMap["name"] = alar.Name + } + if alar.Type != nil { + objectMap["type"] = alar.Type + } + if alar.Location != nil { + objectMap["location"] = alar.Location + } + if alar.Tags != nil { + objectMap["tags"] = alar.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ActivityLogAlertResource struct. +func (alar *ActivityLogAlertResource) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var activityLogAlert ActivityLogAlert + err = json.Unmarshal(*v, &activityLogAlert) + if err != nil { + return err + } + alar.ActivityLogAlert = &activityLogAlert + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + alar.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + alar.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + alar.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + alar.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + alar.Tags = tags + } + } + } + + return nil +} + +// AlertRule an alert rule. +type AlertRule struct { + // Name - the name of the alert rule. + Name *string `json:"name,omitempty"` + // Description - the description of the alert rule that will be included in the alert email. + Description *string `json:"description,omitempty"` + // IsEnabled - the flag that indicates whether the alert rule is enabled. + IsEnabled *bool `json:"isEnabled,omitempty"` + // Condition - the condition that results in the alert rule being activated. + Condition BasicRuleCondition `json:"condition,omitempty"` + // Actions - the array of actions that are performed when the alert rule becomes active, and when an alert condition is resolved. + Actions *[]BasicRuleAction `json:"actions,omitempty"` + // LastUpdatedTime - Last time the rule was updated in ISO8601 format. + LastUpdatedTime *date.Time `json:"lastUpdatedTime,omitempty"` +} + +// UnmarshalJSON is the custom unmarshaler for AlertRule struct. +func (ar *AlertRule) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + ar.Name = &name + } + case "description": + if v != nil { + var description string + err = json.Unmarshal(*v, &description) + if err != nil { + return err + } + ar.Description = &description + } + case "isEnabled": + if v != nil { + var isEnabled bool + err = json.Unmarshal(*v, &isEnabled) + if err != nil { + return err + } + ar.IsEnabled = &isEnabled + } + case "condition": + if v != nil { + condition, err := unmarshalBasicRuleCondition(*v) + if err != nil { + return err + } + ar.Condition = condition + } + case "actions": + if v != nil { + actions, err := unmarshalBasicRuleActionArray(*v) + if err != nil { + return err + } + ar.Actions = &actions + } + case "lastUpdatedTime": + if v != nil { + var lastUpdatedTime date.Time + err = json.Unmarshal(*v, &lastUpdatedTime) + if err != nil { + return err + } + ar.LastUpdatedTime = &lastUpdatedTime + } + } + } + + return nil +} + +// AlertRuleResource the alert rule resource. +type AlertRuleResource struct { + autorest.Response `json:"-"` + // AlertRule - The alert rule properties of the resource. + *AlertRule `json:"properties,omitempty"` + // ID - Azure resource Id + ID *string `json:"id,omitempty"` + // Name - Azure resource name + Name *string `json:"name,omitempty"` + // Type - Azure resource type + Type *string `json:"type,omitempty"` + // Location - Resource location + Location *string `json:"location,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for AlertRuleResource. +func (arr AlertRuleResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if arr.AlertRule != nil { + objectMap["properties"] = arr.AlertRule + } + if arr.ID != nil { + objectMap["id"] = arr.ID + } + if arr.Name != nil { + objectMap["name"] = arr.Name + } + if arr.Type != nil { + objectMap["type"] = arr.Type + } + if arr.Location != nil { + objectMap["location"] = arr.Location + } + if arr.Tags != nil { + objectMap["tags"] = arr.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for AlertRuleResource struct. +func (arr *AlertRuleResource) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var alertRule AlertRule + err = json.Unmarshal(*v, &alertRule) + if err != nil { + return err + } + arr.AlertRule = &alertRule + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + arr.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + arr.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + arr.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + arr.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + arr.Tags = tags + } + } + } + + return nil +} + +// AlertRuleResourceCollection represents a collection of alert rule resources. +type AlertRuleResourceCollection struct { + autorest.Response `json:"-"` + // Value - the values for the alert rule resources. + Value *[]AlertRuleResource `json:"value,omitempty"` +} + +// AlertRuleResourcePatch the alert rule object for patch operations. +type AlertRuleResourcePatch struct { + // Tags - Resource tags + Tags map[string]*string `json:"tags"` + // AlertRule - The properties of an alert rule. + *AlertRule `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for AlertRuleResourcePatch. +func (arrp AlertRuleResourcePatch) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if arrp.Tags != nil { + objectMap["tags"] = arrp.Tags + } + if arrp.AlertRule != nil { + objectMap["properties"] = arrp.AlertRule + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for AlertRuleResourcePatch struct. +func (arrp *AlertRuleResourcePatch) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + arrp.Tags = tags + } + case "properties": + if v != nil { + var alertRule AlertRule + err = json.Unmarshal(*v, &alertRule) + if err != nil { + return err + } + arrp.AlertRule = &alertRule + } + } + } + + return nil +} + +// AutomationRunbookReceiver the Azure Automation Runbook notification receiver. +type AutomationRunbookReceiver struct { + // AutomationAccountID - The Azure automation account Id which holds this runbook and authenticate to Azure resource. + AutomationAccountID *string `json:"automationAccountId,omitempty"` + // RunbookName - The name for this runbook. + RunbookName *string `json:"runbookName,omitempty"` + // WebhookResourceID - The resource id for webhook linked to this runbook. + WebhookResourceID *string `json:"webhookResourceId,omitempty"` + // IsGlobalRunbook - Indicates whether this instance is global runbook. + IsGlobalRunbook *bool `json:"isGlobalRunbook,omitempty"` + // Name - Indicates name of the webhook. + Name *string `json:"name,omitempty"` + // ServiceURI - The URI where webhooks should be sent. + ServiceURI *string `json:"serviceUri,omitempty"` +} + +// AutoscaleNotification autoscale notification. +type AutoscaleNotification struct { + // Operation - the operation associated with the notification and its value must be "scale" + Operation *string `json:"operation,omitempty"` + // Email - the email notification. + Email *EmailNotification `json:"email,omitempty"` + // Webhooks - the collection of webhook notifications. + Webhooks *[]WebhookNotification `json:"webhooks,omitempty"` +} + +// AutoscaleProfile autoscale profile. +type AutoscaleProfile struct { + // Name - the name of the profile. + Name *string `json:"name,omitempty"` + // Capacity - the number of instances that can be used during this profile. + Capacity *ScaleCapacity `json:"capacity,omitempty"` + // Rules - the collection of rules that provide the triggers and parameters for the scaling action. A maximum of 10 rules can be specified. + Rules *[]ScaleRule `json:"rules,omitempty"` + // FixedDate - the specific date-time for the profile. This element is not used if the Recurrence element is used. + FixedDate *TimeWindow `json:"fixedDate,omitempty"` + // Recurrence - the repeating times at which this profile begins. This element is not used if the FixedDate element is used. + Recurrence *Recurrence `json:"recurrence,omitempty"` +} + +// AutoscaleSetting a setting that contains all of the configuration for the automatic scaling of a resource. +type AutoscaleSetting struct { + // Profiles - the collection of automatic scaling profiles that specify different scaling parameters for different time periods. A maximum of 20 profiles can be specified. + Profiles *[]AutoscaleProfile `json:"profiles,omitempty"` + // Notifications - the collection of notifications. + Notifications *[]AutoscaleNotification `json:"notifications,omitempty"` + // Enabled - the enabled flag. Specifies whether automatic scaling is enabled for the resource. The default value is 'true'. + Enabled *bool `json:"enabled,omitempty"` + // Name - the name of the autoscale setting. + Name *string `json:"name,omitempty"` + // TargetResourceURI - the resource identifier of the resource that the autoscale setting should be added to. + TargetResourceURI *string `json:"targetResourceUri,omitempty"` +} + +// AutoscaleSettingResource the autoscale setting resource. +type AutoscaleSettingResource struct { + autorest.Response `json:"-"` + // AutoscaleSetting - The autoscale setting of the resource. + *AutoscaleSetting `json:"properties,omitempty"` + // ID - Azure resource Id + ID *string `json:"id,omitempty"` + // Name - Azure resource name + Name *string `json:"name,omitempty"` + // Type - Azure resource type + Type *string `json:"type,omitempty"` + // Location - Resource location + Location *string `json:"location,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for AutoscaleSettingResource. +func (asr AutoscaleSettingResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if asr.AutoscaleSetting != nil { + objectMap["properties"] = asr.AutoscaleSetting + } + if asr.ID != nil { + objectMap["id"] = asr.ID + } + if asr.Name != nil { + objectMap["name"] = asr.Name + } + if asr.Type != nil { + objectMap["type"] = asr.Type + } + if asr.Location != nil { + objectMap["location"] = asr.Location + } + if asr.Tags != nil { + objectMap["tags"] = asr.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for AutoscaleSettingResource struct. +func (asr *AutoscaleSettingResource) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var autoscaleSetting AutoscaleSetting + err = json.Unmarshal(*v, &autoscaleSetting) + if err != nil { + return err + } + asr.AutoscaleSetting = &autoscaleSetting + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + asr.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + asr.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + asr.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + asr.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + asr.Tags = tags + } + } + } + + return nil +} + +// AutoscaleSettingResourceCollection represents a collection of autoscale setting resources. +type AutoscaleSettingResourceCollection struct { + autorest.Response `json:"-"` + // Value - the values for the autoscale setting resources. + Value *[]AutoscaleSettingResource `json:"value,omitempty"` + // NextLink - URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// AutoscaleSettingResourceCollectionIterator provides access to a complete listing of AutoscaleSettingResource +// values. +type AutoscaleSettingResourceCollectionIterator struct { + i int + page AutoscaleSettingResourceCollectionPage +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *AutoscaleSettingResourceCollectionIterator) Next() error { + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err := iter.page.Next() + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter AutoscaleSettingResourceCollectionIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter AutoscaleSettingResourceCollectionIterator) Response() AutoscaleSettingResourceCollection { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter AutoscaleSettingResourceCollectionIterator) Value() AutoscaleSettingResource { + if !iter.page.NotDone() { + return AutoscaleSettingResource{} + } + return iter.page.Values()[iter.i] +} + +// IsEmpty returns true if the ListResult contains no values. +func (asrc AutoscaleSettingResourceCollection) IsEmpty() bool { + return asrc.Value == nil || len(*asrc.Value) == 0 +} + +// autoscaleSettingResourceCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (asrc AutoscaleSettingResourceCollection) autoscaleSettingResourceCollectionPreparer() (*http.Request, error) { + if asrc.NextLink == nil || len(to.String(asrc.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(asrc.NextLink))) +} + +// AutoscaleSettingResourceCollectionPage contains a page of AutoscaleSettingResource values. +type AutoscaleSettingResourceCollectionPage struct { + fn func(AutoscaleSettingResourceCollection) (AutoscaleSettingResourceCollection, error) + asrc AutoscaleSettingResourceCollection +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *AutoscaleSettingResourceCollectionPage) Next() error { + next, err := page.fn(page.asrc) + if err != nil { + return err + } + page.asrc = next + return nil +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page AutoscaleSettingResourceCollectionPage) NotDone() bool { + return !page.asrc.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page AutoscaleSettingResourceCollectionPage) Response() AutoscaleSettingResourceCollection { + return page.asrc +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page AutoscaleSettingResourceCollectionPage) Values() []AutoscaleSettingResource { + if page.asrc.IsEmpty() { + return nil + } + return *page.asrc.Value +} + +// AutoscaleSettingResourcePatch the autoscale setting object for patch operations. +type AutoscaleSettingResourcePatch struct { + // Tags - Resource tags + Tags map[string]*string `json:"tags"` + // AutoscaleSetting - The autoscale setting properties of the update operation. + *AutoscaleSetting `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for AutoscaleSettingResourcePatch. +func (asrp AutoscaleSettingResourcePatch) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if asrp.Tags != nil { + objectMap["tags"] = asrp.Tags + } + if asrp.AutoscaleSetting != nil { + objectMap["properties"] = asrp.AutoscaleSetting + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for AutoscaleSettingResourcePatch struct. +func (asrp *AutoscaleSettingResourcePatch) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + asrp.Tags = tags + } + case "properties": + if v != nil { + var autoscaleSetting AutoscaleSetting + err = json.Unmarshal(*v, &autoscaleSetting) + if err != nil { + return err + } + asrp.AutoscaleSetting = &autoscaleSetting + } + } + } + + return nil +} + +// AzureAppPushReceiver the Azure mobile App push notification receiver. +type AzureAppPushReceiver struct { + // Name - The name of the Azure mobile app push receiver. Names must be unique across all receivers within an action group. + Name *string `json:"name,omitempty"` + // EmailAddress - The email address registered for the Azure mobile app. + EmailAddress *string `json:"emailAddress,omitempty"` +} + +// Baseline the baseline values for a single sensitivity value. +type Baseline struct { + // Sensitivity - the sensitivity of the baseline. Possible values include: 'Low', 'Medium', 'High' + Sensitivity Sensitivity `json:"sensitivity,omitempty"` + // LowThresholds - The low thresholds of the baseline. + LowThresholds *[]float64 `json:"lowThresholds,omitempty"` + // HighThresholds - The high thresholds of the baseline. + HighThresholds *[]float64 `json:"highThresholds,omitempty"` +} + +// BaselineMetadataValue represents a baseline metadata value. +type BaselineMetadataValue struct { + // Name - the name of the metadata. + Name *LocalizableString `json:"name,omitempty"` + // Value - the value of the metadata. + Value *string `json:"value,omitempty"` +} + +// BaselineProperties the baseline properties class. +type BaselineProperties struct { + // Timespan - The timespan for which the data was retrieved. Its value consists of two datatimes concatenated, separated by '/'. This may be adjusted in the future and returned back from what was originally requested. + Timespan *string `json:"timespan,omitempty"` + // Interval - The interval (window size) for which the metric data was returned in. This may be adjusted in the future and returned back from what was originally requested. This is not present if a metadata request was made. + Interval *string `json:"interval,omitempty"` + // Aggregation - The aggregation type of the metric. + Aggregation *string `json:"aggregation,omitempty"` + // Timestamps - the array of timestamps of the baselines. + Timestamps *[]date.Time `json:"timestamps,omitempty"` + // Baseline - the baseline values for each sensitivity. + Baseline *[]Baseline `json:"baseline,omitempty"` + // Metadata - the baseline metadata values. + Metadata *[]BaselineMetadataValue `json:"metadata,omitempty"` +} + +// BaselineResponse the response to a baseline query. +type BaselineResponse struct { + autorest.Response `json:"-"` + // ID - the metric baseline Id. + ID *string `json:"id,omitempty"` + // Type - the resource type of the baseline resource. + Type *string `json:"type,omitempty"` + // Name - the name and the display name of the metric, i.e. it is localizable string. + Name *LocalizableString `json:"name,omitempty"` + // BaselineProperties - the properties of the baseline. + *BaselineProperties `json:"properties,omitempty"` +} + +// UnmarshalJSON is the custom unmarshaler for BaselineResponse struct. +func (br *BaselineResponse) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + br.ID = &ID + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + br.Type = &typeVar + } + case "name": + if v != nil { + var name LocalizableString + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + br.Name = &name + } + case "properties": + if v != nil { + var baselineProperties BaselineProperties + err = json.Unmarshal(*v, &baselineProperties) + if err != nil { + return err + } + br.BaselineProperties = &baselineProperties + } + } + } + + return nil +} + +// CalculateBaselineResponse the response to a calcualte baseline call. +type CalculateBaselineResponse struct { + autorest.Response `json:"-"` + // Type - the resource type of the baseline resource. + Type *string `json:"type,omitempty"` + // Timestamps - the array of timestamps of the baselines. + Timestamps *[]date.Time `json:"timestamps,omitempty"` + // Baseline - the baseline values for each sensitivity. + Baseline *[]Baseline `json:"baseline,omitempty"` +} + +// DiagnosticSettings the diagnostic settings. +type DiagnosticSettings struct { + // StorageAccountID - The resource ID of the storage account to which you would like to send Diagnostic Logs. + StorageAccountID *string `json:"storageAccountId,omitempty"` + // EventHubAuthorizationRuleID - The resource Id for the event hub authorization rule. + EventHubAuthorizationRuleID *string `json:"eventHubAuthorizationRuleId,omitempty"` + // EventHubName - The name of the event hub. If none is specified, the default event hub will be selected. + EventHubName *string `json:"eventHubName,omitempty"` + // Metrics - the list of metric settings. + Metrics *[]MetricSettings `json:"metrics,omitempty"` + // Logs - the list of logs settings. + Logs *[]LogSettings `json:"logs,omitempty"` + // WorkspaceID - The workspace ID (resource ID of a Log Analytics workspace) for a Log Analytics workspace to which you would like to send Diagnostic Logs. Example: /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights-integration/providers/Microsoft.OperationalInsights/workspaces/viruela2 + WorkspaceID *string `json:"workspaceId,omitempty"` +} + +// DiagnosticSettingsCategory the diagnostic settings Category. +type DiagnosticSettingsCategory struct { + // CategoryType - The type of the diagnostic settings category. Possible values include: 'Metrics', 'Logs' + CategoryType CategoryType `json:"categoryType,omitempty"` +} + +// DiagnosticSettingsCategoryResource the diagnostic settings category resource. +type DiagnosticSettingsCategoryResource struct { + autorest.Response `json:"-"` + *DiagnosticSettingsCategory `json:"properties,omitempty"` + // ID - Azure resource Id + ID *string `json:"id,omitempty"` + // Name - Azure resource name + Name *string `json:"name,omitempty"` + // Type - Azure resource type + Type *string `json:"type,omitempty"` +} + +// UnmarshalJSON is the custom unmarshaler for DiagnosticSettingsCategoryResource struct. +func (dscr *DiagnosticSettingsCategoryResource) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var diagnosticSettingsCategory DiagnosticSettingsCategory + err = json.Unmarshal(*v, &diagnosticSettingsCategory) + if err != nil { + return err + } + dscr.DiagnosticSettingsCategory = &diagnosticSettingsCategory + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + dscr.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + dscr.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + dscr.Type = &typeVar + } + } + } + + return nil +} + +// DiagnosticSettingsCategoryResourceCollection represents a collection of diagnostic setting category resources. +type DiagnosticSettingsCategoryResourceCollection struct { + autorest.Response `json:"-"` + // Value - The collection of diagnostic settings category resources. + Value *[]DiagnosticSettingsCategoryResource `json:"value,omitempty"` +} + +// DiagnosticSettingsResource the diagnostic setting resource. +type DiagnosticSettingsResource struct { + autorest.Response `json:"-"` + *DiagnosticSettings `json:"properties,omitempty"` + // ID - Azure resource Id + ID *string `json:"id,omitempty"` + // Name - Azure resource name + Name *string `json:"name,omitempty"` + // Type - Azure resource type + Type *string `json:"type,omitempty"` +} + +// UnmarshalJSON is the custom unmarshaler for DiagnosticSettingsResource struct. +func (dsr *DiagnosticSettingsResource) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var diagnosticSettings DiagnosticSettings + err = json.Unmarshal(*v, &diagnosticSettings) + if err != nil { + return err + } + dsr.DiagnosticSettings = &diagnosticSettings + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + dsr.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + dsr.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + dsr.Type = &typeVar + } + } + } + + return nil +} + +// DiagnosticSettingsResourceCollection represents a collection of alert rule resources. +type DiagnosticSettingsResourceCollection struct { + autorest.Response `json:"-"` + // Value - The collection of diagnostic settings resources;. + Value *[]DiagnosticSettingsResource `json:"value,omitempty"` +} + +// EmailNotification email notification of an autoscale event. +type EmailNotification struct { + // SendToSubscriptionAdministrator - a value indicating whether to send email to subscription administrator. + SendToSubscriptionAdministrator *bool `json:"sendToSubscriptionAdministrator,omitempty"` + // SendToSubscriptionCoAdministrators - a value indicating whether to send email to subscription co-administrators. + SendToSubscriptionCoAdministrators *bool `json:"sendToSubscriptionCoAdministrators,omitempty"` + // CustomEmails - the custom e-mails list. This value can be null or empty, in which case this attribute will be ignored. + CustomEmails *[]string `json:"customEmails,omitempty"` +} + +// EmailReceiver an email receiver. +type EmailReceiver struct { + // Name - The name of the email receiver. Names must be unique across all receivers within an action group. + Name *string `json:"name,omitempty"` + // EmailAddress - The email address of this receiver. + EmailAddress *string `json:"emailAddress,omitempty"` + // Status - The receiver status of the e-mail. Possible values include: 'NotSpecified', 'Enabled', 'Disabled' + Status ReceiverStatus `json:"status,omitempty"` +} + +// EnableRequest describes a receiver that should be resubscribed. +type EnableRequest struct { + // ReceiverName - The name of the receiver to resubscribe. + ReceiverName *string `json:"receiverName,omitempty"` +} + +// ErrorResponse describes the format of Error response. +type ErrorResponse struct { + // Code - Error code + Code *string `json:"code,omitempty"` + // Message - Error message indicating why the operation failed. + Message *string `json:"message,omitempty"` +} + +// EventCategoryCollection a collection of event categories. Currently possible values are: Administrative, +// Security, ServiceHealth, Alert, Recommendation, Policy. +type EventCategoryCollection struct { + autorest.Response `json:"-"` + // Value - the list that includes the Azure event categories. + Value *[]LocalizableString `json:"value,omitempty"` +} + +// EventData the Azure event log entries are of type EventData +type EventData struct { + Authorization *SenderAuthorization `json:"authorization,omitempty"` + // Claims - key value pairs to identify ARM permissions. + Claims map[string]*string `json:"claims"` + // Caller - the email address of the user who has performed the operation, the UPN claim or SPN claim based on availability. + Caller *string `json:"caller,omitempty"` + // Description - the description of the event. + Description *string `json:"description,omitempty"` + // ID - the Id of this event as required by ARM for RBAC. It contains the EventDataID and a timestamp information. + ID *string `json:"id,omitempty"` + // EventDataID - the event data Id. This is a unique identifier for an event. + EventDataID *string `json:"eventDataId,omitempty"` + // CorrelationID - the correlation Id, usually a GUID in the string format. The correlation Id is shared among the events that belong to the same uber operation. + CorrelationID *string `json:"correlationId,omitempty"` + // EventName - the event name. This value should not be confused with OperationName. For practical purposes, OperationName might be more appealing to end users. + EventName *LocalizableString `json:"eventName,omitempty"` + // Category - the event category. + Category *LocalizableString `json:"category,omitempty"` + // HTTPRequest - the HTTP request info. Usually includes the 'clientRequestId', 'clientIpAddress' (IP address of the user who initiated the event) and 'method' (HTTP method e.g. PUT). + HTTPRequest *HTTPRequestInfo `json:"httpRequest,omitempty"` + // Level - the event level. Possible values include: 'Critical', 'Error', 'Warning', 'Informational', 'Verbose' + Level EventLevel `json:"level,omitempty"` + // ResourceGroupName - the resource group name of the impacted resource. + ResourceGroupName *string `json:"resourceGroupName,omitempty"` + // ResourceProviderName - the resource provider name of the impacted resource. + ResourceProviderName *LocalizableString `json:"resourceProviderName,omitempty"` + // ResourceID - the resource uri that uniquely identifies the resource that caused this event. + ResourceID *string `json:"resourceId,omitempty"` + // ResourceType - the resource type + ResourceType *LocalizableString `json:"resourceType,omitempty"` + // OperationID - It is usually a GUID shared among the events corresponding to single operation. This value should not be confused with EventName. + OperationID *string `json:"operationId,omitempty"` + // OperationName - the operation name. + OperationName *LocalizableString `json:"operationName,omitempty"` + // Properties - the set of pairs (usually a Dictionary) that includes details about the event. + Properties map[string]*string `json:"properties"` + // Status - a string describing the status of the operation. Some typical values are: Started, In progress, Succeeded, Failed, Resolved. + Status *LocalizableString `json:"status,omitempty"` + // SubStatus - the event sub status. Most of the time, when included, this captures the HTTP status code of the REST call. Common values are: OK (HTTP Status Code: 200), Created (HTTP Status Code: 201), Accepted (HTTP Status Code: 202), No Content (HTTP Status Code: 204), Bad Request(HTTP Status Code: 400), Not Found (HTTP Status Code: 404), Conflict (HTTP Status Code: 409), Internal Server Error (HTTP Status Code: 500), Service Unavailable (HTTP Status Code:503), Gateway Timeout (HTTP Status Code: 504) + SubStatus *LocalizableString `json:"subStatus,omitempty"` + // EventTimestamp - the timestamp of when the event was generated by the Azure service processing the request corresponding the event. It in ISO 8601 format. + EventTimestamp *date.Time `json:"eventTimestamp,omitempty"` + // SubmissionTimestamp - the timestamp of when the event became available for querying via this API. It is in ISO 8601 format. This value should not be confused eventTimestamp. As there might be a delay between the occurrence time of the event, and the time that the event is submitted to the Azure logging infrastructure. + SubmissionTimestamp *date.Time `json:"submissionTimestamp,omitempty"` + // SubscriptionID - the Azure subscription Id usually a GUID. + SubscriptionID *string `json:"subscriptionId,omitempty"` + // TenantID - the Azure tenant Id + TenantID *string `json:"tenantId,omitempty"` +} + +// MarshalJSON is the custom marshaler for EventData. +func (ed EventData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ed.Authorization != nil { + objectMap["authorization"] = ed.Authorization + } + if ed.Claims != nil { + objectMap["claims"] = ed.Claims + } + if ed.Caller != nil { + objectMap["caller"] = ed.Caller + } + if ed.Description != nil { + objectMap["description"] = ed.Description + } + if ed.ID != nil { + objectMap["id"] = ed.ID + } + if ed.EventDataID != nil { + objectMap["eventDataId"] = ed.EventDataID + } + if ed.CorrelationID != nil { + objectMap["correlationId"] = ed.CorrelationID + } + if ed.EventName != nil { + objectMap["eventName"] = ed.EventName + } + if ed.Category != nil { + objectMap["category"] = ed.Category + } + if ed.HTTPRequest != nil { + objectMap["httpRequest"] = ed.HTTPRequest + } + objectMap["level"] = ed.Level + if ed.ResourceGroupName != nil { + objectMap["resourceGroupName"] = ed.ResourceGroupName + } + if ed.ResourceProviderName != nil { + objectMap["resourceProviderName"] = ed.ResourceProviderName + } + if ed.ResourceID != nil { + objectMap["resourceId"] = ed.ResourceID + } + if ed.ResourceType != nil { + objectMap["resourceType"] = ed.ResourceType + } + if ed.OperationID != nil { + objectMap["operationId"] = ed.OperationID + } + if ed.OperationName != nil { + objectMap["operationName"] = ed.OperationName + } + if ed.Properties != nil { + objectMap["properties"] = ed.Properties + } + if ed.Status != nil { + objectMap["status"] = ed.Status + } + if ed.SubStatus != nil { + objectMap["subStatus"] = ed.SubStatus + } + if ed.EventTimestamp != nil { + objectMap["eventTimestamp"] = ed.EventTimestamp + } + if ed.SubmissionTimestamp != nil { + objectMap["submissionTimestamp"] = ed.SubmissionTimestamp + } + if ed.SubscriptionID != nil { + objectMap["subscriptionId"] = ed.SubscriptionID + } + if ed.TenantID != nil { + objectMap["tenantId"] = ed.TenantID + } + return json.Marshal(objectMap) +} + +// EventDataCollection represents collection of events. +type EventDataCollection struct { + autorest.Response `json:"-"` + // Value - this list that includes the Azure audit logs. + Value *[]EventData `json:"value,omitempty"` + // NextLink - Provides the link to retrieve the next set of events. + NextLink *string `json:"nextLink,omitempty"` +} + +// EventDataCollectionIterator provides access to a complete listing of EventData values. +type EventDataCollectionIterator struct { + i int + page EventDataCollectionPage +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *EventDataCollectionIterator) Next() error { + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err := iter.page.Next() + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter EventDataCollectionIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter EventDataCollectionIterator) Response() EventDataCollection { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter EventDataCollectionIterator) Value() EventData { + if !iter.page.NotDone() { + return EventData{} + } + return iter.page.Values()[iter.i] +} + +// IsEmpty returns true if the ListResult contains no values. +func (edc EventDataCollection) IsEmpty() bool { + return edc.Value == nil || len(*edc.Value) == 0 +} + +// eventDataCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (edc EventDataCollection) eventDataCollectionPreparer() (*http.Request, error) { + if edc.NextLink == nil || len(to.String(edc.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(edc.NextLink))) +} + +// EventDataCollectionPage contains a page of EventData values. +type EventDataCollectionPage struct { + fn func(EventDataCollection) (EventDataCollection, error) + edc EventDataCollection +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *EventDataCollectionPage) Next() error { + next, err := page.fn(page.edc) + if err != nil { + return err + } + page.edc = next + return nil +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page EventDataCollectionPage) NotDone() bool { + return !page.edc.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page EventDataCollectionPage) Response() EventDataCollection { + return page.edc +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page EventDataCollectionPage) Values() []EventData { + if page.edc.IsEmpty() { + return nil + } + return *page.edc.Value +} + +// HTTPRequestInfo the Http request info. +type HTTPRequestInfo struct { + // ClientRequestID - the client request id. + ClientRequestID *string `json:"clientRequestId,omitempty"` + // ClientIPAddress - the client Ip Address + ClientIPAddress *string `json:"clientIpAddress,omitempty"` + // Method - the Http request method. + Method *string `json:"method,omitempty"` + // URI - the Uri. + URI *string `json:"uri,omitempty"` +} + +// Incident an alert incident indicates the activation status of an alert rule. +type Incident struct { + autorest.Response `json:"-"` + // Name - Incident name. + Name *string `json:"name,omitempty"` + // RuleName - Rule name that is associated with the incident. + RuleName *string `json:"ruleName,omitempty"` + // IsActive - A boolean to indicate whether the incident is active or resolved. + IsActive *bool `json:"isActive,omitempty"` + // ActivatedTime - The time at which the incident was activated in ISO8601 format. + ActivatedTime *date.Time `json:"activatedTime,omitempty"` + // ResolvedTime - The time at which the incident was resolved in ISO8601 format. If null, it means the incident is still active. + ResolvedTime *date.Time `json:"resolvedTime,omitempty"` +} + +// IncidentListResult the List incidents operation response. +type IncidentListResult struct { + autorest.Response `json:"-"` + // Value - the incident collection. + Value *[]Incident `json:"value,omitempty"` +} + +// ItsmReceiver an Itsm receiver. +type ItsmReceiver struct { + // Name - The name of the Itsm receiver. Names must be unique across all receivers within an action group. + Name *string `json:"name,omitempty"` + // WorkspaceID - OMS LA instance identifier. + WorkspaceID *string `json:"workspaceId,omitempty"` + // ConnectionID - Unique identification of ITSM connection among multiple defined in above workspace. + ConnectionID *string `json:"connectionId,omitempty"` + // TicketConfiguration - JSON blob for the configurations of the ITSM action. CreateMultipleWorkItems option will be part of this blob as well. + TicketConfiguration *string `json:"ticketConfiguration,omitempty"` + // Region - Region in which workspace resides. Supported values:'centralindia','japaneast','southeastasia','australiasoutheast','uksouth','westcentralus','canadacentral','eastus','westeurope' + Region *string `json:"region,omitempty"` +} + +// LocalizableString the localizable string class. +type LocalizableString struct { + // Value - the invariant value. + Value *string `json:"value,omitempty"` + // LocalizedValue - the locale specific value. + LocalizedValue *string `json:"localizedValue,omitempty"` +} + +// LocationThresholdRuleCondition a rule condition based on a certain number of locations failing. +type LocationThresholdRuleCondition struct { + // WindowSize - the period of time (in ISO 8601 duration format) that is used to monitor alert activity based on the threshold. If specified then it must be between 5 minutes and 1 day. + WindowSize *string `json:"windowSize,omitempty"` + // FailedLocationCount - the number of locations that must fail to activate the alert. + FailedLocationCount *int32 `json:"failedLocationCount,omitempty"` + // DataSource - the resource from which the rule collects its data. For this type dataSource will always be of type RuleMetricDataSource. + DataSource BasicRuleDataSource `json:"dataSource,omitempty"` + // OdataType - Possible values include: 'OdataTypeRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition' + OdataType OdataTypeBasicRuleCondition `json:"odata.type,omitempty"` +} + +// MarshalJSON is the custom marshaler for LocationThresholdRuleCondition. +func (ltrc LocationThresholdRuleCondition) MarshalJSON() ([]byte, error) { + ltrc.OdataType = OdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition + objectMap := make(map[string]interface{}) + if ltrc.WindowSize != nil { + objectMap["windowSize"] = ltrc.WindowSize + } + if ltrc.FailedLocationCount != nil { + objectMap["failedLocationCount"] = ltrc.FailedLocationCount + } + objectMap["dataSource"] = ltrc.DataSource + objectMap["odata.type"] = ltrc.OdataType + return json.Marshal(objectMap) +} + +// AsThresholdRuleCondition is the BasicRuleCondition implementation for LocationThresholdRuleCondition. +func (ltrc LocationThresholdRuleCondition) AsThresholdRuleCondition() (*ThresholdRuleCondition, bool) { + return nil, false +} + +// AsLocationThresholdRuleCondition is the BasicRuleCondition implementation for LocationThresholdRuleCondition. +func (ltrc LocationThresholdRuleCondition) AsLocationThresholdRuleCondition() (*LocationThresholdRuleCondition, bool) { + return <rc, true +} + +// AsManagementEventRuleCondition is the BasicRuleCondition implementation for LocationThresholdRuleCondition. +func (ltrc LocationThresholdRuleCondition) AsManagementEventRuleCondition() (*ManagementEventRuleCondition, bool) { + return nil, false +} + +// AsRuleCondition is the BasicRuleCondition implementation for LocationThresholdRuleCondition. +func (ltrc LocationThresholdRuleCondition) AsRuleCondition() (*RuleCondition, bool) { + return nil, false +} + +// AsBasicRuleCondition is the BasicRuleCondition implementation for LocationThresholdRuleCondition. +func (ltrc LocationThresholdRuleCondition) AsBasicRuleCondition() (BasicRuleCondition, bool) { + return <rc, true +} + +// UnmarshalJSON is the custom unmarshaler for LocationThresholdRuleCondition struct. +func (ltrc *LocationThresholdRuleCondition) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "windowSize": + if v != nil { + var windowSize string + err = json.Unmarshal(*v, &windowSize) + if err != nil { + return err + } + ltrc.WindowSize = &windowSize + } + case "failedLocationCount": + if v != nil { + var failedLocationCount int32 + err = json.Unmarshal(*v, &failedLocationCount) + if err != nil { + return err + } + ltrc.FailedLocationCount = &failedLocationCount + } + case "dataSource": + if v != nil { + dataSource, err := unmarshalBasicRuleDataSource(*v) + if err != nil { + return err + } + ltrc.DataSource = dataSource + } + case "odata.type": + if v != nil { + var odataType OdataTypeBasicRuleCondition + err = json.Unmarshal(*v, &odataType) + if err != nil { + return err + } + ltrc.OdataType = odataType + } + } + } + + return nil +} + +// LogicAppReceiver a logic app receiver. +type LogicAppReceiver struct { + // Name - The name of the logic app receiver. Names must be unique across all receivers within an action group. + Name *string `json:"name,omitempty"` + // ResourceID - The azure resource id of the logic app receiver. + ResourceID *string `json:"resourceId,omitempty"` + // CallbackURL - The callback url where http request sent to. + CallbackURL *string `json:"callbackUrl,omitempty"` +} + +// LogProfileCollection represents a collection of log profiles. +type LogProfileCollection struct { + autorest.Response `json:"-"` + // Value - the values of the log profiles. + Value *[]LogProfileResource `json:"value,omitempty"` +} + +// LogProfileProperties the log profile properties. +type LogProfileProperties struct { + // StorageAccountID - the resource id of the storage account to which you would like to send the Activity Log. + StorageAccountID *string `json:"storageAccountId,omitempty"` + // ServiceBusRuleID - The service bus rule ID of the service bus namespace in which you would like to have Event Hubs created for streaming the Activity Log. The rule ID is of the format: '{service bus resource ID}/authorizationrules/{key name}'. + ServiceBusRuleID *string `json:"serviceBusRuleId,omitempty"` + // Locations - List of regions for which Activity Log events should be stored or streamed. It is a comma separated list of valid ARM locations including the 'global' location. + Locations *[]string `json:"locations,omitempty"` + // Categories - the categories of the logs. These categories are created as is convenient to the user. Some values are: 'Write', 'Delete', and/or 'Action.' + Categories *[]string `json:"categories,omitempty"` + // RetentionPolicy - the retention policy for the events in the log. + RetentionPolicy *RetentionPolicy `json:"retentionPolicy,omitempty"` +} + +// LogProfileResource the log profile resource. +type LogProfileResource struct { + autorest.Response `json:"-"` + // LogProfileProperties - The log profile properties of the resource. + *LogProfileProperties `json:"properties,omitempty"` + // ID - Azure resource Id + ID *string `json:"id,omitempty"` + // Name - Azure resource name + Name *string `json:"name,omitempty"` + // Type - Azure resource type + Type *string `json:"type,omitempty"` + // Location - Resource location + Location *string `json:"location,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for LogProfileResource. +func (lpr LogProfileResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if lpr.LogProfileProperties != nil { + objectMap["properties"] = lpr.LogProfileProperties + } + if lpr.ID != nil { + objectMap["id"] = lpr.ID + } + if lpr.Name != nil { + objectMap["name"] = lpr.Name + } + if lpr.Type != nil { + objectMap["type"] = lpr.Type + } + if lpr.Location != nil { + objectMap["location"] = lpr.Location + } + if lpr.Tags != nil { + objectMap["tags"] = lpr.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for LogProfileResource struct. +func (lpr *LogProfileResource) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var logProfileProperties LogProfileProperties + err = json.Unmarshal(*v, &logProfileProperties) + if err != nil { + return err + } + lpr.LogProfileProperties = &logProfileProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + lpr.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + lpr.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + lpr.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + lpr.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + lpr.Tags = tags + } + } + } + + return nil +} + +// LogProfileResourcePatch the log profile resource for patch operations. +type LogProfileResourcePatch struct { + // Tags - Resource tags + Tags map[string]*string `json:"tags"` + // LogProfileProperties - The log profile properties for an update operation. + *LogProfileProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for LogProfileResourcePatch. +func (lprp LogProfileResourcePatch) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if lprp.Tags != nil { + objectMap["tags"] = lprp.Tags + } + if lprp.LogProfileProperties != nil { + objectMap["properties"] = lprp.LogProfileProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for LogProfileResourcePatch struct. +func (lprp *LogProfileResourcePatch) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + lprp.Tags = tags + } + case "properties": + if v != nil { + var logProfileProperties LogProfileProperties + err = json.Unmarshal(*v, &logProfileProperties) + if err != nil { + return err + } + lprp.LogProfileProperties = &logProfileProperties + } + } + } + + return nil +} + +// LogSettings part of MultiTenantDiagnosticSettings. Specifies the settings for a particular log. +type LogSettings struct { + // Category - Name of a Diagnostic Log category for a resource type this setting is applied to. To obtain the list of Diagnostic Log categories for a resource, first perform a GET diagnostic settings operation. + Category *string `json:"category,omitempty"` + // Enabled - a value indicating whether this log is enabled. + Enabled *bool `json:"enabled,omitempty"` + // RetentionPolicy - the retention policy for this log. + RetentionPolicy *RetentionPolicy `json:"retentionPolicy,omitempty"` +} + +// ManagementEventAggregationCondition how the data that is collected should be combined over time. +type ManagementEventAggregationCondition struct { + // Operator - the condition operator. Possible values include: 'ConditionOperatorGreaterThan', 'ConditionOperatorGreaterThanOrEqual', 'ConditionOperatorLessThan', 'ConditionOperatorLessThanOrEqual' + Operator ConditionOperator `json:"operator,omitempty"` + // Threshold - The threshold value that activates the alert. + Threshold *float64 `json:"threshold,omitempty"` + // WindowSize - the period of time (in ISO 8601 duration format) that is used to monitor alert activity based on the threshold. If specified then it must be between 5 minutes and 1 day. + WindowSize *string `json:"windowSize,omitempty"` +} + +// ManagementEventRuleCondition a management event rule condition. +type ManagementEventRuleCondition struct { + // Aggregation - How the data that is collected should be combined over time and when the alert is activated. Note that for management event alerts aggregation is optional – if it is not provided then any event will cause the alert to activate. + Aggregation *ManagementEventAggregationCondition `json:"aggregation,omitempty"` + // DataSource - the resource from which the rule collects its data. For this type dataSource will always be of type RuleMetricDataSource. + DataSource BasicRuleDataSource `json:"dataSource,omitempty"` + // OdataType - Possible values include: 'OdataTypeRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition' + OdataType OdataTypeBasicRuleCondition `json:"odata.type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ManagementEventRuleCondition. +func (merc ManagementEventRuleCondition) MarshalJSON() ([]byte, error) { + merc.OdataType = OdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition + objectMap := make(map[string]interface{}) + if merc.Aggregation != nil { + objectMap["aggregation"] = merc.Aggregation + } + objectMap["dataSource"] = merc.DataSource + objectMap["odata.type"] = merc.OdataType + return json.Marshal(objectMap) +} + +// AsThresholdRuleCondition is the BasicRuleCondition implementation for ManagementEventRuleCondition. +func (merc ManagementEventRuleCondition) AsThresholdRuleCondition() (*ThresholdRuleCondition, bool) { + return nil, false +} + +// AsLocationThresholdRuleCondition is the BasicRuleCondition implementation for ManagementEventRuleCondition. +func (merc ManagementEventRuleCondition) AsLocationThresholdRuleCondition() (*LocationThresholdRuleCondition, bool) { + return nil, false +} + +// AsManagementEventRuleCondition is the BasicRuleCondition implementation for ManagementEventRuleCondition. +func (merc ManagementEventRuleCondition) AsManagementEventRuleCondition() (*ManagementEventRuleCondition, bool) { + return &merc, true +} + +// AsRuleCondition is the BasicRuleCondition implementation for ManagementEventRuleCondition. +func (merc ManagementEventRuleCondition) AsRuleCondition() (*RuleCondition, bool) { + return nil, false +} + +// AsBasicRuleCondition is the BasicRuleCondition implementation for ManagementEventRuleCondition. +func (merc ManagementEventRuleCondition) AsBasicRuleCondition() (BasicRuleCondition, bool) { + return &merc, true +} + +// UnmarshalJSON is the custom unmarshaler for ManagementEventRuleCondition struct. +func (merc *ManagementEventRuleCondition) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "aggregation": + if v != nil { + var aggregation ManagementEventAggregationCondition + err = json.Unmarshal(*v, &aggregation) + if err != nil { + return err + } + merc.Aggregation = &aggregation + } + case "dataSource": + if v != nil { + dataSource, err := unmarshalBasicRuleDataSource(*v) + if err != nil { + return err + } + merc.DataSource = dataSource + } + case "odata.type": + if v != nil { + var odataType OdataTypeBasicRuleCondition + err = json.Unmarshal(*v, &odataType) + if err != nil { + return err + } + merc.OdataType = odataType + } + } + } + + return nil +} + +// MetadataValue represents a metric metadata value. +type MetadataValue struct { + // Name - the name of the metadata. + Name *LocalizableString `json:"name,omitempty"` + // Value - the value of the metadata. + Value *string `json:"value,omitempty"` +} + +// Metric the result data of a query. +type Metric struct { + // ID - the metric Id. + ID *string `json:"id,omitempty"` + // Type - the resource type of the metric resource. + Type *string `json:"type,omitempty"` + // Name - the name and the display name of the metric, i.e. it is localizable string. + Name *LocalizableString `json:"name,omitempty"` + // Unit - the unit of the metric. Possible values include: 'UnitCount', 'UnitBytes', 'UnitSeconds', 'UnitCountPerSecond', 'UnitBytesPerSecond', 'UnitPercent', 'UnitMilliSeconds', 'UnitByteSeconds', 'UnitUnspecified' + Unit Unit `json:"unit,omitempty"` + // Timeseries - the time series returned when a data query is performed. + Timeseries *[]TimeSeriesElement `json:"timeseries,omitempty"` +} + +// MetricAvailability metric availability specifies the time grain (aggregation interval or frequency) and the +// retention period for that time grain. +type MetricAvailability struct { + // TimeGrain - the time grain specifies the aggregation interval for the metric. Expressed as a duration 'PT1M', 'P1D', etc. + TimeGrain *string `json:"timeGrain,omitempty"` + // Retention - the retention period for the metric at the specified timegrain. Expressed as a duration 'PT1M', 'P1D', etc. + Retention *string `json:"retention,omitempty"` +} + +// MetricDefinition metric definition class specifies the metadata for a metric. +type MetricDefinition struct { + // IsDimensionRequired - Flag to indicate whether the dimension is required. + IsDimensionRequired *bool `json:"isDimensionRequired,omitempty"` + // ResourceID - the resource identifier of the resource that emitted the metric. + ResourceID *string `json:"resourceId,omitempty"` + // Name - the name and the display name of the metric, i.e. it is a localizable string. + Name *LocalizableString `json:"name,omitempty"` + // Unit - the unit of the metric. Possible values include: 'UnitCount', 'UnitBytes', 'UnitSeconds', 'UnitCountPerSecond', 'UnitBytesPerSecond', 'UnitPercent', 'UnitMilliSeconds', 'UnitByteSeconds', 'UnitUnspecified' + Unit Unit `json:"unit,omitempty"` + // PrimaryAggregationType - the primary aggregation type value defining how to use the values for display. Possible values include: 'None', 'Average', 'Count', 'Minimum', 'Maximum', 'Total' + PrimaryAggregationType AggregationType `json:"primaryAggregationType,omitempty"` + // MetricAvailabilities - the collection of what aggregation intervals are available to be queried. + MetricAvailabilities *[]MetricAvailability `json:"metricAvailabilities,omitempty"` + // ID - the resource identifier of the metric definition. + ID *string `json:"id,omitempty"` + // Dimensions - the name and the display name of the dimension, i.e. it is a localizable string. + Dimensions *[]LocalizableString `json:"dimensions,omitempty"` +} + +// MetricDefinitionCollection represents collection of metric definitions. +type MetricDefinitionCollection struct { + autorest.Response `json:"-"` + // Value - the values for the metric definitions. + Value *[]MetricDefinition `json:"value,omitempty"` +} + +// MetricSettings part of MultiTenantDiagnosticSettings. Specifies the settings for a particular metric. +type MetricSettings struct { + // TimeGrain - the timegrain of the metric in ISO8601 format. + TimeGrain *string `json:"timeGrain,omitempty"` + // Category - Name of a Diagnostic Metric category for a resource type this setting is applied to. To obtain the list of Diagnostic metric categories for a resource, first perform a GET diagnostic settings operation. + Category *string `json:"category,omitempty"` + // Enabled - a value indicating whether this category is enabled. + Enabled *bool `json:"enabled,omitempty"` + // RetentionPolicy - the retention policy for this category. + RetentionPolicy *RetentionPolicy `json:"retentionPolicy,omitempty"` +} + +// MetricTrigger the trigger that results in a scaling action. +type MetricTrigger struct { + // MetricName - the name of the metric that defines what the rule monitors. + MetricName *string `json:"metricName,omitempty"` + // MetricResourceURI - the resource identifier of the resource the rule monitors. + MetricResourceURI *string `json:"metricResourceUri,omitempty"` + // TimeGrain - the granularity of metrics the rule monitors. Must be one of the predefined values returned from metric definitions for the metric. Must be between 12 hours and 1 minute. + TimeGrain *string `json:"timeGrain,omitempty"` + // Statistic - the metric statistic type. How the metrics from multiple instances are combined. Possible values include: 'MetricStatisticTypeAverage', 'MetricStatisticTypeMin', 'MetricStatisticTypeMax', 'MetricStatisticTypeSum' + Statistic MetricStatisticType `json:"statistic,omitempty"` + // TimeWindow - the range of time in which instance data is collected. This value must be greater than the delay in metric collection, which can vary from resource-to-resource. Must be between 12 hours and 5 minutes. + TimeWindow *string `json:"timeWindow,omitempty"` + // TimeAggregation - time aggregation type. How the data that is collected should be combined over time. The default value is Average. Possible values include: 'TimeAggregationTypeAverage', 'TimeAggregationTypeMinimum', 'TimeAggregationTypeMaximum', 'TimeAggregationTypeTotal', 'TimeAggregationTypeCount' + TimeAggregation TimeAggregationType `json:"timeAggregation,omitempty"` + // Operator - the operator that is used to compare the metric data and the threshold. Possible values include: 'Equals', 'NotEquals', 'GreaterThan', 'GreaterThanOrEqual', 'LessThan', 'LessThanOrEqual' + Operator ComparisonOperationType `json:"operator,omitempty"` + // Threshold - the threshold of the metric that triggers the scale action. + Threshold *float64 `json:"threshold,omitempty"` +} + +// MetricValue represents a metric value. +type MetricValue struct { + // TimeStamp - the timestamp for the metric value in ISO 8601 format. + TimeStamp *date.Time `json:"timeStamp,omitempty"` + // Average - the average value in the time range. + Average *float64 `json:"average,omitempty"` + // Minimum - the least value in the time range. + Minimum *float64 `json:"minimum,omitempty"` + // Maximum - the greatest value in the time range. + Maximum *float64 `json:"maximum,omitempty"` + // Total - the sum of all of the values in the time range. + Total *float64 `json:"total,omitempty"` + // Count - the number of samples in the time range. Can be used to determine the number of values that contributed to the average value. + Count *int64 `json:"count,omitempty"` +} + +// Operation microsoft Insights API operation definition. +type Operation struct { + // Name - Operation name: {provider}/{resource}/{operation} + Name *string `json:"name,omitempty"` + // Display - Display metadata associated with the operation. + Display *OperationDisplay `json:"display,omitempty"` +} + +// OperationDisplay display metadata associated with the operation. +type OperationDisplay struct { + // Provider - Service provider: Microsoft.Insights + Provider *string `json:"provider,omitempty"` + // Resource - Resource on which the operation is performed: AlertRules, Autoscale, etc. + Resource *string `json:"resource,omitempty"` + // Operation - Operation type: Read, write, delete, etc. + Operation *string `json:"operation,omitempty"` +} + +// OperationListResult result of the request to list Microsoft.Insights operations. It contains a list of +// operations and a URL link to get the next set of results. +type OperationListResult struct { + autorest.Response `json:"-"` + // Value - List of operations supported by the Microsoft.Insights provider. + Value *[]Operation `json:"value,omitempty"` + // NextLink - URL to get the next set of operation list results if there are any. + NextLink *string `json:"nextLink,omitempty"` +} + +// ProxyOnlyResource a proxy only azure resource object +type ProxyOnlyResource struct { + // ID - Azure resource Id + ID *string `json:"id,omitempty"` + // Name - Azure resource name + Name *string `json:"name,omitempty"` + // Type - Azure resource type + Type *string `json:"type,omitempty"` +} + +// Recurrence the repeating times at which this profile begins. This element is not used if the FixedDate element +// is used. +type Recurrence struct { + // Frequency - the recurrence frequency. How often the schedule profile should take effect. This value must be Week, meaning each week will have the same set of profiles. Possible values include: 'RecurrenceFrequencyNone', 'RecurrenceFrequencySecond', 'RecurrenceFrequencyMinute', 'RecurrenceFrequencyHour', 'RecurrenceFrequencyDay', 'RecurrenceFrequencyWeek', 'RecurrenceFrequencyMonth', 'RecurrenceFrequencyYear' + Frequency RecurrenceFrequency `json:"frequency,omitempty"` + // Schedule - the scheduling constraints for when the profile begins. + Schedule *RecurrentSchedule `json:"schedule,omitempty"` +} + +// RecurrentSchedule the scheduling constraints for when the profile begins. +type RecurrentSchedule struct { + // TimeZone - the timezone for the hours of the profile. Some examples of valid timezones are: Dateline Standard Time, UTC-11, Hawaiian Standard Time, Alaskan Standard Time, Pacific Standard Time (Mexico), Pacific Standard Time, US Mountain Standard Time, Mountain Standard Time (Mexico), Mountain Standard Time, Central America Standard Time, Central Standard Time, Central Standard Time (Mexico), Canada Central Standard Time, SA Pacific Standard Time, Eastern Standard Time, US Eastern Standard Time, Venezuela Standard Time, Paraguay Standard Time, Atlantic Standard Time, Central Brazilian Standard Time, SA Western Standard Time, Pacific SA Standard Time, Newfoundland Standard Time, E. South America Standard Time, Argentina Standard Time, SA Eastern Standard Time, Greenland Standard Time, Montevideo Standard Time, Bahia Standard Time, UTC-02, Mid-Atlantic Standard Time, Azores Standard Time, Cape Verde Standard Time, Morocco Standard Time, UTC, GMT Standard Time, Greenwich Standard Time, W. Europe Standard Time, Central Europe Standard Time, Romance Standard Time, Central European Standard Time, W. Central Africa Standard Time, Namibia Standard Time, Jordan Standard Time, GTB Standard Time, Middle East Standard Time, Egypt Standard Time, Syria Standard Time, E. Europe Standard Time, South Africa Standard Time, FLE Standard Time, Turkey Standard Time, Israel Standard Time, Kaliningrad Standard Time, Libya Standard Time, Arabic Standard Time, Arab Standard Time, Belarus Standard Time, Russian Standard Time, E. Africa Standard Time, Iran Standard Time, Arabian Standard Time, Azerbaijan Standard Time, Russia Time Zone 3, Mauritius Standard Time, Georgian Standard Time, Caucasus Standard Time, Afghanistan Standard Time, West Asia Standard Time, Ekaterinburg Standard Time, Pakistan Standard Time, India Standard Time, Sri Lanka Standard Time, Nepal Standard Time, Central Asia Standard Time, Bangladesh Standard Time, N. Central Asia Standard Time, Myanmar Standard Time, SE Asia Standard Time, North Asia Standard Time, China Standard Time, North Asia East Standard Time, Singapore Standard Time, W. Australia Standard Time, Taipei Standard Time, Ulaanbaatar Standard Time, Tokyo Standard Time, Korea Standard Time, Yakutsk Standard Time, Cen. Australia Standard Time, AUS Central Standard Time, E. Australia Standard Time, AUS Eastern Standard Time, West Pacific Standard Time, Tasmania Standard Time, Magadan Standard Time, Vladivostok Standard Time, Russia Time Zone 10, Central Pacific Standard Time, Russia Time Zone 11, New Zealand Standard Time, UTC+12, Fiji Standard Time, Kamchatka Standard Time, Tonga Standard Time, Samoa Standard Time, Line Islands Standard Time + TimeZone *string `json:"timeZone,omitempty"` + // Days - the collection of days that the profile takes effect on. Possible values are Sunday through Saturday. + Days *[]string `json:"days,omitempty"` + // Hours - A collection of hours that the profile takes effect on. Values supported are 0 to 23 on the 24-hour clock (AM/PM times are not supported). + Hours *[]int32 `json:"hours,omitempty"` + // Minutes - A collection of minutes at which the profile takes effect at. + Minutes *[]int32 `json:"minutes,omitempty"` +} + +// Resource an azure resource object +type Resource struct { + // ID - Azure resource Id + ID *string `json:"id,omitempty"` + // Name - Azure resource name + Name *string `json:"name,omitempty"` + // Type - Azure resource type + Type *string `json:"type,omitempty"` + // Location - Resource location + Location *string `json:"location,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for Resource. +func (r Resource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if r.ID != nil { + objectMap["id"] = r.ID + } + if r.Name != nil { + objectMap["name"] = r.Name + } + if r.Type != nil { + objectMap["type"] = r.Type + } + if r.Location != nil { + objectMap["location"] = r.Location + } + if r.Tags != nil { + objectMap["tags"] = r.Tags + } + return json.Marshal(objectMap) +} + +// Response the response to a metrics query. +type Response struct { + autorest.Response `json:"-"` + // Cost - The integer value representing the cost of the query, for data case. + Cost *float64 `json:"cost,omitempty"` + // Timespan - The timespan for which the data was retrieved. Its value consists of two datatimes concatenated, separated by '/'. This may be adjusted in the future and returned back from what was originally requested. + Timespan *string `json:"timespan,omitempty"` + // Interval - The interval (window size) for which the metric data was returned in. This may be adjusted in the future and returned back from what was originally requested. This is not present if a metadata request was made. + Interval *string `json:"interval,omitempty"` + // Value - the value of the collection. + Value *[]Metric `json:"value,omitempty"` +} + +// RetentionPolicy specifies the retention policy for the log. +type RetentionPolicy struct { + // Enabled - a value indicating whether the retention policy is enabled. + Enabled *bool `json:"enabled,omitempty"` + // Days - the number of days for the retention in days. A value of 0 will retain the events indefinitely. + Days *int32 `json:"days,omitempty"` +} + +// BasicRuleAction the action that is performed when the alert rule becomes active, and when an alert condition is +// resolved. +type BasicRuleAction interface { + AsRuleEmailAction() (*RuleEmailAction, bool) + AsRuleWebhookAction() (*RuleWebhookAction, bool) + AsRuleAction() (*RuleAction, bool) +} + +// RuleAction the action that is performed when the alert rule becomes active, and when an alert condition is +// resolved. +type RuleAction struct { + // OdataType - Possible values include: 'OdataTypeRuleAction', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction' + OdataType OdataTypeBasicRuleAction `json:"odata.type,omitempty"` +} + +func unmarshalBasicRuleAction(body []byte) (BasicRuleAction, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["odata.type"] { + case string(OdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction): + var rea RuleEmailAction + err := json.Unmarshal(body, &rea) + return rea, err + case string(OdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction): + var rwa RuleWebhookAction + err := json.Unmarshal(body, &rwa) + return rwa, err + default: + var ra RuleAction + err := json.Unmarshal(body, &ra) + return ra, err + } +} +func unmarshalBasicRuleActionArray(body []byte) ([]BasicRuleAction, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + raArray := make([]BasicRuleAction, len(rawMessages)) + + for index, rawMessage := range rawMessages { + ra, err := unmarshalBasicRuleAction(*rawMessage) + if err != nil { + return nil, err + } + raArray[index] = ra + } + return raArray, nil +} + +// MarshalJSON is the custom marshaler for RuleAction. +func (ra RuleAction) MarshalJSON() ([]byte, error) { + ra.OdataType = OdataTypeRuleAction + objectMap := make(map[string]interface{}) + objectMap["odata.type"] = ra.OdataType + return json.Marshal(objectMap) +} + +// AsRuleEmailAction is the BasicRuleAction implementation for RuleAction. +func (ra RuleAction) AsRuleEmailAction() (*RuleEmailAction, bool) { + return nil, false +} + +// AsRuleWebhookAction is the BasicRuleAction implementation for RuleAction. +func (ra RuleAction) AsRuleWebhookAction() (*RuleWebhookAction, bool) { + return nil, false +} + +// AsRuleAction is the BasicRuleAction implementation for RuleAction. +func (ra RuleAction) AsRuleAction() (*RuleAction, bool) { + return &ra, true +} + +// AsBasicRuleAction is the BasicRuleAction implementation for RuleAction. +func (ra RuleAction) AsBasicRuleAction() (BasicRuleAction, bool) { + return &ra, true +} + +// BasicRuleCondition the condition that results in the alert rule being activated. +type BasicRuleCondition interface { + AsThresholdRuleCondition() (*ThresholdRuleCondition, bool) + AsLocationThresholdRuleCondition() (*LocationThresholdRuleCondition, bool) + AsManagementEventRuleCondition() (*ManagementEventRuleCondition, bool) + AsRuleCondition() (*RuleCondition, bool) +} + +// RuleCondition the condition that results in the alert rule being activated. +type RuleCondition struct { + // DataSource - the resource from which the rule collects its data. For this type dataSource will always be of type RuleMetricDataSource. + DataSource BasicRuleDataSource `json:"dataSource,omitempty"` + // OdataType - Possible values include: 'OdataTypeRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition' + OdataType OdataTypeBasicRuleCondition `json:"odata.type,omitempty"` +} + +func unmarshalBasicRuleCondition(body []byte) (BasicRuleCondition, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["odata.type"] { + case string(OdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition): + var trc ThresholdRuleCondition + err := json.Unmarshal(body, &trc) + return trc, err + case string(OdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition): + var ltrc LocationThresholdRuleCondition + err := json.Unmarshal(body, <rc) + return ltrc, err + case string(OdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition): + var merc ManagementEventRuleCondition + err := json.Unmarshal(body, &merc) + return merc, err + default: + var rc RuleCondition + err := json.Unmarshal(body, &rc) + return rc, err + } +} +func unmarshalBasicRuleConditionArray(body []byte) ([]BasicRuleCondition, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + rcArray := make([]BasicRuleCondition, len(rawMessages)) + + for index, rawMessage := range rawMessages { + rc, err := unmarshalBasicRuleCondition(*rawMessage) + if err != nil { + return nil, err + } + rcArray[index] = rc + } + return rcArray, nil +} + +// MarshalJSON is the custom marshaler for RuleCondition. +func (rc RuleCondition) MarshalJSON() ([]byte, error) { + rc.OdataType = OdataTypeRuleCondition + objectMap := make(map[string]interface{}) + objectMap["dataSource"] = rc.DataSource + objectMap["odata.type"] = rc.OdataType + return json.Marshal(objectMap) +} + +// AsThresholdRuleCondition is the BasicRuleCondition implementation for RuleCondition. +func (rc RuleCondition) AsThresholdRuleCondition() (*ThresholdRuleCondition, bool) { + return nil, false +} + +// AsLocationThresholdRuleCondition is the BasicRuleCondition implementation for RuleCondition. +func (rc RuleCondition) AsLocationThresholdRuleCondition() (*LocationThresholdRuleCondition, bool) { + return nil, false +} + +// AsManagementEventRuleCondition is the BasicRuleCondition implementation for RuleCondition. +func (rc RuleCondition) AsManagementEventRuleCondition() (*ManagementEventRuleCondition, bool) { + return nil, false +} + +// AsRuleCondition is the BasicRuleCondition implementation for RuleCondition. +func (rc RuleCondition) AsRuleCondition() (*RuleCondition, bool) { + return &rc, true +} + +// AsBasicRuleCondition is the BasicRuleCondition implementation for RuleCondition. +func (rc RuleCondition) AsBasicRuleCondition() (BasicRuleCondition, bool) { + return &rc, true +} + +// UnmarshalJSON is the custom unmarshaler for RuleCondition struct. +func (rc *RuleCondition) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "dataSource": + if v != nil { + dataSource, err := unmarshalBasicRuleDataSource(*v) + if err != nil { + return err + } + rc.DataSource = dataSource + } + case "odata.type": + if v != nil { + var odataType OdataTypeBasicRuleCondition + err = json.Unmarshal(*v, &odataType) + if err != nil { + return err + } + rc.OdataType = odataType + } + } + } + + return nil +} + +// BasicRuleDataSource the resource from which the rule collects its data. +type BasicRuleDataSource interface { + AsRuleMetricDataSource() (*RuleMetricDataSource, bool) + AsRuleManagementEventDataSource() (*RuleManagementEventDataSource, bool) + AsRuleDataSource() (*RuleDataSource, bool) +} + +// RuleDataSource the resource from which the rule collects its data. +type RuleDataSource struct { + // ResourceURI - the resource identifier of the resource the rule monitors. **NOTE**: this property cannot be updated for an existing rule. + ResourceURI *string `json:"resourceUri,omitempty"` + // OdataType - Possible values include: 'OdataTypeRuleDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource' + OdataType OdataType `json:"odata.type,omitempty"` +} + +func unmarshalBasicRuleDataSource(body []byte) (BasicRuleDataSource, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["odata.type"] { + case string(OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource): + var rmds RuleMetricDataSource + err := json.Unmarshal(body, &rmds) + return rmds, err + case string(OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource): + var rmeds RuleManagementEventDataSource + err := json.Unmarshal(body, &rmeds) + return rmeds, err + default: + var rds RuleDataSource + err := json.Unmarshal(body, &rds) + return rds, err + } +} +func unmarshalBasicRuleDataSourceArray(body []byte) ([]BasicRuleDataSource, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + rdsArray := make([]BasicRuleDataSource, len(rawMessages)) + + for index, rawMessage := range rawMessages { + rds, err := unmarshalBasicRuleDataSource(*rawMessage) + if err != nil { + return nil, err + } + rdsArray[index] = rds + } + return rdsArray, nil +} + +// MarshalJSON is the custom marshaler for RuleDataSource. +func (rds RuleDataSource) MarshalJSON() ([]byte, error) { + rds.OdataType = OdataTypeRuleDataSource + objectMap := make(map[string]interface{}) + if rds.ResourceURI != nil { + objectMap["resourceUri"] = rds.ResourceURI + } + objectMap["odata.type"] = rds.OdataType + return json.Marshal(objectMap) +} + +// AsRuleMetricDataSource is the BasicRuleDataSource implementation for RuleDataSource. +func (rds RuleDataSource) AsRuleMetricDataSource() (*RuleMetricDataSource, bool) { + return nil, false +} + +// AsRuleManagementEventDataSource is the BasicRuleDataSource implementation for RuleDataSource. +func (rds RuleDataSource) AsRuleManagementEventDataSource() (*RuleManagementEventDataSource, bool) { + return nil, false +} + +// AsRuleDataSource is the BasicRuleDataSource implementation for RuleDataSource. +func (rds RuleDataSource) AsRuleDataSource() (*RuleDataSource, bool) { + return &rds, true +} + +// AsBasicRuleDataSource is the BasicRuleDataSource implementation for RuleDataSource. +func (rds RuleDataSource) AsBasicRuleDataSource() (BasicRuleDataSource, bool) { + return &rds, true +} + +// RuleEmailAction specifies the action to send email when the rule condition is evaluated. The discriminator is +// always RuleEmailAction in this case. +type RuleEmailAction struct { + // SendToServiceOwners - Whether the administrators (service and co-administrators) of the service should be notified when the alert is activated. + SendToServiceOwners *bool `json:"sendToServiceOwners,omitempty"` + // CustomEmails - the list of administrator's custom email addresses to notify of the activation of the alert. + CustomEmails *[]string `json:"customEmails,omitempty"` + // OdataType - Possible values include: 'OdataTypeRuleAction', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction' + OdataType OdataTypeBasicRuleAction `json:"odata.type,omitempty"` +} + +// MarshalJSON is the custom marshaler for RuleEmailAction. +func (rea RuleEmailAction) MarshalJSON() ([]byte, error) { + rea.OdataType = OdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction + objectMap := make(map[string]interface{}) + if rea.SendToServiceOwners != nil { + objectMap["sendToServiceOwners"] = rea.SendToServiceOwners + } + if rea.CustomEmails != nil { + objectMap["customEmails"] = rea.CustomEmails + } + objectMap["odata.type"] = rea.OdataType + return json.Marshal(objectMap) +} + +// AsRuleEmailAction is the BasicRuleAction implementation for RuleEmailAction. +func (rea RuleEmailAction) AsRuleEmailAction() (*RuleEmailAction, bool) { + return &rea, true +} + +// AsRuleWebhookAction is the BasicRuleAction implementation for RuleEmailAction. +func (rea RuleEmailAction) AsRuleWebhookAction() (*RuleWebhookAction, bool) { + return nil, false +} + +// AsRuleAction is the BasicRuleAction implementation for RuleEmailAction. +func (rea RuleEmailAction) AsRuleAction() (*RuleAction, bool) { + return nil, false +} + +// AsBasicRuleAction is the BasicRuleAction implementation for RuleEmailAction. +func (rea RuleEmailAction) AsBasicRuleAction() (BasicRuleAction, bool) { + return &rea, true +} + +// RuleManagementEventClaimsDataSource the claims for a rule management event data source. +type RuleManagementEventClaimsDataSource struct { + // EmailAddress - the email address. + EmailAddress *string `json:"emailAddress,omitempty"` +} + +// RuleManagementEventDataSource a rule management event data source. The discriminator fields is always +// RuleManagementEventDataSource in this case. +type RuleManagementEventDataSource struct { + // EventName - the event name. + EventName *string `json:"eventName,omitempty"` + // EventSource - the event source. + EventSource *string `json:"eventSource,omitempty"` + // Level - the level. + Level *string `json:"level,omitempty"` + // OperationName - The name of the operation that should be checked for. If no name is provided, any operation will match. + OperationName *string `json:"operationName,omitempty"` + // ResourceGroupName - the resource group name. + ResourceGroupName *string `json:"resourceGroupName,omitempty"` + // ResourceProviderName - the resource provider name. + ResourceProviderName *string `json:"resourceProviderName,omitempty"` + // Status - The status of the operation that should be checked for. If no status is provided, any status will match. + Status *string `json:"status,omitempty"` + // SubStatus - the substatus. + SubStatus *string `json:"subStatus,omitempty"` + // Claims - the claims. + Claims *RuleManagementEventClaimsDataSource `json:"claims,omitempty"` + // ResourceURI - the resource identifier of the resource the rule monitors. **NOTE**: this property cannot be updated for an existing rule. + ResourceURI *string `json:"resourceUri,omitempty"` + // OdataType - Possible values include: 'OdataTypeRuleDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource' + OdataType OdataType `json:"odata.type,omitempty"` +} + +// MarshalJSON is the custom marshaler for RuleManagementEventDataSource. +func (rmeds RuleManagementEventDataSource) MarshalJSON() ([]byte, error) { + rmeds.OdataType = OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource + objectMap := make(map[string]interface{}) + if rmeds.EventName != nil { + objectMap["eventName"] = rmeds.EventName + } + if rmeds.EventSource != nil { + objectMap["eventSource"] = rmeds.EventSource + } + if rmeds.Level != nil { + objectMap["level"] = rmeds.Level + } + if rmeds.OperationName != nil { + objectMap["operationName"] = rmeds.OperationName + } + if rmeds.ResourceGroupName != nil { + objectMap["resourceGroupName"] = rmeds.ResourceGroupName + } + if rmeds.ResourceProviderName != nil { + objectMap["resourceProviderName"] = rmeds.ResourceProviderName + } + if rmeds.Status != nil { + objectMap["status"] = rmeds.Status + } + if rmeds.SubStatus != nil { + objectMap["subStatus"] = rmeds.SubStatus + } + if rmeds.Claims != nil { + objectMap["claims"] = rmeds.Claims + } + if rmeds.ResourceURI != nil { + objectMap["resourceUri"] = rmeds.ResourceURI + } + objectMap["odata.type"] = rmeds.OdataType + return json.Marshal(objectMap) +} + +// AsRuleMetricDataSource is the BasicRuleDataSource implementation for RuleManagementEventDataSource. +func (rmeds RuleManagementEventDataSource) AsRuleMetricDataSource() (*RuleMetricDataSource, bool) { + return nil, false +} + +// AsRuleManagementEventDataSource is the BasicRuleDataSource implementation for RuleManagementEventDataSource. +func (rmeds RuleManagementEventDataSource) AsRuleManagementEventDataSource() (*RuleManagementEventDataSource, bool) { + return &rmeds, true +} + +// AsRuleDataSource is the BasicRuleDataSource implementation for RuleManagementEventDataSource. +func (rmeds RuleManagementEventDataSource) AsRuleDataSource() (*RuleDataSource, bool) { + return nil, false +} + +// AsBasicRuleDataSource is the BasicRuleDataSource implementation for RuleManagementEventDataSource. +func (rmeds RuleManagementEventDataSource) AsBasicRuleDataSource() (BasicRuleDataSource, bool) { + return &rmeds, true +} + +// RuleMetricDataSource a rule metric data source. The discriminator value is always RuleMetricDataSource in this +// case. +type RuleMetricDataSource struct { + // MetricName - the name of the metric that defines what the rule monitors. + MetricName *string `json:"metricName,omitempty"` + // ResourceURI - the resource identifier of the resource the rule monitors. **NOTE**: this property cannot be updated for an existing rule. + ResourceURI *string `json:"resourceUri,omitempty"` + // OdataType - Possible values include: 'OdataTypeRuleDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource' + OdataType OdataType `json:"odata.type,omitempty"` +} + +// MarshalJSON is the custom marshaler for RuleMetricDataSource. +func (rmds RuleMetricDataSource) MarshalJSON() ([]byte, error) { + rmds.OdataType = OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource + objectMap := make(map[string]interface{}) + if rmds.MetricName != nil { + objectMap["metricName"] = rmds.MetricName + } + if rmds.ResourceURI != nil { + objectMap["resourceUri"] = rmds.ResourceURI + } + objectMap["odata.type"] = rmds.OdataType + return json.Marshal(objectMap) +} + +// AsRuleMetricDataSource is the BasicRuleDataSource implementation for RuleMetricDataSource. +func (rmds RuleMetricDataSource) AsRuleMetricDataSource() (*RuleMetricDataSource, bool) { + return &rmds, true +} + +// AsRuleManagementEventDataSource is the BasicRuleDataSource implementation for RuleMetricDataSource. +func (rmds RuleMetricDataSource) AsRuleManagementEventDataSource() (*RuleManagementEventDataSource, bool) { + return nil, false +} + +// AsRuleDataSource is the BasicRuleDataSource implementation for RuleMetricDataSource. +func (rmds RuleMetricDataSource) AsRuleDataSource() (*RuleDataSource, bool) { + return nil, false +} + +// AsBasicRuleDataSource is the BasicRuleDataSource implementation for RuleMetricDataSource. +func (rmds RuleMetricDataSource) AsBasicRuleDataSource() (BasicRuleDataSource, bool) { + return &rmds, true +} + +// RuleWebhookAction specifies the action to post to service when the rule condition is evaluated. The +// discriminator is always RuleWebhookAction in this case. +type RuleWebhookAction struct { + // ServiceURI - the service uri to Post the notification when the alert activates or resolves. + ServiceURI *string `json:"serviceUri,omitempty"` + // Properties - the dictionary of custom properties to include with the post operation. These data are appended to the webhook payload. + Properties map[string]*string `json:"properties"` + // OdataType - Possible values include: 'OdataTypeRuleAction', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction' + OdataType OdataTypeBasicRuleAction `json:"odata.type,omitempty"` +} + +// MarshalJSON is the custom marshaler for RuleWebhookAction. +func (rwa RuleWebhookAction) MarshalJSON() ([]byte, error) { + rwa.OdataType = OdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction + objectMap := make(map[string]interface{}) + if rwa.ServiceURI != nil { + objectMap["serviceUri"] = rwa.ServiceURI + } + if rwa.Properties != nil { + objectMap["properties"] = rwa.Properties + } + objectMap["odata.type"] = rwa.OdataType + return json.Marshal(objectMap) +} + +// AsRuleEmailAction is the BasicRuleAction implementation for RuleWebhookAction. +func (rwa RuleWebhookAction) AsRuleEmailAction() (*RuleEmailAction, bool) { + return nil, false +} + +// AsRuleWebhookAction is the BasicRuleAction implementation for RuleWebhookAction. +func (rwa RuleWebhookAction) AsRuleWebhookAction() (*RuleWebhookAction, bool) { + return &rwa, true +} + +// AsRuleAction is the BasicRuleAction implementation for RuleWebhookAction. +func (rwa RuleWebhookAction) AsRuleAction() (*RuleAction, bool) { + return nil, false +} + +// AsBasicRuleAction is the BasicRuleAction implementation for RuleWebhookAction. +func (rwa RuleWebhookAction) AsBasicRuleAction() (BasicRuleAction, bool) { + return &rwa, true +} + +// ScaleAction the parameters for the scaling action. +type ScaleAction struct { + // Direction - the scale direction. Whether the scaling action increases or decreases the number of instances. Possible values include: 'ScaleDirectionNone', 'ScaleDirectionIncrease', 'ScaleDirectionDecrease' + Direction ScaleDirection `json:"direction,omitempty"` + // Type - the type of action that should occur when the scale rule fires. Possible values include: 'ChangeCount', 'PercentChangeCount', 'ExactCount' + Type ScaleType `json:"type,omitempty"` + // Value - the number of instances that are involved in the scaling action. This value must be 1 or greater. The default value is 1. + Value *string `json:"value,omitempty"` + // Cooldown - the amount of time to wait since the last scaling action before this action occurs. It must be between 1 week and 1 minute in ISO 8601 format. + Cooldown *string `json:"cooldown,omitempty"` +} + +// ScaleCapacity the number of instances that can be used during this profile. +type ScaleCapacity struct { + // Minimum - the minimum number of instances for the resource. + Minimum *string `json:"minimum,omitempty"` + // Maximum - the maximum number of instances for the resource. The actual maximum number of instances is limited by the cores that are available in the subscription. + Maximum *string `json:"maximum,omitempty"` + // Default - the number of instances that will be set if metrics are not available for evaluation. The default is only used if the current instance count is lower than the default. + Default *string `json:"default,omitempty"` +} + +// ScaleRule a rule that provide the triggers and parameters for the scaling action. +type ScaleRule struct { + // MetricTrigger - the trigger that results in a scaling action. + MetricTrigger *MetricTrigger `json:"metricTrigger,omitempty"` + // ScaleAction - the parameters for the scaling action. + ScaleAction *ScaleAction `json:"scaleAction,omitempty"` +} + +// SenderAuthorization the authorization used by the user who has performed the operation that led to this event. +// This captures the RBAC properties of the event. These usually include the 'action', 'role' and the 'scope' +type SenderAuthorization struct { + // Action - the permissible actions. For instance: microsoft.support/supporttickets/write + Action *string `json:"action,omitempty"` + // Role - the role of the user. For instance: Subscription Admin + Role *string `json:"role,omitempty"` + // Scope - the scope. + Scope *string `json:"scope,omitempty"` +} + +// SmsReceiver an SMS receiver. +type SmsReceiver struct { + // Name - The name of the SMS receiver. Names must be unique across all receivers within an action group. + Name *string `json:"name,omitempty"` + // CountryCode - The country code of the SMS receiver. + CountryCode *string `json:"countryCode,omitempty"` + // PhoneNumber - The phone number of the SMS receiver. + PhoneNumber *string `json:"phoneNumber,omitempty"` + // Status - The status of the receiver. Possible values include: 'NotSpecified', 'Enabled', 'Disabled' + Status ReceiverStatus `json:"status,omitempty"` +} + +// ThresholdRuleCondition a rule condition based on a metric crossing a threshold. +type ThresholdRuleCondition struct { + // Operator - the operator used to compare the data and the threshold. Possible values include: 'ConditionOperatorGreaterThan', 'ConditionOperatorGreaterThanOrEqual', 'ConditionOperatorLessThan', 'ConditionOperatorLessThanOrEqual' + Operator ConditionOperator `json:"operator,omitempty"` + // Threshold - the threshold value that activates the alert. + Threshold *float64 `json:"threshold,omitempty"` + // WindowSize - the period of time (in ISO 8601 duration format) that is used to monitor alert activity based on the threshold. If specified then it must be between 5 minutes and 1 day. + WindowSize *string `json:"windowSize,omitempty"` + // TimeAggregation - the time aggregation operator. How the data that are collected should be combined over time. The default value is the PrimaryAggregationType of the Metric. Possible values include: 'TimeAggregationOperatorAverage', 'TimeAggregationOperatorMinimum', 'TimeAggregationOperatorMaximum', 'TimeAggregationOperatorTotal', 'TimeAggregationOperatorLast' + TimeAggregation TimeAggregationOperator `json:"timeAggregation,omitempty"` + // DataSource - the resource from which the rule collects its data. For this type dataSource will always be of type RuleMetricDataSource. + DataSource BasicRuleDataSource `json:"dataSource,omitempty"` + // OdataType - Possible values include: 'OdataTypeRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition' + OdataType OdataTypeBasicRuleCondition `json:"odata.type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ThresholdRuleCondition. +func (trc ThresholdRuleCondition) MarshalJSON() ([]byte, error) { + trc.OdataType = OdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition + objectMap := make(map[string]interface{}) + objectMap["operator"] = trc.Operator + if trc.Threshold != nil { + objectMap["threshold"] = trc.Threshold + } + if trc.WindowSize != nil { + objectMap["windowSize"] = trc.WindowSize + } + objectMap["timeAggregation"] = trc.TimeAggregation + objectMap["dataSource"] = trc.DataSource + objectMap["odata.type"] = trc.OdataType + return json.Marshal(objectMap) +} + +// AsThresholdRuleCondition is the BasicRuleCondition implementation for ThresholdRuleCondition. +func (trc ThresholdRuleCondition) AsThresholdRuleCondition() (*ThresholdRuleCondition, bool) { + return &trc, true +} + +// AsLocationThresholdRuleCondition is the BasicRuleCondition implementation for ThresholdRuleCondition. +func (trc ThresholdRuleCondition) AsLocationThresholdRuleCondition() (*LocationThresholdRuleCondition, bool) { + return nil, false +} + +// AsManagementEventRuleCondition is the BasicRuleCondition implementation for ThresholdRuleCondition. +func (trc ThresholdRuleCondition) AsManagementEventRuleCondition() (*ManagementEventRuleCondition, bool) { + return nil, false +} + +// AsRuleCondition is the BasicRuleCondition implementation for ThresholdRuleCondition. +func (trc ThresholdRuleCondition) AsRuleCondition() (*RuleCondition, bool) { + return nil, false +} + +// AsBasicRuleCondition is the BasicRuleCondition implementation for ThresholdRuleCondition. +func (trc ThresholdRuleCondition) AsBasicRuleCondition() (BasicRuleCondition, bool) { + return &trc, true +} + +// UnmarshalJSON is the custom unmarshaler for ThresholdRuleCondition struct. +func (trc *ThresholdRuleCondition) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "operator": + if v != nil { + var operator ConditionOperator + err = json.Unmarshal(*v, &operator) + if err != nil { + return err + } + trc.Operator = operator + } + case "threshold": + if v != nil { + var threshold float64 + err = json.Unmarshal(*v, &threshold) + if err != nil { + return err + } + trc.Threshold = &threshold + } + case "windowSize": + if v != nil { + var windowSize string + err = json.Unmarshal(*v, &windowSize) + if err != nil { + return err + } + trc.WindowSize = &windowSize + } + case "timeAggregation": + if v != nil { + var timeAggregation TimeAggregationOperator + err = json.Unmarshal(*v, &timeAggregation) + if err != nil { + return err + } + trc.TimeAggregation = timeAggregation + } + case "dataSource": + if v != nil { + dataSource, err := unmarshalBasicRuleDataSource(*v) + if err != nil { + return err + } + trc.DataSource = dataSource + } + case "odata.type": + if v != nil { + var odataType OdataTypeBasicRuleCondition + err = json.Unmarshal(*v, &odataType) + if err != nil { + return err + } + trc.OdataType = odataType + } + } + } + + return nil +} + +// TimeSeriesElement a time series result type. The discriminator value is always TimeSeries in this case. +type TimeSeriesElement struct { + // Metadatavalues - the metadata values returned if $filter was specified in the call. + Metadatavalues *[]MetadataValue `json:"metadatavalues,omitempty"` + // Data - An array of data points representing the metric values. This is only returned if a result type of data is specified. + Data *[]MetricValue `json:"data,omitempty"` +} + +// TimeSeriesInformation the time series info needed for calculating the baseline. +type TimeSeriesInformation struct { + // Sensitivities - the list of sensitivities for calculating the baseline. + Sensitivities *[]string `json:"sensitivities,omitempty"` + // Values - The metric values to calculate the baseline. + Values *[]float64 `json:"values,omitempty"` + // Timestamps - the array of timestamps of the baselines. + Timestamps *[]date.Time `json:"timestamps,omitempty"` +} + +// TimeWindow a specific date-time for the profile. +type TimeWindow struct { + // TimeZone - the timezone of the start and end times for the profile. Some examples of valid timezones are: Dateline Standard Time, UTC-11, Hawaiian Standard Time, Alaskan Standard Time, Pacific Standard Time (Mexico), Pacific Standard Time, US Mountain Standard Time, Mountain Standard Time (Mexico), Mountain Standard Time, Central America Standard Time, Central Standard Time, Central Standard Time (Mexico), Canada Central Standard Time, SA Pacific Standard Time, Eastern Standard Time, US Eastern Standard Time, Venezuela Standard Time, Paraguay Standard Time, Atlantic Standard Time, Central Brazilian Standard Time, SA Western Standard Time, Pacific SA Standard Time, Newfoundland Standard Time, E. South America Standard Time, Argentina Standard Time, SA Eastern Standard Time, Greenland Standard Time, Montevideo Standard Time, Bahia Standard Time, UTC-02, Mid-Atlantic Standard Time, Azores Standard Time, Cape Verde Standard Time, Morocco Standard Time, UTC, GMT Standard Time, Greenwich Standard Time, W. Europe Standard Time, Central Europe Standard Time, Romance Standard Time, Central European Standard Time, W. Central Africa Standard Time, Namibia Standard Time, Jordan Standard Time, GTB Standard Time, Middle East Standard Time, Egypt Standard Time, Syria Standard Time, E. Europe Standard Time, South Africa Standard Time, FLE Standard Time, Turkey Standard Time, Israel Standard Time, Kaliningrad Standard Time, Libya Standard Time, Arabic Standard Time, Arab Standard Time, Belarus Standard Time, Russian Standard Time, E. Africa Standard Time, Iran Standard Time, Arabian Standard Time, Azerbaijan Standard Time, Russia Time Zone 3, Mauritius Standard Time, Georgian Standard Time, Caucasus Standard Time, Afghanistan Standard Time, West Asia Standard Time, Ekaterinburg Standard Time, Pakistan Standard Time, India Standard Time, Sri Lanka Standard Time, Nepal Standard Time, Central Asia Standard Time, Bangladesh Standard Time, N. Central Asia Standard Time, Myanmar Standard Time, SE Asia Standard Time, North Asia Standard Time, China Standard Time, North Asia East Standard Time, Singapore Standard Time, W. Australia Standard Time, Taipei Standard Time, Ulaanbaatar Standard Time, Tokyo Standard Time, Korea Standard Time, Yakutsk Standard Time, Cen. Australia Standard Time, AUS Central Standard Time, E. Australia Standard Time, AUS Eastern Standard Time, West Pacific Standard Time, Tasmania Standard Time, Magadan Standard Time, Vladivostok Standard Time, Russia Time Zone 10, Central Pacific Standard Time, Russia Time Zone 11, New Zealand Standard Time, UTC+12, Fiji Standard Time, Kamchatka Standard Time, Tonga Standard Time, Samoa Standard Time, Line Islands Standard Time + TimeZone *string `json:"timeZone,omitempty"` + // Start - the start time for the profile in ISO 8601 format. + Start *date.Time `json:"start,omitempty"` + // End - the end time for the profile in ISO 8601 format. + End *date.Time `json:"end,omitempty"` +} + +// VoiceReceiver a voice receiver. +type VoiceReceiver struct { + // Name - The name of the voice receiver. Names must be unique across all receivers within an action group. + Name *string `json:"name,omitempty"` + // CountryCode - The country code of the voice receiver. + CountryCode *string `json:"countryCode,omitempty"` + // PhoneNumber - The phone number of the voice receiver. + PhoneNumber *string `json:"phoneNumber,omitempty"` +} + +// WebhookNotification webhook notification of an autoscale event. +type WebhookNotification struct { + // ServiceURI - the service address to receive the notification. + ServiceURI *string `json:"serviceUri,omitempty"` + // Properties - a property bag of settings. This value can be empty. + Properties map[string]*string `json:"properties"` +} + +// MarshalJSON is the custom marshaler for WebhookNotification. +func (wn WebhookNotification) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if wn.ServiceURI != nil { + objectMap["serviceUri"] = wn.ServiceURI + } + if wn.Properties != nil { + objectMap["properties"] = wn.Properties + } + return json.Marshal(objectMap) +} + +// WebhookReceiver a webhook receiver. +type WebhookReceiver struct { + // Name - The name of the webhook receiver. Names must be unique across all receivers within an action group. + Name *string `json:"name,omitempty"` + // ServiceURI - The URI where webhooks should be sent. + ServiceURI *string `json:"serviceUri,omitempty"` +} diff --git a/services/monitor/mgmt/2018-03-01/insights/operationsgroup.go b/services/monitor/mgmt/2018-03-01/insights/operationsgroup.go new file mode 100644 index 000000000000..959f11660790 --- /dev/null +++ b/services/monitor/mgmt/2018-03-01/insights/operationsgroup.go @@ -0,0 +1,98 @@ +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" +) + +// OperationsGroupClient is the monitor Management Client +type OperationsGroupClient struct { + BaseClient +} + +// NewOperationsGroupClient creates an instance of the OperationsGroupClient client. +func NewOperationsGroupClient(subscriptionID string) OperationsGroupClient { + return NewOperationsGroupClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewOperationsGroupClientWithBaseURI creates an instance of the OperationsGroupClient client. +func NewOperationsGroupClientWithBaseURI(baseURI string, subscriptionID string) OperationsGroupClient { + return OperationsGroupClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List lists all of the available operations from Microsoft.Insights provider. +func (client OperationsGroupClient) List(ctx context.Context) (result OperationListResult, err error) { + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.OperationsGroupClient", "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.OperationsGroupClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.OperationsGroupClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client OperationsGroupClient) ListPreparer(ctx context.Context) (*http.Request, error) { + const APIVersion = "2015-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/microsoft.insights/operations"), + 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 OperationsGroupClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client OperationsGroupClient) ListResponder(resp *http.Response) (result OperationListResult, 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/monitor/mgmt/2018-03-01/insights/tenantactivitylogs.go b/services/monitor/mgmt/2018-03-01/insights/tenantactivitylogs.go new file mode 100644 index 000000000000..88a53cd2c0d4 --- /dev/null +++ b/services/monitor/mgmt/2018-03-01/insights/tenantactivitylogs.go @@ -0,0 +1,152 @@ +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" +) + +// TenantActivityLogsClient is the monitor Management Client +type TenantActivityLogsClient struct { + BaseClient +} + +// NewTenantActivityLogsClient creates an instance of the TenantActivityLogsClient client. +func NewTenantActivityLogsClient(subscriptionID string) TenantActivityLogsClient { + return NewTenantActivityLogsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewTenantActivityLogsClientWithBaseURI creates an instance of the TenantActivityLogsClient client. +func NewTenantActivityLogsClientWithBaseURI(baseURI string, subscriptionID string) TenantActivityLogsClient { + return TenantActivityLogsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List gets the Activity Logs for the Tenant.
Everything that is applicable to the API to get the Activity Logs for +// the subscription is applicable to this API (the parameters, $filter, etc.).
One thing to point out here is that +// this API does *not* retrieve the logs at the individual subscription of the tenant but only surfaces the logs that +// were generated at the tenant level. +// +// filter is reduces the set of data collected.
The **$filter** is very restricted and allows only the +// following patterns.
- List events for a resource group: $filter=eventTimestamp ge '' and +// eventTimestamp le '' and eventChannels eq 'Admin, Operation' and resourceGroupName eq +// ''.
- List events for resource: $filter=eventTimestamp ge '' and +// eventTimestamp le '' and eventChannels eq 'Admin, Operation' and resourceUri eq ''.
- +// List events for a subscription: $filter=eventTimestamp ge '' and eventTimestamp le '' and +// eventChannels eq 'Admin, Operation'.
- List events for a resource provider: $filter=eventTimestamp ge '' and eventTimestamp le '' and eventChannels eq 'Admin, Operation' and resourceProvider eq +// ''.
- List events for a correlation Id: api-version=2014-04-01&$filter=eventTimestamp +// ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' and eventChannels eq +// 'Admin, Operation' and correlationId eq ''.
**NOTE**: No other syntax is allowed. +// selectParameter is used to fetch events with only the given properties.
The **$select** argument is a comma +// separated list of property names to be returned. Possible values are: *authorization*, *claims*, +// *correlationId*, *description*, *eventDataId*, *eventName*, *eventTimestamp*, *httpRequest*, *level*, +// *operationId*, *operationName*, *properties*, *resourceGroupName*, *resourceProviderName*, *resourceId*, +// *status*, *submissionTimestamp*, *subStatus*, *subscriptionId* +func (client TenantActivityLogsClient) List(ctx context.Context, filter string, selectParameter string) (result EventDataCollectionPage, err error) { + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, filter, selectParameter) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.TenantActivityLogsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.edc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.TenantActivityLogsClient", "List", resp, "Failure sending request") + return + } + + result.edc, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.TenantActivityLogsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client TenantActivityLogsClient) ListPreparer(ctx context.Context, filter string, selectParameter string) (*http.Request, error) { + const APIVersion = "2015-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if len(selectParameter) > 0 { + queryParameters["$select"] = autorest.Encode("query", selectParameter) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/microsoft.insights/eventtypes/management/values"), + 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 TenantActivityLogsClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client TenantActivityLogsClient) ListResponder(resp *http.Response) (result EventDataCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client TenantActivityLogsClient) listNextResults(lastResults EventDataCollection) (result EventDataCollection, err error) { + req, err := lastResults.eventDataCollectionPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "insights.TenantActivityLogsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "insights.TenantActivityLogsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.TenantActivityLogsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client TenantActivityLogsClient) ListComplete(ctx context.Context, filter string, selectParameter string) (result EventDataCollectionIterator, err error) { + result.page, err = client.List(ctx, filter, selectParameter) + return +} diff --git a/services/monitor/mgmt/2018-03-01/insights/version.go b/services/monitor/mgmt/2018-03-01/insights/version.go new file mode 100644 index 000000000000..fdeb26fe1aec --- /dev/null +++ b/services/monitor/mgmt/2018-03-01/insights/version.go @@ -0,0 +1,28 @@ +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. + +// UserAgent returns the UserAgent string to use when sending http.Requests. +func UserAgent() string { + return "Azure-SDK-For-Go/latest services" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "latest" +}