diff --git a/services/appinsights/mgmt/2015-05-01/insights/CHANGELOG.md b/services/appinsights/mgmt/2015-05-01/insights/CHANGELOG.md index 2c3469c874a8..a1ecf841edb0 100644 --- a/services/appinsights/mgmt/2015-05-01/insights/CHANGELOG.md +++ b/services/appinsights/mgmt/2015-05-01/insights/CHANGELOG.md @@ -1,16 +1,2 @@ -# Change History +# Unreleased -## Additive Changes - -### New Funcs - -1. AnnotationsListResult.MarshalJSON() ([]byte, error) -1. ApplicationInsightsComponentAvailableFeatures.MarshalJSON() ([]byte, error) -1. ApplicationInsightsComponentFeature.MarshalJSON() ([]byte, error) -1. ApplicationInsightsComponentFeatureCapabilities.MarshalJSON() ([]byte, error) -1. ApplicationInsightsComponentFeatureCapability.MarshalJSON() ([]byte, error) -1. ApplicationInsightsComponentQuotaStatus.MarshalJSON() ([]byte, error) -1. ApplicationInsightsComponentWebTestLocation.MarshalJSON() ([]byte, error) -1. MyWorkbooksListResult.MarshalJSON() ([]byte, error) -1. WorkItemConfigurationsListResult.MarshalJSON() ([]byte, error) -1. WorkbooksListResult.MarshalJSON() ([]byte, error) diff --git a/services/appinsights/mgmt/2015-05-01/insights/_meta.json b/services/appinsights/mgmt/2015-05-01/insights/_meta.json index a025c80f1f56..5ad16f11fab6 100644 --- a/services/appinsights/mgmt/2015-05-01/insights/_meta.json +++ b/services/appinsights/mgmt/2015-05-01/insights/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "4483c52219e9e8490dabbe53f1fe8005e8f3acd3", "readme": "/_/azure-rest-api-specs/specification/applicationinsights/resource-manager/readme.md", "tag": "package-2015-05", "use": "@microsoft.azure/autorest.go@2.1.183", diff --git a/services/appinsights/mgmt/2015-05-01/insights/analyticsitems.go b/services/appinsights/mgmt/2015-05-01/insights/analyticsitems.go index 4cc774485e47..2e08deb5b096 100644 --- a/services/appinsights/mgmt/2015-05-01/insights/analyticsitems.go +++ b/services/appinsights/mgmt/2015-05-01/insights/analyticsitems.go @@ -55,8 +55,7 @@ func (client AnalyticsItemsClient) Delete(ctx context.Context, resourceGroupName Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("insights.AnalyticsItemsClient", "Delete", err.Error()) } @@ -151,8 +150,7 @@ func (client AnalyticsItemsClient) Get(ctx context.Context, resourceGroupName st Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("insights.AnalyticsItemsClient", "Get", err.Error()) } @@ -251,8 +249,7 @@ func (client AnalyticsItemsClient) List(ctx context.Context, resourceGroupName s Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("insights.AnalyticsItemsClient", "List", err.Error()) } @@ -357,8 +354,7 @@ func (client AnalyticsItemsClient) Put(ctx context.Context, resourceGroupName st Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("insights.AnalyticsItemsClient", "Put", err.Error()) } diff --git a/services/appinsights/mgmt/2015-05-01/insights/annotations.go b/services/appinsights/mgmt/2015-05-01/insights/annotations.go index 44ba919dd8e0..aa31fd7d0e74 100644 --- a/services/appinsights/mgmt/2015-05-01/insights/annotations.go +++ b/services/appinsights/mgmt/2015-05-01/insights/annotations.go @@ -51,8 +51,7 @@ func (client AnnotationsClient) Create(ctx context.Context, resourceGroupName st if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: client.SubscriptionID, Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("insights.AnnotationsClient", "Create", err.Error()) @@ -140,8 +139,7 @@ func (client AnnotationsClient) Delete(ctx context.Context, resourceGroupName st if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: client.SubscriptionID, Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("insights.AnnotationsClient", "Delete", err.Error()) @@ -227,8 +225,7 @@ func (client AnnotationsClient) Get(ctx context.Context, resourceGroupName strin if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: client.SubscriptionID, Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("insights.AnnotationsClient", "Get", err.Error()) @@ -316,8 +313,7 @@ func (client AnnotationsClient) List(ctx context.Context, resourceGroupName stri if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: client.SubscriptionID, Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("insights.AnnotationsClient", "List", err.Error()) diff --git a/services/appinsights/mgmt/2015-05-01/insights/apikeys.go b/services/appinsights/mgmt/2015-05-01/insights/apikeys.go index c82caeeab8fa..ca33d3c4c68d 100644 --- a/services/appinsights/mgmt/2015-05-01/insights/apikeys.go +++ b/services/appinsights/mgmt/2015-05-01/insights/apikeys.go @@ -51,8 +51,7 @@ func (client APIKeysClient) Create(ctx context.Context, resourceGroupName string if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: client.SubscriptionID, Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("insights.APIKeysClient", "Create", err.Error()) @@ -140,8 +139,7 @@ func (client APIKeysClient) Delete(ctx context.Context, resourceGroupName string if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: client.SubscriptionID, Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("insights.APIKeysClient", "Delete", err.Error()) @@ -228,8 +226,7 @@ func (client APIKeysClient) Get(ctx context.Context, resourceGroupName string, r if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: client.SubscriptionID, Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("insights.APIKeysClient", "Get", err.Error()) @@ -315,8 +312,7 @@ func (client APIKeysClient) List(ctx context.Context, resourceGroupName string, if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: client.SubscriptionID, Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("insights.APIKeysClient", "List", err.Error()) diff --git a/services/appinsights/mgmt/2015-05-01/insights/componentavailablefeatures.go b/services/appinsights/mgmt/2015-05-01/insights/componentavailablefeatures.go index 7b824be297a7..997a483b327f 100644 --- a/services/appinsights/mgmt/2015-05-01/insights/componentavailablefeatures.go +++ b/services/appinsights/mgmt/2015-05-01/insights/componentavailablefeatures.go @@ -50,8 +50,7 @@ func (client ComponentAvailableFeaturesClient) Get(ctx context.Context, resource if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: client.SubscriptionID, Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("insights.ComponentAvailableFeaturesClient", "Get", err.Error()) diff --git a/services/appinsights/mgmt/2015-05-01/insights/componentcurrentbillingfeatures.go b/services/appinsights/mgmt/2015-05-01/insights/componentcurrentbillingfeatures.go index 19a1ce42b190..3416a616be9c 100644 --- a/services/appinsights/mgmt/2015-05-01/insights/componentcurrentbillingfeatures.go +++ b/services/appinsights/mgmt/2015-05-01/insights/componentcurrentbillingfeatures.go @@ -50,8 +50,7 @@ func (client ComponentCurrentBillingFeaturesClient) Get(ctx context.Context, res if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: client.SubscriptionID, Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("insights.ComponentCurrentBillingFeaturesClient", "Get", err.Error()) @@ -138,8 +137,7 @@ func (client ComponentCurrentBillingFeaturesClient) Update(ctx context.Context, if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: client.SubscriptionID, Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("insights.ComponentCurrentBillingFeaturesClient", "Update", err.Error()) diff --git a/services/appinsights/mgmt/2015-05-01/insights/componentfeaturecapabilities.go b/services/appinsights/mgmt/2015-05-01/insights/componentfeaturecapabilities.go index d4f7a3cc512e..0620681495e8 100644 --- a/services/appinsights/mgmt/2015-05-01/insights/componentfeaturecapabilities.go +++ b/services/appinsights/mgmt/2015-05-01/insights/componentfeaturecapabilities.go @@ -50,8 +50,7 @@ func (client ComponentFeatureCapabilitiesClient) Get(ctx context.Context, resour if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: client.SubscriptionID, Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("insights.ComponentFeatureCapabilitiesClient", "Get", err.Error()) diff --git a/services/appinsights/mgmt/2015-05-01/insights/componentquotastatus.go b/services/appinsights/mgmt/2015-05-01/insights/componentquotastatus.go index 9a786872f5bc..98d79dda19cd 100644 --- a/services/appinsights/mgmt/2015-05-01/insights/componentquotastatus.go +++ b/services/appinsights/mgmt/2015-05-01/insights/componentquotastatus.go @@ -50,8 +50,7 @@ func (client ComponentQuotaStatusClient) Get(ctx context.Context, resourceGroupN if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: client.SubscriptionID, Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("insights.ComponentQuotaStatusClient", "Get", err.Error()) diff --git a/services/appinsights/mgmt/2015-05-01/insights/components.go b/services/appinsights/mgmt/2015-05-01/insights/components.go index 4a7dab1e5367..687a6d6f6169 100644 --- a/services/appinsights/mgmt/2015-05-01/insights/components.go +++ b/services/appinsights/mgmt/2015-05-01/insights/components.go @@ -51,8 +51,7 @@ func (client ComponentsClient) CreateOrUpdate(ctx context.Context, resourceGroup if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: client.SubscriptionID, Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: insightProperties, @@ -141,8 +140,7 @@ func (client ComponentsClient) Delete(ctx context.Context, resourceGroupName str if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: client.SubscriptionID, Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("insights.ComponentsClient", "Delete", err.Error()) @@ -226,8 +224,7 @@ func (client ComponentsClient) Get(ctx context.Context, resourceGroupName string if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: client.SubscriptionID, Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("insights.ComponentsClient", "Get", err.Error()) @@ -313,8 +310,7 @@ func (client ComponentsClient) GetPurgeStatus(ctx context.Context, resourceGroup if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: client.SubscriptionID, Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("insights.ComponentsClient", "GetPurgeStatus", err.Error()) @@ -518,8 +514,7 @@ func (client ComponentsClient) ListByResourceGroup(ctx context.Context, resource if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: client.SubscriptionID, Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("insights.ComponentsClient", "ListByResourceGroup", err.Error()) @@ -651,8 +646,7 @@ func (client ComponentsClient) Purge(ctx context.Context, resourceGroupName stri if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: client.SubscriptionID, Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: body, @@ -743,8 +737,7 @@ func (client ComponentsClient) UpdateTags(ctx context.Context, resourceGroupName if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: client.SubscriptionID, Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("insights.ComponentsClient", "UpdateTags", err.Error()) diff --git a/services/appinsights/mgmt/2015-05-01/insights/exportconfigurations.go b/services/appinsights/mgmt/2015-05-01/insights/exportconfigurations.go index 668a155a8370..8543b8d411df 100644 --- a/services/appinsights/mgmt/2015-05-01/insights/exportconfigurations.go +++ b/services/appinsights/mgmt/2015-05-01/insights/exportconfigurations.go @@ -52,8 +52,7 @@ func (client ExportConfigurationsClient) Create(ctx context.Context, resourceGro if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: client.SubscriptionID, Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("insights.ExportConfigurationsClient", "Create", err.Error()) @@ -141,8 +140,7 @@ func (client ExportConfigurationsClient) Delete(ctx context.Context, resourceGro if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: client.SubscriptionID, Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("insights.ExportConfigurationsClient", "Delete", err.Error()) @@ -229,8 +227,7 @@ func (client ExportConfigurationsClient) Get(ctx context.Context, resourceGroupN if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: client.SubscriptionID, Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("insights.ExportConfigurationsClient", "Get", err.Error()) @@ -316,8 +313,7 @@ func (client ExportConfigurationsClient) List(ctx context.Context, resourceGroup if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: client.SubscriptionID, Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("insights.ExportConfigurationsClient", "List", err.Error()) @@ -404,8 +400,7 @@ func (client ExportConfigurationsClient) Update(ctx context.Context, resourceGro if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: client.SubscriptionID, Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("insights.ExportConfigurationsClient", "Update", err.Error()) diff --git a/services/appinsights/mgmt/2015-05-01/insights/favorites.go b/services/appinsights/mgmt/2015-05-01/insights/favorites.go index 9edd56e83328..732fca754804 100644 --- a/services/appinsights/mgmt/2015-05-01/insights/favorites.go +++ b/services/appinsights/mgmt/2015-05-01/insights/favorites.go @@ -52,8 +52,7 @@ func (client FavoritesClient) Add(ctx context.Context, resourceGroupName string, if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: client.SubscriptionID, Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("insights.FavoritesClient", "Add", err.Error()) @@ -145,8 +144,7 @@ func (client FavoritesClient) Delete(ctx context.Context, resourceGroupName stri if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: client.SubscriptionID, Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("insights.FavoritesClient", "Delete", err.Error()) @@ -232,8 +230,7 @@ func (client FavoritesClient) Get(ctx context.Context, resourceGroupName string, if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: client.SubscriptionID, Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("insights.FavoritesClient", "Get", err.Error()) @@ -325,8 +322,7 @@ func (client FavoritesClient) List(ctx context.Context, resourceGroupName string if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: client.SubscriptionID, Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("insights.FavoritesClient", "List", err.Error()) @@ -427,8 +423,7 @@ func (client FavoritesClient) Update(ctx context.Context, resourceGroupName stri if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: client.SubscriptionID, Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("insights.FavoritesClient", "Update", err.Error()) diff --git a/services/appinsights/mgmt/2015-05-01/insights/myworkbooks.go b/services/appinsights/mgmt/2015-05-01/insights/myworkbooks.go index 5110ff178a32..0f11b643e8bc 100644 --- a/services/appinsights/mgmt/2015-05-01/insights/myworkbooks.go +++ b/services/appinsights/mgmt/2015-05-01/insights/myworkbooks.go @@ -52,8 +52,7 @@ func (client MyWorkbooksClient) CreateOrUpdate(ctx context.Context, resourceGrou Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workbookProperties, Constraints: []validation.Constraint{{Target: "workbookProperties.MyWorkbookProperties", Name: validation.Null, Rule: false, Chain: []validation.Constraint{{Target: "workbookProperties.MyWorkbookProperties.DisplayName", Name: validation.Null, Rule: true, Chain: nil}, @@ -146,8 +145,7 @@ func (client MyWorkbooksClient) Delete(ctx context.Context, resourceGroupName st Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("insights.MyWorkbooksClient", "Delete", err.Error()) } @@ -231,8 +229,7 @@ func (client MyWorkbooksClient) Get(ctx context.Context, resourceGroupName strin Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("insights.MyWorkbooksClient", "Get", err.Error()) } @@ -320,8 +317,7 @@ func (client MyWorkbooksClient) ListByResourceGroup(ctx context.Context, resourc Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("insights.MyWorkbooksClient", "ListByResourceGroup", err.Error()) } @@ -502,8 +498,7 @@ func (client MyWorkbooksClient) Update(ctx context.Context, resourceGroupName st Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("insights.MyWorkbooksClient", "Update", err.Error()) } diff --git a/services/appinsights/mgmt/2015-05-01/insights/proactivedetectionconfigurations.go b/services/appinsights/mgmt/2015-05-01/insights/proactivedetectionconfigurations.go index 646c0107a4a4..78223d23395b 100644 --- a/services/appinsights/mgmt/2015-05-01/insights/proactivedetectionconfigurations.go +++ b/services/appinsights/mgmt/2015-05-01/insights/proactivedetectionconfigurations.go @@ -52,8 +52,7 @@ func (client ProactiveDetectionConfigurationsClient) Get(ctx context.Context, re if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: client.SubscriptionID, Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("insights.ProactiveDetectionConfigurationsClient", "Get", err.Error()) @@ -139,8 +138,7 @@ func (client ProactiveDetectionConfigurationsClient) List(ctx context.Context, r if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: client.SubscriptionID, Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("insights.ProactiveDetectionConfigurationsClient", "List", err.Error()) @@ -229,8 +227,7 @@ func (client ProactiveDetectionConfigurationsClient) Update(ctx context.Context, if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: client.SubscriptionID, Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("insights.ProactiveDetectionConfigurationsClient", "Update", err.Error()) diff --git a/services/appinsights/mgmt/2015-05-01/insights/webtestlocations.go b/services/appinsights/mgmt/2015-05-01/insights/webtestlocations.go index 84963a68379b..dcb3923ba146 100644 --- a/services/appinsights/mgmt/2015-05-01/insights/webtestlocations.go +++ b/services/appinsights/mgmt/2015-05-01/insights/webtestlocations.go @@ -50,8 +50,7 @@ func (client WebTestLocationsClient) List(ctx context.Context, resourceGroupName if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: client.SubscriptionID, Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("insights.WebTestLocationsClient", "List", err.Error()) diff --git a/services/appinsights/mgmt/2015-05-01/insights/webtests.go b/services/appinsights/mgmt/2015-05-01/insights/webtests.go index 04768305c609..cb9450fdee91 100644 --- a/services/appinsights/mgmt/2015-05-01/insights/webtests.go +++ b/services/appinsights/mgmt/2015-05-01/insights/webtests.go @@ -51,8 +51,7 @@ func (client WebTestsClient) CreateOrUpdate(ctx context.Context, resourceGroupNa if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: client.SubscriptionID, Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: webTestDefinition, @@ -147,8 +146,7 @@ func (client WebTestsClient) Delete(ctx context.Context, resourceGroupName strin Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("insights.WebTestsClient", "Delete", err.Error()) } @@ -230,8 +228,7 @@ func (client WebTestsClient) Get(ctx context.Context, resourceGroupName string, if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: client.SubscriptionID, Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("insights.WebTestsClient", "Get", err.Error()) @@ -435,8 +432,7 @@ func (client WebTestsClient) ListByComponent(ctx context.Context, componentName if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: client.SubscriptionID, Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("insights.WebTestsClient", "ListByComponent", err.Error()) @@ -562,8 +558,7 @@ func (client WebTestsClient) ListByResourceGroup(ctx context.Context, resourceGr if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: client.SubscriptionID, Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("insights.WebTestsClient", "ListByResourceGroup", err.Error()) @@ -690,8 +685,7 @@ func (client WebTestsClient) UpdateTags(ctx context.Context, resourceGroupName s if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: client.SubscriptionID, Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("insights.WebTestsClient", "UpdateTags", err.Error()) diff --git a/services/appinsights/mgmt/2015-05-01/insights/workbooks.go b/services/appinsights/mgmt/2015-05-01/insights/workbooks.go index b11fc21428fd..e30bd2ce8bb4 100644 --- a/services/appinsights/mgmt/2015-05-01/insights/workbooks.go +++ b/services/appinsights/mgmt/2015-05-01/insights/workbooks.go @@ -52,8 +52,7 @@ func (client WorkbooksClient) CreateOrUpdate(ctx context.Context, resourceGroupN Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workbookProperties, Constraints: []validation.Constraint{{Target: "workbookProperties.WorkbookProperties", Name: validation.Null, Rule: false, Chain: []validation.Constraint{{Target: "workbookProperties.WorkbookProperties.Name", Name: validation.Null, Rule: true, Chain: nil}, @@ -148,8 +147,7 @@ func (client WorkbooksClient) Delete(ctx context.Context, resourceGroupName stri Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("insights.WorkbooksClient", "Delete", err.Error()) } @@ -233,8 +231,7 @@ func (client WorkbooksClient) Get(ctx context.Context, resourceGroupName string, Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("insights.WorkbooksClient", "Get", err.Error()) } @@ -322,8 +319,7 @@ func (client WorkbooksClient) ListByResourceGroup(ctx context.Context, resourceG Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("insights.WorkbooksClient", "ListByResourceGroup", err.Error()) } @@ -415,8 +411,7 @@ func (client WorkbooksClient) Update(ctx context.Context, resourceGroupName stri Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("insights.WorkbooksClient", "Update", err.Error()) } diff --git a/services/appinsights/mgmt/2015-05-01/insights/workitemconfigurations.go b/services/appinsights/mgmt/2015-05-01/insights/workitemconfigurations.go index 10c6e0ba0e4a..c46789bddc6e 100644 --- a/services/appinsights/mgmt/2015-05-01/insights/workitemconfigurations.go +++ b/services/appinsights/mgmt/2015-05-01/insights/workitemconfigurations.go @@ -52,8 +52,7 @@ func (client WorkItemConfigurationsClient) Create(ctx context.Context, resourceG if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: client.SubscriptionID, Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("insights.WorkItemConfigurationsClient", "Create", err.Error()) @@ -142,8 +141,7 @@ func (client WorkItemConfigurationsClient) Delete(ctx context.Context, resourceG if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: client.SubscriptionID, Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("insights.WorkItemConfigurationsClient", "Delete", err.Error()) @@ -228,8 +226,7 @@ func (client WorkItemConfigurationsClient) GetDefault(ctx context.Context, resou if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: client.SubscriptionID, Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("insights.WorkItemConfigurationsClient", "GetDefault", err.Error()) @@ -316,8 +313,7 @@ func (client WorkItemConfigurationsClient) GetItem(ctx context.Context, resource if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: client.SubscriptionID, Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("insights.WorkItemConfigurationsClient", "GetItem", err.Error()) @@ -403,8 +399,7 @@ func (client WorkItemConfigurationsClient) List(ctx context.Context, resourceGro if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: client.SubscriptionID, Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("insights.WorkItemConfigurationsClient", "List", err.Error()) @@ -493,8 +488,7 @@ func (client WorkItemConfigurationsClient) UpdateItem(ctx context.Context, resou if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: client.SubscriptionID, Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("insights.WorkItemConfigurationsClient", "UpdateItem", err.Error()) diff --git a/services/preview/appinsights/mgmt/2020-02-02-preview/insights/CHANGELOG.md b/services/preview/appinsights/mgmt/2020-02-02-preview/insights/CHANGELOG.md new file mode 100644 index 000000000000..a1ecf841edb0 --- /dev/null +++ b/services/preview/appinsights/mgmt/2020-02-02-preview/insights/CHANGELOG.md @@ -0,0 +1,2 @@ +# Unreleased + diff --git a/services/preview/appinsights/mgmt/2020-02-02-preview/insights/_meta.json b/services/preview/appinsights/mgmt/2020-02-02-preview/insights/_meta.json new file mode 100644 index 000000000000..a0ef4226fb8b --- /dev/null +++ b/services/preview/appinsights/mgmt/2020-02-02-preview/insights/_meta.json @@ -0,0 +1,11 @@ +{ + "commit": "4483c52219e9e8490dabbe53f1fe8005e8f3acd3", + "readme": "/_/azure-rest-api-specs/specification/applicationinsights/resource-manager/readme.md", + "tag": "package-2020-02-02", + "use": "@microsoft.azure/autorest.go@2.1.183", + "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", + "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.183 --tag=package-2020-02-02 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=V2 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/applicationinsights/resource-manager/readme.md", + "additional_properties": { + "additional_options": "--go --verbose --use-onever --version=V2 --go.license-header=MICROSOFT_MIT_NO_VERSION" + } +} \ No newline at end of file diff --git a/services/preview/appinsights/mgmt/2020-02-02-preview/insights/analyticsitems.go b/services/preview/appinsights/mgmt/2020-02-02-preview/insights/analyticsitems.go new file mode 100644 index 000000000000..2e08deb5b096 --- /dev/null +++ b/services/preview/appinsights/mgmt/2020-02-02-preview/insights/analyticsitems.go @@ -0,0 +1,429 @@ +package insights + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// AnalyticsItemsClient is the composite Swagger for Application Insights Management Client +type AnalyticsItemsClient struct { + BaseClient +} + +// NewAnalyticsItemsClient creates an instance of the AnalyticsItemsClient client. +func NewAnalyticsItemsClient(subscriptionID string) AnalyticsItemsClient { + return NewAnalyticsItemsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewAnalyticsItemsClientWithBaseURI creates an instance of the AnalyticsItemsClient client using a custom endpoint. +// Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewAnalyticsItemsClientWithBaseURI(baseURI string, subscriptionID string) AnalyticsItemsClient { + return AnalyticsItemsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Delete deletes a specific Analytics Items defined within an Application Insights component. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the Application Insights component resource. +// scopePath - enum indicating if this item definition is owned by a specific user or is shared between all +// users with access to the Application Insights component. +// ID - the Id of a specific item defined in the Application Insights component +// name - the name of a specific item defined in the Application Insights component +func (client AnalyticsItemsClient) Delete(ctx context.Context, resourceGroupName string, resourceName string, scopePath ItemScopePath, ID string, name string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AnalyticsItemsClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.AnalyticsItemsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, resourceName, scopePath, ID, name) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.AnalyticsItemsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "insights.AnalyticsItemsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.AnalyticsItemsClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client AnalyticsItemsClient) DeletePreparer(ctx context.Context, resourceGroupName string, resourceName string, scopePath ItemScopePath, ID string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "scopePath": autorest.Encode("path", scopePath), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-05-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(ID) > 0 { + queryParameters["id"] = autorest.Encode("query", ID) + } + if len(name) > 0 { + queryParameters["name"] = autorest.Encode("query", name) + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components/{resourceName}/{scopePath}/item", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client AnalyticsItemsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client AnalyticsItemsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets a specific Analytics Items defined within an Application Insights component. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the Application Insights component resource. +// scopePath - enum indicating if this item definition is owned by a specific user or is shared between all +// users with access to the Application Insights component. +// ID - the Id of a specific item defined in the Application Insights component +// name - the name of a specific item defined in the Application Insights component +func (client AnalyticsItemsClient) Get(ctx context.Context, resourceGroupName string, resourceName string, scopePath ItemScopePath, ID string, name string) (result ApplicationInsightsComponentAnalyticsItem, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AnalyticsItemsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.AnalyticsItemsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, resourceName, scopePath, ID, name) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.AnalyticsItemsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.AnalyticsItemsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.AnalyticsItemsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client AnalyticsItemsClient) GetPreparer(ctx context.Context, resourceGroupName string, resourceName string, scopePath ItemScopePath, ID string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "scopePath": autorest.Encode("path", scopePath), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-05-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(ID) > 0 { + queryParameters["id"] = autorest.Encode("query", ID) + } + if len(name) > 0 { + queryParameters["name"] = autorest.Encode("query", name) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components/{resourceName}/{scopePath}/item", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client AnalyticsItemsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client AnalyticsItemsClient) GetResponder(resp *http.Response) (result ApplicationInsightsComponentAnalyticsItem, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets a list of Analytics Items defined within an Application Insights component. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the Application Insights component resource. +// scopePath - enum indicating if this item definition is owned by a specific user or is shared between all +// users with access to the Application Insights component. +// scope - enum indicating if this item definition is owned by a specific user or is shared between all users +// with access to the Application Insights component. +// typeParameter - enum indicating the type of the Analytics item. +// includeContent - flag indicating whether or not to return the content of each applicable item. If false, +// only return the item information. +func (client AnalyticsItemsClient) List(ctx context.Context, resourceGroupName string, resourceName string, scopePath ItemScopePath, scope ItemScope, typeParameter ItemTypeParameter, includeContent *bool) (result ListApplicationInsightsComponentAnalyticsItem, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AnalyticsItemsClient.List") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.AnalyticsItemsClient", "List", err.Error()) + } + + req, err := client.ListPreparer(ctx, resourceGroupName, resourceName, scopePath, scope, typeParameter, includeContent) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.AnalyticsItemsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.AnalyticsItemsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.AnalyticsItemsClient", "List", resp, "Failure responding to request") + return + } + + return +} + +// ListPreparer prepares the List request. +func (client AnalyticsItemsClient) ListPreparer(ctx context.Context, resourceGroupName string, resourceName string, scopePath ItemScopePath, scope ItemScope, typeParameter ItemTypeParameter, includeContent *bool) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "scopePath": autorest.Encode("path", scopePath), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-05-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(string(scope)) > 0 { + queryParameters["scope"] = autorest.Encode("query", scope) + } else { + queryParameters["scope"] = autorest.Encode("query", "shared") + } + if len(string(typeParameter)) > 0 { + queryParameters["type"] = autorest.Encode("query", typeParameter) + } else { + queryParameters["type"] = autorest.Encode("query", "none") + } + if includeContent != nil { + queryParameters["includeContent"] = autorest.Encode("query", *includeContent) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components/{resourceName}/{scopePath}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client AnalyticsItemsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client AnalyticsItemsClient) ListResponder(resp *http.Response) (result ListApplicationInsightsComponentAnalyticsItem, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Put adds or Updates a specific Analytics Item within an Application Insights component. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the Application Insights component resource. +// scopePath - enum indicating if this item definition is owned by a specific user or is shared between all +// users with access to the Application Insights component. +// itemProperties - properties that need to be specified to create a new item and add it to an Application +// Insights component. +// overrideItem - flag indicating whether or not to force save an item. This allows overriding an item if it +// already exists. +func (client AnalyticsItemsClient) Put(ctx context.Context, resourceGroupName string, resourceName string, scopePath ItemScopePath, itemProperties ApplicationInsightsComponentAnalyticsItem, overrideItem *bool) (result ApplicationInsightsComponentAnalyticsItem, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AnalyticsItemsClient.Put") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.AnalyticsItemsClient", "Put", err.Error()) + } + + req, err := client.PutPreparer(ctx, resourceGroupName, resourceName, scopePath, itemProperties, overrideItem) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.AnalyticsItemsClient", "Put", nil, "Failure preparing request") + return + } + + resp, err := client.PutSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.AnalyticsItemsClient", "Put", resp, "Failure sending request") + return + } + + result, err = client.PutResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.AnalyticsItemsClient", "Put", resp, "Failure responding to request") + return + } + + return +} + +// PutPreparer prepares the Put request. +func (client AnalyticsItemsClient) PutPreparer(ctx context.Context, resourceGroupName string, resourceName string, scopePath ItemScopePath, itemProperties ApplicationInsightsComponentAnalyticsItem, overrideItem *bool) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "scopePath": autorest.Encode("path", scopePath), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-05-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if overrideItem != nil { + queryParameters["overrideItem"] = autorest.Encode("query", *overrideItem) + } + + itemProperties.Version = nil + itemProperties.TimeCreated = nil + itemProperties.TimeModified = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components/{resourceName}/{scopePath}/item", pathParameters), + autorest.WithJSON(itemProperties), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// PutSender sends the Put request. The method will close the +// http.Response Body if it receives an error. +func (client AnalyticsItemsClient) PutSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// PutResponder handles the response to the Put request. The method always +// closes the http.Response Body. +func (client AnalyticsItemsClient) PutResponder(resp *http.Response) (result ApplicationInsightsComponentAnalyticsItem, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/appinsights/mgmt/2020-02-02-preview/insights/annotations.go b/services/preview/appinsights/mgmt/2020-02-02-preview/insights/annotations.go new file mode 100644 index 000000000000..aa31fd7d0e74 --- /dev/null +++ b/services/preview/appinsights/mgmt/2020-02-02-preview/insights/annotations.go @@ -0,0 +1,383 @@ +package insights + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// AnnotationsClient is the composite Swagger for Application Insights Management Client +type AnnotationsClient struct { + BaseClient +} + +// NewAnnotationsClient creates an instance of the AnnotationsClient client. +func NewAnnotationsClient(subscriptionID string) AnnotationsClient { + return NewAnnotationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewAnnotationsClientWithBaseURI creates an instance of the AnnotationsClient client using a custom endpoint. Use +// this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewAnnotationsClientWithBaseURI(baseURI string, subscriptionID string) AnnotationsClient { + return AnnotationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create create an Annotation of an Application Insights component. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the Application Insights component resource. +// annotationProperties - properties that need to be specified to create an annotation of a Application +// Insights component. +func (client AnnotationsClient) Create(ctx context.Context, resourceGroupName string, resourceName string, annotationProperties Annotation) (result ListAnnotation, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AnnotationsClient.Create") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.AnnotationsClient", "Create", err.Error()) + } + + req, err := client.CreatePreparer(ctx, resourceGroupName, resourceName, annotationProperties) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.AnnotationsClient", "Create", nil, "Failure preparing request") + return + } + + resp, err := client.CreateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.AnnotationsClient", "Create", resp, "Failure sending request") + return + } + + result, err = client.CreateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.AnnotationsClient", "Create", resp, "Failure responding to request") + return + } + + return +} + +// CreatePreparer prepares the Create request. +func (client AnnotationsClient) CreatePreparer(ctx context.Context, resourceGroupName string, resourceName string, annotationProperties Annotation) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-05-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/Annotations", pathParameters), + autorest.WithJSON(annotationProperties), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client AnnotationsClient) CreateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client AnnotationsClient) CreateResponder(resp *http.Response) (result ListAnnotation, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete delete an Annotation of an Application Insights component. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the Application Insights component resource. +// annotationID - the unique annotation ID. This is unique within a Application Insights component. +func (client AnnotationsClient) Delete(ctx context.Context, resourceGroupName string, resourceName string, annotationID string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AnnotationsClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.AnnotationsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, resourceName, annotationID) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.AnnotationsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "insights.AnnotationsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.AnnotationsClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client AnnotationsClient) DeletePreparer(ctx context.Context, resourceGroupName string, resourceName string, annotationID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "annotationId": autorest.Encode("path", annotationID), + "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}/Annotations/{annotationId}", 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 AnnotationsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client AnnotationsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get the annotation for given id. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the Application Insights component resource. +// annotationID - the unique annotation ID. This is unique within a Application Insights component. +func (client AnnotationsClient) Get(ctx context.Context, resourceGroupName string, resourceName string, annotationID string) (result ListAnnotation, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AnnotationsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.AnnotationsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, resourceName, annotationID) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.AnnotationsClient", "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.AnnotationsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.AnnotationsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client AnnotationsClient) GetPreparer(ctx context.Context, resourceGroupName string, resourceName string, annotationID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "annotationId": autorest.Encode("path", annotationID), + "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}/Annotations/{annotationId}", 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 AnnotationsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client AnnotationsClient) GetResponder(resp *http.Response) (result ListAnnotation, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets the list of annotations for a component for given time range +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the Application Insights component resource. +// start - the start time to query from for annotations, cannot be older than 90 days from current date. +// end - the end time to query for annotations. +func (client AnnotationsClient) List(ctx context.Context, resourceGroupName string, resourceName string, start string, end string) (result AnnotationsListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AnnotationsClient.List") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.AnnotationsClient", "List", err.Error()) + } + + req, err := client.ListPreparer(ctx, resourceGroupName, resourceName, start, end) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.AnnotationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.AnnotationsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.AnnotationsClient", "List", resp, "Failure responding to request") + return + } + + return +} + +// ListPreparer prepares the List request. +func (client AnnotationsClient) ListPreparer(ctx context.Context, resourceGroupName string, resourceName string, start string, end 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, + "end": autorest.Encode("query", end), + "start": autorest.Encode("query", start), + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/Annotations", 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 AnnotationsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client AnnotationsClient) ListResponder(resp *http.Response) (result AnnotationsListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/appinsights/mgmt/2020-02-02-preview/insights/apikeys.go b/services/preview/appinsights/mgmt/2020-02-02-preview/insights/apikeys.go new file mode 100644 index 000000000000..ca33d3c4c68d --- /dev/null +++ b/services/preview/appinsights/mgmt/2020-02-02-preview/insights/apikeys.go @@ -0,0 +1,380 @@ +package insights + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// APIKeysClient is the composite Swagger for Application Insights Management Client +type APIKeysClient struct { + BaseClient +} + +// NewAPIKeysClient creates an instance of the APIKeysClient client. +func NewAPIKeysClient(subscriptionID string) APIKeysClient { + return NewAPIKeysClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewAPIKeysClientWithBaseURI creates an instance of the APIKeysClient client using a custom endpoint. Use this when +// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewAPIKeysClientWithBaseURI(baseURI string, subscriptionID string) APIKeysClient { + return APIKeysClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create create an API Key of an Application Insights component. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the Application Insights component resource. +// APIKeyProperties - properties that need to be specified to create an API key of a Application Insights +// component. +func (client APIKeysClient) Create(ctx context.Context, resourceGroupName string, resourceName string, APIKeyProperties APIKeyRequest) (result ApplicationInsightsComponentAPIKey, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/APIKeysClient.Create") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.APIKeysClient", "Create", err.Error()) + } + + req, err := client.CreatePreparer(ctx, resourceGroupName, resourceName, APIKeyProperties) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.APIKeysClient", "Create", nil, "Failure preparing request") + return + } + + resp, err := client.CreateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.APIKeysClient", "Create", resp, "Failure sending request") + return + } + + result, err = client.CreateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.APIKeysClient", "Create", resp, "Failure responding to request") + return + } + + return +} + +// CreatePreparer prepares the Create request. +func (client APIKeysClient) CreatePreparer(ctx context.Context, resourceGroupName string, resourceName string, APIKeyProperties APIKeyRequest) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-05-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + 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)) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client APIKeysClient) CreateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client APIKeysClient) CreateResponder(resp *http.Response) (result ApplicationInsightsComponentAPIKey, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete delete an API Key of an Application Insights component. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the Application Insights component resource. +// keyID - the API Key ID. This is unique within a Application Insights component. +func (client APIKeysClient) Delete(ctx context.Context, resourceGroupName string, resourceName string, keyID string) (result ApplicationInsightsComponentAPIKey, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/APIKeysClient.Delete") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.APIKeysClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, resourceName, keyID) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.APIKeysClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.APIKeysClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.APIKeysClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client APIKeysClient) DeletePreparer(ctx context.Context, resourceGroupName string, resourceName string, keyID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "keyId": autorest.Encode("path", keyID), + "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}/APIKeys/{keyId}", 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 APIKeysClient) DeleteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client APIKeysClient) DeleteResponder(resp *http.Response) (result ApplicationInsightsComponentAPIKey, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Get get the API Key for this key id. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the Application Insights component resource. +// keyID - the API Key ID. This is unique within a Application Insights component. +func (client APIKeysClient) Get(ctx context.Context, resourceGroupName string, resourceName string, keyID string) (result ApplicationInsightsComponentAPIKey, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/APIKeysClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.APIKeysClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, resourceName, keyID) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.APIKeysClient", "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.APIKeysClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.APIKeysClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client APIKeysClient) GetPreparer(ctx context.Context, resourceGroupName string, resourceName string, keyID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "keyId": autorest.Encode("path", keyID), + "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}/APIKeys/{keyId}", 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 APIKeysClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client APIKeysClient) GetResponder(resp *http.Response) (result ApplicationInsightsComponentAPIKey, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets a list of API keys of an Application Insights component. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the Application Insights component resource. +func (client APIKeysClient) List(ctx context.Context, resourceGroupName string, resourceName string) (result ApplicationInsightsComponentAPIKeyListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/APIKeysClient.List") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.APIKeysClient", "List", err.Error()) + } + + req, err := client.ListPreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.APIKeysClient", "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.APIKeysClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.APIKeysClient", "List", resp, "Failure responding to request") + return + } + + return +} + +// ListPreparer prepares the List request. +func (client APIKeysClient) 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}/ApiKeys", 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 APIKeysClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client APIKeysClient) ListResponder(resp *http.Response) (result ApplicationInsightsComponentAPIKeyListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/appinsights/mgmt/2020-02-02-preview/insights/client.go b/services/preview/appinsights/mgmt/2020-02-02-preview/insights/client.go new file mode 100644 index 000000000000..9203ed850c0c --- /dev/null +++ b/services/preview/appinsights/mgmt/2020-02-02-preview/insights/client.go @@ -0,0 +1,41 @@ +// Package insights implements the Azure ARM Insights service API version . +// +// Composite Swagger for Application Insights Management Client +package insights + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// 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 using a custom endpoint. Use this when interacting with +// an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { + return BaseClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + SubscriptionID: subscriptionID, + } +} diff --git a/services/preview/appinsights/mgmt/2020-02-02-preview/insights/componentavailablefeatures.go b/services/preview/appinsights/mgmt/2020-02-02-preview/insights/componentavailablefeatures.go new file mode 100644 index 000000000000..997a483b327f --- /dev/null +++ b/services/preview/appinsights/mgmt/2020-02-02-preview/insights/componentavailablefeatures.go @@ -0,0 +1,118 @@ +package insights + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// ComponentAvailableFeaturesClient is the composite Swagger for Application Insights Management Client +type ComponentAvailableFeaturesClient struct { + BaseClient +} + +// NewComponentAvailableFeaturesClient creates an instance of the ComponentAvailableFeaturesClient client. +func NewComponentAvailableFeaturesClient(subscriptionID string) ComponentAvailableFeaturesClient { + return NewComponentAvailableFeaturesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewComponentAvailableFeaturesClientWithBaseURI creates an instance of the ComponentAvailableFeaturesClient client +// using a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign +// clouds, Azure stack). +func NewComponentAvailableFeaturesClientWithBaseURI(baseURI string, subscriptionID string) ComponentAvailableFeaturesClient { + return ComponentAvailableFeaturesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get returns all available features of the application insights component. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the Application Insights component resource. +func (client ComponentAvailableFeaturesClient) Get(ctx context.Context, resourceGroupName string, resourceName string) (result ApplicationInsightsComponentAvailableFeatures, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ComponentAvailableFeaturesClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ComponentAvailableFeaturesClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ComponentAvailableFeaturesClient", "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.ComponentAvailableFeaturesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ComponentAvailableFeaturesClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client ComponentAvailableFeaturesClient) GetPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-05-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/getavailablebillingfeatures", 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 ComponentAvailableFeaturesClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ComponentAvailableFeaturesClient) GetResponder(resp *http.Response) (result ApplicationInsightsComponentAvailableFeatures, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/appinsights/mgmt/2020-02-02-preview/insights/componentcurrentbillingfeatures.go b/services/preview/appinsights/mgmt/2020-02-02-preview/insights/componentcurrentbillingfeatures.go new file mode 100644 index 000000000000..3416a616be9c --- /dev/null +++ b/services/preview/appinsights/mgmt/2020-02-02-preview/insights/componentcurrentbillingfeatures.go @@ -0,0 +1,207 @@ +package insights + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// ComponentCurrentBillingFeaturesClient is the composite Swagger for Application Insights Management Client +type ComponentCurrentBillingFeaturesClient struct { + BaseClient +} + +// NewComponentCurrentBillingFeaturesClient creates an instance of the ComponentCurrentBillingFeaturesClient client. +func NewComponentCurrentBillingFeaturesClient(subscriptionID string) ComponentCurrentBillingFeaturesClient { + return NewComponentCurrentBillingFeaturesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewComponentCurrentBillingFeaturesClientWithBaseURI creates an instance of the ComponentCurrentBillingFeaturesClient +// client using a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI +// (sovereign clouds, Azure stack). +func NewComponentCurrentBillingFeaturesClientWithBaseURI(baseURI string, subscriptionID string) ComponentCurrentBillingFeaturesClient { + return ComponentCurrentBillingFeaturesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get returns current billing features for an Application Insights component. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the Application Insights component resource. +func (client ComponentCurrentBillingFeaturesClient) Get(ctx context.Context, resourceGroupName string, resourceName string) (result ApplicationInsightsComponentBillingFeatures, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ComponentCurrentBillingFeaturesClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ComponentCurrentBillingFeaturesClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ComponentCurrentBillingFeaturesClient", "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.ComponentCurrentBillingFeaturesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ComponentCurrentBillingFeaturesClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client ComponentCurrentBillingFeaturesClient) GetPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-05-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/currentbillingfeatures", 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 ComponentCurrentBillingFeaturesClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ComponentCurrentBillingFeaturesClient) GetResponder(resp *http.Response) (result ApplicationInsightsComponentBillingFeatures, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Update update current billing features for an Application Insights component. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the Application Insights component resource. +// billingFeaturesProperties - properties that need to be specified to update billing features for an +// Application Insights component. +func (client ComponentCurrentBillingFeaturesClient) Update(ctx context.Context, resourceGroupName string, resourceName string, billingFeaturesProperties ApplicationInsightsComponentBillingFeatures) (result ApplicationInsightsComponentBillingFeatures, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ComponentCurrentBillingFeaturesClient.Update") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ComponentCurrentBillingFeaturesClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, resourceName, billingFeaturesProperties) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ComponentCurrentBillingFeaturesClient", "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.ComponentCurrentBillingFeaturesClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ComponentCurrentBillingFeaturesClient", "Update", resp, "Failure responding to request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client ComponentCurrentBillingFeaturesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, resourceName string, billingFeaturesProperties ApplicationInsightsComponentBillingFeatures) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-05-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/currentbillingfeatures", pathParameters), + autorest.WithJSON(billingFeaturesProperties), + 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 ComponentCurrentBillingFeaturesClient) UpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client ComponentCurrentBillingFeaturesClient) UpdateResponder(resp *http.Response) (result ApplicationInsightsComponentBillingFeatures, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/appinsights/mgmt/2020-02-02-preview/insights/componentfeaturecapabilities.go b/services/preview/appinsights/mgmt/2020-02-02-preview/insights/componentfeaturecapabilities.go new file mode 100644 index 000000000000..0620681495e8 --- /dev/null +++ b/services/preview/appinsights/mgmt/2020-02-02-preview/insights/componentfeaturecapabilities.go @@ -0,0 +1,118 @@ +package insights + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// ComponentFeatureCapabilitiesClient is the composite Swagger for Application Insights Management Client +type ComponentFeatureCapabilitiesClient struct { + BaseClient +} + +// NewComponentFeatureCapabilitiesClient creates an instance of the ComponentFeatureCapabilitiesClient client. +func NewComponentFeatureCapabilitiesClient(subscriptionID string) ComponentFeatureCapabilitiesClient { + return NewComponentFeatureCapabilitiesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewComponentFeatureCapabilitiesClientWithBaseURI creates an instance of the ComponentFeatureCapabilitiesClient +// client using a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI +// (sovereign clouds, Azure stack). +func NewComponentFeatureCapabilitiesClientWithBaseURI(baseURI string, subscriptionID string) ComponentFeatureCapabilitiesClient { + return ComponentFeatureCapabilitiesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get returns feature capabilities of the application insights component. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the Application Insights component resource. +func (client ComponentFeatureCapabilitiesClient) Get(ctx context.Context, resourceGroupName string, resourceName string) (result ApplicationInsightsComponentFeatureCapabilities, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ComponentFeatureCapabilitiesClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ComponentFeatureCapabilitiesClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ComponentFeatureCapabilitiesClient", "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.ComponentFeatureCapabilitiesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ComponentFeatureCapabilitiesClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client ComponentFeatureCapabilitiesClient) GetPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-05-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/featurecapabilities", 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 ComponentFeatureCapabilitiesClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ComponentFeatureCapabilitiesClient) GetResponder(resp *http.Response) (result ApplicationInsightsComponentFeatureCapabilities, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/appinsights/mgmt/2020-02-02-preview/insights/componentlinkedstorageaccounts.go b/services/preview/appinsights/mgmt/2020-02-02-preview/insights/componentlinkedstorageaccounts.go new file mode 100644 index 000000000000..52a5a107c3fd --- /dev/null +++ b/services/preview/appinsights/mgmt/2020-02-02-preview/insights/componentlinkedstorageaccounts.go @@ -0,0 +1,384 @@ +package insights + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// ComponentLinkedStorageAccountsClient is the composite Swagger for Application Insights Management Client +type ComponentLinkedStorageAccountsClient struct { + BaseClient +} + +// NewComponentLinkedStorageAccountsClient creates an instance of the ComponentLinkedStorageAccountsClient client. +func NewComponentLinkedStorageAccountsClient(subscriptionID string) ComponentLinkedStorageAccountsClient { + return NewComponentLinkedStorageAccountsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewComponentLinkedStorageAccountsClientWithBaseURI creates an instance of the ComponentLinkedStorageAccountsClient +// client using a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI +// (sovereign clouds, Azure stack). +func NewComponentLinkedStorageAccountsClientWithBaseURI(baseURI string, subscriptionID string) ComponentLinkedStorageAccountsClient { + return ComponentLinkedStorageAccountsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateAndUpdate replace current linked storage account for an Application Insights component. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the Application Insights component resource. +// linkedStorageAccountsProperties - properties that need to be specified to update linked storage accounts for +// an Application Insights component. +func (client ComponentLinkedStorageAccountsClient) CreateAndUpdate(ctx context.Context, resourceGroupName string, resourceName string, linkedStorageAccountsProperties ComponentLinkedStorageAccounts) (result ComponentLinkedStorageAccounts, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ComponentLinkedStorageAccountsClient.CreateAndUpdate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ComponentLinkedStorageAccountsClient", "CreateAndUpdate", err.Error()) + } + + req, err := client.CreateAndUpdatePreparer(ctx, resourceGroupName, resourceName, linkedStorageAccountsProperties) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ComponentLinkedStorageAccountsClient", "CreateAndUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateAndUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.ComponentLinkedStorageAccountsClient", "CreateAndUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateAndUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ComponentLinkedStorageAccountsClient", "CreateAndUpdate", resp, "Failure responding to request") + return + } + + return +} + +// CreateAndUpdatePreparer prepares the CreateAndUpdate request. +func (client ComponentLinkedStorageAccountsClient) CreateAndUpdatePreparer(ctx context.Context, resourceGroupName string, resourceName string, linkedStorageAccountsProperties ComponentLinkedStorageAccounts) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "storageType": autorest.Encode("path", "ServiceProfiler"), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components/{resourceName}/linkedStorageAccounts/{storageType}", pathParameters), + autorest.WithJSON(linkedStorageAccountsProperties), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateAndUpdateSender sends the CreateAndUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client ComponentLinkedStorageAccountsClient) CreateAndUpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateAndUpdateResponder handles the response to the CreateAndUpdate request. The method always +// closes the http.Response Body. +func (client ComponentLinkedStorageAccountsClient) CreateAndUpdateResponder(resp *http.Response) (result ComponentLinkedStorageAccounts, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete delete linked storage accounts for an Application Insights component. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the Application Insights component resource. +func (client ComponentLinkedStorageAccountsClient) Delete(ctx context.Context, resourceGroupName string, resourceName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ComponentLinkedStorageAccountsClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ComponentLinkedStorageAccountsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ComponentLinkedStorageAccountsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "insights.ComponentLinkedStorageAccountsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ComponentLinkedStorageAccountsClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ComponentLinkedStorageAccountsClient) DeletePreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "storageType": autorest.Encode("path", "ServiceProfiler"), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-03-01-preview" + 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}/linkedStorageAccounts/{storageType}", 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 ComponentLinkedStorageAccountsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ComponentLinkedStorageAccountsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get returns the current linked storage settings for an Application Insights component. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the Application Insights component resource. +func (client ComponentLinkedStorageAccountsClient) Get(ctx context.Context, resourceGroupName string, resourceName string) (result ComponentLinkedStorageAccounts, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ComponentLinkedStorageAccountsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ComponentLinkedStorageAccountsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ComponentLinkedStorageAccountsClient", "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.ComponentLinkedStorageAccountsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ComponentLinkedStorageAccountsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client ComponentLinkedStorageAccountsClient) GetPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "storageType": autorest.Encode("path", "ServiceProfiler"), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-03-01-preview" + 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}/linkedStorageAccounts/{storageType}", 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 ComponentLinkedStorageAccountsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ComponentLinkedStorageAccountsClient) GetResponder(resp *http.Response) (result ComponentLinkedStorageAccounts, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Update update linked storage accounts for an Application Insights component. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the Application Insights component resource. +// linkedStorageAccountsProperties - properties that need to be specified to update a linked storage accounts +// for an Application Insights component. +func (client ComponentLinkedStorageAccountsClient) Update(ctx context.Context, resourceGroupName string, resourceName string, linkedStorageAccountsProperties ComponentLinkedStorageAccountsPatch) (result ComponentLinkedStorageAccounts, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ComponentLinkedStorageAccountsClient.Update") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ComponentLinkedStorageAccountsClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, resourceName, linkedStorageAccountsProperties) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ComponentLinkedStorageAccountsClient", "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.ComponentLinkedStorageAccountsClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ComponentLinkedStorageAccountsClient", "Update", resp, "Failure responding to request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client ComponentLinkedStorageAccountsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, resourceName string, linkedStorageAccountsProperties ComponentLinkedStorageAccountsPatch) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "storageType": autorest.Encode("path", "ServiceProfiler"), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components/{resourceName}/linkedStorageAccounts/{storageType}", pathParameters), + autorest.WithJSON(linkedStorageAccountsProperties), + 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 ComponentLinkedStorageAccountsClient) UpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client ComponentLinkedStorageAccountsClient) UpdateResponder(resp *http.Response) (result ComponentLinkedStorageAccounts, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/appinsights/mgmt/2020-02-02-preview/insights/componentquotastatus.go b/services/preview/appinsights/mgmt/2020-02-02-preview/insights/componentquotastatus.go new file mode 100644 index 000000000000..98d79dda19cd --- /dev/null +++ b/services/preview/appinsights/mgmt/2020-02-02-preview/insights/componentquotastatus.go @@ -0,0 +1,118 @@ +package insights + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// ComponentQuotaStatusClient is the composite Swagger for Application Insights Management Client +type ComponentQuotaStatusClient struct { + BaseClient +} + +// NewComponentQuotaStatusClient creates an instance of the ComponentQuotaStatusClient client. +func NewComponentQuotaStatusClient(subscriptionID string) ComponentQuotaStatusClient { + return NewComponentQuotaStatusClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewComponentQuotaStatusClientWithBaseURI creates an instance of the ComponentQuotaStatusClient client using a custom +// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure +// stack). +func NewComponentQuotaStatusClientWithBaseURI(baseURI string, subscriptionID string) ComponentQuotaStatusClient { + return ComponentQuotaStatusClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get returns daily data volume cap (quota) status for an Application Insights component. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the Application Insights component resource. +func (client ComponentQuotaStatusClient) Get(ctx context.Context, resourceGroupName string, resourceName string) (result ApplicationInsightsComponentQuotaStatus, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ComponentQuotaStatusClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ComponentQuotaStatusClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ComponentQuotaStatusClient", "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.ComponentQuotaStatusClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ComponentQuotaStatusClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client ComponentQuotaStatusClient) GetPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-05-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/quotastatus", 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 ComponentQuotaStatusClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ComponentQuotaStatusClient) GetResponder(resp *http.Response) (result ApplicationInsightsComponentQuotaStatus, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/appinsights/mgmt/2020-02-02-preview/insights/components.go b/services/preview/appinsights/mgmt/2020-02-02-preview/insights/components.go new file mode 100644 index 000000000000..edd860490ce2 --- /dev/null +++ b/services/preview/appinsights/mgmt/2020-02-02-preview/insights/components.go @@ -0,0 +1,807 @@ +package insights + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// ComponentsClient is the composite Swagger for Application Insights Management Client +type ComponentsClient struct { + BaseClient +} + +// NewComponentsClient creates an instance of the ComponentsClient client. +func NewComponentsClient(subscriptionID string) ComponentsClient { + return NewComponentsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewComponentsClientWithBaseURI creates an instance of the ComponentsClient client using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewComponentsClientWithBaseURI(baseURI string, subscriptionID string) ComponentsClient { + return ComponentsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates (or updates) an Application Insights component. Note: You cannot specify a different value +// for InstrumentationKey nor AppId in the Put operation. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the Application Insights component resource. +// insightProperties - properties that need to be specified to create an Application Insights component. +func (client ComponentsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, insightProperties ApplicationInsightsComponent) (result ApplicationInsightsComponent, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ComponentsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: insightProperties, + Constraints: []validation.Constraint{{Target: "insightProperties.Kind", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ComponentsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, resourceName, insightProperties) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ComponentsClient", "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.ComponentsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ComponentsClient", "CreateOrUpdate", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client ComponentsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, resourceName string, insightProperties ApplicationInsightsComponent) (*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 = "2020-02-02" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}", pathParameters), + autorest.WithJSON(insightProperties), + 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 ComponentsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client ComponentsClient) CreateOrUpdateResponder(resp *http.Response) (result ApplicationInsightsComponent, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes an Application Insights component. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the Application Insights component resource. +func (client ComponentsClient) Delete(ctx context.Context, resourceGroupName string, resourceName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ComponentsClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ComponentsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ComponentsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "insights.ComponentsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ComponentsClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ComponentsClient) DeletePreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-02-02" + 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}", 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 ComponentsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ComponentsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get returns an Application Insights component. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the Application Insights component resource. +func (client ComponentsClient) Get(ctx context.Context, resourceGroupName string, resourceName string) (result ApplicationInsightsComponent, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ComponentsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ComponentsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ComponentsClient", "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.ComponentsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ComponentsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client ComponentsClient) GetPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-02-02" + 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}", 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 ComponentsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ComponentsClient) GetResponder(resp *http.Response) (result ApplicationInsightsComponent, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetPurgeStatus get status for an ongoing purge operation. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the Application Insights component resource. +// purgeID - in a purge status request, this is the Id of the operation the status of which is returned. +func (client ComponentsClient) GetPurgeStatus(ctx context.Context, resourceGroupName string, resourceName string, purgeID string) (result ComponentPurgeStatusResponse, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ComponentsClient.GetPurgeStatus") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ComponentsClient", "GetPurgeStatus", err.Error()) + } + + req, err := client.GetPurgeStatusPreparer(ctx, resourceGroupName, resourceName, purgeID) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ComponentsClient", "GetPurgeStatus", nil, "Failure preparing request") + return + } + + resp, err := client.GetPurgeStatusSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.ComponentsClient", "GetPurgeStatus", resp, "Failure sending request") + return + } + + result, err = client.GetPurgeStatusResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ComponentsClient", "GetPurgeStatus", resp, "Failure responding to request") + return + } + + return +} + +// GetPurgeStatusPreparer prepares the GetPurgeStatus request. +func (client ComponentsClient) GetPurgeStatusPreparer(ctx context.Context, resourceGroupName string, resourceName string, purgeID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "purgeId": autorest.Encode("path", purgeID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-02-02" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/operations/{purgeId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetPurgeStatusSender sends the GetPurgeStatus request. The method will close the +// http.Response Body if it receives an error. +func (client ComponentsClient) GetPurgeStatusSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetPurgeStatusResponder handles the response to the GetPurgeStatus request. The method always +// closes the http.Response Body. +func (client ComponentsClient) GetPurgeStatusResponder(resp *http.Response) (result ComponentPurgeStatusResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets a list of all Application Insights components within a subscription. +func (client ComponentsClient) List(ctx context.Context) (result ApplicationInsightsComponentListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ComponentsClient.List") + defer func() { + sc := -1 + if result.aiclr.Response.Response != nil { + sc = result.aiclr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ComponentsClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ComponentsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.aiclr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.ComponentsClient", "List", resp, "Failure sending request") + return + } + + result.aiclr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ComponentsClient", "List", resp, "Failure responding to request") + return + } + if result.aiclr.hasNextLink() && result.aiclr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client ComponentsClient) ListPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-02-02" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/components", 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 ComponentsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ComponentsClient) ListResponder(resp *http.Response) (result ApplicationInsightsComponentListResult, err error) { + err = autorest.Respond( + resp, + 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 ComponentsClient) listNextResults(ctx context.Context, lastResults ApplicationInsightsComponentListResult) (result ApplicationInsightsComponentListResult, err error) { + req, err := lastResults.applicationInsightsComponentListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "insights.ComponentsClient", "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.ComponentsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ComponentsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client ComponentsClient) ListComplete(ctx context.Context) (result ApplicationInsightsComponentListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ComponentsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx) + return +} + +// ListByResourceGroup gets a list of Application Insights components within a resource group. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +func (client ComponentsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ApplicationInsightsComponentListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ComponentsClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.aiclr.Response.Response != nil { + sc = result.aiclr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ComponentsClient", "ListByResourceGroup", err.Error()) + } + + result.fn = client.listByResourceGroupNextResults + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ComponentsClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.aiclr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.ComponentsClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.aiclr, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ComponentsClient", "ListByResourceGroup", resp, "Failure responding to request") + return + } + if result.aiclr.hasNextLink() && result.aiclr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client ComponentsClient) 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 = "2020-02-02" + 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", 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 ComponentsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client ComponentsClient) ListByResourceGroupResponder(resp *http.Response) (result ApplicationInsightsComponentListResult, err error) { + err = autorest.Respond( + resp, + 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 ComponentsClient) listByResourceGroupNextResults(ctx context.Context, lastResults ApplicationInsightsComponentListResult) (result ApplicationInsightsComponentListResult, err error) { + req, err := lastResults.applicationInsightsComponentListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "insights.ComponentsClient", "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.ComponentsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ComponentsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client ComponentsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result ApplicationInsightsComponentListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ComponentsClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByResourceGroup(ctx, resourceGroupName) + return +} + +// Purge purges data in an Application Insights component by a set of user-defined filters. +// +// In order to manage system resources, purge requests are throttled at 50 requests per hour. You should batch the +// execution of purge requests by sending a single command whose predicate includes all user identities that require +// purging. Use the in operator to specify multiple identities. You should run the query prior to using for a purge +// request to verify that the results are expected. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the Application Insights component resource. +// body - describes the body of a request to purge data in a single table of an Application Insights component +func (client ComponentsClient) Purge(ctx context.Context, resourceGroupName string, resourceName string, body ComponentPurgeBody) (result ComponentPurgeResponse, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ComponentsClient.Purge") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: body, + Constraints: []validation.Constraint{{Target: "body.Table", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "body.Filters", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ComponentsClient", "Purge", err.Error()) + } + + req, err := client.PurgePreparer(ctx, resourceGroupName, resourceName, body) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ComponentsClient", "Purge", nil, "Failure preparing request") + return + } + + resp, err := client.PurgeSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.ComponentsClient", "Purge", resp, "Failure sending request") + return + } + + result, err = client.PurgeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ComponentsClient", "Purge", resp, "Failure responding to request") + return + } + + return +} + +// PurgePreparer prepares the Purge request. +func (client ComponentsClient) PurgePreparer(ctx context.Context, resourceGroupName string, resourceName string, body ComponentPurgeBody) (*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 = "2020-02-02" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + 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)) +} + +// PurgeSender sends the Purge request. The method will close the +// http.Response Body if it receives an error. +func (client ComponentsClient) PurgeSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// PurgeResponder handles the response to the Purge request. The method always +// closes the http.Response Body. +func (client ComponentsClient) PurgeResponder(resp *http.Response) (result ComponentPurgeResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateTags updates an existing component's tags. To update other fields use the CreateOrUpdate method. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the Application Insights component resource. +// componentTags - updated tag information to set into the component instance. +func (client ComponentsClient) UpdateTags(ctx context.Context, resourceGroupName string, resourceName string, componentTags TagsResource) (result ApplicationInsightsComponent, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ComponentsClient.UpdateTags") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ComponentsClient", "UpdateTags", err.Error()) + } + + req, err := client.UpdateTagsPreparer(ctx, resourceGroupName, resourceName, componentTags) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ComponentsClient", "UpdateTags", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateTagsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.ComponentsClient", "UpdateTags", resp, "Failure sending request") + return + } + + result, err = client.UpdateTagsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ComponentsClient", "UpdateTags", resp, "Failure responding to request") + return + } + + return +} + +// UpdateTagsPreparer prepares the UpdateTags request. +func (client ComponentsClient) UpdateTagsPreparer(ctx context.Context, resourceGroupName string, resourceName string, componentTags TagsResource) (*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 = "2020-02-02" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}", pathParameters), + autorest.WithJSON(componentTags), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateTagsSender sends the UpdateTags request. The method will close the +// http.Response Body if it receives an error. +func (client ComponentsClient) UpdateTagsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateTagsResponder handles the response to the UpdateTags request. The method always +// closes the http.Response Body. +func (client ComponentsClient) UpdateTagsResponder(resp *http.Response) (result ApplicationInsightsComponent, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/appinsights/mgmt/2020-02-02-preview/insights/enums.go b/services/preview/appinsights/mgmt/2020-02-02-preview/insights/enums.go new file mode 100644 index 000000000000..c1e6f6a851bb --- /dev/null +++ b/services/preview/appinsights/mgmt/2020-02-02-preview/insights/enums.go @@ -0,0 +1,256 @@ +package insights + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// ApplicationType enumerates the values for application type. +type ApplicationType string + +const ( + // Other ... + Other ApplicationType = "other" + // Web ... + Web ApplicationType = "web" +) + +// PossibleApplicationTypeValues returns an array of possible values for the ApplicationType const type. +func PossibleApplicationTypeValues() []ApplicationType { + return []ApplicationType{Other, Web} +} + +// CategoryType enumerates the values for category type. +type CategoryType string + +const ( + // CategoryTypePerformance ... + CategoryTypePerformance CategoryType = "performance" + // CategoryTypeRetention ... + CategoryTypeRetention CategoryType = "retention" + // CategoryTypeTSG ... + CategoryTypeTSG CategoryType = "TSG" + // CategoryTypeWorkbook ... + CategoryTypeWorkbook CategoryType = "workbook" +) + +// PossibleCategoryTypeValues returns an array of possible values for the CategoryType const type. +func PossibleCategoryTypeValues() []CategoryType { + return []CategoryType{CategoryTypePerformance, CategoryTypeRetention, CategoryTypeTSG, CategoryTypeWorkbook} +} + +// 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() []FavoriteSourceType { + return []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() []FavoriteType { + return []FavoriteType{Shared, User} +} + +// FlowType enumerates the values for flow type. +type FlowType string + +const ( + // Bluefield ... + Bluefield FlowType = "Bluefield" +) + +// PossibleFlowTypeValues returns an array of possible values for the FlowType const type. +func PossibleFlowTypeValues() []FlowType { + return []FlowType{Bluefield} +} + +// IngestionMode enumerates the values for ingestion mode. +type IngestionMode string + +const ( + // ApplicationInsights ... + ApplicationInsights IngestionMode = "ApplicationInsights" + // ApplicationInsightsWithDiagnosticSettings ... + ApplicationInsightsWithDiagnosticSettings IngestionMode = "ApplicationInsightsWithDiagnosticSettings" + // LogAnalytics ... + LogAnalytics IngestionMode = "LogAnalytics" +) + +// PossibleIngestionModeValues returns an array of possible values for the IngestionMode const type. +func PossibleIngestionModeValues() []IngestionMode { + return []IngestionMode{ApplicationInsights, ApplicationInsightsWithDiagnosticSettings, LogAnalytics} +} + +// ItemScope enumerates the values for item scope. +type ItemScope string + +const ( + // ItemScopeShared ... + ItemScopeShared ItemScope = "shared" + // ItemScopeUser ... + ItemScopeUser ItemScope = "user" +) + +// PossibleItemScopeValues returns an array of possible values for the ItemScope const type. +func PossibleItemScopeValues() []ItemScope { + return []ItemScope{ItemScopeShared, ItemScopeUser} +} + +// ItemScopePath enumerates the values for item scope path. +type ItemScopePath string + +const ( + // AnalyticsItems ... + AnalyticsItems ItemScopePath = "analyticsItems" + // MyanalyticsItems ... + MyanalyticsItems ItemScopePath = "myanalyticsItems" +) + +// PossibleItemScopePathValues returns an array of possible values for the ItemScopePath const type. +func PossibleItemScopePathValues() []ItemScopePath { + return []ItemScopePath{AnalyticsItems, MyanalyticsItems} +} + +// ItemType enumerates the values for item type. +type ItemType string + +const ( + // Folder ... + Folder ItemType = "folder" + // Function ... + Function ItemType = "function" + // Query ... + Query ItemType = "query" + // Recent ... + Recent ItemType = "recent" +) + +// PossibleItemTypeValues returns an array of possible values for the ItemType const type. +func PossibleItemTypeValues() []ItemType { + return []ItemType{Folder, Function, Query, Recent} +} + +// ItemTypeParameter enumerates the values for item type parameter. +type ItemTypeParameter string + +const ( + // ItemTypeParameterFolder ... + ItemTypeParameterFolder ItemTypeParameter = "folder" + // ItemTypeParameterFunction ... + ItemTypeParameterFunction ItemTypeParameter = "function" + // ItemTypeParameterNone ... + ItemTypeParameterNone ItemTypeParameter = "none" + // ItemTypeParameterQuery ... + ItemTypeParameterQuery ItemTypeParameter = "query" + // ItemTypeParameterRecent ... + ItemTypeParameterRecent ItemTypeParameter = "recent" +) + +// PossibleItemTypeParameterValues returns an array of possible values for the ItemTypeParameter const type. +func PossibleItemTypeParameterValues() []ItemTypeParameter { + return []ItemTypeParameter{ItemTypeParameterFolder, ItemTypeParameterFunction, ItemTypeParameterNone, ItemTypeParameterQuery, ItemTypeParameterRecent} +} + +// PublicNetworkAccessType enumerates the values for public network access type. +type PublicNetworkAccessType string + +const ( + // Disabled Disables public connectivity to Application Insights through public DNS. + Disabled PublicNetworkAccessType = "Disabled" + // Enabled Enables connectivity to Application Insights through public DNS. + Enabled PublicNetworkAccessType = "Enabled" +) + +// PossiblePublicNetworkAccessTypeValues returns an array of possible values for the PublicNetworkAccessType const type. +func PossiblePublicNetworkAccessTypeValues() []PublicNetworkAccessType { + return []PublicNetworkAccessType{Disabled, Enabled} +} + +// PurgeState enumerates the values for purge state. +type PurgeState string + +const ( + // Completed ... + Completed PurgeState = "completed" + // Pending ... + Pending PurgeState = "pending" +) + +// PossiblePurgeStateValues returns an array of possible values for the PurgeState const type. +func PossiblePurgeStateValues() []PurgeState { + return []PurgeState{Completed, Pending} +} + +// RequestSource enumerates the values for request source. +type RequestSource string + +const ( + // Rest ... + Rest RequestSource = "rest" +) + +// PossibleRequestSourceValues returns an array of possible values for the RequestSource const type. +func PossibleRequestSourceValues() []RequestSource { + return []RequestSource{Rest} +} + +// SharedTypeKind enumerates the values for shared type kind. +type SharedTypeKind string + +const ( + // SharedTypeKindShared ... + SharedTypeKindShared SharedTypeKind = "shared" + // SharedTypeKindUser ... + SharedTypeKindUser SharedTypeKind = "user" +) + +// PossibleSharedTypeKindValues returns an array of possible values for the SharedTypeKind const type. +func PossibleSharedTypeKindValues() []SharedTypeKind { + return []SharedTypeKind{SharedTypeKindShared, SharedTypeKindUser} +} + +// WebTestKind enumerates the values for web test kind. +type WebTestKind string + +const ( + // Multistep ... + Multistep WebTestKind = "multistep" + // Ping ... + Ping WebTestKind = "ping" +) + +// PossibleWebTestKindValues returns an array of possible values for the WebTestKind const type. +func PossibleWebTestKindValues() []WebTestKind { + return []WebTestKind{Multistep, Ping} +} diff --git a/services/preview/appinsights/mgmt/2020-02-02-preview/insights/exportconfigurations.go b/services/preview/appinsights/mgmt/2020-02-02-preview/insights/exportconfigurations.go new file mode 100644 index 000000000000..8543b8d411df --- /dev/null +++ b/services/preview/appinsights/mgmt/2020-02-02-preview/insights/exportconfigurations.go @@ -0,0 +1,471 @@ +package insights + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// ExportConfigurationsClient is the composite Swagger for Application Insights Management Client +type ExportConfigurationsClient struct { + BaseClient +} + +// NewExportConfigurationsClient creates an instance of the ExportConfigurationsClient client. +func NewExportConfigurationsClient(subscriptionID string) ExportConfigurationsClient { + return NewExportConfigurationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewExportConfigurationsClientWithBaseURI creates an instance of the ExportConfigurationsClient client using a custom +// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure +// stack). +func NewExportConfigurationsClientWithBaseURI(baseURI string, subscriptionID string) ExportConfigurationsClient { + return ExportConfigurationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create create a Continuous Export configuration of an Application Insights component. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the Application Insights component resource. +// exportProperties - properties that need to be specified to create a Continuous Export configuration of a +// Application Insights component. +func (client ExportConfigurationsClient) Create(ctx context.Context, resourceGroupName string, resourceName string, exportProperties ApplicationInsightsComponentExportRequest) (result ListApplicationInsightsComponentExportConfiguration, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExportConfigurationsClient.Create") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ExportConfigurationsClient", "Create", err.Error()) + } + + req, err := client.CreatePreparer(ctx, resourceGroupName, resourceName, exportProperties) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ExportConfigurationsClient", "Create", nil, "Failure preparing request") + return + } + + resp, err := client.CreateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.ExportConfigurationsClient", "Create", resp, "Failure sending request") + return + } + + result, err = client.CreateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ExportConfigurationsClient", "Create", resp, "Failure responding to request") + return + } + + return +} + +// CreatePreparer prepares the Create request. +func (client ExportConfigurationsClient) CreatePreparer(ctx context.Context, resourceGroupName string, resourceName string, exportProperties ApplicationInsightsComponentExportRequest) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-05-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + 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)) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client ExportConfigurationsClient) CreateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client ExportConfigurationsClient) CreateResponder(resp *http.Response) (result ListApplicationInsightsComponentExportConfiguration, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete delete a Continuous Export configuration of an Application Insights component. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the Application Insights component resource. +// exportID - the Continuous Export configuration ID. This is unique within a Application Insights component. +func (client ExportConfigurationsClient) Delete(ctx context.Context, resourceGroupName string, resourceName string, exportID string) (result ApplicationInsightsComponentExportConfiguration, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExportConfigurationsClient.Delete") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ExportConfigurationsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, resourceName, exportID) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ExportConfigurationsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.ExportConfigurationsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ExportConfigurationsClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ExportConfigurationsClient) DeletePreparer(ctx context.Context, resourceGroupName string, resourceName string, exportID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "exportId": autorest.Encode("path", exportID), + "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}/exportconfiguration/{exportId}", 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 ExportConfigurationsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ExportConfigurationsClient) DeleteResponder(resp *http.Response) (result ApplicationInsightsComponentExportConfiguration, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Get get the Continuous Export configuration for this export id. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the Application Insights component resource. +// exportID - the Continuous Export configuration ID. This is unique within a Application Insights component. +func (client ExportConfigurationsClient) Get(ctx context.Context, resourceGroupName string, resourceName string, exportID string) (result ApplicationInsightsComponentExportConfiguration, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExportConfigurationsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ExportConfigurationsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, resourceName, exportID) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ExportConfigurationsClient", "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.ExportConfigurationsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ExportConfigurationsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client ExportConfigurationsClient) GetPreparer(ctx context.Context, resourceGroupName string, resourceName string, exportID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "exportId": autorest.Encode("path", exportID), + "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}/exportconfiguration/{exportId}", 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 ExportConfigurationsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ExportConfigurationsClient) GetResponder(resp *http.Response) (result ApplicationInsightsComponentExportConfiguration, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets a list of Continuous Export configuration of an Application Insights component. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the Application Insights component resource. +func (client ExportConfigurationsClient) List(ctx context.Context, resourceGroupName string, resourceName string) (result ListApplicationInsightsComponentExportConfiguration, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExportConfigurationsClient.List") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ExportConfigurationsClient", "List", err.Error()) + } + + req, err := client.ListPreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ExportConfigurationsClient", "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.ExportConfigurationsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ExportConfigurationsClient", "List", resp, "Failure responding to request") + return + } + + return +} + +// ListPreparer prepares the List request. +func (client ExportConfigurationsClient) 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}/exportconfiguration", 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 ExportConfigurationsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ExportConfigurationsClient) ListResponder(resp *http.Response) (result ListApplicationInsightsComponentExportConfiguration, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Update update the Continuous Export configuration for this export id. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the Application Insights component resource. +// exportID - the Continuous Export configuration ID. This is unique within a Application Insights component. +// exportProperties - properties that need to be specified to update the Continuous Export configuration. +func (client ExportConfigurationsClient) Update(ctx context.Context, resourceGroupName string, resourceName string, exportID string, exportProperties ApplicationInsightsComponentExportRequest) (result ApplicationInsightsComponentExportConfiguration, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExportConfigurationsClient.Update") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ExportConfigurationsClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, resourceName, exportID, exportProperties) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ExportConfigurationsClient", "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.ExportConfigurationsClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ExportConfigurationsClient", "Update", resp, "Failure responding to request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client ExportConfigurationsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, resourceName string, exportID string, exportProperties ApplicationInsightsComponentExportRequest) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "exportId": autorest.Encode("path", exportID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-05-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/exportconfiguration/{exportId}", pathParameters), + autorest.WithJSON(exportProperties), + 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 ExportConfigurationsClient) UpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client ExportConfigurationsClient) UpdateResponder(resp *http.Response) (result ApplicationInsightsComponentExportConfiguration, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/appinsights/mgmt/2020-02-02-preview/insights/favorites.go b/services/preview/appinsights/mgmt/2020-02-02-preview/insights/favorites.go new file mode 100644 index 000000000000..732fca754804 --- /dev/null +++ b/services/preview/appinsights/mgmt/2020-02-02-preview/insights/favorites.go @@ -0,0 +1,497 @@ +package insights + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// 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) FavoritesClient { + return NewFavoritesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewFavoritesClientWithBaseURI creates an instance of the FavoritesClient client using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewFavoritesClientWithBaseURI(baseURI string, subscriptionID string) FavoritesClient { + return FavoritesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Add adds a new favorites to an Application Insights component. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the Application Insights component resource. +// favoriteID - the Id of a specific favorite defined in the Application Insights component +// favoriteProperties - properties that need to be specified to create a new favorite and add it to an +// Application Insights component. +func (client FavoritesClient) Add(ctx context.Context, resourceGroupName string, resourceName string, favoriteID string, favoriteProperties ApplicationInsightsComponentFavorite) (result ApplicationInsightsComponentFavorite, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FavoritesClient.Add") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.FavoritesClient", "Add", err.Error()) + } + + req, err := client.AddPreparer(ctx, resourceGroupName, resourceName, favoriteID, favoriteProperties) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.FavoritesClient", "Add", nil, "Failure preparing request") + return + } + + resp, err := client.AddSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.FavoritesClient", "Add", resp, "Failure sending request") + return + } + + result, err = client.AddResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.FavoritesClient", "Add", resp, "Failure responding to request") + return + } + + return +} + +// AddPreparer prepares the Add request. +func (client FavoritesClient) AddPreparer(ctx context.Context, resourceGroupName string, resourceName string, favoriteID string, favoriteProperties ApplicationInsightsComponentFavorite) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "favoriteId": autorest.Encode("path", favoriteID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-05-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + favoriteProperties.FavoriteID = nil + favoriteProperties.TimeModified = nil + favoriteProperties.UserID = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/favorites/{favoriteId}", pathParameters), + autorest.WithJSON(favoriteProperties), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// AddSender sends the Add request. The method will close the +// http.Response Body if it receives an error. +func (client FavoritesClient) AddSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// AddResponder handles the response to the Add request. The method always +// closes the http.Response Body. +func (client FavoritesClient) AddResponder(resp *http.Response) (result ApplicationInsightsComponentFavorite, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete remove a favorite that is associated to an Application Insights component. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the Application Insights component resource. +// favoriteID - the Id of a specific favorite defined in the Application Insights component +func (client FavoritesClient) Delete(ctx context.Context, resourceGroupName string, resourceName string, favoriteID string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FavoritesClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.FavoritesClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, resourceName, favoriteID) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.FavoritesClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "insights.FavoritesClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.FavoritesClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client FavoritesClient) DeletePreparer(ctx context.Context, resourceGroupName string, resourceName string, favoriteID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "favoriteId": autorest.Encode("path", favoriteID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-05-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/favorites/{favoriteId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client FavoritesClient) DeleteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client FavoritesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get a single favorite by its FavoriteId, defined within an Application Insights component. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the Application Insights component resource. +// favoriteID - the Id of a specific favorite defined in the Application Insights component +func (client FavoritesClient) Get(ctx context.Context, resourceGroupName string, resourceName string, favoriteID string) (result ApplicationInsightsComponentFavorite, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FavoritesClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.FavoritesClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, resourceName, favoriteID) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.FavoritesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.FavoritesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.FavoritesClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client FavoritesClient) GetPreparer(ctx context.Context, resourceGroupName string, resourceName string, favoriteID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "favoriteId": autorest.Encode("path", favoriteID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-05-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/favorites/{favoriteId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client FavoritesClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client FavoritesClient) GetResponder(resp *http.Response) (result ApplicationInsightsComponentFavorite, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets a list of favorites defined within an Application Insights component. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the Application Insights component resource. +// favoriteType - the type of favorite. Value can be either shared or user. +// sourceType - source type of favorite to return. When left out, the source type defaults to 'other' (not +// present in this enum). +// canFetchContent - flag indicating whether or not to return the full content for each applicable favorite. If +// false, only return summary content for favorites. +// tags - 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) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FavoritesClient.List") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.FavoritesClient", "List", 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 + } + + 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 client.Send(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, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Update updates a favorite that has already been added to an Application Insights component. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the Application Insights component resource. +// favoriteID - the Id of a specific favorite defined in the Application Insights component +// favoriteProperties - properties that need to be specified to update the existing favorite. +func (client FavoritesClient) Update(ctx context.Context, resourceGroupName string, resourceName string, favoriteID string, favoriteProperties ApplicationInsightsComponentFavorite) (result ApplicationInsightsComponentFavorite, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FavoritesClient.Update") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.FavoritesClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, resourceName, favoriteID, favoriteProperties) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.FavoritesClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.FavoritesClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.FavoritesClient", "Update", resp, "Failure responding to request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client FavoritesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, resourceName string, favoriteID string, favoriteProperties ApplicationInsightsComponentFavorite) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "favoriteId": autorest.Encode("path", favoriteID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-05-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + favoriteProperties.FavoriteID = nil + favoriteProperties.TimeModified = nil + favoriteProperties.UserID = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/favorites/{favoriteId}", pathParameters), + autorest.WithJSON(favoriteProperties), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client FavoritesClient) UpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client FavoritesClient) UpdateResponder(resp *http.Response) (result ApplicationInsightsComponentFavorite, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/appinsights/mgmt/2020-02-02-preview/insights/insightsapi/interfaces.go b/services/preview/appinsights/mgmt/2020-02-02-preview/insights/insightsapi/interfaces.go new file mode 100644 index 000000000000..2147306911a8 --- /dev/null +++ b/services/preview/appinsights/mgmt/2020-02-02-preview/insights/insightsapi/interfaces.go @@ -0,0 +1,195 @@ +package insightsapi + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/services/preview/appinsights/mgmt/2020-02-02-preview/insights" + "github.com/Azure/go-autorest/autorest" +) + +// OperationsClientAPI contains the set of methods on the OperationsClient type. +type OperationsClientAPI interface { + List(ctx context.Context) (result insights.OperationListResultPage, err error) + ListComplete(ctx context.Context) (result insights.OperationListResultIterator, err error) +} + +var _ OperationsClientAPI = (*insights.OperationsClient)(nil) + +// AnnotationsClientAPI contains the set of methods on the AnnotationsClient type. +type AnnotationsClientAPI interface { + Create(ctx context.Context, resourceGroupName string, resourceName string, annotationProperties insights.Annotation) (result insights.ListAnnotation, err error) + Delete(ctx context.Context, resourceGroupName string, resourceName string, annotationID string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, resourceName string, annotationID string) (result insights.ListAnnotation, err error) + List(ctx context.Context, resourceGroupName string, resourceName string, start string, end string) (result insights.AnnotationsListResult, err error) +} + +var _ AnnotationsClientAPI = (*insights.AnnotationsClient)(nil) + +// APIKeysClientAPI contains the set of methods on the APIKeysClient type. +type APIKeysClientAPI interface { + Create(ctx context.Context, resourceGroupName string, resourceName string, APIKeyProperties insights.APIKeyRequest) (result insights.ApplicationInsightsComponentAPIKey, err error) + Delete(ctx context.Context, resourceGroupName string, resourceName string, keyID string) (result insights.ApplicationInsightsComponentAPIKey, err error) + Get(ctx context.Context, resourceGroupName string, resourceName string, keyID string) (result insights.ApplicationInsightsComponentAPIKey, err error) + List(ctx context.Context, resourceGroupName string, resourceName string) (result insights.ApplicationInsightsComponentAPIKeyListResult, err error) +} + +var _ APIKeysClientAPI = (*insights.APIKeysClient)(nil) + +// ExportConfigurationsClientAPI contains the set of methods on the ExportConfigurationsClient type. +type ExportConfigurationsClientAPI interface { + Create(ctx context.Context, resourceGroupName string, resourceName string, exportProperties insights.ApplicationInsightsComponentExportRequest) (result insights.ListApplicationInsightsComponentExportConfiguration, err error) + Delete(ctx context.Context, resourceGroupName string, resourceName string, exportID string) (result insights.ApplicationInsightsComponentExportConfiguration, err error) + Get(ctx context.Context, resourceGroupName string, resourceName string, exportID string) (result insights.ApplicationInsightsComponentExportConfiguration, err error) + List(ctx context.Context, resourceGroupName string, resourceName string) (result insights.ListApplicationInsightsComponentExportConfiguration, err error) + Update(ctx context.Context, resourceGroupName string, resourceName string, exportID string, exportProperties insights.ApplicationInsightsComponentExportRequest) (result insights.ApplicationInsightsComponentExportConfiguration, err error) +} + +var _ ExportConfigurationsClientAPI = (*insights.ExportConfigurationsClient)(nil) + +// ComponentCurrentBillingFeaturesClientAPI contains the set of methods on the ComponentCurrentBillingFeaturesClient type. +type ComponentCurrentBillingFeaturesClientAPI interface { + Get(ctx context.Context, resourceGroupName string, resourceName string) (result insights.ApplicationInsightsComponentBillingFeatures, err error) + Update(ctx context.Context, resourceGroupName string, resourceName string, billingFeaturesProperties insights.ApplicationInsightsComponentBillingFeatures) (result insights.ApplicationInsightsComponentBillingFeatures, err error) +} + +var _ ComponentCurrentBillingFeaturesClientAPI = (*insights.ComponentCurrentBillingFeaturesClient)(nil) + +// ComponentQuotaStatusClientAPI contains the set of methods on the ComponentQuotaStatusClient type. +type ComponentQuotaStatusClientAPI interface { + Get(ctx context.Context, resourceGroupName string, resourceName string) (result insights.ApplicationInsightsComponentQuotaStatus, err error) +} + +var _ ComponentQuotaStatusClientAPI = (*insights.ComponentQuotaStatusClient)(nil) + +// ComponentFeatureCapabilitiesClientAPI contains the set of methods on the ComponentFeatureCapabilitiesClient type. +type ComponentFeatureCapabilitiesClientAPI interface { + Get(ctx context.Context, resourceGroupName string, resourceName string) (result insights.ApplicationInsightsComponentFeatureCapabilities, err error) +} + +var _ ComponentFeatureCapabilitiesClientAPI = (*insights.ComponentFeatureCapabilitiesClient)(nil) + +// ComponentAvailableFeaturesClientAPI contains the set of methods on the ComponentAvailableFeaturesClient type. +type ComponentAvailableFeaturesClientAPI interface { + Get(ctx context.Context, resourceGroupName string, resourceName string) (result insights.ApplicationInsightsComponentAvailableFeatures, err error) +} + +var _ ComponentAvailableFeaturesClientAPI = (*insights.ComponentAvailableFeaturesClient)(nil) + +// ProactiveDetectionConfigurationsClientAPI contains the set of methods on the ProactiveDetectionConfigurationsClient type. +type ProactiveDetectionConfigurationsClientAPI interface { + Get(ctx context.Context, resourceGroupName string, resourceName string, configurationID string) (result insights.ApplicationInsightsComponentProactiveDetectionConfiguration, err error) + List(ctx context.Context, resourceGroupName string, resourceName string) (result insights.ListApplicationInsightsComponentProactiveDetectionConfiguration, err error) + Update(ctx context.Context, resourceGroupName string, resourceName string, configurationID string, proactiveDetectionProperties insights.ApplicationInsightsComponentProactiveDetectionConfiguration) (result insights.ApplicationInsightsComponentProactiveDetectionConfiguration, err error) +} + +var _ ProactiveDetectionConfigurationsClientAPI = (*insights.ProactiveDetectionConfigurationsClient)(nil) + +// WorkItemConfigurationsClientAPI contains the set of methods on the WorkItemConfigurationsClient type. +type WorkItemConfigurationsClientAPI interface { + Create(ctx context.Context, resourceGroupName string, resourceName string, workItemConfigurationProperties insights.WorkItemCreateConfiguration) (result insights.WorkItemConfiguration, err error) + Delete(ctx context.Context, resourceGroupName string, resourceName string, workItemConfigID string) (result autorest.Response, err error) + GetDefault(ctx context.Context, resourceGroupName string, resourceName string) (result insights.WorkItemConfiguration, err error) + GetItem(ctx context.Context, resourceGroupName string, resourceName string, workItemConfigID string) (result insights.WorkItemConfiguration, err error) + List(ctx context.Context, resourceGroupName string, resourceName string) (result insights.WorkItemConfigurationsListResult, err error) + UpdateItem(ctx context.Context, resourceGroupName string, resourceName string, workItemConfigID string, workItemConfigurationProperties insights.WorkItemCreateConfiguration) (result insights.WorkItemConfiguration, err error) +} + +var _ WorkItemConfigurationsClientAPI = (*insights.WorkItemConfigurationsClient)(nil) + +// FavoritesClientAPI contains the set of methods on the FavoritesClient type. +type FavoritesClientAPI interface { + Add(ctx context.Context, resourceGroupName string, resourceName string, favoriteID string, favoriteProperties insights.ApplicationInsightsComponentFavorite) (result insights.ApplicationInsightsComponentFavorite, err error) + Delete(ctx context.Context, resourceGroupName string, resourceName string, favoriteID string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, resourceName string, favoriteID string) (result insights.ApplicationInsightsComponentFavorite, err error) + List(ctx context.Context, resourceGroupName string, resourceName string, favoriteType insights.FavoriteType, sourceType insights.FavoriteSourceType, canFetchContent *bool, tags []string) (result insights.ListApplicationInsightsComponentFavorite, err error) + Update(ctx context.Context, resourceGroupName string, resourceName string, favoriteID string, favoriteProperties insights.ApplicationInsightsComponentFavorite) (result insights.ApplicationInsightsComponentFavorite, err error) +} + +var _ FavoritesClientAPI = (*insights.FavoritesClient)(nil) + +// WebTestLocationsClientAPI contains the set of methods on the WebTestLocationsClient type. +type WebTestLocationsClientAPI interface { + List(ctx context.Context, resourceGroupName string, resourceName string) (result insights.ApplicationInsightsWebTestLocationsListResult, err error) +} + +var _ WebTestLocationsClientAPI = (*insights.WebTestLocationsClient)(nil) + +// WebTestsClientAPI contains the set of methods on the WebTestsClient type. +type WebTestsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, webTestName string, webTestDefinition insights.WebTest) (result insights.WebTest, err error) + Delete(ctx context.Context, resourceGroupName string, webTestName string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, webTestName string) (result insights.WebTest, err error) + List(ctx context.Context) (result insights.WebTestListResultPage, err error) + ListComplete(ctx context.Context) (result insights.WebTestListResultIterator, err error) + ListByComponent(ctx context.Context, componentName string, resourceGroupName string) (result insights.WebTestListResultPage, err error) + ListByComponentComplete(ctx context.Context, componentName string, resourceGroupName string) (result insights.WebTestListResultIterator, err error) + ListByResourceGroup(ctx context.Context, resourceGroupName string) (result insights.WebTestListResultPage, err error) + ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result insights.WebTestListResultIterator, err error) + UpdateTags(ctx context.Context, resourceGroupName string, webTestName string, webTestTags insights.TagsResource) (result insights.WebTest, err error) +} + +var _ WebTestsClientAPI = (*insights.WebTestsClient)(nil) + +// AnalyticsItemsClientAPI contains the set of methods on the AnalyticsItemsClient type. +type AnalyticsItemsClientAPI interface { + Delete(ctx context.Context, resourceGroupName string, resourceName string, scopePath insights.ItemScopePath, ID string, name string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, resourceName string, scopePath insights.ItemScopePath, ID string, name string) (result insights.ApplicationInsightsComponentAnalyticsItem, err error) + List(ctx context.Context, resourceGroupName string, resourceName string, scopePath insights.ItemScopePath, scope insights.ItemScope, typeParameter insights.ItemTypeParameter, includeContent *bool) (result insights.ListApplicationInsightsComponentAnalyticsItem, err error) + Put(ctx context.Context, resourceGroupName string, resourceName string, scopePath insights.ItemScopePath, itemProperties insights.ApplicationInsightsComponentAnalyticsItem, overrideItem *bool) (result insights.ApplicationInsightsComponentAnalyticsItem, err error) +} + +var _ AnalyticsItemsClientAPI = (*insights.AnalyticsItemsClient)(nil) + +// WorkbooksClientAPI contains the set of methods on the WorkbooksClient type. +type WorkbooksClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, workbookProperties insights.Workbook) (result insights.Workbook, err error) + Delete(ctx context.Context, resourceGroupName string, resourceName string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, resourceName string) (result insights.Workbook, err error) + ListByResourceGroup(ctx context.Context, resourceGroupName string, category insights.CategoryType, tags []string, canFetchContent *bool) (result insights.WorkbooksListResult, err error) + Update(ctx context.Context, resourceGroupName string, resourceName string, workbookProperties insights.Workbook) (result insights.Workbook, err error) +} + +var _ WorkbooksClientAPI = (*insights.WorkbooksClient)(nil) + +// MyWorkbooksClientAPI contains the set of methods on the MyWorkbooksClient type. +type MyWorkbooksClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, workbookProperties insights.MyWorkbook) (result insights.MyWorkbook, err error) + Delete(ctx context.Context, resourceGroupName string, resourceName string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, resourceName string) (result insights.MyWorkbook, err error) + ListByResourceGroup(ctx context.Context, resourceGroupName string, category insights.CategoryType, tags []string, canFetchContent *bool) (result insights.MyWorkbooksListResult, err error) + ListBySubscription(ctx context.Context, category insights.CategoryType, tags []string, canFetchContent *bool) (result insights.MyWorkbooksListResult, err error) + Update(ctx context.Context, resourceGroupName string, resourceName string, workbookProperties insights.MyWorkbook) (result insights.MyWorkbook, err error) +} + +var _ MyWorkbooksClientAPI = (*insights.MyWorkbooksClient)(nil) + +// ComponentsClientAPI contains the set of methods on the ComponentsClient type. +type ComponentsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, insightProperties insights.ApplicationInsightsComponent) (result insights.ApplicationInsightsComponent, err error) + Delete(ctx context.Context, resourceGroupName string, resourceName string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, resourceName string) (result insights.ApplicationInsightsComponent, err error) + GetPurgeStatus(ctx context.Context, resourceGroupName string, resourceName string, purgeID string) (result insights.ComponentPurgeStatusResponse, err error) + List(ctx context.Context) (result insights.ApplicationInsightsComponentListResultPage, err error) + ListComplete(ctx context.Context) (result insights.ApplicationInsightsComponentListResultIterator, err error) + ListByResourceGroup(ctx context.Context, resourceGroupName string) (result insights.ApplicationInsightsComponentListResultPage, err error) + ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result insights.ApplicationInsightsComponentListResultIterator, err error) + Purge(ctx context.Context, resourceGroupName string, resourceName string, body insights.ComponentPurgeBody) (result insights.ComponentPurgeResponse, err error) + UpdateTags(ctx context.Context, resourceGroupName string, resourceName string, componentTags insights.TagsResource) (result insights.ApplicationInsightsComponent, err error) +} + +var _ ComponentsClientAPI = (*insights.ComponentsClient)(nil) + +// ComponentLinkedStorageAccountsClientAPI contains the set of methods on the ComponentLinkedStorageAccountsClient type. +type ComponentLinkedStorageAccountsClientAPI interface { + CreateAndUpdate(ctx context.Context, resourceGroupName string, resourceName string, linkedStorageAccountsProperties insights.ComponentLinkedStorageAccounts) (result insights.ComponentLinkedStorageAccounts, err error) + Delete(ctx context.Context, resourceGroupName string, resourceName string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, resourceName string) (result insights.ComponentLinkedStorageAccounts, err error) + Update(ctx context.Context, resourceGroupName string, resourceName string, linkedStorageAccountsProperties insights.ComponentLinkedStorageAccountsPatch) (result insights.ComponentLinkedStorageAccounts, err error) +} + +var _ ComponentLinkedStorageAccountsClientAPI = (*insights.ComponentLinkedStorageAccountsClient)(nil) diff --git a/services/preview/appinsights/mgmt/2020-02-02-preview/insights/models.go b/services/preview/appinsights/mgmt/2020-02-02-preview/insights/models.go new file mode 100644 index 000000000000..7facd2123ae8 --- /dev/null +++ b/services/preview/appinsights/mgmt/2020-02-02-preview/insights/models.go @@ -0,0 +1,2376 @@ +package insights + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "encoding/json" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/date" + "github.com/Azure/go-autorest/autorest/to" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// The package's fully qualified name. +const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/appinsights/mgmt/2020-02-02-preview/insights" + +// Annotation annotation associated with an application insights resource. +type Annotation struct { + // AnnotationName - Name of annotation + AnnotationName *string `json:"AnnotationName,omitempty"` + // Category - Category of annotation, free form + Category *string `json:"Category,omitempty"` + // EventTime - Time when event occurred + EventTime *date.Time `json:"EventTime,omitempty"` + // ID - Unique Id for annotation + ID *string `json:"Id,omitempty"` + // Properties - Serialized JSON object for detailed properties + Properties *string `json:"Properties,omitempty"` + // RelatedAnnotation - Related parent annotation if any + RelatedAnnotation *string `json:"RelatedAnnotation,omitempty"` +} + +// AnnotationError error associated with trying to create annotation with Id that already exist +type AnnotationError struct { + // Code - Error detail code and explanation + Code *string `json:"code,omitempty"` + // Message - Error message + Message *string `json:"message,omitempty"` + Innererror *InnerError `json:"innererror,omitempty"` +} + +// AnnotationsListResult annotations list result. +type AnnotationsListResult struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; An array of annotations. + Value *[]Annotation `json:"value,omitempty"` +} + +// MarshalJSON is the custom marshaler for AnnotationsListResult. +func (alr AnnotationsListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// APIKeyRequest an Application Insights component API Key creation request definition. +type APIKeyRequest struct { + // Name - The name of the API Key. + Name *string `json:"name,omitempty"` + // LinkedReadProperties - The read access rights of this API Key. + LinkedReadProperties *[]string `json:"linkedReadProperties,omitempty"` + // LinkedWriteProperties - The write access rights of this API Key. + LinkedWriteProperties *[]string `json:"linkedWriteProperties,omitempty"` +} + +// ApplicationInsightsComponent an Application Insights component definition. +type ApplicationInsightsComponent struct { + autorest.Response `json:"-"` + // Kind - The kind of application that this component refers to, used to customize UI. This value is a freeform string, values should typically be one of the following: web, ios, other, store, java, phone. + Kind *string `json:"kind,omitempty"` + // Etag - Resource etag + Etag *string `json:"etag,omitempty"` + // ApplicationInsightsComponentProperties - Properties that define an Application Insights component resource. + *ApplicationInsightsComponentProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Azure resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Azure resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; 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 ApplicationInsightsComponent. +func (aic ApplicationInsightsComponent) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if aic.Kind != nil { + objectMap["kind"] = aic.Kind + } + if aic.Etag != nil { + objectMap["etag"] = aic.Etag + } + if aic.ApplicationInsightsComponentProperties != nil { + objectMap["properties"] = aic.ApplicationInsightsComponentProperties + } + if aic.Location != nil { + objectMap["location"] = aic.Location + } + if aic.Tags != nil { + objectMap["tags"] = aic.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ApplicationInsightsComponent struct. +func (aic *ApplicationInsightsComponent) 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 "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + aic.Kind = &kind + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + aic.Etag = &etag + } + case "properties": + if v != nil { + var applicationInsightsComponentProperties ApplicationInsightsComponentProperties + err = json.Unmarshal(*v, &applicationInsightsComponentProperties) + if err != nil { + return err + } + aic.ApplicationInsightsComponentProperties = &applicationInsightsComponentProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + aic.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + aic.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + aic.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + aic.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + aic.Tags = tags + } + } + } + + return nil +} + +// ApplicationInsightsComponentAnalyticsItem properties that define an Analytics item that is associated to +// an Application Insights component. +type ApplicationInsightsComponentAnalyticsItem struct { + autorest.Response `json:"-"` + // ID - Internally assigned unique id of the item definition. + ID *string `json:"Id,omitempty"` + // Name - The user-defined name of the item. + Name *string `json:"Name,omitempty"` + // Content - The content of this item + Content *string `json:"Content,omitempty"` + // Version - READ-ONLY; This instance's version of the data model. This can change as new features are added. + Version *string `json:"Version,omitempty"` + // Scope - Enum indicating if this item definition is owned by a specific user or is shared between all users with access to the Application Insights component. Possible values include: 'ItemScopeShared', 'ItemScopeUser' + Scope ItemScope `json:"Scope,omitempty"` + // Type - Enum indicating the type of the Analytics item. Possible values include: 'Query', 'Function', 'Folder', 'Recent' + Type ItemType `json:"Type,omitempty"` + // TimeCreated - READ-ONLY; Date and time in UTC when this item was created. + TimeCreated *string `json:"TimeCreated,omitempty"` + // TimeModified - READ-ONLY; Date and time in UTC of the last modification that was made to this item. + TimeModified *string `json:"TimeModified,omitempty"` + Properties *ApplicationInsightsComponentAnalyticsItemProperties `json:"Properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationInsightsComponentAnalyticsItem. +func (aicai ApplicationInsightsComponentAnalyticsItem) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if aicai.ID != nil { + objectMap["Id"] = aicai.ID + } + if aicai.Name != nil { + objectMap["Name"] = aicai.Name + } + if aicai.Content != nil { + objectMap["Content"] = aicai.Content + } + if aicai.Scope != "" { + objectMap["Scope"] = aicai.Scope + } + if aicai.Type != "" { + objectMap["Type"] = aicai.Type + } + if aicai.Properties != nil { + objectMap["Properties"] = aicai.Properties + } + return json.Marshal(objectMap) +} + +// ApplicationInsightsComponentAnalyticsItemProperties a set of properties that can be defined in the +// context of a specific item type. Each type may have its own properties. +type ApplicationInsightsComponentAnalyticsItemProperties struct { + // FunctionAlias - A function alias, used when the type of the item is Function + FunctionAlias *string `json:"functionAlias,omitempty"` +} + +// ApplicationInsightsComponentAPIKey properties that define an API key of an Application Insights +// Component. +type ApplicationInsightsComponentAPIKey struct { + autorest.Response `json:"-"` + // ID - READ-ONLY; The unique ID of the API key inside an Application Insights component. It is auto generated when the API key is created. + ID *string `json:"id,omitempty"` + // APIKey - READ-ONLY; The API key value. It will be only return once when the API Key was created. + APIKey *string `json:"apiKey,omitempty"` + // CreatedDate - The create date of this API key. + CreatedDate *string `json:"createdDate,omitempty"` + // Name - The name of the API key. + Name *string `json:"name,omitempty"` + // LinkedReadProperties - The read access rights of this API Key. + LinkedReadProperties *[]string `json:"linkedReadProperties,omitempty"` + // LinkedWriteProperties - The write access rights of this API Key. + LinkedWriteProperties *[]string `json:"linkedWriteProperties,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationInsightsComponentAPIKey. +func (aicak ApplicationInsightsComponentAPIKey) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if aicak.CreatedDate != nil { + objectMap["createdDate"] = aicak.CreatedDate + } + if aicak.Name != nil { + objectMap["name"] = aicak.Name + } + if aicak.LinkedReadProperties != nil { + objectMap["linkedReadProperties"] = aicak.LinkedReadProperties + } + if aicak.LinkedWriteProperties != nil { + objectMap["linkedWriteProperties"] = aicak.LinkedWriteProperties + } + return json.Marshal(objectMap) +} + +// ApplicationInsightsComponentAPIKeyListResult describes the list of API Keys of an Application Insights +// Component. +type ApplicationInsightsComponentAPIKeyListResult struct { + autorest.Response `json:"-"` + // Value - List of API Key definitions. + Value *[]ApplicationInsightsComponentAPIKey `json:"value,omitempty"` +} + +// ApplicationInsightsComponentAvailableFeatures an Application Insights component available features. +type ApplicationInsightsComponentAvailableFeatures struct { + autorest.Response `json:"-"` + // Result - READ-ONLY; A list of Application Insights component feature. + Result *[]ApplicationInsightsComponentFeature `json:"Result,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationInsightsComponentAvailableFeatures. +func (aicaf ApplicationInsightsComponentAvailableFeatures) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ApplicationInsightsComponentBillingFeatures an Application Insights component billing features +type ApplicationInsightsComponentBillingFeatures struct { + autorest.Response `json:"-"` + // DataVolumeCap - An Application Insights component daily data volume cap + DataVolumeCap *ApplicationInsightsComponentDataVolumeCap `json:"DataVolumeCap,omitempty"` + // CurrentBillingFeatures - Current enabled pricing plan. When the component is in the Enterprise plan, this will list both 'Basic' and 'Application Insights Enterprise'. + CurrentBillingFeatures *[]string `json:"CurrentBillingFeatures,omitempty"` +} + +// ApplicationInsightsComponentDataVolumeCap an Application Insights component daily data volume cap +type ApplicationInsightsComponentDataVolumeCap struct { + // Cap - Daily data volume cap in GB. + Cap *float64 `json:"Cap,omitempty"` + // ResetTime - READ-ONLY; Daily data volume cap UTC reset hour. + ResetTime *int32 `json:"ResetTime,omitempty"` + // WarningThreshold - Reserved, not used for now. + WarningThreshold *int32 `json:"WarningThreshold,omitempty"` + // StopSendNotificationWhenHitThreshold - Reserved, not used for now. + StopSendNotificationWhenHitThreshold *bool `json:"StopSendNotificationWhenHitThreshold,omitempty"` + // StopSendNotificationWhenHitCap - Do not send a notification email when the daily data volume cap is met. + StopSendNotificationWhenHitCap *bool `json:"StopSendNotificationWhenHitCap,omitempty"` + // MaxHistoryCap - READ-ONLY; Maximum daily data volume cap that the user can set for this component. + MaxHistoryCap *float64 `json:"MaxHistoryCap,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationInsightsComponentDataVolumeCap. +func (aicdvc ApplicationInsightsComponentDataVolumeCap) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if aicdvc.Cap != nil { + objectMap["Cap"] = aicdvc.Cap + } + if aicdvc.WarningThreshold != nil { + objectMap["WarningThreshold"] = aicdvc.WarningThreshold + } + if aicdvc.StopSendNotificationWhenHitThreshold != nil { + objectMap["StopSendNotificationWhenHitThreshold"] = aicdvc.StopSendNotificationWhenHitThreshold + } + if aicdvc.StopSendNotificationWhenHitCap != nil { + objectMap["StopSendNotificationWhenHitCap"] = aicdvc.StopSendNotificationWhenHitCap + } + return json.Marshal(objectMap) +} + +// ApplicationInsightsComponentExportConfiguration properties that define a Continuous Export +// configuration. +type ApplicationInsightsComponentExportConfiguration struct { + autorest.Response `json:"-"` + // ExportID - READ-ONLY; The unique ID of the export configuration inside an Application Insights component. It is auto generated when the Continuous Export configuration is created. + ExportID *string `json:"ExportId,omitempty"` + // InstrumentationKey - READ-ONLY; The instrumentation key of the Application Insights component. + InstrumentationKey *string `json:"InstrumentationKey,omitempty"` + // RecordTypes - This comma separated list of document types that will be exported. The possible values include 'Requests', 'Event', 'Exceptions', 'Metrics', 'PageViews', 'PageViewPerformance', 'Rdd', 'PerformanceCounters', 'Availability', 'Messages'. + RecordTypes *string `json:"RecordTypes,omitempty"` + // ApplicationName - READ-ONLY; The name of the Application Insights component. + ApplicationName *string `json:"ApplicationName,omitempty"` + // SubscriptionID - READ-ONLY; The subscription of the Application Insights component. + SubscriptionID *string `json:"SubscriptionId,omitempty"` + // ResourceGroup - READ-ONLY; The resource group of the Application Insights component. + ResourceGroup *string `json:"ResourceGroup,omitempty"` + // DestinationStorageSubscriptionID - READ-ONLY; The destination storage account subscription ID. + DestinationStorageSubscriptionID *string `json:"DestinationStorageSubscriptionId,omitempty"` + // DestinationStorageLocationID - READ-ONLY; The destination account location ID. + DestinationStorageLocationID *string `json:"DestinationStorageLocationId,omitempty"` + // DestinationAccountID - READ-ONLY; The name of destination account. + DestinationAccountID *string `json:"DestinationAccountId,omitempty"` + // DestinationType - READ-ONLY; The destination type. + DestinationType *string `json:"DestinationType,omitempty"` + // IsUserEnabled - READ-ONLY; This will be 'true' if the Continuous Export configuration is enabled, otherwise it will be 'false'. + IsUserEnabled *string `json:"IsUserEnabled,omitempty"` + // LastUserUpdate - READ-ONLY; Last time the Continuous Export configuration was updated. + LastUserUpdate *string `json:"LastUserUpdate,omitempty"` + // NotificationQueueEnabled - Deprecated + NotificationQueueEnabled *string `json:"NotificationQueueEnabled,omitempty"` + // ExportStatus - READ-ONLY; This indicates current Continuous Export configuration status. The possible values are 'Preparing', 'Success', 'Failure'. + ExportStatus *string `json:"ExportStatus,omitempty"` + // LastSuccessTime - READ-ONLY; The last time data was successfully delivered to the destination storage container for this Continuous Export configuration. + LastSuccessTime *string `json:"LastSuccessTime,omitempty"` + // LastGapTime - READ-ONLY; The last time the Continuous Export configuration started failing. + LastGapTime *string `json:"LastGapTime,omitempty"` + // PermanentErrorReason - READ-ONLY; This is the reason the Continuous Export configuration started failing. It can be 'AzureStorageNotFound' or 'AzureStorageAccessDenied'. + PermanentErrorReason *string `json:"PermanentErrorReason,omitempty"` + // StorageName - READ-ONLY; The name of the destination storage account. + StorageName *string `json:"StorageName,omitempty"` + // ContainerName - READ-ONLY; The name of the destination storage container. + ContainerName *string `json:"ContainerName,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationInsightsComponentExportConfiguration. +func (aicec ApplicationInsightsComponentExportConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if aicec.RecordTypes != nil { + objectMap["RecordTypes"] = aicec.RecordTypes + } + if aicec.NotificationQueueEnabled != nil { + objectMap["NotificationQueueEnabled"] = aicec.NotificationQueueEnabled + } + return json.Marshal(objectMap) +} + +// ApplicationInsightsComponentExportRequest an Application Insights component Continuous Export +// configuration request definition. +type ApplicationInsightsComponentExportRequest struct { + // RecordTypes - The document types to be exported, as comma separated values. Allowed values include 'Requests', 'Event', 'Exceptions', 'Metrics', 'PageViews', 'PageViewPerformance', 'Rdd', 'PerformanceCounters', 'Availability', 'Messages'. + RecordTypes *string `json:"RecordTypes,omitempty"` + // DestinationType - The Continuous Export destination type. This has to be 'Blob'. + DestinationType *string `json:"DestinationType,omitempty"` + // DestinationAddress - The SAS URL for the destination storage container. It must grant write permission. + DestinationAddress *string `json:"DestinationAddress,omitempty"` + // IsEnabled - Set to 'true' to create a Continuous Export configuration as enabled, otherwise set it to 'false'. + IsEnabled *string `json:"IsEnabled,omitempty"` + // NotificationQueueEnabled - Deprecated + NotificationQueueEnabled *string `json:"NotificationQueueEnabled,omitempty"` + // NotificationQueueURI - Deprecated + NotificationQueueURI *string `json:"NotificationQueueUri,omitempty"` + // DestinationStorageSubscriptionID - The subscription ID of the destination storage container. + DestinationStorageSubscriptionID *string `json:"DestinationStorageSubscriptionId,omitempty"` + // DestinationStorageLocationID - The location ID of the destination storage container. + DestinationStorageLocationID *string `json:"DestinationStorageLocationId,omitempty"` + // DestinationAccountID - The name of destination storage account. + 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 - READ-ONLY; 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 - READ-ONLY; 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 - READ-ONLY; Unique user id of the specific user that owns this favorite. + UserID *string `json:"UserId,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationInsightsComponentFavorite. +func (aicf ApplicationInsightsComponentFavorite) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if aicf.Name != nil { + objectMap["Name"] = aicf.Name + } + if aicf.Config != nil { + objectMap["Config"] = aicf.Config + } + if aicf.Version != nil { + objectMap["Version"] = aicf.Version + } + if aicf.FavoriteType != "" { + objectMap["FavoriteType"] = aicf.FavoriteType + } + if aicf.SourceType != nil { + objectMap["SourceType"] = aicf.SourceType + } + if aicf.Tags != nil { + objectMap["Tags"] = aicf.Tags + } + if aicf.Category != nil { + objectMap["Category"] = aicf.Category + } + if aicf.IsGeneratedFromTemplate != nil { + objectMap["IsGeneratedFromTemplate"] = aicf.IsGeneratedFromTemplate + } + return json.Marshal(objectMap) +} + +// ApplicationInsightsComponentFeature an Application Insights component daily data volume cap status +type ApplicationInsightsComponentFeature struct { + // FeatureName - READ-ONLY; The pricing feature name. + FeatureName *string `json:"FeatureName,omitempty"` + // MeterID - READ-ONLY; The meter id used for the feature. + MeterID *string `json:"MeterId,omitempty"` + // MeterRateFrequency - READ-ONLY; The meter rate for the feature's meter. + MeterRateFrequency *string `json:"MeterRateFrequency,omitempty"` + // ResouceID - READ-ONLY; Reserved, not used now. + ResouceID *string `json:"ResouceId,omitempty"` + // IsHidden - READ-ONLY; Reserved, not used now. + IsHidden *bool `json:"IsHidden,omitempty"` + // Capabilities - READ-ONLY; A list of Application Insights component feature capability. + Capabilities *[]ApplicationInsightsComponentFeatureCapability `json:"Capabilities,omitempty"` + // Title - READ-ONLY; Display name of the feature. + Title *string `json:"Title,omitempty"` + // IsMainFeature - READ-ONLY; Whether can apply addon feature on to it. + IsMainFeature *bool `json:"IsMainFeature,omitempty"` + // SupportedAddonFeatures - READ-ONLY; The add on features on main feature. + SupportedAddonFeatures *string `json:"SupportedAddonFeatures,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationInsightsComponentFeature. +func (aicf ApplicationInsightsComponentFeature) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ApplicationInsightsComponentFeatureCapabilities an Application Insights component feature capabilities +type ApplicationInsightsComponentFeatureCapabilities struct { + autorest.Response `json:"-"` + // SupportExportData - READ-ONLY; Whether allow to use continuous export feature. + SupportExportData *bool `json:"SupportExportData,omitempty"` + // BurstThrottlePolicy - READ-ONLY; Reserved, not used now. + BurstThrottlePolicy *string `json:"BurstThrottlePolicy,omitempty"` + // MetadataClass - READ-ONLY; Reserved, not used now. + MetadataClass *string `json:"MetadataClass,omitempty"` + // LiveStreamMetrics - READ-ONLY; Reserved, not used now. + LiveStreamMetrics *bool `json:"LiveStreamMetrics,omitempty"` + // ApplicationMap - READ-ONLY; Reserved, not used now. + ApplicationMap *bool `json:"ApplicationMap,omitempty"` + // WorkItemIntegration - READ-ONLY; Whether allow to use work item integration feature. + WorkItemIntegration *bool `json:"WorkItemIntegration,omitempty"` + // PowerBIIntegration - READ-ONLY; Reserved, not used now. + PowerBIIntegration *bool `json:"PowerBIIntegration,omitempty"` + // OpenSchema - READ-ONLY; Reserved, not used now. + OpenSchema *bool `json:"OpenSchema,omitempty"` + // ProactiveDetection - READ-ONLY; Reserved, not used now. + ProactiveDetection *bool `json:"ProactiveDetection,omitempty"` + // AnalyticsIntegration - READ-ONLY; Reserved, not used now. + AnalyticsIntegration *bool `json:"AnalyticsIntegration,omitempty"` + // MultipleStepWebTest - READ-ONLY; Whether allow to use multiple steps web test feature. + MultipleStepWebTest *bool `json:"MultipleStepWebTest,omitempty"` + // APIAccessLevel - READ-ONLY; Reserved, not used now. + APIAccessLevel *string `json:"ApiAccessLevel,omitempty"` + // TrackingType - READ-ONLY; The application insights component used tracking type. + TrackingType *string `json:"TrackingType,omitempty"` + // DailyCap - READ-ONLY; Daily data volume cap in GB. + DailyCap *float64 `json:"DailyCap,omitempty"` + // DailyCapResetTime - READ-ONLY; Daily data volume cap UTC reset hour. + DailyCapResetTime *float64 `json:"DailyCapResetTime,omitempty"` + // ThrottleRate - READ-ONLY; Reserved, not used now. + ThrottleRate *float64 `json:"ThrottleRate,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationInsightsComponentFeatureCapabilities. +func (aicfc ApplicationInsightsComponentFeatureCapabilities) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ApplicationInsightsComponentFeatureCapability an Application Insights component feature capability +type ApplicationInsightsComponentFeatureCapability struct { + // Name - READ-ONLY; The name of the capability. + Name *string `json:"Name,omitempty"` + // Description - READ-ONLY; The description of the capability. + Description *string `json:"Description,omitempty"` + // Value - READ-ONLY; The value of the capability. + Value *string `json:"Value,omitempty"` + // Unit - READ-ONLY; The unit of the capability. + Unit *string `json:"Unit,omitempty"` + // MeterID - READ-ONLY; The meter used for the capability. + MeterID *string `json:"MeterId,omitempty"` + // MeterRateFrequency - READ-ONLY; The meter rate of the meter. + MeterRateFrequency *string `json:"MeterRateFrequency,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationInsightsComponentFeatureCapability. +func (aicfc ApplicationInsightsComponentFeatureCapability) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ApplicationInsightsComponentListResult describes the list of Application Insights Resources. +type ApplicationInsightsComponentListResult struct { + autorest.Response `json:"-"` + // Value - List of Application Insights component definitions. + Value *[]ApplicationInsightsComponent `json:"value,omitempty"` + // NextLink - The URI to get the next set of Application Insights component definitions if too many components where returned in the result set. + NextLink *string `json:"nextLink,omitempty"` +} + +// ApplicationInsightsComponentListResultIterator provides access to a complete listing of +// ApplicationInsightsComponent values. +type ApplicationInsightsComponentListResultIterator struct { + i int + page ApplicationInsightsComponentListResultPage +} + +// NextWithContext 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 *ApplicationInsightsComponentListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationInsightsComponentListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ApplicationInsightsComponentListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ApplicationInsightsComponentListResultIterator) 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 ApplicationInsightsComponentListResultIterator) Response() ApplicationInsightsComponentListResult { + 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 ApplicationInsightsComponentListResultIterator) Value() ApplicationInsightsComponent { + if !iter.page.NotDone() { + return ApplicationInsightsComponent{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ApplicationInsightsComponentListResultIterator type. +func NewApplicationInsightsComponentListResultIterator(page ApplicationInsightsComponentListResultPage) ApplicationInsightsComponentListResultIterator { + return ApplicationInsightsComponentListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (aiclr ApplicationInsightsComponentListResult) IsEmpty() bool { + return aiclr.Value == nil || len(*aiclr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (aiclr ApplicationInsightsComponentListResult) hasNextLink() bool { + return aiclr.NextLink != nil && len(*aiclr.NextLink) != 0 +} + +// applicationInsightsComponentListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (aiclr ApplicationInsightsComponentListResult) applicationInsightsComponentListResultPreparer(ctx context.Context) (*http.Request, error) { + if !aiclr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(aiclr.NextLink))) +} + +// ApplicationInsightsComponentListResultPage contains a page of ApplicationInsightsComponent values. +type ApplicationInsightsComponentListResultPage struct { + fn func(context.Context, ApplicationInsightsComponentListResult) (ApplicationInsightsComponentListResult, error) + aiclr ApplicationInsightsComponentListResult +} + +// NextWithContext 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 *ApplicationInsightsComponentListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationInsightsComponentListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.aiclr) + if err != nil { + return err + } + page.aiclr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// 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. +// Deprecated: Use NextWithContext() instead. +func (page *ApplicationInsightsComponentListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ApplicationInsightsComponentListResultPage) NotDone() bool { + return !page.aiclr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ApplicationInsightsComponentListResultPage) Response() ApplicationInsightsComponentListResult { + return page.aiclr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ApplicationInsightsComponentListResultPage) Values() []ApplicationInsightsComponent { + if page.aiclr.IsEmpty() { + return nil + } + return *page.aiclr.Value +} + +// Creates a new instance of the ApplicationInsightsComponentListResultPage type. +func NewApplicationInsightsComponentListResultPage(cur ApplicationInsightsComponentListResult, getNextPage func(context.Context, ApplicationInsightsComponentListResult) (ApplicationInsightsComponentListResult, error)) ApplicationInsightsComponentListResultPage { + return ApplicationInsightsComponentListResultPage{ + fn: getNextPage, + aiclr: cur, + } +} + +// ApplicationInsightsComponentProactiveDetectionConfiguration properties that define a ProactiveDetection +// configuration. +type ApplicationInsightsComponentProactiveDetectionConfiguration struct { + autorest.Response `json:"-"` + // Name - The rule name + Name *string `json:"Name,omitempty"` + // Enabled - A flag that indicates whether this rule is enabled by the user + Enabled *bool `json:"Enabled,omitempty"` + // SendEmailsToSubscriptionOwners - A flag that indicated whether notifications on this rule should be sent to subscription owners + SendEmailsToSubscriptionOwners *bool `json:"SendEmailsToSubscriptionOwners,omitempty"` + // CustomEmails - Custom email addresses for this rule notifications + CustomEmails *[]string `json:"CustomEmails,omitempty"` + // LastUpdatedTime - The last time this rule was updated + LastUpdatedTime *string `json:"LastUpdatedTime,omitempty"` + // RuleDefinitions - Static definitions of the ProactiveDetection configuration rule (same values for all components). + RuleDefinitions *ApplicationInsightsComponentProactiveDetectionConfigurationRuleDefinitions `json:"RuleDefinitions,omitempty"` +} + +// ApplicationInsightsComponentProactiveDetectionConfigurationRuleDefinitions static definitions of the +// ProactiveDetection configuration rule (same values for all components). +type ApplicationInsightsComponentProactiveDetectionConfigurationRuleDefinitions struct { + // Name - The rule name + Name *string `json:"Name,omitempty"` + // DisplayName - The rule name as it is displayed in UI + DisplayName *string `json:"DisplayName,omitempty"` + // Description - The rule description + Description *string `json:"Description,omitempty"` + // HelpURL - URL which displays additional info about the proactive detection rule + HelpURL *string `json:"HelpUrl,omitempty"` + // IsHidden - A flag indicating whether the rule is hidden (from the UI) + IsHidden *bool `json:"IsHidden,omitempty"` + // IsEnabledByDefault - A flag indicating whether the rule is enabled by default + IsEnabledByDefault *bool `json:"IsEnabledByDefault,omitempty"` + // IsInPreview - A flag indicating whether the rule is in preview + IsInPreview *bool `json:"IsInPreview,omitempty"` + // SupportsEmailNotifications - A flag indicating whether email notifications are supported for detections for this rule + SupportsEmailNotifications *bool `json:"SupportsEmailNotifications,omitempty"` +} + +// ApplicationInsightsComponentProperties properties that define an Application Insights component +// resource. +type ApplicationInsightsComponentProperties struct { + // ApplicationID - READ-ONLY; The unique ID of your application. This field mirrors the 'Name' field and cannot be changed. + ApplicationID *string `json:"ApplicationId,omitempty"` + // AppID - READ-ONLY; Application Insights Unique ID for your Application. + AppID *string `json:"AppId,omitempty"` + // Name - READ-ONLY; Application name. + Name *string `json:"Name,omitempty"` + // ApplicationType - Type of application being monitored. Possible values include: 'Web', 'Other' + ApplicationType ApplicationType `json:"Application_Type,omitempty"` + // FlowType - Used by the Application Insights system to determine what kind of flow this component was created by. This is to be set to 'Bluefield' when creating/updating a component via the REST API. Possible values include: 'Bluefield' + FlowType FlowType `json:"Flow_Type,omitempty"` + // RequestSource - Describes what tool created this Application Insights component. Customers using this API should set this to the default 'rest'. Possible values include: 'Rest' + RequestSource RequestSource `json:"Request_Source,omitempty"` + // InstrumentationKey - READ-ONLY; Application Insights Instrumentation key. A read-only value that applications can use to identify the destination for all telemetry sent to Azure Application Insights. This value will be supplied upon construction of each new Application Insights component. + InstrumentationKey *string `json:"InstrumentationKey,omitempty"` + // CreationDate - READ-ONLY; Creation Date for the Application Insights component, in ISO 8601 format. + CreationDate *date.Time `json:"CreationDate,omitempty"` + // TenantID - READ-ONLY; Azure Tenant Id. + TenantID *string `json:"TenantId,omitempty"` + // HockeyAppID - The unique application ID created when a new application is added to HockeyApp, used for communications with HockeyApp. + HockeyAppID *string `json:"HockeyAppId,omitempty"` + // HockeyAppToken - READ-ONLY; Token used to authenticate communications with between Application Insights and HockeyApp. + HockeyAppToken *string `json:"HockeyAppToken,omitempty"` + // ProvisioningState - READ-ONLY; Current state of this component: whether or not is has been provisioned within the resource group it is defined. Users cannot change this value but are able to read from it. Values will include Succeeded, Deploying, Canceled, and Failed. + ProvisioningState *string `json:"provisioningState,omitempty"` + // SamplingPercentage - Percentage of the data produced by the application being monitored that is being sampled for Application Insights telemetry. + SamplingPercentage *float64 `json:"SamplingPercentage,omitempty"` + // ConnectionString - READ-ONLY; Application Insights component connection string. + ConnectionString *string `json:"ConnectionString,omitempty"` + // RetentionInDays - READ-ONLY; Retention period in days. + RetentionInDays *int32 `json:"RetentionInDays,omitempty"` + // DisableIPMasking - Disable IP masking. + DisableIPMasking *bool `json:"DisableIpMasking,omitempty"` + // ImmediatePurgeDataOn30Days - Purge data immediately after 30 days. + ImmediatePurgeDataOn30Days *bool `json:"ImmediatePurgeDataOn30Days,omitempty"` + // WorkspaceResourceID - Resource Id of the log analytics workspace which the data will be ingested to. This property is required to create an application with this API version. Applications from older versions will not have this property. + WorkspaceResourceID *string `json:"WorkspaceResourceId,omitempty"` + // LaMigrationDate - READ-ONLY; The date which the component got migrated to LA, in ISO 8601 format. + LaMigrationDate *date.Time `json:"LaMigrationDate,omitempty"` + // PrivateLinkScopedResources - READ-ONLY; List of linked private link scope resources. + PrivateLinkScopedResources *[]PrivateLinkScopedResource `json:"PrivateLinkScopedResources,omitempty"` + // PublicNetworkAccessForIngestion - The network access type for accessing Application Insights ingestion. Possible values include: 'Enabled', 'Disabled' + PublicNetworkAccessForIngestion PublicNetworkAccessType `json:"publicNetworkAccessForIngestion,omitempty"` + // PublicNetworkAccessForQuery - The network access type for accessing Application Insights query. Possible values include: 'Enabled', 'Disabled' + PublicNetworkAccessForQuery PublicNetworkAccessType `json:"publicNetworkAccessForQuery,omitempty"` + // IngestionMode - Indicates the flow of the ingestion. Possible values include: 'ApplicationInsights', 'ApplicationInsightsWithDiagnosticSettings', 'LogAnalytics' + IngestionMode IngestionMode `json:"IngestionMode,omitempty"` + // DisableLocalAuth - Disable Non-AAD based Auth. + DisableLocalAuth *bool `json:"DisableLocalAuth,omitempty"` + // ForceCustomerStorageForProfiler - Force users to create their own storage account for profiler and debugger. + ForceCustomerStorageForProfiler *bool `json:"ForceCustomerStorageForProfiler,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationInsightsComponentProperties. +func (aicp ApplicationInsightsComponentProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if aicp.ApplicationType != "" { + objectMap["Application_Type"] = aicp.ApplicationType + } + if aicp.FlowType != "" { + objectMap["Flow_Type"] = aicp.FlowType + } + if aicp.RequestSource != "" { + objectMap["Request_Source"] = aicp.RequestSource + } + if aicp.HockeyAppID != nil { + objectMap["HockeyAppId"] = aicp.HockeyAppID + } + if aicp.SamplingPercentage != nil { + objectMap["SamplingPercentage"] = aicp.SamplingPercentage + } + if aicp.DisableIPMasking != nil { + objectMap["DisableIpMasking"] = aicp.DisableIPMasking + } + if aicp.ImmediatePurgeDataOn30Days != nil { + objectMap["ImmediatePurgeDataOn30Days"] = aicp.ImmediatePurgeDataOn30Days + } + if aicp.WorkspaceResourceID != nil { + objectMap["WorkspaceResourceId"] = aicp.WorkspaceResourceID + } + if aicp.PublicNetworkAccessForIngestion != "" { + objectMap["publicNetworkAccessForIngestion"] = aicp.PublicNetworkAccessForIngestion + } + if aicp.PublicNetworkAccessForQuery != "" { + objectMap["publicNetworkAccessForQuery"] = aicp.PublicNetworkAccessForQuery + } + if aicp.IngestionMode != "" { + objectMap["IngestionMode"] = aicp.IngestionMode + } + if aicp.DisableLocalAuth != nil { + objectMap["DisableLocalAuth"] = aicp.DisableLocalAuth + } + if aicp.ForceCustomerStorageForProfiler != nil { + objectMap["ForceCustomerStorageForProfiler"] = aicp.ForceCustomerStorageForProfiler + } + return json.Marshal(objectMap) +} + +// ApplicationInsightsComponentQuotaStatus an Application Insights component daily data volume cap status +type ApplicationInsightsComponentQuotaStatus struct { + autorest.Response `json:"-"` + // AppID - READ-ONLY; The Application ID for the Application Insights component. + AppID *string `json:"AppId,omitempty"` + // ShouldBeThrottled - READ-ONLY; The daily data volume cap is met, and data ingestion will be stopped. + ShouldBeThrottled *bool `json:"ShouldBeThrottled,omitempty"` + // ExpirationTime - READ-ONLY; Date and time when the daily data volume cap will be reset, and data ingestion will resume. + ExpirationTime *string `json:"ExpirationTime,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationInsightsComponentQuotaStatus. +func (aicqs ApplicationInsightsComponentQuotaStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ApplicationInsightsComponentWebTestLocation properties that define a web test location available to an +// Application Insights Component. +type ApplicationInsightsComponentWebTestLocation struct { + // DisplayName - READ-ONLY; The display name of the web test location. + DisplayName *string `json:"DisplayName,omitempty"` + // Tag - READ-ONLY; Internally defined geographic location tag. + Tag *string `json:"Tag,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationInsightsComponentWebTestLocation. +func (aicwtl ApplicationInsightsComponentWebTestLocation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// 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"` +} + +// AzureEntityResource the resource model definition for an Azure Resource Manager resource with an etag. +type AzureEntityResource struct { + // Etag - READ-ONLY; Resource Etag. + Etag *string `json:"etag,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for AzureEntityResource. +func (aer AzureEntityResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ComponentLinkedStorageAccounts an Application Insights component linked storage accounts +type ComponentLinkedStorageAccounts struct { + autorest.Response `json:"-"` + // LinkedStorageAccountsProperties - The properties of the linked storage accounts. + *LinkedStorageAccountsProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ComponentLinkedStorageAccounts. +func (clsa ComponentLinkedStorageAccounts) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if clsa.LinkedStorageAccountsProperties != nil { + objectMap["properties"] = clsa.LinkedStorageAccountsProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ComponentLinkedStorageAccounts struct. +func (clsa *ComponentLinkedStorageAccounts) 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 linkedStorageAccountsProperties LinkedStorageAccountsProperties + err = json.Unmarshal(*v, &linkedStorageAccountsProperties) + if err != nil { + return err + } + clsa.LinkedStorageAccountsProperties = &linkedStorageAccountsProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + clsa.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + clsa.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + clsa.Type = &typeVar + } + } + } + + return nil +} + +// ComponentLinkedStorageAccountsPatch an Application Insights component linked storage accounts patch +type ComponentLinkedStorageAccountsPatch struct { + // LinkedStorageAccountsProperties - The properties of the linked storage accounts. + *LinkedStorageAccountsProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for ComponentLinkedStorageAccountsPatch. +func (clsap ComponentLinkedStorageAccountsPatch) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if clsap.LinkedStorageAccountsProperties != nil { + objectMap["properties"] = clsap.LinkedStorageAccountsProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ComponentLinkedStorageAccountsPatch struct. +func (clsap *ComponentLinkedStorageAccountsPatch) 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 linkedStorageAccountsProperties LinkedStorageAccountsProperties + err = json.Unmarshal(*v, &linkedStorageAccountsProperties) + if err != nil { + return err + } + clsap.LinkedStorageAccountsProperties = &linkedStorageAccountsProperties + } + } + } + + return nil +} + +// ComponentPurgeBody describes the body of a purge request for an App Insights component +type ComponentPurgeBody struct { + // Table - Table from which to purge data. + Table *string `json:"table,omitempty"` + // Filters - The set of columns and filters (queries) to run over them to purge the resulting data. + Filters *[]ComponentPurgeBodyFilters `json:"filters,omitempty"` +} + +// ComponentPurgeBodyFilters user-defined filters to return data which will be purged from the table. +type ComponentPurgeBodyFilters struct { + // Column - The column of the table over which the given query should run + Column *string `json:"column,omitempty"` + // Operator - A query operator to evaluate over the provided column and value(s). Supported operators are ==, =~, in, in~, >, >=, <, <=, between, and have the same behavior as they would in a KQL query. + Operator *string `json:"operator,omitempty"` + // Value - the value for the operator to function over. This can be a number (e.g., > 100), a string (timestamp >= '2017-09-01') or array of values. + Value interface{} `json:"value,omitempty"` + // Key - When filtering over custom dimensions, this key will be used as the name of the custom dimension. + Key *string `json:"key,omitempty"` +} + +// ComponentPurgeResponse response containing operationId for a specific purge action. +type ComponentPurgeResponse struct { + autorest.Response `json:"-"` + // OperationID - Id to use when querying for status for a particular purge operation. + OperationID *string `json:"operationId,omitempty"` +} + +// ComponentPurgeStatusResponse response containing status for a specific purge operation. +type ComponentPurgeStatusResponse struct { + autorest.Response `json:"-"` + // Status - Status of the operation represented by the requested Id. Possible values include: 'Pending', 'Completed' + Status PurgeState `json:"status,omitempty"` +} + +// ComponentsResource an azure resource object +type ComponentsResource struct { + // ID - READ-ONLY; Azure resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Azure resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; 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 ComponentsResource. +func (cr ComponentsResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cr.Location != nil { + objectMap["location"] = cr.Location + } + if cr.Tags != nil { + objectMap["tags"] = cr.Tags + } + return json.Marshal(objectMap) +} + +// ErrorFieldContract error Field contract. +type ErrorFieldContract struct { + // Code - Property level error code. + Code *string `json:"code,omitempty"` + // Message - Human-readable representation of property-level error. + Message *string `json:"message,omitempty"` + // Target - Property name. + Target *string `json:"target,omitempty"` +} + +// ErrorResponse error response indicates Insights service is not able to process the incoming request. The +// reason is provided in the error message. +type ErrorResponse struct { + // Code - Error code. + Code *string `json:"code,omitempty"` + // Message - Error message indicating why the operation failed. + Message *string `json:"message,omitempty"` +} + +// ErrorResponseComponents ... +type ErrorResponseComponents struct { + // Error - Error response indicates Insights service is not able to process the incoming request. The reason is provided in the error message. + Error *ErrorResponseComponentsError `json:"error,omitempty"` +} + +// ErrorResponseComponentsError error response indicates Insights service is not able to process the +// incoming request. The reason is provided in the error message. +type ErrorResponseComponentsError struct { + // Code - READ-ONLY; Error code. + Code *string `json:"code,omitempty"` + // Message - READ-ONLY; Error message indicating why the operation failed. + Message *string `json:"message,omitempty"` +} + +// MarshalJSON is the custom marshaler for ErrorResponseComponentsError. +func (erc ErrorResponseComponentsError) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ErrorResponseLinkedStorage ... +type ErrorResponseLinkedStorage struct { + // Error - Error response indicates Insights service is not able to process the incoming request. The reason is provided in the error message. + Error *ErrorResponseLinkedStorageError `json:"error,omitempty"` +} + +// ErrorResponseLinkedStorageError error response indicates Insights service is not able to process the +// incoming request. The reason is provided in the error message. +type ErrorResponseLinkedStorageError struct { + // Code - READ-ONLY; Error code. + Code *string `json:"code,omitempty"` + // Message - READ-ONLY; Error message indicating why the operation failed. + Message *string `json:"message,omitempty"` +} + +// MarshalJSON is the custom marshaler for ErrorResponseLinkedStorageError. +func (erls ErrorResponseLinkedStorageError) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// InnerError inner error +type InnerError struct { + // Diagnosticcontext - Provides correlation for request + Diagnosticcontext *string `json:"diagnosticcontext,omitempty"` + // Time - Request time + Time *date.Time `json:"time,omitempty"` +} + +// LinkedStorageAccountsProperties an Application Insights component linked storage account +type LinkedStorageAccountsProperties struct { + // LinkedStorageAccount - Linked storage account resource ID + LinkedStorageAccount *string `json:"linkedStorageAccount,omitempty"` +} + +// LinkProperties contains a sourceId and workbook resource id to link two resources. +type LinkProperties struct { + // SourceID - The source Azure resource id + SourceID *string `json:"sourceId,omitempty"` + // TargetID - The workbook Azure resource id + TargetID *string `json:"targetId,omitempty"` + // Category - The category of workbook + Category *string `json:"category,omitempty"` +} + +// ListAnnotation ... +type ListAnnotation struct { + autorest.Response `json:"-"` + Value *[]Annotation `json:"value,omitempty"` +} + +// ListApplicationInsightsComponentAnalyticsItem ... +type ListApplicationInsightsComponentAnalyticsItem struct { + autorest.Response `json:"-"` + Value *[]ApplicationInsightsComponentAnalyticsItem `json:"value,omitempty"` +} + +// ListApplicationInsightsComponentExportConfiguration ... +type ListApplicationInsightsComponentExportConfiguration struct { + autorest.Response `json:"-"` + Value *[]ApplicationInsightsComponentExportConfiguration `json:"value,omitempty"` +} + +// ListApplicationInsightsComponentFavorite ... +type ListApplicationInsightsComponentFavorite struct { + autorest.Response `json:"-"` + Value *[]ApplicationInsightsComponentFavorite `json:"value,omitempty"` +} + +// ListApplicationInsightsComponentProactiveDetectionConfiguration ... +type ListApplicationInsightsComponentProactiveDetectionConfiguration struct { + autorest.Response `json:"-"` + Value *[]ApplicationInsightsComponentProactiveDetectionConfiguration `json:"value,omitempty"` +} + +// MyWorkbook an Application Insights private workbook definition. +type MyWorkbook struct { + autorest.Response `json:"-"` + // Kind - The kind of workbook. Choices are user and shared. Possible values include: 'SharedTypeKindUser', 'SharedTypeKindShared' + Kind SharedTypeKind `json:"kind,omitempty"` + // MyWorkbookProperties - Metadata describing a workbook for an Azure resource. + *MyWorkbookProperties `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 MyWorkbook. +func (mw MyWorkbook) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mw.Kind != "" { + objectMap["kind"] = mw.Kind + } + if mw.MyWorkbookProperties != nil { + objectMap["properties"] = mw.MyWorkbookProperties + } + if mw.ID != nil { + objectMap["id"] = mw.ID + } + if mw.Name != nil { + objectMap["name"] = mw.Name + } + if mw.Type != nil { + objectMap["type"] = mw.Type + } + if mw.Location != nil { + objectMap["location"] = mw.Location + } + if mw.Tags != nil { + objectMap["tags"] = mw.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for MyWorkbook struct. +func (mw *MyWorkbook) 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 "kind": + if v != nil { + var kind SharedTypeKind + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + mw.Kind = kind + } + case "properties": + if v != nil { + var myWorkbookProperties MyWorkbookProperties + err = json.Unmarshal(*v, &myWorkbookProperties) + if err != nil { + return err + } + mw.MyWorkbookProperties = &myWorkbookProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + mw.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + mw.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + mw.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + mw.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + mw.Tags = tags + } + } + } + + return nil +} + +// MyWorkbookError error message body that will indicate why the operation failed. +type MyWorkbookError struct { + // Code - Service-defined error code. This code serves as a sub-status for the HTTP error code specified in the response. + Code *string `json:"code,omitempty"` + // Message - Human-readable representation of the error. + Message *string `json:"message,omitempty"` + // Details - The list of invalid fields send in request, in case of validation error. + Details *[]ErrorFieldContract `json:"details,omitempty"` +} + +// MyWorkbookProperties properties that contain a private workbook. +type MyWorkbookProperties struct { + // DisplayName - The user-defined name of the private workbook. + DisplayName *string `json:"displayName,omitempty"` + // SerializedData - Configuration of this particular private workbook. Configuration data is a string containing valid JSON + SerializedData *string `json:"serializedData,omitempty"` + // Version - This instance's version of the data model. This can change as new features are added that can be marked private workbook. + Version *string `json:"version,omitempty"` + // TimeModified - READ-ONLY; Date and time in UTC of the last modification that was made to this private workbook definition. + TimeModified *string `json:"timeModified,omitempty"` + // Category - Workbook category, as defined by the user at creation time. + Category *string `json:"category,omitempty"` + // Tags - A list of 0 or more tags that are associated with this private workbook definition + Tags *[]string `json:"tags,omitempty"` + // UserID - READ-ONLY; Unique user id of the specific user that owns this private workbook. + UserID *string `json:"userId,omitempty"` + // SourceID - Optional resourceId for a source resource. + SourceID *string `json:"sourceId,omitempty"` +} + +// MarshalJSON is the custom marshaler for MyWorkbookProperties. +func (mwp MyWorkbookProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mwp.DisplayName != nil { + objectMap["displayName"] = mwp.DisplayName + } + if mwp.SerializedData != nil { + objectMap["serializedData"] = mwp.SerializedData + } + if mwp.Version != nil { + objectMap["version"] = mwp.Version + } + if mwp.Category != nil { + objectMap["category"] = mwp.Category + } + if mwp.Tags != nil { + objectMap["tags"] = mwp.Tags + } + if mwp.SourceID != nil { + objectMap["sourceId"] = mwp.SourceID + } + return json.Marshal(objectMap) +} + +// MyWorkbookResource an azure resource object +type MyWorkbookResource 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 MyWorkbookResource. +func (mwr MyWorkbookResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mwr.ID != nil { + objectMap["id"] = mwr.ID + } + if mwr.Name != nil { + objectMap["name"] = mwr.Name + } + if mwr.Type != nil { + objectMap["type"] = mwr.Type + } + if mwr.Location != nil { + objectMap["location"] = mwr.Location + } + if mwr.Tags != nil { + objectMap["tags"] = mwr.Tags + } + return json.Marshal(objectMap) +} + +// MyWorkbooksListResult workbook list result. +type MyWorkbooksListResult struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; An array of private workbooks. + Value *[]MyWorkbook `json:"value,omitempty"` +} + +// MarshalJSON is the custom marshaler for MyWorkbooksListResult. +func (mwlr MyWorkbooksListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// Operation CDN REST API operation +type Operation struct { + // Name - Operation name: {provider}/{resource}/{operation} + Name *string `json:"name,omitempty"` + // Display - The object that represents the operation. + Display *OperationDisplay `json:"display,omitempty"` +} + +// OperationDisplay the object that represents the operation. +type OperationDisplay struct { + // Provider - Service provider: Microsoft.Cdn + Provider *string `json:"provider,omitempty"` + // Resource - Resource on which the operation is performed: Profile, endpoint, 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 CDN 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 CDN operations supported by the CDN resource 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"` +} + +// OperationListResultIterator provides access to a complete listing of Operation values. +type OperationListResultIterator struct { + i int + page OperationListResultPage +} + +// NextWithContext 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 *OperationListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *OperationListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter OperationListResultIterator) 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 OperationListResultIterator) Response() OperationListResult { + 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 OperationListResultIterator) Value() Operation { + if !iter.page.NotDone() { + return Operation{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the OperationListResultIterator type. +func NewOperationListResultIterator(page OperationListResultPage) OperationListResultIterator { + return OperationListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (olr OperationListResult) IsEmpty() bool { + return olr.Value == nil || len(*olr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (olr OperationListResult) hasNextLink() bool { + return olr.NextLink != nil && len(*olr.NextLink) != 0 +} + +// operationListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (olr OperationListResult) operationListResultPreparer(ctx context.Context) (*http.Request, error) { + if !olr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(olr.NextLink))) +} + +// OperationListResultPage contains a page of Operation values. +type OperationListResultPage struct { + fn func(context.Context, OperationListResult) (OperationListResult, error) + olr OperationListResult +} + +// NextWithContext 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 *OperationListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.olr) + if err != nil { + return err + } + page.olr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// 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. +// Deprecated: Use NextWithContext() instead. +func (page *OperationListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page OperationListResultPage) NotDone() bool { + return !page.olr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page OperationListResultPage) Response() OperationListResult { + return page.olr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page OperationListResultPage) Values() []Operation { + if page.olr.IsEmpty() { + return nil + } + return *page.olr.Value +} + +// Creates a new instance of the OperationListResultPage type. +func NewOperationListResultPage(cur OperationListResult, getNextPage func(context.Context, OperationListResult) (OperationListResult, error)) OperationListResultPage { + return OperationListResultPage{ + fn: getNextPage, + olr: cur, + } +} + +// PrivateLinkScopedResource the private link scope resource reference. +type PrivateLinkScopedResource struct { + // ResourceID - The full resource Id of the private link scope resource. + ResourceID *string `json:"ResourceId,omitempty"` + // ScopeID - The private link scope unique Identifier. + ScopeID *string `json:"ScopeId,omitempty"` +} + +// ProxyResource the resource model definition for a Azure Resource Manager proxy resource. It will not +// have tags and a location +type ProxyResource struct { + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ProxyResource. +func (pr ProxyResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// Resource common fields that are returned in the response for all Azure Resource Manager resources +type Resource struct { + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for Resource. +func (r Resource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// TagsResource a container holding only the Tags for a resource, allowing the user to update the tags on a +// WebTest instance. +type TagsResource struct { + // Tags - Resource tags + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for TagsResource. +func (tr TagsResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if tr.Tags != nil { + objectMap["tags"] = tr.Tags + } + return json.Marshal(objectMap) +} + +// TrackedResource the resource model definition for an Azure Resource Manager tracked top level resource +// which has 'tags' and a 'location' +type TrackedResource struct { + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` + // Location - The geo-location where the resource lives + Location *string `json:"location,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for TrackedResource. +func (tr TrackedResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if tr.Tags != nil { + objectMap["tags"] = tr.Tags + } + if tr.Location != nil { + objectMap["location"] = tr.Location + } + return json.Marshal(objectMap) +} + +// WebTest an Application Insights web test definition. +type WebTest struct { + autorest.Response `json:"-"` + // Kind - The kind of web test that this web test watches. Choices are ping and multistep. Possible values include: 'Ping', 'Multistep' + Kind WebTestKind `json:"kind,omitempty"` + // WebTestProperties - Metadata describing a web test for an Azure resource. + *WebTestProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Azure resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Azure resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; 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 WebTest. +func (wt WebTest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if wt.Kind != "" { + objectMap["kind"] = wt.Kind + } + if wt.WebTestProperties != nil { + objectMap["properties"] = wt.WebTestProperties + } + if wt.Location != nil { + objectMap["location"] = wt.Location + } + if wt.Tags != nil { + objectMap["tags"] = wt.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for WebTest struct. +func (wt *WebTest) 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 "kind": + if v != nil { + var kind WebTestKind + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + wt.Kind = kind + } + case "properties": + if v != nil { + var webTestProperties WebTestProperties + err = json.Unmarshal(*v, &webTestProperties) + if err != nil { + return err + } + wt.WebTestProperties = &webTestProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + wt.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + wt.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + wt.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + wt.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + wt.Tags = tags + } + } + } + + return nil +} + +// WebTestGeolocation geo-physical location to run a web test from. You must specify one or more locations +// for the test to run from. +type WebTestGeolocation struct { + // Location - Location ID for the webtest to run from. + Location *string `json:"Id,omitempty"` +} + +// WebTestListResult a list of 0 or more Application Insights web test definitions. +type WebTestListResult struct { + autorest.Response `json:"-"` + // Value - Set of Application Insights web test definitions. + Value *[]WebTest `json:"value,omitempty"` + // NextLink - The link to get the next part of the returned list of web tests, should the return set be too large for a single request. May be null. + NextLink *string `json:"nextLink,omitempty"` +} + +// WebTestListResultIterator provides access to a complete listing of WebTest values. +type WebTestListResultIterator struct { + i int + page WebTestListResultPage +} + +// NextWithContext 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 *WebTestListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WebTestListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *WebTestListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter WebTestListResultIterator) 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 WebTestListResultIterator) Response() WebTestListResult { + 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 WebTestListResultIterator) Value() WebTest { + if !iter.page.NotDone() { + return WebTest{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the WebTestListResultIterator type. +func NewWebTestListResultIterator(page WebTestListResultPage) WebTestListResultIterator { + return WebTestListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (wtlr WebTestListResult) IsEmpty() bool { + return wtlr.Value == nil || len(*wtlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (wtlr WebTestListResult) hasNextLink() bool { + return wtlr.NextLink != nil && len(*wtlr.NextLink) != 0 +} + +// webTestListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (wtlr WebTestListResult) webTestListResultPreparer(ctx context.Context) (*http.Request, error) { + if !wtlr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(wtlr.NextLink))) +} + +// WebTestListResultPage contains a page of WebTest values. +type WebTestListResultPage struct { + fn func(context.Context, WebTestListResult) (WebTestListResult, error) + wtlr WebTestListResult +} + +// NextWithContext 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 *WebTestListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WebTestListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.wtlr) + if err != nil { + return err + } + page.wtlr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// 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. +// Deprecated: Use NextWithContext() instead. +func (page *WebTestListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page WebTestListResultPage) NotDone() bool { + return !page.wtlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page WebTestListResultPage) Response() WebTestListResult { + return page.wtlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page WebTestListResultPage) Values() []WebTest { + if page.wtlr.IsEmpty() { + return nil + } + return *page.wtlr.Value +} + +// Creates a new instance of the WebTestListResultPage type. +func NewWebTestListResultPage(cur WebTestListResult, getNextPage func(context.Context, WebTestListResult) (WebTestListResult, error)) WebTestListResultPage { + return WebTestListResultPage{ + fn: getNextPage, + wtlr: cur, + } +} + +// WebTestProperties metadata describing a web test for an Azure resource. +type WebTestProperties struct { + // SyntheticMonitorID - Unique ID of this WebTest. This is typically the same value as the Name field. + SyntheticMonitorID *string `json:"SyntheticMonitorId,omitempty"` + // WebTestName - User defined name if this WebTest. + WebTestName *string `json:"Name,omitempty"` + // Description - Purpose/user defined descriptive test for this WebTest. + Description *string `json:"Description,omitempty"` + // Enabled - Is the test actively being monitored. + Enabled *bool `json:"Enabled,omitempty"` + // Frequency - Interval in seconds between test runs for this WebTest. Default value is 300. + Frequency *int32 `json:"Frequency,omitempty"` + // Timeout - Seconds until this WebTest will timeout and fail. Default value is 30. + Timeout *int32 `json:"Timeout,omitempty"` + // WebTestKind - The kind of web test this is, valid choices are ping and multistep. Possible values include: 'Ping', 'Multistep' + WebTestKind WebTestKind `json:"Kind,omitempty"` + // RetryEnabled - Allow for retries should this WebTest fail. + RetryEnabled *bool `json:"RetryEnabled,omitempty"` + // Locations - A list of where to physically run the tests from to give global coverage for accessibility of your application. + Locations *[]WebTestGeolocation `json:"Locations,omitempty"` + // Configuration - An XML configuration specification for a WebTest. + Configuration *WebTestPropertiesConfiguration `json:"Configuration,omitempty"` + // ProvisioningState - READ-ONLY; Current state of this component, whether or not is has been provisioned within the resource group it is defined. Users cannot change this value but are able to read from it. Values will include Succeeded, Deploying, Canceled, and Failed. + ProvisioningState *string `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for WebTestProperties. +func (wtp WebTestProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if wtp.SyntheticMonitorID != nil { + objectMap["SyntheticMonitorId"] = wtp.SyntheticMonitorID + } + if wtp.WebTestName != nil { + objectMap["Name"] = wtp.WebTestName + } + if wtp.Description != nil { + objectMap["Description"] = wtp.Description + } + if wtp.Enabled != nil { + objectMap["Enabled"] = wtp.Enabled + } + if wtp.Frequency != nil { + objectMap["Frequency"] = wtp.Frequency + } + if wtp.Timeout != nil { + objectMap["Timeout"] = wtp.Timeout + } + if wtp.WebTestKind != "" { + objectMap["Kind"] = wtp.WebTestKind + } + if wtp.RetryEnabled != nil { + objectMap["RetryEnabled"] = wtp.RetryEnabled + } + if wtp.Locations != nil { + objectMap["Locations"] = wtp.Locations + } + if wtp.Configuration != nil { + objectMap["Configuration"] = wtp.Configuration + } + return json.Marshal(objectMap) +} + +// WebTestPropertiesConfiguration an XML configuration specification for a WebTest. +type WebTestPropertiesConfiguration struct { + // WebTest - The XML specification of a WebTest to run against an application. + WebTest *string `json:"WebTest,omitempty"` +} + +// WebtestsResource an azure resource object +type WebtestsResource struct { + // ID - READ-ONLY; Azure resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Azure resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; 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 WebtestsResource. +func (wr WebtestsResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if wr.Location != nil { + objectMap["location"] = wr.Location + } + if wr.Tags != nil { + objectMap["tags"] = wr.Tags + } + return json.Marshal(objectMap) +} + +// Workbook an Application Insights workbook definition. +type Workbook struct { + autorest.Response `json:"-"` + // Kind - The kind of workbook. Choices are user and shared. Possible values include: 'SharedTypeKindUser', 'SharedTypeKindShared' + Kind SharedTypeKind `json:"kind,omitempty"` + // WorkbookProperties - Metadata describing a web test for an Azure resource. + *WorkbookProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Azure resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Azure resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; 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 Workbook. +func (w Workbook) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if w.Kind != "" { + objectMap["kind"] = w.Kind + } + if w.WorkbookProperties != nil { + objectMap["properties"] = w.WorkbookProperties + } + if w.Location != nil { + objectMap["location"] = w.Location + } + if w.Tags != nil { + objectMap["tags"] = w.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Workbook struct. +func (w *Workbook) 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 "kind": + if v != nil { + var kind SharedTypeKind + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + w.Kind = kind + } + case "properties": + if v != nil { + var workbookProperties WorkbookProperties + err = json.Unmarshal(*v, &workbookProperties) + if err != nil { + return err + } + w.WorkbookProperties = &workbookProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + w.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + w.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + w.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + w.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + w.Tags = tags + } + } + } + + return nil +} + +// WorkbookError error message body that will indicate why the operation failed. +type WorkbookError struct { + // Code - Service-defined error code. This code serves as a sub-status for the HTTP error code specified in the response. + Code *string `json:"code,omitempty"` + // Message - Human-readable representation of the error. + Message *string `json:"message,omitempty"` + // Details - The list of invalid fields send in request, in case of validation error. + Details *[]ErrorFieldContract `json:"details,omitempty"` +} + +// WorkbookProperties properties that contain a workbook. +type WorkbookProperties struct { + // Name - The user-defined name of the workbook. + Name *string `json:"name,omitempty"` + // SerializedData - Configuration of this particular workbook. Configuration data is a string containing valid JSON + SerializedData *string `json:"serializedData,omitempty"` + // Version - This instance's version of the data model. This can change as new features are added that can be marked workbook. + Version *string `json:"version,omitempty"` + // WorkbookID - Internally assigned unique id of the workbook definition. + WorkbookID *string `json:"workbookId,omitempty"` + // SharedTypeKind - Enum indicating if this workbook definition is owned by a specific user or is shared between all users with access to the Application Insights component. Possible values include: 'SharedTypeKindUser', 'SharedTypeKindShared' + SharedTypeKind SharedTypeKind `json:"kind,omitempty"` + // TimeModified - READ-ONLY; Date and time in UTC of the last modification that was made to this workbook definition. + TimeModified *string `json:"timeModified,omitempty"` + // Category - Workbook category, as defined by the user at creation time. + Category *string `json:"category,omitempty"` + // Tags - A list of 0 or more tags that are associated with this workbook definition + Tags *[]string `json:"tags,omitempty"` + // UserID - Unique user id of the specific user that owns this workbook. + UserID *string `json:"userId,omitempty"` + // SourceResourceID - Optional resourceId for a source resource. + SourceResourceID *string `json:"sourceResourceId,omitempty"` +} + +// MarshalJSON is the custom marshaler for WorkbookProperties. +func (wp WorkbookProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if wp.Name != nil { + objectMap["name"] = wp.Name + } + if wp.SerializedData != nil { + objectMap["serializedData"] = wp.SerializedData + } + if wp.Version != nil { + objectMap["version"] = wp.Version + } + if wp.WorkbookID != nil { + objectMap["workbookId"] = wp.WorkbookID + } + if wp.SharedTypeKind != "" { + objectMap["kind"] = wp.SharedTypeKind + } + if wp.Category != nil { + objectMap["category"] = wp.Category + } + if wp.Tags != nil { + objectMap["tags"] = wp.Tags + } + if wp.UserID != nil { + objectMap["userId"] = wp.UserID + } + if wp.SourceResourceID != nil { + objectMap["sourceResourceId"] = wp.SourceResourceID + } + return json.Marshal(objectMap) +} + +// WorkbookResource an azure resource object +type WorkbookResource struct { + // ID - READ-ONLY; Azure resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Azure resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; 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 WorkbookResource. +func (wr WorkbookResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if wr.Location != nil { + objectMap["location"] = wr.Location + } + if wr.Tags != nil { + objectMap["tags"] = wr.Tags + } + return json.Marshal(objectMap) +} + +// WorkbooksListResult workbook list result. +type WorkbooksListResult struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; An array of workbooks. + Value *[]Workbook `json:"value,omitempty"` +} + +// MarshalJSON is the custom marshaler for WorkbooksListResult. +func (wlr WorkbooksListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// WorkItemConfiguration work item configuration associated with an application insights resource. +type WorkItemConfiguration struct { + autorest.Response `json:"-"` + // ConnectorID - Connector identifier where work item is created + ConnectorID *string `json:"ConnectorId,omitempty"` + // ConfigDisplayName - Configuration friendly name + ConfigDisplayName *string `json:"ConfigDisplayName,omitempty"` + // IsDefault - Boolean value indicating whether configuration is default + IsDefault *bool `json:"IsDefault,omitempty"` + // ID - Unique Id for work item + ID *string `json:"Id,omitempty"` + // ConfigProperties - Serialized JSON object for detailed properties + ConfigProperties *string `json:"ConfigProperties,omitempty"` +} + +// WorkItemConfigurationError error associated with trying to get work item configuration or configurations +type WorkItemConfigurationError struct { + // Code - Error detail code and explanation + Code *string `json:"code,omitempty"` + // Message - Error message + Message *string `json:"message,omitempty"` + Innererror *InnerError `json:"innererror,omitempty"` +} + +// WorkItemConfigurationsListResult work item configuration list result. +type WorkItemConfigurationsListResult struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; An array of work item configurations. + Value *[]WorkItemConfiguration `json:"value,omitempty"` +} + +// MarshalJSON is the custom marshaler for WorkItemConfigurationsListResult. +func (wiclr WorkItemConfigurationsListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// WorkItemCreateConfiguration work item configuration creation payload +type WorkItemCreateConfiguration struct { + // ConnectorID - Unique connector id + ConnectorID *string `json:"ConnectorId,omitempty"` + // ConnectorDataConfiguration - Serialized JSON object for detailed properties + ConnectorDataConfiguration *string `json:"ConnectorDataConfiguration,omitempty"` + // ValidateOnly - Boolean indicating validate only + ValidateOnly *bool `json:"ValidateOnly,omitempty"` + // WorkItemProperties - Custom work item properties + WorkItemProperties map[string]*string `json:"WorkItemProperties"` +} + +// MarshalJSON is the custom marshaler for WorkItemCreateConfiguration. +func (wicc WorkItemCreateConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if wicc.ConnectorID != nil { + objectMap["ConnectorId"] = wicc.ConnectorID + } + if wicc.ConnectorDataConfiguration != nil { + objectMap["ConnectorDataConfiguration"] = wicc.ConnectorDataConfiguration + } + if wicc.ValidateOnly != nil { + objectMap["ValidateOnly"] = wicc.ValidateOnly + } + if wicc.WorkItemProperties != nil { + objectMap["WorkItemProperties"] = wicc.WorkItemProperties + } + return json.Marshal(objectMap) +} diff --git a/services/preview/appinsights/mgmt/2020-02-02-preview/insights/myworkbooks.go b/services/preview/appinsights/mgmt/2020-02-02-preview/insights/myworkbooks.go new file mode 100644 index 000000000000..0f11b643e8bc --- /dev/null +++ b/services/preview/appinsights/mgmt/2020-02-02-preview/insights/myworkbooks.go @@ -0,0 +1,566 @@ +package insights + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// MyWorkbooksClient is the composite Swagger for Application Insights Management Client +type MyWorkbooksClient struct { + BaseClient +} + +// NewMyWorkbooksClient creates an instance of the MyWorkbooksClient client. +func NewMyWorkbooksClient(subscriptionID string) MyWorkbooksClient { + return NewMyWorkbooksClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewMyWorkbooksClientWithBaseURI creates an instance of the MyWorkbooksClient client using a custom endpoint. Use +// this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewMyWorkbooksClientWithBaseURI(baseURI string, subscriptionID string) MyWorkbooksClient { + return MyWorkbooksClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create a new private workbook. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the Application Insights component resource. +// workbookProperties - properties that need to be specified to create a new private workbook. +func (client MyWorkbooksClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, workbookProperties MyWorkbook) (result MyWorkbook, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MyWorkbooksClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: workbookProperties, + Constraints: []validation.Constraint{{Target: "workbookProperties.MyWorkbookProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "workbookProperties.MyWorkbookProperties.DisplayName", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "workbookProperties.MyWorkbookProperties.SerializedData", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "workbookProperties.MyWorkbookProperties.Category", Name: validation.Null, Rule: true, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewError("insights.MyWorkbooksClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, resourceName, workbookProperties) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.MyWorkbooksClient", "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.MyWorkbooksClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.MyWorkbooksClient", "CreateOrUpdate", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client MyWorkbooksClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, resourceName string, workbookProperties MyWorkbook) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-05-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/myWorkbooks/{resourceName}", pathParameters), + autorest.WithJSON(workbookProperties), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client MyWorkbooksClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client MyWorkbooksClient) CreateOrUpdateResponder(resp *http.Response) (result MyWorkbook, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete delete a private workbook. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the Application Insights component resource. +func (client MyWorkbooksClient) Delete(ctx context.Context, resourceGroupName string, resourceName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MyWorkbooksClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.MyWorkbooksClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.MyWorkbooksClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "insights.MyWorkbooksClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.MyWorkbooksClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client MyWorkbooksClient) DeletePreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-05-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/myWorkbooks/{resourceName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client MyWorkbooksClient) DeleteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client MyWorkbooksClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get a single private workbook by its resourceName. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the Application Insights component resource. +func (client MyWorkbooksClient) Get(ctx context.Context, resourceGroupName string, resourceName string) (result MyWorkbook, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MyWorkbooksClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.MyWorkbooksClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.MyWorkbooksClient", "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.MyWorkbooksClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.MyWorkbooksClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client MyWorkbooksClient) GetPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-05-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/myWorkbooks/{resourceName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client MyWorkbooksClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client MyWorkbooksClient) GetResponder(resp *http.Response) (result MyWorkbook, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByResourceGroup get all private workbooks defined within a specified resource group and category. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// category - category of workbook to return. +// tags - tags presents on each workbook returned. +// canFetchContent - flag indicating whether or not to return the full content for each applicable workbook. If +// false, only return summary content for workbooks. +func (client MyWorkbooksClient) ListByResourceGroup(ctx context.Context, resourceGroupName string, category CategoryType, tags []string, canFetchContent *bool) (result MyWorkbooksListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MyWorkbooksClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.MyWorkbooksClient", "ListByResourceGroup", err.Error()) + } + + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName, category, tags, canFetchContent) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.MyWorkbooksClient", "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.MyWorkbooksClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.MyWorkbooksClient", "ListByResourceGroup", resp, "Failure responding to request") + return + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client MyWorkbooksClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string, category CategoryType, tags []string, canFetchContent *bool) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-05-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + "category": autorest.Encode("query", category), + } + if tags != nil && len(tags) > 0 { + queryParameters["tags"] = autorest.Encode("query", tags, ",") + } + if canFetchContent != nil { + queryParameters["canFetchContent"] = autorest.Encode("query", *canFetchContent) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/myWorkbooks", 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 MyWorkbooksClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client MyWorkbooksClient) ListByResourceGroupResponder(resp *http.Response) (result MyWorkbooksListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListBySubscription get all private workbooks defined within a specified subscription and category. +// Parameters: +// category - category of workbook to return. +// tags - tags presents on each workbook returned. +// canFetchContent - flag indicating whether or not to return the full content for each applicable workbook. If +// false, only return summary content for workbooks. +func (client MyWorkbooksClient) ListBySubscription(ctx context.Context, category CategoryType, tags []string, canFetchContent *bool) (result MyWorkbooksListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MyWorkbooksClient.ListBySubscription") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.MyWorkbooksClient", "ListBySubscription", err.Error()) + } + + req, err := client.ListBySubscriptionPreparer(ctx, category, tags, canFetchContent) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.MyWorkbooksClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + resp, err := client.ListBySubscriptionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.MyWorkbooksClient", "ListBySubscription", resp, "Failure sending request") + return + } + + result, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.MyWorkbooksClient", "ListBySubscription", resp, "Failure responding to request") + return + } + + return +} + +// ListBySubscriptionPreparer prepares the ListBySubscription request. +func (client MyWorkbooksClient) ListBySubscriptionPreparer(ctx context.Context, category CategoryType, tags []string, canFetchContent *bool) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-05-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + "category": autorest.Encode("query", category), + } + if tags != nil && len(tags) > 0 { + queryParameters["tags"] = autorest.Encode("query", tags, ",") + } + if canFetchContent != nil { + queryParameters["canFetchContent"] = autorest.Encode("query", *canFetchContent) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/myWorkbooks", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListBySubscriptionSender sends the ListBySubscription request. The method will close the +// http.Response Body if it receives an error. +func (client MyWorkbooksClient) ListBySubscriptionSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListBySubscriptionResponder handles the response to the ListBySubscription request. The method always +// closes the http.Response Body. +func (client MyWorkbooksClient) ListBySubscriptionResponder(resp *http.Response) (result MyWorkbooksListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Update updates a private workbook that has already been added. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the Application Insights component resource. +// workbookProperties - properties that need to be specified to create a new private workbook. +func (client MyWorkbooksClient) Update(ctx context.Context, resourceGroupName string, resourceName string, workbookProperties MyWorkbook) (result MyWorkbook, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MyWorkbooksClient.Update") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.MyWorkbooksClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, resourceName, workbookProperties) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.MyWorkbooksClient", "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.MyWorkbooksClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.MyWorkbooksClient", "Update", resp, "Failure responding to request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client MyWorkbooksClient) UpdatePreparer(ctx context.Context, resourceGroupName string, resourceName string, workbookProperties MyWorkbook) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-05-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/myWorkbooks/{resourceName}", pathParameters), + autorest.WithJSON(workbookProperties), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client MyWorkbooksClient) UpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client MyWorkbooksClient) UpdateResponder(resp *http.Response) (result MyWorkbook, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/appinsights/mgmt/2020-02-02-preview/insights/operations.go b/services/preview/appinsights/mgmt/2020-02-02-preview/insights/operations.go new file mode 100644 index 000000000000..b7459628872f --- /dev/null +++ b/services/preview/appinsights/mgmt/2020-02-02-preview/insights/operations.go @@ -0,0 +1,140 @@ +package insights + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// 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/tracing" + "net/http" +) + +// OperationsClient is the composite Swagger for Application Insights Management Client +type OperationsClient struct { + BaseClient +} + +// NewOperationsClient creates an instance of the OperationsClient client. +func NewOperationsClient(subscriptionID string) OperationsClient { + return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewOperationsClientWithBaseURI creates an instance of the OperationsClient client using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { + return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List lists all of the available insights REST API operations. +func (client OperationsClient) List(ctx context.Context) (result OperationListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") + defer func() { + sc := -1 + if result.olr.Response.Response != nil { + sc = result.olr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.OperationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.olr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.OperationsClient", "List", resp, "Failure sending request") + return + } + + result.olr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.OperationsClient", "List", resp, "Failure responding to request") + return + } + if result.olr.hasNextLink() && result.olr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { + const APIVersion = "2015-05-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 OperationsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(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 OperationsClient) ListResponder(resp *http.Response) (result OperationListResult, err error) { + err = autorest.Respond( + resp, + 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 OperationsClient) listNextResults(ctx context.Context, lastResults OperationListResult) (result OperationListResult, err error) { + req, err := lastResults.operationListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "insights.OperationsClient", "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.OperationsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.OperationsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client OperationsClient) ListComplete(ctx context.Context) (result OperationListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx) + return +} diff --git a/services/preview/appinsights/mgmt/2020-02-02-preview/insights/proactivedetectionconfigurations.go b/services/preview/appinsights/mgmt/2020-02-02-preview/insights/proactivedetectionconfigurations.go new file mode 100644 index 000000000000..78223d23395b --- /dev/null +++ b/services/preview/appinsights/mgmt/2020-02-02-preview/insights/proactivedetectionconfigurations.go @@ -0,0 +1,298 @@ +package insights + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// ProactiveDetectionConfigurationsClient is the composite Swagger for Application Insights Management Client +type ProactiveDetectionConfigurationsClient struct { + BaseClient +} + +// NewProactiveDetectionConfigurationsClient creates an instance of the ProactiveDetectionConfigurationsClient client. +func NewProactiveDetectionConfigurationsClient(subscriptionID string) ProactiveDetectionConfigurationsClient { + return NewProactiveDetectionConfigurationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewProactiveDetectionConfigurationsClientWithBaseURI creates an instance of the +// ProactiveDetectionConfigurationsClient client using a custom endpoint. Use this when interacting with an Azure +// cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewProactiveDetectionConfigurationsClientWithBaseURI(baseURI string, subscriptionID string) ProactiveDetectionConfigurationsClient { + return ProactiveDetectionConfigurationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get get the ProactiveDetection configuration for this configuration id. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the Application Insights component resource. +// configurationID - the ProactiveDetection configuration ID. This is unique within a Application Insights +// component. +func (client ProactiveDetectionConfigurationsClient) Get(ctx context.Context, resourceGroupName string, resourceName string, configurationID string) (result ApplicationInsightsComponentProactiveDetectionConfiguration, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ProactiveDetectionConfigurationsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ProactiveDetectionConfigurationsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, resourceName, configurationID) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ProactiveDetectionConfigurationsClient", "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.ProactiveDetectionConfigurationsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ProactiveDetectionConfigurationsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client ProactiveDetectionConfigurationsClient) GetPreparer(ctx context.Context, resourceGroupName string, resourceName string, configurationID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "ConfigurationId": autorest.Encode("path", configurationID), + "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}/ProactiveDetectionConfigs/{ConfigurationId}", 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 ProactiveDetectionConfigurationsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ProactiveDetectionConfigurationsClient) GetResponder(resp *http.Response) (result ApplicationInsightsComponentProactiveDetectionConfiguration, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets a list of ProactiveDetection configurations of an Application Insights component. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the Application Insights component resource. +func (client ProactiveDetectionConfigurationsClient) List(ctx context.Context, resourceGroupName string, resourceName string) (result ListApplicationInsightsComponentProactiveDetectionConfiguration, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ProactiveDetectionConfigurationsClient.List") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ProactiveDetectionConfigurationsClient", "List", err.Error()) + } + + req, err := client.ListPreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ProactiveDetectionConfigurationsClient", "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.ProactiveDetectionConfigurationsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ProactiveDetectionConfigurationsClient", "List", resp, "Failure responding to request") + return + } + + return +} + +// ListPreparer prepares the List request. +func (client ProactiveDetectionConfigurationsClient) 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}/ProactiveDetectionConfigs", 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 ProactiveDetectionConfigurationsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ProactiveDetectionConfigurationsClient) ListResponder(resp *http.Response) (result ListApplicationInsightsComponentProactiveDetectionConfiguration, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Update update the ProactiveDetection configuration for this configuration id. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the Application Insights component resource. +// configurationID - the ProactiveDetection configuration ID. This is unique within a Application Insights +// component. +// proactiveDetectionProperties - properties that need to be specified to update the ProactiveDetection +// configuration. +func (client ProactiveDetectionConfigurationsClient) Update(ctx context.Context, resourceGroupName string, resourceName string, configurationID string, proactiveDetectionProperties ApplicationInsightsComponentProactiveDetectionConfiguration) (result ApplicationInsightsComponentProactiveDetectionConfiguration, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ProactiveDetectionConfigurationsClient.Update") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ProactiveDetectionConfigurationsClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, resourceName, configurationID, proactiveDetectionProperties) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ProactiveDetectionConfigurationsClient", "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.ProactiveDetectionConfigurationsClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ProactiveDetectionConfigurationsClient", "Update", resp, "Failure responding to request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client ProactiveDetectionConfigurationsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, resourceName string, configurationID string, proactiveDetectionProperties ApplicationInsightsComponentProactiveDetectionConfiguration) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "ConfigurationId": autorest.Encode("path", configurationID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-05-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/ProactiveDetectionConfigs/{ConfigurationId}", pathParameters), + autorest.WithJSON(proactiveDetectionProperties), + 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 ProactiveDetectionConfigurationsClient) UpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client ProactiveDetectionConfigurationsClient) UpdateResponder(resp *http.Response) (result ApplicationInsightsComponentProactiveDetectionConfiguration, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/appinsights/mgmt/2020-02-02-preview/insights/version.go b/services/preview/appinsights/mgmt/2020-02-02-preview/insights/version.go new file mode 100644 index 000000000000..531d11c5c18a --- /dev/null +++ b/services/preview/appinsights/mgmt/2020-02-02-preview/insights/version.go @@ -0,0 +1,19 @@ +package insights + +import "github.com/Azure/azure-sdk-for-go/version" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// UserAgent returns the UserAgent string to use when sending http.Requests. +func UserAgent() string { + return "Azure-SDK-For-Go/" + Version() + " insights/2020-02-02-preview" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return version.Number +} diff --git a/services/preview/appinsights/mgmt/2020-02-02-preview/insights/webtestlocations.go b/services/preview/appinsights/mgmt/2020-02-02-preview/insights/webtestlocations.go new file mode 100644 index 000000000000..dcb3923ba146 --- /dev/null +++ b/services/preview/appinsights/mgmt/2020-02-02-preview/insights/webtestlocations.go @@ -0,0 +1,118 @@ +package insights + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// 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) WebTestLocationsClient { + return NewWebTestLocationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWebTestLocationsClientWithBaseURI creates an instance of the WebTestLocationsClient client using a custom +// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure +// stack). +func NewWebTestLocationsClientWithBaseURI(baseURI string, subscriptionID string) WebTestLocationsClient { + return WebTestLocationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List gets a list of web test locations available to this Application Insights component. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the Application Insights component resource. +func (client WebTestLocationsClient) List(ctx context.Context, resourceGroupName string, resourceName string) (result ApplicationInsightsWebTestLocationsListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WebTestLocationsClient.List") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.WebTestLocationsClient", "List", 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 + } + + 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 client.Send(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, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/appinsights/mgmt/2020-02-02-preview/insights/webtests.go b/services/preview/appinsights/mgmt/2020-02-02-preview/insights/webtests.go new file mode 100644 index 000000000000..cb9450fdee91 --- /dev/null +++ b/services/preview/appinsights/mgmt/2020-02-02-preview/insights/webtests.go @@ -0,0 +1,755 @@ +package insights + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// WebTestsClient is the composite Swagger for Application Insights Management Client +type WebTestsClient struct { + BaseClient +} + +// NewWebTestsClient creates an instance of the WebTestsClient client. +func NewWebTestsClient(subscriptionID string) WebTestsClient { + return NewWebTestsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWebTestsClientWithBaseURI creates an instance of the WebTestsClient client using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewWebTestsClientWithBaseURI(baseURI string, subscriptionID string) WebTestsClient { + return WebTestsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates an Application Insights web test definition. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// webTestName - the name of the Application Insights webtest resource. +// webTestDefinition - properties that need to be specified to create or update an Application Insights web +// test definition. +func (client WebTestsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, webTestName string, webTestDefinition WebTest) (result WebTest, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WebTestsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: webTestDefinition, + Constraints: []validation.Constraint{{Target: "webTestDefinition.WebTestProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "webTestDefinition.WebTestProperties.SyntheticMonitorID", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "webTestDefinition.WebTestProperties.WebTestName", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "webTestDefinition.WebTestProperties.Locations", Name: validation.Null, Rule: true, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewError("insights.WebTestsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, webTestName, webTestDefinition) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.WebTestsClient", "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.WebTestsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.WebTestsClient", "CreateOrUpdate", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client WebTestsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, webTestName string, webTestDefinition WebTest) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "webTestName": autorest.Encode("path", webTestName), + } + + const APIVersion = "2015-05-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/webtests/{webTestName}", pathParameters), + autorest.WithJSON(webTestDefinition), + 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 WebTestsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client WebTestsClient) CreateOrUpdateResponder(resp *http.Response) (result WebTest, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes an Application Insights web test. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// webTestName - the name of the Application Insights webtest resource. +func (client WebTestsClient) Delete(ctx context.Context, resourceGroupName string, webTestName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WebTestsClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.WebTestsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, webTestName) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.WebTestsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "insights.WebTestsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.WebTestsClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client WebTestsClient) DeletePreparer(ctx context.Context, resourceGroupName string, webTestName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "webTestName": autorest.Encode("path", webTestName), + } + + 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/webtests/{webTestName}", 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 WebTestsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client WebTestsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get a specific Application Insights web test definition. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// webTestName - the name of the Application Insights webtest resource. +func (client WebTestsClient) Get(ctx context.Context, resourceGroupName string, webTestName string) (result WebTest, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WebTestsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.WebTestsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, webTestName) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.WebTestsClient", "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.WebTestsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.WebTestsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client WebTestsClient) GetPreparer(ctx context.Context, resourceGroupName string, webTestName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "webTestName": autorest.Encode("path", webTestName), + } + + 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/webtests/{webTestName}", 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 WebTestsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client WebTestsClient) GetResponder(resp *http.Response) (result WebTest, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List get all Application Insights web test alerts definitions within a subscription. +func (client WebTestsClient) List(ctx context.Context) (result WebTestListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WebTestsClient.List") + defer func() { + sc := -1 + if result.wtlr.Response.Response != nil { + sc = result.wtlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.WebTestsClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.WebTestsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.wtlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.WebTestsClient", "List", resp, "Failure sending request") + return + } + + result.wtlr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.WebTestsClient", "List", resp, "Failure responding to request") + return + } + if result.wtlr.hasNextLink() && result.wtlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client WebTestsClient) ListPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-05-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/webtests", 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 WebTestsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client WebTestsClient) ListResponder(resp *http.Response) (result WebTestListResult, err error) { + err = autorest.Respond( + resp, + 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 WebTestsClient) listNextResults(ctx context.Context, lastResults WebTestListResult) (result WebTestListResult, err error) { + req, err := lastResults.webTestListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "insights.WebTestsClient", "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.WebTestsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.WebTestsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client WebTestsClient) ListComplete(ctx context.Context) (result WebTestListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WebTestsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx) + return +} + +// ListByComponent get all Application Insights web tests defined for the specified component. +// Parameters: +// componentName - the name of the Application Insights component resource. +// resourceGroupName - the name of the resource group. The name is case insensitive. +func (client WebTestsClient) ListByComponent(ctx context.Context, componentName string, resourceGroupName string) (result WebTestListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WebTestsClient.ListByComponent") + defer func() { + sc := -1 + if result.wtlr.Response.Response != nil { + sc = result.wtlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.WebTestsClient", "ListByComponent", err.Error()) + } + + result.fn = client.listByComponentNextResults + req, err := client.ListByComponentPreparer(ctx, componentName, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.WebTestsClient", "ListByComponent", nil, "Failure preparing request") + return + } + + resp, err := client.ListByComponentSender(req) + if err != nil { + result.wtlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.WebTestsClient", "ListByComponent", resp, "Failure sending request") + return + } + + result.wtlr, err = client.ListByComponentResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.WebTestsClient", "ListByComponent", resp, "Failure responding to request") + return + } + if result.wtlr.hasNextLink() && result.wtlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByComponentPreparer prepares the ListByComponent request. +func (client WebTestsClient) ListByComponentPreparer(ctx context.Context, componentName string, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "componentName": autorest.Encode("path", componentName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "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/{componentName}/webtests", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByComponentSender sends the ListByComponent request. The method will close the +// http.Response Body if it receives an error. +func (client WebTestsClient) ListByComponentSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByComponentResponder handles the response to the ListByComponent request. The method always +// closes the http.Response Body. +func (client WebTestsClient) ListByComponentResponder(resp *http.Response) (result WebTestListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByComponentNextResults retrieves the next set of results, if any. +func (client WebTestsClient) listByComponentNextResults(ctx context.Context, lastResults WebTestListResult) (result WebTestListResult, err error) { + req, err := lastResults.webTestListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "insights.WebTestsClient", "listByComponentNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByComponentSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "insights.WebTestsClient", "listByComponentNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByComponentResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.WebTestsClient", "listByComponentNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByComponentComplete enumerates all values, automatically crossing page boundaries as required. +func (client WebTestsClient) ListByComponentComplete(ctx context.Context, componentName string, resourceGroupName string) (result WebTestListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WebTestsClient.ListByComponent") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByComponent(ctx, componentName, resourceGroupName) + return +} + +// ListByResourceGroup get all Application Insights web tests defined within a specified resource group. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +func (client WebTestsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result WebTestListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WebTestsClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.wtlr.Response.Response != nil { + sc = result.wtlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.WebTestsClient", "ListByResourceGroup", err.Error()) + } + + result.fn = client.listByResourceGroupNextResults + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.WebTestsClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.wtlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.WebTestsClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.wtlr, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.WebTestsClient", "ListByResourceGroup", resp, "Failure responding to request") + return + } + if result.wtlr.hasNextLink() && result.wtlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client WebTestsClient) 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-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/webtests", 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 WebTestsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client WebTestsClient) ListByResourceGroupResponder(resp *http.Response) (result WebTestListResult, err error) { + err = autorest.Respond( + resp, + 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 WebTestsClient) listByResourceGroupNextResults(ctx context.Context, lastResults WebTestListResult) (result WebTestListResult, err error) { + req, err := lastResults.webTestListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "insights.WebTestsClient", "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.WebTestsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.WebTestsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client WebTestsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result WebTestListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WebTestsClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByResourceGroup(ctx, resourceGroupName) + return +} + +// UpdateTags creates or updates an Application Insights web test definition. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// webTestName - the name of the Application Insights webtest resource. +// webTestTags - updated tag information to set into the web test instance. +func (client WebTestsClient) UpdateTags(ctx context.Context, resourceGroupName string, webTestName string, webTestTags TagsResource) (result WebTest, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WebTestsClient.UpdateTags") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.WebTestsClient", "UpdateTags", err.Error()) + } + + req, err := client.UpdateTagsPreparer(ctx, resourceGroupName, webTestName, webTestTags) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.WebTestsClient", "UpdateTags", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateTagsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.WebTestsClient", "UpdateTags", resp, "Failure sending request") + return + } + + result, err = client.UpdateTagsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.WebTestsClient", "UpdateTags", resp, "Failure responding to request") + return + } + + return +} + +// UpdateTagsPreparer prepares the UpdateTags request. +func (client WebTestsClient) UpdateTagsPreparer(ctx context.Context, resourceGroupName string, webTestName string, webTestTags TagsResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "webTestName": autorest.Encode("path", webTestName), + } + + const APIVersion = "2015-05-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/webtests/{webTestName}", pathParameters), + autorest.WithJSON(webTestTags), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateTagsSender sends the UpdateTags request. The method will close the +// http.Response Body if it receives an error. +func (client WebTestsClient) UpdateTagsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateTagsResponder handles the response to the UpdateTags request. The method always +// closes the http.Response Body. +func (client WebTestsClient) UpdateTagsResponder(resp *http.Response) (result WebTest, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/appinsights/mgmt/2020-02-02-preview/insights/workbooks.go b/services/preview/appinsights/mgmt/2020-02-02-preview/insights/workbooks.go new file mode 100644 index 000000000000..e30bd2ce8bb4 --- /dev/null +++ b/services/preview/appinsights/mgmt/2020-02-02-preview/insights/workbooks.go @@ -0,0 +1,479 @@ +package insights + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// WorkbooksClient is the composite Swagger for Application Insights Management Client +type WorkbooksClient struct { + BaseClient +} + +// NewWorkbooksClient creates an instance of the WorkbooksClient client. +func NewWorkbooksClient(subscriptionID string) WorkbooksClient { + return NewWorkbooksClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWorkbooksClientWithBaseURI creates an instance of the WorkbooksClient client using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewWorkbooksClientWithBaseURI(baseURI string, subscriptionID string) WorkbooksClient { + return WorkbooksClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create a new workbook. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the Application Insights component resource. +// workbookProperties - properties that need to be specified to create a new workbook. +func (client WorkbooksClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, workbookProperties Workbook) (result Workbook, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WorkbooksClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: workbookProperties, + Constraints: []validation.Constraint{{Target: "workbookProperties.WorkbookProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "workbookProperties.WorkbookProperties.Name", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "workbookProperties.WorkbookProperties.SerializedData", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "workbookProperties.WorkbookProperties.WorkbookID", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "workbookProperties.WorkbookProperties.Category", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "workbookProperties.WorkbookProperties.UserID", Name: validation.Null, Rule: true, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewError("insights.WorkbooksClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, resourceName, workbookProperties) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.WorkbooksClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.WorkbooksClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.WorkbooksClient", "CreateOrUpdate", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client WorkbooksClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, resourceName string, workbookProperties Workbook) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-05-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/workbooks/{resourceName}", pathParameters), + autorest.WithJSON(workbookProperties), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client WorkbooksClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client WorkbooksClient) CreateOrUpdateResponder(resp *http.Response) (result Workbook, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete delete a workbook. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the Application Insights component resource. +func (client WorkbooksClient) Delete(ctx context.Context, resourceGroupName string, resourceName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WorkbooksClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.WorkbooksClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.WorkbooksClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "insights.WorkbooksClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.WorkbooksClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client WorkbooksClient) DeletePreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-05-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/workbooks/{resourceName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client WorkbooksClient) DeleteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client WorkbooksClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get a single workbook by its resourceName. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the Application Insights component resource. +func (client WorkbooksClient) Get(ctx context.Context, resourceGroupName string, resourceName string) (result Workbook, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WorkbooksClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.WorkbooksClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.WorkbooksClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.WorkbooksClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.WorkbooksClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client WorkbooksClient) GetPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-05-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/workbooks/{resourceName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client WorkbooksClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client WorkbooksClient) GetResponder(resp *http.Response) (result Workbook, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByResourceGroup get all Workbooks defined within a specified resource group and category. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// category - category of workbook to return. +// tags - tags presents on each workbook returned. +// canFetchContent - flag indicating whether or not to return the full content for each applicable workbook. If +// false, only return summary content for workbooks. +func (client WorkbooksClient) ListByResourceGroup(ctx context.Context, resourceGroupName string, category CategoryType, tags []string, canFetchContent *bool) (result WorkbooksListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WorkbooksClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.WorkbooksClient", "ListByResourceGroup", err.Error()) + } + + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName, category, tags, canFetchContent) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.WorkbooksClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.WorkbooksClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.WorkbooksClient", "ListByResourceGroup", resp, "Failure responding to request") + return + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client WorkbooksClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string, category CategoryType, tags []string, canFetchContent *bool) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-05-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + "category": autorest.Encode("query", category), + } + if tags != nil && len(tags) > 0 { + queryParameters["tags"] = autorest.Encode("query", tags, ",") + } + if canFetchContent != nil { + queryParameters["canFetchContent"] = autorest.Encode("query", *canFetchContent) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/workbooks", 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 WorkbooksClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client WorkbooksClient) ListByResourceGroupResponder(resp *http.Response) (result WorkbooksListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Update updates a workbook that has already been added. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the Application Insights component resource. +// workbookProperties - properties that need to be specified to create a new workbook. +func (client WorkbooksClient) Update(ctx context.Context, resourceGroupName string, resourceName string, workbookProperties Workbook) (result Workbook, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WorkbooksClient.Update") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.WorkbooksClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, resourceName, workbookProperties) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.WorkbooksClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.WorkbooksClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.WorkbooksClient", "Update", resp, "Failure responding to request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client WorkbooksClient) UpdatePreparer(ctx context.Context, resourceGroupName string, resourceName string, workbookProperties Workbook) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-05-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/workbooks/{resourceName}", pathParameters), + autorest.WithJSON(workbookProperties), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client WorkbooksClient) UpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client WorkbooksClient) UpdateResponder(resp *http.Response) (result Workbook, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/appinsights/mgmt/2020-02-02-preview/insights/workitemconfigurations.go b/services/preview/appinsights/mgmt/2020-02-02-preview/insights/workitemconfigurations.go new file mode 100644 index 000000000000..c46789bddc6e --- /dev/null +++ b/services/preview/appinsights/mgmt/2020-02-02-preview/insights/workitemconfigurations.go @@ -0,0 +1,559 @@ +package insights + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// WorkItemConfigurationsClient is the composite Swagger for Application Insights Management Client +type WorkItemConfigurationsClient struct { + BaseClient +} + +// NewWorkItemConfigurationsClient creates an instance of the WorkItemConfigurationsClient client. +func NewWorkItemConfigurationsClient(subscriptionID string) WorkItemConfigurationsClient { + return NewWorkItemConfigurationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWorkItemConfigurationsClientWithBaseURI creates an instance of the WorkItemConfigurationsClient client using a +// custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, +// Azure stack). +func NewWorkItemConfigurationsClientWithBaseURI(baseURI string, subscriptionID string) WorkItemConfigurationsClient { + return WorkItemConfigurationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create create a work item configuration for an Application Insights component. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the Application Insights component resource. +// workItemConfigurationProperties - properties that need to be specified to create a work item configuration +// of a Application Insights component. +func (client WorkItemConfigurationsClient) Create(ctx context.Context, resourceGroupName string, resourceName string, workItemConfigurationProperties WorkItemCreateConfiguration) (result WorkItemConfiguration, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WorkItemConfigurationsClient.Create") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.WorkItemConfigurationsClient", "Create", err.Error()) + } + + req, err := client.CreatePreparer(ctx, resourceGroupName, resourceName, workItemConfigurationProperties) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.WorkItemConfigurationsClient", "Create", nil, "Failure preparing request") + return + } + + resp, err := client.CreateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.WorkItemConfigurationsClient", "Create", resp, "Failure sending request") + return + } + + result, err = client.CreateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.WorkItemConfigurationsClient", "Create", resp, "Failure responding to request") + return + } + + return +} + +// CreatePreparer prepares the Create request. +func (client WorkItemConfigurationsClient) CreatePreparer(ctx context.Context, resourceGroupName string, resourceName string, workItemConfigurationProperties WorkItemCreateConfiguration) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-05-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + 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)) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client WorkItemConfigurationsClient) CreateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client WorkItemConfigurationsClient) CreateResponder(resp *http.Response) (result WorkItemConfiguration, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete delete a work item configuration of an Application Insights component. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the Application Insights component resource. +// workItemConfigID - the unique work item configuration Id. This can be either friendly name of connector as +// defined in connector configuration +func (client WorkItemConfigurationsClient) Delete(ctx context.Context, resourceGroupName string, resourceName string, workItemConfigID string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WorkItemConfigurationsClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.WorkItemConfigurationsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, resourceName, workItemConfigID) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.WorkItemConfigurationsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "insights.WorkItemConfigurationsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.WorkItemConfigurationsClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client WorkItemConfigurationsClient) DeletePreparer(ctx context.Context, resourceGroupName string, resourceName string, workItemConfigID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workItemConfigId": autorest.Encode("path", workItemConfigID), + } + + 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}/WorkItemConfigs/{workItemConfigId}", 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 WorkItemConfigurationsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client WorkItemConfigurationsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// GetDefault gets default work item configurations that exist for the application +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the Application Insights component resource. +func (client WorkItemConfigurationsClient) GetDefault(ctx context.Context, resourceGroupName string, resourceName string) (result WorkItemConfiguration, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WorkItemConfigurationsClient.GetDefault") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.WorkItemConfigurationsClient", "GetDefault", err.Error()) + } + + req, err := client.GetDefaultPreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.WorkItemConfigurationsClient", "GetDefault", nil, "Failure preparing request") + return + } + + resp, err := client.GetDefaultSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.WorkItemConfigurationsClient", "GetDefault", resp, "Failure sending request") + return + } + + result, err = client.GetDefaultResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.WorkItemConfigurationsClient", "GetDefault", resp, "Failure responding to request") + return + } + + return +} + +// GetDefaultPreparer prepares the GetDefault request. +func (client WorkItemConfigurationsClient) GetDefaultPreparer(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}/DefaultWorkItemConfig", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetDefaultSender sends the GetDefault request. The method will close the +// http.Response Body if it receives an error. +func (client WorkItemConfigurationsClient) GetDefaultSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetDefaultResponder handles the response to the GetDefault request. The method always +// closes the http.Response Body. +func (client WorkItemConfigurationsClient) GetDefaultResponder(resp *http.Response) (result WorkItemConfiguration, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetItem gets specified work item configuration for an Application Insights component. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the Application Insights component resource. +// workItemConfigID - the unique work item configuration Id. This can be either friendly name of connector as +// defined in connector configuration +func (client WorkItemConfigurationsClient) GetItem(ctx context.Context, resourceGroupName string, resourceName string, workItemConfigID string) (result WorkItemConfiguration, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WorkItemConfigurationsClient.GetItem") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.WorkItemConfigurationsClient", "GetItem", err.Error()) + } + + req, err := client.GetItemPreparer(ctx, resourceGroupName, resourceName, workItemConfigID) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.WorkItemConfigurationsClient", "GetItem", nil, "Failure preparing request") + return + } + + resp, err := client.GetItemSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.WorkItemConfigurationsClient", "GetItem", resp, "Failure sending request") + return + } + + result, err = client.GetItemResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.WorkItemConfigurationsClient", "GetItem", resp, "Failure responding to request") + return + } + + return +} + +// GetItemPreparer prepares the GetItem request. +func (client WorkItemConfigurationsClient) GetItemPreparer(ctx context.Context, resourceGroupName string, resourceName string, workItemConfigID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workItemConfigId": autorest.Encode("path", workItemConfigID), + } + + 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}/WorkItemConfigs/{workItemConfigId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetItemSender sends the GetItem request. The method will close the +// http.Response Body if it receives an error. +func (client WorkItemConfigurationsClient) GetItemSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetItemResponder handles the response to the GetItem request. The method always +// closes the http.Response Body. +func (client WorkItemConfigurationsClient) GetItemResponder(resp *http.Response) (result WorkItemConfiguration, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets the list work item configurations that exist for the application +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the Application Insights component resource. +func (client WorkItemConfigurationsClient) List(ctx context.Context, resourceGroupName string, resourceName string) (result WorkItemConfigurationsListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WorkItemConfigurationsClient.List") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.WorkItemConfigurationsClient", "List", err.Error()) + } + + req, err := client.ListPreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.WorkItemConfigurationsClient", "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.WorkItemConfigurationsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.WorkItemConfigurationsClient", "List", resp, "Failure responding to request") + return + } + + return +} + +// ListPreparer prepares the List request. +func (client WorkItemConfigurationsClient) 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}/WorkItemConfigs", 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 WorkItemConfigurationsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client WorkItemConfigurationsClient) ListResponder(resp *http.Response) (result WorkItemConfigurationsListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateItem update a work item configuration for an Application Insights component. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the Application Insights component resource. +// workItemConfigID - the unique work item configuration Id. This can be either friendly name of connector as +// defined in connector configuration +// workItemConfigurationProperties - properties that need to be specified to update a work item configuration +// for this Application Insights component. +func (client WorkItemConfigurationsClient) UpdateItem(ctx context.Context, resourceGroupName string, resourceName string, workItemConfigID string, workItemConfigurationProperties WorkItemCreateConfiguration) (result WorkItemConfiguration, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WorkItemConfigurationsClient.UpdateItem") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.WorkItemConfigurationsClient", "UpdateItem", err.Error()) + } + + req, err := client.UpdateItemPreparer(ctx, resourceGroupName, resourceName, workItemConfigID, workItemConfigurationProperties) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.WorkItemConfigurationsClient", "UpdateItem", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateItemSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.WorkItemConfigurationsClient", "UpdateItem", resp, "Failure sending request") + return + } + + result, err = client.UpdateItemResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.WorkItemConfigurationsClient", "UpdateItem", resp, "Failure responding to request") + return + } + + return +} + +// UpdateItemPreparer prepares the UpdateItem request. +func (client WorkItemConfigurationsClient) UpdateItemPreparer(ctx context.Context, resourceGroupName string, resourceName string, workItemConfigID string, workItemConfigurationProperties WorkItemCreateConfiguration) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workItemConfigId": autorest.Encode("path", workItemConfigID), + } + + const APIVersion = "2015-05-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/WorkItemConfigs/{workItemConfigId}", pathParameters), + autorest.WithJSON(workItemConfigurationProperties), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateItemSender sends the UpdateItem request. The method will close the +// http.Response Body if it receives an error. +func (client WorkItemConfigurationsClient) UpdateItemSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateItemResponder handles the response to the UpdateItem request. The method always +// closes the http.Response Body. +func (client WorkItemConfigurationsClient) UpdateItemResponder(resp *http.Response) (result WorkItemConfiguration, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +}