diff --git a/internal/services/applicationinsights/application_insights_analytics_item_resource.go b/internal/services/applicationinsights/application_insights_analytics_item_resource.go index 52105abd652e..803d382ff0e5 100644 --- a/internal/services/applicationinsights/application_insights_analytics_item_resource.go +++ b/internal/services/applicationinsights/application_insights_analytics_item_resource.go @@ -8,16 +8,22 @@ import ( "strings" "time" - "github.com/Azure/azure-sdk-for-go/services/appinsights/mgmt/2020-02-02/insights" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/lang/response" + analyticsitems "github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/analyticsitemsapis" + components "github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-02-02/componentsapis" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/applicationinsights/migration" "github.com/hashicorp/terraform-provider-azurerm/internal/services/applicationinsights/parse" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/applicationinsights/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" +) + +var ( + userScopePath = "myAnalyticsItems" + sharedScopePath = "analyticsItems" ) func resourceApplicationInsightsAnalyticsItem() *pluginsdk.Resource { @@ -28,14 +34,12 @@ func resourceApplicationInsightsAnalyticsItem() *pluginsdk.Resource { Delete: resourceApplicationInsightsAnalyticsItemDelete, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - if strings.Contains(id, "myAnalyticsItems") { - _, err := parse.AnalyticsUserItemID(id) - return err - } else { - strings.Contains(id, string(insights.ItemScopePathAnalyticsItems)) - _, err := parse.AnalyticsSharedItemID(id) - return err + if strings.Contains(id, userScopePath) || strings.Contains(id, sharedScopePath) { + if _, err := analyticsitems.ParseProviderComponentID(id); err != nil { + return err + } } + return nil }), SchemaVersion: 1, @@ -62,7 +66,7 @@ func resourceApplicationInsightsAnalyticsItem() *pluginsdk.Resource { Type: pluginsdk.TypeString, Required: true, ForceNew: true, - ValidateFunc: validate.ComponentID, + ValidateFunc: components.ValidateComponentID, }, "version": { @@ -80,8 +84,8 @@ func resourceApplicationInsightsAnalyticsItem() *pluginsdk.Resource { Required: true, ForceNew: true, ValidateFunc: validation.StringInSlice([]string{ - string(insights.ItemScopeShared), - string(insights.ItemScopeUser), + string(analyticsitems.ItemScopeShared), + string(analyticsitems.ItemScopeUser), }, false), }, @@ -90,10 +94,10 @@ func resourceApplicationInsightsAnalyticsItem() *pluginsdk.Resource { Required: true, ForceNew: true, ValidateFunc: validation.StringInSlice([]string{ - string(insights.ItemTypeQuery), - string(insights.ItemTypeFunction), - string(insights.ItemTypeFolder), - string(insights.ItemTypeRecent), + string(analyticsitems.ItemTypeQuery), + string(analyticsitems.ItemTypeFunction), + string(analyticsitems.ItemTypeParameterFolder), + string(analyticsitems.ItemTypeRecent), }, false), }, @@ -116,129 +120,160 @@ func resourceApplicationInsightsAnalyticsItem() *pluginsdk.Resource { } func resourceApplicationInsightsAnalyticsItemCreate(d *pluginsdk.ResourceData, meta interface{}) error { - return resourceApplicationInsightsAnalyticsItemCreateUpdate(d, meta, false) -} - -func resourceApplicationInsightsAnalyticsItemUpdate(d *pluginsdk.ResourceData, meta interface{}) error { - return resourceApplicationInsightsAnalyticsItemCreateUpdate(d, meta, true) -} - -func resourceApplicationInsightsAnalyticsItemCreateUpdate(d *pluginsdk.ResourceData, meta interface{}, overwrite bool) error { client := meta.(*clients.Client).AppInsights.AnalyticsItemsClient ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) defer cancel() - appInsightsId, err := parse.ComponentID(d.Get("application_insights_id").(string)) + appInsightsId, err := components.ParseComponentID(d.Get("application_insights_id").(string)) if err != nil { return err } - var itemID string - var id string - if id, _, _, _, itemID, err = ResourcesArmApplicationInsightsAnalyticsItemParseID(d.Id()); d.Id() != "" { - if err != nil { - return fmt.Errorf("parsing Application Insights Analytics Item ID %s: %+v", d.Id(), err) - } - } - name := d.Get("name").(string) - content := d.Get("content").(string) scopeName := d.Get("scope").(string) typeName := d.Get("type").(string) - functionAlias := d.Get("function_alias").(string) - itemType := insights.ItemType(typeName) - itemScope := insights.ItemScope(scopeName) + itemType := analyticsitems.ItemType(typeName) + itemScope := analyticsitems.ItemScope(scopeName) - var itemScopePath insights.ItemScopePath - if itemScope == insights.ItemScopeUser { - itemScopePath = insights.ItemScopePathMyanalyticsItems - } else { - itemScopePath = insights.ItemScopePathAnalyticsItems + itemScopePath := sharedScopePath + if itemScope == analyticsitems.ItemScopeUser { + itemScopePath = userScopePath } - includeContent := false - - if d.IsNewResource() { - // We cannot get specific analytics items without their itemID which is why we need to list all the - // available items of a certain type and scope in order to check whether a resource already exists and needs - // to be imported first - // https://github.com/Azure/azure-rest-api-specs/issues/20712 itemScopePath should be set to insights.ItemScopePathAnalyticsItems in List method - existing, err := client.List(ctx, appInsightsId.ResourceGroup, appInsightsId.Name, insights.ItemScopePathAnalyticsItems, itemScope, insights.ItemTypeParameter(typeName), &includeContent) - if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { - return fmt.Errorf("checking for presence of existing Application Insights Analytics Items %+v", err) - } + id := analyticsitems.NewProviderComponentID(appInsightsId.SubscriptionId, appInsightsId.ResourceGroupName, appInsightsId.ComponentName, itemScopePath) + + // We cannot get specific analytics items without their itemID which is why we need to list all the + // available items of a certain type and scope in order to check whether a resource already exists and needs + // to be imported first + // https://github.com/Azure/azure-rest-api-specs/issues/20712 itemScopePath should be set to insights.ItemScopePathAnalyticsItems in List method + listId := analyticsitems.NewProviderComponentID(appInsightsId.SubscriptionId, appInsightsId.ResourceGroupName, appInsightsId.ComponentName, "analyticsItems") + existing, err := client.AnalyticsItemsList(ctx, listId, analyticsitems.DefaultAnalyticsItemsListOperationOptions()) + if err != nil { + if !response.WasNotFound(existing.HttpResponse) { + return fmt.Errorf("checking for presence of existing %s: %+v", id, err) } - if existing.Value != nil { - values := *existing.Value - for _, v := range values { - if *v.Name == name { - return tf.ImportAsExistsError("azurerm_application_insights_analytics_item", *v.ID) - } + } + + if model := existing.Model; model != nil { + for _, value := range *model { + if v := value.Name; v != nil && *v == name { + return tf.ImportAsExistsError("azurerm_application_insights_analytics_item", *value.Id) } } } - properties := insights.ApplicationInsightsComponentAnalyticsItem{ - ID: &itemID, - Name: &name, - Type: itemType, - Scope: itemScope, - Content: &content, + properties := analyticsitems.ApplicationInsightsComponentAnalyticsItem{ + Name: pointer.To(name), + Type: pointer.To(itemType), + Scope: pointer.To(itemScope), + Content: pointer.To(d.Get("content").(string)), } - if functionAlias != "" { - properties.Properties = &insights.ApplicationInsightsComponentAnalyticsItemProperties{ - FunctionAlias: &functionAlias, + if v := d.Get("function_alias").(string); v != "" { + properties.Properties = &analyticsitems.ApplicationInsightsComponentAnalyticsItemProperties{ + FunctionAlias: &v, } } - result, err := client.Put(ctx, appInsightsId.ResourceGroup, appInsightsId.Name, itemScopePath, properties, &overwrite) + resp, err := client.AnalyticsItemsPut(ctx, id, properties, analyticsitems.DefaultAnalyticsItemsPutOperationOptions()) + if err != nil { + return fmt.Errorf("creating %s: %+v", id, err) + } + + if resp.Model == nil && resp.Model.Id == nil { + return fmt.Errorf("model and model ID for %s are nil", id) + } + + generatedId := parse.NewAnalyticsSharedItemID(id.SubscriptionId, id.ResourceGroupName, id.ComponentName, *resp.Model.Id).ID() + if itemScope == analyticsitems.ItemScopeUser { + generatedId = parse.NewAnalyticsUserItemID(id.SubscriptionId, id.ResourceGroupName, id.ComponentName, *resp.Model.Id).ID() + } + + d.SetId(generatedId) + + return resourceApplicationInsightsAnalyticsItemRead(d, meta) +} + +func resourceApplicationInsightsAnalyticsItemUpdate(d *pluginsdk.ResourceData, meta interface{}) error { + client := meta.(*clients.Client).AppInsights.AnalyticsItemsClient + ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) + defer cancel() + + id, itemId, err := ParseGeneratedAnalyticsItemId(d.Id()) + if err != nil { + return err + } + + getOptions := analyticsitems.AnalyticsItemsGetOperationOptions{ + Id: pointer.To(itemId), + } + + existing, err := client.AnalyticsItemsGet(ctx, *id, getOptions) if err != nil { - return fmt.Errorf("putting Application Insights Analytics Item %s: %+v", id, err) + return fmt.Errorf("retrieving %s: %+v", id, err) + } + + payload := existing.Model + + if d.HasChange("content") { + payload.Content = pointer.To(d.Get("content").(string)) } - // See comments in ResourcesArmApplicationInsightsAnalyticsItemParseID method about ID format - generatedID := resourcesArmApplicationInsightsAnalyticsItemGenerateID(itemScope, *result.ID, appInsightsId) + if d.HasChange("function_alias") { + if payload.Properties == nil { + payload.Properties = &analyticsitems.ApplicationInsightsComponentAnalyticsItemProperties{} + } + payload.Properties.FunctionAlias = pointer.To(d.Get("function_alias").(string)) + } - d.SetId(generatedID) + putOptions := analyticsitems.AnalyticsItemsPutOperationOptions{ + OverrideItem: pointer.To(true), + } + + if _, err = client.AnalyticsItemsPut(ctx, *id, *payload, putOptions); err != nil { + return fmt.Errorf("updating %s: %+v", id, err) + } return resourceApplicationInsightsAnalyticsItemRead(d, meta) } func resourceApplicationInsightsAnalyticsItemRead(d *pluginsdk.ResourceData, meta interface{}) error { client := meta.(*clients.Client).AppInsights.AnalyticsItemsClient - subscriptionId := meta.(*clients.Client).AppInsights.AnalyticsItemsClient.SubscriptionID ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, resourceGroupName, appInsightsName, itemScopePath, itemID, err := ResourcesArmApplicationInsightsAnalyticsItemParseID(d.Id()) + id, itemId, err := ParseGeneratedAnalyticsItemId(d.Id()) if err != nil { - return fmt.Errorf("parsing Application Insights Analytics Item ID %s: %s", d.Id(), err) + return err + } + + options := analyticsitems.AnalyticsItemsGetOperationOptions{ + Id: pointer.To(itemId), } - result, err := client.Get(ctx, resourceGroupName, appInsightsName, itemScopePath, itemID, "") + resp, err := client.AnalyticsItemsGet(ctx, *id, options) if err != nil { - if utils.ResponseWasNotFound(result.Response) { + if response.WasNotFound(resp.HttpResponse) { d.SetId("") return nil } - return fmt.Errorf("getting Application Insights Analytics Item %s: %+v", id, err) + return fmt.Errorf("retrieving %s: %+v", id, err) } - appInsightsId := parse.NewComponentID(subscriptionId, resourceGroupName, appInsightsName) + appInsightsId := components.NewComponentID(id.SubscriptionId, id.ResourceGroupName, id.ComponentName) d.Set("application_insights_id", appInsightsId.ID()) - d.Set("name", result.Name) - d.Set("version", result.Version) - d.Set("content", result.Content) - d.Set("scope", string(result.Scope)) - d.Set("type", string(result.Type)) - d.Set("time_created", result.TimeCreated) - d.Set("time_modified", result.TimeModified) - - if result.Properties != nil { - d.Set("function_alias", result.Properties.FunctionAlias) + if model := resp.Model; model != nil { + d.Set("name", model.Name) + d.Set("version", model.Version) + d.Set("content", model.Content) + d.Set("scope", pointer.From(model.Scope)) + d.Set("type", pointer.From(model.Type)) + d.Set("time_created", model.TimeCreated) + d.Set("time_modified", model.TimeModified) + if props := model.Properties; props != nil { + d.Set("function_alias", pointer.From(props.FunctionAlias)) + } } return nil @@ -249,46 +284,34 @@ func resourceApplicationInsightsAnalyticsItemDelete(d *pluginsdk.ResourceData, m ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, resourceGroupName, appInsightsName, itemScopePath, itemID, err := ResourcesArmApplicationInsightsAnalyticsItemParseID(d.Id()) + id, itemId, err := ParseGeneratedAnalyticsItemId(d.Id()) if err != nil { - return fmt.Errorf("parsing Application Insights Analytics Item ID %s: %+v", d.Id(), err) + return err + } + + options := analyticsitems.AnalyticsItemsDeleteOperationOptions{ + Id: pointer.To(itemId), } - if _, err = client.Delete(ctx, resourceGroupName, appInsightsName, itemScopePath, itemID, ""); err != nil { - return fmt.Errorf("deleting Application Insights Analytics Item %s: %+v", id, err) + if _, err = client.AnalyticsItemsDelete(ctx, *id, options); err != nil { + return fmt.Errorf("deleting %s: %+v", id, err) } return nil } -func ResourcesArmApplicationInsightsAnalyticsItemParseID(id string) (string, string, string, insights.ItemScopePath, string, error) { +func ParseGeneratedAnalyticsItemId(input string) (*analyticsitems.ProviderComponentId, string, error) { // The generated ID format differs depending on scope // /analyticsItems/ [for shared scope items] // /myAnalyticsItems/ [for user scope items] - switch { - case strings.Contains(id, "myAnalyticsItems"): - id, err := parse.AnalyticsUserItemID(id) - if err != nil { - return "", "", "", "", "", err - } - return id.String(), id.ResourceGroup, id.ComponentName, insights.ItemScopePathMyanalyticsItems, id.MyAnalyticsItemName, nil - case strings.Contains(id, string(insights.ItemScopePathAnalyticsItems)): - id, err := parse.AnalyticsSharedItemID(id) - if err != nil { - return "", "", "", "", "", err - } - return id.String(), id.ResourceGroup, id.ComponentName, insights.ItemScopePathAnalyticsItems, id.AnalyticsItemName, nil - default: - return "", "", "", "", "", fmt.Errorf("parsing Application Insights Analytics Item ID %s", id) + generatedId, err := analyticsitems.ParseProviderComponentID(input) + if err != nil { + return nil, "", err } -} -func resourcesArmApplicationInsightsAnalyticsItemGenerateID(itemScope insights.ItemScope, itemID string, appInsightsId *parse.ComponentId) string { - if itemScope == insights.ItemScopeShared { - id := parse.NewAnalyticsSharedItemID(appInsightsId.SubscriptionId, appInsightsId.ResourceGroup, appInsightsId.Name, itemID) - return id.ID() - } else { - id := parse.NewAnalyticsUserItemID(appInsightsId.SubscriptionId, appInsightsId.ResourceGroup, appInsightsId.Name, itemID) - return id.ID() - } + scope := strings.Split(generatedId.ScopePath, "/") + + id := analyticsitems.NewProviderComponentID(generatedId.SubscriptionId, generatedId.ResourceGroupName, generatedId.ComponentName, scope[1]) + + return &id, scope[2], nil } diff --git a/internal/services/applicationinsights/application_insights_analytics_item_resource_test.go b/internal/services/applicationinsights/application_insights_analytics_item_resource_test.go index 1a33dd344020..0d4791159956 100644 --- a/internal/services/applicationinsights/application_insights_analytics_item_resource_test.go +++ b/internal/services/applicationinsights/application_insights_analytics_item_resource_test.go @@ -6,15 +6,15 @@ package applicationinsights_test import ( "context" "fmt" - "net/http" "testing" + "github.com/hashicorp/go-azure-helpers/lang/pointer" + analyticsitems "github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/analyticsitemsapis" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/applicationinsights" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) type AppInsightsAnalyticsItemResource struct{} @@ -118,17 +118,21 @@ func TestAccApplicationInsightsAnalyticsItem_requiresImport(t *testing.T) { } func (t AppInsightsAnalyticsItemResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, resGroup, appInsightsName, itemScopePath, itemID, err := applicationinsights.ResourcesArmApplicationInsightsAnalyticsItemParseID(state.ID) + id, itemId, err := applicationinsights.ParseGeneratedAnalyticsItemId(state.ID) if err != nil { - return nil, fmt.Errorf("failed to parse id %s: %+v", state.ID, err) + return nil, err } - resp, err := clients.AppInsights.AnalyticsItemsClient.Get(ctx, resGroup, appInsightsName, itemScopePath, itemID, "") + options := analyticsitems.AnalyticsItemsGetOperationOptions{ + Id: pointer.To(itemId), + } + + resp, err := clients.AppInsights.AnalyticsItemsClient.AnalyticsItemsGet(ctx, *id, options) if err != nil { - return nil, fmt.Errorf("retrieving Application Insights Analytics Item %s: %+v", id, err) + return nil, fmt.Errorf("retrieving %s: %+v", id, err) } - return utils.Bool(resp.StatusCode != http.StatusNotFound), nil + return pointer.To(resp.Model != nil), nil } func (AppInsightsAnalyticsItemResource) basic(data acceptance.TestData) string { diff --git a/internal/services/applicationinsights/application_insights_api_key_resource.go b/internal/services/applicationinsights/application_insights_api_key_resource.go index 5be1db6b8947..86ec9331b8ce 100644 --- a/internal/services/applicationinsights/application_insights_api_key_resource.go +++ b/internal/services/applicationinsights/application_insights_api_key_resource.go @@ -6,19 +6,17 @@ package applicationinsights import ( "fmt" "log" - "regexp" "time" - "github.com/Azure/azure-sdk-for-go/services/appinsights/mgmt/2020-02-02/insights" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/response" + apikeys "github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/componentapikeysapis" + components "github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-02-02/componentsapis" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/applicationinsights/migration" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/applicationinsights/parse" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/applicationinsights/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func resourceApplicationInsightsAPIKey() *pluginsdk.Resource { @@ -28,7 +26,7 @@ func resourceApplicationInsightsAPIKey() *pluginsdk.Resource { Delete: resourceApplicationInsightsAPIKeyDelete, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.ApiKeyID(id) + _, err := apikeys.ParseApiKeyID(id) return err }), @@ -55,7 +53,7 @@ func resourceApplicationInsightsAPIKey() *pluginsdk.Resource { Type: pluginsdk.TypeString, Required: true, ForceNew: true, - ValidateFunc: validate.ComponentID, + ValidateFunc: components.ValidateComponentID, }, "read_permissions": { @@ -94,27 +92,25 @@ func resourceApplicationInsightsAPIKeyCreate(d *pluginsdk.ResourceData, meta int ctx, cancel := timeouts.ForCreate(meta.(*clients.Client).StopContext, d) defer cancel() - log.Printf("[INFO] preparing arguments for AzureRM Application Insights API key creation.") - - appInsightsId, err := parse.ComponentID(d.Get("application_insights_id").(string)) + appInsightsId, err := apikeys.ParseComponentID(d.Get("application_insights_id").(string)) if err != nil { return err } name := d.Get("name").(string) - var existingAPIKeyList insights.ApplicationInsightsComponentAPIKeyListResult - var existingAPIKeyId *parse.ApiKeyId - existingAPIKeyList, err = client.List(ctx, appInsightsId.ResourceGroup, appInsightsId.Name) + var existingAPIKeyList apikeys.APIKeysListOperationResponse + var existingAPIKeyId *apikeys.ApiKeyId + existingAPIKeyList, err = client.APIKeysList(ctx, *appInsightsId) if err != nil { - if !utils.ResponseWasNotFound(existingAPIKeyList.Response) { - return fmt.Errorf("checking for presence of existing Application Insights API key list %q (%s): %+v", name, appInsightsId, err) + if !response.WasNotFound(existingAPIKeyList.HttpResponse) { + return fmt.Errorf("checking for presence of existing Application Insights API key list for %s: %+v", appInsightsId, err) } } - if existingAPIKeyList.Value != nil { - for _, existingAPIKey := range *existingAPIKeyList.Value { - existingAPIKeyId, err = parse.ApiKeyID(camelCaseApiKeys(*existingAPIKey.ID)) + for existingAPIKeyList.Model != nil && len(existingAPIKeyList.Model.Value) > 0 { + for _, existingAPIKey := range existingAPIKeyList.Model.Value { + existingAPIKeyId, err = apikeys.ParseApiKeyIDInsensitively(*existingAPIKey.Id) if err != nil { return err } @@ -130,64 +126,73 @@ func resourceApplicationInsightsAPIKeyCreate(d *pluginsdk.ResourceData, meta int if len(*linkedReadProperties) == 0 && len(*linkedWriteProperties) == 0 { return fmt.Errorf("at least one read or write permission must be defined") } - apiKeyProperties := insights.APIKeyRequest{ + apiKeyProperties := apikeys.APIKeyRequest{ Name: &name, LinkedReadProperties: linkedReadProperties, LinkedWriteProperties: linkedWriteProperties, } - result, err := client.Create(ctx, appInsightsId.ResourceGroup, appInsightsId.Name, apiKeyProperties) + resp, err := client.APIKeysCreate(ctx, *appInsightsId, apiKeyProperties) if err != nil { - return fmt.Errorf("creating Application Insights API key %q (%s): %+v", name, appInsightsId, err) + return fmt.Errorf("creating API key %q for %s: %+v", name, appInsightsId, err) } - if result.APIKey == nil { - return fmt.Errorf("creating Application Insights API key %q (%s): got empty API key", name, appInsightsId) + if resp.Model == nil || resp.Model.ApiKey == nil { + return fmt.Errorf("creating API key %q for %s: got empty API key", name, appInsightsId) } - d.SetId(camelCaseApiKeys(*result.ID)) + // API returns lower case on resourceGroups and apiKeys + id, err := apikeys.ParseApiKeyIDInsensitively(*resp.Model.Id) + if err != nil { + return err + } + d.SetId(id.ID()) - // API key can only retrieved at key creation - d.Set("api_key", result.APIKey) + // API key can only be retrieved at key creation + d.Set("api_key", resp.Model.ApiKey) return resourceApplicationInsightsAPIKeyRead(d, meta) } func resourceApplicationInsightsAPIKeyRead(d *pluginsdk.ResourceData, meta interface{}) error { client := meta.(*clients.Client).AppInsights.APIKeysClient - subscriptionId := meta.(*clients.Client).AppInsights.APIKeysClient.SubscriptionID + subscriptionId := meta.(*clients.Client).Account.SubscriptionId ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.ApiKeyID(d.Id()) + id, err := apikeys.ParseApiKeyID(d.Id()) if err != nil { return err } - appInsightsId := parse.NewComponentID(subscriptionId, id.ResourceGroup, id.ComponentName) + appInsightsId := components.NewComponentID(subscriptionId, id.ResourceGroupName, id.ComponentName) - log.Printf("[DEBUG] Reading AzureRM Application Insights API key '%s'", id) - - result, err := client.Get(ctx, id.ResourceGroup, id.ComponentName, id.Name) + result, err := client.APIKeysGet(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(result.Response) { - log.Printf("[WARN] AzureRM Application Insights API key '%s' not found, removing from state", id) + if response.WasNotFound(result.HttpResponse) { + log.Printf("[DEBUG] %s not found, removing from state", id) d.SetId("") return nil } - return fmt.Errorf("making Read request on %s: %+v", id, err) + return fmt.Errorf("retrieving %s: %+v", id, err) } d.Set("application_insights_id", appInsightsId.ID()) - d.Set("name", result.Name) - readProps := flattenApplicationInsightsAPIKeyLinkedProperties(result.LinkedReadProperties) - if err := d.Set("read_permissions", readProps); err != nil { - return fmt.Errorf("flattening `read_permissions `: %s", err) - } - writeProps := flattenApplicationInsightsAPIKeyLinkedProperties(result.LinkedWriteProperties) - if err := d.Set("write_permissions", writeProps); err != nil { - return fmt.Errorf("flattening `write_permissions `: %s", err) + if model := result.Model; model != nil { + d.Set("name", model.Name) + if props := model.LinkedReadProperties; props != nil { + readProps := flattenApplicationInsightsAPIKeyLinkedProperties(props) + if err := d.Set("read_permissions", readProps); err != nil { + return fmt.Errorf("flattening `read_permissions `: %s", err) + } + } + if props := model.LinkedWriteProperties; props != nil { + writeProps := flattenApplicationInsightsAPIKeyLinkedProperties(props) + if err := d.Set("write_permissions", writeProps); err != nil { + return fmt.Errorf("flattening `write_permissions `: %s", err) + } + } } return nil @@ -198,26 +203,18 @@ func resourceApplicationInsightsAPIKeyDelete(d *pluginsdk.ResourceData, meta int ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.ApiKeyID(d.Id()) + id, err := apikeys.ParseApiKeyID(d.Id()) if err != nil { return err } - log.Printf("[DEBUG] Deleting AzureRM Application Insights API key '%s'", id) - - result, err := client.Delete(ctx, id.ResourceGroup, id.ComponentName, id.Name) + result, err := client.APIKeysDelete(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(result.Response) { + if response.WasNotFound(result.HttpResponse) { return nil } - return fmt.Errorf("issuing AzureRM delete request for Application Insights API key '%s': %+v", id, err) + return fmt.Errorf("deleting %s: %+v", id, err) } return nil } - -func camelCaseApiKeys(id string) string { - // Azure only returns the api key identifier in the resource ID string where apikeys isn't camel cased - r := regexp.MustCompile(`apikeys`) - return r.ReplaceAllString(id, "apiKeys") -} diff --git a/internal/services/applicationinsights/application_insights_api_key_resource_test.go b/internal/services/applicationinsights/application_insights_api_key_resource_test.go index bb75d314e2f7..426a77141c18 100644 --- a/internal/services/applicationinsights/application_insights_api_key_resource_test.go +++ b/internal/services/applicationinsights/application_insights_api_key_resource_test.go @@ -6,16 +6,15 @@ package applicationinsights_test import ( "context" "fmt" - "net/http" "regexp" "testing" + "github.com/hashicorp/go-azure-helpers/lang/pointer" + apikeys "github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/componentapikeysapis" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/applicationinsights/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) type AppInsightsAPIKey struct{} @@ -137,17 +136,17 @@ func TestAccApplicationInsightsAPIKey_multiple_keys(t *testing.T) { } func (t AppInsightsAPIKey) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := parse.ApiKeyID(state.Attributes["id"]) + id, err := apikeys.ParseApiKeyID(state.Attributes["id"]) if err != nil { return nil, err } - resp, err := clients.AppInsights.APIKeysClient.Get(ctx, id.ResourceGroup, id.ComponentName, id.Name) + resp, err := clients.AppInsights.APIKeysClient.APIKeysGet(ctx, *id) if err != nil { - return nil, fmt.Errorf("retrieving Application Insights API Key '%s' does not exist", id) + return nil, fmt.Errorf("retrieving %s", id) } - return utils.Bool(resp.StatusCode != http.StatusNotFound), nil + return pointer.To(resp.Model != nil), nil } func (AppInsightsAPIKey) basic(data acceptance.TestData, readPerms, writePerms string) string { diff --git a/internal/services/applicationinsights/application_insights_data_source.go b/internal/services/applicationinsights/application_insights_data_source.go index 0eb2f785db4e..90fa403744b1 100644 --- a/internal/services/applicationinsights/application_insights_data_source.go +++ b/internal/services/applicationinsights/application_insights_data_source.go @@ -7,15 +7,15 @@ import ( "fmt" "time" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + components "github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-02-02/componentsapis" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/applicationinsights/parse" - "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func dataSourceApplicationInsights() *pluginsdk.Resource { @@ -88,36 +88,40 @@ func dataSourceArmApplicationInsightsRead(d *pluginsdk.ResourceData, meta interf ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - resGroup := d.Get("resource_group_name").(string) - name := d.Get("name").(string) + id := components.NewComponentID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) - resp, err := client.Get(ctx, resGroup, name) + resp, err := client.ComponentsGet(ctx, id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { - return fmt.Errorf("Application Insights %q (Resource Group %q) was not found", name, resGroup) + if response.WasNotFound(resp.HttpResponse) { + return fmt.Errorf("%s was not found", id) } - - return fmt.Errorf("retrieving Application Insights %q (Resource Group %q): %+v", name, resGroup, err) + return fmt.Errorf("retrieving %s: %+v", id, err) } - d.SetId(parse.NewComponentID(subscriptionId, resGroup, name).ID()) - d.Set("location", location.NormalizeNilable(resp.Location)) - if props := resp.ApplicationInsightsComponentProperties; props != nil { - d.Set("app_id", props.AppID) - d.Set("application_type", props.ApplicationType) - d.Set("connection_string", props.ConnectionString) - d.Set("instrumentation_key", props.InstrumentationKey) - retentionInDays := 0 - if props.RetentionInDays != nil { - retentionInDays = int(*props.RetentionInDays) - } - d.Set("retention_in_days", retentionInDays) + d.SetId(id.ID()) - workspaceId := "" - if props.WorkspaceResourceID != nil { - workspaceId = *props.WorkspaceResourceID + if model := resp.Model; model != nil { + d.Set("location", location.Normalize(model.Location)) + if err := tags.FlattenAndSet(d, model.Tags); err != nil { + return fmt.Errorf("flattening `tags`: %+v", err) + } + if props := model.Properties; props != nil { + d.Set("app_id", props.ApplicationId) + d.Set("application_type", props.ApplicationType) + d.Set("connection_string", props.ConnectionString) + d.Set("instrumentation_key", props.InstrumentationKey) + retentionInDays := 0 + if props.RetentionInDays != nil { + retentionInDays = int(*props.RetentionInDays) + } + d.Set("retention_in_days", retentionInDays) + + workspaceId := "" + if props.WorkspaceResourceId != nil { + workspaceId = *props.WorkspaceResourceId + } + d.Set("workspace_id", workspaceId) } - d.Set("workspace_id", workspaceId) } - return tags.FlattenAndSet(d, resp.Tags) + return nil } diff --git a/internal/services/applicationinsights/application_insights_resource.go b/internal/services/applicationinsights/application_insights_resource.go index 33045c484be1..9428f62b2b54 100644 --- a/internal/services/applicationinsights/application_insights_resource.go +++ b/internal/services/applicationinsights/application_insights_resource.go @@ -5,22 +5,23 @@ package applicationinsights import ( "fmt" - "log" "net/http" "strings" "time" - "github.com/Azure/azure-sdk-for-go/services/appinsights/mgmt/2020-02-02/insights" // nolint: staticcheck "github.com/Azure/azure-sdk-for-go/services/preview/alertsmanagement/mgmt/2019-06-01-preview/alertsmanagement" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + billing "github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/componentfeaturesandpricingapis" + components "github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-02-02/componentsapis" "github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/applicationinsights/migration" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/applicationinsights/parse" monitorParse "github.com/hashicorp/terraform-provider-azurerm/internal/services/monitor/parse" - "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" @@ -35,7 +36,7 @@ func resourceApplicationInsights() *pluginsdk.Resource { Delete: resourceApplicationInsightsDelete, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.ComponentID(id) + _, err := components.ParseComponentID(id) return err }), @@ -114,7 +115,7 @@ func resourceApplicationInsights() *pluginsdk.Resource { Default: false, }, - "tags": tags.Schema(), + "tags": commonschema.Tags(), "daily_data_cap_in_gb": { Type: pluginsdk.TypeFloat, @@ -180,53 +181,38 @@ func resourceApplicationInsightsCreateUpdate(d *pluginsdk.ResourceData, meta int ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) defer cancel() - log.Printf("[INFO] preparing arguments for AzureRM Application Insights creation.") - - name := d.Get("name").(string) - resGroup := d.Get("resource_group_name").(string) - - resourceId := parse.NewComponentID(subscriptionId, resGroup, name) + id := components.NewComponentID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) if d.IsNewResource() { - existing, err := client.Get(ctx, resGroup, name) + existing, err := client.ComponentsGet(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { - return fmt.Errorf("checking for presence of existing Application Insights %q (Resource Group %q): %s", name, resGroup, err) + if !response.WasNotFound(existing.HttpResponse) { + return fmt.Errorf("checking for presence of existing %s: %v", id, err) } } - - if !utils.ResponseWasNotFound(existing.Response) { - return tf.ImportAsExistsError("azurerm_application_insights", resourceId.ID()) + if !response.WasNotFound(existing.HttpResponse) { + return tf.ImportAsExistsError("azurerm_application_insights", id.ID()) } } - applicationType := d.Get("application_type").(string) - samplingPercentage := utils.Float(d.Get("sampling_percentage").(float64)) - disableIpMasking := d.Get("disable_ip_masking").(bool) - localAuthenticationDisabled := d.Get("local_authentication_disabled").(bool) - location := location.Normalize(d.Get("location").(string)) - t := d.Get("tags").(map[string]interface{}) - - internetIngestionEnabled := insights.PublicNetworkAccessTypeDisabled + internetIngestionEnabled := components.PublicNetworkAccessTypeDisabled if d.Get("internet_ingestion_enabled").(bool) { - internetIngestionEnabled = insights.PublicNetworkAccessTypeEnabled + internetIngestionEnabled = components.PublicNetworkAccessTypeEnabled } - internetQueryEnabled := insights.PublicNetworkAccessTypeDisabled + internetQueryEnabled := components.PublicNetworkAccessTypeDisabled if d.Get("internet_query_enabled").(bool) { - internetQueryEnabled = insights.PublicNetworkAccessTypeEnabled + internetQueryEnabled = components.PublicNetworkAccessTypeEnabled } - forceCustomerStorageForProfiler := d.Get("force_customer_storage_for_profiler").(bool) - - applicationInsightsComponentProperties := insights.ApplicationInsightsComponentProperties{ - ApplicationID: &name, - ApplicationType: insights.ApplicationType(applicationType), - SamplingPercentage: samplingPercentage, - DisableIPMasking: utils.Bool(disableIpMasking), - DisableLocalAuth: utils.Bool(localAuthenticationDisabled), - PublicNetworkAccessForIngestion: internetIngestionEnabled, - PublicNetworkAccessForQuery: internetQueryEnabled, - ForceCustomerStorageForProfiler: utils.Bool(forceCustomerStorageForProfiler), + applicationInsightsComponentProperties := components.ApplicationInsightsComponentProperties{ + ApplicationId: pointer.To(id.ComponentName), + ApplicationType: components.ApplicationType(d.Get("application_type").(string)), + SamplingPercentage: pointer.To(d.Get("sampling_percentage").(float64)), + DisableIPMasking: pointer.To(d.Get("disable_ip_masking").(bool)), + DisableLocalAuth: pointer.To(d.Get("local_authentication_disabled").(bool)), + PublicNetworkAccessForIngestion: pointer.To(internetIngestionEnabled), + PublicNetworkAccessForQuery: pointer.To(internetQueryEnabled), + ForceCustomerStorageForProfiler: pointer.To(d.Get("force_customer_storage_for_profiler").(bool)), } if !d.IsNewResource() { @@ -241,42 +227,49 @@ func resourceApplicationInsightsCreateUpdate(d *pluginsdk.ResourceData, meta int if err != nil { return err } - applicationInsightsComponentProperties.WorkspaceResourceID = utils.String(workspaceID.ID()) + applicationInsightsComponentProperties.WorkspaceResourceId = pointer.To(workspaceID.ID()) } if v, ok := d.GetOk("retention_in_days"); ok { - applicationInsightsComponentProperties.RetentionInDays = utils.Int32(int32(v.(int))) + applicationInsightsComponentProperties.RetentionInDays = pointer.To(int64(v.(int))) } - insightProperties := insights.ApplicationInsightsComponent{ - Name: &name, - Location: &location, - Kind: &applicationType, - ApplicationInsightsComponentProperties: &applicationInsightsComponentProperties, - Tags: tags.Expand(t), + insightProperties := components.ApplicationInsightsComponent{ + Name: pointer.To(id.ComponentName), + Location: location.Normalize(d.Get("location").(string)), + Kind: d.Get("application_type").(string), + Properties: &applicationInsightsComponentProperties, + Tags: tags.Expand(d.Get("tags").(map[string]interface{})), } - _, err := client.CreateOrUpdate(ctx, resGroup, name, insightProperties) + _, err := client.ComponentsCreateOrUpdate(ctx, id, insightProperties) if err != nil { - return fmt.Errorf("creating Application Insights %q (Resource Group %q): %+v", name, resGroup, err) + return fmt.Errorf("creating %s: %+v", id, err) } - read, err := client.Get(ctx, resGroup, name) + read, err := client.ComponentsGet(ctx, id) if err != nil { - return fmt.Errorf("retrieving Application Insights %q (Resource Group %q): %+v", name, resGroup, err) + return fmt.Errorf("retrieving %s: %+v", id, err) } - if read.ID == nil { - return fmt.Errorf("Cannot read AzureRM Application Insights '%s' (Resource Group %s) ID", name, resGroup) + if read.Model == nil && read.Model.Id == nil { + return fmt.Errorf("cannot read %s", id) } - billingRead, err := billingClient.Get(ctx, resGroup, name) + billingId, err := billing.ParseComponentID(id.ID()) if err != nil { - return fmt.Errorf("read Application Insights Billing Features %q (Resource Group %q): %+v", name, resGroup, err) + return err + } + billingRead, err := billingClient.ComponentCurrentBillingFeaturesGet(ctx, *billingId) + if err != nil { + return fmt.Errorf("retrieving Billing Features for %s: %+v", id, err) } - applicationInsightsComponentBillingFeatures := insights.ApplicationInsightsComponentBillingFeatures{ - CurrentBillingFeatures: billingRead.CurrentBillingFeatures, - DataVolumeCap: billingRead.DataVolumeCap, + if billingRead.Model == nil { + return fmt.Errorf("model is nil for billing features") + } + applicationInsightsComponentBillingFeatures := billing.ApplicationInsightsComponentBillingFeatures{ + CurrentBillingFeatures: billingRead.Model.CurrentBillingFeatures, + DataVolumeCap: billingRead.Model.DataVolumeCap, } if v, ok := d.GetOk("daily_data_cap_in_gb"); ok { @@ -287,8 +280,8 @@ func resourceApplicationInsightsCreateUpdate(d *pluginsdk.ResourceData, meta int applicationInsightsComponentBillingFeatures.DataVolumeCap.StopSendNotificationWhenHitCap = utils.Bool(v.(bool)) } - if _, err = billingClient.Update(ctx, resGroup, name, applicationInsightsComponentBillingFeatures); err != nil { - return fmt.Errorf("update Application Insights Billing Feature %q (Resource Group %q): %+v", name, resGroup, err) + if _, err = billingClient.ComponentCurrentBillingFeaturesUpdate(ctx, *billingId, applicationInsightsComponentBillingFeatures); err != nil { + return fmt.Errorf("update Billing Feature for %s: %+v", id, err) } // https://github.com/hashicorp/terraform-provider-azurerm/issues/10563 @@ -299,9 +292,9 @@ func resourceApplicationInsightsCreateUpdate(d *pluginsdk.ResourceData, meta int // TODO: replace this with a StateWait func err = pluginsdk.Retry(d.Timeout(pluginsdk.TimeoutCreate), func() *pluginsdk.RetryError { time.Sleep(30 * time.Second) - ruleName := fmt.Sprintf("Failure Anomalies - %s", resourceId.Name) - ruleId := monitorParse.NewSmartDetectorAlertRuleID(resourceId.SubscriptionId, resourceId.ResourceGroup, ruleName) - result, err := ruleClient.Get(ctx, ruleId.ResourceGroup, ruleId.Name, utils.Bool(true)) + ruleName := fmt.Sprintf("Failure Anomalies - %s", id.ComponentName) + ruleId := monitorParse.NewSmartDetectorAlertRuleID(id.SubscriptionId, id.ResourceGroupName, ruleName) + result, err := ruleClient.Get(ctx, ruleId.ResourceGroup, ruleId.Name, pointer.To(true)) if err != nil { if utils.ResponseWasNotFound(result.Response) { return pluginsdk.RetryableError(fmt.Errorf("expected %s to be created but was not found, retrying", ruleId)) @@ -325,7 +318,7 @@ func resourceApplicationInsightsCreateUpdate(d *pluginsdk.ResourceData, meta int } } - d.SetId(resourceId.ID()) + d.SetId(id.ID()) return resourceApplicationInsightsRead(d, meta) } @@ -336,74 +329,79 @@ func resourceApplicationInsightsRead(d *pluginsdk.ResourceData, meta interface{} ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.ComponentID(d.Id()) + id, err := components.ParseComponentID(d.Id()) if err != nil { return err } - log.Printf("[DEBUG] Reading AzureRM Application Insights '%s'", id) - - resp, err := client.Get(ctx, id.ResourceGroup, id.Name) + resp, err := client.ComponentsGet(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { d.SetId("") return nil } - return fmt.Errorf("making Read request on AzureRM Application Insights '%s': %+v", id.Name, err) + return fmt.Errorf("retrieving %s: %+v", id, err) } - billingResp, err := billingClient.Get(ctx, id.ResourceGroup, id.Name) + billingId, err := billing.ParseComponentID(id.ID()) + if err != nil { + return err + } + billingResp, err := billingClient.ComponentCurrentBillingFeaturesGet(ctx, *billingId) if err != nil { - return fmt.Errorf("making Read request on AzureRM Application Insights Billing Feature '%s': %+v", id.Name, err) + return fmt.Errorf("retrieving Billing Features for %s: %+v", id, err) } - d.Set("name", id.Name) - d.Set("resource_group_name", id.ResourceGroup) - d.Set("location", location.NormalizeNilable(resp.Location)) + d.Set("name", id.ComponentName) + d.Set("resource_group_name", id.ResourceGroupName) - if props := resp.ApplicationInsightsComponentProperties; props != nil { - // Accommodate application_type that only differs by case and so shouldn't cause a recreation - vals := map[string]string{ - "web": "web", - "other": "other", - } - if v, ok := vals[strings.ToLower(string(props.ApplicationType))]; ok { - d.Set("application_type", v) - } else { - d.Set("application_type", string(props.ApplicationType)) + if model := resp.Model; model != nil { + d.Set("location", location.Normalize(model.Location)) + if err := tags.FlattenAndSet(d, model.Tags); err != nil { + return fmt.Errorf("flattening `tags`: %+v", err) } - d.Set("app_id", props.AppID) - d.Set("instrumentation_key", props.InstrumentationKey) - d.Set("sampling_percentage", props.SamplingPercentage) - d.Set("disable_ip_masking", props.DisableIPMasking) - d.Set("connection_string", props.ConnectionString) - d.Set("local_authentication_disabled", props.DisableLocalAuth) - - d.Set("internet_ingestion_enabled", resp.PublicNetworkAccessForIngestion == insights.PublicNetworkAccessTypeEnabled) - d.Set("internet_query_enabled", resp.PublicNetworkAccessForQuery == insights.PublicNetworkAccessTypeEnabled) - d.Set("force_customer_storage_for_profiler", props.ForceCustomerStorageForProfiler) - - workspaceId := "" - if v := props.WorkspaceResourceID; v != nil { - id, err := workspaces.ParseWorkspaceIDInsensitively(*v) - if err != nil { - return err + + if props := model.Properties; props != nil { + vals := map[string]string{ + "web": "web", + "other": "other", } - workspaceId = id.ID() - } - d.Set("workspace_id", workspaceId) - if v := props.RetentionInDays; v != nil { - d.Set("retention_in_days", v) + if v, ok := vals[strings.ToLower(string(props.ApplicationType))]; ok { + d.Set("application_type", v) + } else { + d.Set("application_type", string(props.ApplicationType)) + } + d.Set("app_id", props.ApplicationId) + d.Set("instrumentation_key", props.InstrumentationKey) + d.Set("sampling_percentage", props.SamplingPercentage) + d.Set("disable_ip_masking", props.DisableIPMasking) + d.Set("connection_string", props.ConnectionString) + d.Set("local_authentication_disabled", props.DisableLocalAuth) + d.Set("internet_ingestion_enabled", pointer.From(props.PublicNetworkAccessForIngestion) == components.PublicNetworkAccessTypeEnabled) + d.Set("internet_query_enabled", pointer.From(props.PublicNetworkAccessForQuery) == components.PublicNetworkAccessTypeEnabled) + d.Set("force_customer_storage_for_profiler", props.ForceCustomerStorageForProfiler) + d.Set("retention_in_days", pointer.From(props.RetentionInDays)) + workspaceId := "" + if v := props.WorkspaceResourceId; v != nil { + id, err := workspaces.ParseWorkspaceIDInsensitively(*v) + if err != nil { + return err + } + workspaceId = id.ID() + } + d.Set("workspace_id", workspaceId) } } - if billingProps := billingResp.DataVolumeCap; billingProps != nil { - d.Set("daily_data_cap_in_gb", billingProps.Cap) - d.Set("daily_data_cap_notifications_disabled", billingProps.StopSendNotificationWhenHitCap) + if model := billingResp.Model; model != nil { + if props := model.DataVolumeCap; props != nil { + d.Set("daily_data_cap_in_gb", props.Cap) + d.Set("daily_data_cap_notifications_disabled", props.StopSendNotificationWhenHitCap) + } } - return tags.FlattenAndSet(d, resp.Tags) + return nil } func resourceApplicationInsightsDelete(d *pluginsdk.ResourceData, meta interface{}) error { @@ -412,25 +410,23 @@ func resourceApplicationInsightsDelete(d *pluginsdk.ResourceData, meta interface ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.ComponentID(d.Id()) + id, err := components.ParseComponentID(d.Id()) if err != nil { return err } - log.Printf("[DEBUG] Deleting AzureRM Application Insights %q (resource group %q)", id.Name, id.ResourceGroup) - - resp, err := client.Delete(ctx, id.ResourceGroup, id.Name) + resp, err := client.ComponentsDelete(ctx, *id) if err != nil { - if resp.StatusCode == http.StatusNotFound { + if response.WasNotFound(resp.HttpResponse) { return nil } - return fmt.Errorf("issuing AzureRM delete request for Application Insights %q: %+v", id.Name, err) + return fmt.Errorf("deleting %s: %+v", id, err) } // if disable_generated_rule=true, the generated rule is not automatically deleted. if meta.(*clients.Client).Features.ApplicationInsights.DisableGeneratedRule { - ruleName := fmt.Sprintf("Failure Anomalies - %s", id.Name) - ruleId := monitorParse.NewSmartDetectorAlertRuleID(id.SubscriptionId, id.ResourceGroup, ruleName) + ruleName := fmt.Sprintf("Failure Anomalies - %s", id.ComponentName) + ruleId := monitorParse.NewSmartDetectorAlertRuleID(id.SubscriptionId, id.ResourceGroupName, ruleName) deleteResp, deleteErr := ruleClient.Delete(ctx, ruleId.ResourceGroup, ruleId.Name) if deleteErr != nil && deleteResp.StatusCode != http.StatusNotFound { return fmt.Errorf("deleting %s: %+v", ruleId, deleteErr) diff --git a/internal/services/applicationinsights/application_insights_resource_test.go b/internal/services/applicationinsights/application_insights_resource_test.go index 77ae91bef9cb..aab47c5d80a6 100644 --- a/internal/services/applicationinsights/application_insights_resource_test.go +++ b/internal/services/applicationinsights/application_insights_resource_test.go @@ -8,12 +8,12 @@ import ( "fmt" "testing" + "github.com/hashicorp/go-azure-helpers/lang/pointer" + components "github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-02-02/componentsapis" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/applicationinsights/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) type AppInsightsResource struct{} @@ -172,17 +172,17 @@ func TestAccApplicationInsights_basicWorkspaceMode(t *testing.T) { } func (t AppInsightsResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := parse.ComponentID(state.ID) + id, err := components.ParseComponentID(state.ID) if err != nil { return nil, err } - resp, err := clients.AppInsights.ComponentsClient.Get(ctx, id.ResourceGroup, id.Name) + resp, err := clients.AppInsights.ComponentsClient.ComponentsGet(ctx, *id) if err != nil { - return nil, fmt.Errorf("retrieving Application Insights %q (resource group: %q) does not exist", id.Name, id.ResourceGroup) + return nil, fmt.Errorf("retrieving %s: %+v", id, err) } - return utils.Bool(resp.ApplicationInsightsComponentProperties != nil), nil + return pointer.To(resp.Model != nil), nil } func TestAccApplicationInsights_complete(t *testing.T) { diff --git a/internal/services/applicationinsights/application_insights_smart_detection_rule_resource.go b/internal/services/applicationinsights/application_insights_smart_detection_rule_resource.go index 372666389304..a7f5bf06e22f 100644 --- a/internal/services/applicationinsights/application_insights_smart_detection_rule_resource.go +++ b/internal/services/applicationinsights/application_insights_smart_detection_rule_resource.go @@ -9,11 +9,12 @@ import ( "strings" "time" - "github.com/Azure/azure-sdk-for-go/services/appinsights/mgmt/2020-02-02/insights" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/lang/response" + smartdetection "github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/componentproactivedetectionapis" + components "github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-02-02/componentsapis" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/applicationinsights/migration" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/applicationinsights/parse" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/applicationinsights/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" @@ -28,13 +29,14 @@ func resourceApplicationInsightsSmartDetectionRule() *pluginsdk.Resource { Delete: resourceApplicationInsightsSmartDetectionRuleDelete, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.SmartDetectionRuleID(id) + _, err := smartdetection.ParseProactiveDetectionConfigID(id) return err }), - SchemaVersion: 1, + SchemaVersion: 2, StateUpgraders: pluginsdk.StateUpgrades(map[int]pluginsdk.StateUpgrade{ 0: migration.SmartDetectionRuleUpgradeV0ToV1{}, + 1: migration.SmartDetectionRuleUpgradeV1ToV2{}, }), Timeouts: &pluginsdk.ResourceTimeout{ @@ -69,7 +71,7 @@ func resourceApplicationInsightsSmartDetectionRule() *pluginsdk.Resource { Type: pluginsdk.TypeString, Required: true, ForceNew: true, - ValidateFunc: validate.ComponentID, + ValidateFunc: components.ValidateComponentID, }, "enabled": { @@ -104,23 +106,23 @@ func resourceApplicationInsightsSmartDetectionRuleUpdate(d *pluginsdk.ResourceDa // We'll have the user submit what the name looks like in the UI and convert it behind the scenes to match what the API accepts name := convertUiNameToApiName(d.Get("name")) - appInsightsId, err := parse.ComponentID(d.Get("application_insights_id").(string)) + appInsightsId, err := smartdetection.ParseComponentID(d.Get("application_insights_id").(string)) if err != nil { return err } - id := parse.NewSmartDetectionRuleID(appInsightsId.SubscriptionId, appInsightsId.ResourceGroup, appInsightsId.Name, name) + id := smartdetection.NewProactiveDetectionConfigID(appInsightsId.SubscriptionId, appInsightsId.ResourceGroupName, appInsightsId.ComponentName, name) - smartDetectionRuleProperties := insights.ApplicationInsightsComponentProactiveDetectionConfiguration{ + smartDetectionRuleProperties := smartdetection.ApplicationInsightsComponentProactiveDetectionConfiguration{ Name: &name, - Enabled: utils.Bool(d.Get("enabled").(bool)), - SendEmailsToSubscriptionOwners: utils.Bool(d.Get("send_emails_to_subscription_owners").(bool)), + Enabled: pointer.To(d.Get("enabled").(bool)), + SendEmailsToSubscriptionOwners: pointer.To(d.Get("send_emails_to_subscription_owners").(bool)), CustomEmails: utils.ExpandStringSlice(d.Get("additional_email_recipients").(*pluginsdk.Set).List()), } - _, err = client.Update(ctx, id.ResourceGroup, id.ComponentName, name, smartDetectionRuleProperties) + _, err = client.ProactiveDetectionConfigurationsUpdate(ctx, id, smartDetectionRuleProperties) if err != nil { - return fmt.Errorf("updating Application Insights Smart Detection Rule %s: %+v", id, err) + return fmt.Errorf("updating %s: %+v", id, err) } d.SetId(id.ID()) @@ -133,28 +135,32 @@ func resourceApplicationInsightsSmartDetectionRuleRead(d *pluginsdk.ResourceData ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.SmartDetectionRuleID(d.Id()) + id, err := smartdetection.ParseProactiveDetectionConfigID(d.Id()) if err != nil { return err } log.Printf("[DEBUG] Reading AzureRM Application Insights Smart Detection Rule %s", id) - result, err := client.Get(ctx, id.ResourceGroup, id.ComponentName, id.SmartDetectionRuleName) + resp, err := client.ProactiveDetectionConfigurationsGet(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(result.Response) { - log.Printf("[WARN] AzureRM Application Insights Smart Detection Rule %s not found, removing from state", id) + if response.WasNotFound(resp.HttpResponse) { + log.Printf("[DEBUG] %s was not found, removing from state", id) d.SetId("") return nil } - return fmt.Errorf("making Read request on AzureRM Application Insights Smart Detection Rule %s: %+v", id, err) + return fmt.Errorf("retrieving %s: %+v", id, err) } - d.Set("name", result.Name) - d.Set("application_insights_id", parse.NewComponentID(id.SubscriptionId, id.ResourceGroup, id.ComponentName).ID()) - d.Set("enabled", result.Enabled) - d.Set("send_emails_to_subscription_owners", result.SendEmailsToSubscriptionOwners) - d.Set("additional_email_recipients", utils.FlattenStringSlice(result.CustomEmails)) + d.Set("application_insights_id", smartdetection.NewComponentID(id.SubscriptionId, id.ResourceGroupName, id.ComponentName).ID()) + + if model := resp.Model; model != nil { + d.Set("name", model.Name) + d.Set("enabled", model.Enabled) + d.Set("send_emails_to_subscription_owners", model.SendEmailsToSubscriptionOwners) + d.Set("additional_email_recipients", utils.FlattenStringSlice(model.CustomEmails)) + + } return nil } @@ -163,37 +169,40 @@ func resourceApplicationInsightsSmartDetectionRuleDelete(d *pluginsdk.ResourceDa ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.SmartDetectionRuleID(d.Id()) + id, err := smartdetection.ParseProactiveDetectionConfigID(d.Id()) if err != nil { return err } log.Printf("[DEBUG] reseting AzureRM Application Insights Smart Detection Rule %s", id) - result, err := client.Get(ctx, id.ResourceGroup, id.ComponentName, id.SmartDetectionRuleName) + resp, err := client.ProactiveDetectionConfigurationsGet(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(result.Response) { - log.Printf("[WARN] AzureRM Application Insights Smart Detection Rule %s not found, removing from state", id) + if response.WasNotFound(resp.HttpResponse) { + log.Printf("[DEBUG] %s was not found, removing from state", id) d.SetId("") return nil } - return fmt.Errorf("making Read request on AzureRM Application Insights Smart Detection Rule %s: %+v", id, err) + return fmt.Errorf("retrieving %s: %+v", id, err) } - smartDetectionRuleProperties := insights.ApplicationInsightsComponentProactiveDetectionConfiguration{ - Name: utils.String(id.SmartDetectionRuleName), - Enabled: result.RuleDefinitions.IsEnabledByDefault, - SendEmailsToSubscriptionOwners: result.RuleDefinitions.SupportsEmailNotifications, + if resp.Model == nil { + return fmt.Errorf("model was nil for %s", id) + } + smartDetectionRuleProperties := smartdetection.ApplicationInsightsComponentProactiveDetectionConfiguration{ + Name: pointer.To(id.ConfigurationId), + Enabled: resp.Model.RuleDefinitions.IsEnabledByDefault, + SendEmailsToSubscriptionOwners: resp.Model.RuleDefinitions.SupportsEmailNotifications, CustomEmails: utils.ExpandStringSlice([]interface{}{}), } // Application Insights defaults all the Smart Detection Rules so if a user wants to delete a rule, we'll update it back to it's default values. - _, err = client.Update(ctx, id.ResourceGroup, id.ComponentName, id.SmartDetectionRuleName, smartDetectionRuleProperties) + _, err = client.ProactiveDetectionConfigurationsUpdate(ctx, *id, smartDetectionRuleProperties) if err != nil { - if utils.ResponseWasNotFound(result.Response) { + if response.WasNotFound(resp.HttpResponse) { return nil } - return fmt.Errorf("issuing AzureRM reset update request for Application Insights Smart Detection Rule %q: %+v", id.String(), err) + return fmt.Errorf("resetting %s: %+v", id, err) } return nil diff --git a/internal/services/applicationinsights/application_insights_smart_detection_rule_resource_test.go b/internal/services/applicationinsights/application_insights_smart_detection_rule_resource_test.go index 2943ee7912d1..eda5d9e292c6 100644 --- a/internal/services/applicationinsights/application_insights_smart_detection_rule_resource_test.go +++ b/internal/services/applicationinsights/application_insights_smart_detection_rule_resource_test.go @@ -6,15 +6,14 @@ package applicationinsights_test import ( "context" "fmt" - "net/http" "testing" + "github.com/hashicorp/go-azure-helpers/lang/pointer" + smartdetection "github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/componentproactivedetectionapis" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/applicationinsights/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) type AppInsightsSmartDetectionRule struct{} @@ -102,17 +101,17 @@ func TestAccApplicationInsightsSmartDetectionRule_longDependencyDuration(t *test // but this still causes issues when the resource performs a d.IsNewResource() check, where the tf.ImportAsExistsError is thrown. func (t AppInsightsSmartDetectionRule) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := parse.SmartDetectionRuleID(state.Attributes["id"]) + id, err := smartdetection.ParseProactiveDetectionConfigID(state.Attributes["id"]) if err != nil { return nil, err } - resp, err := clients.AppInsights.SmartDetectionRuleClient.Get(ctx, id.ResourceGroup, id.ComponentName, id.SmartDetectionRuleName) + resp, err := clients.AppInsights.SmartDetectionRuleClient.ProactiveDetectionConfigurationsGet(ctx, *id) if err != nil { - return nil, fmt.Errorf("retrieving Application Insights Smart Detection Rule '%s' does not exist", id) + return nil, fmt.Errorf("retrieving %s: %+v", id, err) } - return utils.Bool(resp.StatusCode != http.StatusNotFound), nil + return pointer.To(resp.Model != nil), nil } func (AppInsightsSmartDetectionRule) basic(data acceptance.TestData) string { diff --git a/internal/services/applicationinsights/application_insights_standard_webtests_resource.go b/internal/services/applicationinsights/application_insights_standard_webtests_resource.go index a84e244ebced..b05de63d1954 100644 --- a/internal/services/applicationinsights/application_insights_standard_webtests_resource.go +++ b/internal/services/applicationinsights/application_insights_standard_webtests_resource.go @@ -14,9 +14,9 @@ import ( "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + components "github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-02-02/componentsapis" webtests "github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2022-06-15/webtestsapis" "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/applicationinsights/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/utils" @@ -112,7 +112,7 @@ func (ApplicationInsightsStandardWebTestResource) Arguments() map[string]*plugin Type: pluginsdk.TypeString, Required: true, ForceNew: true, - ValidateFunc: validate.ComponentID, + ValidateFunc: components.ValidateComponentID, }, "location": commonschema.Location(), diff --git a/internal/services/applicationinsights/application_insights_webtests_resource.go b/internal/services/applicationinsights/application_insights_webtests_resource.go index 941efc1906b3..5954ba403825 100644 --- a/internal/services/applicationinsights/application_insights_webtests_resource.go +++ b/internal/services/applicationinsights/application_insights_webtests_resource.go @@ -6,25 +6,23 @@ package applicationinsights import ( "fmt" "log" - "net/http" "strings" "time" - "github.com/Azure/azure-sdk-for-go/services/appinsights/mgmt/2020-02-02/insights" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" - "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + components "github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-02-02/componentsapis" + webtests "github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2022-06-15/webtestsapis" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/applicationinsights/migration" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/applicationinsights/parse" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/applicationinsights/validate" - "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/suppress" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func resourceApplicationInsightsWebTests() *pluginsdk.Resource { @@ -34,7 +32,7 @@ func resourceApplicationInsightsWebTests() *pluginsdk.Resource { Update: resourceApplicationInsightsWebTestsCreateUpdate, Delete: resourceApplicationInsightsWebTestsDelete, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.WebTestID(id) + _, err := webtests.ParseWebTestID(id) return err }), @@ -64,7 +62,7 @@ func resourceApplicationInsightsWebTests() *pluginsdk.Resource { Type: pluginsdk.TypeString, Required: true, ForceNew: true, - ValidateFunc: validate.ComponentID, + ValidateFunc: components.ValidateComponentID, }, "location": commonschema.Location(), @@ -74,8 +72,8 @@ func resourceApplicationInsightsWebTests() *pluginsdk.Resource { Required: true, ForceNew: true, ValidateFunc: validation.StringInSlice([]string{ - string(insights.WebTestKindMultistep), - string(insights.WebTestKindPing), + string(webtests.WebTestKindMultistep), + string(webtests.WebTestKindPing), }, false), }, @@ -129,7 +127,7 @@ func resourceApplicationInsightsWebTests() *pluginsdk.Resource { DiffSuppressFunc: suppress.XmlDiff, }, - "tags": tags.Schema(), + "tags": commonschema.Tags(), "synthetic_monitor_id": { Type: pluginsdk.TypeString, @@ -146,27 +144,26 @@ func resourceApplicationInsightsWebTestsCreateUpdate(d *pluginsdk.ResourceData, log.Printf("[INFO] preparing arguments for AzureRM Application Insights WebTest creation.") - appInsightsId, err := parse.ComponentID(d.Get("application_insights_id").(string)) + appInsightsId, err := components.ParseComponentID(d.Get("application_insights_id").(string)) if err != nil { return err } - id := parse.NewWebTestID(appInsightsId.SubscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) + id := webtests.NewWebTestID(appInsightsId.SubscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) if d.IsNewResource() { - existing, err := client.Get(ctx, id) + existing, err := client.WebTestsGet(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { - return fmt.Errorf("checking for presence of existing Application Insights %s: %+v", id, err) + if !response.WasNotFound(existing.HttpResponse) { + return fmt.Errorf("checking for presence of %s: %+v", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return tf.ImportAsExistsError("azurerm_application_insights_web_test", id.ID()) } } - location := azure.NormalizeLocation(d.Get("location").(string)) kind := d.Get("kind").(string) description := d.Get("description").(string) frequency := int32(d.Get("frequency").(int)) @@ -181,30 +178,30 @@ func resourceApplicationInsightsWebTestsCreateUpdate(d *pluginsdk.ResourceData, tagKey := fmt.Sprintf("hidden-link:%s", appInsightsId.ID()) t[tagKey] = "Resource" - webTest := insights.WebTest{ - Name: &id.Name, - Location: &location, - Kind: insights.WebTestKind(kind), - WebTestProperties: &insights.WebTestProperties{ - SyntheticMonitorID: &id.Name, - WebTestName: &id.Name, + webTest := webtests.WebTest{ + Name: pointer.To(id.WebTestName), + Location: location.Normalize(d.Get("location").(string)), + Kind: pointer.To(webtests.WebTestKind(kind)), + Properties: &webtests.WebTestProperties{ + SyntheticMonitorId: id.WebTestName, + Name: id.WebTestName, Description: &description, Enabled: &isEnabled, - Frequency: &frequency, - Timeout: &timeout, - WebTestKind: insights.WebTestKind(kind), + Frequency: pointer.To(int64(frequency)), + Timeout: pointer.To(int64(timeout)), + Kind: webtests.WebTestKind(kind), RetryEnabled: &retryEnabled, - Locations: &geoLocations, - Configuration: &insights.WebTestPropertiesConfiguration{ + Locations: geoLocations, + Configuration: &webtests.WebTestPropertiesConfiguration{ WebTest: &testConf, }, }, Tags: tags.Expand(t), } - _, err = client.CreateOrUpdate(ctx, id, webTest) + _, err = client.WebTestsCreateOrUpdate(ctx, id, webTest) if err != nil { - return fmt.Errorf("creating/updating Application Insights %s: %+v", id, err) + return fmt.Errorf("creating/updating %s: %+v", id, err) } d.SetId(id.ID()) @@ -217,65 +214,69 @@ func resourceApplicationInsightsWebTestsRead(d *pluginsdk.ResourceData, meta int ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.WebTestID(d.Id()) + id, err := webtests.ParseWebTestID(d.Id()) if err != nil { return err } log.Printf("[DEBUG] Reading AzureRM Application Insights %q", *id) - resp, err := client.Get(ctx, *id) + resp, err := client.WebTestsGet(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { - log.Printf("[DEBUG] Application Insights %s was not found - removing from state!", *id) + if response.WasNotFound(resp.HttpResponse) { + log.Printf("[DEBUG] %s was not found - removing from state!", *id) d.SetId("") return nil } - return fmt.Errorf("retrieving Application Insights %s: %+v", *id, err) + return fmt.Errorf("retrieving %s: %+v", *id, err) } + d.Set("name", id.WebTestName) + d.Set("resource_group_name", id.ResourceGroupName) + appInsightsId := "" - for i := range resp.Tags { - if strings.HasPrefix(i, "hidden-link") { - appInsightsId = strings.Split(i, ":")[1] - } - } - parsedAppInsightsId, err := parse.ComponentIDInsensitively(appInsightsId) - if err != nil { - return fmt.Errorf("parsing `application_insights_id`: %+v", err) - } - d.Set("application_insights_id", parsedAppInsightsId.ID()) - d.Set("name", id.Name) - d.Set("resource_group_name", id.ResourceGroup) - d.Set("kind", resp.Kind) + if model := resp.Model; model != nil { + if model.Tags != nil { + for i := range *model.Tags { + if strings.HasPrefix(i, "hidden-link") { + appInsightsId = strings.Split(i, ":")[1] + } + } + } + d.Set("kind", pointer.From(model.Kind)) + d.Set("location", location.Normalize(model.Location)) - if location := resp.Location; location != nil { - d.Set("location", azure.NormalizeLocation(*location)) - } + if props := model.Properties; props != nil { + // It is possible that the root level `kind` in response is empty in some cases (see PR #8372 for more info) + if model.Kind == nil || *model.Kind == "" { + d.Set("kind", props.Kind) + } + d.Set("synthetic_monitor_id", props.SyntheticMonitorId) + d.Set("description", props.Description) + d.Set("enabled", props.Enabled) + d.Set("frequency", props.Frequency) + d.Set("timeout", props.Timeout) + d.Set("retry_enabled", props.RetryEnabled) + + if config := props.Configuration; config != nil { + d.Set("configuration", config.WebTest) + } - if props := resp.WebTestProperties; props != nil { - // It is possible that the root level `kind` in response is empty in some cases (see PR #8372 for more info) - if resp.Kind == "" { - d.Set("kind", props.WebTestKind) - } - d.Set("synthetic_monitor_id", props.SyntheticMonitorID) - d.Set("description", props.Description) - d.Set("enabled", props.Enabled) - d.Set("frequency", props.Frequency) - d.Set("timeout", props.Timeout) - d.Set("retry_enabled", props.RetryEnabled) - - if config := props.Configuration; config != nil { - d.Set("configuration", config.WebTest) + if err := d.Set("geo_locations", flattenApplicationInsightsWebTestGeoLocations(props.Locations)); err != nil { + return fmt.Errorf("setting `geo_locations`: %+v", err) + } } - if err := d.Set("geo_locations", flattenApplicationInsightsWebTestGeoLocations(props.Locations)); err != nil { - return fmt.Errorf("setting `geo_locations`: %+v", err) + parsedAppInsightsId, err := webtests.ParseComponentIDInsensitively(appInsightsId) + if err != nil { + return err } - } + d.Set("application_insights_id", parsedAppInsightsId.ID()) - return tags.FlattenAndSet(d, resp.Tags) + return tags.FlattenAndSet(d, model.Tags) + } + return nil } func resourceApplicationInsightsWebTestsDelete(d *pluginsdk.ResourceData, meta interface{}) error { @@ -283,31 +284,29 @@ func resourceApplicationInsightsWebTestsDelete(d *pluginsdk.ResourceData, meta i ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.WebTestID(d.Id()) + id, err := webtests.ParseWebTestID(d.Id()) if err != nil { return err } - log.Printf("[DEBUG] Deleting AzureRM Application Insights %s", *id) - - resp, err := client.Delete(ctx, *id) + resp, err := client.WebTestsDelete(ctx, *id) if err != nil { - if resp.StatusCode == http.StatusNotFound { + if response.WasNotFound(resp.HttpResponse) { return nil } - return fmt.Errorf("issuing AzureRM delete request for Application Insights '%s': %+v", *id, err) + return fmt.Errorf("deleting %s: %+v", *id, err) } return err } -func expandApplicationInsightsWebTestGeoLocations(input []interface{}) []insights.WebTestGeolocation { - locations := make([]insights.WebTestGeolocation, 0) +func expandApplicationInsightsWebTestGeoLocations(input []interface{}) []webtests.WebTestGeolocation { + locations := make([]webtests.WebTestGeolocation, 0) for _, v := range input { lc := v.(string) - loc := insights.WebTestGeolocation{ - Location: &lc, + loc := webtests.WebTestGeolocation{ + Id: &lc, } locations = append(locations, loc) } @@ -315,15 +314,15 @@ func expandApplicationInsightsWebTestGeoLocations(input []interface{}) []insight return locations } -func flattenApplicationInsightsWebTestGeoLocations(input *[]insights.WebTestGeolocation) []string { +func flattenApplicationInsightsWebTestGeoLocations(input []webtests.WebTestGeolocation) []string { results := make([]string, 0) - if input == nil { + if len(input) == 0 { return results } - for _, prop := range *input { - if prop.Location != nil { - results = append(results, azure.NormalizeLocation(*prop.Location)) + for _, prop := range input { + if prop.Id != nil { + results = append(results, location.Normalize(*prop.Id)) } } diff --git a/internal/services/applicationinsights/application_insights_webtests_resource_test.go b/internal/services/applicationinsights/application_insights_webtests_resource_test.go index c565325aa374..d69915e36efb 100644 --- a/internal/services/applicationinsights/application_insights_webtests_resource_test.go +++ b/internal/services/applicationinsights/application_insights_webtests_resource_test.go @@ -8,12 +8,12 @@ import ( "fmt" "testing" + "github.com/hashicorp/go-azure-helpers/lang/pointer" + webtests "github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2022-06-15/webtestsapis" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/applicationinsights/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) type AppInsightsWebTestsResource struct{} @@ -99,17 +99,17 @@ func TestAccApplicationInsightsWebTests_requiresImport(t *testing.T) { } func (t AppInsightsWebTestsResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := parse.WebTestID(state.ID) + id, err := webtests.ParseWebTestID(state.ID) if err != nil { return nil, err } - resp, err := clients.AppInsights.WebTestsClient.Get(ctx, *id) + resp, err := clients.AppInsights.WebTestsClient.WebTestsGet(ctx, *id) if err != nil { - return nil, fmt.Errorf("retrieving Application Insights '%q' (resource group: '%q') does not exist", id.ResourceGroup, id.Name) + return nil, fmt.Errorf("retrieving %s: %+v", id, err) } - return utils.Bool(resp.WebTestProperties != nil), nil + return pointer.To(resp.Model != nil), nil } func (AppInsightsWebTestsResource) basic(data acceptance.TestData) string { diff --git a/internal/services/applicationinsights/azuresdkhacks/webtests.go b/internal/services/applicationinsights/azuresdkhacks/webtests.go deleted file mode 100644 index 32cebd0c2cff..000000000000 --- a/internal/services/applicationinsights/azuresdkhacks/webtests.go +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 - -package azuresdkhacks - -import ( - "context" - "net/http" - - "github.com/Azure/azure-sdk-for-go/services/appinsights/mgmt/2020-02-02/insights" // nolint: staticcheck - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/applicationinsights/parse" -) - -type WebTestsClient struct { - client *insights.WebTestsClient -} - -func NewWebTestsClient(client insights.WebTestsClient) WebTestsClient { - return WebTestsClient{ - client: &client, - } -} - -// CreateOrUpdate is a workaround to handle that the Azure API can return either a 200 / 201 -// rather than the 200 documented in the Swagger - this is a workaround until the upstream PR is merged -// TF issue: https://github.com/hashicorp/terraform-provider-azurerm/issues/16805 -// Swagger PR: https://github.com/Azure/azure-rest-api-specs/pull/19104 -func (c WebTestsClient) CreateOrUpdate(ctx context.Context, id parse.WebTestId, webTestDefinition insights.WebTest) (result insights.WebTest, err error) { - req, err := c.client.CreateOrUpdatePreparer(ctx, id.ResourceGroup, id.Name, webTestDefinition) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.WebTestsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := c.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 = c.createOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.WebTestsClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// createOrUpdateResponder is a workaround to handle that the Azure API can return either a 200 / 201 -// rather than the 200 documented in the Swagger - this is a workaround until the upstream PR is merged -// TF issue: https://github.com/hashicorp/terraform-provider-azurerm/issues/16805 -// Swagger PR: https://github.com/Azure/azure-rest-api-specs/pull/19104 -func (c WebTestsClient) createOrUpdateResponder(resp *http.Response) (result insights.WebTest, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -func (c WebTestsClient) Delete(ctx context.Context, id parse.WebTestId) (result autorest.Response, err error) { - return c.client.Delete(ctx, id.ResourceGroup, id.Name) -} - -func (c WebTestsClient) Get(ctx context.Context, id parse.WebTestId) (result insights.WebTest, err error) { - return c.client.Get(ctx, id.ResourceGroup, id.Name) -} diff --git a/internal/services/applicationinsights/client/client.go b/internal/services/applicationinsights/client/client.go index 7477e1f1caa3..fb4504d8b7ad 100644 --- a/internal/services/applicationinsights/client/client.go +++ b/internal/services/applicationinsights/client/client.go @@ -6,39 +6,53 @@ package client import ( "fmt" - "github.com/Azure/azure-sdk-for-go/services/appinsights/mgmt/2020-02-02/insights" // nolint: staticcheck + analyticsitems "github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/analyticsitemsapis" + apikeys "github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/componentapikeysapis" + billing "github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/componentfeaturesandpricingapis" + smartdetection "github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/componentproactivedetectionapis" + components "github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-02-02/componentsapis" workbooktemplates "github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-11-20/workbooktemplatesapis" workbooks "github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2022-04-01/workbooksapis" webtests "github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2022-06-15/webtestsapis" "github.com/hashicorp/terraform-provider-azurerm/internal/common" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/applicationinsights/azuresdkhacks" ) type Client struct { - AnalyticsItemsClient *insights.AnalyticsItemsClient - APIKeysClient *insights.APIKeysClient - ComponentsClient *insights.ComponentsClient - WebTestsClient *azuresdkhacks.WebTestsClient + AnalyticsItemsClient *analyticsitems.AnalyticsItemsAPIsClient + APIKeysClient *apikeys.ComponentApiKeysAPIsClient + ComponentsClient *components.ComponentsAPIsClient + WebTestsClient *webtests.WebTestsAPIsClient StandardWebTestsClient *webtests.WebTestsAPIsClient - BillingClient *insights.ComponentCurrentBillingFeaturesClient - SmartDetectionRuleClient *insights.ProactiveDetectionConfigurationsClient + BillingClient *billing.ComponentFeaturesAndPricingAPIsClient + SmartDetectionRuleClient *smartdetection.ComponentProactiveDetectionAPIsClient WorkbookClient *workbooks.WorkbooksAPIsClient WorkbookTemplateClient *workbooktemplates.WorkbookTemplatesAPIsClient } func NewClient(o *common.ClientOptions) (*Client, error) { - analyticsItemsClient := insights.NewAnalyticsItemsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) - o.ConfigureClient(&analyticsItemsClient.Client, o.ResourceManagerAuthorizer) + analyticsItemsClient, err := analyticsitems.NewAnalyticsItemsAPIsClientWithBaseURI(o.Environment.ResourceManager) + if err != nil { + return nil, fmt.Errorf("building AnalyticsItems client: %+v", err) + } + o.Configure(analyticsItemsClient.Client, o.Authorizers.ResourceManager) - apiKeysClient := insights.NewAPIKeysClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) - o.ConfigureClient(&apiKeysClient.Client, o.ResourceManagerAuthorizer) + apiKeysClient, err := apikeys.NewComponentApiKeysAPIsClientWithBaseURI(o.Environment.ResourceManager) + if err != nil { + return nil, fmt.Errorf("building ApiKeys client: %+v", err) + } + o.Configure(apiKeysClient.Client, o.Authorizers.ResourceManager) - componentsClient := insights.NewComponentsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) - o.ConfigureClient(&componentsClient.Client, o.ResourceManagerAuthorizer) + componentsClient, err := components.NewComponentsAPIsClientWithBaseURI(o.Environment.ResourceManager) + if err != nil { + return nil, fmt.Errorf("building Components client: %+v", err) + } + o.Configure(componentsClient.Client, o.Authorizers.ResourceManager) - webTestsClient := insights.NewWebTestsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) - o.ConfigureClient(&webTestsClient.Client, o.ResourceManagerAuthorizer) - webTestsWorkaroundClient := azuresdkhacks.NewWebTestsClient(webTestsClient) + webTestsClient, err := webtests.NewWebTestsAPIsClientWithBaseURI(o.Environment.ResourceManager) + if err != nil { + return nil, fmt.Errorf("building WebTests client: %+v", err) + } + o.Configure(webTestsClient.Client, o.Authorizers.ResourceManager) standardWebTestsClient, err := webtests.NewWebTestsAPIsClientWithBaseURI(o.Environment.ResourceManager) if err != nil { @@ -46,11 +60,17 @@ func NewClient(o *common.ClientOptions) (*Client, error) { } o.Configure(standardWebTestsClient.Client, o.Authorizers.ResourceManager) - billingClient := insights.NewComponentCurrentBillingFeaturesClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) - o.ConfigureClient(&billingClient.Client, o.ResourceManagerAuthorizer) + billingClient, err := billing.NewComponentFeaturesAndPricingAPIsClientWithBaseURI(o.Environment.ResourceManager) + if err != nil { + return nil, fmt.Errorf("building Billing client: %+v", err) + } + o.Configure(billingClient.Client, o.Authorizers.ResourceManager) - smartDetectionRuleClient := insights.NewProactiveDetectionConfigurationsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) - o.ConfigureClient(&smartDetectionRuleClient.Client, o.ResourceManagerAuthorizer) + smartDetectionRuleClient, err := smartdetection.NewComponentProactiveDetectionAPIsClientWithBaseURI(o.Environment.ResourceManager) + if err != nil { + return nil, fmt.Errorf("building SmartDetection client: %+v", err) + } + o.Configure(smartDetectionRuleClient.Client, o.Authorizers.ResourceManager) workbookClient, err := workbooks.NewWorkbooksAPIsClientWithBaseURI(o.Environment.ResourceManager) if err != nil { @@ -65,12 +85,12 @@ func NewClient(o *common.ClientOptions) (*Client, error) { o.Configure(workbookTemplateClient.Client, o.Authorizers.ResourceManager) return &Client{ - AnalyticsItemsClient: &analyticsItemsClient, - APIKeysClient: &apiKeysClient, - ComponentsClient: &componentsClient, - WebTestsClient: &webTestsWorkaroundClient, - BillingClient: &billingClient, - SmartDetectionRuleClient: &smartDetectionRuleClient, + AnalyticsItemsClient: analyticsItemsClient, + APIKeysClient: apiKeysClient, + ComponentsClient: componentsClient, + WebTestsClient: webTestsClient, + BillingClient: billingClient, + SmartDetectionRuleClient: smartDetectionRuleClient, WorkbookClient: workbookClient, WorkbookTemplateClient: workbookTemplateClient, StandardWebTestsClient: standardWebTestsClient, diff --git a/internal/services/applicationinsights/migration/api_key.go b/internal/services/applicationinsights/migration/api_key.go index b11cc8d71125..dc754cba7621 100644 --- a/internal/services/applicationinsights/migration/api_key.go +++ b/internal/services/applicationinsights/migration/api_key.go @@ -7,7 +7,7 @@ import ( "context" "log" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/applicationinsights/parse" + apikeys "github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/componentapikeysapis" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" ) @@ -26,7 +26,7 @@ func (ApiKeyUpgradeV0ToV1) UpgradeFunc() pluginsdk.StateUpgraderFunc { // new: // /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/component1/apiKeys/key1 oldIdRaw := rawState["id"].(string) - id, err := parse.ApiKeyIDInsensitively(oldIdRaw) + id, err := apikeys.ParseApiKeyIDInsensitively(oldIdRaw) if err != nil { return rawState, err } diff --git a/internal/services/applicationinsights/migration/component.go b/internal/services/applicationinsights/migration/component.go index c6ae79d53765..f9c6b3cb741b 100644 --- a/internal/services/applicationinsights/migration/component.go +++ b/internal/services/applicationinsights/migration/component.go @@ -8,7 +8,7 @@ import ( "log" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/applicationinsights/parse" + components "github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-02-02/componentsapis" "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" ) @@ -28,7 +28,7 @@ func (ComponentUpgradeV0ToV1) UpgradeFunc() pluginsdk.StateUpgraderFunc { // new: // /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/component1 oldIdRaw := rawState["id"].(string) - id, err := parse.ComponentIDInsensitively(oldIdRaw) + id, err := components.ParseComponentIDInsensitively(oldIdRaw) if err != nil { return rawState, err } diff --git a/internal/services/applicationinsights/migration/smart_detection_rule.go b/internal/services/applicationinsights/migration/smart_detection_rule_v0_to_v1.go similarity index 100% rename from internal/services/applicationinsights/migration/smart_detection_rule.go rename to internal/services/applicationinsights/migration/smart_detection_rule_v0_to_v1.go diff --git a/internal/services/applicationinsights/migration/smart_detection_rule_test.go b/internal/services/applicationinsights/migration/smart_detection_rule_v0_to_v1_test.go similarity index 72% rename from internal/services/applicationinsights/migration/smart_detection_rule_test.go rename to internal/services/applicationinsights/migration/smart_detection_rule_v0_to_v1_test.go index cd0baa3dc24b..b5f60cf6c39b 100644 --- a/internal/services/applicationinsights/migration/smart_detection_rule_test.go +++ b/internal/services/applicationinsights/migration/smart_detection_rule_v0_to_v1_test.go @@ -7,7 +7,7 @@ import ( "context" "testing" - "github.com/hashicorp/terraform-provider-azurerm/utils" + "github.com/hashicorp/go-azure-helpers/lang/pointer" ) func TestSmartDetectionRuleV0ToV1(t *testing.T) { @@ -21,21 +21,21 @@ func TestSmartDetectionRuleV0ToV1(t *testing.T) { input: map[string]interface{}{ "id": "/subscriptions/12345678-1234-5678-1234-123456789012/resourcegroups/group1/providers/microsoft.insights/components/component1/SmartDetectionRule/rule1", }, - expected: utils.String("/subscriptions/12345678-1234-5678-1234-123456789012/resourceGroups/group1/providers/Microsoft.Insights/components/component1/smartDetectionRule/rule1"), + expected: pointer.To("/subscriptions/12345678-1234-5678-1234-123456789012/resourceGroups/group1/providers/Microsoft.Insights/components/component1/smartDetectionRule/rule1"), }, { name: "old id - mixed case", input: map[string]interface{}{ "id": "/subscriptions/12345678-1234-5678-1234-123456789012/resourcegroups/group1/providers/microsoft.insights/components/component1/SmartDetectionRule/rule1", }, - expected: utils.String("/subscriptions/12345678-1234-5678-1234-123456789012/resourceGroups/group1/providers/Microsoft.Insights/components/component1/smartDetectionRule/rule1"), + expected: pointer.To("/subscriptions/12345678-1234-5678-1234-123456789012/resourceGroups/group1/providers/Microsoft.Insights/components/component1/smartDetectionRule/rule1"), }, { name: "new id", input: map[string]interface{}{ "id": "/subscriptions/12345678-1234-5678-1234-123456789012/resourceGroups/group1/providers/Microsoft.Insights/components/component1/smartDetectionRule/rule1", }, - expected: utils.String("/subscriptions/12345678-1234-5678-1234-123456789012/resourceGroups/group1/providers/Microsoft.Insights/components/component1/smartDetectionRule/rule1"), + expected: pointer.To("/subscriptions/12345678-1234-5678-1234-123456789012/resourceGroups/group1/providers/Microsoft.Insights/components/component1/smartDetectionRule/rule1"), }, } for _, test := range testData { diff --git a/internal/services/applicationinsights/migration/smart_detection_rule_v1_to_v2.go b/internal/services/applicationinsights/migration/smart_detection_rule_v1_to_v2.go new file mode 100644 index 000000000000..f85288261346 --- /dev/null +++ b/internal/services/applicationinsights/migration/smart_detection_rule_v1_to_v2.go @@ -0,0 +1,73 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +package migration + +import ( + "context" + "log" + + smartdetection "github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/componentproactivedetectionapis" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/applicationinsights/parse" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" +) + +var _ pluginsdk.StateUpgrade = SmartDetectionRuleUpgradeV1ToV2{} + +type SmartDetectionRuleUpgradeV1ToV2 struct{} + +func (SmartDetectionRuleUpgradeV1ToV2) Schema() map[string]*pluginsdk.Schema { + return smartDetectionRuleSchemaForV1AndV2() +} + +func (SmartDetectionRuleUpgradeV1ToV2) UpgradeFunc() pluginsdk.StateUpgraderFunc { + return func(ctx context.Context, rawState map[string]interface{}, meta interface{}) (map[string]interface{}, error) { + // old: + // /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components/component1/SmartDetectionRule/rule1 + // new: + // /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/component1/proactiveDetectionConfigs/rule1 + oldIdRaw := rawState["id"].(string) + oldId, err := parse.SmartDetectionRuleIDInsensitively(oldIdRaw) + if err != nil { + return rawState, err + } + + id := smartdetection.NewProactiveDetectionConfigID(oldId.SubscriptionId, oldId.ResourceGroup, oldId.ComponentName, oldId.SmartDetectionRuleName) + + newId := id.ID() + log.Printf("[DEBUG] Updating ID from %q to %q", oldIdRaw, newId) + rawState["id"] = newId + + return rawState, nil + } +} + +func smartDetectionRuleSchemaForV1AndV2() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + }, + + "application_insights_id": { + Type: pluginsdk.TypeString, + Required: true, + }, + + "enabled": { + Type: pluginsdk.TypeBool, + Optional: true, + }, + + "send_emails_to_subscription_owners": { + Type: pluginsdk.TypeBool, + Optional: true, + }, + + "additional_email_recipients": { + Type: pluginsdk.TypeSet, + Optional: true, + Elem: &pluginsdk.Schema{Type: pluginsdk.TypeString}, + }, + } +} diff --git a/internal/services/applicationinsights/migration/smart_detection_rule_v1_to_v2_test.go b/internal/services/applicationinsights/migration/smart_detection_rule_v1_to_v2_test.go new file mode 100644 index 000000000000..42409ab68918 --- /dev/null +++ b/internal/services/applicationinsights/migration/smart_detection_rule_v1_to_v2_test.go @@ -0,0 +1,52 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +package migration + +import ( + "context" + "testing" + + "github.com/hashicorp/go-azure-helpers/lang/pointer" +) + +func TestSmartDetectionRuleV1ToV2(t *testing.T) { + testData := []struct { + name string + input map[string]interface{} + expected *string + }{ + { + name: "old id - mixed case", + input: map[string]interface{}{ + "id": "/subscriptions/12345678-1234-5678-1234-123456789012/resourcegroups/group1/providers/microsoft.insights/components/component1/SmartDetectionRule/rule1", + }, + expected: pointer.To("/subscriptions/12345678-1234-5678-1234-123456789012/resourceGroups/group1/providers/Microsoft.Insights/components/component1/proactiveDetectionConfigs/rule1"), + }, + { + name: "new id", + input: map[string]interface{}{ + "id": "/subscriptions/12345678-1234-5678-1234-123456789012/resourceGroups/group1/providers/Microsoft.Insights/components/component1/smartDetectionRule/rule1", + }, + expected: pointer.To("/subscriptions/12345678-1234-5678-1234-123456789012/resourceGroups/group1/providers/Microsoft.Insights/components/component1/proactiveDetectionConfigs/rule1"), + }, + } + for _, test := range testData { + t.Logf("Testing %q...", test.name) + result, err := SmartDetectionRuleUpgradeV1ToV2{}.UpgradeFunc()(context.TODO(), test.input, nil) + if err != nil && test.expected == nil { + continue + } else { + if err == nil && test.expected == nil { + t.Fatalf("Expected an error but didn't get one") + } else if err != nil && test.expected != nil { + t.Fatalf("Expected no error but got: %+v", err) + } + } + + actualId := result["id"].(string) + if *test.expected != actualId { + t.Fatalf("expected %q but got %q!", *test.expected, actualId) + } + } +} diff --git a/internal/services/applicationinsights/migration/web_test_id.go b/internal/services/applicationinsights/migration/web_test_id.go index 10a1f1170675..07bab0942854 100644 --- a/internal/services/applicationinsights/migration/web_test_id.go +++ b/internal/services/applicationinsights/migration/web_test_id.go @@ -8,7 +8,7 @@ import ( "log" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/applicationinsights/parse" + "github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2022-06-15/webtestsapis" "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" ) @@ -28,7 +28,7 @@ func (WebTestUpgradeV0ToV1) UpgradeFunc() pluginsdk.StateUpgraderFunc { // new: // /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/webTests/test1 oldIdRaw := rawState["id"].(string) - id, err := parse.WebTestIDInsensitively(oldIdRaw) + id, err := webtestsapis.ParseWebTestIDInsensitively(oldIdRaw) if err != nil { return rawState, err } diff --git a/internal/services/applicationinsights/parse/api_key.go b/internal/services/applicationinsights/parse/api_key.go deleted file mode 100644 index ebe90e3d43ca..000000000000 --- a/internal/services/applicationinsights/parse/api_key.go +++ /dev/null @@ -1,134 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 - -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type ApiKeyId struct { - SubscriptionId string - ResourceGroup string - ComponentName string - Name string -} - -func NewApiKeyID(subscriptionId, resourceGroup, componentName, name string) ApiKeyId { - return ApiKeyId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - ComponentName: componentName, - Name: name, - } -} - -func (id ApiKeyId) String() string { - segments := []string{ - fmt.Sprintf("Name %q", id.Name), - fmt.Sprintf("Component Name %q", id.ComponentName), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Api Key", segmentsStr) -} - -func (id ApiKeyId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Insights/components/%s/apiKeys/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.ComponentName, id.Name) -} - -// ApiKeyID parses a ApiKey ID into an ApiKeyId struct -func ApiKeyID(input string) (*ApiKeyId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, fmt.Errorf("parsing %q as an ApiKey ID: %+v", input, err) - } - - resourceId := ApiKeyId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.ComponentName, err = id.PopSegment("components"); err != nil { - return nil, err - } - if resourceId.Name, err = id.PopSegment("apiKeys"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} - -// ApiKeyIDInsensitively parses an ApiKey ID into an ApiKeyId struct, insensitively -// This should only be used to parse an ID for rewriting, the ApiKeyID -// method should be used instead for validation etc. -// -// Whilst this may seem strange, this enables Terraform have consistent casing -// which works around issues in Core, whilst handling broken API responses. -func ApiKeyIDInsensitively(input string) (*ApiKeyId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := ApiKeyId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - // find the correct casing for the 'components' segment - componentsKey := "components" - for key := range id.Path { - if strings.EqualFold(key, componentsKey) { - componentsKey = key - break - } - } - if resourceId.ComponentName, err = id.PopSegment(componentsKey); err != nil { - return nil, err - } - - // find the correct casing for the 'apiKeys' segment - apiKeysKey := "apiKeys" - for key := range id.Path { - if strings.EqualFold(key, apiKeysKey) { - apiKeysKey = key - break - } - } - if resourceId.Name, err = id.PopSegment(apiKeysKey); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/internal/services/applicationinsights/parse/api_key_test.go b/internal/services/applicationinsights/parse/api_key_test.go deleted file mode 100644 index b54af6549ce4..000000000000 --- a/internal/services/applicationinsights/parse/api_key_test.go +++ /dev/null @@ -1,267 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 - -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "testing" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.Id = ApiKeyId{} - -func TestApiKeyIDFormatter(t *testing.T) { - actual := NewApiKeyID("12345678-1234-9876-4563-123456789012", "group1", "component1", "apikey1").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Insights/components/component1/apiKeys/apikey1" - if actual != expected { - t.Fatalf("Expected %q but got %q", expected, actual) - } -} - -func TestApiKeyID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *ApiKeyId - }{ - - { - // empty - Input: "", - Error: true, - }, - - { - // missing SubscriptionId - Input: "/", - Error: true, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Error: true, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Error: true, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Error: true, - }, - - { - // missing ComponentName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Insights/", - Error: true, - }, - - { - // missing value for ComponentName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Insights/components/", - Error: true, - }, - - { - // missing Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Insights/components/component1/", - Error: true, - }, - - { - // missing value for Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Insights/components/component1/apiKeys/", - Error: true, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Insights/components/component1/apiKeys/apikey1", - Expected: &ApiKeyId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroup: "group1", - ComponentName: "component1", - Name: "apikey1", - }, - }, - - { - // upper-cased - Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/GROUP1/PROVIDERS/MICROSOFT.INSIGHTS/COMPONENTS/COMPONENT1/APIKEYS/APIKEY1", - Error: true, - }, - } - - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ApiKeyID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %s", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - if actual.ResourceGroup != v.Expected.ResourceGroup { - t.Fatalf("Expected %q but got %q for ResourceGroup", v.Expected.ResourceGroup, actual.ResourceGroup) - } - if actual.ComponentName != v.Expected.ComponentName { - t.Fatalf("Expected %q but got %q for ComponentName", v.Expected.ComponentName, actual.ComponentName) - } - if actual.Name != v.Expected.Name { - t.Fatalf("Expected %q but got %q for Name", v.Expected.Name, actual.Name) - } - } -} - -func TestApiKeyIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *ApiKeyId - }{ - - { - // empty - Input: "", - Error: true, - }, - - { - // missing SubscriptionId - Input: "/", - Error: true, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Error: true, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Error: true, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Error: true, - }, - - { - // missing ComponentName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Insights/", - Error: true, - }, - - { - // missing value for ComponentName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Insights/components/", - Error: true, - }, - - { - // missing Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Insights/components/component1/", - Error: true, - }, - - { - // missing value for Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Insights/components/component1/apiKeys/", - Error: true, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Insights/components/component1/apiKeys/apikey1", - Expected: &ApiKeyId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroup: "group1", - ComponentName: "component1", - Name: "apikey1", - }, - }, - - { - // lower-cased segment names - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Insights/components/component1/apikeys/apikey1", - Expected: &ApiKeyId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroup: "group1", - ComponentName: "component1", - Name: "apikey1", - }, - }, - - { - // upper-cased segment names - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Insights/COMPONENTS/component1/APIKEYS/apikey1", - Expected: &ApiKeyId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroup: "group1", - ComponentName: "component1", - Name: "apikey1", - }, - }, - - { - // mixed-cased segment names - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Insights/CoMpOnEnTs/component1/ApIkEyS/apikey1", - Expected: &ApiKeyId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroup: "group1", - ComponentName: "component1", - Name: "apikey1", - }, - }, - } - - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ApiKeyIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %s", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - if actual.ResourceGroup != v.Expected.ResourceGroup { - t.Fatalf("Expected %q but got %q for ResourceGroup", v.Expected.ResourceGroup, actual.ResourceGroup) - } - if actual.ComponentName != v.Expected.ComponentName { - t.Fatalf("Expected %q but got %q for ComponentName", v.Expected.ComponentName, actual.ComponentName) - } - if actual.Name != v.Expected.Name { - t.Fatalf("Expected %q but got %q for Name", v.Expected.Name, actual.Name) - } - } -} diff --git a/internal/services/applicationinsights/parse/component.go b/internal/services/applicationinsights/parse/component.go deleted file mode 100644 index 88d365875ada..000000000000 --- a/internal/services/applicationinsights/parse/component.go +++ /dev/null @@ -1,116 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 - -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type ComponentId struct { - SubscriptionId string - ResourceGroup string - Name string -} - -func NewComponentID(subscriptionId, resourceGroup, name string) ComponentId { - return ComponentId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - Name: name, - } -} - -func (id ComponentId) String() string { - segments := []string{ - fmt.Sprintf("Name %q", id.Name), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Component", segmentsStr) -} - -func (id ComponentId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Insights/components/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.Name) -} - -// ComponentID parses a Component ID into an ComponentId struct -func ComponentID(input string) (*ComponentId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, fmt.Errorf("parsing %q as an Component ID: %+v", input, err) - } - - resourceId := ComponentId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.Name, err = id.PopSegment("components"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} - -// ComponentIDInsensitively parses an Component ID into an ComponentId struct, insensitively -// This should only be used to parse an ID for rewriting, the ComponentID -// method should be used instead for validation etc. -// -// Whilst this may seem strange, this enables Terraform have consistent casing -// which works around issues in Core, whilst handling broken API responses. -func ComponentIDInsensitively(input string) (*ComponentId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := ComponentId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - // find the correct casing for the 'components' segment - componentsKey := "components" - for key := range id.Path { - if strings.EqualFold(key, componentsKey) { - componentsKey = key - break - } - } - if resourceId.Name, err = id.PopSegment(componentsKey); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/internal/services/applicationinsights/parse/component_test.go b/internal/services/applicationinsights/parse/component_test.go deleted file mode 100644 index b7f1f74494a2..000000000000 --- a/internal/services/applicationinsights/parse/component_test.go +++ /dev/null @@ -1,232 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 - -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "testing" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.Id = ComponentId{} - -func TestComponentIDFormatter(t *testing.T) { - actual := NewComponentID("12345678-1234-9876-4563-123456789012", "group1", "component1").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Insights/components/component1" - if actual != expected { - t.Fatalf("Expected %q but got %q", expected, actual) - } -} - -func TestComponentID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *ComponentId - }{ - - { - // empty - Input: "", - Error: true, - }, - - { - // missing SubscriptionId - Input: "/", - Error: true, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Error: true, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Error: true, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Error: true, - }, - - { - // missing Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Insights/", - Error: true, - }, - - { - // missing value for Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Insights/components/", - Error: true, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Insights/components/component1", - Expected: &ComponentId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroup: "group1", - Name: "component1", - }, - }, - - { - // upper-cased - Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/GROUP1/PROVIDERS/MICROSOFT.INSIGHTS/COMPONENTS/COMPONENT1", - Error: true, - }, - } - - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ComponentID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %s", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - if actual.ResourceGroup != v.Expected.ResourceGroup { - t.Fatalf("Expected %q but got %q for ResourceGroup", v.Expected.ResourceGroup, actual.ResourceGroup) - } - if actual.Name != v.Expected.Name { - t.Fatalf("Expected %q but got %q for Name", v.Expected.Name, actual.Name) - } - } -} - -func TestComponentIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *ComponentId - }{ - - { - // empty - Input: "", - Error: true, - }, - - { - // missing SubscriptionId - Input: "/", - Error: true, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Error: true, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Error: true, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Error: true, - }, - - { - // missing Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Insights/", - Error: true, - }, - - { - // missing value for Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Insights/components/", - Error: true, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Insights/components/component1", - Expected: &ComponentId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroup: "group1", - Name: "component1", - }, - }, - - { - // lower-cased segment names - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Insights/components/component1", - Expected: &ComponentId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroup: "group1", - Name: "component1", - }, - }, - - { - // upper-cased segment names - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Insights/COMPONENTS/component1", - Expected: &ComponentId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroup: "group1", - Name: "component1", - }, - }, - - { - // mixed-cased segment names - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Insights/CoMpOnEnTs/component1", - Expected: &ComponentId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroup: "group1", - Name: "component1", - }, - }, - } - - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ComponentIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %s", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - if actual.ResourceGroup != v.Expected.ResourceGroup { - t.Fatalf("Expected %q but got %q for ResourceGroup", v.Expected.ResourceGroup, actual.ResourceGroup) - } - if actual.Name != v.Expected.Name { - t.Fatalf("Expected %q but got %q for Name", v.Expected.Name, actual.Name) - } - } -} diff --git a/internal/services/applicationinsights/parse/web_test_id.go b/internal/services/applicationinsights/parse/web_test_id.go deleted file mode 100644 index 7c119beb6b9b..000000000000 --- a/internal/services/applicationinsights/parse/web_test_id.go +++ /dev/null @@ -1,116 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 - -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type WebTestId struct { - SubscriptionId string - ResourceGroup string - Name string -} - -func NewWebTestID(subscriptionId, resourceGroup, name string) WebTestId { - return WebTestId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - Name: name, - } -} - -func (id WebTestId) String() string { - segments := []string{ - fmt.Sprintf("Name %q", id.Name), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Web Test", segmentsStr) -} - -func (id WebTestId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Insights/webTests/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.Name) -} - -// WebTestID parses a WebTest ID into an WebTestId struct -func WebTestID(input string) (*WebTestId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, fmt.Errorf("parsing %q as an WebTest ID: %+v", input, err) - } - - resourceId := WebTestId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.Name, err = id.PopSegment("webTests"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} - -// WebTestIDInsensitively parses an WebTest ID into an WebTestId struct, insensitively -// This should only be used to parse an ID for rewriting, the WebTestID -// method should be used instead for validation etc. -// -// Whilst this may seem strange, this enables Terraform have consistent casing -// which works around issues in Core, whilst handling broken API responses. -func WebTestIDInsensitively(input string) (*WebTestId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := WebTestId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - // find the correct casing for the 'webTests' segment - webTestsKey := "webTests" - for key := range id.Path { - if strings.EqualFold(key, webTestsKey) { - webTestsKey = key - break - } - } - if resourceId.Name, err = id.PopSegment(webTestsKey); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/internal/services/applicationinsights/parse/web_test_id_test.go b/internal/services/applicationinsights/parse/web_test_id_test.go deleted file mode 100644 index 40caf99d6f97..000000000000 --- a/internal/services/applicationinsights/parse/web_test_id_test.go +++ /dev/null @@ -1,232 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 - -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "testing" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.Id = WebTestId{} - -func TestWebTestIDFormatter(t *testing.T) { - actual := NewWebTestID("12345678-1234-9876-4563-123456789012", "group1", "test1").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Insights/webTests/test1" - if actual != expected { - t.Fatalf("Expected %q but got %q", expected, actual) - } -} - -func TestWebTestID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *WebTestId - }{ - - { - // empty - Input: "", - Error: true, - }, - - { - // missing SubscriptionId - Input: "/", - Error: true, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Error: true, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Error: true, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Error: true, - }, - - { - // missing Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Insights/", - Error: true, - }, - - { - // missing value for Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Insights/webTests/", - Error: true, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Insights/webTests/test1", - Expected: &WebTestId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroup: "group1", - Name: "test1", - }, - }, - - { - // upper-cased - Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/GROUP1/PROVIDERS/MICROSOFT.INSIGHTS/WEBTESTS/TEST1", - Error: true, - }, - } - - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := WebTestID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %s", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - if actual.ResourceGroup != v.Expected.ResourceGroup { - t.Fatalf("Expected %q but got %q for ResourceGroup", v.Expected.ResourceGroup, actual.ResourceGroup) - } - if actual.Name != v.Expected.Name { - t.Fatalf("Expected %q but got %q for Name", v.Expected.Name, actual.Name) - } - } -} - -func TestWebTestIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *WebTestId - }{ - - { - // empty - Input: "", - Error: true, - }, - - { - // missing SubscriptionId - Input: "/", - Error: true, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Error: true, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Error: true, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Error: true, - }, - - { - // missing Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Insights/", - Error: true, - }, - - { - // missing value for Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Insights/webTests/", - Error: true, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Insights/webTests/test1", - Expected: &WebTestId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroup: "group1", - Name: "test1", - }, - }, - - { - // lower-cased segment names - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Insights/webtests/test1", - Expected: &WebTestId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroup: "group1", - Name: "test1", - }, - }, - - { - // upper-cased segment names - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Insights/WEBTESTS/test1", - Expected: &WebTestId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroup: "group1", - Name: "test1", - }, - }, - - { - // mixed-cased segment names - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Insights/WeBtEsTs/test1", - Expected: &WebTestId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroup: "group1", - Name: "test1", - }, - }, - } - - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := WebTestIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %s", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - if actual.ResourceGroup != v.Expected.ResourceGroup { - t.Fatalf("Expected %q but got %q for ResourceGroup", v.Expected.ResourceGroup, actual.ResourceGroup) - } - if actual.Name != v.Expected.Name { - t.Fatalf("Expected %q but got %q for Name", v.Expected.Name, actual.Name) - } - } -} diff --git a/internal/services/applicationinsights/resourceids.go b/internal/services/applicationinsights/resourceids.go index d23422e716d5..b440e089f887 100644 --- a/internal/services/applicationinsights/resourceids.go +++ b/internal/services/applicationinsights/resourceids.go @@ -3,9 +3,6 @@ package applicationinsights -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=Component -rewrite=true -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Insights/components/component1 //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=SmartDetectionRule -rewrite=true -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Insights/components/component1/smartDetectionRule/rule1 -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=WebTest -rewrite=true -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Insights/webTests/test1 -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=ApiKey -rewrite=true -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Insights/components/component1/apiKeys/apikey1 //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=AnalyticsUserItem -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Insights/components/component1/myAnalyticsItems/item1 //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=AnalyticsSharedItem -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Insights/components/component1/analyticsItems/item1 diff --git a/internal/services/applicationinsights/validate/api_key_id.go b/internal/services/applicationinsights/validate/api_key_id.go deleted file mode 100644 index 8152aec75dc3..000000000000 --- a/internal/services/applicationinsights/validate/api_key_id.go +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 - -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/applicationinsights/parse" -) - -func ApiKeyID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := parse.ApiKeyID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/internal/services/applicationinsights/validate/api_key_id_test.go b/internal/services/applicationinsights/validate/api_key_id_test.go deleted file mode 100644 index e1d022980268..000000000000 --- a/internal/services/applicationinsights/validate/api_key_id_test.go +++ /dev/null @@ -1,91 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 - -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import "testing" - -func TestApiKeyID(t *testing.T) { - cases := []struct { - Input string - Valid bool - }{ - - { - // empty - Input: "", - Valid: false, - }, - - { - // missing SubscriptionId - Input: "/", - Valid: false, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Valid: false, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Valid: false, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Valid: false, - }, - - { - // missing ComponentName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Insights/", - Valid: false, - }, - - { - // missing value for ComponentName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Insights/components/", - Valid: false, - }, - - { - // missing Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Insights/components/component1/", - Valid: false, - }, - - { - // missing value for Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Insights/components/component1/apiKeys/", - Valid: false, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Insights/components/component1/apiKeys/apikey1", - Valid: true, - }, - - { - // upper-cased - Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/GROUP1/PROVIDERS/MICROSOFT.INSIGHTS/COMPONENTS/COMPONENT1/APIKEYS/APIKEY1", - Valid: false, - }, - } - for _, tc := range cases { - t.Logf("[DEBUG] Testing Value %s", tc.Input) - _, errors := ApiKeyID(tc.Input, "test") - valid := len(errors) == 0 - - if tc.Valid != valid { - t.Fatalf("Expected %t but got %t", tc.Valid, valid) - } - } -} diff --git a/internal/services/applicationinsights/validate/component_id.go b/internal/services/applicationinsights/validate/component_id.go deleted file mode 100644 index 11897b73d703..000000000000 --- a/internal/services/applicationinsights/validate/component_id.go +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 - -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/applicationinsights/parse" -) - -func ComponentID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := parse.ComponentID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/internal/services/applicationinsights/validate/component_id_test.go b/internal/services/applicationinsights/validate/component_id_test.go deleted file mode 100644 index 19c9557720ed..000000000000 --- a/internal/services/applicationinsights/validate/component_id_test.go +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 - -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import "testing" - -func TestComponentID(t *testing.T) { - cases := []struct { - Input string - Valid bool - }{ - - { - // empty - Input: "", - Valid: false, - }, - - { - // missing SubscriptionId - Input: "/", - Valid: false, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Valid: false, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Valid: false, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Valid: false, - }, - - { - // missing Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Insights/", - Valid: false, - }, - - { - // missing value for Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Insights/components/", - Valid: false, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Insights/components/component1", - Valid: true, - }, - - { - // upper-cased - Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/GROUP1/PROVIDERS/MICROSOFT.INSIGHTS/COMPONENTS/COMPONENT1", - Valid: false, - }, - } - for _, tc := range cases { - t.Logf("[DEBUG] Testing Value %s", tc.Input) - _, errors := ComponentID(tc.Input, "test") - valid := len(errors) == 0 - - if tc.Valid != valid { - t.Fatalf("Expected %t but got %t", tc.Valid, valid) - } - } -} diff --git a/internal/services/applicationinsights/validate/web_test_id.go b/internal/services/applicationinsights/validate/web_test_id.go deleted file mode 100644 index e457c3fbd7aa..000000000000 --- a/internal/services/applicationinsights/validate/web_test_id.go +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 - -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/applicationinsights/parse" -) - -func WebTestID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := parse.WebTestID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/internal/services/applicationinsights/validate/web_test_id_test.go b/internal/services/applicationinsights/validate/web_test_id_test.go deleted file mode 100644 index eb55df8f0849..000000000000 --- a/internal/services/applicationinsights/validate/web_test_id_test.go +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 - -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import "testing" - -func TestWebTestID(t *testing.T) { - cases := []struct { - Input string - Valid bool - }{ - - { - // empty - Input: "", - Valid: false, - }, - - { - // missing SubscriptionId - Input: "/", - Valid: false, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Valid: false, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Valid: false, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Valid: false, - }, - - { - // missing Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Insights/", - Valid: false, - }, - - { - // missing value for Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Insights/webTests/", - Valid: false, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Insights/webTests/test1", - Valid: true, - }, - - { - // upper-cased - Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/GROUP1/PROVIDERS/MICROSOFT.INSIGHTS/WEBTESTS/TEST1", - Valid: false, - }, - } - for _, tc := range cases { - t.Logf("[DEBUG] Testing Value %s", tc.Input) - _, errors := WebTestID(tc.Input, "test") - valid := len(errors) == 0 - - if tc.Valid != valid { - t.Fatalf("Expected %t but got %t", tc.Valid, valid) - } - } -} diff --git a/internal/services/machinelearning/machine_learning_workspace_resource.go b/internal/services/machinelearning/machine_learning_workspace_resource.go index ea1f759e723a..9be42b7046b5 100644 --- a/internal/services/machinelearning/machine_learning_workspace_resource.go +++ b/internal/services/machinelearning/machine_learning_workspace_resource.go @@ -14,13 +14,13 @@ import ( "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + components "github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-02-02/componentsapis" "github.com/hashicorp/go-azure-sdk/resource-manager/containerregistry/2021-08-01-preview/registries" "github.com/hashicorp/go-azure-sdk/resource-manager/machinelearningservices/2023-10-01/workspaces" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/features" - appInsightsValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/applicationinsights/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/services/machinelearning/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/suppress" @@ -70,7 +70,7 @@ func resourceMachineLearningWorkspace() *pluginsdk.Resource { Type: pluginsdk.TypeString, Required: true, ForceNew: true, - ValidateFunc: appInsightsValidate.ComponentID, + ValidateFunc: components.ValidateComponentID, // TODO -- remove when issue https://github.com/Azure/azure-rest-api-specs/issues/8323 is addressed DiffSuppressFunc: suppress.CaseDifference, }, diff --git a/internal/services/monitor/monitor_metric_alert_resource.go b/internal/services/monitor/monitor_metric_alert_resource.go index 36b45515a054..6b22a12180fc 100644 --- a/internal/services/monitor/monitor_metric_alert_resource.go +++ b/internal/services/monitor/monitor_metric_alert_resource.go @@ -16,11 +16,12 @@ import ( "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + components "github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-02-02/componentsapis" + webtests "github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2022-06-15/webtestsapis" "github.com/hashicorp/go-azure-sdk/resource-manager/insights/2018-03-01/metricalerts" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/applicationinsights/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/services/monitor/migration" "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" @@ -291,12 +292,12 @@ func resourceMonitorMetricAlert() *pluginsdk.Resource { "web_test_id": { Type: pluginsdk.TypeString, Required: true, - ValidateFunc: validate.WebTestID, + ValidateFunc: webtests.ValidateWebTestID, }, "component_id": { Type: pluginsdk.TypeString, Required: true, - ValidateFunc: validate.ComponentID, + ValidateFunc: components.ValidateComponentID, }, "failed_location_count": { Type: pluginsdk.TypeInt, diff --git a/internal/services/monitor/monitor_private_link_scoped_service_resource.go b/internal/services/monitor/monitor_private_link_scoped_service_resource.go index 003cfcb5fe89..3a1bdbc8a6b4 100644 --- a/internal/services/monitor/monitor_private_link_scoped_service_resource.go +++ b/internal/services/monitor/monitor_private_link_scoped_service_resource.go @@ -10,12 +10,12 @@ import ( "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + components "github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-02-02/componentsapis" "github.com/hashicorp/go-azure-sdk/resource-manager/insights/2019-10-17-preview/privatelinkscopedresources" "github.com/hashicorp/go-azure-sdk/resource-manager/insights/2022-06-01/datacollectionendpoints" "github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - applicationinsightsvalidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/applicationinsights/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/services/monitor/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/suppress" @@ -64,7 +64,7 @@ func resourceMonitorPrivateLinkScopedService() *pluginsdk.Resource { ForceNew: true, DiffSuppressFunc: suppress.CaseDifference, ValidateFunc: validation.Any( - applicationinsightsvalidate.ComponentID, + components.ValidateComponentID, workspaces.ValidateWorkspaceID, datacollectionendpoints.ValidateDataCollectionEndpointID, ), diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/appinsights/mgmt/2020-02-02/insights/CHANGELOG.md b/vendor/github.com/Azure/azure-sdk-for-go/services/appinsights/mgmt/2020-02-02/insights/CHANGELOG.md deleted file mode 100644 index 52911e4cc5e4..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/appinsights/mgmt/2020-02-02/insights/CHANGELOG.md +++ /dev/null @@ -1,2 +0,0 @@ -# Change History - diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/appinsights/mgmt/2020-02-02/insights/_meta.json b/vendor/github.com/Azure/azure-sdk-for-go/services/appinsights/mgmt/2020-02-02/insights/_meta.json deleted file mode 100644 index 45894dd958ff..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/appinsights/mgmt/2020-02-02/insights/_meta.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "commit": "b47572ab2069865484c493a4f679d4e72f8b303d", - "readme": "/_/azure-rest-api-specs/specification/applicationinsights/resource-manager/readme.md", - "tag": "package-2020-02-02", - "use": "@microsoft.azure/autorest.go@2.1.187", - "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-2020-02-02 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION --enum-prefix /_/azure-rest-api-specs/specification/applicationinsights/resource-manager/readme.md", - "additional_properties": { - "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION --enum-prefix" - } -} \ No newline at end of file diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/appinsights/mgmt/2020-02-02/insights/analyticsitems.go b/vendor/github.com/Azure/azure-sdk-for-go/services/appinsights/mgmt/2020-02-02/insights/analyticsitems.go deleted file mode 100644 index 2e08deb5b096..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/appinsights/mgmt/2020-02-02/insights/analyticsitems.go +++ /dev/null @@ -1,429 +0,0 @@ -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/vendor/github.com/Azure/azure-sdk-for-go/services/appinsights/mgmt/2020-02-02/insights/annotations.go b/vendor/github.com/Azure/azure-sdk-for-go/services/appinsights/mgmt/2020-02-02/insights/annotations.go deleted file mode 100644 index aa31fd7d0e74..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/appinsights/mgmt/2020-02-02/insights/annotations.go +++ /dev/null @@ -1,383 +0,0 @@ -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/vendor/github.com/Azure/azure-sdk-for-go/services/appinsights/mgmt/2020-02-02/insights/apikeys.go b/vendor/github.com/Azure/azure-sdk-for-go/services/appinsights/mgmt/2020-02-02/insights/apikeys.go deleted file mode 100644 index ca33d3c4c68d..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/appinsights/mgmt/2020-02-02/insights/apikeys.go +++ /dev/null @@ -1,380 +0,0 @@ -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/vendor/github.com/Azure/azure-sdk-for-go/services/appinsights/mgmt/2020-02-02/insights/client.go b/vendor/github.com/Azure/azure-sdk-for-go/services/appinsights/mgmt/2020-02-02/insights/client.go deleted file mode 100644 index 70491459d21e..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/appinsights/mgmt/2020-02-02/insights/client.go +++ /dev/null @@ -1,43 +0,0 @@ -// Deprecated: Please note, this package has been deprecated. A replacement package is available [github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/applicationinsights/armapplicationinsights](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/applicationinsights/armapplicationinsights). We strongly encourage you to upgrade to continue receiving updates. See [Migration Guide](https://aka.ms/azsdk/golang/t2/migration) for guidance on upgrading. Refer to our [deprecation policy](https://azure.github.io/azure-sdk/policies_support.html) for more details. -// -// 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/vendor/github.com/Azure/azure-sdk-for-go/services/appinsights/mgmt/2020-02-02/insights/componentavailablefeatures.go b/vendor/github.com/Azure/azure-sdk-for-go/services/appinsights/mgmt/2020-02-02/insights/componentavailablefeatures.go deleted file mode 100644 index 997a483b327f..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/appinsights/mgmt/2020-02-02/insights/componentavailablefeatures.go +++ /dev/null @@ -1,118 +0,0 @@ -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/vendor/github.com/Azure/azure-sdk-for-go/services/appinsights/mgmt/2020-02-02/insights/componentcurrentbillingfeatures.go b/vendor/github.com/Azure/azure-sdk-for-go/services/appinsights/mgmt/2020-02-02/insights/componentcurrentbillingfeatures.go deleted file mode 100644 index 3416a616be9c..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/appinsights/mgmt/2020-02-02/insights/componentcurrentbillingfeatures.go +++ /dev/null @@ -1,207 +0,0 @@ -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/vendor/github.com/Azure/azure-sdk-for-go/services/appinsights/mgmt/2020-02-02/insights/componentfeaturecapabilities.go b/vendor/github.com/Azure/azure-sdk-for-go/services/appinsights/mgmt/2020-02-02/insights/componentfeaturecapabilities.go deleted file mode 100644 index 0620681495e8..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/appinsights/mgmt/2020-02-02/insights/componentfeaturecapabilities.go +++ /dev/null @@ -1,118 +0,0 @@ -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/vendor/github.com/Azure/azure-sdk-for-go/services/appinsights/mgmt/2020-02-02/insights/componentquotastatus.go b/vendor/github.com/Azure/azure-sdk-for-go/services/appinsights/mgmt/2020-02-02/insights/componentquotastatus.go deleted file mode 100644 index 98d79dda19cd..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/appinsights/mgmt/2020-02-02/insights/componentquotastatus.go +++ /dev/null @@ -1,118 +0,0 @@ -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/vendor/github.com/Azure/azure-sdk-for-go/services/appinsights/mgmt/2020-02-02/insights/components.go b/vendor/github.com/Azure/azure-sdk-for-go/services/appinsights/mgmt/2020-02-02/insights/components.go deleted file mode 100644 index edd860490ce2..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/appinsights/mgmt/2020-02-02/insights/components.go +++ /dev/null @@ -1,807 +0,0 @@ -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/vendor/github.com/Azure/azure-sdk-for-go/services/appinsights/mgmt/2020-02-02/insights/enums.go b/vendor/github.com/Azure/azure-sdk-for-go/services/appinsights/mgmt/2020-02-02/insights/enums.go deleted file mode 100644 index f1909b5bbfbc..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/appinsights/mgmt/2020-02-02/insights/enums.go +++ /dev/null @@ -1,256 +0,0 @@ -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 ( - // ApplicationTypeOther ... - ApplicationTypeOther ApplicationType = "other" - // ApplicationTypeWeb ... - ApplicationTypeWeb ApplicationType = "web" -) - -// PossibleApplicationTypeValues returns an array of possible values for the ApplicationType const type. -func PossibleApplicationTypeValues() []ApplicationType { - return []ApplicationType{ApplicationTypeOther, ApplicationTypeWeb} -} - -// 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 ( - // FavoriteSourceTypeEvents ... - FavoriteSourceTypeEvents FavoriteSourceType = "events" - // FavoriteSourceTypeFunnel ... - FavoriteSourceTypeFunnel FavoriteSourceType = "funnel" - // FavoriteSourceTypeImpact ... - FavoriteSourceTypeImpact FavoriteSourceType = "impact" - // FavoriteSourceTypeNotebook ... - FavoriteSourceTypeNotebook FavoriteSourceType = "notebook" - // FavoriteSourceTypeRetention ... - FavoriteSourceTypeRetention FavoriteSourceType = "retention" - // FavoriteSourceTypeSegmentation ... - FavoriteSourceTypeSegmentation FavoriteSourceType = "segmentation" - // FavoriteSourceTypeSessions ... - FavoriteSourceTypeSessions FavoriteSourceType = "sessions" - // FavoriteSourceTypeUserflows ... - FavoriteSourceTypeUserflows FavoriteSourceType = "userflows" -) - -// PossibleFavoriteSourceTypeValues returns an array of possible values for the FavoriteSourceType const type. -func PossibleFavoriteSourceTypeValues() []FavoriteSourceType { - return []FavoriteSourceType{FavoriteSourceTypeEvents, FavoriteSourceTypeFunnel, FavoriteSourceTypeImpact, FavoriteSourceTypeNotebook, FavoriteSourceTypeRetention, FavoriteSourceTypeSegmentation, FavoriteSourceTypeSessions, FavoriteSourceTypeUserflows} -} - -// FavoriteType enumerates the values for favorite type. -type FavoriteType string - -const ( - // FavoriteTypeShared ... - FavoriteTypeShared FavoriteType = "shared" - // FavoriteTypeUser ... - FavoriteTypeUser FavoriteType = "user" -) - -// PossibleFavoriteTypeValues returns an array of possible values for the FavoriteType const type. -func PossibleFavoriteTypeValues() []FavoriteType { - return []FavoriteType{FavoriteTypeShared, FavoriteTypeUser} -} - -// FlowType enumerates the values for flow type. -type FlowType string - -const ( - // FlowTypeBluefield ... - FlowTypeBluefield FlowType = "Bluefield" -) - -// PossibleFlowTypeValues returns an array of possible values for the FlowType const type. -func PossibleFlowTypeValues() []FlowType { - return []FlowType{FlowTypeBluefield} -} - -// IngestionMode enumerates the values for ingestion mode. -type IngestionMode string - -const ( - // IngestionModeApplicationInsights ... - IngestionModeApplicationInsights IngestionMode = "ApplicationInsights" - // IngestionModeApplicationInsightsWithDiagnosticSettings ... - IngestionModeApplicationInsightsWithDiagnosticSettings IngestionMode = "ApplicationInsightsWithDiagnosticSettings" - // IngestionModeLogAnalytics ... - IngestionModeLogAnalytics IngestionMode = "LogAnalytics" -) - -// PossibleIngestionModeValues returns an array of possible values for the IngestionMode const type. -func PossibleIngestionModeValues() []IngestionMode { - return []IngestionMode{IngestionModeApplicationInsights, IngestionModeApplicationInsightsWithDiagnosticSettings, IngestionModeLogAnalytics} -} - -// 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 ( - // ItemScopePathAnalyticsItems ... - ItemScopePathAnalyticsItems ItemScopePath = "analyticsItems" - // ItemScopePathMyanalyticsItems ... - ItemScopePathMyanalyticsItems ItemScopePath = "myanalyticsItems" -) - -// PossibleItemScopePathValues returns an array of possible values for the ItemScopePath const type. -func PossibleItemScopePathValues() []ItemScopePath { - return []ItemScopePath{ItemScopePathAnalyticsItems, ItemScopePathMyanalyticsItems} -} - -// ItemType enumerates the values for item type. -type ItemType string - -const ( - // ItemTypeFolder ... - ItemTypeFolder ItemType = "folder" - // ItemTypeFunction ... - ItemTypeFunction ItemType = "function" - // ItemTypeQuery ... - ItemTypeQuery ItemType = "query" - // ItemTypeRecent ... - ItemTypeRecent ItemType = "recent" -) - -// PossibleItemTypeValues returns an array of possible values for the ItemType const type. -func PossibleItemTypeValues() []ItemType { - return []ItemType{ItemTypeFolder, ItemTypeFunction, ItemTypeQuery, ItemTypeRecent} -} - -// 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 ( - // PublicNetworkAccessTypeDisabled Disables public connectivity to Application Insights through public DNS. - PublicNetworkAccessTypeDisabled PublicNetworkAccessType = "Disabled" - // PublicNetworkAccessTypeEnabled Enables connectivity to Application Insights through public DNS. - PublicNetworkAccessTypeEnabled PublicNetworkAccessType = "Enabled" -) - -// PossiblePublicNetworkAccessTypeValues returns an array of possible values for the PublicNetworkAccessType const type. -func PossiblePublicNetworkAccessTypeValues() []PublicNetworkAccessType { - return []PublicNetworkAccessType{PublicNetworkAccessTypeDisabled, PublicNetworkAccessTypeEnabled} -} - -// PurgeState enumerates the values for purge state. -type PurgeState string - -const ( - // PurgeStateCompleted ... - PurgeStateCompleted PurgeState = "completed" - // PurgeStatePending ... - PurgeStatePending PurgeState = "pending" -) - -// PossiblePurgeStateValues returns an array of possible values for the PurgeState const type. -func PossiblePurgeStateValues() []PurgeState { - return []PurgeState{PurgeStateCompleted, PurgeStatePending} -} - -// RequestSource enumerates the values for request source. -type RequestSource string - -const ( - // RequestSourceRest ... - RequestSourceRest RequestSource = "rest" -) - -// PossibleRequestSourceValues returns an array of possible values for the RequestSource const type. -func PossibleRequestSourceValues() []RequestSource { - return []RequestSource{RequestSourceRest} -} - -// 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 ( - // WebTestKindMultistep ... - WebTestKindMultistep WebTestKind = "multistep" - // WebTestKindPing ... - WebTestKindPing WebTestKind = "ping" -) - -// PossibleWebTestKindValues returns an array of possible values for the WebTestKind const type. -func PossibleWebTestKindValues() []WebTestKind { - return []WebTestKind{WebTestKindMultistep, WebTestKindPing} -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/appinsights/mgmt/2020-02-02/insights/exportconfigurations.go b/vendor/github.com/Azure/azure-sdk-for-go/services/appinsights/mgmt/2020-02-02/insights/exportconfigurations.go deleted file mode 100644 index 8543b8d411df..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/appinsights/mgmt/2020-02-02/insights/exportconfigurations.go +++ /dev/null @@ -1,471 +0,0 @@ -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/vendor/github.com/Azure/azure-sdk-for-go/services/appinsights/mgmt/2020-02-02/insights/favorites.go b/vendor/github.com/Azure/azure-sdk-for-go/services/appinsights/mgmt/2020-02-02/insights/favorites.go deleted file mode 100644 index 732fca754804..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/appinsights/mgmt/2020-02-02/insights/favorites.go +++ /dev/null @@ -1,497 +0,0 @@ -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/vendor/github.com/Azure/azure-sdk-for-go/services/appinsights/mgmt/2020-02-02/insights/models.go b/vendor/github.com/Azure/azure-sdk-for-go/services/appinsights/mgmt/2020-02-02/insights/models.go deleted file mode 100644 index b8d4af6e0655..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/appinsights/mgmt/2020-02-02/insights/models.go +++ /dev/null @@ -1,2162 +0,0 @@ -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/appinsights/mgmt/2020-02-02/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: 'ItemTypeQuery', 'ItemTypeFunction', 'ItemTypeFolder', 'ItemTypeRecent' - 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: 'FavoriteTypeShared', 'FavoriteTypeUser' - 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: 'ApplicationTypeWeb', 'ApplicationTypeOther' - 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: 'FlowTypeBluefield' - 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: 'RequestSourceRest' - 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 - 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: 'PublicNetworkAccessTypeEnabled', 'PublicNetworkAccessTypeDisabled' - PublicNetworkAccessForIngestion PublicNetworkAccessType `json:"publicNetworkAccessForIngestion,omitempty"` - // PublicNetworkAccessForQuery - The network access type for accessing Application Insights query. Possible values include: 'PublicNetworkAccessTypeEnabled', 'PublicNetworkAccessTypeDisabled' - PublicNetworkAccessForQuery PublicNetworkAccessType `json:"publicNetworkAccessForQuery,omitempty"` - // IngestionMode - Indicates the flow of the ingestion. Possible values include: 'IngestionModeApplicationInsights', 'IngestionModeApplicationInsightsWithDiagnosticSettings', 'IngestionModeLogAnalytics' - 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.RetentionInDays != nil { - objectMap["RetentionInDays"] = aicp.RetentionInDays - } - 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"` -} - -// 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: 'PurgeStatePending', 'PurgeStateCompleted' - 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) -} - -// 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"` -} - -// 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"` -} - -// 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) -} - -// 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: 'WebTestKindPing', 'WebTestKindMultistep' - 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: 'WebTestKindPing', 'WebTestKindMultistep' - 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/vendor/github.com/Azure/azure-sdk-for-go/services/appinsights/mgmt/2020-02-02/insights/myworkbooks.go b/vendor/github.com/Azure/azure-sdk-for-go/services/appinsights/mgmt/2020-02-02/insights/myworkbooks.go deleted file mode 100644 index 0f11b643e8bc..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/appinsights/mgmt/2020-02-02/insights/myworkbooks.go +++ /dev/null @@ -1,566 +0,0 @@ -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/vendor/github.com/Azure/azure-sdk-for-go/services/appinsights/mgmt/2020-02-02/insights/operations.go b/vendor/github.com/Azure/azure-sdk-for-go/services/appinsights/mgmt/2020-02-02/insights/operations.go deleted file mode 100644 index b7459628872f..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/appinsights/mgmt/2020-02-02/insights/operations.go +++ /dev/null @@ -1,140 +0,0 @@ -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/vendor/github.com/Azure/azure-sdk-for-go/services/appinsights/mgmt/2020-02-02/insights/proactivedetectionconfigurations.go b/vendor/github.com/Azure/azure-sdk-for-go/services/appinsights/mgmt/2020-02-02/insights/proactivedetectionconfigurations.go deleted file mode 100644 index 78223d23395b..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/appinsights/mgmt/2020-02-02/insights/proactivedetectionconfigurations.go +++ /dev/null @@ -1,298 +0,0 @@ -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/vendor/github.com/Azure/azure-sdk-for-go/services/appinsights/mgmt/2020-02-02/insights/version.go b/vendor/github.com/Azure/azure-sdk-for-go/services/appinsights/mgmt/2020-02-02/insights/version.go deleted file mode 100644 index 10d9415d4af7..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/appinsights/mgmt/2020-02-02/insights/version.go +++ /dev/null @@ -1,19 +0,0 @@ -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" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return version.Number -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/appinsights/mgmt/2020-02-02/insights/webtestlocations.go b/vendor/github.com/Azure/azure-sdk-for-go/services/appinsights/mgmt/2020-02-02/insights/webtestlocations.go deleted file mode 100644 index dcb3923ba146..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/appinsights/mgmt/2020-02-02/insights/webtestlocations.go +++ /dev/null @@ -1,118 +0,0 @@ -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/vendor/github.com/Azure/azure-sdk-for-go/services/appinsights/mgmt/2020-02-02/insights/webtests.go b/vendor/github.com/Azure/azure-sdk-for-go/services/appinsights/mgmt/2020-02-02/insights/webtests.go deleted file mode 100644 index cb9450fdee91..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/appinsights/mgmt/2020-02-02/insights/webtests.go +++ /dev/null @@ -1,755 +0,0 @@ -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/vendor/github.com/Azure/azure-sdk-for-go/services/appinsights/mgmt/2020-02-02/insights/workbooks.go b/vendor/github.com/Azure/azure-sdk-for-go/services/appinsights/mgmt/2020-02-02/insights/workbooks.go deleted file mode 100644 index e30bd2ce8bb4..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/appinsights/mgmt/2020-02-02/insights/workbooks.go +++ /dev/null @@ -1,479 +0,0 @@ -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/vendor/github.com/Azure/azure-sdk-for-go/services/appinsights/mgmt/2020-02-02/insights/workitemconfigurations.go b/vendor/github.com/Azure/azure-sdk-for-go/services/appinsights/mgmt/2020-02-02/insights/workitemconfigurations.go deleted file mode 100644 index c46789bddc6e..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/appinsights/mgmt/2020-02-02/insights/workitemconfigurations.go +++ /dev/null @@ -1,559 +0,0 @@ -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 -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/analyticsitemsapis/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/analyticsitemsapis/README.md new file mode 100644 index 000000000000..01549daf64a8 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/analyticsitemsapis/README.md @@ -0,0 +1,89 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/analyticsitemsapis` Documentation + +The `analyticsitemsapis` SDK allows for interaction with the Azure Resource Manager Service `applicationinsights` (API Version `2015-05-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/analyticsitemsapis" +``` + + +### Client Initialization + +```go +client := analyticsitemsapis.NewAnalyticsItemsAPIsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `AnalyticsItemsAPIsClient.AnalyticsItemsDelete` + +```go +ctx := context.TODO() +id := analyticsitemsapis.NewProviderComponentID("12345678-1234-9876-4563-123456789012", "example-resource-group", "componentValue", "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group") + +read, err := client.AnalyticsItemsDelete(ctx, id, analyticsitemsapis.DefaultAnalyticsItemsDeleteOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `AnalyticsItemsAPIsClient.AnalyticsItemsGet` + +```go +ctx := context.TODO() +id := analyticsitemsapis.NewProviderComponentID("12345678-1234-9876-4563-123456789012", "example-resource-group", "componentValue", "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group") + +read, err := client.AnalyticsItemsGet(ctx, id, analyticsitemsapis.DefaultAnalyticsItemsGetOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `AnalyticsItemsAPIsClient.AnalyticsItemsList` + +```go +ctx := context.TODO() +id := analyticsitemsapis.NewProviderComponentID("12345678-1234-9876-4563-123456789012", "example-resource-group", "componentValue", "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group") + +read, err := client.AnalyticsItemsList(ctx, id, analyticsitemsapis.DefaultAnalyticsItemsListOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `AnalyticsItemsAPIsClient.AnalyticsItemsPut` + +```go +ctx := context.TODO() +id := analyticsitemsapis.NewProviderComponentID("12345678-1234-9876-4563-123456789012", "example-resource-group", "componentValue", "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group") + +payload := analyticsitemsapis.ApplicationInsightsComponentAnalyticsItem{ + // ... +} + + +read, err := client.AnalyticsItemsPut(ctx, id, payload, analyticsitemsapis.DefaultAnalyticsItemsPutOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/analyticsitemsapis/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/analyticsitemsapis/client.go new file mode 100644 index 000000000000..ec47b02ec433 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/analyticsitemsapis/client.go @@ -0,0 +1,26 @@ +package analyticsitemsapis + +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AnalyticsItemsAPIsClient struct { + Client *resourcemanager.Client +} + +func NewAnalyticsItemsAPIsClientWithBaseURI(sdkApi sdkEnv.Api) (*AnalyticsItemsAPIsClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "analyticsitemsapis", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating AnalyticsItemsAPIsClient: %+v", err) + } + + return &AnalyticsItemsAPIsClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/analyticsitemsapis/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/analyticsitemsapis/constants.go new file mode 100644 index 000000000000..8f827ba4db0b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/analyticsitemsapis/constants.go @@ -0,0 +1,148 @@ +package analyticsitemsapis + +import ( + "encoding/json" + "fmt" + "strings" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ItemScope string + +const ( + ItemScopeShared ItemScope = "shared" + ItemScopeUser ItemScope = "user" +) + +func PossibleValuesForItemScope() []string { + return []string{ + string(ItemScopeShared), + string(ItemScopeUser), + } +} + +func (s *ItemScope) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseItemScope(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseItemScope(input string) (*ItemScope, error) { + vals := map[string]ItemScope{ + "shared": ItemScopeShared, + "user": ItemScopeUser, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ItemScope(input) + return &out, nil +} + +type ItemType string + +const ( + ItemTypeFunction ItemType = "function" + ItemTypeNone ItemType = "none" + ItemTypeQuery ItemType = "query" + ItemTypeRecent ItemType = "recent" +) + +func PossibleValuesForItemType() []string { + return []string{ + string(ItemTypeFunction), + string(ItemTypeNone), + string(ItemTypeQuery), + string(ItemTypeRecent), + } +} + +func (s *ItemType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseItemType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseItemType(input string) (*ItemType, error) { + vals := map[string]ItemType{ + "function": ItemTypeFunction, + "none": ItemTypeNone, + "query": ItemTypeQuery, + "recent": ItemTypeRecent, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ItemType(input) + return &out, nil +} + +type ItemTypeParameter string + +const ( + ItemTypeParameterFolder ItemTypeParameter = "folder" + ItemTypeParameterFunction ItemTypeParameter = "function" + ItemTypeParameterNone ItemTypeParameter = "none" + ItemTypeParameterQuery ItemTypeParameter = "query" + ItemTypeParameterRecent ItemTypeParameter = "recent" +) + +func PossibleValuesForItemTypeParameter() []string { + return []string{ + string(ItemTypeParameterFolder), + string(ItemTypeParameterFunction), + string(ItemTypeParameterNone), + string(ItemTypeParameterQuery), + string(ItemTypeParameterRecent), + } +} + +func (s *ItemTypeParameter) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseItemTypeParameter(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseItemTypeParameter(input string) (*ItemTypeParameter, error) { + vals := map[string]ItemTypeParameter{ + "folder": ItemTypeParameterFolder, + "function": ItemTypeParameterFunction, + "none": ItemTypeParameterNone, + "query": ItemTypeParameterQuery, + "recent": ItemTypeParameterRecent, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ItemTypeParameter(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/analyticsitemsapis/id_providercomponent.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/analyticsitemsapis/id_providercomponent.go new file mode 100644 index 000000000000..213634672f75 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/analyticsitemsapis/id_providercomponent.go @@ -0,0 +1,133 @@ +package analyticsitemsapis + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = &ProviderComponentId{} + +// ProviderComponentId is a struct representing the Resource ID for a Provider Component +type ProviderComponentId struct { + SubscriptionId string + ResourceGroupName string + ComponentName string + ScopePath string +} + +// NewProviderComponentID returns a new ProviderComponentId struct +func NewProviderComponentID(subscriptionId string, resourceGroupName string, componentName string, scopePath string) ProviderComponentId { + return ProviderComponentId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ComponentName: componentName, + ScopePath: scopePath, + } +} + +// ParseProviderComponentID parses 'input' into a ProviderComponentId +func ParseProviderComponentID(input string) (*ProviderComponentId, error) { + parser := resourceids.NewParserFromResourceIdType(&ProviderComponentId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := ProviderComponentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseProviderComponentIDInsensitively parses 'input' case-insensitively into a ProviderComponentId +// note: this method should only be used for API response data and not user input +func ParseProviderComponentIDInsensitively(input string) (*ProviderComponentId, error) { + parser := resourceids.NewParserFromResourceIdType(&ProviderComponentId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := ProviderComponentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ProviderComponentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) + } + + if id.ComponentName, ok = input.Parsed["componentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "componentName", input) + } + + if id.ScopePath, ok = input.Parsed["scopePath"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scopePath", input) + } + + return nil +} + +// ValidateProviderComponentID checks that 'input' can be parsed as a Provider Component ID +func ValidateProviderComponentID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseProviderComponentID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Provider Component ID +func (id ProviderComponentId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Insights/components/%s/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ComponentName, strings.TrimPrefix(id.ScopePath, "/")) +} + +// Segments returns a slice of Resource ID Segments which comprise this Provider Component ID +func (id ProviderComponentId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftInsights", "Microsoft.Insights", "Microsoft.Insights"), + resourceids.StaticSegment("staticComponents", "components", "components"), + resourceids.UserSpecifiedSegment("componentName", "componentValue"), + resourceids.ScopeSegment("scopePath", "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group"), + } +} + +// String returns a human-readable description of this Provider Component ID +func (id ProviderComponentId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Component Name: %q", id.ComponentName), + fmt.Sprintf("Scope Path: %q", id.ScopePath), + } + return fmt.Sprintf("Provider Component (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/analyticsitemsapis/method_analyticsitemsdelete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/analyticsitemsapis/method_analyticsitemsdelete.go new file mode 100644 index 000000000000..af3a9bfba0f8 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/analyticsitemsapis/method_analyticsitemsdelete.go @@ -0,0 +1,79 @@ +package analyticsitemsapis + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AnalyticsItemsDeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +type AnalyticsItemsDeleteOperationOptions struct { + Id *string + Name *string +} + +func DefaultAnalyticsItemsDeleteOperationOptions() AnalyticsItemsDeleteOperationOptions { + return AnalyticsItemsDeleteOperationOptions{} +} + +func (o AnalyticsItemsDeleteOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o AnalyticsItemsDeleteOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o AnalyticsItemsDeleteOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Id != nil { + out.Append("id", fmt.Sprintf("%v", *o.Id)) + } + if o.Name != nil { + out.Append("name", fmt.Sprintf("%v", *o.Name)) + } + return &out +} + +// AnalyticsItemsDelete ... +func (c AnalyticsItemsAPIsClient) AnalyticsItemsDelete(ctx context.Context, id ProviderComponentId, options AnalyticsItemsDeleteOperationOptions) (result AnalyticsItemsDeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: fmt.Sprintf("%s/item", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/analyticsitemsapis/method_analyticsitemsget.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/analyticsitemsapis/method_analyticsitemsget.go new file mode 100644 index 000000000000..6793d9068e30 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/analyticsitemsapis/method_analyticsitemsget.go @@ -0,0 +1,87 @@ +package analyticsitemsapis + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AnalyticsItemsGetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ApplicationInsightsComponentAnalyticsItem +} + +type AnalyticsItemsGetOperationOptions struct { + Id *string + Name *string +} + +func DefaultAnalyticsItemsGetOperationOptions() AnalyticsItemsGetOperationOptions { + return AnalyticsItemsGetOperationOptions{} +} + +func (o AnalyticsItemsGetOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o AnalyticsItemsGetOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o AnalyticsItemsGetOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Id != nil { + out.Append("id", fmt.Sprintf("%v", *o.Id)) + } + if o.Name != nil { + out.Append("name", fmt.Sprintf("%v", *o.Name)) + } + return &out +} + +// AnalyticsItemsGet ... +func (c AnalyticsItemsAPIsClient) AnalyticsItemsGet(ctx context.Context, id ProviderComponentId, options AnalyticsItemsGetOperationOptions) (result AnalyticsItemsGetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/item", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model ApplicationInsightsComponentAnalyticsItem + result.Model = &model + + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/analyticsitemsapis/method_analyticsitemslist.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/analyticsitemsapis/method_analyticsitemslist.go new file mode 100644 index 000000000000..b45a6d26662e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/analyticsitemsapis/method_analyticsitemslist.go @@ -0,0 +1,91 @@ +package analyticsitemsapis + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AnalyticsItemsListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]ApplicationInsightsComponentAnalyticsItem +} + +type AnalyticsItemsListOperationOptions struct { + IncludeContent *bool + Scope *ItemScope + Type *ItemTypeParameter +} + +func DefaultAnalyticsItemsListOperationOptions() AnalyticsItemsListOperationOptions { + return AnalyticsItemsListOperationOptions{} +} + +func (o AnalyticsItemsListOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o AnalyticsItemsListOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o AnalyticsItemsListOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.IncludeContent != nil { + out.Append("includeContent", fmt.Sprintf("%v", *o.IncludeContent)) + } + if o.Scope != nil { + out.Append("scope", fmt.Sprintf("%v", *o.Scope)) + } + if o.Type != nil { + out.Append("type", fmt.Sprintf("%v", *o.Type)) + } + return &out +} + +// AnalyticsItemsList ... +func (c AnalyticsItemsAPIsClient) AnalyticsItemsList(ctx context.Context, id ProviderComponentId, options AnalyticsItemsListOperationOptions) (result AnalyticsItemsListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model []ApplicationInsightsComponentAnalyticsItem + result.Model = &model + + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/analyticsitemsapis/method_analyticsitemsput.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/analyticsitemsapis/method_analyticsitemsput.go new file mode 100644 index 000000000000..d13f2e550925 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/analyticsitemsapis/method_analyticsitemsput.go @@ -0,0 +1,87 @@ +package analyticsitemsapis + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AnalyticsItemsPutOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ApplicationInsightsComponentAnalyticsItem +} + +type AnalyticsItemsPutOperationOptions struct { + OverrideItem *bool +} + +func DefaultAnalyticsItemsPutOperationOptions() AnalyticsItemsPutOperationOptions { + return AnalyticsItemsPutOperationOptions{} +} + +func (o AnalyticsItemsPutOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o AnalyticsItemsPutOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o AnalyticsItemsPutOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.OverrideItem != nil { + out.Append("overrideItem", fmt.Sprintf("%v", *o.OverrideItem)) + } + return &out +} + +// AnalyticsItemsPut ... +func (c AnalyticsItemsAPIsClient) AnalyticsItemsPut(ctx context.Context, id ProviderComponentId, input ApplicationInsightsComponentAnalyticsItem, options AnalyticsItemsPutOperationOptions) (result AnalyticsItemsPutOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: fmt.Sprintf("%s/item", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model ApplicationInsightsComponentAnalyticsItem + result.Model = &model + + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/analyticsitemsapis/model_applicationinsightscomponentanalyticsitem.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/analyticsitemsapis/model_applicationinsightscomponentanalyticsitem.go new file mode 100644 index 000000000000..852a85cf31d6 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/analyticsitemsapis/model_applicationinsightscomponentanalyticsitem.go @@ -0,0 +1,16 @@ +package analyticsitemsapis + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApplicationInsightsComponentAnalyticsItem struct { + Content *string `json:"Content,omitempty"` + Id *string `json:"Id,omitempty"` + Name *string `json:"Name,omitempty"` + Properties *ApplicationInsightsComponentAnalyticsItemProperties `json:"Properties,omitempty"` + Scope *ItemScope `json:"Scope,omitempty"` + TimeCreated *string `json:"TimeCreated,omitempty"` + TimeModified *string `json:"TimeModified,omitempty"` + Type *ItemType `json:"Type,omitempty"` + Version *string `json:"Version,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/analyticsitemsapis/model_applicationinsightscomponentanalyticsitemproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/analyticsitemsapis/model_applicationinsightscomponentanalyticsitemproperties.go new file mode 100644 index 000000000000..13f857359490 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/analyticsitemsapis/model_applicationinsightscomponentanalyticsitemproperties.go @@ -0,0 +1,8 @@ +package analyticsitemsapis + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApplicationInsightsComponentAnalyticsItemProperties struct { + FunctionAlias *string `json:"functionAlias,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/analyticsitemsapis/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/analyticsitemsapis/version.go new file mode 100644 index 000000000000..0f318bbc6fd9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/analyticsitemsapis/version.go @@ -0,0 +1,12 @@ +package analyticsitemsapis + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2015-05-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/analyticsitemsapis/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/componentapikeysapis/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/componentapikeysapis/README.md new file mode 100644 index 000000000000..94b5fc6568db --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/componentapikeysapis/README.md @@ -0,0 +1,89 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/componentapikeysapis` Documentation + +The `componentapikeysapis` SDK allows for interaction with the Azure Resource Manager Service `applicationinsights` (API Version `2015-05-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/componentapikeysapis" +``` + + +### Client Initialization + +```go +client := componentapikeysapis.NewComponentApiKeysAPIsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `ComponentApiKeysAPIsClient.APIKeysCreate` + +```go +ctx := context.TODO() +id := componentapikeysapis.NewComponentID("12345678-1234-9876-4563-123456789012", "example-resource-group", "componentValue") + +payload := componentapikeysapis.APIKeyRequest{ + // ... +} + + +read, err := client.APIKeysCreate(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ComponentApiKeysAPIsClient.APIKeysDelete` + +```go +ctx := context.TODO() +id := componentapikeysapis.NewApiKeyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "componentValue", "keyIdValue") + +read, err := client.APIKeysDelete(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ComponentApiKeysAPIsClient.APIKeysGet` + +```go +ctx := context.TODO() +id := componentapikeysapis.NewApiKeyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "componentValue", "keyIdValue") + +read, err := client.APIKeysGet(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ComponentApiKeysAPIsClient.APIKeysList` + +```go +ctx := context.TODO() +id := componentapikeysapis.NewComponentID("12345678-1234-9876-4563-123456789012", "example-resource-group", "componentValue") + +read, err := client.APIKeysList(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/componentapikeysapis/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/componentapikeysapis/client.go new file mode 100644 index 000000000000..d9a7ffe194f1 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/componentapikeysapis/client.go @@ -0,0 +1,26 @@ +package componentapikeysapis + +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ComponentApiKeysAPIsClient struct { + Client *resourcemanager.Client +} + +func NewComponentApiKeysAPIsClientWithBaseURI(sdkApi sdkEnv.Api) (*ComponentApiKeysAPIsClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "componentapikeysapis", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating ComponentApiKeysAPIsClient: %+v", err) + } + + return &ComponentApiKeysAPIsClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/componentapikeysapis/id_apikey.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/componentapikeysapis/id_apikey.go new file mode 100644 index 000000000000..09954fd673b7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/componentapikeysapis/id_apikey.go @@ -0,0 +1,134 @@ +package componentapikeysapis + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = &ApiKeyId{} + +// ApiKeyId is a struct representing the Resource ID for a Api Key +type ApiKeyId struct { + SubscriptionId string + ResourceGroupName string + ComponentName string + KeyId string +} + +// NewApiKeyID returns a new ApiKeyId struct +func NewApiKeyID(subscriptionId string, resourceGroupName string, componentName string, keyId string) ApiKeyId { + return ApiKeyId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ComponentName: componentName, + KeyId: keyId, + } +} + +// ParseApiKeyID parses 'input' into a ApiKeyId +func ParseApiKeyID(input string) (*ApiKeyId, error) { + parser := resourceids.NewParserFromResourceIdType(&ApiKeyId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := ApiKeyId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseApiKeyIDInsensitively parses 'input' case-insensitively into a ApiKeyId +// note: this method should only be used for API response data and not user input +func ParseApiKeyIDInsensitively(input string) (*ApiKeyId, error) { + parser := resourceids.NewParserFromResourceIdType(&ApiKeyId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := ApiKeyId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ApiKeyId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) + } + + if id.ComponentName, ok = input.Parsed["componentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "componentName", input) + } + + if id.KeyId, ok = input.Parsed["keyId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "keyId", input) + } + + return nil +} + +// ValidateApiKeyID checks that 'input' can be parsed as a Api Key ID +func ValidateApiKeyID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseApiKeyID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Api Key ID +func (id ApiKeyId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Insights/components/%s/apiKeys/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ComponentName, id.KeyId) +} + +// Segments returns a slice of Resource ID Segments which comprise this Api Key ID +func (id ApiKeyId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftInsights", "Microsoft.Insights", "Microsoft.Insights"), + resourceids.StaticSegment("staticComponents", "components", "components"), + resourceids.UserSpecifiedSegment("componentName", "componentValue"), + resourceids.StaticSegment("staticApiKeys", "apiKeys", "apiKeys"), + resourceids.UserSpecifiedSegment("keyId", "keyIdValue"), + } +} + +// String returns a human-readable description of this Api Key ID +func (id ApiKeyId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Component Name: %q", id.ComponentName), + fmt.Sprintf("Key: %q", id.KeyId), + } + return fmt.Sprintf("Api Key (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/componentapikeysapis/id_component.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/componentapikeysapis/id_component.go new file mode 100644 index 000000000000..4c433878088d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/componentapikeysapis/id_component.go @@ -0,0 +1,125 @@ +package componentapikeysapis + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = &ComponentId{} + +// ComponentId is a struct representing the Resource ID for a Component +type ComponentId struct { + SubscriptionId string + ResourceGroupName string + ComponentName string +} + +// NewComponentID returns a new ComponentId struct +func NewComponentID(subscriptionId string, resourceGroupName string, componentName string) ComponentId { + return ComponentId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ComponentName: componentName, + } +} + +// ParseComponentID parses 'input' into a ComponentId +func ParseComponentID(input string) (*ComponentId, error) { + parser := resourceids.NewParserFromResourceIdType(&ComponentId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := ComponentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseComponentIDInsensitively parses 'input' case-insensitively into a ComponentId +// note: this method should only be used for API response data and not user input +func ParseComponentIDInsensitively(input string) (*ComponentId, error) { + parser := resourceids.NewParserFromResourceIdType(&ComponentId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := ComponentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ComponentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) + } + + if id.ComponentName, ok = input.Parsed["componentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "componentName", input) + } + + return nil +} + +// ValidateComponentID checks that 'input' can be parsed as a Component ID +func ValidateComponentID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseComponentID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Component ID +func (id ComponentId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Insights/components/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ComponentName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Component ID +func (id ComponentId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftInsights", "Microsoft.Insights", "Microsoft.Insights"), + resourceids.StaticSegment("staticComponents", "components", "components"), + resourceids.UserSpecifiedSegment("componentName", "componentValue"), + } +} + +// String returns a human-readable description of this Component ID +func (id ComponentId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Component Name: %q", id.ComponentName), + } + return fmt.Sprintf("Component (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/componentapikeysapis/method_apikeyscreate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/componentapikeysapis/method_apikeyscreate.go new file mode 100644 index 000000000000..62719a7c6d2a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/componentapikeysapis/method_apikeyscreate.go @@ -0,0 +1,59 @@ +package componentapikeysapis + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type APIKeysCreateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ApplicationInsightsComponentAPIKey +} + +// APIKeysCreate ... +func (c ComponentApiKeysAPIsClient) APIKeysCreate(ctx context.Context, id ComponentId, input APIKeyRequest) (result APIKeysCreateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/apiKeys", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model ApplicationInsightsComponentAPIKey + result.Model = &model + + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/componentapikeysapis/method_apikeysdelete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/componentapikeysapis/method_apikeysdelete.go new file mode 100644 index 000000000000..d54a5ccf80ed --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/componentapikeysapis/method_apikeysdelete.go @@ -0,0 +1,54 @@ +package componentapikeysapis + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type APIKeysDeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ApplicationInsightsComponentAPIKey +} + +// APIKeysDelete ... +func (c ComponentApiKeysAPIsClient) APIKeysDelete(ctx context.Context, id ApiKeyId) (result APIKeysDeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model ApplicationInsightsComponentAPIKey + result.Model = &model + + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/componentapikeysapis/method_apikeysget.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/componentapikeysapis/method_apikeysget.go new file mode 100644 index 000000000000..6a5b763060d7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/componentapikeysapis/method_apikeysget.go @@ -0,0 +1,54 @@ +package componentapikeysapis + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type APIKeysGetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ApplicationInsightsComponentAPIKey +} + +// APIKeysGet ... +func (c ComponentApiKeysAPIsClient) APIKeysGet(ctx context.Context, id ApiKeyId) (result APIKeysGetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model ApplicationInsightsComponentAPIKey + result.Model = &model + + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/componentapikeysapis/method_apikeyslist.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/componentapikeysapis/method_apikeyslist.go new file mode 100644 index 000000000000..c71e39f7058e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/componentapikeysapis/method_apikeyslist.go @@ -0,0 +1,55 @@ +package componentapikeysapis + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type APIKeysListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ApplicationInsightsComponentAPIKeyListResult +} + +// APIKeysList ... +func (c ComponentApiKeysAPIsClient) APIKeysList(ctx context.Context, id ComponentId) (result APIKeysListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/apiKeys", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model ApplicationInsightsComponentAPIKeyListResult + result.Model = &model + + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/componentapikeysapis/model_apikeyrequest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/componentapikeysapis/model_apikeyrequest.go new file mode 100644 index 000000000000..9c5e82723b4f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/componentapikeysapis/model_apikeyrequest.go @@ -0,0 +1,10 @@ +package componentapikeysapis + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type APIKeyRequest struct { + LinkedReadProperties *[]string `json:"linkedReadProperties,omitempty"` + LinkedWriteProperties *[]string `json:"linkedWriteProperties,omitempty"` + Name *string `json:"name,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/componentapikeysapis/model_applicationinsightscomponentapikey.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/componentapikeysapis/model_applicationinsightscomponentapikey.go new file mode 100644 index 000000000000..8fa68b3237f3 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/componentapikeysapis/model_applicationinsightscomponentapikey.go @@ -0,0 +1,13 @@ +package componentapikeysapis + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApplicationInsightsComponentAPIKey struct { + ApiKey *string `json:"apiKey,omitempty"` + CreatedDate *string `json:"createdDate,omitempty"` + Id *string `json:"id,omitempty"` + LinkedReadProperties *[]string `json:"linkedReadProperties,omitempty"` + LinkedWriteProperties *[]string `json:"linkedWriteProperties,omitempty"` + Name *string `json:"name,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/componentapikeysapis/model_applicationinsightscomponentapikeylistresult.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/componentapikeysapis/model_applicationinsightscomponentapikeylistresult.go new file mode 100644 index 000000000000..b3a4e57a0309 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/componentapikeysapis/model_applicationinsightscomponentapikeylistresult.go @@ -0,0 +1,8 @@ +package componentapikeysapis + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApplicationInsightsComponentAPIKeyListResult struct { + Value []ApplicationInsightsComponentAPIKey `json:"value"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/componentapikeysapis/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/componentapikeysapis/version.go new file mode 100644 index 000000000000..fe56ab969ace --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/componentapikeysapis/version.go @@ -0,0 +1,12 @@ +package componentapikeysapis + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2015-05-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/componentapikeysapis/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/componentfeaturesandpricingapis/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/componentfeaturesandpricingapis/README.md new file mode 100644 index 000000000000..104de71da4af --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/componentfeaturesandpricingapis/README.md @@ -0,0 +1,105 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/componentfeaturesandpricingapis` Documentation + +The `componentfeaturesandpricingapis` SDK allows for interaction with the Azure Resource Manager Service `applicationinsights` (API Version `2015-05-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/componentfeaturesandpricingapis" +``` + + +### Client Initialization + +```go +client := componentfeaturesandpricingapis.NewComponentFeaturesAndPricingAPIsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `ComponentFeaturesAndPricingAPIsClient.ComponentAvailableFeaturesGet` + +```go +ctx := context.TODO() +id := componentfeaturesandpricingapis.NewComponentID("12345678-1234-9876-4563-123456789012", "example-resource-group", "componentValue") + +read, err := client.ComponentAvailableFeaturesGet(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ComponentFeaturesAndPricingAPIsClient.ComponentCurrentBillingFeaturesGet` + +```go +ctx := context.TODO() +id := componentfeaturesandpricingapis.NewComponentID("12345678-1234-9876-4563-123456789012", "example-resource-group", "componentValue") + +read, err := client.ComponentCurrentBillingFeaturesGet(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ComponentFeaturesAndPricingAPIsClient.ComponentCurrentBillingFeaturesUpdate` + +```go +ctx := context.TODO() +id := componentfeaturesandpricingapis.NewComponentID("12345678-1234-9876-4563-123456789012", "example-resource-group", "componentValue") + +payload := componentfeaturesandpricingapis.ApplicationInsightsComponentBillingFeatures{ + // ... +} + + +read, err := client.ComponentCurrentBillingFeaturesUpdate(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ComponentFeaturesAndPricingAPIsClient.ComponentFeatureCapabilitiesGet` + +```go +ctx := context.TODO() +id := componentfeaturesandpricingapis.NewComponentID("12345678-1234-9876-4563-123456789012", "example-resource-group", "componentValue") + +read, err := client.ComponentFeatureCapabilitiesGet(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ComponentFeaturesAndPricingAPIsClient.ComponentQuotaStatusGet` + +```go +ctx := context.TODO() +id := componentfeaturesandpricingapis.NewComponentID("12345678-1234-9876-4563-123456789012", "example-resource-group", "componentValue") + +read, err := client.ComponentQuotaStatusGet(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/componentfeaturesandpricingapis/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/componentfeaturesandpricingapis/client.go new file mode 100644 index 000000000000..6f0db30a637c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/componentfeaturesandpricingapis/client.go @@ -0,0 +1,26 @@ +package componentfeaturesandpricingapis + +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ComponentFeaturesAndPricingAPIsClient struct { + Client *resourcemanager.Client +} + +func NewComponentFeaturesAndPricingAPIsClientWithBaseURI(sdkApi sdkEnv.Api) (*ComponentFeaturesAndPricingAPIsClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "componentfeaturesandpricingapis", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating ComponentFeaturesAndPricingAPIsClient: %+v", err) + } + + return &ComponentFeaturesAndPricingAPIsClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/componentfeaturesandpricingapis/id_component.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/componentfeaturesandpricingapis/id_component.go new file mode 100644 index 000000000000..e52f76cedc12 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/componentfeaturesandpricingapis/id_component.go @@ -0,0 +1,125 @@ +package componentfeaturesandpricingapis + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = &ComponentId{} + +// ComponentId is a struct representing the Resource ID for a Component +type ComponentId struct { + SubscriptionId string + ResourceGroupName string + ComponentName string +} + +// NewComponentID returns a new ComponentId struct +func NewComponentID(subscriptionId string, resourceGroupName string, componentName string) ComponentId { + return ComponentId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ComponentName: componentName, + } +} + +// ParseComponentID parses 'input' into a ComponentId +func ParseComponentID(input string) (*ComponentId, error) { + parser := resourceids.NewParserFromResourceIdType(&ComponentId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := ComponentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseComponentIDInsensitively parses 'input' case-insensitively into a ComponentId +// note: this method should only be used for API response data and not user input +func ParseComponentIDInsensitively(input string) (*ComponentId, error) { + parser := resourceids.NewParserFromResourceIdType(&ComponentId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := ComponentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ComponentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) + } + + if id.ComponentName, ok = input.Parsed["componentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "componentName", input) + } + + return nil +} + +// ValidateComponentID checks that 'input' can be parsed as a Component ID +func ValidateComponentID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseComponentID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Component ID +func (id ComponentId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Insights/components/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ComponentName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Component ID +func (id ComponentId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftInsights", "Microsoft.Insights", "Microsoft.Insights"), + resourceids.StaticSegment("staticComponents", "components", "components"), + resourceids.UserSpecifiedSegment("componentName", "componentValue"), + } +} + +// String returns a human-readable description of this Component ID +func (id ComponentId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Component Name: %q", id.ComponentName), + } + return fmt.Sprintf("Component (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/componentfeaturesandpricingapis/method_componentavailablefeaturesget.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/componentfeaturesandpricingapis/method_componentavailablefeaturesget.go new file mode 100644 index 000000000000..bd3b23e5848e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/componentfeaturesandpricingapis/method_componentavailablefeaturesget.go @@ -0,0 +1,55 @@ +package componentfeaturesandpricingapis + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ComponentAvailableFeaturesGetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ApplicationInsightsComponentAvailableFeatures +} + +// ComponentAvailableFeaturesGet ... +func (c ComponentFeaturesAndPricingAPIsClient) ComponentAvailableFeaturesGet(ctx context.Context, id ComponentId) (result ComponentAvailableFeaturesGetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/getavailablebillingfeatures", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model ApplicationInsightsComponentAvailableFeatures + result.Model = &model + + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/componentfeaturesandpricingapis/method_componentcurrentbillingfeaturesget.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/componentfeaturesandpricingapis/method_componentcurrentbillingfeaturesget.go new file mode 100644 index 000000000000..853da03268c1 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/componentfeaturesandpricingapis/method_componentcurrentbillingfeaturesget.go @@ -0,0 +1,55 @@ +package componentfeaturesandpricingapis + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ComponentCurrentBillingFeaturesGetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ApplicationInsightsComponentBillingFeatures +} + +// ComponentCurrentBillingFeaturesGet ... +func (c ComponentFeaturesAndPricingAPIsClient) ComponentCurrentBillingFeaturesGet(ctx context.Context, id ComponentId) (result ComponentCurrentBillingFeaturesGetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/currentbillingfeatures", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model ApplicationInsightsComponentBillingFeatures + result.Model = &model + + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/componentfeaturesandpricingapis/method_componentcurrentbillingfeaturesupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/componentfeaturesandpricingapis/method_componentcurrentbillingfeaturesupdate.go new file mode 100644 index 000000000000..c95c2c1bfc84 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/componentfeaturesandpricingapis/method_componentcurrentbillingfeaturesupdate.go @@ -0,0 +1,59 @@ +package componentfeaturesandpricingapis + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ComponentCurrentBillingFeaturesUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ApplicationInsightsComponentBillingFeatures +} + +// ComponentCurrentBillingFeaturesUpdate ... +func (c ComponentFeaturesAndPricingAPIsClient) ComponentCurrentBillingFeaturesUpdate(ctx context.Context, id ComponentId, input ApplicationInsightsComponentBillingFeatures) (result ComponentCurrentBillingFeaturesUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: fmt.Sprintf("%s/currentbillingfeatures", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model ApplicationInsightsComponentBillingFeatures + result.Model = &model + + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/componentfeaturesandpricingapis/method_componentfeaturecapabilitiesget.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/componentfeaturesandpricingapis/method_componentfeaturecapabilitiesget.go new file mode 100644 index 000000000000..ce2fbdfb3864 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/componentfeaturesandpricingapis/method_componentfeaturecapabilitiesget.go @@ -0,0 +1,55 @@ +package componentfeaturesandpricingapis + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ComponentFeatureCapabilitiesGetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ApplicationInsightsComponentFeatureCapabilities +} + +// ComponentFeatureCapabilitiesGet ... +func (c ComponentFeaturesAndPricingAPIsClient) ComponentFeatureCapabilitiesGet(ctx context.Context, id ComponentId) (result ComponentFeatureCapabilitiesGetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/featurecapabilities", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model ApplicationInsightsComponentFeatureCapabilities + result.Model = &model + + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/componentfeaturesandpricingapis/method_componentquotastatusget.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/componentfeaturesandpricingapis/method_componentquotastatusget.go new file mode 100644 index 000000000000..cb0b92f50a00 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/componentfeaturesandpricingapis/method_componentquotastatusget.go @@ -0,0 +1,55 @@ +package componentfeaturesandpricingapis + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ComponentQuotaStatusGetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ApplicationInsightsComponentQuotaStatus +} + +// ComponentQuotaStatusGet ... +func (c ComponentFeaturesAndPricingAPIsClient) ComponentQuotaStatusGet(ctx context.Context, id ComponentId) (result ComponentQuotaStatusGetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/quotastatus", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model ApplicationInsightsComponentQuotaStatus + result.Model = &model + + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/componentfeaturesandpricingapis/model_applicationinsightscomponentavailablefeatures.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/componentfeaturesandpricingapis/model_applicationinsightscomponentavailablefeatures.go new file mode 100644 index 000000000000..4537fb81fbbe --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/componentfeaturesandpricingapis/model_applicationinsightscomponentavailablefeatures.go @@ -0,0 +1,8 @@ +package componentfeaturesandpricingapis + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApplicationInsightsComponentAvailableFeatures struct { + Result *[]ApplicationInsightsComponentFeature `json:"Result,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/componentfeaturesandpricingapis/model_applicationinsightscomponentbillingfeatures.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/componentfeaturesandpricingapis/model_applicationinsightscomponentbillingfeatures.go new file mode 100644 index 000000000000..ecc5e02cce82 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/componentfeaturesandpricingapis/model_applicationinsightscomponentbillingfeatures.go @@ -0,0 +1,9 @@ +package componentfeaturesandpricingapis + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApplicationInsightsComponentBillingFeatures struct { + CurrentBillingFeatures *[]string `json:"CurrentBillingFeatures,omitempty"` + DataVolumeCap *ApplicationInsightsComponentDataVolumeCap `json:"DataVolumeCap,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/componentfeaturesandpricingapis/model_applicationinsightscomponentdatavolumecap.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/componentfeaturesandpricingapis/model_applicationinsightscomponentdatavolumecap.go new file mode 100644 index 000000000000..80ce287249e5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/componentfeaturesandpricingapis/model_applicationinsightscomponentdatavolumecap.go @@ -0,0 +1,13 @@ +package componentfeaturesandpricingapis + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApplicationInsightsComponentDataVolumeCap struct { + Cap *float64 `json:"Cap,omitempty"` + MaxHistoryCap *float64 `json:"MaxHistoryCap,omitempty"` + ResetTime *int64 `json:"ResetTime,omitempty"` + StopSendNotificationWhenHitCap *bool `json:"StopSendNotificationWhenHitCap,omitempty"` + StopSendNotificationWhenHitThreshold *bool `json:"StopSendNotificationWhenHitThreshold,omitempty"` + WarningThreshold *int64 `json:"WarningThreshold,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/componentfeaturesandpricingapis/model_applicationinsightscomponentfeature.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/componentfeaturesandpricingapis/model_applicationinsightscomponentfeature.go new file mode 100644 index 000000000000..8bf8c8adc523 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/componentfeaturesandpricingapis/model_applicationinsightscomponentfeature.go @@ -0,0 +1,16 @@ +package componentfeaturesandpricingapis + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApplicationInsightsComponentFeature struct { + Capabilities *[]ApplicationInsightsComponentFeatureCapability `json:"Capabilities,omitempty"` + FeatureName *string `json:"FeatureName,omitempty"` + IsHidden *bool `json:"IsHidden,omitempty"` + IsMainFeature *bool `json:"IsMainFeature,omitempty"` + MeterId *string `json:"MeterId,omitempty"` + MeterRateFrequency *string `json:"MeterRateFrequency,omitempty"` + ResouceId *string `json:"ResouceId,omitempty"` + SupportedAddonFeatures *string `json:"SupportedAddonFeatures,omitempty"` + Title *string `json:"Title,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/componentfeaturesandpricingapis/model_applicationinsightscomponentfeaturecapabilities.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/componentfeaturesandpricingapis/model_applicationinsightscomponentfeaturecapabilities.go new file mode 100644 index 000000000000..4c7c32cffc5e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/componentfeaturesandpricingapis/model_applicationinsightscomponentfeaturecapabilities.go @@ -0,0 +1,23 @@ +package componentfeaturesandpricingapis + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApplicationInsightsComponentFeatureCapabilities struct { + AnalyticsIntegration *bool `json:"AnalyticsIntegration,omitempty"` + ApiAccessLevel *string `json:"ApiAccessLevel,omitempty"` + ApplicationMap *bool `json:"ApplicationMap,omitempty"` + BurstThrottlePolicy *string `json:"BurstThrottlePolicy,omitempty"` + DailyCap *float64 `json:"DailyCap,omitempty"` + DailyCapResetTime *float64 `json:"DailyCapResetTime,omitempty"` + LiveStreamMetrics *bool `json:"LiveStreamMetrics,omitempty"` + MetadataClass *string `json:"MetadataClass,omitempty"` + MultipleStepWebTest *bool `json:"MultipleStepWebTest,omitempty"` + OpenSchema *bool `json:"OpenSchema,omitempty"` + PowerBIIntegration *bool `json:"PowerBIIntegration,omitempty"` + ProactiveDetection *bool `json:"ProactiveDetection,omitempty"` + SupportExportData *bool `json:"SupportExportData,omitempty"` + ThrottleRate *float64 `json:"ThrottleRate,omitempty"` + TrackingType *string `json:"TrackingType,omitempty"` + WorkItemIntegration *bool `json:"WorkItemIntegration,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/componentfeaturesandpricingapis/model_applicationinsightscomponentfeaturecapability.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/componentfeaturesandpricingapis/model_applicationinsightscomponentfeaturecapability.go new file mode 100644 index 000000000000..519499dd4e53 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/componentfeaturesandpricingapis/model_applicationinsightscomponentfeaturecapability.go @@ -0,0 +1,13 @@ +package componentfeaturesandpricingapis + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApplicationInsightsComponentFeatureCapability struct { + Description *string `json:"Description,omitempty"` + MeterId *string `json:"MeterId,omitempty"` + MeterRateFrequency *string `json:"MeterRateFrequency,omitempty"` + Name *string `json:"Name,omitempty"` + Unit *string `json:"Unit,omitempty"` + Value *string `json:"Value,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/componentfeaturesandpricingapis/model_applicationinsightscomponentquotastatus.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/componentfeaturesandpricingapis/model_applicationinsightscomponentquotastatus.go new file mode 100644 index 000000000000..04a08cab97bb --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/componentfeaturesandpricingapis/model_applicationinsightscomponentquotastatus.go @@ -0,0 +1,10 @@ +package componentfeaturesandpricingapis + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApplicationInsightsComponentQuotaStatus struct { + AppId *string `json:"AppId,omitempty"` + ExpirationTime *string `json:"ExpirationTime,omitempty"` + ShouldBeThrottled *bool `json:"ShouldBeThrottled,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/componentfeaturesandpricingapis/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/componentfeaturesandpricingapis/version.go new file mode 100644 index 000000000000..75a93f50b457 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/componentfeaturesandpricingapis/version.go @@ -0,0 +1,12 @@ +package componentfeaturesandpricingapis + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2015-05-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/componentfeaturesandpricingapis/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/componentproactivedetectionapis/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/componentproactivedetectionapis/README.md new file mode 100644 index 000000000000..cb31060c18d2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/componentproactivedetectionapis/README.md @@ -0,0 +1,73 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/componentproactivedetectionapis` Documentation + +The `componentproactivedetectionapis` SDK allows for interaction with the Azure Resource Manager Service `applicationinsights` (API Version `2015-05-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/componentproactivedetectionapis" +``` + + +### Client Initialization + +```go +client := componentproactivedetectionapis.NewComponentProactiveDetectionAPIsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `ComponentProactiveDetectionAPIsClient.ProactiveDetectionConfigurationsGet` + +```go +ctx := context.TODO() +id := componentproactivedetectionapis.NewProactiveDetectionConfigID("12345678-1234-9876-4563-123456789012", "example-resource-group", "componentValue", "configurationIdValue") + +read, err := client.ProactiveDetectionConfigurationsGet(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ComponentProactiveDetectionAPIsClient.ProactiveDetectionConfigurationsList` + +```go +ctx := context.TODO() +id := componentproactivedetectionapis.NewComponentID("12345678-1234-9876-4563-123456789012", "example-resource-group", "componentValue") + +read, err := client.ProactiveDetectionConfigurationsList(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ComponentProactiveDetectionAPIsClient.ProactiveDetectionConfigurationsUpdate` + +```go +ctx := context.TODO() +id := componentproactivedetectionapis.NewProactiveDetectionConfigID("12345678-1234-9876-4563-123456789012", "example-resource-group", "componentValue", "configurationIdValue") + +payload := componentproactivedetectionapis.ApplicationInsightsComponentProactiveDetectionConfiguration{ + // ... +} + + +read, err := client.ProactiveDetectionConfigurationsUpdate(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/componentproactivedetectionapis/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/componentproactivedetectionapis/client.go new file mode 100644 index 000000000000..231679061b03 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/componentproactivedetectionapis/client.go @@ -0,0 +1,26 @@ +package componentproactivedetectionapis + +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ComponentProactiveDetectionAPIsClient struct { + Client *resourcemanager.Client +} + +func NewComponentProactiveDetectionAPIsClientWithBaseURI(sdkApi sdkEnv.Api) (*ComponentProactiveDetectionAPIsClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "componentproactivedetectionapis", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating ComponentProactiveDetectionAPIsClient: %+v", err) + } + + return &ComponentProactiveDetectionAPIsClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/componentproactivedetectionapis/id_component.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/componentproactivedetectionapis/id_component.go new file mode 100644 index 000000000000..0a25644c4018 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/componentproactivedetectionapis/id_component.go @@ -0,0 +1,125 @@ +package componentproactivedetectionapis + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = &ComponentId{} + +// ComponentId is a struct representing the Resource ID for a Component +type ComponentId struct { + SubscriptionId string + ResourceGroupName string + ComponentName string +} + +// NewComponentID returns a new ComponentId struct +func NewComponentID(subscriptionId string, resourceGroupName string, componentName string) ComponentId { + return ComponentId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ComponentName: componentName, + } +} + +// ParseComponentID parses 'input' into a ComponentId +func ParseComponentID(input string) (*ComponentId, error) { + parser := resourceids.NewParserFromResourceIdType(&ComponentId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := ComponentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseComponentIDInsensitively parses 'input' case-insensitively into a ComponentId +// note: this method should only be used for API response data and not user input +func ParseComponentIDInsensitively(input string) (*ComponentId, error) { + parser := resourceids.NewParserFromResourceIdType(&ComponentId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := ComponentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ComponentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) + } + + if id.ComponentName, ok = input.Parsed["componentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "componentName", input) + } + + return nil +} + +// ValidateComponentID checks that 'input' can be parsed as a Component ID +func ValidateComponentID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseComponentID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Component ID +func (id ComponentId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Insights/components/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ComponentName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Component ID +func (id ComponentId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftInsights", "Microsoft.Insights", "Microsoft.Insights"), + resourceids.StaticSegment("staticComponents", "components", "components"), + resourceids.UserSpecifiedSegment("componentName", "componentValue"), + } +} + +// String returns a human-readable description of this Component ID +func (id ComponentId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Component Name: %q", id.ComponentName), + } + return fmt.Sprintf("Component (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/componentproactivedetectionapis/id_proactivedetectionconfig.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/componentproactivedetectionapis/id_proactivedetectionconfig.go new file mode 100644 index 000000000000..b8f615a0038b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/componentproactivedetectionapis/id_proactivedetectionconfig.go @@ -0,0 +1,134 @@ +package componentproactivedetectionapis + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = &ProactiveDetectionConfigId{} + +// ProactiveDetectionConfigId is a struct representing the Resource ID for a Proactive Detection Config +type ProactiveDetectionConfigId struct { + SubscriptionId string + ResourceGroupName string + ComponentName string + ConfigurationId string +} + +// NewProactiveDetectionConfigID returns a new ProactiveDetectionConfigId struct +func NewProactiveDetectionConfigID(subscriptionId string, resourceGroupName string, componentName string, configurationId string) ProactiveDetectionConfigId { + return ProactiveDetectionConfigId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ComponentName: componentName, + ConfigurationId: configurationId, + } +} + +// ParseProactiveDetectionConfigID parses 'input' into a ProactiveDetectionConfigId +func ParseProactiveDetectionConfigID(input string) (*ProactiveDetectionConfigId, error) { + parser := resourceids.NewParserFromResourceIdType(&ProactiveDetectionConfigId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := ProactiveDetectionConfigId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseProactiveDetectionConfigIDInsensitively parses 'input' case-insensitively into a ProactiveDetectionConfigId +// note: this method should only be used for API response data and not user input +func ParseProactiveDetectionConfigIDInsensitively(input string) (*ProactiveDetectionConfigId, error) { + parser := resourceids.NewParserFromResourceIdType(&ProactiveDetectionConfigId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := ProactiveDetectionConfigId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ProactiveDetectionConfigId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) + } + + if id.ComponentName, ok = input.Parsed["componentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "componentName", input) + } + + if id.ConfigurationId, ok = input.Parsed["configurationId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "configurationId", input) + } + + return nil +} + +// ValidateProactiveDetectionConfigID checks that 'input' can be parsed as a Proactive Detection Config ID +func ValidateProactiveDetectionConfigID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseProactiveDetectionConfigID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Proactive Detection Config ID +func (id ProactiveDetectionConfigId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Insights/components/%s/proactiveDetectionConfigs/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ComponentName, id.ConfigurationId) +} + +// Segments returns a slice of Resource ID Segments which comprise this Proactive Detection Config ID +func (id ProactiveDetectionConfigId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftInsights", "Microsoft.Insights", "Microsoft.Insights"), + resourceids.StaticSegment("staticComponents", "components", "components"), + resourceids.UserSpecifiedSegment("componentName", "componentValue"), + resourceids.StaticSegment("staticProactiveDetectionConfigs", "proactiveDetectionConfigs", "proactiveDetectionConfigs"), + resourceids.UserSpecifiedSegment("configurationId", "configurationIdValue"), + } +} + +// String returns a human-readable description of this Proactive Detection Config ID +func (id ProactiveDetectionConfigId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Component Name: %q", id.ComponentName), + fmt.Sprintf("Configuration: %q", id.ConfigurationId), + } + return fmt.Sprintf("Proactive Detection Config (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/componentproactivedetectionapis/method_proactivedetectionconfigurationsget.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/componentproactivedetectionapis/method_proactivedetectionconfigurationsget.go new file mode 100644 index 000000000000..68954d274515 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/componentproactivedetectionapis/method_proactivedetectionconfigurationsget.go @@ -0,0 +1,54 @@ +package componentproactivedetectionapis + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ProactiveDetectionConfigurationsGetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ApplicationInsightsComponentProactiveDetectionConfiguration +} + +// ProactiveDetectionConfigurationsGet ... +func (c ComponentProactiveDetectionAPIsClient) ProactiveDetectionConfigurationsGet(ctx context.Context, id ProactiveDetectionConfigId) (result ProactiveDetectionConfigurationsGetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model ApplicationInsightsComponentProactiveDetectionConfiguration + result.Model = &model + + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/componentproactivedetectionapis/method_proactivedetectionconfigurationslist.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/componentproactivedetectionapis/method_proactivedetectionconfigurationslist.go new file mode 100644 index 000000000000..fc7540872409 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/componentproactivedetectionapis/method_proactivedetectionconfigurationslist.go @@ -0,0 +1,55 @@ +package componentproactivedetectionapis + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ProactiveDetectionConfigurationsListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]ApplicationInsightsComponentProactiveDetectionConfiguration +} + +// ProactiveDetectionConfigurationsList ... +func (c ComponentProactiveDetectionAPIsClient) ProactiveDetectionConfigurationsList(ctx context.Context, id ComponentId) (result ProactiveDetectionConfigurationsListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/proactiveDetectionConfigs", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model []ApplicationInsightsComponentProactiveDetectionConfiguration + result.Model = &model + + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/componentproactivedetectionapis/method_proactivedetectionconfigurationsupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/componentproactivedetectionapis/method_proactivedetectionconfigurationsupdate.go new file mode 100644 index 000000000000..245415d073dd --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/componentproactivedetectionapis/method_proactivedetectionconfigurationsupdate.go @@ -0,0 +1,58 @@ +package componentproactivedetectionapis + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ProactiveDetectionConfigurationsUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ApplicationInsightsComponentProactiveDetectionConfiguration +} + +// ProactiveDetectionConfigurationsUpdate ... +func (c ComponentProactiveDetectionAPIsClient) ProactiveDetectionConfigurationsUpdate(ctx context.Context, id ProactiveDetectionConfigId, input ApplicationInsightsComponentProactiveDetectionConfiguration) (result ProactiveDetectionConfigurationsUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model ApplicationInsightsComponentProactiveDetectionConfiguration + result.Model = &model + + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/componentproactivedetectionapis/model_applicationinsightscomponentproactivedetectionconfiguration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/componentproactivedetectionapis/model_applicationinsightscomponentproactivedetectionconfiguration.go new file mode 100644 index 000000000000..bfcdc6019377 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/componentproactivedetectionapis/model_applicationinsightscomponentproactivedetectionconfiguration.go @@ -0,0 +1,13 @@ +package componentproactivedetectionapis + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApplicationInsightsComponentProactiveDetectionConfiguration struct { + CustomEmails *[]string `json:"CustomEmails,omitempty"` + Enabled *bool `json:"Enabled,omitempty"` + LastUpdatedTime *string `json:"LastUpdatedTime,omitempty"` + Name *string `json:"Name,omitempty"` + RuleDefinitions *ApplicationInsightsComponentProactiveDetectionConfigurationRuleDefinitions `json:"RuleDefinitions,omitempty"` + SendEmailsToSubscriptionOwners *bool `json:"SendEmailsToSubscriptionOwners,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/componentproactivedetectionapis/model_applicationinsightscomponentproactivedetectionconfigurationruledefinitions.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/componentproactivedetectionapis/model_applicationinsightscomponentproactivedetectionconfigurationruledefinitions.go new file mode 100644 index 000000000000..b9e655a767d2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/componentproactivedetectionapis/model_applicationinsightscomponentproactivedetectionconfigurationruledefinitions.go @@ -0,0 +1,15 @@ +package componentproactivedetectionapis + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApplicationInsightsComponentProactiveDetectionConfigurationRuleDefinitions struct { + Description *string `json:"Description,omitempty"` + DisplayName *string `json:"DisplayName,omitempty"` + HelpUrl *string `json:"HelpUrl,omitempty"` + IsEnabledByDefault *bool `json:"IsEnabledByDefault,omitempty"` + IsHidden *bool `json:"IsHidden,omitempty"` + IsInPreview *bool `json:"IsInPreview,omitempty"` + Name *string `json:"Name,omitempty"` + SupportsEmailNotifications *bool `json:"SupportsEmailNotifications,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/componentproactivedetectionapis/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/componentproactivedetectionapis/version.go new file mode 100644 index 000000000000..01ef8a89c612 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/componentproactivedetectionapis/version.go @@ -0,0 +1,12 @@ +package componentproactivedetectionapis + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2015-05-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/componentproactivedetectionapis/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-02-02/componentsapis/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-02-02/componentsapis/README.md new file mode 100644 index 000000000000..39f9fa5483cb --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-02-02/componentsapis/README.md @@ -0,0 +1,166 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-02-02/componentsapis` Documentation + +The `componentsapis` SDK allows for interaction with the Azure Resource Manager Service `applicationinsights` (API Version `2020-02-02`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +import "github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-02-02/componentsapis" +``` + + +### Client Initialization + +```go +client := componentsapis.NewComponentsAPIsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `ComponentsAPIsClient.ComponentsCreateOrUpdate` + +```go +ctx := context.TODO() +id := componentsapis.NewComponentID("12345678-1234-9876-4563-123456789012", "example-resource-group", "componentValue") + +payload := componentsapis.ApplicationInsightsComponent{ + // ... +} + + +read, err := client.ComponentsCreateOrUpdate(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ComponentsAPIsClient.ComponentsDelete` + +```go +ctx := context.TODO() +id := componentsapis.NewComponentID("12345678-1234-9876-4563-123456789012", "example-resource-group", "componentValue") + +read, err := client.ComponentsDelete(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ComponentsAPIsClient.ComponentsGet` + +```go +ctx := context.TODO() +id := componentsapis.NewComponentID("12345678-1234-9876-4563-123456789012", "example-resource-group", "componentValue") + +read, err := client.ComponentsGet(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ComponentsAPIsClient.ComponentsGetPurgeStatus` + +```go +ctx := context.TODO() +id := componentsapis.NewOperationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "componentValue", "purgeIdValue") + +read, err := client.ComponentsGetPurgeStatus(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ComponentsAPIsClient.ComponentsList` + +```go +ctx := context.TODO() +id := commonids.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +// alternatively `client.ComponentsList(ctx, id)` can be used to do batched pagination +items, err := client.ComponentsListComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `ComponentsAPIsClient.ComponentsListByResourceGroup` + +```go +ctx := context.TODO() +id := commonids.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") + +// alternatively `client.ComponentsListByResourceGroup(ctx, id)` can be used to do batched pagination +items, err := client.ComponentsListByResourceGroupComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `ComponentsAPIsClient.ComponentsPurge` + +```go +ctx := context.TODO() +id := componentsapis.NewComponentID("12345678-1234-9876-4563-123456789012", "example-resource-group", "componentValue") + +payload := componentsapis.ComponentPurgeBody{ + // ... +} + + +read, err := client.ComponentsPurge(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ComponentsAPIsClient.ComponentsUpdateTags` + +```go +ctx := context.TODO() +id := componentsapis.NewComponentID("12345678-1234-9876-4563-123456789012", "example-resource-group", "componentValue") + +payload := componentsapis.TagsResource{ + // ... +} + + +read, err := client.ComponentsUpdateTags(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-02-02/componentsapis/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-02-02/componentsapis/client.go new file mode 100644 index 000000000000..147a71cc0e12 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-02-02/componentsapis/client.go @@ -0,0 +1,26 @@ +package componentsapis + +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ComponentsAPIsClient struct { + Client *resourcemanager.Client +} + +func NewComponentsAPIsClientWithBaseURI(sdkApi sdkEnv.Api) (*ComponentsAPIsClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "componentsapis", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating ComponentsAPIsClient: %+v", err) + } + + return &ComponentsAPIsClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-02-02/componentsapis/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-02-02/componentsapis/constants.go new file mode 100644 index 000000000000..86f6c6c1f0ab --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-02-02/componentsapis/constants.go @@ -0,0 +1,253 @@ +package componentsapis + +import ( + "encoding/json" + "fmt" + "strings" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApplicationType string + +const ( + ApplicationTypeOther ApplicationType = "other" + ApplicationTypeWeb ApplicationType = "web" +) + +func PossibleValuesForApplicationType() []string { + return []string{ + string(ApplicationTypeOther), + string(ApplicationTypeWeb), + } +} + +func (s *ApplicationType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseApplicationType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseApplicationType(input string) (*ApplicationType, error) { + vals := map[string]ApplicationType{ + "other": ApplicationTypeOther, + "web": ApplicationTypeWeb, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ApplicationType(input) + return &out, nil +} + +type FlowType string + +const ( + FlowTypeBluefield FlowType = "Bluefield" +) + +func PossibleValuesForFlowType() []string { + return []string{ + string(FlowTypeBluefield), + } +} + +func (s *FlowType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseFlowType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseFlowType(input string) (*FlowType, error) { + vals := map[string]FlowType{ + "bluefield": FlowTypeBluefield, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := FlowType(input) + return &out, nil +} + +type IngestionMode string + +const ( + IngestionModeApplicationInsights IngestionMode = "ApplicationInsights" + IngestionModeApplicationInsightsWithDiagnosticSettings IngestionMode = "ApplicationInsightsWithDiagnosticSettings" + IngestionModeLogAnalytics IngestionMode = "LogAnalytics" +) + +func PossibleValuesForIngestionMode() []string { + return []string{ + string(IngestionModeApplicationInsights), + string(IngestionModeApplicationInsightsWithDiagnosticSettings), + string(IngestionModeLogAnalytics), + } +} + +func (s *IngestionMode) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseIngestionMode(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseIngestionMode(input string) (*IngestionMode, error) { + vals := map[string]IngestionMode{ + "applicationinsights": IngestionModeApplicationInsights, + "applicationinsightswithdiagnosticsettings": IngestionModeApplicationInsightsWithDiagnosticSettings, + "loganalytics": IngestionModeLogAnalytics, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := IngestionMode(input) + return &out, nil +} + +type PublicNetworkAccessType string + +const ( + PublicNetworkAccessTypeDisabled PublicNetworkAccessType = "Disabled" + PublicNetworkAccessTypeEnabled PublicNetworkAccessType = "Enabled" +) + +func PossibleValuesForPublicNetworkAccessType() []string { + return []string{ + string(PublicNetworkAccessTypeDisabled), + string(PublicNetworkAccessTypeEnabled), + } +} + +func (s *PublicNetworkAccessType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePublicNetworkAccessType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parsePublicNetworkAccessType(input string) (*PublicNetworkAccessType, error) { + vals := map[string]PublicNetworkAccessType{ + "disabled": PublicNetworkAccessTypeDisabled, + "enabled": PublicNetworkAccessTypeEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PublicNetworkAccessType(input) + return &out, nil +} + +type PurgeState string + +const ( + PurgeStateCompleted PurgeState = "completed" + PurgeStatePending PurgeState = "pending" +) + +func PossibleValuesForPurgeState() []string { + return []string{ + string(PurgeStateCompleted), + string(PurgeStatePending), + } +} + +func (s *PurgeState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePurgeState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parsePurgeState(input string) (*PurgeState, error) { + vals := map[string]PurgeState{ + "completed": PurgeStateCompleted, + "pending": PurgeStatePending, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PurgeState(input) + return &out, nil +} + +type RequestSource string + +const ( + RequestSourceRest RequestSource = "rest" +) + +func PossibleValuesForRequestSource() []string { + return []string{ + string(RequestSourceRest), + } +} + +func (s *RequestSource) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseRequestSource(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseRequestSource(input string) (*RequestSource, error) { + vals := map[string]RequestSource{ + "rest": RequestSourceRest, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := RequestSource(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-02-02/componentsapis/id_component.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-02-02/componentsapis/id_component.go new file mode 100644 index 000000000000..d1ca828a28d7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-02-02/componentsapis/id_component.go @@ -0,0 +1,125 @@ +package componentsapis + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = &ComponentId{} + +// ComponentId is a struct representing the Resource ID for a Component +type ComponentId struct { + SubscriptionId string + ResourceGroupName string + ComponentName string +} + +// NewComponentID returns a new ComponentId struct +func NewComponentID(subscriptionId string, resourceGroupName string, componentName string) ComponentId { + return ComponentId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ComponentName: componentName, + } +} + +// ParseComponentID parses 'input' into a ComponentId +func ParseComponentID(input string) (*ComponentId, error) { + parser := resourceids.NewParserFromResourceIdType(&ComponentId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := ComponentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseComponentIDInsensitively parses 'input' case-insensitively into a ComponentId +// note: this method should only be used for API response data and not user input +func ParseComponentIDInsensitively(input string) (*ComponentId, error) { + parser := resourceids.NewParserFromResourceIdType(&ComponentId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := ComponentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ComponentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) + } + + if id.ComponentName, ok = input.Parsed["componentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "componentName", input) + } + + return nil +} + +// ValidateComponentID checks that 'input' can be parsed as a Component ID +func ValidateComponentID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseComponentID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Component ID +func (id ComponentId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Insights/components/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ComponentName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Component ID +func (id ComponentId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftInsights", "Microsoft.Insights", "Microsoft.Insights"), + resourceids.StaticSegment("staticComponents", "components", "components"), + resourceids.UserSpecifiedSegment("componentName", "componentValue"), + } +} + +// String returns a human-readable description of this Component ID +func (id ComponentId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Component Name: %q", id.ComponentName), + } + return fmt.Sprintf("Component (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-02-02/componentsapis/id_operation.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-02-02/componentsapis/id_operation.go new file mode 100644 index 000000000000..e2d7e817bd7a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-02-02/componentsapis/id_operation.go @@ -0,0 +1,134 @@ +package componentsapis + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = &OperationId{} + +// OperationId is a struct representing the Resource ID for a Operation +type OperationId struct { + SubscriptionId string + ResourceGroupName string + ComponentName string + PurgeId string +} + +// NewOperationID returns a new OperationId struct +func NewOperationID(subscriptionId string, resourceGroupName string, componentName string, purgeId string) OperationId { + return OperationId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ComponentName: componentName, + PurgeId: purgeId, + } +} + +// ParseOperationID parses 'input' into a OperationId +func ParseOperationID(input string) (*OperationId, error) { + parser := resourceids.NewParserFromResourceIdType(&OperationId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := OperationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseOperationIDInsensitively parses 'input' case-insensitively into a OperationId +// note: this method should only be used for API response data and not user input +func ParseOperationIDInsensitively(input string) (*OperationId, error) { + parser := resourceids.NewParserFromResourceIdType(&OperationId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := OperationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *OperationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) + } + + if id.ComponentName, ok = input.Parsed["componentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "componentName", input) + } + + if id.PurgeId, ok = input.Parsed["purgeId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "purgeId", input) + } + + return nil +} + +// ValidateOperationID checks that 'input' can be parsed as a Operation ID +func ValidateOperationID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseOperationID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Operation ID +func (id OperationId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Insights/components/%s/operations/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ComponentName, id.PurgeId) +} + +// Segments returns a slice of Resource ID Segments which comprise this Operation ID +func (id OperationId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftInsights", "Microsoft.Insights", "Microsoft.Insights"), + resourceids.StaticSegment("staticComponents", "components", "components"), + resourceids.UserSpecifiedSegment("componentName", "componentValue"), + resourceids.StaticSegment("staticOperations", "operations", "operations"), + resourceids.UserSpecifiedSegment("purgeId", "purgeIdValue"), + } +} + +// String returns a human-readable description of this Operation ID +func (id OperationId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Component Name: %q", id.ComponentName), + fmt.Sprintf("Purge: %q", id.PurgeId), + } + return fmt.Sprintf("Operation (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-02-02/componentsapis/method_componentscreateorupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-02-02/componentsapis/method_componentscreateorupdate.go new file mode 100644 index 000000000000..c440ffa3afae --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-02-02/componentsapis/method_componentscreateorupdate.go @@ -0,0 +1,58 @@ +package componentsapis + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ComponentsCreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ApplicationInsightsComponent +} + +// ComponentsCreateOrUpdate ... +func (c ComponentsAPIsClient) ComponentsCreateOrUpdate(ctx context.Context, id ComponentId, input ApplicationInsightsComponent) (result ComponentsCreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model ApplicationInsightsComponent + result.Model = &model + + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-02-02/componentsapis/method_componentsdelete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-02-02/componentsapis/method_componentsdelete.go new file mode 100644 index 000000000000..847ecb0d7ce3 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-02-02/componentsapis/method_componentsdelete.go @@ -0,0 +1,47 @@ +package componentsapis + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ComponentsDeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// ComponentsDelete ... +func (c ComponentsAPIsClient) ComponentsDelete(ctx context.Context, id ComponentId) (result ComponentsDeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-02-02/componentsapis/method_componentsget.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-02-02/componentsapis/method_componentsget.go new file mode 100644 index 000000000000..d69f612ab9fb --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-02-02/componentsapis/method_componentsget.go @@ -0,0 +1,54 @@ +package componentsapis + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ComponentsGetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ApplicationInsightsComponent +} + +// ComponentsGet ... +func (c ComponentsAPIsClient) ComponentsGet(ctx context.Context, id ComponentId) (result ComponentsGetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model ApplicationInsightsComponent + result.Model = &model + + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-02-02/componentsapis/method_componentsgetpurgestatus.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-02-02/componentsapis/method_componentsgetpurgestatus.go new file mode 100644 index 000000000000..cf00bc8ad406 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-02-02/componentsapis/method_componentsgetpurgestatus.go @@ -0,0 +1,54 @@ +package componentsapis + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ComponentsGetPurgeStatusOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ComponentPurgeStatusResponse +} + +// ComponentsGetPurgeStatus ... +func (c ComponentsAPIsClient) ComponentsGetPurgeStatus(ctx context.Context, id OperationId) (result ComponentsGetPurgeStatusOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model ComponentPurgeStatusResponse + result.Model = &model + + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-02-02/componentsapis/method_componentslist.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-02-02/componentsapis/method_componentslist.go new file mode 100644 index 000000000000..a41fe7cde99c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-02-02/componentsapis/method_componentslist.go @@ -0,0 +1,92 @@ +package componentsapis + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ComponentsListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]ApplicationInsightsComponent +} + +type ComponentsListCompleteResult struct { + LatestHttpResponse *http.Response + Items []ApplicationInsightsComponent +} + +// ComponentsList ... +func (c ComponentsAPIsClient) ComponentsList(ctx context.Context, id commonids.SubscriptionId) (result ComponentsListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/providers/Microsoft.Insights/components", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]ApplicationInsightsComponent `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ComponentsListComplete retrieves all the results into a single object +func (c ComponentsAPIsClient) ComponentsListComplete(ctx context.Context, id commonids.SubscriptionId) (ComponentsListCompleteResult, error) { + return c.ComponentsListCompleteMatchingPredicate(ctx, id, ApplicationInsightsComponentOperationPredicate{}) +} + +// ComponentsListCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ComponentsAPIsClient) ComponentsListCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate ApplicationInsightsComponentOperationPredicate) (result ComponentsListCompleteResult, err error) { + items := make([]ApplicationInsightsComponent, 0) + + resp, err := c.ComponentsList(ctx, id) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ComponentsListCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-02-02/componentsapis/method_componentslistbyresourcegroup.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-02-02/componentsapis/method_componentslistbyresourcegroup.go new file mode 100644 index 000000000000..e1dac7d02794 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-02-02/componentsapis/method_componentslistbyresourcegroup.go @@ -0,0 +1,92 @@ +package componentsapis + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ComponentsListByResourceGroupOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]ApplicationInsightsComponent +} + +type ComponentsListByResourceGroupCompleteResult struct { + LatestHttpResponse *http.Response + Items []ApplicationInsightsComponent +} + +// ComponentsListByResourceGroup ... +func (c ComponentsAPIsClient) ComponentsListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (result ComponentsListByResourceGroupOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/providers/Microsoft.Insights/components", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]ApplicationInsightsComponent `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ComponentsListByResourceGroupComplete retrieves all the results into a single object +func (c ComponentsAPIsClient) ComponentsListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (ComponentsListByResourceGroupCompleteResult, error) { + return c.ComponentsListByResourceGroupCompleteMatchingPredicate(ctx, id, ApplicationInsightsComponentOperationPredicate{}) +} + +// ComponentsListByResourceGroupCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ComponentsAPIsClient) ComponentsListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate ApplicationInsightsComponentOperationPredicate) (result ComponentsListByResourceGroupCompleteResult, err error) { + items := make([]ApplicationInsightsComponent, 0) + + resp, err := c.ComponentsListByResourceGroup(ctx, id) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ComponentsListByResourceGroupCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-02-02/componentsapis/method_componentspurge.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-02-02/componentsapis/method_componentspurge.go new file mode 100644 index 000000000000..084ef9a550bd --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-02-02/componentsapis/method_componentspurge.go @@ -0,0 +1,59 @@ +package componentsapis + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ComponentsPurgeOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ComponentPurgeResponse +} + +// ComponentsPurge ... +func (c ComponentsAPIsClient) ComponentsPurge(ctx context.Context, id ComponentId, input ComponentPurgeBody) (result ComponentsPurgeOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/purge", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model ComponentPurgeResponse + result.Model = &model + + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-02-02/componentsapis/method_componentsupdatetags.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-02-02/componentsapis/method_componentsupdatetags.go new file mode 100644 index 000000000000..b428a674d9bd --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-02-02/componentsapis/method_componentsupdatetags.go @@ -0,0 +1,58 @@ +package componentsapis + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ComponentsUpdateTagsOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ApplicationInsightsComponent +} + +// ComponentsUpdateTags ... +func (c ComponentsAPIsClient) ComponentsUpdateTags(ctx context.Context, id ComponentId, input TagsResource) (result ComponentsUpdateTagsOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model ApplicationInsightsComponent + result.Model = &model + + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-02-02/componentsapis/model_applicationinsightscomponent.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-02-02/componentsapis/model_applicationinsightscomponent.go new file mode 100644 index 000000000000..d4ce30d8b50a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-02-02/componentsapis/model_applicationinsightscomponent.go @@ -0,0 +1,15 @@ +package componentsapis + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApplicationInsightsComponent struct { + Etag *string `json:"etag,omitempty"` + Id *string `json:"id,omitempty"` + Kind string `json:"kind"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties *ApplicationInsightsComponentProperties `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-02-02/componentsapis/model_applicationinsightscomponentproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-02-02/componentsapis/model_applicationinsightscomponentproperties.go new file mode 100644 index 000000000000..e1accb4cc643 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-02-02/componentsapis/model_applicationinsightscomponentproperties.go @@ -0,0 +1,62 @@ +package componentsapis + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApplicationInsightsComponentProperties struct { + AppId *string `json:"AppId,omitempty"` + ApplicationId *string `json:"ApplicationId,omitempty"` + ApplicationType ApplicationType `json:"Application_Type"` + ConnectionString *string `json:"ConnectionString,omitempty"` + CreationDate *string `json:"CreationDate,omitempty"` + DisableIPMasking *bool `json:"DisableIpMasking,omitempty"` + DisableLocalAuth *bool `json:"DisableLocalAuth,omitempty"` + FlowType *FlowType `json:"Flow_Type,omitempty"` + ForceCustomerStorageForProfiler *bool `json:"ForceCustomerStorageForProfiler,omitempty"` + HockeyAppId *string `json:"HockeyAppId,omitempty"` + HockeyAppToken *string `json:"HockeyAppToken,omitempty"` + ImmediatePurgeDataOn30Days *bool `json:"ImmediatePurgeDataOn30Days,omitempty"` + IngestionMode *IngestionMode `json:"IngestionMode,omitempty"` + InstrumentationKey *string `json:"InstrumentationKey,omitempty"` + LaMigrationDate *string `json:"LaMigrationDate,omitempty"` + Name *string `json:"Name,omitempty"` + PrivateLinkScopedResources *[]PrivateLinkScopedResource `json:"PrivateLinkScopedResources,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` + PublicNetworkAccessForIngestion *PublicNetworkAccessType `json:"publicNetworkAccessForIngestion,omitempty"` + PublicNetworkAccessForQuery *PublicNetworkAccessType `json:"publicNetworkAccessForQuery,omitempty"` + RequestSource *RequestSource `json:"Request_Source,omitempty"` + RetentionInDays *int64 `json:"RetentionInDays,omitempty"` + SamplingPercentage *float64 `json:"SamplingPercentage,omitempty"` + TenantId *string `json:"TenantId,omitempty"` + WorkspaceResourceId *string `json:"WorkspaceResourceId,omitempty"` +} + +func (o *ApplicationInsightsComponentProperties) GetCreationDateAsTime() (*time.Time, error) { + if o.CreationDate == nil { + return nil, nil + } + return dates.ParseAsFormat(o.CreationDate, "2006-01-02T15:04:05Z07:00") +} + +func (o *ApplicationInsightsComponentProperties) SetCreationDateAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.CreationDate = &formatted +} + +func (o *ApplicationInsightsComponentProperties) GetLaMigrationDateAsTime() (*time.Time, error) { + if o.LaMigrationDate == nil { + return nil, nil + } + return dates.ParseAsFormat(o.LaMigrationDate, "2006-01-02T15:04:05Z07:00") +} + +func (o *ApplicationInsightsComponentProperties) SetLaMigrationDateAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.LaMigrationDate = &formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-02-02/componentsapis/model_componentpurgebody.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-02-02/componentsapis/model_componentpurgebody.go new file mode 100644 index 000000000000..bb1d5366444a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-02-02/componentsapis/model_componentpurgebody.go @@ -0,0 +1,9 @@ +package componentsapis + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ComponentPurgeBody struct { + Filters []ComponentPurgeBodyFilters `json:"filters"` + Table string `json:"table"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-02-02/componentsapis/model_componentpurgebodyfilters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-02-02/componentsapis/model_componentpurgebodyfilters.go new file mode 100644 index 000000000000..1c18b1ccfe84 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-02-02/componentsapis/model_componentpurgebodyfilters.go @@ -0,0 +1,11 @@ +package componentsapis + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ComponentPurgeBodyFilters struct { + Column *string `json:"column,omitempty"` + Key *string `json:"key,omitempty"` + Operator *string `json:"operator,omitempty"` + Value *interface{} `json:"value,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-02-02/componentsapis/model_componentpurgeresponse.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-02-02/componentsapis/model_componentpurgeresponse.go new file mode 100644 index 000000000000..04ecc72c3600 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-02-02/componentsapis/model_componentpurgeresponse.go @@ -0,0 +1,8 @@ +package componentsapis + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ComponentPurgeResponse struct { + OperationId string `json:"operationId"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-02-02/componentsapis/model_componentpurgestatusresponse.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-02-02/componentsapis/model_componentpurgestatusresponse.go new file mode 100644 index 000000000000..edcc370a13ba --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-02-02/componentsapis/model_componentpurgestatusresponse.go @@ -0,0 +1,8 @@ +package componentsapis + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ComponentPurgeStatusResponse struct { + Status PurgeState `json:"status"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-02-02/componentsapis/model_privatelinkscopedresource.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-02-02/componentsapis/model_privatelinkscopedresource.go new file mode 100644 index 000000000000..df79dcc1ba55 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-02-02/componentsapis/model_privatelinkscopedresource.go @@ -0,0 +1,9 @@ +package componentsapis + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateLinkScopedResource struct { + ResourceId *string `json:"ResourceId,omitempty"` + ScopeId *string `json:"ScopeId,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-02-02/componentsapis/model_tagsresource.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-02-02/componentsapis/model_tagsresource.go new file mode 100644 index 000000000000..dfc5284b7d77 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-02-02/componentsapis/model_tagsresource.go @@ -0,0 +1,8 @@ +package componentsapis + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TagsResource struct { + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-02-02/componentsapis/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-02-02/componentsapis/predicates.go new file mode 100644 index 000000000000..98142c0a2163 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-02-02/componentsapis/predicates.go @@ -0,0 +1,42 @@ +package componentsapis + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApplicationInsightsComponentOperationPredicate struct { + Etag *string + Id *string + Kind *string + Location *string + Name *string + Type *string +} + +func (p ApplicationInsightsComponentOperationPredicate) Matches(input ApplicationInsightsComponent) bool { + + if p.Etag != nil && (input.Etag == nil || *p.Etag != *input.Etag) { + return false + } + + if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { + return false + } + + if p.Kind != nil && *p.Kind != input.Kind { + return false + } + + if p.Location != nil && *p.Location != input.Location { + return false + } + + if p.Name != nil && (input.Name == nil || *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil || *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-02-02/componentsapis/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-02-02/componentsapis/version.go new file mode 100644 index 000000000000..fa4e38cbec4a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-02-02/componentsapis/version.go @@ -0,0 +1,12 @@ +package componentsapis + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2020-02-02" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/componentsapis/%s", defaultApiVersion) +} diff --git a/vendor/modules.txt b/vendor/modules.txt index ca82580787a8..bd18e23da3cb 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -1,6 +1,5 @@ # github.com/Azure/azure-sdk-for-go v66.0.0+incompatible ## explicit -github.com/Azure/azure-sdk-for-go/services/appinsights/mgmt/2020-02-02/insights github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2020-09-01/cdn github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn github.com/Azure/azure-sdk-for-go/services/cosmos-db/mgmt/2021-10-15/documentdb @@ -214,6 +213,11 @@ github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2023-03-01/c github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2023-03-01/deletedconfigurationstores github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2023-03-01/operations github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2023-03-01/replicas +github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/analyticsitemsapis +github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/componentapikeysapis +github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/componentfeaturesandpricingapis +github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2015-05-01/componentproactivedetectionapis +github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-02-02/componentsapis github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-11-20/workbooktemplatesapis github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2022-04-01/workbooksapis github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2022-06-15/webtestsapis diff --git a/website/docs/r/application_insights_smart_detection_rule.html.markdown b/website/docs/r/application_insights_smart_detection_rule.html.markdown index d3d619500df0..371ca26224b1 100644 --- a/website/docs/r/application_insights_smart_detection_rule.html.markdown +++ b/website/docs/r/application_insights_smart_detection_rule.html.markdown @@ -68,5 +68,5 @@ The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/l Application Insights Smart Detection Rules can be imported using the `resource id`, e.g. ```shell -terraform import azurerm_application_insights_smart_detection_rule.rule1 /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Insights/components/mycomponent1/smartDetectionRule/myrule1 +terraform import azurerm_application_insights_smart_detection_rule.rule1 /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Insights/components/mycomponent1/proactiveDetectionConfig/myrule1 ```