From 77fc94e2843c4da5f4a4caac655bad69952bd717 Mon Sep 17 00:00:00 2001 From: Zhenhua Hu Date: Tue, 28 Jun 2022 16:29:05 +0800 Subject: [PATCH 1/6] add code --- go.mod | 2 +- go.sum | 4 +- internal/provider/services.go | 1 + ...ion_insights_workbook_template_resource.go | 393 ++++++++++++++++++ ...nsights_workbook_template_resource_test.go | 216 ++++++++++ .../applicationinsights/client/client.go | 6 + .../applicationinsights/registration.go | 17 +- .../validate/workbook_template_id.go | 21 + .../tenants/method_create_autorest.go | 2 + .../tenants/method_delete_autorest.go | 7 + .../servers/method_create_autorest.go | 2 + .../servers/method_delete_autorest.go | 7 + .../servers/method_resume_autorest.go | 2 + .../servers/method_suspend_autorest.go | 2 + .../servers/method_update_autorest.go | 2 + .../method_create_autorest.go | 2 + .../method_delete_autorest.go | 7 + .../method_update_autorest.go | 2 + .../2020-11-20/applicationinsights/client.go | 18 + .../id_workbooktemplate.go | 124 ++++++ ...orkbooktemplatescreateorupdate_autorest.go | 68 +++ ...method_workbooktemplatesdelete_autorest.go | 65 +++ .../method_workbooktemplatesget_autorest.go | 67 +++ ...oktemplateslistbyresourcegroup_autorest.go | 69 +++ ...method_workbooktemplatesupdate_autorest.go | 68 +++ .../model_workbooktemplate.go | 13 + .../model_workbooktemplategallery.go | 12 + .../model_workbooktemplatelocalizedgallery.go | 9 + .../model_workbooktemplateproperties.go | 12 + .../model_workbooktemplateslistresult.go | 8 + .../model_workbooktemplateupdateparameters.go | 9 + .../2020-11-20/applicationinsights/version.go | 12 + .../method_accountscreate_autorest.go | 2 + .../method_accountsdelete_autorest.go | 7 + .../method_accountsupdate_autorest.go | 2 + .../method_deletedaccountspurge_autorest.go | 7 + .../method_createorupdate_autorest.go | 2 + .../method_delete_autorest.go | 7 + .../method_ledgercreate_autorest.go | 2 + .../method_ledgerdelete_autorest.go | 7 + .../method_ledgerupdate_autorest.go | 2 + .../apps/method_createorupdate_autorest.go | 2 + .../apps/method_delete_autorest.go | 7 + .../apps/method_update_autorest.go | 2 + .../namespaces/method_delete_autorest.go | 7 + .../tenantconfiguration/constants.go | 31 -- .../tenantconfiguration/id_configuration.go | 112 ----- ...hod_tenantconfigurationscreate_autorest.go | 8 +- ...hod_tenantconfigurationsdelete_autorest.go | 8 +- ...method_tenantconfigurationsget_autorest.go | 8 +- .../method_createorupdate_autorest.go | 2 + .../managedcluster/method_delete_autorest.go | 7 + .../method_createorupdate_autorest.go | 2 + .../nodetype/method_delete_autorest.go | 7 + .../nodetype/method_deletenode_autorest.go | 2 + .../nodetype/method_reimage_autorest.go | 2 + .../nodetype/method_restart_autorest.go | 2 + .../method_createorupdate_autorest.go | 2 + .../authorizations/method_delete_autorest.go | 7 + .../method_createorupdate_autorest.go | 2 + .../clusters/method_delete_autorest.go | 7 + .../clusters/method_update_autorest.go | 2 + .../method_createorupdate_autorest.go | 2 + .../privateclouds/method_delete_autorest.go | 7 + .../privateclouds/method_update_autorest.go | 2 + vendor/modules.txt | 3 +- 66 files changed, 1370 insertions(+), 160 deletions(-) create mode 100644 internal/services/applicationinsights/application_insights_workbook_template_resource.go create mode 100644 internal/services/applicationinsights/application_insights_workbook_template_resource_test.go create mode 100644 internal/services/applicationinsights/validate/workbook_template_id.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-11-20/applicationinsights/client.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-11-20/applicationinsights/id_workbooktemplate.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-11-20/applicationinsights/method_workbooktemplatescreateorupdate_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-11-20/applicationinsights/method_workbooktemplatesdelete_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-11-20/applicationinsights/method_workbooktemplatesget_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-11-20/applicationinsights/method_workbooktemplateslistbyresourcegroup_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-11-20/applicationinsights/method_workbooktemplatesupdate_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-11-20/applicationinsights/model_workbooktemplate.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-11-20/applicationinsights/model_workbooktemplategallery.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-11-20/applicationinsights/model_workbooktemplatelocalizedgallery.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-11-20/applicationinsights/model_workbooktemplateproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-11-20/applicationinsights/model_workbooktemplateslistresult.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-11-20/applicationinsights/model_workbooktemplateupdateparameters.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-11-20/applicationinsights/version.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/portal/2019-01-01-preview/tenantconfiguration/constants.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/portal/2019-01-01-preview/tenantconfiguration/id_configuration.go diff --git a/go.mod b/go.mod index ec0f3053d937..e9b304408784 100644 --- a/go.mod +++ b/go.mod @@ -13,7 +13,7 @@ require ( github.com/google/go-cmp v0.5.8 github.com/google/uuid v1.1.2 github.com/hashicorp/go-azure-helpers v0.34.0 - github.com/hashicorp/go-azure-sdk v0.20220623.1064317 + github.com/hashicorp/go-azure-sdk v0.20220627.1102220 github.com/hashicorp/go-multierror v1.1.1 github.com/hashicorp/go-uuid v1.0.2 github.com/hashicorp/go-version v1.4.0 diff --git a/go.sum b/go.sum index fa6bdb83fe45..fbdef1e5f519 100644 --- a/go.sum +++ b/go.sum @@ -259,8 +259,8 @@ github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brv github.com/hashicorp/go-azure-helpers v0.12.0/go.mod h1:Zc3v4DNeX6PDdy7NljlYpnrdac1++qNW0I4U+ofGwpg= github.com/hashicorp/go-azure-helpers v0.34.0 h1:Lvk3IgwFT51WVu1IK5rpUMd+rKnRylg9vMTt6Qx6xn4= github.com/hashicorp/go-azure-helpers v0.34.0/go.mod h1:gcutZ/Hf/O7YN9M3UIvyZ9l0Rxv7Yrc9x5sSfM9cuSw= -github.com/hashicorp/go-azure-sdk v0.20220623.1064317 h1:ebBEfxlNZ4VlWvlcRqTsx9fyhhyWeBEsAVFr42arDzk= -github.com/hashicorp/go-azure-sdk v0.20220623.1064317/go.mod h1:jPd83zRme0J5C+rUQaU6bzrWg/AS5WN1TiilFzRoKU0= +github.com/hashicorp/go-azure-sdk v0.20220627.1102220 h1:e1yub13ihc2HSROJJEnUFsKlIvdmuJXBaXW8e24t0E8= +github.com/hashicorp/go-azure-sdk v0.20220627.1102220/go.mod h1:jPd83zRme0J5C+rUQaU6bzrWg/AS5WN1TiilFzRoKU0= github.com/hashicorp/go-checkpoint v0.5.0 h1:MFYpPZCnQqQTE18jFwSII6eUQrD/oxMFp3mlgcqk5mU= github.com/hashicorp/go-checkpoint v0.5.0/go.mod h1:7nfLNL10NsxqO4iWuW6tWW0HjZuDrwkBuEQsVcpCOgg= github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= diff --git a/internal/provider/services.go b/internal/provider/services.go index ca6cd4ec3882..b8971dd6395e 100644 --- a/internal/provider/services.go +++ b/internal/provider/services.go @@ -113,6 +113,7 @@ func SupportedTypedServices() []sdk.TypedServiceRegistration { aadb2c.Registration{}, apimanagement.Registration{}, appconfiguration.Registration{}, + applicationinsights.Registration{}, appservice.Registration{}, batch.Registration{}, bot.Registration{}, diff --git a/internal/services/applicationinsights/application_insights_workbook_template_resource.go b/internal/services/applicationinsights/application_insights_workbook_template_resource.go new file mode 100644 index 000000000000..7c2e30fafcb8 --- /dev/null +++ b/internal/services/applicationinsights/application_insights_workbook_template_resource.go @@ -0,0 +1,393 @@ +package applicationinsights + +import ( + "context" + "encoding/json" + "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-sdk/resource-manager/applicationinsights/2020-11-20/applicationinsights" + "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" +) + +type ApplicationInsightsWorkbookTemplateModel struct { + Name string `tfschema:"name"` + ResourceGroupName string `tfschema:"resource_group_name"` + Author string `tfschema:"author"` + Galleries []WorkbookTemplateGalleryModel `tfschema:"galleries"` + Location string `tfschema:"location"` + Priority int64 `tfschema:"priority"` + Tags map[string]string `tfschema:"tags"` + TemplateData string `tfschema:"template_data"` +} + +type WorkbookTemplateGalleryModel struct { + Category string `tfschema:"category"` + Name string `tfschema:"name"` + Order int64 `tfschema:"order"` + ResourceType string `tfschema:"resource_type"` + Type string `tfschema:"type"` +} + +type ApplicationInsightsWorkbookTemplateResource struct{} + +var _ sdk.ResourceWithUpdate = ApplicationInsightsWorkbookTemplateResource{} + +func (r ApplicationInsightsWorkbookTemplateResource) ResourceType() string { + return "azurerm_application_insights_workbook_template" +} + +func (r ApplicationInsightsWorkbookTemplateResource) ModelObject() interface{} { + return &ApplicationInsightsWorkbookTemplateModel{} +} + +func (r ApplicationInsightsWorkbookTemplateResource) IDValidationFunc() pluginsdk.SchemaValidateFunc { + return validate.WorkbookTemplateID +} + +func (r ApplicationInsightsWorkbookTemplateResource) Arguments() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "resource_group_name": commonschema.ResourceGroupName(), + + "author": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "galleries": { + Type: pluginsdk.TypeList, + Required: true, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "category": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "name": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "order": { + Type: pluginsdk.TypeInt, + Optional: true, + }, + + "resource_type": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "type": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + }, + }, + }, + + "location": commonschema.Location(), + + "priority": { + Type: pluginsdk.TypeInt, + Optional: true, + }, + + "tags": commonschema.Tags(), + + "template_data": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringIsJSON, + DiffSuppressFunc: pluginsdk.SuppressJsonDiff, + }, + } +} + +func (r ApplicationInsightsWorkbookTemplateResource) Attributes() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{} +} + +func (r ApplicationInsightsWorkbookTemplateResource) Create() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + var model ApplicationInsightsWorkbookTemplateModel + if err := metadata.Decode(&model); err != nil { + return fmt.Errorf("decoding: %+v", err) + } + + client := metadata.Client.AppInsights.WorkbookTemplateClient + subscriptionId := metadata.Client.Account.SubscriptionId + id := applicationinsights.NewWorkbookTemplateID(subscriptionId, model.ResourceGroupName, model.Name) + existing, err := client.WorkbookTemplatesGet(ctx, id) + if err != nil && !response.WasNotFound(existing.HttpResponse) { + return fmt.Errorf("checking for existing %s: %+v", id, err) + } + + if !response.WasNotFound(existing.HttpResponse) { + return metadata.ResourceRequiresImport(r.ResourceType(), id) + } + + var templateDataValue interface{} + err = json.Unmarshal([]byte(model.TemplateData), &templateDataValue) + if err != nil { + return err + } + + properties := &applicationinsights.WorkbookTemplate{ + Location: location.Normalize(model.Location), + Properties: &applicationinsights.WorkbookTemplateProperties{ + Priority: &model.Priority, + TemplateData: templateDataValue, + }, + Tags: &model.Tags, + } + + if model.Author != "" { + properties.Properties.Author = &model.Author + } + + galleriesValue, err := expandWorkbookTemplateGalleryModel(model.Galleries) + if err != nil { + return err + } + + if galleriesValue != nil { + properties.Properties.Galleries = *galleriesValue + } + + if _, err := client.WorkbookTemplatesCreateOrUpdate(ctx, id, *properties); err != nil { + return fmt.Errorf("creating %s: %+v", id, err) + } + + metadata.SetID(id) + return nil + }, + } +} + +func (r ApplicationInsightsWorkbookTemplateResource) Update() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.AppInsights.WorkbookTemplateClient + + id, err := applicationinsights.ParseWorkbookTemplateID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + var model ApplicationInsightsWorkbookTemplateModel + if err := metadata.Decode(&model); err != nil { + return fmt.Errorf("decoding: %+v", err) + } + + resp, err := client.WorkbookTemplatesGet(ctx, *id) + if err != nil { + return fmt.Errorf("retrieving %s: %+v", *id, err) + } + + properties := resp.Model + if properties == nil { + return fmt.Errorf("retrieving %s: properties was nil", id) + } + + if metadata.ResourceData.HasChange("author") { + properties.Properties.Author = &model.Author + } + + if metadata.ResourceData.HasChange("galleries") { + galleriesValue, err := expandWorkbookTemplateGalleryModel(model.Galleries) + if err != nil { + return err + } + + if galleriesValue != nil { + properties.Properties.Galleries = *galleriesValue + } + } + + if metadata.ResourceData.HasChange("priority") { + properties.Properties.Priority = &model.Priority + } + + if metadata.ResourceData.HasChange("template_data") { + var templateDataValue interface{} + err := json.Unmarshal([]byte(model.TemplateData), &templateDataValue) + if err != nil { + return err + } + + properties.Properties.TemplateData = templateDataValue + } + + if metadata.ResourceData.HasChange("tags") { + properties.Tags = &model.Tags + } + + if _, err := client.WorkbookTemplatesCreateOrUpdate(ctx, *id, *properties); err != nil { + return fmt.Errorf("updating %s: %+v", *id, err) + } + + return nil + }, + } +} + +func (r ApplicationInsightsWorkbookTemplateResource) Read() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 5 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.AppInsights.WorkbookTemplateClient + + id, err := applicationinsights.ParseWorkbookTemplateID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + resp, err := client.WorkbookTemplatesGet(ctx, *id) + if err != nil { + if response.WasNotFound(resp.HttpResponse) { + return metadata.MarkAsGone(id) + } + + return fmt.Errorf("retrieving %s: %+v", *id, err) + } + + model := resp.Model + if model == nil { + return fmt.Errorf("retrieving %s: model was nil", id) + } + + state := ApplicationInsightsWorkbookTemplateModel{ + Name: id.ResourceName, + ResourceGroupName: id.ResourceGroupName, + Location: location.Normalize(model.Location), + } + + if properties := model.Properties; properties != nil { + if properties.Author != nil { + state.Author = *properties.Author + } + + galleriesValue, err := flattenWorkbookTemplateGalleryModel(&properties.Galleries) + if err != nil { + return err + } + + state.Galleries = galleriesValue + + if properties.Priority != nil { + state.Priority = *properties.Priority + } + + if properties.TemplateData != nil { + + templateDataValue, err := json.Marshal(properties.TemplateData) + if err != nil { + return err + } + + state.TemplateData = string(templateDataValue) + } + } + if model.Tags != nil { + state.Tags = *model.Tags + } + + return metadata.Encode(&state) + }, + } +} + +func (r ApplicationInsightsWorkbookTemplateResource) Delete() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.AppInsights.WorkbookTemplateClient + + id, err := applicationinsights.ParseWorkbookTemplateID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + if _, err := client.WorkbookTemplatesDelete(ctx, *id); err != nil { + return fmt.Errorf("deleting %s: %+v", id, err) + } + + return nil + }, + } +} + +func expandWorkbookTemplateGalleryModel(inputList []WorkbookTemplateGalleryModel) (*[]applicationinsights.WorkbookTemplateGallery, error) { + var outputList []applicationinsights.WorkbookTemplateGallery + for _, input := range inputList { + output := applicationinsights.WorkbookTemplateGallery{ + Category: &input.Category, + Name: &input.Name, + Order: &input.Order, + ResourceType: &input.ResourceType, + Type: &input.Type, + } + + outputList = append(outputList, output) + } + + return &outputList, nil +} + +func flattenWorkbookTemplateGalleryModel(inputList *[]applicationinsights.WorkbookTemplateGallery) ([]WorkbookTemplateGalleryModel, error) { + var outputList []WorkbookTemplateGalleryModel + if inputList == nil { + return outputList, nil + } + + for _, input := range *inputList { + output := WorkbookTemplateGalleryModel{} + + if input.Category != nil { + output.Category = *input.Category + } + + if input.Name != nil { + output.Name = *input.Name + } + + if input.Order != nil { + output.Order = *input.Order + } + + if input.ResourceType != nil { + output.ResourceType = *input.ResourceType + } + + if input.Type != nil { + output.Type = *input.Type + } + + outputList = append(outputList, output) + } + + return outputList, nil +} diff --git a/internal/services/applicationinsights/application_insights_workbook_template_resource_test.go b/internal/services/applicationinsights/application_insights_workbook_template_resource_test.go new file mode 100644 index 000000000000..4a9714ae79ec --- /dev/null +++ b/internal/services/applicationinsights/application_insights_workbook_template_resource_test.go @@ -0,0 +1,216 @@ +package applicationinsights_test + +import ( + "context" + "fmt" + "testing" + + "github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-11-20/applicationinsights" + + "github.com/hashicorp/go-azure-helpers/lang/response" + "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/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/utils" +) + +type ApplicationInsightsWorkbookTemplateResource struct{} + +func TestAccApplicationInsightsWorkbookTemplate_basic(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_application_insights_workbook_template", "test") + r := ApplicationInsightsWorkbookTemplateResource{} + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func TestAccApplicationInsightsWorkbookTemplate_requiresImport(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_application_insights_workbook_template", "test") + r := ApplicationInsightsWorkbookTemplateResource{} + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.RequiresImportErrorStep(r.requiresImport), + }) +} + +func TestAccApplicationInsightsWorkbookTemplate_complete(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_application_insights_workbook_template", "test") + r := ApplicationInsightsWorkbookTemplateResource{} + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.complete(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func TestAccApplicationInsightsWorkbookTemplate_update(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_application_insights_workbook_template", "test") + r := ApplicationInsightsWorkbookTemplateResource{} + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.complete(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + { + Config: r.update(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func (r ApplicationInsightsWorkbookTemplateResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { + id, err := applicationinsights.ParseWorkbookTemplateID(state.ID) + if err != nil { + return nil, err + } + + client := clients.AppInsights.WorkbookTemplateClient + resp, err := client.WorkbookTemplatesGet(ctx, *id) + if err != nil { + if response.WasNotFound(resp.HttpResponse) { + return utils.Bool(false), nil + } + return nil, fmt.Errorf("retrieving %s: %+v", id, err) + } + return utils.Bool(resp.Model != nil), nil +} + +func (r ApplicationInsightsWorkbookTemplateResource) template(data acceptance.TestData) string { + return fmt.Sprintf(` +provider "azurerm" { + features {} +} + +resource "azurerm_resource_group" "test" { + name = "acctest-rg-%d" + location = "%s" +} +`, data.RandomInteger, data.Locations.Primary) +} + +func (r ApplicationInsightsWorkbookTemplateResource) basic(data acceptance.TestData) string { + template := r.template(data) + return fmt.Sprintf(` + %s + +resource "azurerm_application_insights_workbook_template" "test" { + name = "acctest-aiwt-%d" + resource_group_name = azurerm_resource_group.test.name + location = "%s" + galleries { + category = "" + name = "" + order = 0 + resource_type = "" + type = "" + } + template_data = jsonencode({ + "key" = "value" + }) +} +`, template, data.RandomInteger, data.Locations.Primary) +} + +func (r ApplicationInsightsWorkbookTemplateResource) requiresImport(data acceptance.TestData) string { + config := r.basic(data) + return fmt.Sprintf(` + %s + +resource "azurerm_application_insights_workbook_template" "import" { + name = azurerm_application_insights_workbook_template.test.name + resource_group_name = azurerm_resource_group.test.name + location = "%s" + galleries { + category = "" + name = "" + order = 0 + resource_type = "" + type = "" + } + template_data = jsonencode({ + "key" = "value" + }) +} +`, config, data.Locations.Primary) +} + +func (r ApplicationInsightsWorkbookTemplateResource) complete(data acceptance.TestData) string { + template := r.template(data) + return fmt.Sprintf(` + %s + +resource "azurerm_application_insights_workbook_template" "test" { + name = "acctest-aiwt-%d" + resource_group_name = azurerm_resource_group.test.name + location = "%s" + author = "" + priority = 0 + + galleries { + category = "" + name = "" + order = 0 + resource_type = "" + type = "" + } + + template_data = jsonencode({ + "key" = "value" + }) + + tags = { + key = "value" + } +} +`, template, data.RandomInteger, data.Locations.Primary) +} + +func (r ApplicationInsightsWorkbookTemplateResource) update(data acceptance.TestData) string { + template := r.template(data) + return fmt.Sprintf(` + %s + +resource "azurerm_application_insights_workbook_template" "test" { + name = "acctest-aiwt-%d" + resource_group_name = azurerm_resource_group.test.name + location = "%s" + author = "" + priority = 0 + galleries { + category = "" + name = "" + order = 0 + resource_type = "" + type = "" + } + template_data = jsonencode({ + "key" = "value" + }) + tags = { + key = "value" + } +} +`, template, data.RandomInteger, data.Locations.Primary) +} diff --git a/internal/services/applicationinsights/client/client.go b/internal/services/applicationinsights/client/client.go index 4907c213e532..8f69466b6aaa 100644 --- a/internal/services/applicationinsights/client/client.go +++ b/internal/services/applicationinsights/client/client.go @@ -2,6 +2,7 @@ package client import ( "github.com/Azure/azure-sdk-for-go/services/appinsights/mgmt/2020-02-02/insights" + workbookTemplate "github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-11-20/applicationinsights" "github.com/hashicorp/terraform-provider-azurerm/internal/common" "github.com/hashicorp/terraform-provider-azurerm/internal/services/applicationinsights/azuresdkhacks" ) @@ -13,6 +14,7 @@ type Client struct { WebTestsClient *azuresdkhacks.WebTestsClient BillingClient *insights.ComponentCurrentBillingFeaturesClient SmartDetectionRuleClient *insights.ProactiveDetectionConfigurationsClient + WorkbookTemplateClient *workbookTemplate.ApplicationInsightsClient } func NewClient(o *common.ClientOptions) *Client { @@ -35,6 +37,9 @@ func NewClient(o *common.ClientOptions) *Client { smartDetectionRuleClient := insights.NewProactiveDetectionConfigurationsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) o.ConfigureClient(&smartDetectionRuleClient.Client, o.ResourceManagerAuthorizer) + workbookTemplateClient := workbookTemplate.NewApplicationInsightsClientWithBaseURI(o.ResourceManagerEndpoint) + o.ConfigureClient(&workbookTemplateClient.Client, o.ResourceManagerAuthorizer) + return &Client{ AnalyticsItemsClient: &analyticsItemsClient, APIKeysClient: &apiKeysClient, @@ -42,5 +47,6 @@ func NewClient(o *common.ClientOptions) *Client { WebTestsClient: &webTestsWorkaroundClient, BillingClient: &billingClient, SmartDetectionRuleClient: &smartDetectionRuleClient, + WorkbookTemplateClient: &workbookTemplateClient, } } diff --git a/internal/services/applicationinsights/registration.go b/internal/services/applicationinsights/registration.go index 061f12d459d0..cc0f01206e8c 100644 --- a/internal/services/applicationinsights/registration.go +++ b/internal/services/applicationinsights/registration.go @@ -7,7 +7,10 @@ import ( type Registration struct{} -var _ sdk.UntypedServiceRegistrationWithAGitHubLabel = Registration{} +var ( + _ sdk.TypedServiceRegistrationWithAGitHubLabel = Registration{} + _ sdk.UntypedServiceRegistrationWithAGitHubLabel = Registration{} +) func (r Registration) AssociatedGitHubLabel() string { return "service/application-insights" @@ -42,3 +45,15 @@ func (r Registration) SupportedResources() map[string]*pluginsdk.Resource { "azurerm_application_insights_web_test": resourceApplicationInsightsWebTests(), } } + +// DataSources returns a list of Data Sources supported by this Service +func (r Registration) DataSources() []sdk.DataSource { + return []sdk.DataSource{} +} + +// Resources returns a list of Resources supported by this Service +func (r Registration) Resources() []sdk.Resource { + return []sdk.Resource{ + ApplicationInsightsWorkbookTemplateResource{}, + } +} diff --git a/internal/services/applicationinsights/validate/workbook_template_id.go b/internal/services/applicationinsights/validate/workbook_template_id.go new file mode 100644 index 000000000000..5ea51de2017b --- /dev/null +++ b/internal/services/applicationinsights/validate/workbook_template_id.go @@ -0,0 +1,21 @@ +package validate + +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-11-20/applicationinsights" +) + +func WorkbookTemplateID(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 := applicationinsights.ParseWorkbookTemplateID(v); err != nil { + errors = append(errors, err) + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aadb2c/2021-04-01-preview/tenants/method_create_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aadb2c/2021-04-01-preview/tenants/method_create_autorest.go index 30e23bdb3ab4..5084db30761c 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aadb2c/2021-04-01-preview/tenants/method_create_autorest.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aadb2c/2021-04-01-preview/tenants/method_create_autorest.go @@ -73,6 +73,8 @@ func (c TenantsClient) senderForCreate(ctx context.Context, req *http.Request) ( if err != nil { return } + future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) + return } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aadb2c/2021-04-01-preview/tenants/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aadb2c/2021-04-01-preview/tenants/method_delete_autorest.go index 6242757c8717..5335f208edaf 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aadb2c/2021-04-01-preview/tenants/method_delete_autorest.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aadb2c/2021-04-01-preview/tenants/method_delete_autorest.go @@ -7,6 +7,7 @@ import ( "github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/polling" ) @@ -72,6 +73,12 @@ func (c TenantsClient) senderForDelete(ctx context.Context, req *http.Request) ( if err != nil { return } + future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) + + if !response.WasNotFound(future.Poller.HttpResponse) { + return future, err + } + return } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/method_create_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/method_create_autorest.go index 3b4573503513..100cce6899e5 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/method_create_autorest.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/method_create_autorest.go @@ -73,6 +73,8 @@ func (c ServersClient) senderForCreate(ctx context.Context, req *http.Request) ( if err != nil { return } + future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) + return } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/method_delete_autorest.go index 888a4641a726..7b2120ab13ff 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/method_delete_autorest.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/method_delete_autorest.go @@ -7,6 +7,7 @@ import ( "github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/polling" ) @@ -72,6 +73,12 @@ func (c ServersClient) senderForDelete(ctx context.Context, req *http.Request) ( if err != nil { return } + future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) + + if !response.WasNotFound(future.Poller.HttpResponse) { + return future, err + } + return } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/method_resume_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/method_resume_autorest.go index 4703526157f6..b5840faca296 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/method_resume_autorest.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/method_resume_autorest.go @@ -72,6 +72,8 @@ func (c ServersClient) senderForResume(ctx context.Context, req *http.Request) ( if err != nil { return } + future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) + return } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/method_suspend_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/method_suspend_autorest.go index 9942c094a829..3668045ad6cd 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/method_suspend_autorest.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/method_suspend_autorest.go @@ -72,6 +72,8 @@ func (c ServersClient) senderForSuspend(ctx context.Context, req *http.Request) if err != nil { return } + future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) + return } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/method_update_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/method_update_autorest.go index 2d4b9a7dd1b4..e6455d323936 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/method_update_autorest.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/method_update_autorest.go @@ -73,6 +73,8 @@ func (c ServersClient) senderForUpdate(ctx context.Context, req *http.Request) ( if err != nil { return } + future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) + return } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2020-06-01/configurationstores/method_create_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2020-06-01/configurationstores/method_create_autorest.go index e316a1be4e2c..e0ef50dc4672 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2020-06-01/configurationstores/method_create_autorest.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2020-06-01/configurationstores/method_create_autorest.go @@ -73,6 +73,8 @@ func (c ConfigurationStoresClient) senderForCreate(ctx context.Context, req *htt if err != nil { return } + future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) + return } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2020-06-01/configurationstores/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2020-06-01/configurationstores/method_delete_autorest.go index 85a8b675d414..037a23f7759b 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2020-06-01/configurationstores/method_delete_autorest.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2020-06-01/configurationstores/method_delete_autorest.go @@ -7,6 +7,7 @@ import ( "github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/polling" ) @@ -72,6 +73,12 @@ func (c ConfigurationStoresClient) senderForDelete(ctx context.Context, req *htt if err != nil { return } + future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) + + if !response.WasNotFound(future.Poller.HttpResponse) { + return future, err + } + return } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2020-06-01/configurationstores/method_update_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2020-06-01/configurationstores/method_update_autorest.go index e0cf1de6c91e..9989e703ff9b 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2020-06-01/configurationstores/method_update_autorest.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2020-06-01/configurationstores/method_update_autorest.go @@ -73,6 +73,8 @@ func (c ConfigurationStoresClient) senderForUpdate(ctx context.Context, req *htt if err != nil { return } + future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) + return } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-11-20/applicationinsights/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-11-20/applicationinsights/client.go new file mode 100644 index 000000000000..f35cbf2494aa --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-11-20/applicationinsights/client.go @@ -0,0 +1,18 @@ +package applicationinsights + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApplicationInsightsClient struct { + Client autorest.Client + baseUri string +} + +func NewApplicationInsightsClientWithBaseURI(endpoint string) ApplicationInsightsClient { + return ApplicationInsightsClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-11-20/applicationinsights/id_workbooktemplate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-11-20/applicationinsights/id_workbooktemplate.go new file mode 100644 index 000000000000..21ad2013cf86 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-11-20/applicationinsights/id_workbooktemplate.go @@ -0,0 +1,124 @@ +package applicationinsights + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = WorkbookTemplateId{} + +// WorkbookTemplateId is a struct representing the Resource ID for a Workbook Template +type WorkbookTemplateId struct { + SubscriptionId string + ResourceGroupName string + ResourceName string +} + +// NewWorkbookTemplateID returns a new WorkbookTemplateId struct +func NewWorkbookTemplateID(subscriptionId string, resourceGroupName string, resourceName string) WorkbookTemplateId { + return WorkbookTemplateId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ResourceName: resourceName, + } +} + +// ParseWorkbookTemplateID parses 'input' into a WorkbookTemplateId +func ParseWorkbookTemplateID(input string) (*WorkbookTemplateId, error) { + parser := resourceids.NewParserFromResourceIdType(WorkbookTemplateId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := WorkbookTemplateId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseWorkbookTemplateIDInsensitively parses 'input' case-insensitively into a WorkbookTemplateId +// note: this method should only be used for API response data and not user input +func ParseWorkbookTemplateIDInsensitively(input string) (*WorkbookTemplateId, error) { + parser := resourceids.NewParserFromResourceIdType(WorkbookTemplateId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := WorkbookTemplateId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateWorkbookTemplateID checks that 'input' can be parsed as a Workbook Template ID +func ValidateWorkbookTemplateID(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 := ParseWorkbookTemplateID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Workbook Template ID +func (id WorkbookTemplateId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Insights/workbookTemplates/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ResourceName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Workbook Template ID +func (id WorkbookTemplateId) 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("staticWorkbookTemplates", "workbookTemplates", "workbookTemplates"), + resourceids.UserSpecifiedSegment("resourceName", "resourceValue"), + } +} + +// String returns a human-readable description of this Workbook Template ID +func (id WorkbookTemplateId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Resource Name: %q", id.ResourceName), + } + return fmt.Sprintf("Workbook Template (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-11-20/applicationinsights/method_workbooktemplatescreateorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-11-20/applicationinsights/method_workbooktemplatescreateorupdate_autorest.go new file mode 100644 index 000000000000..43c3d52ed6e4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-11-20/applicationinsights/method_workbooktemplatescreateorupdate_autorest.go @@ -0,0 +1,68 @@ +package applicationinsights + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WorkbookTemplatesCreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + Model *WorkbookTemplate +} + +// WorkbookTemplatesCreateOrUpdate ... +func (c ApplicationInsightsClient) WorkbookTemplatesCreateOrUpdate(ctx context.Context, id WorkbookTemplateId, input WorkbookTemplate) (result WorkbookTemplatesCreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForWorkbookTemplatesCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "applicationinsights.ApplicationInsightsClient", "WorkbookTemplatesCreateOrUpdate", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "applicationinsights.ApplicationInsightsClient", "WorkbookTemplatesCreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForWorkbookTemplatesCreateOrUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "applicationinsights.ApplicationInsightsClient", "WorkbookTemplatesCreateOrUpdate", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForWorkbookTemplatesCreateOrUpdate prepares the WorkbookTemplatesCreateOrUpdate request. +func (c ApplicationInsightsClient) preparerForWorkbookTemplatesCreateOrUpdate(ctx context.Context, id WorkbookTemplateId, input WorkbookTemplate) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForWorkbookTemplatesCreateOrUpdate handles the response to the WorkbookTemplatesCreateOrUpdate request. The method always +// closes the http.Response Body. +func (c ApplicationInsightsClient) responderForWorkbookTemplatesCreateOrUpdate(resp *http.Response) (result WorkbookTemplatesCreateOrUpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-11-20/applicationinsights/method_workbooktemplatesdelete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-11-20/applicationinsights/method_workbooktemplatesdelete_autorest.go new file mode 100644 index 000000000000..a8d8153c8b18 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-11-20/applicationinsights/method_workbooktemplatesdelete_autorest.go @@ -0,0 +1,65 @@ +package applicationinsights + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WorkbookTemplatesDeleteOperationResponse struct { + HttpResponse *http.Response +} + +// WorkbookTemplatesDelete ... +func (c ApplicationInsightsClient) WorkbookTemplatesDelete(ctx context.Context, id WorkbookTemplateId) (result WorkbookTemplatesDeleteOperationResponse, err error) { + req, err := c.preparerForWorkbookTemplatesDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "applicationinsights.ApplicationInsightsClient", "WorkbookTemplatesDelete", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "applicationinsights.ApplicationInsightsClient", "WorkbookTemplatesDelete", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForWorkbookTemplatesDelete(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "applicationinsights.ApplicationInsightsClient", "WorkbookTemplatesDelete", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForWorkbookTemplatesDelete prepares the WorkbookTemplatesDelete request. +func (c ApplicationInsightsClient) preparerForWorkbookTemplatesDelete(ctx context.Context, id WorkbookTemplateId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForWorkbookTemplatesDelete handles the response to the WorkbookTemplatesDelete request. The method always +// closes the http.Response Body. +func (c ApplicationInsightsClient) responderForWorkbookTemplatesDelete(resp *http.Response) (result WorkbookTemplatesDeleteOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), + autorest.ByClosing()) + result.HttpResponse = resp + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-11-20/applicationinsights/method_workbooktemplatesget_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-11-20/applicationinsights/method_workbooktemplatesget_autorest.go new file mode 100644 index 000000000000..f13cb1e9fb2c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-11-20/applicationinsights/method_workbooktemplatesget_autorest.go @@ -0,0 +1,67 @@ +package applicationinsights + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WorkbookTemplatesGetOperationResponse struct { + HttpResponse *http.Response + Model *WorkbookTemplate +} + +// WorkbookTemplatesGet ... +func (c ApplicationInsightsClient) WorkbookTemplatesGet(ctx context.Context, id WorkbookTemplateId) (result WorkbookTemplatesGetOperationResponse, err error) { + req, err := c.preparerForWorkbookTemplatesGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "applicationinsights.ApplicationInsightsClient", "WorkbookTemplatesGet", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "applicationinsights.ApplicationInsightsClient", "WorkbookTemplatesGet", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForWorkbookTemplatesGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "applicationinsights.ApplicationInsightsClient", "WorkbookTemplatesGet", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForWorkbookTemplatesGet prepares the WorkbookTemplatesGet request. +func (c ApplicationInsightsClient) preparerForWorkbookTemplatesGet(ctx context.Context, id WorkbookTemplateId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForWorkbookTemplatesGet handles the response to the WorkbookTemplatesGet request. The method always +// closes the http.Response Body. +func (c ApplicationInsightsClient) responderForWorkbookTemplatesGet(resp *http.Response) (result WorkbookTemplatesGetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-11-20/applicationinsights/method_workbooktemplateslistbyresourcegroup_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-11-20/applicationinsights/method_workbooktemplateslistbyresourcegroup_autorest.go new file mode 100644 index 000000000000..039b198a6bc4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-11-20/applicationinsights/method_workbooktemplateslistbyresourcegroup_autorest.go @@ -0,0 +1,69 @@ +package applicationinsights + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WorkbookTemplatesListByResourceGroupOperationResponse struct { + HttpResponse *http.Response + Model *WorkbookTemplatesListResult +} + +// WorkbookTemplatesListByResourceGroup ... +func (c ApplicationInsightsClient) WorkbookTemplatesListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (result WorkbookTemplatesListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForWorkbookTemplatesListByResourceGroup(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "applicationinsights.ApplicationInsightsClient", "WorkbookTemplatesListByResourceGroup", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "applicationinsights.ApplicationInsightsClient", "WorkbookTemplatesListByResourceGroup", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForWorkbookTemplatesListByResourceGroup(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "applicationinsights.ApplicationInsightsClient", "WorkbookTemplatesListByResourceGroup", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForWorkbookTemplatesListByResourceGroup prepares the WorkbookTemplatesListByResourceGroup request. +func (c ApplicationInsightsClient) preparerForWorkbookTemplatesListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.Insights/workbookTemplates", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForWorkbookTemplatesListByResourceGroup handles the response to the WorkbookTemplatesListByResourceGroup request. The method always +// closes the http.Response Body. +func (c ApplicationInsightsClient) responderForWorkbookTemplatesListByResourceGroup(resp *http.Response) (result WorkbookTemplatesListByResourceGroupOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-11-20/applicationinsights/method_workbooktemplatesupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-11-20/applicationinsights/method_workbooktemplatesupdate_autorest.go new file mode 100644 index 000000000000..3194faaf2ebd --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-11-20/applicationinsights/method_workbooktemplatesupdate_autorest.go @@ -0,0 +1,68 @@ +package applicationinsights + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WorkbookTemplatesUpdateOperationResponse struct { + HttpResponse *http.Response + Model *WorkbookTemplate +} + +// WorkbookTemplatesUpdate ... +func (c ApplicationInsightsClient) WorkbookTemplatesUpdate(ctx context.Context, id WorkbookTemplateId, input WorkbookTemplateUpdateParameters) (result WorkbookTemplatesUpdateOperationResponse, err error) { + req, err := c.preparerForWorkbookTemplatesUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "applicationinsights.ApplicationInsightsClient", "WorkbookTemplatesUpdate", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "applicationinsights.ApplicationInsightsClient", "WorkbookTemplatesUpdate", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForWorkbookTemplatesUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "applicationinsights.ApplicationInsightsClient", "WorkbookTemplatesUpdate", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForWorkbookTemplatesUpdate prepares the WorkbookTemplatesUpdate request. +func (c ApplicationInsightsClient) preparerForWorkbookTemplatesUpdate(ctx context.Context, id WorkbookTemplateId, input WorkbookTemplateUpdateParameters) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForWorkbookTemplatesUpdate handles the response to the WorkbookTemplatesUpdate request. The method always +// closes the http.Response Body. +func (c ApplicationInsightsClient) responderForWorkbookTemplatesUpdate(resp *http.Response) (result WorkbookTemplatesUpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-11-20/applicationinsights/model_workbooktemplate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-11-20/applicationinsights/model_workbooktemplate.go new file mode 100644 index 000000000000..a70bfa79a358 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-11-20/applicationinsights/model_workbooktemplate.go @@ -0,0 +1,13 @@ +package applicationinsights + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WorkbookTemplate struct { + Id *string `json:"id,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties *WorkbookTemplateProperties `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-11-20/applicationinsights/model_workbooktemplategallery.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-11-20/applicationinsights/model_workbooktemplategallery.go new file mode 100644 index 000000000000..4459f03c6d28 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-11-20/applicationinsights/model_workbooktemplategallery.go @@ -0,0 +1,12 @@ +package applicationinsights + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WorkbookTemplateGallery struct { + Category *string `json:"category,omitempty"` + Name *string `json:"name,omitempty"` + Order *int64 `json:"order,omitempty"` + ResourceType *string `json:"resourceType,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-11-20/applicationinsights/model_workbooktemplatelocalizedgallery.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-11-20/applicationinsights/model_workbooktemplatelocalizedgallery.go new file mode 100644 index 000000000000..ef525ea0c307 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-11-20/applicationinsights/model_workbooktemplatelocalizedgallery.go @@ -0,0 +1,9 @@ +package applicationinsights + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WorkbookTemplateLocalizedGallery struct { + Galleries *[]WorkbookTemplateGallery `json:"galleries,omitempty"` + TemplateData *interface{} `json:"templateData,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-11-20/applicationinsights/model_workbooktemplateproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-11-20/applicationinsights/model_workbooktemplateproperties.go new file mode 100644 index 000000000000..15c0eb32a94d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-11-20/applicationinsights/model_workbooktemplateproperties.go @@ -0,0 +1,12 @@ +package applicationinsights + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WorkbookTemplateProperties struct { + Author *string `json:"author,omitempty"` + Galleries []WorkbookTemplateGallery `json:"galleries"` + Localized *map[string][]WorkbookTemplateLocalizedGallery `json:"localized,omitempty"` + Priority *int64 `json:"priority,omitempty"` + TemplateData interface{} `json:"templateData"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-11-20/applicationinsights/model_workbooktemplateslistresult.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-11-20/applicationinsights/model_workbooktemplateslistresult.go new file mode 100644 index 000000000000..0acb197b2f67 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-11-20/applicationinsights/model_workbooktemplateslistresult.go @@ -0,0 +1,8 @@ +package applicationinsights + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WorkbookTemplatesListResult struct { + Value *[]WorkbookTemplate `json:"value,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-11-20/applicationinsights/model_workbooktemplateupdateparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-11-20/applicationinsights/model_workbooktemplateupdateparameters.go new file mode 100644 index 000000000000..e8a88aa86fcb --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-11-20/applicationinsights/model_workbooktemplateupdateparameters.go @@ -0,0 +1,9 @@ +package applicationinsights + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WorkbookTemplateUpdateParameters struct { + Properties *WorkbookTemplateProperties `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-11-20/applicationinsights/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-11-20/applicationinsights/version.go new file mode 100644 index 000000000000..2dc2d21c4d96 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-11-20/applicationinsights/version.go @@ -0,0 +1,12 @@ +package applicationinsights + +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-11-20" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/applicationinsights/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/method_accountscreate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/method_accountscreate_autorest.go index e3019a24589e..48d971bd0fe0 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/method_accountscreate_autorest.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/method_accountscreate_autorest.go @@ -73,6 +73,8 @@ func (c CognitiveServicesAccountsClient) senderForAccountsCreate(ctx context.Con if err != nil { return } + future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) + return } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/method_accountsdelete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/method_accountsdelete_autorest.go index 065341dc8a9b..0112f0ad4597 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/method_accountsdelete_autorest.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/method_accountsdelete_autorest.go @@ -7,6 +7,7 @@ import ( "github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/polling" ) @@ -72,6 +73,12 @@ func (c CognitiveServicesAccountsClient) senderForAccountsDelete(ctx context.Con if err != nil { return } + future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) + + if !response.WasNotFound(future.Poller.HttpResponse) { + return future, err + } + return } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/method_accountsupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/method_accountsupdate_autorest.go index e683755989d3..9b8804d2cb64 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/method_accountsupdate_autorest.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/method_accountsupdate_autorest.go @@ -73,6 +73,8 @@ func (c CognitiveServicesAccountsClient) senderForAccountsUpdate(ctx context.Con if err != nil { return } + future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) + return } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/method_deletedaccountspurge_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/method_deletedaccountspurge_autorest.go index 1d900307ecc1..386b46f2d3e7 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/method_deletedaccountspurge_autorest.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/method_deletedaccountspurge_autorest.go @@ -7,6 +7,7 @@ import ( "github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/polling" ) @@ -72,6 +73,12 @@ func (c CognitiveServicesAccountsClient) senderForDeletedAccountsPurge(ctx conte if err != nil { return } + future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) + + if !response.WasNotFound(future.Poller.HttpResponse) { + return future, err + } + return } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/communication/2020-08-20/communicationservice/method_createorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/communication/2020-08-20/communicationservice/method_createorupdate_autorest.go index a7f6ad426a26..5374104b6162 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/communication/2020-08-20/communicationservice/method_createorupdate_autorest.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/communication/2020-08-20/communicationservice/method_createorupdate_autorest.go @@ -73,6 +73,8 @@ func (c CommunicationServiceClient) senderForCreateOrUpdate(ctx context.Context, if err != nil { return } + future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) + return } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/communication/2020-08-20/communicationservice/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/communication/2020-08-20/communicationservice/method_delete_autorest.go index a104e0614cf6..1a812515baf5 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/communication/2020-08-20/communicationservice/method_delete_autorest.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/communication/2020-08-20/communicationservice/method_delete_autorest.go @@ -7,6 +7,7 @@ import ( "github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/polling" ) @@ -72,6 +73,12 @@ func (c CommunicationServiceClient) senderForDelete(ctx context.Context, req *ht if err != nil { return } + future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) + + if !response.WasNotFound(future.Poller.HttpResponse) { + return future, err + } + return } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/confidentialledger/2022-05-13/confidentialledger/method_ledgercreate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/confidentialledger/2022-05-13/confidentialledger/method_ledgercreate_autorest.go index 159793926119..5a2b91a8ac03 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/confidentialledger/2022-05-13/confidentialledger/method_ledgercreate_autorest.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/confidentialledger/2022-05-13/confidentialledger/method_ledgercreate_autorest.go @@ -73,6 +73,8 @@ func (c ConfidentialLedgerClient) senderForLedgerCreate(ctx context.Context, req if err != nil { return } + future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) + return } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/confidentialledger/2022-05-13/confidentialledger/method_ledgerdelete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/confidentialledger/2022-05-13/confidentialledger/method_ledgerdelete_autorest.go index 75776cf4a131..5856d77fa7fb 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/confidentialledger/2022-05-13/confidentialledger/method_ledgerdelete_autorest.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/confidentialledger/2022-05-13/confidentialledger/method_ledgerdelete_autorest.go @@ -7,6 +7,7 @@ import ( "github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/polling" ) @@ -72,6 +73,12 @@ func (c ConfidentialLedgerClient) senderForLedgerDelete(ctx context.Context, req if err != nil { return } + future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) + + if !response.WasNotFound(future.Poller.HttpResponse) { + return future, err + } + return } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/confidentialledger/2022-05-13/confidentialledger/method_ledgerupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/confidentialledger/2022-05-13/confidentialledger/method_ledgerupdate_autorest.go index 5ee8e6675e9c..5e7d27c4a7cd 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/confidentialledger/2022-05-13/confidentialledger/method_ledgerupdate_autorest.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/confidentialledger/2022-05-13/confidentialledger/method_ledgerupdate_autorest.go @@ -73,6 +73,8 @@ func (c ConfidentialLedgerClient) senderForLedgerUpdate(ctx context.Context, req if err != nil { return } + future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) + return } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/iotcentral/2021-11-01-preview/apps/method_createorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/iotcentral/2021-11-01-preview/apps/method_createorupdate_autorest.go index e52a100b3fb9..aa4a25ff1d78 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/iotcentral/2021-11-01-preview/apps/method_createorupdate_autorest.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/iotcentral/2021-11-01-preview/apps/method_createorupdate_autorest.go @@ -73,6 +73,8 @@ func (c AppsClient) senderForCreateOrUpdate(ctx context.Context, req *http.Reque if err != nil { return } + future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) + return } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/iotcentral/2021-11-01-preview/apps/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/iotcentral/2021-11-01-preview/apps/method_delete_autorest.go index 270ac48d5cd0..19860440ea76 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/iotcentral/2021-11-01-preview/apps/method_delete_autorest.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/iotcentral/2021-11-01-preview/apps/method_delete_autorest.go @@ -7,6 +7,7 @@ import ( "github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/polling" ) @@ -72,6 +73,12 @@ func (c AppsClient) senderForDelete(ctx context.Context, req *http.Request) (fut if err != nil { return } + future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) + + if !response.WasNotFound(future.Poller.HttpResponse) { + return future, err + } + return } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/iotcentral/2021-11-01-preview/apps/method_update_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/iotcentral/2021-11-01-preview/apps/method_update_autorest.go index 8a5d0bb1b4c2..5669080ae711 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/iotcentral/2021-11-01-preview/apps/method_update_autorest.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/iotcentral/2021-11-01-preview/apps/method_update_autorest.go @@ -73,6 +73,8 @@ func (c AppsClient) senderForUpdate(ctx context.Context, req *http.Request) (fut if err != nil { return } + future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) + return } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/namespaces/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/namespaces/method_delete_autorest.go index 9cbe0ebee73e..f0aab96c3d76 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/namespaces/method_delete_autorest.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/namespaces/method_delete_autorest.go @@ -7,6 +7,7 @@ import ( "github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/polling" ) @@ -72,6 +73,12 @@ func (c NamespacesClient) senderForDelete(ctx context.Context, req *http.Request if err != nil { return } + future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) + + if !response.WasNotFound(future.Poller.HttpResponse) { + return future, err + } + return } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/portal/2019-01-01-preview/tenantconfiguration/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/portal/2019-01-01-preview/tenantconfiguration/constants.go deleted file mode 100644 index c6cf8a346015..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/portal/2019-01-01-preview/tenantconfiguration/constants.go +++ /dev/null @@ -1,31 +0,0 @@ -package tenantconfiguration - -import "strings" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ConfigurationName string - -const ( - ConfigurationNameDefault ConfigurationName = "default" -) - -func PossibleValuesForConfigurationName() []string { - return []string{ - string(ConfigurationNameDefault), - } -} - -func parseConfigurationName(input string) (*ConfigurationName, error) { - vals := map[string]ConfigurationName{ - "default": ConfigurationNameDefault, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := ConfigurationName(input) - return &out, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/portal/2019-01-01-preview/tenantconfiguration/id_configuration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/portal/2019-01-01-preview/tenantconfiguration/id_configuration.go deleted file mode 100644 index a0f22df44787..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/portal/2019-01-01-preview/tenantconfiguration/id_configuration.go +++ /dev/null @@ -1,112 +0,0 @@ -package tenantconfiguration - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.ResourceId = ConfigurationId{} - -// ConfigurationId is a struct representing the Resource ID for a Configuration -type ConfigurationId struct { - ConfigurationName ConfigurationName -} - -// NewConfigurationID returns a new ConfigurationId struct -func NewConfigurationID(configurationName ConfigurationName) ConfigurationId { - return ConfigurationId{ - ConfigurationName: configurationName, - } -} - -// ParseConfigurationID parses 'input' into a ConfigurationId -func ParseConfigurationID(input string) (*ConfigurationId, error) { - parser := resourceids.NewParserFromResourceIdType(ConfigurationId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - id := ConfigurationId{} - - if v, ok := parsed.Parsed["configurationName"]; true { - if !ok { - return nil, fmt.Errorf("the segment 'configurationName' was not found in the resource id %q", input) - } - - configurationName, err := parseConfigurationName(v) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) - } - id.ConfigurationName = *configurationName - } - - return &id, nil -} - -// ParseConfigurationIDInsensitively parses 'input' case-insensitively into a ConfigurationId -// note: this method should only be used for API response data and not user input -func ParseConfigurationIDInsensitively(input string) (*ConfigurationId, error) { - parser := resourceids.NewParserFromResourceIdType(ConfigurationId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - id := ConfigurationId{} - - if v, ok := parsed.Parsed["configurationName"]; true { - if !ok { - return nil, fmt.Errorf("the segment 'configurationName' was not found in the resource id %q", input) - } - - configurationName, err := parseConfigurationName(v) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) - } - id.ConfigurationName = *configurationName - } - - return &id, nil -} - -// ValidateConfigurationID checks that 'input' can be parsed as a Configuration ID -func ValidateConfigurationID(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 := ParseConfigurationID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Configuration ID -func (id ConfigurationId) ID() string { - fmtString := "/providers/Microsoft.Portal/tenantConfigurations/%s" - return fmt.Sprintf(fmtString, string(id.ConfigurationName)) -} - -// Segments returns a slice of Resource ID Segments which comprise this Configuration ID -func (id ConfigurationId) Segments() []resourceids.Segment { - return []resourceids.Segment{ - resourceids.StaticSegment("staticProviders", "providers", "providers"), - resourceids.ResourceProviderSegment("staticMicrosoftPortal", "Microsoft.Portal", "Microsoft.Portal"), - resourceids.StaticSegment("staticTenantConfigurations", "tenantConfigurations", "tenantConfigurations"), - resourceids.ConstantSegment("configurationName", PossibleValuesForConfigurationName(), "default"), - } -} - -// String returns a human-readable description of this Configuration ID -func (id ConfigurationId) String() string { - components := []string{ - fmt.Sprintf("Configuration Name: %q", string(id.ConfigurationName)), - } - return fmt.Sprintf("Configuration (%s)", strings.Join(components, "\n")) -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/portal/2019-01-01-preview/tenantconfiguration/method_tenantconfigurationscreate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/portal/2019-01-01-preview/tenantconfiguration/method_tenantconfigurationscreate_autorest.go index f261c92147bb..8d9a936f255b 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/portal/2019-01-01-preview/tenantconfiguration/method_tenantconfigurationscreate_autorest.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/portal/2019-01-01-preview/tenantconfiguration/method_tenantconfigurationscreate_autorest.go @@ -17,8 +17,8 @@ type TenantConfigurationsCreateOperationResponse struct { } // TenantConfigurationsCreate ... -func (c TenantConfigurationClient) TenantConfigurationsCreate(ctx context.Context, id ConfigurationId, input Configuration) (result TenantConfigurationsCreateOperationResponse, err error) { - req, err := c.preparerForTenantConfigurationsCreate(ctx, id, input) +func (c TenantConfigurationClient) TenantConfigurationsCreate(ctx context.Context, input Configuration) (result TenantConfigurationsCreateOperationResponse, err error) { + req, err := c.preparerForTenantConfigurationsCreate(ctx, input) if err != nil { err = autorest.NewErrorWithError(err, "tenantconfiguration.TenantConfigurationClient", "TenantConfigurationsCreate", nil, "Failure preparing request") return @@ -40,7 +40,7 @@ func (c TenantConfigurationClient) TenantConfigurationsCreate(ctx context.Contex } // preparerForTenantConfigurationsCreate prepares the TenantConfigurationsCreate request. -func (c TenantConfigurationClient) preparerForTenantConfigurationsCreate(ctx context.Context, id ConfigurationId, input Configuration) (*http.Request, error) { +func (c TenantConfigurationClient) preparerForTenantConfigurationsCreate(ctx context.Context, input Configuration) (*http.Request, error) { queryParameters := map[string]interface{}{ "api-version": defaultApiVersion, } @@ -49,7 +49,7 @@ func (c TenantConfigurationClient) preparerForTenantConfigurationsCreate(ctx con autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPut(), autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), + autorest.WithPath("/providers/Microsoft.Portal/tenantConfigurations/default"), autorest.WithJSON(input), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/portal/2019-01-01-preview/tenantconfiguration/method_tenantconfigurationsdelete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/portal/2019-01-01-preview/tenantconfiguration/method_tenantconfigurationsdelete_autorest.go index aa37b23f8a40..e4f1837a0f34 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/portal/2019-01-01-preview/tenantconfiguration/method_tenantconfigurationsdelete_autorest.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/portal/2019-01-01-preview/tenantconfiguration/method_tenantconfigurationsdelete_autorest.go @@ -16,8 +16,8 @@ type TenantConfigurationsDeleteOperationResponse struct { } // TenantConfigurationsDelete ... -func (c TenantConfigurationClient) TenantConfigurationsDelete(ctx context.Context, id ConfigurationId) (result TenantConfigurationsDeleteOperationResponse, err error) { - req, err := c.preparerForTenantConfigurationsDelete(ctx, id) +func (c TenantConfigurationClient) TenantConfigurationsDelete(ctx context.Context) (result TenantConfigurationsDeleteOperationResponse, err error) { + req, err := c.preparerForTenantConfigurationsDelete(ctx) if err != nil { err = autorest.NewErrorWithError(err, "tenantconfiguration.TenantConfigurationClient", "TenantConfigurationsDelete", nil, "Failure preparing request") return @@ -39,7 +39,7 @@ func (c TenantConfigurationClient) TenantConfigurationsDelete(ctx context.Contex } // preparerForTenantConfigurationsDelete prepares the TenantConfigurationsDelete request. -func (c TenantConfigurationClient) preparerForTenantConfigurationsDelete(ctx context.Context, id ConfigurationId) (*http.Request, error) { +func (c TenantConfigurationClient) preparerForTenantConfigurationsDelete(ctx context.Context) (*http.Request, error) { queryParameters := map[string]interface{}{ "api-version": defaultApiVersion, } @@ -48,7 +48,7 @@ func (c TenantConfigurationClient) preparerForTenantConfigurationsDelete(ctx con autorest.AsContentType("application/json; charset=utf-8"), autorest.AsDelete(), autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), + autorest.WithPath("/providers/Microsoft.Portal/tenantConfigurations/default"), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/portal/2019-01-01-preview/tenantconfiguration/method_tenantconfigurationsget_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/portal/2019-01-01-preview/tenantconfiguration/method_tenantconfigurationsget_autorest.go index 2c78aec4b930..2b6a381dcf61 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/portal/2019-01-01-preview/tenantconfiguration/method_tenantconfigurationsget_autorest.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/portal/2019-01-01-preview/tenantconfiguration/method_tenantconfigurationsget_autorest.go @@ -17,8 +17,8 @@ type TenantConfigurationsGetOperationResponse struct { } // TenantConfigurationsGet ... -func (c TenantConfigurationClient) TenantConfigurationsGet(ctx context.Context, id ConfigurationId) (result TenantConfigurationsGetOperationResponse, err error) { - req, err := c.preparerForTenantConfigurationsGet(ctx, id) +func (c TenantConfigurationClient) TenantConfigurationsGet(ctx context.Context) (result TenantConfigurationsGetOperationResponse, err error) { + req, err := c.preparerForTenantConfigurationsGet(ctx) if err != nil { err = autorest.NewErrorWithError(err, "tenantconfiguration.TenantConfigurationClient", "TenantConfigurationsGet", nil, "Failure preparing request") return @@ -40,7 +40,7 @@ func (c TenantConfigurationClient) TenantConfigurationsGet(ctx context.Context, } // preparerForTenantConfigurationsGet prepares the TenantConfigurationsGet request. -func (c TenantConfigurationClient) preparerForTenantConfigurationsGet(ctx context.Context, id ConfigurationId) (*http.Request, error) { +func (c TenantConfigurationClient) preparerForTenantConfigurationsGet(ctx context.Context) (*http.Request, error) { queryParameters := map[string]interface{}{ "api-version": defaultApiVersion, } @@ -49,7 +49,7 @@ func (c TenantConfigurationClient) preparerForTenantConfigurationsGet(ctx contex autorest.AsContentType("application/json; charset=utf-8"), autorest.AsGet(), autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), + autorest.WithPath("/providers/Microsoft.Portal/tenantConfigurations/default"), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/method_createorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/method_createorupdate_autorest.go index 70d43a74af24..9aa6bae4be17 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/method_createorupdate_autorest.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/method_createorupdate_autorest.go @@ -73,6 +73,8 @@ func (c ManagedClusterClient) senderForCreateOrUpdate(ctx context.Context, req * if err != nil { return } + future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) + return } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/method_delete_autorest.go index ea00893285d3..23d69c887414 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/method_delete_autorest.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/method_delete_autorest.go @@ -7,6 +7,7 @@ import ( "github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/polling" ) @@ -72,6 +73,12 @@ func (c ManagedClusterClient) senderForDelete(ctx context.Context, req *http.Req if err != nil { return } + future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) + + if !response.WasNotFound(future.Poller.HttpResponse) { + return future, err + } + return } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/method_createorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/method_createorupdate_autorest.go index e5e001375afd..7ad9c6707289 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/method_createorupdate_autorest.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/method_createorupdate_autorest.go @@ -73,6 +73,8 @@ func (c NodeTypeClient) senderForCreateOrUpdate(ctx context.Context, req *http.R if err != nil { return } + future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) + return } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/method_delete_autorest.go index ea5437219af3..2f0f2b4700a3 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/method_delete_autorest.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/method_delete_autorest.go @@ -7,6 +7,7 @@ import ( "github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/polling" ) @@ -72,6 +73,12 @@ func (c NodeTypeClient) senderForDelete(ctx context.Context, req *http.Request) if err != nil { return } + future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) + + if !response.WasNotFound(future.Poller.HttpResponse) { + return future, err + } + return } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/method_deletenode_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/method_deletenode_autorest.go index 5be8e585748e..e37b6efd747e 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/method_deletenode_autorest.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/method_deletenode_autorest.go @@ -73,6 +73,8 @@ func (c NodeTypeClient) senderForDeleteNode(ctx context.Context, req *http.Reque if err != nil { return } + future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) + return } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/method_reimage_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/method_reimage_autorest.go index 04eeaf142b0b..b0a83965f69f 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/method_reimage_autorest.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/method_reimage_autorest.go @@ -73,6 +73,8 @@ func (c NodeTypeClient) senderForReimage(ctx context.Context, req *http.Request) if err != nil { return } + future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) + return } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/method_restart_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/method_restart_autorest.go index 134745e712e4..51aa5c0afd7e 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/method_restart_autorest.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/method_restart_autorest.go @@ -73,6 +73,8 @@ func (c NodeTypeClient) senderForRestart(ctx context.Context, req *http.Request) if err != nil { return } + future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) + return } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/authorizations/method_createorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/authorizations/method_createorupdate_autorest.go index b4ee78702a1f..17aa439150ff 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/authorizations/method_createorupdate_autorest.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/authorizations/method_createorupdate_autorest.go @@ -73,6 +73,8 @@ func (c AuthorizationsClient) senderForCreateOrUpdate(ctx context.Context, req * if err != nil { return } + future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) + return } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/authorizations/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/authorizations/method_delete_autorest.go index 2f1c6dcb7bf3..c8a6e7886c0a 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/authorizations/method_delete_autorest.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/authorizations/method_delete_autorest.go @@ -7,6 +7,7 @@ import ( "github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/polling" ) @@ -72,6 +73,12 @@ func (c AuthorizationsClient) senderForDelete(ctx context.Context, req *http.Req if err != nil { return } + future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) + + if !response.WasNotFound(future.Poller.HttpResponse) { + return future, err + } + return } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/clusters/method_createorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/clusters/method_createorupdate_autorest.go index 28527b2ce65e..5e0987631806 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/clusters/method_createorupdate_autorest.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/clusters/method_createorupdate_autorest.go @@ -73,6 +73,8 @@ func (c ClustersClient) senderForCreateOrUpdate(ctx context.Context, req *http.R if err != nil { return } + future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) + return } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/clusters/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/clusters/method_delete_autorest.go index b81a6a0d8e87..59eaa0bb6bab 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/clusters/method_delete_autorest.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/clusters/method_delete_autorest.go @@ -7,6 +7,7 @@ import ( "github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/polling" ) @@ -72,6 +73,12 @@ func (c ClustersClient) senderForDelete(ctx context.Context, req *http.Request) if err != nil { return } + future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) + + if !response.WasNotFound(future.Poller.HttpResponse) { + return future, err + } + return } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/clusters/method_update_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/clusters/method_update_autorest.go index 170e4948f20b..6e9c6997fa8c 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/clusters/method_update_autorest.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/clusters/method_update_autorest.go @@ -73,6 +73,8 @@ func (c ClustersClient) senderForUpdate(ctx context.Context, req *http.Request) if err != nil { return } + future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) + return } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/method_createorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/method_createorupdate_autorest.go index 6499ab5f8821..3b62db48bedc 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/method_createorupdate_autorest.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/method_createorupdate_autorest.go @@ -73,6 +73,8 @@ func (c PrivateCloudsClient) senderForCreateOrUpdate(ctx context.Context, req *h if err != nil { return } + future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) + return } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/method_delete_autorest.go index fe3bb701cafe..aca5b618a27b 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/method_delete_autorest.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/method_delete_autorest.go @@ -7,6 +7,7 @@ import ( "github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/polling" ) @@ -72,6 +73,12 @@ func (c PrivateCloudsClient) senderForDelete(ctx context.Context, req *http.Requ if err != nil { return } + future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) + + if !response.WasNotFound(future.Poller.HttpResponse) { + return future, err + } + return } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/method_update_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/method_update_autorest.go index 95c9d835b1a4..11241b2f7202 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/method_update_autorest.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/method_update_autorest.go @@ -73,6 +73,8 @@ func (c PrivateCloudsClient) senderForUpdate(ctx context.Context, req *http.Requ if err != nil { return } + future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) + return } diff --git a/vendor/modules.txt b/vendor/modules.txt index e6d14bdcb263..4b0407751ab0 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -211,11 +211,12 @@ github.com/hashicorp/go-azure-helpers/resourcemanager/zones github.com/hashicorp/go-azure-helpers/resourceproviders github.com/hashicorp/go-azure-helpers/sender github.com/hashicorp/go-azure-helpers/storage -# github.com/hashicorp/go-azure-sdk v0.20220623.1064317 +# github.com/hashicorp/go-azure-sdk v0.20220627.1102220 ## explicit; go 1.18 github.com/hashicorp/go-azure-sdk/resource-manager/aadb2c/2021-04-01-preview/tenants github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2020-06-01/configurationstores +github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-11-20/applicationinsights github.com/hashicorp/go-azure-sdk/resource-manager/attestation/2020-10-01/attestationproviders github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts github.com/hashicorp/go-azure-sdk/resource-manager/communication/2020-08-20/communicationservice From 7a2bb36031c06a433d1c7b9abea41da4ed7772d6 Mon Sep 17 00:00:00 2001 From: Zhenhua Hu Date: Wed, 29 Jun 2022 14:58:39 +0800 Subject: [PATCH 2/6] update --- ...ion_insights_workbook_template_resource.go | 39 ++++--- ...nsights_workbook_template_resource_test.go | 25 +++-- ...n_insights_workbook_template.html.markdown | 100 ++++++++++++++++++ 3 files changed, 138 insertions(+), 26 deletions(-) create mode 100644 website/docs/r/application_insights_workbook_template.html.markdown diff --git a/internal/services/applicationinsights/application_insights_workbook_template_resource.go b/internal/services/applicationinsights/application_insights_workbook_template_resource.go index 7c2e30fafcb8..cd6cbdb0fd45 100644 --- a/internal/services/applicationinsights/application_insights_workbook_template_resource.go +++ b/internal/services/applicationinsights/application_insights_workbook_template_resource.go @@ -28,8 +28,8 @@ type ApplicationInsightsWorkbookTemplateModel struct { } type WorkbookTemplateGalleryModel struct { - Category string `tfschema:"category"` Name string `tfschema:"name"` + Category string `tfschema:"category"` Order int64 `tfschema:"order"` ResourceType string `tfschema:"resource_type"` Type string `tfschema:"type"` @@ -62,64 +62,69 @@ func (r ApplicationInsightsWorkbookTemplateResource) Arguments() map[string]*plu "resource_group_name": commonschema.ResourceGroupName(), - "author": { - Type: pluginsdk.TypeString, - Optional: true, - ValidateFunc: validation.StringIsNotEmpty, + "location": commonschema.Location(), + + "template_data": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringIsJSON, + DiffSuppressFunc: pluginsdk.SuppressJsonDiff, }, "galleries": { Type: pluginsdk.TypeList, Required: true, + MinItems: 1, Elem: &pluginsdk.Resource{ Schema: map[string]*pluginsdk.Schema{ - "category": { + "name": { Type: pluginsdk.TypeString, - Optional: true, + Required: true, ValidateFunc: validation.StringIsNotEmpty, }, - "name": { + "category": { Type: pluginsdk.TypeString, - Optional: true, + Required: true, ValidateFunc: validation.StringIsNotEmpty, }, "order": { Type: pluginsdk.TypeInt, Optional: true, + Default: 0, }, "resource_type": { Type: pluginsdk.TypeString, Optional: true, ValidateFunc: validation.StringIsNotEmpty, + Default: "Azure Monitor", }, "type": { Type: pluginsdk.TypeString, Optional: true, ValidateFunc: validation.StringIsNotEmpty, + Default: "workbook", }, }, }, }, - "location": commonschema.Location(), + "author": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: validation.StringIsNotEmpty, + }, "priority": { Type: pluginsdk.TypeInt, Optional: true, + Default: 0, }, "tags": commonschema.Tags(), - - "template_data": { - Type: pluginsdk.TypeString, - Required: true, - ValidateFunc: validation.StringIsJSON, - DiffSuppressFunc: pluginsdk.SuppressJsonDiff, - }, } } diff --git a/internal/services/applicationinsights/application_insights_workbook_template_resource_test.go b/internal/services/applicationinsights/application_insights_workbook_template_resource_test.go index 4a9714ae79ec..70561cae9de1 100644 --- a/internal/services/applicationinsights/application_insights_workbook_template_resource_test.go +++ b/internal/services/applicationinsights/application_insights_workbook_template_resource_test.go @@ -119,15 +119,25 @@ resource "azurerm_application_insights_workbook_template" "test" { name = "acctest-aiwt-%d" resource_group_name = azurerm_resource_group.test.name location = "%s" + galleries { - category = "" - name = "" - order = 0 - resource_type = "" - type = "" + category = "workbook" + name = "test" } + template_data = jsonencode({ - "key" = "value" + "version": "Notebook/1.0", + "items": [ + { + "type": 1, + "content": { + "json": "## New workbook\n---\n\nWelcome to your new workbook." + }, + "name": "text - 2" + } + ], + "styleSettings": {}, + "$schema": "https://github.com/Microsoft/Application-Insights-Workbooks/blob/master/schema/workbook.json" }) } `, template, data.RandomInteger, data.Locations.Primary) @@ -167,7 +177,6 @@ resource "azurerm_application_insights_workbook_template" "test" { location = "%s" author = "" priority = 0 - galleries { category = "" name = "" @@ -175,11 +184,9 @@ resource "azurerm_application_insights_workbook_template" "test" { resource_type = "" type = "" } - template_data = jsonencode({ "key" = "value" }) - tags = { key = "value" } diff --git a/website/docs/r/application_insights_workbook_template.html.markdown b/website/docs/r/application_insights_workbook_template.html.markdown new file mode 100644 index 000000000000..7546c4e4c6f1 --- /dev/null +++ b/website/docs/r/application_insights_workbook_template.html.markdown @@ -0,0 +1,100 @@ +--- +subcategory: "Application Insights" +layout: "azurerm" +page_title: "Azure Resource Manager: azurerm_application_insights_workbook_template" +description: |- + Manages an Application Insights Workbook Templates. +--- + +# azurerm_application_insights_workbook_template + +Manages an Application Insights Workbook Templates. + +## Example Usage + +```hcl +resource "azurerm_resource_group" "example" { + name = "example-resources" + location = "West Europe" +} + +resource "azurerm_application_insights_workbook_template" "example" { + name = "example-aiwt" + resource_group_name = azurerm_resource_group.example.name + location = "West Europe" + author = "" + priority = 0 + galleries { + category = "" + name = "" + order = 0 + resource_type = "" + type = "" + } + template_data = jsonencode({ + "key" = "value" + }) + tags = { + key = "value" + } +} +``` + +## Arguments Reference + +The following arguments are supported: + +* `name` - (Required) Specifies the name which should be used for this Application Insights Workbook Templates. Changing this forces a new Application Insights Workbook Templates to be created. + +* `resource_group_name` - (Required) Specifies the name of the Resource Group where the Application Insights Workbook Templates should exist. Changing this forces a new Application Insights Workbook Templates to be created. + +* `galleries` - (Required) A `galleries` block as defined below. + +* `location` - (Required) Specifies the Azure Region where the Application Insights Workbook Templates should exist. Changing this forces a new Application Insights Workbook Templates to be created. + +* `template_data` - (Required) Valid JSON object containing workbook template payload. + +* `author` - (Optional) Information about the author of the workbook template. + +* `priority` - (Optional) Priority of the template. Determines which template to open when a workbook gallery is opened in viewer mode. Defaults to 0. + +* `tags` - (Optional) A mapping of tags which should be assigned to the Application Insights Workbook Templates. + +--- + +A `galleries` block supports the following: + +* `name` - (Required) Name of the workbook template in the gallery. + +* `category` - (Required) Category for the gallery. + +* `order` - (Optional) Order of the template within the gallery. Defaults to `0`. + +* `resource_type` - (Optional) Azure resource type supported by the gallery. Defaults to `Azure Monitor`. + +* `type` - (Optional) Type of workbook supported by the workbook template. Defaults to `workbook`. + +~> **Note:** See [documentation](https://docs.microsoft.com/en-us/azure/azure-monitor/visualize/workbooks-automate#galleries) for more information of `resource_type` and `type`. + +## Attributes Reference + +In addition to the Arguments listed above - the following Attributes are exported: + +* `id` - The ID of the Application Insights Workbook Templates. + +## Timeouts + +The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/docs/configuration/resources.html#timeouts) for certain actions: + +* `create` - (Defaults to 30 minutes) Used when creating the Application Insights Workbook Templates. +* `read` - (Defaults to 5 minutes) Used when retrieving the Application Insights Workbook Templates. +* `update` - (Defaults to 30 minutes) Used when updating the Application Insights Workbook Templates. +* `delete` - (Defaults to 30 minutes) Used when deleting the Application Insights Workbook Templates. + +## Import + +Application Insights Workbook Templates can be imported using the `resource id`, e.g. + +```shell +terraform import azurerm_application_insights_workbook_template.example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourceGroup1/providers/Microsoft.Insights/workbooktemplates/resource1 +``` From 071bc039d19aad6edef394619af71547f16c6eca Mon Sep 17 00:00:00 2001 From: Zhenhua Hu Date: Wed, 29 Jun 2022 15:05:18 +0800 Subject: [PATCH 3/6] update --- ...ion_insights_workbook_template_resource.go | 37 +++- ...nsights_workbook_template_resource_test.go | 178 ++++++++++++++---- .../tenants/method_create_autorest.go | 1 - .../tenants/method_delete_autorest.go | 6 - .../servers/method_create_autorest.go | 1 - .../servers/method_delete_autorest.go | 6 - .../servers/method_resume_autorest.go | 1 - .../servers/method_suspend_autorest.go | 1 - .../servers/method_update_autorest.go | 1 - .../method_create_autorest.go | 1 - .../method_delete_autorest.go | 6 - .../method_update_autorest.go | 1 - .../2020-11-20/applicationinsights/README.md | 108 +++++++++++ .../method_accountscreate_autorest.go | 1 - .../method_accountsdelete_autorest.go | 6 - .../method_accountsupdate_autorest.go | 1 - .../method_deletedaccountspurge_autorest.go | 6 - .../method_createorupdate_autorest.go | 1 - .../method_delete_autorest.go | 6 - .../method_ledgercreate_autorest.go | 1 - .../method_ledgerdelete_autorest.go | 6 - .../method_ledgerupdate_autorest.go | 1 - .../apps/method_createorupdate_autorest.go | 1 - .../apps/method_delete_autorest.go | 6 - .../apps/method_update_autorest.go | 1 - .../namespaces/method_delete_autorest.go | 6 - .../method_createorupdate_autorest.go | 1 - .../managedcluster/method_delete_autorest.go | 6 - .../method_createorupdate_autorest.go | 1 - .../nodetype/method_delete_autorest.go | 6 - .../nodetype/method_deletenode_autorest.go | 1 - .../nodetype/method_reimage_autorest.go | 1 - .../nodetype/method_restart_autorest.go | 1 - .../method_createorupdate_autorest.go | 1 - .../authorizations/method_delete_autorest.go | 6 - .../method_createorupdate_autorest.go | 1 - .../clusters/method_delete_autorest.go | 6 - .../clusters/method_update_autorest.go | 1 - .../method_createorupdate_autorest.go | 1 - .../privateclouds/method_delete_autorest.go | 6 - .../privateclouds/method_update_autorest.go | 1 - vendor/modules.txt | 1 + ...n_insights_workbook_template.html.markdown | 88 ++++++--- 43 files changed, 350 insertions(+), 170 deletions(-) create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-11-20/applicationinsights/README.md diff --git a/internal/services/applicationinsights/application_insights_workbook_template_resource.go b/internal/services/applicationinsights/application_insights_workbook_template_resource.go index cd6cbdb0fd45..57ae7639ffcd 100644 --- a/internal/services/applicationinsights/application_insights_workbook_template_resource.go +++ b/internal/services/applicationinsights/application_insights_workbook_template_resource.go @@ -21,6 +21,7 @@ type ApplicationInsightsWorkbookTemplateModel struct { ResourceGroupName string `tfschema:"resource_group_name"` Author string `tfschema:"author"` Galleries []WorkbookTemplateGalleryModel `tfschema:"galleries"` + Localized string `tfschema:"localized"` Location string `tfschema:"location"` Priority int64 `tfschema:"priority"` Tags map[string]string `tfschema:"tags"` @@ -118,6 +119,12 @@ func (r ApplicationInsightsWorkbookTemplateResource) Arguments() map[string]*plu ValidateFunc: validation.StringIsNotEmpty, }, + "localized": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + "priority": { Type: pluginsdk.TypeInt, Optional: true, @@ -165,6 +172,7 @@ func (r ApplicationInsightsWorkbookTemplateResource) Create() sdk.ResourceFunc { Priority: &model.Priority, TemplateData: templateDataValue, }, + Tags: &model.Tags, } @@ -172,6 +180,15 @@ func (r ApplicationInsightsWorkbookTemplateResource) Create() sdk.ResourceFunc { properties.Properties.Author = &model.Author } + if model.Localized != "" { + var localizedValue map[string][]applicationinsights.WorkbookTemplateLocalizedGallery + if err := json.Unmarshal([]byte(model.Localized), &localizedValue); err != nil { + return err + } + + properties.Properties.Localized = &localizedValue + } + galleriesValue, err := expandWorkbookTemplateGalleryModel(model.Galleries) if err != nil { return err @@ -246,6 +263,15 @@ func (r ApplicationInsightsWorkbookTemplateResource) Update() sdk.ResourceFunc { properties.Properties.TemplateData = templateDataValue } + if metadata.ResourceData.HasChange("localized") { + var localizedValue map[string][]applicationinsights.WorkbookTemplateLocalizedGallery + if err := json.Unmarshal([]byte(model.Localized), &localizedValue); err != nil { + return err + } + + properties.Properties.Localized = &localizedValue + } + if metadata.ResourceData.HasChange("tags") { properties.Tags = &model.Tags } @@ -307,7 +333,6 @@ func (r ApplicationInsightsWorkbookTemplateResource) Read() sdk.ResourceFunc { } if properties.TemplateData != nil { - templateDataValue, err := json.Marshal(properties.TemplateData) if err != nil { return err @@ -315,7 +340,17 @@ func (r ApplicationInsightsWorkbookTemplateResource) Read() sdk.ResourceFunc { state.TemplateData = string(templateDataValue) } + + if properties.Localized != nil { + localizedValue, err := json.Marshal(properties.Localized) + if err != nil { + return err + } + + state.Localized = string(localizedValue) + } } + if model.Tags != nil { state.Tags = *model.Tags } diff --git a/internal/services/applicationinsights/application_insights_workbook_template_resource_test.go b/internal/services/applicationinsights/application_insights_workbook_template_resource_test.go index 70561cae9de1..81fa6eaacdf3 100644 --- a/internal/services/applicationinsights/application_insights_workbook_template_resource_test.go +++ b/internal/services/applicationinsights/application_insights_workbook_template_resource_test.go @@ -121,23 +121,23 @@ resource "azurerm_application_insights_workbook_template" "test" { location = "%s" galleries { - category = "workbook" - name = "test" + category = "workbook" + name = "test" } template_data = jsonencode({ - "version": "Notebook/1.0", - "items": [ - { - "type": 1, - "content": { - "json": "## New workbook\n---\n\nWelcome to your new workbook." - }, - "name": "text - 2" - } - ], - "styleSettings": {}, - "$schema": "https://github.com/Microsoft/Application-Insights-Workbooks/blob/master/schema/workbook.json" + "version" : "Notebook/1.0", + "items" : [ + { + "type" : 1, + "content" : { + "json" : "## New workbook\n---\n\nWelcome to your new workbook." + }, + "name" : "text - 2" + } + ], + "styleSettings" : {}, + "$schema" : "https://github.com/Microsoft/Application-Insights-Workbooks/blob/master/schema/workbook.json" }) } `, template, data.RandomInteger, data.Locations.Primary) @@ -150,20 +150,30 @@ func (r ApplicationInsightsWorkbookTemplateResource) requiresImport(data accepta resource "azurerm_application_insights_workbook_template" "import" { name = azurerm_application_insights_workbook_template.test.name - resource_group_name = azurerm_resource_group.test.name - location = "%s" + resource_group_name = azurerm_application_insights_workbook_template.test.resource_group_name + location = azurerm_application_insights_workbook_template.test.location + galleries { - category = "" - name = "" - order = 0 - resource_type = "" - type = "" + category = "workbook" + name = "test" } + template_data = jsonencode({ - "key" = "value" + "version" : "Notebook/1.0", + "items" : [ + { + "type" : 1, + "content" : { + "json" : "## New workbook\n---\n\nWelcome to your new workbook." + }, + "name" : "text - 2" + } + ], + "styleSettings" : {}, + "$schema" : "https://github.com/Microsoft/Application-Insights-Workbooks/blob/master/schema/workbook.json" }) } -`, config, data.Locations.Primary) +`, config) } func (r ApplicationInsightsWorkbookTemplateResource) complete(data acceptance.TestData) string { @@ -175,18 +185,62 @@ resource "azurerm_application_insights_workbook_template" "test" { name = "acctest-aiwt-%d" resource_group_name = azurerm_resource_group.test.name location = "%s" - author = "" - priority = 0 + author = "test author" + priority = 1 + galleries { - category = "" - name = "" - order = 0 - resource_type = "" - type = "" + category = "Failures" + name = "test" + order = 100 + resource_type = "microsoft.insights/components" + type = "tsg" } + template_data = jsonencode({ - "key" = "value" + "version" : "Notebook/1.0", + "items" : [ + { + "type" : 1, + "content" : { + "json" : "## New workbook\n---\n\nWelcome to your new workbook." + }, + "name" : "text - 2" + } + ], + "styleSettings" : {}, + "$schema" : "https://github.com/Microsoft/Application-Insights-Workbooks/blob/master/schema/workbook.json" }) + + localized = jsonencode({ + "ar" : [ + { + "galleries" : [ + { + "name" : "test", + "category" : "Failures", + "type" : "tsg", + "resourceType" : "microsoft.insights/components", + "order" : 100 + } + ], + "templateData" : { + "version" : "Notebook/1.0", + "items" : [ + { + "type" : 1, + "content" : { + "json" : "## New workbook\n---\n\nWelcome to your new workbook." + }, + "name" : "text - 2" + } + ], + "styleSettings" : {}, + "$schema" : "https://github.com/Microsoft/Application-Insights-Workbooks/blob/master/schema/workbook.json" + }, + } + ] + }) + tags = { key = "value" } @@ -203,20 +257,64 @@ resource "azurerm_application_insights_workbook_template" "test" { name = "acctest-aiwt-%d" resource_group_name = azurerm_resource_group.test.name location = "%s" - author = "" - priority = 0 + author = "test author 2" + priority = 2 + galleries { - category = "" - name = "" - order = 0 - resource_type = "" - type = "" + category = "workbook" + name = "test2" + order = 200 + resource_type = "Azure Monitor" + type = "workbook" } + template_data = jsonencode({ - "key" = "value" + "version" : "Notebook/1.0", + "items" : [ + { + "type" : 2, + "content" : { + "json" : "## New workbook\n---\n\nWelcome to your new workbook." + }, + "name" : "text - 2" + } + ], + "styleSettings" : {}, + "$schema" : "https://github.com/Microsoft/Application-Insights-Workbooks/blob/master/schema/workbook.json" }) + + localized = jsonencode({ + "en-US" : [ + { + "galleries" : [ + { + "name" : "test2", + "category" : "workbook", + "type" : "workbook", + "resourceType" : "Azure Monitor", + "order" : 200 + } + ], + "templateData" : { + "version" : "Notebook/1.0", + "items" : [ + { + "type" : 2, + "content" : { + "json" : "## New workbook\n---\n\nWelcome to your new workbook." + }, + "name" : "text - 2" + } + ], + "styleSettings" : {}, + "$schema" : "https://github.com/Microsoft/Application-Insights-Workbooks/blob/master/schema/workbook.json" + }, + } + ] + }) + tags = { - key = "value" + key = "value2" } } `, template, data.RandomInteger, data.Locations.Primary) diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aadb2c/2021-04-01-preview/tenants/method_create_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aadb2c/2021-04-01-preview/tenants/method_create_autorest.go index 5084db30761c..c72de3efe174 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aadb2c/2021-04-01-preview/tenants/method_create_autorest.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aadb2c/2021-04-01-preview/tenants/method_create_autorest.go @@ -75,6 +75,5 @@ func (c TenantsClient) senderForCreate(ctx context.Context, req *http.Request) ( } future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) - return } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aadb2c/2021-04-01-preview/tenants/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aadb2c/2021-04-01-preview/tenants/method_delete_autorest.go index 5335f208edaf..0106a1bab129 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aadb2c/2021-04-01-preview/tenants/method_delete_autorest.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aadb2c/2021-04-01-preview/tenants/method_delete_autorest.go @@ -7,7 +7,6 @@ import ( "github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/polling" ) @@ -75,10 +74,5 @@ func (c TenantsClient) senderForDelete(ctx context.Context, req *http.Request) ( } future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) - - if !response.WasNotFound(future.Poller.HttpResponse) { - return future, err - } - return } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/method_create_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/method_create_autorest.go index 100cce6899e5..054c9e9e70d4 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/method_create_autorest.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/method_create_autorest.go @@ -75,6 +75,5 @@ func (c ServersClient) senderForCreate(ctx context.Context, req *http.Request) ( } future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) - return } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/method_delete_autorest.go index 7b2120ab13ff..381ce68df819 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/method_delete_autorest.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/method_delete_autorest.go @@ -7,7 +7,6 @@ import ( "github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/polling" ) @@ -75,10 +74,5 @@ func (c ServersClient) senderForDelete(ctx context.Context, req *http.Request) ( } future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) - - if !response.WasNotFound(future.Poller.HttpResponse) { - return future, err - } - return } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/method_resume_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/method_resume_autorest.go index b5840faca296..ea0cfc658756 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/method_resume_autorest.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/method_resume_autorest.go @@ -74,6 +74,5 @@ func (c ServersClient) senderForResume(ctx context.Context, req *http.Request) ( } future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) - return } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/method_suspend_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/method_suspend_autorest.go index 3668045ad6cd..b4b5f6b512f6 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/method_suspend_autorest.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/method_suspend_autorest.go @@ -74,6 +74,5 @@ func (c ServersClient) senderForSuspend(ctx context.Context, req *http.Request) } future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) - return } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/method_update_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/method_update_autorest.go index e6455d323936..cc56502ba53b 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/method_update_autorest.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/method_update_autorest.go @@ -75,6 +75,5 @@ func (c ServersClient) senderForUpdate(ctx context.Context, req *http.Request) ( } future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) - return } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2020-06-01/configurationstores/method_create_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2020-06-01/configurationstores/method_create_autorest.go index e0ef50dc4672..2acc9286913d 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2020-06-01/configurationstores/method_create_autorest.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2020-06-01/configurationstores/method_create_autorest.go @@ -75,6 +75,5 @@ func (c ConfigurationStoresClient) senderForCreate(ctx context.Context, req *htt } future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) - return } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2020-06-01/configurationstores/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2020-06-01/configurationstores/method_delete_autorest.go index 037a23f7759b..c410409febb7 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2020-06-01/configurationstores/method_delete_autorest.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2020-06-01/configurationstores/method_delete_autorest.go @@ -7,7 +7,6 @@ import ( "github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/polling" ) @@ -75,10 +74,5 @@ func (c ConfigurationStoresClient) senderForDelete(ctx context.Context, req *htt } future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) - - if !response.WasNotFound(future.Poller.HttpResponse) { - return future, err - } - return } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2020-06-01/configurationstores/method_update_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2020-06-01/configurationstores/method_update_autorest.go index 9989e703ff9b..c58a47162039 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2020-06-01/configurationstores/method_update_autorest.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2020-06-01/configurationstores/method_update_autorest.go @@ -75,6 +75,5 @@ func (c ConfigurationStoresClient) senderForUpdate(ctx context.Context, req *htt } future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) - return } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-11-20/applicationinsights/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-11-20/applicationinsights/README.md new file mode 100644 index 000000000000..e4e502d820fd --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-11-20/applicationinsights/README.md @@ -0,0 +1,108 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-11-20/applicationinsights` Documentation + +The `applicationinsights` SDK allows for interaction with the Azure Resource Manager Service `applicationinsights` (API Version `2020-11-20`). + +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/2020-11-20/applicationinsights" +``` + + +### Client Initialization + +```go +client := applicationinsights.NewApplicationInsightsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +if err != nil { + // handle the error +} +``` + + +### Example Usage: `ApplicationInsightsClient.WorkbookTemplatesCreateOrUpdate` + +```go +ctx := context.TODO() +id := applicationinsights.NewWorkbookTemplateID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue") + +payload := applicationinsights.WorkbookTemplate{ + // ... +} + +read, err := client.WorkbookTemplatesCreateOrUpdate(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ApplicationInsightsClient.WorkbookTemplatesDelete` + +```go +ctx := context.TODO() +id := applicationinsights.NewWorkbookTemplateID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue") +read, err := client.WorkbookTemplatesDelete(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ApplicationInsightsClient.WorkbookTemplatesGet` + +```go +ctx := context.TODO() +id := applicationinsights.NewWorkbookTemplateID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue") +read, err := client.WorkbookTemplatesGet(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ApplicationInsightsClient.WorkbookTemplatesListByResourceGroup` + +```go +ctx := context.TODO() +id := applicationinsights.NewResourceGroupID() +read, err := client.WorkbookTemplatesListByResourceGroup(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ApplicationInsightsClient.WorkbookTemplatesUpdate` + +```go +ctx := context.TODO() +id := applicationinsights.NewWorkbookTemplateID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue") + +payload := applicationinsights.WorkbookTemplateUpdateParameters{ + // ... +} + +read, err := client.WorkbookTemplatesUpdate(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/cognitive/2021-04-30/cognitiveservicesaccounts/method_accountscreate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/method_accountscreate_autorest.go index 48d971bd0fe0..12eb5c41c0d0 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/method_accountscreate_autorest.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/method_accountscreate_autorest.go @@ -75,6 +75,5 @@ func (c CognitiveServicesAccountsClient) senderForAccountsCreate(ctx context.Con } future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) - return } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/method_accountsdelete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/method_accountsdelete_autorest.go index 0112f0ad4597..2b97a1af6bef 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/method_accountsdelete_autorest.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/method_accountsdelete_autorest.go @@ -7,7 +7,6 @@ import ( "github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/polling" ) @@ -75,10 +74,5 @@ func (c CognitiveServicesAccountsClient) senderForAccountsDelete(ctx context.Con } future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) - - if !response.WasNotFound(future.Poller.HttpResponse) { - return future, err - } - return } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/method_accountsupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/method_accountsupdate_autorest.go index 9b8804d2cb64..52775e391f1c 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/method_accountsupdate_autorest.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/method_accountsupdate_autorest.go @@ -75,6 +75,5 @@ func (c CognitiveServicesAccountsClient) senderForAccountsUpdate(ctx context.Con } future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) - return } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/method_deletedaccountspurge_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/method_deletedaccountspurge_autorest.go index 386b46f2d3e7..dba570c710e2 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/method_deletedaccountspurge_autorest.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/method_deletedaccountspurge_autorest.go @@ -7,7 +7,6 @@ import ( "github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/polling" ) @@ -75,10 +74,5 @@ func (c CognitiveServicesAccountsClient) senderForDeletedAccountsPurge(ctx conte } future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) - - if !response.WasNotFound(future.Poller.HttpResponse) { - return future, err - } - return } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/communication/2020-08-20/communicationservice/method_createorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/communication/2020-08-20/communicationservice/method_createorupdate_autorest.go index 5374104b6162..365f47ce3e0c 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/communication/2020-08-20/communicationservice/method_createorupdate_autorest.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/communication/2020-08-20/communicationservice/method_createorupdate_autorest.go @@ -75,6 +75,5 @@ func (c CommunicationServiceClient) senderForCreateOrUpdate(ctx context.Context, } future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) - return } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/communication/2020-08-20/communicationservice/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/communication/2020-08-20/communicationservice/method_delete_autorest.go index 1a812515baf5..d65463d389da 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/communication/2020-08-20/communicationservice/method_delete_autorest.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/communication/2020-08-20/communicationservice/method_delete_autorest.go @@ -7,7 +7,6 @@ import ( "github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/polling" ) @@ -75,10 +74,5 @@ func (c CommunicationServiceClient) senderForDelete(ctx context.Context, req *ht } future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) - - if !response.WasNotFound(future.Poller.HttpResponse) { - return future, err - } - return } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/confidentialledger/2022-05-13/confidentialledger/method_ledgercreate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/confidentialledger/2022-05-13/confidentialledger/method_ledgercreate_autorest.go index 5a2b91a8ac03..84bcbcbe3423 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/confidentialledger/2022-05-13/confidentialledger/method_ledgercreate_autorest.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/confidentialledger/2022-05-13/confidentialledger/method_ledgercreate_autorest.go @@ -75,6 +75,5 @@ func (c ConfidentialLedgerClient) senderForLedgerCreate(ctx context.Context, req } future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) - return } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/confidentialledger/2022-05-13/confidentialledger/method_ledgerdelete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/confidentialledger/2022-05-13/confidentialledger/method_ledgerdelete_autorest.go index 5856d77fa7fb..2d4172b43c45 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/confidentialledger/2022-05-13/confidentialledger/method_ledgerdelete_autorest.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/confidentialledger/2022-05-13/confidentialledger/method_ledgerdelete_autorest.go @@ -7,7 +7,6 @@ import ( "github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/polling" ) @@ -75,10 +74,5 @@ func (c ConfidentialLedgerClient) senderForLedgerDelete(ctx context.Context, req } future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) - - if !response.WasNotFound(future.Poller.HttpResponse) { - return future, err - } - return } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/confidentialledger/2022-05-13/confidentialledger/method_ledgerupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/confidentialledger/2022-05-13/confidentialledger/method_ledgerupdate_autorest.go index 5e7d27c4a7cd..3c9328440e3a 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/confidentialledger/2022-05-13/confidentialledger/method_ledgerupdate_autorest.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/confidentialledger/2022-05-13/confidentialledger/method_ledgerupdate_autorest.go @@ -75,6 +75,5 @@ func (c ConfidentialLedgerClient) senderForLedgerUpdate(ctx context.Context, req } future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) - return } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/iotcentral/2021-11-01-preview/apps/method_createorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/iotcentral/2021-11-01-preview/apps/method_createorupdate_autorest.go index aa4a25ff1d78..8c771fca3178 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/iotcentral/2021-11-01-preview/apps/method_createorupdate_autorest.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/iotcentral/2021-11-01-preview/apps/method_createorupdate_autorest.go @@ -75,6 +75,5 @@ func (c AppsClient) senderForCreateOrUpdate(ctx context.Context, req *http.Reque } future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) - return } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/iotcentral/2021-11-01-preview/apps/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/iotcentral/2021-11-01-preview/apps/method_delete_autorest.go index 19860440ea76..f214b7dcf3ac 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/iotcentral/2021-11-01-preview/apps/method_delete_autorest.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/iotcentral/2021-11-01-preview/apps/method_delete_autorest.go @@ -7,7 +7,6 @@ import ( "github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/polling" ) @@ -75,10 +74,5 @@ func (c AppsClient) senderForDelete(ctx context.Context, req *http.Request) (fut } future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) - - if !response.WasNotFound(future.Poller.HttpResponse) { - return future, err - } - return } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/iotcentral/2021-11-01-preview/apps/method_update_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/iotcentral/2021-11-01-preview/apps/method_update_autorest.go index 5669080ae711..2f707665c0f9 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/iotcentral/2021-11-01-preview/apps/method_update_autorest.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/iotcentral/2021-11-01-preview/apps/method_update_autorest.go @@ -75,6 +75,5 @@ func (c AppsClient) senderForUpdate(ctx context.Context, req *http.Request) (fut } future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) - return } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/namespaces/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/namespaces/method_delete_autorest.go index f0aab96c3d76..eec88a9eea80 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/namespaces/method_delete_autorest.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/namespaces/method_delete_autorest.go @@ -7,7 +7,6 @@ import ( "github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/polling" ) @@ -75,10 +74,5 @@ func (c NamespacesClient) senderForDelete(ctx context.Context, req *http.Request } future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) - - if !response.WasNotFound(future.Poller.HttpResponse) { - return future, err - } - return } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/method_createorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/method_createorupdate_autorest.go index 9aa6bae4be17..a58c7851f2cb 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/method_createorupdate_autorest.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/method_createorupdate_autorest.go @@ -75,6 +75,5 @@ func (c ManagedClusterClient) senderForCreateOrUpdate(ctx context.Context, req * } future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) - return } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/method_delete_autorest.go index 23d69c887414..6531daccaf64 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/method_delete_autorest.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/method_delete_autorest.go @@ -7,7 +7,6 @@ import ( "github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/polling" ) @@ -75,10 +74,5 @@ func (c ManagedClusterClient) senderForDelete(ctx context.Context, req *http.Req } future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) - - if !response.WasNotFound(future.Poller.HttpResponse) { - return future, err - } - return } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/method_createorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/method_createorupdate_autorest.go index 7ad9c6707289..8a71a50d5240 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/method_createorupdate_autorest.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/method_createorupdate_autorest.go @@ -75,6 +75,5 @@ func (c NodeTypeClient) senderForCreateOrUpdate(ctx context.Context, req *http.R } future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) - return } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/method_delete_autorest.go index 2f0f2b4700a3..38d544ab3d29 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/method_delete_autorest.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/method_delete_autorest.go @@ -7,7 +7,6 @@ import ( "github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/polling" ) @@ -75,10 +74,5 @@ func (c NodeTypeClient) senderForDelete(ctx context.Context, req *http.Request) } future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) - - if !response.WasNotFound(future.Poller.HttpResponse) { - return future, err - } - return } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/method_deletenode_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/method_deletenode_autorest.go index e37b6efd747e..c212fe4100ce 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/method_deletenode_autorest.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/method_deletenode_autorest.go @@ -75,6 +75,5 @@ func (c NodeTypeClient) senderForDeleteNode(ctx context.Context, req *http.Reque } future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) - return } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/method_reimage_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/method_reimage_autorest.go index b0a83965f69f..243e5a1bc694 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/method_reimage_autorest.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/method_reimage_autorest.go @@ -75,6 +75,5 @@ func (c NodeTypeClient) senderForReimage(ctx context.Context, req *http.Request) } future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) - return } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/method_restart_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/method_restart_autorest.go index 51aa5c0afd7e..f726c07d5df8 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/method_restart_autorest.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/method_restart_autorest.go @@ -75,6 +75,5 @@ func (c NodeTypeClient) senderForRestart(ctx context.Context, req *http.Request) } future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) - return } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/authorizations/method_createorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/authorizations/method_createorupdate_autorest.go index 17aa439150ff..43babd4b2339 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/authorizations/method_createorupdate_autorest.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/authorizations/method_createorupdate_autorest.go @@ -75,6 +75,5 @@ func (c AuthorizationsClient) senderForCreateOrUpdate(ctx context.Context, req * } future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) - return } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/authorizations/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/authorizations/method_delete_autorest.go index c8a6e7886c0a..1f3aa7d010a8 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/authorizations/method_delete_autorest.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/authorizations/method_delete_autorest.go @@ -7,7 +7,6 @@ import ( "github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/polling" ) @@ -75,10 +74,5 @@ func (c AuthorizationsClient) senderForDelete(ctx context.Context, req *http.Req } future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) - - if !response.WasNotFound(future.Poller.HttpResponse) { - return future, err - } - return } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/clusters/method_createorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/clusters/method_createorupdate_autorest.go index 5e0987631806..256915c3dafc 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/clusters/method_createorupdate_autorest.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/clusters/method_createorupdate_autorest.go @@ -75,6 +75,5 @@ func (c ClustersClient) senderForCreateOrUpdate(ctx context.Context, req *http.R } future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) - return } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/clusters/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/clusters/method_delete_autorest.go index 59eaa0bb6bab..48e1f9346770 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/clusters/method_delete_autorest.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/clusters/method_delete_autorest.go @@ -7,7 +7,6 @@ import ( "github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/polling" ) @@ -75,10 +74,5 @@ func (c ClustersClient) senderForDelete(ctx context.Context, req *http.Request) } future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) - - if !response.WasNotFound(future.Poller.HttpResponse) { - return future, err - } - return } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/clusters/method_update_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/clusters/method_update_autorest.go index 6e9c6997fa8c..c95bdd45bee5 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/clusters/method_update_autorest.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/clusters/method_update_autorest.go @@ -75,6 +75,5 @@ func (c ClustersClient) senderForUpdate(ctx context.Context, req *http.Request) } future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) - return } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/method_createorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/method_createorupdate_autorest.go index 3b62db48bedc..90e6d0b5ba58 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/method_createorupdate_autorest.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/method_createorupdate_autorest.go @@ -75,6 +75,5 @@ func (c PrivateCloudsClient) senderForCreateOrUpdate(ctx context.Context, req *h } future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) - return } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/method_delete_autorest.go index aca5b618a27b..3c382b386b35 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/method_delete_autorest.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/method_delete_autorest.go @@ -7,7 +7,6 @@ import ( "github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/polling" ) @@ -75,10 +74,5 @@ func (c PrivateCloudsClient) senderForDelete(ctx context.Context, req *http.Requ } future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) - - if !response.WasNotFound(future.Poller.HttpResponse) { - return future, err - } - return } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/method_update_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/method_update_autorest.go index 11241b2f7202..a24060a96026 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/method_update_autorest.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/method_update_autorest.go @@ -75,6 +75,5 @@ func (c PrivateCloudsClient) senderForUpdate(ctx context.Context, req *http.Requ } future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) - return } diff --git a/vendor/modules.txt b/vendor/modules.txt index fbdb1489434b..274eb0c193d5 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -215,6 +215,7 @@ github.com/hashicorp/go-azure-helpers/storage github.com/hashicorp/go-azure-sdk/resource-manager/aadb2c/2021-04-01-preview/tenants github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2020-06-01/configurationstores +github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-11-20/applicationinsights github.com/hashicorp/go-azure-sdk/resource-manager/attestation/2020-10-01/attestationproviders github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts github.com/hashicorp/go-azure-sdk/resource-manager/communication/2020-08-20/communicationservice diff --git a/website/docs/r/application_insights_workbook_template.html.markdown b/website/docs/r/application_insights_workbook_template.html.markdown index 7546c4e4c6f1..c5482a97310e 100644 --- a/website/docs/r/application_insights_workbook_template.html.markdown +++ b/website/docs/r/application_insights_workbook_template.html.markdown @@ -3,12 +3,12 @@ subcategory: "Application Insights" layout: "azurerm" page_title: "Azure Resource Manager: azurerm_application_insights_workbook_template" description: |- - Manages an Application Insights Workbook Templates. + Manages an Application Insights Workbook Template. --- # azurerm_application_insights_workbook_template -Manages an Application Insights Workbook Templates. +Manages an Application Insights Workbook Template. ## Example Usage @@ -22,18 +22,62 @@ resource "azurerm_application_insights_workbook_template" "example" { name = "example-aiwt" resource_group_name = azurerm_resource_group.example.name location = "West Europe" - author = "" - priority = 0 + author = "test author" + priority = 1 + galleries { - category = "" - name = "" - order = 0 - resource_type = "" - type = "" + category = "workbook" + name = "test" + order = 100 + resource_type = "microsoft.insights/components" + type = "tsg" } + template_data = jsonencode({ - "key" = "value" + "version" : "Notebook/1.0", + "items" : [ + { + "type" : 1, + "content" : { + "json" : "## New workbook\n---\n\nWelcome to your new workbook." + }, + "name" : "text - 2" + } + ], + "styleSettings" : {}, + "$schema" : "https://github.com/Microsoft/Application-Insights-Workbooks/blob/master/schema/workbook.json" + }) + + localized = jsonencode({ + "ar" : [ + { + "galleries" : [ + { + "name" : "test", + "category" : "Failures", + "type" : "tsg", + "resourceType" : "microsoft.insights/components", + "order" : 100 + } + ], + "templateData" : { + "version" : "Notebook/1.0", + "items" : [ + { + "type" : 1, + "content" : { + "json" : "## New workbook\n---\n\nWelcome to your new workbook." + }, + "name" : "text - 2" + } + ], + "styleSettings" : {}, + "$schema" : "https://github.com/Microsoft/Application-Insights-Workbooks/blob/master/schema/workbook.json" + }, + } + ] }) + tags = { key = "value" } @@ -44,21 +88,23 @@ resource "azurerm_application_insights_workbook_template" "example" { The following arguments are supported: -* `name` - (Required) Specifies the name which should be used for this Application Insights Workbook Templates. Changing this forces a new Application Insights Workbook Templates to be created. +* `name` - (Required) Specifies the name which should be used for this Application Insights Workbook Template. Changing this forces a new Application Insights Workbook Template to be created. -* `resource_group_name` - (Required) Specifies the name of the Resource Group where the Application Insights Workbook Templates should exist. Changing this forces a new Application Insights Workbook Templates to be created. +* `resource_group_name` - (Required) Specifies the name of the Resource Group where the Application Insights Workbook Template should exist. Changing this forces a new Application Insights Workbook Template to be created. * `galleries` - (Required) A `galleries` block as defined below. -* `location` - (Required) Specifies the Azure Region where the Application Insights Workbook Templates should exist. Changing this forces a new Application Insights Workbook Templates to be created. +* `location` - (Required) Specifies the Azure Region where the Application Insights Workbook Template should exist. Changing this forces a new Application Insights Workbook Template to be created. * `template_data` - (Required) Valid JSON object containing workbook template payload. * `author` - (Optional) Information about the author of the workbook template. -* `priority` - (Optional) Priority of the template. Determines which template to open when a workbook gallery is opened in viewer mode. Defaults to 0. +* `localized` - (Optional) Key value pairs of localized gallery. Each key is the locale code of languages supported by the Azure portal. + +* `priority` - (Optional) Priority of the template. Determines which template to open when a workbook gallery is opened in viewer mode. Defaults to `0`. -* `tags` - (Optional) A mapping of tags which should be assigned to the Application Insights Workbook Templates. +* `tags` - (Optional) A mapping of tags which should be assigned to the Application Insights Workbook Template. --- @@ -80,20 +126,20 @@ A `galleries` block supports the following: In addition to the Arguments listed above - the following Attributes are exported: -* `id` - The ID of the Application Insights Workbook Templates. +* `id` - The ID of the Application Insights Workbook Template. ## Timeouts The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/docs/configuration/resources.html#timeouts) for certain actions: -* `create` - (Defaults to 30 minutes) Used when creating the Application Insights Workbook Templates. -* `read` - (Defaults to 5 minutes) Used when retrieving the Application Insights Workbook Templates. -* `update` - (Defaults to 30 minutes) Used when updating the Application Insights Workbook Templates. -* `delete` - (Defaults to 30 minutes) Used when deleting the Application Insights Workbook Templates. +* `create` - (Defaults to 30 minutes) Used when creating the Application Insights Workbook Template. +* `read` - (Defaults to 5 minutes) Used when retrieving the Application Insights Workbook Template. +* `update` - (Defaults to 30 minutes) Used when updating the Application Insights Workbook Template. +* `delete` - (Defaults to 30 minutes) Used when deleting the Application Insights Workbook Template. ## Import -Application Insights Workbook Templates can be imported using the `resource id`, e.g. +Application Insights Workbook Template can be imported using the `resource id`, e.g. ```shell terraform import azurerm_application_insights_workbook_template.example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourceGroup1/providers/Microsoft.Insights/workbooktemplates/resource1 From fd49f68972a7675217c4da1a175dd4ab3f984559 Mon Sep 17 00:00:00 2001 From: Zhenhua Hu Date: Thu, 30 Jun 2022 09:18:58 +0800 Subject: [PATCH 4/6] resolve comments --- ...ion_insights_workbook_template_resource.go | 3 +-- .../validate/workbook_template_id.go | 21 ------------------- 2 files changed, 1 insertion(+), 23 deletions(-) delete mode 100644 internal/services/applicationinsights/validate/workbook_template_id.go diff --git a/internal/services/applicationinsights/application_insights_workbook_template_resource.go b/internal/services/applicationinsights/application_insights_workbook_template_resource.go index 57ae7639ffcd..305c2917e517 100644 --- a/internal/services/applicationinsights/application_insights_workbook_template_resource.go +++ b/internal/services/applicationinsights/application_insights_workbook_template_resource.go @@ -11,7 +11,6 @@ import ( "github.com/hashicorp/go-azure-helpers/resourcemanager/location" "github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-11-20/applicationinsights" "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" ) @@ -49,7 +48,7 @@ func (r ApplicationInsightsWorkbookTemplateResource) ModelObject() interface{} { } func (r ApplicationInsightsWorkbookTemplateResource) IDValidationFunc() pluginsdk.SchemaValidateFunc { - return validate.WorkbookTemplateID + return applicationinsights.ValidateWorkbookTemplateID } func (r ApplicationInsightsWorkbookTemplateResource) Arguments() map[string]*pluginsdk.Schema { diff --git a/internal/services/applicationinsights/validate/workbook_template_id.go b/internal/services/applicationinsights/validate/workbook_template_id.go deleted file mode 100644 index 5ea51de2017b..000000000000 --- a/internal/services/applicationinsights/validate/workbook_template_id.go +++ /dev/null @@ -1,21 +0,0 @@ -package validate - -import ( - "fmt" - - "github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-11-20/applicationinsights" -) - -func WorkbookTemplateID(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 := applicationinsights.ParseWorkbookTemplateID(v); err != nil { - errors = append(errors, err) - } - - return -} From 28f2210fd7a2e45c4f298098a78656e4352853df Mon Sep 17 00:00:00 2001 From: Zhenhua Hu Date: Thu, 7 Jul 2022 16:43:22 +0800 Subject: [PATCH 5/6] fix bug --- ...pplication_insights_workbook_template_resource.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/internal/services/applicationinsights/application_insights_workbook_template_resource.go b/internal/services/applicationinsights/application_insights_workbook_template_resource.go index 305c2917e517..b6107d72fd95 100644 --- a/internal/services/applicationinsights/application_insights_workbook_template_resource.go +++ b/internal/services/applicationinsights/application_insights_workbook_template_resource.go @@ -6,6 +6,8 @@ import ( "fmt" "time" + "github.com/hashicorp/terraform-provider-azurerm/utils" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" @@ -383,11 +385,11 @@ func expandWorkbookTemplateGalleryModel(inputList []WorkbookTemplateGalleryModel var outputList []applicationinsights.WorkbookTemplateGallery for _, input := range inputList { output := applicationinsights.WorkbookTemplateGallery{ - Category: &input.Category, - Name: &input.Name, - Order: &input.Order, - ResourceType: &input.ResourceType, - Type: &input.Type, + Category: utils.String(input.Category), + Name: utils.String(input.Name), + Order: utils.Int64(input.Order), + ResourceType: utils.String(input.ResourceType), + Type: utils.String(input.Type), } outputList = append(outputList, output) From 410f43736552862e0c526b33d4ae423fe8320217 Mon Sep 17 00:00:00 2001 From: Zhenhua Hu Date: Thu, 7 Jul 2022 16:53:01 +0800 Subject: [PATCH 6/6] update SDK --- .../2020-11-20/applicationinsights/README.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-11-20/applicationinsights/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-11-20/applicationinsights/README.md index e4e502d820fd..ae6dba0fb510 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-11-20/applicationinsights/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-11-20/applicationinsights/README.md @@ -17,9 +17,6 @@ import "github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2 ```go client := applicationinsights.NewApplicationInsightsClientWithBaseURI("https://management.azure.com") client.Client.Authorizer = authorizer -if err != nil { - // handle the error -} ``` @@ -33,6 +30,7 @@ payload := applicationinsights.WorkbookTemplate{ // ... } + read, err := client.WorkbookTemplatesCreateOrUpdate(ctx, id, payload) if err != nil { // handle the error @@ -48,6 +46,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() id := applicationinsights.NewWorkbookTemplateID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue") + read, err := client.WorkbookTemplatesDelete(ctx, id) if err != nil { // handle the error @@ -63,6 +62,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() id := applicationinsights.NewWorkbookTemplateID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue") + read, err := client.WorkbookTemplatesGet(ctx, id) if err != nil { // handle the error @@ -78,6 +78,7 @@ if model := read.Model; model != nil { ```go ctx := context.TODO() id := applicationinsights.NewResourceGroupID() + read, err := client.WorkbookTemplatesListByResourceGroup(ctx, id) if err != nil { // handle the error @@ -98,6 +99,7 @@ payload := applicationinsights.WorkbookTemplateUpdateParameters{ // ... } + read, err := client.WorkbookTemplatesUpdate(ctx, id, payload) if err != nil { // handle the error