From c1bee762e113414fe3692b3ca9cff72841f7a731 Mon Sep 17 00:00:00 2001 From: Steph Date: Fri, 19 Jan 2024 09:54:21 +0100 Subject: [PATCH] add files for chaos studio targets --- .../chaos_studio_target_resource_create.go | 82 ++++++++ .../chaos_studio_target_resource_gen.go | 44 ++++ .../services/chaosstudio/client/client_gen.go | 27 +++ internal/services/chaosstudio/registration.go | 33 +++ .../services/chaosstudio/registration_gen.go | 30 +++ .../2023-11-01/capabilities/README.md | 106 ++++++++++ .../2023-11-01/capabilities/client.go | 26 +++ .../capabilities/id_capabilitytype.go | 134 +++++++++++++ .../capabilities/id_scopedcapability.go | 124 ++++++++++++ .../capabilities/id_scopedtarget.go | 115 +++++++++++ .../capabilities/method_capabilitytypesget.go | 51 +++++ .../capabilities/method_createorupdate.go | 55 +++++ .../2023-11-01/capabilities/method_delete.go | 47 +++++ .../2023-11-01/capabilities/method_get.go | 51 +++++ .../2023-11-01/capabilities/method_list.go | 119 +++++++++++ .../capabilities/model_capability.go | 16 ++ .../model_capabilityproperties.go | 12 ++ .../capabilities/model_capabilitytype.go | 17 ++ .../model_capabilitytypeproperties.go | 17 ++ ...pabilitytypepropertiesruntimeproperties.go | 8 + .../2023-11-01/capabilities/predicates.go | 27 +++ .../2023-11-01/capabilities/version.go | 12 ++ .../2023-11-01/capabilitytypes/README.md | 37 ++++ .../2023-11-01/capabilitytypes/client.go | 26 +++ .../capabilitytypes/id_targettype.go | 125 ++++++++++++ .../2023-11-01/capabilitytypes/method_list.go | 119 +++++++++++ .../capabilitytypes/model_capabilitytype.go | 17 ++ .../model_capabilitytypeproperties.go | 17 ++ ...pabilitytypepropertiesruntimeproperties.go | 8 + .../2023-11-01/capabilitytypes/predicates.go | 32 +++ .../2023-11-01/capabilitytypes/version.go | 12 ++ .../chaosstudio/2023-11-01/client.go | 64 ++++++ .../2023-11-01/experiments/README.md | 189 ++++++++++++++++++ .../2023-11-01/experiments/client.go | 26 +++ .../2023-11-01/experiments/constants.go | 142 +++++++++++++ .../2023-11-01/experiments/id_execution.go | 134 +++++++++++++ .../2023-11-01/experiments/id_experiment.go | 125 ++++++++++++ .../2023-11-01/experiments/method_cancel.go | 69 +++++++ .../experiments/method_createorupdate.go | 74 +++++++ .../2023-11-01/experiments/method_delete.go | 69 +++++++ .../experiments/method_executiondetails.go | 52 +++++ .../2023-11-01/experiments/method_get.go | 51 +++++ .../experiments/method_getexecution.go | 51 +++++ .../2023-11-01/experiments/method_list.go | 124 ++++++++++++ .../2023-11-01/experiments/method_listall.go | 124 ++++++++++++ .../experiments/method_listallexecutions.go | 91 +++++++++ .../2023-11-01/experiments/method_start.go | 69 +++++++ .../2023-11-01/experiments/method_update.go | 73 +++++++ .../2023-11-01/experiments/model_action.go | 9 + .../experiments/model_actionstatus.go | 43 ++++ .../2023-11-01/experiments/model_branch.go | 9 + .../experiments/model_branchstatus.go | 11 + .../experiments/model_experiment.go | 20 ++ .../experiments/model_experimentexecution.go | 11 + ...rimentexecutionactiontargetdetailserror.go | 9 + ...texecutionactiontargetdetailsproperties.go | 42 ++++ .../model_experimentexecutiondetails.go | 11 + ...el_experimentexecutiondetailsproperties.go | 55 +++++ ...xecutiondetailspropertiesruninformation.go | 8 + .../model_experimentexecutionproperties.go | 40 ++++ .../experiments/model_experimentproperties.go | 10 + .../experiments/model_experimentupdate.go | 12 ++ .../2023-11-01/experiments/model_filter.go | 8 + .../2023-11-01/experiments/model_selector.go | 10 + .../2023-11-01/experiments/model_step.go | 9 + .../experiments/model_stepstatus.go | 11 + .../2023-11-01/experiments/predicates.go | 55 +++++ .../2023-11-01/experiments/version.go | 12 ++ .../chaosstudio/2023-11-01/targets/README.md | 90 +++++++++ .../chaosstudio/2023-11-01/targets/client.go | 26 +++ .../2023-11-01/targets/id_scopedtarget.go | 115 +++++++++++ .../targets/method_createorupdate.go | 55 +++++ .../2023-11-01/targets/method_delete.go | 47 +++++ .../2023-11-01/targets/method_get.go | 51 +++++ .../2023-11-01/targets/method_list.go | 120 +++++++++++ .../2023-11-01/targets/model_target.go | 17 ++ .../2023-11-01/targets/predicates.go | 37 ++++ .../chaosstudio/2023-11-01/targets/version.go | 12 ++ .../2023-11-01/targettypes/README.md | 53 +++++ .../2023-11-01/targettypes/client.go | 26 +++ .../2023-11-01/targettypes/id_location.go | 116 +++++++++++ .../2023-11-01/targettypes/id_targettype.go | 125 ++++++++++++ .../2023-11-01/targettypes/method_get.go | 51 +++++ .../2023-11-01/targettypes/method_list.go | 119 +++++++++++ .../targettypes/model_targettype.go | 17 ++ .../targettypes/model_targettypeproperties.go | 11 + .../2023-11-01/targettypes/predicates.go | 32 +++ .../2023-11-01/targettypes/version.go | 12 ++ vendor/modules.txt | 6 + 89 files changed, 4606 insertions(+) create mode 100644 internal/services/chaosstudio/chaos_studio_target_resource_create.go create mode 100644 internal/services/chaosstudio/chaos_studio_target_resource_gen.go create mode 100644 internal/services/chaosstudio/client/client_gen.go create mode 100644 internal/services/chaosstudio/registration.go create mode 100644 internal/services/chaosstudio/registration_gen.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/capabilities/README.md create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/capabilities/client.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/capabilities/id_capabilitytype.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/capabilities/id_scopedcapability.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/capabilities/id_scopedtarget.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/capabilities/method_capabilitytypesget.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/capabilities/method_createorupdate.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/capabilities/method_delete.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/capabilities/method_get.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/capabilities/method_list.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/capabilities/model_capability.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/capabilities/model_capabilityproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/capabilities/model_capabilitytype.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/capabilities/model_capabilitytypeproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/capabilities/model_capabilitytypepropertiesruntimeproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/capabilities/predicates.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/capabilities/version.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/capabilitytypes/README.md create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/capabilitytypes/client.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/capabilitytypes/id_targettype.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/capabilitytypes/method_list.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/capabilitytypes/model_capabilitytype.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/capabilitytypes/model_capabilitytypeproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/capabilitytypes/model_capabilitytypepropertiesruntimeproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/capabilitytypes/predicates.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/capabilitytypes/version.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/client.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/README.md create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/client.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/constants.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/id_execution.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/id_experiment.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/method_cancel.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/method_createorupdate.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/method_delete.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/method_executiondetails.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/method_get.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/method_getexecution.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/method_list.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/method_listall.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/method_listallexecutions.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/method_start.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/method_update.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/model_action.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/model_actionstatus.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/model_branch.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/model_branchstatus.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/model_experiment.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/model_experimentexecution.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/model_experimentexecutionactiontargetdetailserror.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/model_experimentexecutionactiontargetdetailsproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/model_experimentexecutiondetails.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/model_experimentexecutiondetailsproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/model_experimentexecutiondetailspropertiesruninformation.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/model_experimentexecutionproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/model_experimentproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/model_experimentupdate.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/model_filter.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/model_selector.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/model_step.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/model_stepstatus.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/predicates.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/version.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/targets/README.md create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/targets/client.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/targets/id_scopedtarget.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/targets/method_createorupdate.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/targets/method_delete.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/targets/method_get.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/targets/method_list.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/targets/model_target.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/targets/predicates.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/targets/version.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/targettypes/README.md create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/targettypes/client.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/targettypes/id_location.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/targettypes/id_targettype.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/targettypes/method_get.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/targettypes/method_list.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/targettypes/model_targettype.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/targettypes/model_targettypeproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/targettypes/predicates.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/targettypes/version.go diff --git a/internal/services/chaosstudio/chaos_studio_target_resource_create.go b/internal/services/chaosstudio/chaos_studio_target_resource_create.go new file mode 100644 index 0000000000000..c3d2c35d98f15 --- /dev/null +++ b/internal/services/chaosstudio/chaos_studio_target_resource_create.go @@ -0,0 +1,82 @@ +package chaosstudio + +import ( + "context" + "fmt" + "strings" + "time" + + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/targets" + "github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/targettypes" + "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" +) + +func (r ChaosStudioTargetResource) Create() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.ChaosStudio.V20231101.Targets + targetTypesClient := metadata.Client.ChaosStudio.V20231101.TargetTypes + subscriptionId := metadata.Client.Account.SubscriptionId + + var config ChaosStudioTargetResourceSchema + + if err := metadata.Decode(&config); err != nil { + return fmt.Errorf("decoding: %+v", err) + } + + locationId := targettypes.NewLocationID(subscriptionId, config.Location) + resp, err := targetTypesClient.ListComplete(ctx, locationId, targettypes.DefaultListOperationOptions()) + if err != nil { + return fmt.Errorf("retrieving list of chaos target types: %+v", err) + } + + // Validate name which needs to be of format [publisher]-[targetType] + // Only certain target types are accepted, and they could vary by region + targetTypes := map[string][]string{} + nameIsValid := false + for _, item := range resp.Items { + if name := item.Name; name != nil { + if strings.EqualFold(config.TargetType, *item.Name) { + nameIsValid = true + } + targetTypes[*item.Name] = pointer.From(item.Properties.ResourceTypes) + } + } + + if !nameIsValid { + return fmt.Errorf("%q is not a valid `target_type` for the region %s, must be one of %+v", config.TargetType, config.Location, targetTypes) + } + + id := targets.NewScopedTargetID(config.TargetResourceId, config.TargetType) + + existing, err := client.Get(ctx, id) + if err != nil { + if !response.WasNotFound(existing.HttpResponse) { + return fmt.Errorf("checking for the presence of an existing %s: %+v", id, err) + } + } + if !response.WasNotFound(existing.HttpResponse) { + return metadata.ResourceRequiresImport(r.ResourceType(), id) + } + + var payload targets.Target + + // The API only accepts requests with an empty body for Properties + props := struct{}{} + + payload.Location = pointer.To(location.Normalize(config.Location)) + payload.Properties = pointer.To(props) + + if _, err := client.CreateOrUpdate(ctx, id, payload); err != nil { + return fmt.Errorf("creating %s: %+v", id, err) + } + + metadata.SetID(id) + return nil + }, + Timeout: 30 * time.Minute, + } +} diff --git a/internal/services/chaosstudio/chaos_studio_target_resource_gen.go b/internal/services/chaosstudio/chaos_studio_target_resource_gen.go new file mode 100644 index 0000000000000..bbbdf83daf33d --- /dev/null +++ b/internal/services/chaosstudio/chaos_studio_target_resource_gen.go @@ -0,0 +1,44 @@ +package chaosstudio + +import ( + "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" +) + +var _ sdk.Resource = ChaosStudioTargetResource{} + +type ChaosStudioTargetResource struct{} + +type ChaosStudioTargetResourceSchema struct { + Location string `tfschema:"location"` + TargetType string `tfschema:"target_type"` + TargetResourceId string `tfschema:"target_resource_id"` +} + +func (r ChaosStudioTargetResource) ModelObject() interface{} { + return nil +} + +func (r ChaosStudioTargetResource) IDValidationFunc() pluginsdk.SchemaValidateFunc { + return nil +} + +func (r ChaosStudioTargetResource) ResourceType() string { + return "" +} + +func (r ChaosStudioTargetResource) Arguments() map[string]*pluginsdk.Schema { + return nil +} + +func (r ChaosStudioTargetResource) Attributes() map[string]*pluginsdk.Schema { + return nil +} + +func (r ChaosStudioTargetResource) Read() sdk.ResourceFunc { + return sdk.ResourceFunc{} +} + +func (r ChaosStudioTargetResource) Delete() sdk.ResourceFunc { + return sdk.ResourceFunc{} +} diff --git a/internal/services/chaosstudio/client/client_gen.go b/internal/services/chaosstudio/client/client_gen.go new file mode 100644 index 0000000000000..dee9ebe8c7d7f --- /dev/null +++ b/internal/services/chaosstudio/client/client_gen.go @@ -0,0 +1,27 @@ +package client + +import ( + "fmt" + + chaosstudioV20231101 "github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/terraform-provider-azurerm/internal/common" +) + +type AutoClient struct { + V20231101 chaosstudioV20231101.Client +} + +func NewClient(o *common.ClientOptions) (*AutoClient, error) { + + v20231101Client, err := chaosstudioV20231101.NewClientWithBaseURI(o.Environment.ResourceManager, func(c *resourcemanager.Client) { + o.Configure(c, o.Authorizers.ResourceManager) + }) + if err != nil { + return nil, fmt.Errorf("building client for chaosstudio V20231101: %+v", err) + } + + return &AutoClient{ + V20231101: *v20231101Client, + }, nil +} diff --git a/internal/services/chaosstudio/registration.go b/internal/services/chaosstudio/registration.go new file mode 100644 index 0000000000000..3804b64037f0b --- /dev/null +++ b/internal/services/chaosstudio/registration.go @@ -0,0 +1,33 @@ +package chaosstudio + +import ( + "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" +) + +type Registration struct { + autoRegistration +} + +// Name is the name of this Service +func (r Registration) Name() string { + return r.autoRegistration.Name() +} + +// WebsiteCategories returns a list of categories which can be used for the sidebar +func (r Registration) WebsiteCategories() []string { + return r.autoRegistration.WebsiteCategories() +} + +// DataSources returns a list of Data Sources supported by this Service +func (r Registration) DataSources() []sdk.DataSource { + dataSources := []sdk.DataSource{} + dataSources = append(dataSources, r.autoRegistration.DataSources()...) + return dataSources +} + +// Resources returns a list of Resources supported by this Service +func (r Registration) Resources() []sdk.Resource { + resources := []sdk.Resource{} + resources = append(resources, r.autoRegistration.Resources()...) + return resources +} diff --git a/internal/services/chaosstudio/registration_gen.go b/internal/services/chaosstudio/registration_gen.go new file mode 100644 index 0000000000000..9a56a53625122 --- /dev/null +++ b/internal/services/chaosstudio/registration_gen.go @@ -0,0 +1,30 @@ +package chaosstudio + +// NOTE: this file is generated - manual changes will be overwritten. + +import "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" + +var _ sdk.TypedServiceRegistration = autoRegistration{} + +type autoRegistration struct { +} + +func (autoRegistration) Name() string { + return "ChaosStudio" +} + +func (autoRegistration) DataSources() []sdk.DataSource { + return []sdk.DataSource{} +} + +func (autoRegistration) Resources() []sdk.Resource { + return []sdk.Resource{ + ChaosStudioTargetResource{}, + } +} + +func (autoRegistration) WebsiteCategories() []string { + return []string{ + "Chaos Studio", + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/capabilities/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/capabilities/README.md new file mode 100644 index 0000000000000..baf82f7f6be08 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/capabilities/README.md @@ -0,0 +1,106 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/capabilities` Documentation + +The `capabilities` SDK allows for interaction with the Azure Resource Manager Service `chaosstudio` (API Version `2023-11-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/capabilities" +``` + + +### Client Initialization + +```go +client := capabilities.NewCapabilitiesClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `CapabilitiesClient.CapabilityTypesGet` + +```go +ctx := context.TODO() +id := capabilities.NewCapabilityTypeID("12345678-1234-9876-4563-123456789012", "locationValue", "targetTypeValue", "capabilityTypeValue") + +read, err := client.CapabilityTypesGet(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `CapabilitiesClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := capabilities.NewScopedCapabilityID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group", "targetValue", "capabilityValue") + +payload := capabilities.Capability{ + // ... +} + + +read, err := client.CreateOrUpdate(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `CapabilitiesClient.Delete` + +```go +ctx := context.TODO() +id := capabilities.NewScopedCapabilityID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group", "targetValue", "capabilityValue") + +read, err := client.Delete(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `CapabilitiesClient.Get` + +```go +ctx := context.TODO() +id := capabilities.NewScopedCapabilityID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group", "targetValue", "capabilityValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `CapabilitiesClient.List` + +```go +ctx := context.TODO() +id := capabilities.NewScopedTargetID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group", "targetValue") + +// alternatively `client.List(ctx, id, capabilities.DefaultListOperationOptions())` can be used to do batched pagination +items, err := client.ListComplete(ctx, id, capabilities.DefaultListOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/capabilities/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/capabilities/client.go new file mode 100644 index 0000000000000..a2e1031ed3887 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/capabilities/client.go @@ -0,0 +1,26 @@ +package capabilities + +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CapabilitiesClient struct { + Client *resourcemanager.Client +} + +func NewCapabilitiesClientWithBaseURI(sdkApi sdkEnv.Api) (*CapabilitiesClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "capabilities", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating CapabilitiesClient: %+v", err) + } + + return &CapabilitiesClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/capabilities/id_capabilitytype.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/capabilities/id_capabilitytype.go new file mode 100644 index 0000000000000..c7e4761951994 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/capabilities/id_capabilitytype.go @@ -0,0 +1,134 @@ +package capabilities + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = CapabilityTypeId{} + +// CapabilityTypeId is a struct representing the Resource ID for a Capability Type +type CapabilityTypeId struct { + SubscriptionId string + LocationName string + TargetTypeName string + CapabilityTypeName string +} + +// NewCapabilityTypeID returns a new CapabilityTypeId struct +func NewCapabilityTypeID(subscriptionId string, locationName string, targetTypeName string, capabilityTypeName string) CapabilityTypeId { + return CapabilityTypeId{ + SubscriptionId: subscriptionId, + LocationName: locationName, + TargetTypeName: targetTypeName, + CapabilityTypeName: capabilityTypeName, + } +} + +// ParseCapabilityTypeID parses 'input' into a CapabilityTypeId +func ParseCapabilityTypeID(input string) (*CapabilityTypeId, error) { + parser := resourceids.NewParserFromResourceIdType(CapabilityTypeId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := CapabilityTypeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseCapabilityTypeIDInsensitively parses 'input' case-insensitively into a CapabilityTypeId +// note: this method should only be used for API response data and not user input +func ParseCapabilityTypeIDInsensitively(input string) (*CapabilityTypeId, error) { + parser := resourceids.NewParserFromResourceIdType(CapabilityTypeId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := CapabilityTypeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *CapabilityTypeId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) + } + + if id.TargetTypeName, ok = input.Parsed["targetTypeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "targetTypeName", input) + } + + if id.CapabilityTypeName, ok = input.Parsed["capabilityTypeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "capabilityTypeName", input) + } + + return nil +} + +// ValidateCapabilityTypeID checks that 'input' can be parsed as a Capability Type ID +func ValidateCapabilityTypeID(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 := ParseCapabilityTypeID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Capability Type ID +func (id CapabilityTypeId) ID() string { + fmtString := "/subscriptions/%s/providers/Microsoft.Chaos/locations/%s/targetTypes/%s/capabilityTypes/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.LocationName, id.TargetTypeName, id.CapabilityTypeName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Capability Type ID +func (id CapabilityTypeId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftChaos", "Microsoft.Chaos", "Microsoft.Chaos"), + resourceids.StaticSegment("staticLocations", "locations", "locations"), + resourceids.UserSpecifiedSegment("locationName", "locationValue"), + resourceids.StaticSegment("staticTargetTypes", "targetTypes", "targetTypes"), + resourceids.UserSpecifiedSegment("targetTypeName", "targetTypeValue"), + resourceids.StaticSegment("staticCapabilityTypes", "capabilityTypes", "capabilityTypes"), + resourceids.UserSpecifiedSegment("capabilityTypeName", "capabilityTypeValue"), + } +} + +// String returns a human-readable description of this Capability Type ID +func (id CapabilityTypeId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Location Name: %q", id.LocationName), + fmt.Sprintf("Target Type Name: %q", id.TargetTypeName), + fmt.Sprintf("Capability Type Name: %q", id.CapabilityTypeName), + } + return fmt.Sprintf("Capability Type (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/capabilities/id_scopedcapability.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/capabilities/id_scopedcapability.go new file mode 100644 index 0000000000000..36a78b9ae228b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/capabilities/id_scopedcapability.go @@ -0,0 +1,124 @@ +package capabilities + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = ScopedCapabilityId{} + +// ScopedCapabilityId is a struct representing the Resource ID for a Scoped Capability +type ScopedCapabilityId struct { + Scope string + TargetName string + CapabilityName string +} + +// NewScopedCapabilityID returns a new ScopedCapabilityId struct +func NewScopedCapabilityID(scope string, targetName string, capabilityName string) ScopedCapabilityId { + return ScopedCapabilityId{ + Scope: scope, + TargetName: targetName, + CapabilityName: capabilityName, + } +} + +// ParseScopedCapabilityID parses 'input' into a ScopedCapabilityId +func ParseScopedCapabilityID(input string) (*ScopedCapabilityId, error) { + parser := resourceids.NewParserFromResourceIdType(ScopedCapabilityId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := ScopedCapabilityId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseScopedCapabilityIDInsensitively parses 'input' case-insensitively into a ScopedCapabilityId +// note: this method should only be used for API response data and not user input +func ParseScopedCapabilityIDInsensitively(input string) (*ScopedCapabilityId, error) { + parser := resourceids.NewParserFromResourceIdType(ScopedCapabilityId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := ScopedCapabilityId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ScopedCapabilityId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.Scope, ok = input.Parsed["scope"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scope", input) + } + + if id.TargetName, ok = input.Parsed["targetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "targetName", input) + } + + if id.CapabilityName, ok = input.Parsed["capabilityName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "capabilityName", input) + } + + return nil +} + +// ValidateScopedCapabilityID checks that 'input' can be parsed as a Scoped Capability ID +func ValidateScopedCapabilityID(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 := ParseScopedCapabilityID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Scoped Capability ID +func (id ScopedCapabilityId) ID() string { + fmtString := "/%s/providers/Microsoft.Chaos/targets/%s/capabilities/%s" + return fmt.Sprintf(fmtString, strings.TrimPrefix(id.Scope, "/"), id.TargetName, id.CapabilityName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Scoped Capability ID +func (id ScopedCapabilityId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.ScopeSegment("scope", "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftChaos", "Microsoft.Chaos", "Microsoft.Chaos"), + resourceids.StaticSegment("staticTargets", "targets", "targets"), + resourceids.UserSpecifiedSegment("targetName", "targetValue"), + resourceids.StaticSegment("staticCapabilities", "capabilities", "capabilities"), + resourceids.UserSpecifiedSegment("capabilityName", "capabilityValue"), + } +} + +// String returns a human-readable description of this Scoped Capability ID +func (id ScopedCapabilityId) String() string { + components := []string{ + fmt.Sprintf("Scope: %q", id.Scope), + fmt.Sprintf("Target Name: %q", id.TargetName), + fmt.Sprintf("Capability Name: %q", id.CapabilityName), + } + return fmt.Sprintf("Scoped Capability (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/capabilities/id_scopedtarget.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/capabilities/id_scopedtarget.go new file mode 100644 index 0000000000000..9e3a79b1dad4e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/capabilities/id_scopedtarget.go @@ -0,0 +1,115 @@ +package capabilities + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = ScopedTargetId{} + +// ScopedTargetId is a struct representing the Resource ID for a Scoped Target +type ScopedTargetId struct { + Scope string + TargetName string +} + +// NewScopedTargetID returns a new ScopedTargetId struct +func NewScopedTargetID(scope string, targetName string) ScopedTargetId { + return ScopedTargetId{ + Scope: scope, + TargetName: targetName, + } +} + +// ParseScopedTargetID parses 'input' into a ScopedTargetId +func ParseScopedTargetID(input string) (*ScopedTargetId, error) { + parser := resourceids.NewParserFromResourceIdType(ScopedTargetId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := ScopedTargetId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseScopedTargetIDInsensitively parses 'input' case-insensitively into a ScopedTargetId +// note: this method should only be used for API response data and not user input +func ParseScopedTargetIDInsensitively(input string) (*ScopedTargetId, error) { + parser := resourceids.NewParserFromResourceIdType(ScopedTargetId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := ScopedTargetId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ScopedTargetId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.Scope, ok = input.Parsed["scope"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scope", input) + } + + if id.TargetName, ok = input.Parsed["targetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "targetName", input) + } + + return nil +} + +// ValidateScopedTargetID checks that 'input' can be parsed as a Scoped Target ID +func ValidateScopedTargetID(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 := ParseScopedTargetID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Scoped Target ID +func (id ScopedTargetId) ID() string { + fmtString := "/%s/providers/Microsoft.Chaos/targets/%s" + return fmt.Sprintf(fmtString, strings.TrimPrefix(id.Scope, "/"), id.TargetName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Scoped Target ID +func (id ScopedTargetId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.ScopeSegment("scope", "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftChaos", "Microsoft.Chaos", "Microsoft.Chaos"), + resourceids.StaticSegment("staticTargets", "targets", "targets"), + resourceids.UserSpecifiedSegment("targetName", "targetValue"), + } +} + +// String returns a human-readable description of this Scoped Target ID +func (id ScopedTargetId) String() string { + components := []string{ + fmt.Sprintf("Scope: %q", id.Scope), + fmt.Sprintf("Target Name: %q", id.TargetName), + } + return fmt.Sprintf("Scoped Target (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/capabilities/method_capabilitytypesget.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/capabilities/method_capabilitytypesget.go new file mode 100644 index 0000000000000..5adeb0c008bd4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/capabilities/method_capabilitytypesget.go @@ -0,0 +1,51 @@ +package capabilities + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CapabilityTypesGetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *CapabilityType +} + +// CapabilityTypesGet ... +func (c CapabilitiesClient) CapabilityTypesGet(ctx context.Context, id CapabilityTypeId) (result CapabilityTypesGetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/capabilities/method_createorupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/capabilities/method_createorupdate.go new file mode 100644 index 0000000000000..289c7ba7f8e2a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/capabilities/method_createorupdate.go @@ -0,0 +1,55 @@ +package capabilities + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *Capability +} + +// CreateOrUpdate ... +func (c CapabilitiesClient) CreateOrUpdate(ctx context.Context, id ScopedCapabilityId, input Capability) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/capabilities/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/capabilities/method_delete.go new file mode 100644 index 0000000000000..604f29efd5807 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/capabilities/method_delete.go @@ -0,0 +1,47 @@ +package capabilities + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// Delete ... +func (c CapabilitiesClient) Delete(ctx context.Context, id ScopedCapabilityId) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/capabilities/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/capabilities/method_get.go new file mode 100644 index 0000000000000..33329482911a7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/capabilities/method_get.go @@ -0,0 +1,51 @@ +package capabilities + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *Capability +} + +// Get ... +func (c CapabilitiesClient) Get(ctx context.Context, id ScopedCapabilityId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/capabilities/method_list.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/capabilities/method_list.go new file mode 100644 index 0000000000000..045f0c2ffd474 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/capabilities/method_list.go @@ -0,0 +1,119 @@ +package capabilities + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]Capability +} + +type ListCompleteResult struct { + LatestHttpResponse *http.Response + Items []Capability +} + +type ListOperationOptions struct { + ContinuationToken *string +} + +func DefaultListOperationOptions() ListOperationOptions { + return ListOperationOptions{} +} + +func (o ListOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.ContinuationToken != nil { + out.Append("continuationToken", fmt.Sprintf("%v", *o.ContinuationToken)) + } + return &out +} + +// List ... +func (c CapabilitiesClient) List(ctx context.Context, id ScopedTargetId, options ListOperationOptions) (result ListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/capabilities", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]Capability `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListComplete retrieves all the results into a single object +func (c CapabilitiesClient) ListComplete(ctx context.Context, id ScopedTargetId, options ListOperationOptions) (ListCompleteResult, error) { + return c.ListCompleteMatchingPredicate(ctx, id, options, CapabilityOperationPredicate{}) +} + +// ListCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c CapabilitiesClient) ListCompleteMatchingPredicate(ctx context.Context, id ScopedTargetId, options ListOperationOptions, predicate CapabilityOperationPredicate) (result ListCompleteResult, err error) { + items := make([]Capability, 0) + + resp, err := c.List(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/capabilities/model_capability.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/capabilities/model_capability.go new file mode 100644 index 0000000000000..a5f688167f36b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/capabilities/model_capability.go @@ -0,0 +1,16 @@ +package capabilities + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Capability struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *CapabilityProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/capabilities/model_capabilityproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/capabilities/model_capabilityproperties.go new file mode 100644 index 0000000000000..e691d6069a1e9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/capabilities/model_capabilityproperties.go @@ -0,0 +1,12 @@ +package capabilities + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CapabilityProperties struct { + Description *string `json:"description,omitempty"` + ParametersSchema *string `json:"parametersSchema,omitempty"` + Publisher *string `json:"publisher,omitempty"` + TargetType *string `json:"targetType,omitempty"` + Urn *string `json:"urn,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/capabilities/model_capabilitytype.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/capabilities/model_capabilitytype.go new file mode 100644 index 0000000000000..b6b93fbe93405 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/capabilities/model_capabilitytype.go @@ -0,0 +1,17 @@ +package capabilities + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CapabilityType struct { + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties *CapabilityTypeProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/capabilities/model_capabilitytypeproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/capabilities/model_capabilitytypeproperties.go new file mode 100644 index 0000000000000..cb11ed6b97895 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/capabilities/model_capabilitytypeproperties.go @@ -0,0 +1,17 @@ +package capabilities + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CapabilityTypeProperties struct { + AzureRbacActions *[]string `json:"azureRbacActions,omitempty"` + AzureRbacDataActions *[]string `json:"azureRbacDataActions,omitempty"` + Description *string `json:"description,omitempty"` + DisplayName *string `json:"displayName,omitempty"` + Kind *string `json:"kind,omitempty"` + ParametersSchema *string `json:"parametersSchema,omitempty"` + Publisher *string `json:"publisher,omitempty"` + RuntimeProperties *CapabilityTypePropertiesRuntimeProperties `json:"runtimeProperties,omitempty"` + TargetType *string `json:"targetType,omitempty"` + Urn *string `json:"urn,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/capabilities/model_capabilitytypepropertiesruntimeproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/capabilities/model_capabilitytypepropertiesruntimeproperties.go new file mode 100644 index 0000000000000..f1f7b35bf9767 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/capabilities/model_capabilitytypepropertiesruntimeproperties.go @@ -0,0 +1,8 @@ +package capabilities + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CapabilityTypePropertiesRuntimeProperties struct { + Kind *string `json:"kind,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/capabilities/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/capabilities/predicates.go new file mode 100644 index 0000000000000..4e83d4f003431 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/capabilities/predicates.go @@ -0,0 +1,27 @@ +package capabilities + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CapabilityOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p CapabilityOperationPredicate) Matches(input Capability) bool { + + if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil || *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil || *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/capabilities/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/capabilities/version.go new file mode 100644 index 0000000000000..a945a12b9ca0c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/capabilities/version.go @@ -0,0 +1,12 @@ +package capabilities + +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 = "2023-11-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/capabilities/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/capabilitytypes/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/capabilitytypes/README.md new file mode 100644 index 0000000000000..f9ee5cc9fa326 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/capabilitytypes/README.md @@ -0,0 +1,37 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/capabilitytypes` Documentation + +The `capabilitytypes` SDK allows for interaction with the Azure Resource Manager Service `chaosstudio` (API Version `2023-11-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/capabilitytypes" +``` + + +### Client Initialization + +```go +client := capabilitytypes.NewCapabilityTypesClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `CapabilityTypesClient.List` + +```go +ctx := context.TODO() +id := capabilitytypes.NewTargetTypeID("12345678-1234-9876-4563-123456789012", "locationValue", "targetTypeValue") + +// alternatively `client.List(ctx, id, capabilitytypes.DefaultListOperationOptions())` can be used to do batched pagination +items, err := client.ListComplete(ctx, id, capabilitytypes.DefaultListOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/capabilitytypes/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/capabilitytypes/client.go new file mode 100644 index 0000000000000..3dc8b841e5d37 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/capabilitytypes/client.go @@ -0,0 +1,26 @@ +package capabilitytypes + +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CapabilityTypesClient struct { + Client *resourcemanager.Client +} + +func NewCapabilityTypesClientWithBaseURI(sdkApi sdkEnv.Api) (*CapabilityTypesClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "capabilitytypes", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating CapabilityTypesClient: %+v", err) + } + + return &CapabilityTypesClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/capabilitytypes/id_targettype.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/capabilitytypes/id_targettype.go new file mode 100644 index 0000000000000..ed5fdf6336e9a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/capabilitytypes/id_targettype.go @@ -0,0 +1,125 @@ +package capabilitytypes + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = TargetTypeId{} + +// TargetTypeId is a struct representing the Resource ID for a Target Type +type TargetTypeId struct { + SubscriptionId string + LocationName string + TargetTypeName string +} + +// NewTargetTypeID returns a new TargetTypeId struct +func NewTargetTypeID(subscriptionId string, locationName string, targetTypeName string) TargetTypeId { + return TargetTypeId{ + SubscriptionId: subscriptionId, + LocationName: locationName, + TargetTypeName: targetTypeName, + } +} + +// ParseTargetTypeID parses 'input' into a TargetTypeId +func ParseTargetTypeID(input string) (*TargetTypeId, error) { + parser := resourceids.NewParserFromResourceIdType(TargetTypeId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := TargetTypeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseTargetTypeIDInsensitively parses 'input' case-insensitively into a TargetTypeId +// note: this method should only be used for API response data and not user input +func ParseTargetTypeIDInsensitively(input string) (*TargetTypeId, error) { + parser := resourceids.NewParserFromResourceIdType(TargetTypeId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := TargetTypeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *TargetTypeId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) + } + + if id.TargetTypeName, ok = input.Parsed["targetTypeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "targetTypeName", input) + } + + return nil +} + +// ValidateTargetTypeID checks that 'input' can be parsed as a Target Type ID +func ValidateTargetTypeID(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 := ParseTargetTypeID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Target Type ID +func (id TargetTypeId) ID() string { + fmtString := "/subscriptions/%s/providers/Microsoft.Chaos/locations/%s/targetTypes/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.LocationName, id.TargetTypeName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Target Type ID +func (id TargetTypeId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftChaos", "Microsoft.Chaos", "Microsoft.Chaos"), + resourceids.StaticSegment("staticLocations", "locations", "locations"), + resourceids.UserSpecifiedSegment("locationName", "locationValue"), + resourceids.StaticSegment("staticTargetTypes", "targetTypes", "targetTypes"), + resourceids.UserSpecifiedSegment("targetTypeName", "targetTypeValue"), + } +} + +// String returns a human-readable description of this Target Type ID +func (id TargetTypeId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Location Name: %q", id.LocationName), + fmt.Sprintf("Target Type Name: %q", id.TargetTypeName), + } + return fmt.Sprintf("Target Type (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/capabilitytypes/method_list.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/capabilitytypes/method_list.go new file mode 100644 index 0000000000000..b7ad0f798e7dc --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/capabilitytypes/method_list.go @@ -0,0 +1,119 @@ +package capabilitytypes + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]CapabilityType +} + +type ListCompleteResult struct { + LatestHttpResponse *http.Response + Items []CapabilityType +} + +type ListOperationOptions struct { + ContinuationToken *string +} + +func DefaultListOperationOptions() ListOperationOptions { + return ListOperationOptions{} +} + +func (o ListOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.ContinuationToken != nil { + out.Append("continuationToken", fmt.Sprintf("%v", *o.ContinuationToken)) + } + return &out +} + +// List ... +func (c CapabilityTypesClient) List(ctx context.Context, id TargetTypeId, options ListOperationOptions) (result ListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/capabilityTypes", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]CapabilityType `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListComplete retrieves all the results into a single object +func (c CapabilityTypesClient) ListComplete(ctx context.Context, id TargetTypeId, options ListOperationOptions) (ListCompleteResult, error) { + return c.ListCompleteMatchingPredicate(ctx, id, options, CapabilityTypeOperationPredicate{}) +} + +// ListCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c CapabilityTypesClient) ListCompleteMatchingPredicate(ctx context.Context, id TargetTypeId, options ListOperationOptions, predicate CapabilityTypeOperationPredicate) (result ListCompleteResult, err error) { + items := make([]CapabilityType, 0) + + resp, err := c.List(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/capabilitytypes/model_capabilitytype.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/capabilitytypes/model_capabilitytype.go new file mode 100644 index 0000000000000..fec9365d92c94 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/capabilitytypes/model_capabilitytype.go @@ -0,0 +1,17 @@ +package capabilitytypes + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CapabilityType struct { + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties *CapabilityTypeProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/capabilitytypes/model_capabilitytypeproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/capabilitytypes/model_capabilitytypeproperties.go new file mode 100644 index 0000000000000..7d2ad8abe15e7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/capabilitytypes/model_capabilitytypeproperties.go @@ -0,0 +1,17 @@ +package capabilitytypes + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CapabilityTypeProperties struct { + AzureRbacActions *[]string `json:"azureRbacActions,omitempty"` + AzureRbacDataActions *[]string `json:"azureRbacDataActions,omitempty"` + Description *string `json:"description,omitempty"` + DisplayName *string `json:"displayName,omitempty"` + Kind *string `json:"kind,omitempty"` + ParametersSchema *string `json:"parametersSchema,omitempty"` + Publisher *string `json:"publisher,omitempty"` + RuntimeProperties *CapabilityTypePropertiesRuntimeProperties `json:"runtimeProperties,omitempty"` + TargetType *string `json:"targetType,omitempty"` + Urn *string `json:"urn,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/capabilitytypes/model_capabilitytypepropertiesruntimeproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/capabilitytypes/model_capabilitytypepropertiesruntimeproperties.go new file mode 100644 index 0000000000000..7b3b89e7708bb --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/capabilitytypes/model_capabilitytypepropertiesruntimeproperties.go @@ -0,0 +1,8 @@ +package capabilitytypes + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CapabilityTypePropertiesRuntimeProperties struct { + Kind *string `json:"kind,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/capabilitytypes/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/capabilitytypes/predicates.go new file mode 100644 index 0000000000000..39d040ae4dce7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/capabilitytypes/predicates.go @@ -0,0 +1,32 @@ +package capabilitytypes + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CapabilityTypeOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p CapabilityTypeOperationPredicate) Matches(input CapabilityType) bool { + + if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { + return false + } + + if p.Location != nil && (input.Location == nil || *p.Location != *input.Location) { + return false + } + + if p.Name != nil && (input.Name == nil || *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil || *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/capabilitytypes/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/capabilitytypes/version.go new file mode 100644 index 0000000000000..68366274a35db --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/capabilitytypes/version.go @@ -0,0 +1,12 @@ +package capabilitytypes + +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 = "2023-11-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/capabilitytypes/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/client.go new file mode 100644 index 0000000000000..80e433ca5673d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/client.go @@ -0,0 +1,64 @@ +package v2023_11_01 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/capabilities" + "github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/capabilitytypes" + "github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments" + "github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/targets" + "github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/targettypes" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +type Client struct { + Capabilities *capabilities.CapabilitiesClient + CapabilityTypes *capabilitytypes.CapabilityTypesClient + Experiments *experiments.ExperimentsClient + TargetTypes *targettypes.TargetTypesClient + Targets *targets.TargetsClient +} + +func NewClientWithBaseURI(sdkApi sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { + capabilitiesClient, err := capabilities.NewCapabilitiesClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building Capabilities client: %+v", err) + } + configureFunc(capabilitiesClient.Client) + + capabilityTypesClient, err := capabilitytypes.NewCapabilityTypesClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building CapabilityTypes client: %+v", err) + } + configureFunc(capabilityTypesClient.Client) + + experimentsClient, err := experiments.NewExperimentsClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building Experiments client: %+v", err) + } + configureFunc(experimentsClient.Client) + + targetTypesClient, err := targettypes.NewTargetTypesClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building TargetTypes client: %+v", err) + } + configureFunc(targetTypesClient.Client) + + targetsClient, err := targets.NewTargetsClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building Targets client: %+v", err) + } + configureFunc(targetsClient.Client) + + return &Client{ + Capabilities: capabilitiesClient, + CapabilityTypes: capabilityTypesClient, + Experiments: experimentsClient, + TargetTypes: targetTypesClient, + Targets: targetsClient, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/README.md new file mode 100644 index 0000000000000..cd28d17bf509a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/README.md @@ -0,0 +1,189 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments` Documentation + +The `experiments` SDK allows for interaction with the Azure Resource Manager Service `chaosstudio` (API Version `2023-11-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments" +``` + + +### Client Initialization + +```go +client := experiments.NewExperimentsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `ExperimentsClient.Cancel` + +```go +ctx := context.TODO() +id := experiments.NewExperimentID("12345678-1234-9876-4563-123456789012", "example-resource-group", "experimentValue") + +if err := client.CancelThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `ExperimentsClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := experiments.NewExperimentID("12345678-1234-9876-4563-123456789012", "example-resource-group", "experimentValue") + +payload := experiments.Experiment{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `ExperimentsClient.Delete` + +```go +ctx := context.TODO() +id := experiments.NewExperimentID("12345678-1234-9876-4563-123456789012", "example-resource-group", "experimentValue") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `ExperimentsClient.ExecutionDetails` + +```go +ctx := context.TODO() +id := experiments.NewExecutionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "experimentValue", "executionIdValue") + +read, err := client.ExecutionDetails(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ExperimentsClient.Get` + +```go +ctx := context.TODO() +id := experiments.NewExperimentID("12345678-1234-9876-4563-123456789012", "example-resource-group", "experimentValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ExperimentsClient.GetExecution` + +```go +ctx := context.TODO() +id := experiments.NewExecutionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "experimentValue", "executionIdValue") + +read, err := client.GetExecution(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ExperimentsClient.List` + +```go +ctx := context.TODO() +id := experiments.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") + +// alternatively `client.List(ctx, id, experiments.DefaultListOperationOptions())` can be used to do batched pagination +items, err := client.ListComplete(ctx, id, experiments.DefaultListOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `ExperimentsClient.ListAll` + +```go +ctx := context.TODO() +id := experiments.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +// alternatively `client.ListAll(ctx, id, experiments.DefaultListAllOperationOptions())` can be used to do batched pagination +items, err := client.ListAllComplete(ctx, id, experiments.DefaultListAllOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `ExperimentsClient.ListAllExecutions` + +```go +ctx := context.TODO() +id := experiments.NewExperimentID("12345678-1234-9876-4563-123456789012", "example-resource-group", "experimentValue") + +// alternatively `client.ListAllExecutions(ctx, id)` can be used to do batched pagination +items, err := client.ListAllExecutionsComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `ExperimentsClient.Start` + +```go +ctx := context.TODO() +id := experiments.NewExperimentID("12345678-1234-9876-4563-123456789012", "example-resource-group", "experimentValue") + +if err := client.StartThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `ExperimentsClient.Update` + +```go +ctx := context.TODO() +id := experiments.NewExperimentID("12345678-1234-9876-4563-123456789012", "example-resource-group", "experimentValue") + +payload := experiments.ExperimentUpdate{ + // ... +} + + +if err := client.UpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/client.go new file mode 100644 index 0000000000000..d2642af9418d4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/client.go @@ -0,0 +1,26 @@ +package experiments + +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ExperimentsClient struct { + Client *resourcemanager.Client +} + +func NewExperimentsClientWithBaseURI(sdkApi sdkEnv.Api) (*ExperimentsClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "experiments", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating ExperimentsClient: %+v", err) + } + + return &ExperimentsClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/constants.go new file mode 100644 index 0000000000000..9a5dce911d9c5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/constants.go @@ -0,0 +1,142 @@ +package experiments + +import ( + "encoding/json" + "fmt" + "strings" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type FilterType string + +const ( + FilterTypeSimple FilterType = "Simple" +) + +func PossibleValuesForFilterType() []string { + return []string{ + string(FilterTypeSimple), + } +} + +func (s *FilterType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseFilterType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseFilterType(input string) (*FilterType, error) { + vals := map[string]FilterType{ + "simple": FilterTypeSimple, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := FilterType(input) + return &out, nil +} + +type ProvisioningState string + +const ( + ProvisioningStateCanceled ProvisioningState = "Canceled" + ProvisioningStateCreating ProvisioningState = "Creating" + ProvisioningStateDeleting ProvisioningState = "Deleting" + ProvisioningStateFailed ProvisioningState = "Failed" + ProvisioningStateSucceeded ProvisioningState = "Succeeded" + ProvisioningStateUpdating ProvisioningState = "Updating" +) + +func PossibleValuesForProvisioningState() []string { + return []string{ + string(ProvisioningStateCanceled), + string(ProvisioningStateCreating), + string(ProvisioningStateDeleting), + string(ProvisioningStateFailed), + string(ProvisioningStateSucceeded), + string(ProvisioningStateUpdating), + } +} + +func (s *ProvisioningState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseProvisioningState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseProvisioningState(input string) (*ProvisioningState, error) { + vals := map[string]ProvisioningState{ + "canceled": ProvisioningStateCanceled, + "creating": ProvisioningStateCreating, + "deleting": ProvisioningStateDeleting, + "failed": ProvisioningStateFailed, + "succeeded": ProvisioningStateSucceeded, + "updating": ProvisioningStateUpdating, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ProvisioningState(input) + return &out, nil +} + +type SelectorType string + +const ( + SelectorTypeList SelectorType = "List" + SelectorTypeQuery SelectorType = "Query" +) + +func PossibleValuesForSelectorType() []string { + return []string{ + string(SelectorTypeList), + string(SelectorTypeQuery), + } +} + +func (s *SelectorType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSelectorType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseSelectorType(input string) (*SelectorType, error) { + vals := map[string]SelectorType{ + "list": SelectorTypeList, + "query": SelectorTypeQuery, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SelectorType(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/id_execution.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/id_execution.go new file mode 100644 index 0000000000000..e6471a1db7cfe --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/id_execution.go @@ -0,0 +1,134 @@ +package experiments + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = ExecutionId{} + +// ExecutionId is a struct representing the Resource ID for a Execution +type ExecutionId struct { + SubscriptionId string + ResourceGroupName string + ExperimentName string + ExecutionId string +} + +// NewExecutionID returns a new ExecutionId struct +func NewExecutionID(subscriptionId string, resourceGroupName string, experimentName string, executionId string) ExecutionId { + return ExecutionId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ExperimentName: experimentName, + ExecutionId: executionId, + } +} + +// ParseExecutionID parses 'input' into a ExecutionId +func ParseExecutionID(input string) (*ExecutionId, error) { + parser := resourceids.NewParserFromResourceIdType(ExecutionId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := ExecutionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseExecutionIDInsensitively parses 'input' case-insensitively into a ExecutionId +// note: this method should only be used for API response data and not user input +func ParseExecutionIDInsensitively(input string) (*ExecutionId, error) { + parser := resourceids.NewParserFromResourceIdType(ExecutionId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := ExecutionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ExecutionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) + } + + if id.ExperimentName, ok = input.Parsed["experimentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "experimentName", input) + } + + if id.ExecutionId, ok = input.Parsed["executionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "executionId", input) + } + + return nil +} + +// ValidateExecutionID checks that 'input' can be parsed as a Execution ID +func ValidateExecutionID(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 := ParseExecutionID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Execution ID +func (id ExecutionId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Chaos/experiments/%s/executions/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ExperimentName, id.ExecutionId) +} + +// Segments returns a slice of Resource ID Segments which comprise this Execution ID +func (id ExecutionId) 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("staticMicrosoftChaos", "Microsoft.Chaos", "Microsoft.Chaos"), + resourceids.StaticSegment("staticExperiments", "experiments", "experiments"), + resourceids.UserSpecifiedSegment("experimentName", "experimentValue"), + resourceids.StaticSegment("staticExecutions", "executions", "executions"), + resourceids.UserSpecifiedSegment("executionId", "executionIdValue"), + } +} + +// String returns a human-readable description of this Execution ID +func (id ExecutionId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Experiment Name: %q", id.ExperimentName), + fmt.Sprintf("Execution: %q", id.ExecutionId), + } + return fmt.Sprintf("Execution (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/id_experiment.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/id_experiment.go new file mode 100644 index 0000000000000..c5d6be45f9cbe --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/id_experiment.go @@ -0,0 +1,125 @@ +package experiments + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = ExperimentId{} + +// ExperimentId is a struct representing the Resource ID for a Experiment +type ExperimentId struct { + SubscriptionId string + ResourceGroupName string + ExperimentName string +} + +// NewExperimentID returns a new ExperimentId struct +func NewExperimentID(subscriptionId string, resourceGroupName string, experimentName string) ExperimentId { + return ExperimentId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ExperimentName: experimentName, + } +} + +// ParseExperimentID parses 'input' into a ExperimentId +func ParseExperimentID(input string) (*ExperimentId, error) { + parser := resourceids.NewParserFromResourceIdType(ExperimentId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := ExperimentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseExperimentIDInsensitively parses 'input' case-insensitively into a ExperimentId +// note: this method should only be used for API response data and not user input +func ParseExperimentIDInsensitively(input string) (*ExperimentId, error) { + parser := resourceids.NewParserFromResourceIdType(ExperimentId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := ExperimentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ExperimentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) + } + + if id.ExperimentName, ok = input.Parsed["experimentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "experimentName", input) + } + + return nil +} + +// ValidateExperimentID checks that 'input' can be parsed as a Experiment ID +func ValidateExperimentID(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 := ParseExperimentID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Experiment ID +func (id ExperimentId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Chaos/experiments/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ExperimentName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Experiment ID +func (id ExperimentId) 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("staticMicrosoftChaos", "Microsoft.Chaos", "Microsoft.Chaos"), + resourceids.StaticSegment("staticExperiments", "experiments", "experiments"), + resourceids.UserSpecifiedSegment("experimentName", "experimentValue"), + } +} + +// String returns a human-readable description of this Experiment ID +func (id ExperimentId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Experiment Name: %q", id.ExperimentName), + } + return fmt.Sprintf("Experiment (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/method_cancel.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/method_cancel.go new file mode 100644 index 0000000000000..b17414445592b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/method_cancel.go @@ -0,0 +1,69 @@ +package experiments + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CancelOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// Cancel ... +func (c ExperimentsClient) Cancel(ctx context.Context, id ExperimentId) (result CancelOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/cancel", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// CancelThenPoll performs Cancel then polls until it's completed +func (c ExperimentsClient) CancelThenPoll(ctx context.Context, id ExperimentId) error { + result, err := c.Cancel(ctx, id) + if err != nil { + return fmt.Errorf("performing Cancel: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Cancel: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/method_createorupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/method_createorupdate.go new file mode 100644 index 0000000000000..e0da1074f9d3b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/method_createorupdate.go @@ -0,0 +1,74 @@ +package experiments + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// CreateOrUpdate ... +func (c ExperimentsClient) CreateOrUpdate(ctx context.Context, id ExperimentId, input Experiment) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed +func (c ExperimentsClient) CreateOrUpdateThenPoll(ctx context.Context, id ExperimentId, input Experiment) error { + result, err := c.CreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing CreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after CreateOrUpdate: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/method_delete.go new file mode 100644 index 0000000000000..c24d5824e5a94 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/method_delete.go @@ -0,0 +1,69 @@ +package experiments + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// Delete ... +func (c ExperimentsClient) Delete(ctx context.Context, id ExperimentId) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c ExperimentsClient) DeleteThenPoll(ctx context.Context, id ExperimentId) error { + result, err := c.Delete(ctx, id) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/method_executiondetails.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/method_executiondetails.go new file mode 100644 index 0000000000000..16655f0ab1bfa --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/method_executiondetails.go @@ -0,0 +1,52 @@ +package experiments + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ExecutionDetailsOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ExperimentExecutionDetails +} + +// ExecutionDetails ... +func (c ExperimentsClient) ExecutionDetails(ctx context.Context, id ExecutionId) (result ExecutionDetailsOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/getExecutionDetails", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/method_get.go new file mode 100644 index 0000000000000..73810c0176f17 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/method_get.go @@ -0,0 +1,51 @@ +package experiments + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *Experiment +} + +// Get ... +func (c ExperimentsClient) Get(ctx context.Context, id ExperimentId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/method_getexecution.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/method_getexecution.go new file mode 100644 index 0000000000000..2c5d76dc8a908 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/method_getexecution.go @@ -0,0 +1,51 @@ +package experiments + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetExecutionOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ExperimentExecution +} + +// GetExecution ... +func (c ExperimentsClient) GetExecution(ctx context.Context, id ExecutionId) (result GetExecutionOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/method_list.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/method_list.go new file mode 100644 index 0000000000000..fb9fa9b264a1c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/method_list.go @@ -0,0 +1,124 @@ +package experiments + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]Experiment +} + +type ListCompleteResult struct { + LatestHttpResponse *http.Response + Items []Experiment +} + +type ListOperationOptions struct { + ContinuationToken *string + Running *bool +} + +func DefaultListOperationOptions() ListOperationOptions { + return ListOperationOptions{} +} + +func (o ListOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.ContinuationToken != nil { + out.Append("continuationToken", fmt.Sprintf("%v", *o.ContinuationToken)) + } + if o.Running != nil { + out.Append("running", fmt.Sprintf("%v", *o.Running)) + } + return &out +} + +// List ... +func (c ExperimentsClient) List(ctx context.Context, id commonids.ResourceGroupId, options ListOperationOptions) (result ListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/providers/Microsoft.Chaos/experiments", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]Experiment `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListComplete retrieves all the results into a single object +func (c ExperimentsClient) ListComplete(ctx context.Context, id commonids.ResourceGroupId, options ListOperationOptions) (ListCompleteResult, error) { + return c.ListCompleteMatchingPredicate(ctx, id, options, ExperimentOperationPredicate{}) +} + +// ListCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ExperimentsClient) ListCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, options ListOperationOptions, predicate ExperimentOperationPredicate) (result ListCompleteResult, err error) { + items := make([]Experiment, 0) + + resp, err := c.List(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/method_listall.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/method_listall.go new file mode 100644 index 0000000000000..ac3dc1b5b33fb --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/method_listall.go @@ -0,0 +1,124 @@ +package experiments + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListAllOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]Experiment +} + +type ListAllCompleteResult struct { + LatestHttpResponse *http.Response + Items []Experiment +} + +type ListAllOperationOptions struct { + ContinuationToken *string + Running *bool +} + +func DefaultListAllOperationOptions() ListAllOperationOptions { + return ListAllOperationOptions{} +} + +func (o ListAllOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListAllOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListAllOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.ContinuationToken != nil { + out.Append("continuationToken", fmt.Sprintf("%v", *o.ContinuationToken)) + } + if o.Running != nil { + out.Append("running", fmt.Sprintf("%v", *o.Running)) + } + return &out +} + +// ListAll ... +func (c ExperimentsClient) ListAll(ctx context.Context, id commonids.SubscriptionId, options ListAllOperationOptions) (result ListAllOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/providers/Microsoft.Chaos/experiments", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]Experiment `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListAllComplete retrieves all the results into a single object +func (c ExperimentsClient) ListAllComplete(ctx context.Context, id commonids.SubscriptionId, options ListAllOperationOptions) (ListAllCompleteResult, error) { + return c.ListAllCompleteMatchingPredicate(ctx, id, options, ExperimentOperationPredicate{}) +} + +// ListAllCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ExperimentsClient) ListAllCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, options ListAllOperationOptions, predicate ExperimentOperationPredicate) (result ListAllCompleteResult, err error) { + items := make([]Experiment, 0) + + resp, err := c.ListAll(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListAllCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/method_listallexecutions.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/method_listallexecutions.go new file mode 100644 index 0000000000000..7df8e31a0992a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/method_listallexecutions.go @@ -0,0 +1,91 @@ +package experiments + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListAllExecutionsOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]ExperimentExecution +} + +type ListAllExecutionsCompleteResult struct { + LatestHttpResponse *http.Response + Items []ExperimentExecution +} + +// ListAllExecutions ... +func (c ExperimentsClient) ListAllExecutions(ctx context.Context, id ExperimentId) (result ListAllExecutionsOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/executions", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]ExperimentExecution `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListAllExecutionsComplete retrieves all the results into a single object +func (c ExperimentsClient) ListAllExecutionsComplete(ctx context.Context, id ExperimentId) (ListAllExecutionsCompleteResult, error) { + return c.ListAllExecutionsCompleteMatchingPredicate(ctx, id, ExperimentExecutionOperationPredicate{}) +} + +// ListAllExecutionsCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ExperimentsClient) ListAllExecutionsCompleteMatchingPredicate(ctx context.Context, id ExperimentId, predicate ExperimentExecutionOperationPredicate) (result ListAllExecutionsCompleteResult, err error) { + items := make([]ExperimentExecution, 0) + + resp, err := c.ListAllExecutions(ctx, id) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListAllExecutionsCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/method_start.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/method_start.go new file mode 100644 index 0000000000000..17f9d1946081f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/method_start.go @@ -0,0 +1,69 @@ +package experiments + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type StartOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// Start ... +func (c ExperimentsClient) Start(ctx context.Context, id ExperimentId) (result StartOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/start", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// StartThenPoll performs Start then polls until it's completed +func (c ExperimentsClient) StartThenPoll(ctx context.Context, id ExperimentId) error { + result, err := c.Start(ctx, id) + if err != nil { + return fmt.Errorf("performing Start: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Start: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/method_update.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/method_update.go new file mode 100644 index 0000000000000..007b598ce8ed6 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/method_update.go @@ -0,0 +1,73 @@ +package experiments + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// Update ... +func (c ExperimentsClient) Update(ctx context.Context, id ExperimentId, input ExperimentUpdate) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// UpdateThenPoll performs Update then polls until it's completed +func (c ExperimentsClient) UpdateThenPoll(ctx context.Context, id ExperimentId, input ExperimentUpdate) error { + result, err := c.Update(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Update: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Update: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/model_action.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/model_action.go new file mode 100644 index 0000000000000..6f9cd44476e32 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/model_action.go @@ -0,0 +1,9 @@ +package experiments + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Action struct { + Name string `json:"name"` + Type string `json:"type"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/model_actionstatus.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/model_actionstatus.go new file mode 100644 index 0000000000000..4a666eb2a4a60 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/model_actionstatus.go @@ -0,0 +1,43 @@ +package experiments + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ActionStatus struct { + ActionId *string `json:"actionId,omitempty"` + ActionName *string `json:"actionName,omitempty"` + EndTime *string `json:"endTime,omitempty"` + StartTime *string `json:"startTime,omitempty"` + Status *string `json:"status,omitempty"` + Targets *[]ExperimentExecutionActionTargetDetailsProperties `json:"targets,omitempty"` +} + +func (o *ActionStatus) GetEndTimeAsTime() (*time.Time, error) { + if o.EndTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.EndTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *ActionStatus) SetEndTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.EndTime = &formatted +} + +func (o *ActionStatus) GetStartTimeAsTime() (*time.Time, error) { + if o.StartTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.StartTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *ActionStatus) SetStartTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.StartTime = &formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/model_branch.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/model_branch.go new file mode 100644 index 0000000000000..73523d5186b7e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/model_branch.go @@ -0,0 +1,9 @@ +package experiments + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Branch struct { + Actions []Action `json:"actions"` + Name string `json:"name"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/model_branchstatus.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/model_branchstatus.go new file mode 100644 index 0000000000000..d350c128f9545 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/model_branchstatus.go @@ -0,0 +1,11 @@ +package experiments + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BranchStatus struct { + Actions *[]ActionStatus `json:"actions,omitempty"` + BranchId *string `json:"branchId,omitempty"` + BranchName *string `json:"branchName,omitempty"` + Status *string `json:"status,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/model_experiment.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/model_experiment.go new file mode 100644 index 0000000000000..b61e3184f3ff8 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/model_experiment.go @@ -0,0 +1,20 @@ +package experiments + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Experiment struct { + Id *string `json:"id,omitempty"` + Identity *identity.SystemOrUserAssignedMap `json:"identity,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties ExperimentProperties `json:"properties"` + SystemData *systemdata.SystemData `json:"systemData,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/chaosstudio/2023-11-01/experiments/model_experimentexecution.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/model_experimentexecution.go new file mode 100644 index 0000000000000..ab8de86bf05cd --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/model_experimentexecution.go @@ -0,0 +1,11 @@ +package experiments + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ExperimentExecution struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *ExperimentExecutionProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/model_experimentexecutionactiontargetdetailserror.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/model_experimentexecutionactiontargetdetailserror.go new file mode 100644 index 0000000000000..ddb509c95f947 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/model_experimentexecutionactiontargetdetailserror.go @@ -0,0 +1,9 @@ +package experiments + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ExperimentExecutionActionTargetDetailsError struct { + Code *string `json:"code,omitempty"` + Message *string `json:"message,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/model_experimentexecutionactiontargetdetailsproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/model_experimentexecutionactiontargetdetailsproperties.go new file mode 100644 index 0000000000000..f9eb28e064dc5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/model_experimentexecutionactiontargetdetailsproperties.go @@ -0,0 +1,42 @@ +package experiments + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ExperimentExecutionActionTargetDetailsProperties struct { + Error *ExperimentExecutionActionTargetDetailsError `json:"error,omitempty"` + Status *string `json:"status,omitempty"` + Target *string `json:"target,omitempty"` + TargetCompletedTime *string `json:"targetCompletedTime,omitempty"` + TargetFailedTime *string `json:"targetFailedTime,omitempty"` +} + +func (o *ExperimentExecutionActionTargetDetailsProperties) GetTargetCompletedTimeAsTime() (*time.Time, error) { + if o.TargetCompletedTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.TargetCompletedTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *ExperimentExecutionActionTargetDetailsProperties) SetTargetCompletedTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.TargetCompletedTime = &formatted +} + +func (o *ExperimentExecutionActionTargetDetailsProperties) GetTargetFailedTimeAsTime() (*time.Time, error) { + if o.TargetFailedTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.TargetFailedTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *ExperimentExecutionActionTargetDetailsProperties) SetTargetFailedTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.TargetFailedTime = &formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/model_experimentexecutiondetails.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/model_experimentexecutiondetails.go new file mode 100644 index 0000000000000..a519ac5bbd1dc --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/model_experimentexecutiondetails.go @@ -0,0 +1,11 @@ +package experiments + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ExperimentExecutionDetails struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *ExperimentExecutionDetailsProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/model_experimentexecutiondetailsproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/model_experimentexecutiondetailsproperties.go new file mode 100644 index 0000000000000..9a63be73ac074 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/model_experimentexecutiondetailsproperties.go @@ -0,0 +1,55 @@ +package experiments + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ExperimentExecutionDetailsProperties struct { + FailureReason *string `json:"failureReason,omitempty"` + LastActionAt *string `json:"lastActionAt,omitempty"` + RunInformation *ExperimentExecutionDetailsPropertiesRunInformation `json:"runInformation,omitempty"` + StartedAt *string `json:"startedAt,omitempty"` + Status *string `json:"status,omitempty"` + StoppedAt *string `json:"stoppedAt,omitempty"` +} + +func (o *ExperimentExecutionDetailsProperties) GetLastActionAtAsTime() (*time.Time, error) { + if o.LastActionAt == nil { + return nil, nil + } + return dates.ParseAsFormat(o.LastActionAt, "2006-01-02T15:04:05Z07:00") +} + +func (o *ExperimentExecutionDetailsProperties) SetLastActionAtAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.LastActionAt = &formatted +} + +func (o *ExperimentExecutionDetailsProperties) GetStartedAtAsTime() (*time.Time, error) { + if o.StartedAt == nil { + return nil, nil + } + return dates.ParseAsFormat(o.StartedAt, "2006-01-02T15:04:05Z07:00") +} + +func (o *ExperimentExecutionDetailsProperties) SetStartedAtAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.StartedAt = &formatted +} + +func (o *ExperimentExecutionDetailsProperties) GetStoppedAtAsTime() (*time.Time, error) { + if o.StoppedAt == nil { + return nil, nil + } + return dates.ParseAsFormat(o.StoppedAt, "2006-01-02T15:04:05Z07:00") +} + +func (o *ExperimentExecutionDetailsProperties) SetStoppedAtAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.StoppedAt = &formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/model_experimentexecutiondetailspropertiesruninformation.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/model_experimentexecutiondetailspropertiesruninformation.go new file mode 100644 index 0000000000000..d82c701f77b4d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/model_experimentexecutiondetailspropertiesruninformation.go @@ -0,0 +1,8 @@ +package experiments + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ExperimentExecutionDetailsPropertiesRunInformation struct { + Steps *[]StepStatus `json:"steps,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/model_experimentexecutionproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/model_experimentexecutionproperties.go new file mode 100644 index 0000000000000..64c43e7a8c886 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/model_experimentexecutionproperties.go @@ -0,0 +1,40 @@ +package experiments + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ExperimentExecutionProperties struct { + StartedAt *string `json:"startedAt,omitempty"` + Status *string `json:"status,omitempty"` + StoppedAt *string `json:"stoppedAt,omitempty"` +} + +func (o *ExperimentExecutionProperties) GetStartedAtAsTime() (*time.Time, error) { + if o.StartedAt == nil { + return nil, nil + } + return dates.ParseAsFormat(o.StartedAt, "2006-01-02T15:04:05Z07:00") +} + +func (o *ExperimentExecutionProperties) SetStartedAtAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.StartedAt = &formatted +} + +func (o *ExperimentExecutionProperties) GetStoppedAtAsTime() (*time.Time, error) { + if o.StoppedAt == nil { + return nil, nil + } + return dates.ParseAsFormat(o.StoppedAt, "2006-01-02T15:04:05Z07:00") +} + +func (o *ExperimentExecutionProperties) SetStoppedAtAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.StoppedAt = &formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/model_experimentproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/model_experimentproperties.go new file mode 100644 index 0000000000000..a2d7f0e917c3a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/model_experimentproperties.go @@ -0,0 +1,10 @@ +package experiments + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ExperimentProperties struct { + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` + Selectors []Selector `json:"selectors"` + Steps []Step `json:"steps"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/model_experimentupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/model_experimentupdate.go new file mode 100644 index 0000000000000..965b4a08d48de --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/model_experimentupdate.go @@ -0,0 +1,12 @@ +package experiments + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ExperimentUpdate struct { + Identity *identity.SystemOrUserAssignedMap `json:"identity,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/model_filter.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/model_filter.go new file mode 100644 index 0000000000000..7c9cbc557a8a7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/model_filter.go @@ -0,0 +1,8 @@ +package experiments + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Filter struct { + Type FilterType `json:"type"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/model_selector.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/model_selector.go new file mode 100644 index 0000000000000..0e6c2684f9b11 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/model_selector.go @@ -0,0 +1,10 @@ +package experiments + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Selector struct { + Filter *Filter `json:"filter,omitempty"` + Id string `json:"id"` + Type SelectorType `json:"type"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/model_step.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/model_step.go new file mode 100644 index 0000000000000..791521bad2f80 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/model_step.go @@ -0,0 +1,9 @@ +package experiments + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Step struct { + Branches []Branch `json:"branches"` + Name string `json:"name"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/model_stepstatus.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/model_stepstatus.go new file mode 100644 index 0000000000000..f24804ea7f182 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/model_stepstatus.go @@ -0,0 +1,11 @@ +package experiments + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type StepStatus struct { + Branches *[]BranchStatus `json:"branches,omitempty"` + Status *string `json:"status,omitempty"` + StepId *string `json:"stepId,omitempty"` + StepName *string `json:"stepName,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/predicates.go new file mode 100644 index 0000000000000..3a90722ae88e3 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/predicates.go @@ -0,0 +1,55 @@ +package experiments + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ExperimentOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p ExperimentOperationPredicate) Matches(input Experiment) bool { + + if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { + return false + } + + if p.Location != nil && *p.Location != input.Location { + return false + } + + if p.Name != nil && (input.Name == nil || *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil || *p.Type != *input.Type) { + return false + } + + return true +} + +type ExperimentExecutionOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p ExperimentExecutionOperationPredicate) Matches(input ExperimentExecution) bool { + + if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil || *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil || *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/version.go new file mode 100644 index 0000000000000..45dc2209c5278 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments/version.go @@ -0,0 +1,12 @@ +package experiments + +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 = "2023-11-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/experiments/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/targets/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/targets/README.md new file mode 100644 index 0000000000000..d7899526b1d63 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/targets/README.md @@ -0,0 +1,90 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/targets` Documentation + +The `targets` SDK allows for interaction with the Azure Resource Manager Service `chaosstudio` (API Version `2023-11-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/targets" +``` + + +### Client Initialization + +```go +client := targets.NewTargetsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `TargetsClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := targets.NewScopedTargetID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group", "targetValue") + +payload := targets.Target{ + // ... +} + + +read, err := client.CreateOrUpdate(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `TargetsClient.Delete` + +```go +ctx := context.TODO() +id := targets.NewScopedTargetID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group", "targetValue") + +read, err := client.Delete(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `TargetsClient.Get` + +```go +ctx := context.TODO() +id := targets.NewScopedTargetID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group", "targetValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `TargetsClient.List` + +```go +ctx := context.TODO() +id := targets.NewScopeID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group") + +// alternatively `client.List(ctx, id, targets.DefaultListOperationOptions())` can be used to do batched pagination +items, err := client.ListComplete(ctx, id, targets.DefaultListOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/targets/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/targets/client.go new file mode 100644 index 0000000000000..4fa378b2dbc96 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/targets/client.go @@ -0,0 +1,26 @@ +package targets + +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TargetsClient struct { + Client *resourcemanager.Client +} + +func NewTargetsClientWithBaseURI(sdkApi sdkEnv.Api) (*TargetsClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "targets", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating TargetsClient: %+v", err) + } + + return &TargetsClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/targets/id_scopedtarget.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/targets/id_scopedtarget.go new file mode 100644 index 0000000000000..8f974b51d0928 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/targets/id_scopedtarget.go @@ -0,0 +1,115 @@ +package targets + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = ScopedTargetId{} + +// ScopedTargetId is a struct representing the Resource ID for a Scoped Target +type ScopedTargetId struct { + Scope string + TargetName string +} + +// NewScopedTargetID returns a new ScopedTargetId struct +func NewScopedTargetID(scope string, targetName string) ScopedTargetId { + return ScopedTargetId{ + Scope: scope, + TargetName: targetName, + } +} + +// ParseScopedTargetID parses 'input' into a ScopedTargetId +func ParseScopedTargetID(input string) (*ScopedTargetId, error) { + parser := resourceids.NewParserFromResourceIdType(ScopedTargetId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := ScopedTargetId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseScopedTargetIDInsensitively parses 'input' case-insensitively into a ScopedTargetId +// note: this method should only be used for API response data and not user input +func ParseScopedTargetIDInsensitively(input string) (*ScopedTargetId, error) { + parser := resourceids.NewParserFromResourceIdType(ScopedTargetId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := ScopedTargetId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ScopedTargetId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.Scope, ok = input.Parsed["scope"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scope", input) + } + + if id.TargetName, ok = input.Parsed["targetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "targetName", input) + } + + return nil +} + +// ValidateScopedTargetID checks that 'input' can be parsed as a Scoped Target ID +func ValidateScopedTargetID(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 := ParseScopedTargetID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Scoped Target ID +func (id ScopedTargetId) ID() string { + fmtString := "/%s/providers/Microsoft.Chaos/targets/%s" + return fmt.Sprintf(fmtString, strings.TrimPrefix(id.Scope, "/"), id.TargetName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Scoped Target ID +func (id ScopedTargetId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.ScopeSegment("scope", "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftChaos", "Microsoft.Chaos", "Microsoft.Chaos"), + resourceids.StaticSegment("staticTargets", "targets", "targets"), + resourceids.UserSpecifiedSegment("targetName", "targetValue"), + } +} + +// String returns a human-readable description of this Scoped Target ID +func (id ScopedTargetId) String() string { + components := []string{ + fmt.Sprintf("Scope: %q", id.Scope), + fmt.Sprintf("Target Name: %q", id.TargetName), + } + return fmt.Sprintf("Scoped Target (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/targets/method_createorupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/targets/method_createorupdate.go new file mode 100644 index 0000000000000..cd878889d9c23 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/targets/method_createorupdate.go @@ -0,0 +1,55 @@ +package targets + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *Target +} + +// CreateOrUpdate ... +func (c TargetsClient) CreateOrUpdate(ctx context.Context, id ScopedTargetId, input Target) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/targets/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/targets/method_delete.go new file mode 100644 index 0000000000000..4f8486a0379da --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/targets/method_delete.go @@ -0,0 +1,47 @@ +package targets + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// Delete ... +func (c TargetsClient) Delete(ctx context.Context, id ScopedTargetId) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/targets/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/targets/method_get.go new file mode 100644 index 0000000000000..bd0160969b8a4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/targets/method_get.go @@ -0,0 +1,51 @@ +package targets + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *Target +} + +// Get ... +func (c TargetsClient) Get(ctx context.Context, id ScopedTargetId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/targets/method_list.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/targets/method_list.go new file mode 100644 index 0000000000000..3fed8bc2f9f8e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/targets/method_list.go @@ -0,0 +1,120 @@ +package targets + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]Target +} + +type ListCompleteResult struct { + LatestHttpResponse *http.Response + Items []Target +} + +type ListOperationOptions struct { + ContinuationToken *string +} + +func DefaultListOperationOptions() ListOperationOptions { + return ListOperationOptions{} +} + +func (o ListOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.ContinuationToken != nil { + out.Append("continuationToken", fmt.Sprintf("%v", *o.ContinuationToken)) + } + return &out +} + +// List ... +func (c TargetsClient) List(ctx context.Context, id commonids.ScopeId, options ListOperationOptions) (result ListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/providers/Microsoft.Chaos/targets", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]Target `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListComplete retrieves all the results into a single object +func (c TargetsClient) ListComplete(ctx context.Context, id commonids.ScopeId, options ListOperationOptions) (ListCompleteResult, error) { + return c.ListCompleteMatchingPredicate(ctx, id, options, TargetOperationPredicate{}) +} + +// ListCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c TargetsClient) ListCompleteMatchingPredicate(ctx context.Context, id commonids.ScopeId, options ListOperationOptions, predicate TargetOperationPredicate) (result ListCompleteResult, err error) { + items := make([]Target, 0) + + resp, err := c.List(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/targets/model_target.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/targets/model_target.go new file mode 100644 index 0000000000000..92e4e94254d90 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/targets/model_target.go @@ -0,0 +1,17 @@ +package targets + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Target struct { + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties interface{} `json:"properties"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/targets/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/targets/predicates.go new file mode 100644 index 0000000000000..d3325e9406eba --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/targets/predicates.go @@ -0,0 +1,37 @@ +package targets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TargetOperationPredicate struct { + Id *string + Location *string + Name *string + Properties *interface{} + Type *string +} + +func (p TargetOperationPredicate) Matches(input Target) bool { + + if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { + return false + } + + if p.Location != nil && (input.Location == nil || *p.Location != *input.Location) { + return false + } + + if p.Name != nil && (input.Name == nil || *p.Name != *input.Name) { + return false + } + + if p.Properties != nil && *p.Properties != input.Properties { + return false + } + + if p.Type != nil && (input.Type == nil || *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/targets/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/targets/version.go new file mode 100644 index 0000000000000..fe3a08d004647 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/targets/version.go @@ -0,0 +1,12 @@ +package targets + +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 = "2023-11-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/targets/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/targettypes/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/targettypes/README.md new file mode 100644 index 0000000000000..036773d1c8bdb --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/targettypes/README.md @@ -0,0 +1,53 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/targettypes` Documentation + +The `targettypes` SDK allows for interaction with the Azure Resource Manager Service `chaosstudio` (API Version `2023-11-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/targettypes" +``` + + +### Client Initialization + +```go +client := targettypes.NewTargetTypesClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `TargetTypesClient.Get` + +```go +ctx := context.TODO() +id := targettypes.NewTargetTypeID("12345678-1234-9876-4563-123456789012", "locationValue", "targetTypeValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `TargetTypesClient.List` + +```go +ctx := context.TODO() +id := targettypes.NewLocationID("12345678-1234-9876-4563-123456789012", "locationValue") + +// alternatively `client.List(ctx, id, targettypes.DefaultListOperationOptions())` can be used to do batched pagination +items, err := client.ListComplete(ctx, id, targettypes.DefaultListOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/targettypes/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/targettypes/client.go new file mode 100644 index 0000000000000..ab93296dfcbd0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/targettypes/client.go @@ -0,0 +1,26 @@ +package targettypes + +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TargetTypesClient struct { + Client *resourcemanager.Client +} + +func NewTargetTypesClientWithBaseURI(sdkApi sdkEnv.Api) (*TargetTypesClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "targettypes", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating TargetTypesClient: %+v", err) + } + + return &TargetTypesClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/targettypes/id_location.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/targettypes/id_location.go new file mode 100644 index 0000000000000..5fbf500f9d5e9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/targettypes/id_location.go @@ -0,0 +1,116 @@ +package targettypes + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = LocationId{} + +// LocationId is a struct representing the Resource ID for a Location +type LocationId struct { + SubscriptionId string + LocationName string +} + +// NewLocationID returns a new LocationId struct +func NewLocationID(subscriptionId string, locationName string) LocationId { + return LocationId{ + SubscriptionId: subscriptionId, + LocationName: locationName, + } +} + +// ParseLocationID parses 'input' into a LocationId +func ParseLocationID(input string) (*LocationId, error) { + parser := resourceids.NewParserFromResourceIdType(LocationId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseLocationIDInsensitively parses 'input' case-insensitively into a LocationId +// note: this method should only be used for API response data and not user input +func ParseLocationIDInsensitively(input string) (*LocationId, error) { + parser := resourceids.NewParserFromResourceIdType(LocationId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) + } + + return nil +} + +// ValidateLocationID checks that 'input' can be parsed as a Location ID +func ValidateLocationID(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 := ParseLocationID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Location ID +func (id LocationId) ID() string { + fmtString := "/subscriptions/%s/providers/Microsoft.Chaos/locations/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.LocationName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Location ID +func (id LocationId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftChaos", "Microsoft.Chaos", "Microsoft.Chaos"), + resourceids.StaticSegment("staticLocations", "locations", "locations"), + resourceids.UserSpecifiedSegment("locationName", "locationValue"), + } +} + +// String returns a human-readable description of this Location ID +func (id LocationId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Location Name: %q", id.LocationName), + } + return fmt.Sprintf("Location (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/targettypes/id_targettype.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/targettypes/id_targettype.go new file mode 100644 index 0000000000000..32ca94c54df75 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/targettypes/id_targettype.go @@ -0,0 +1,125 @@ +package targettypes + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = TargetTypeId{} + +// TargetTypeId is a struct representing the Resource ID for a Target Type +type TargetTypeId struct { + SubscriptionId string + LocationName string + TargetTypeName string +} + +// NewTargetTypeID returns a new TargetTypeId struct +func NewTargetTypeID(subscriptionId string, locationName string, targetTypeName string) TargetTypeId { + return TargetTypeId{ + SubscriptionId: subscriptionId, + LocationName: locationName, + TargetTypeName: targetTypeName, + } +} + +// ParseTargetTypeID parses 'input' into a TargetTypeId +func ParseTargetTypeID(input string) (*TargetTypeId, error) { + parser := resourceids.NewParserFromResourceIdType(TargetTypeId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := TargetTypeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseTargetTypeIDInsensitively parses 'input' case-insensitively into a TargetTypeId +// note: this method should only be used for API response data and not user input +func ParseTargetTypeIDInsensitively(input string) (*TargetTypeId, error) { + parser := resourceids.NewParserFromResourceIdType(TargetTypeId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := TargetTypeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *TargetTypeId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) + } + + if id.TargetTypeName, ok = input.Parsed["targetTypeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "targetTypeName", input) + } + + return nil +} + +// ValidateTargetTypeID checks that 'input' can be parsed as a Target Type ID +func ValidateTargetTypeID(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 := ParseTargetTypeID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Target Type ID +func (id TargetTypeId) ID() string { + fmtString := "/subscriptions/%s/providers/Microsoft.Chaos/locations/%s/targetTypes/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.LocationName, id.TargetTypeName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Target Type ID +func (id TargetTypeId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftChaos", "Microsoft.Chaos", "Microsoft.Chaos"), + resourceids.StaticSegment("staticLocations", "locations", "locations"), + resourceids.UserSpecifiedSegment("locationName", "locationValue"), + resourceids.StaticSegment("staticTargetTypes", "targetTypes", "targetTypes"), + resourceids.UserSpecifiedSegment("targetTypeName", "targetTypeValue"), + } +} + +// String returns a human-readable description of this Target Type ID +func (id TargetTypeId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Location Name: %q", id.LocationName), + fmt.Sprintf("Target Type Name: %q", id.TargetTypeName), + } + return fmt.Sprintf("Target Type (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/targettypes/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/targettypes/method_get.go new file mode 100644 index 0000000000000..d1bf1830660a6 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/targettypes/method_get.go @@ -0,0 +1,51 @@ +package targettypes + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *TargetType +} + +// Get ... +func (c TargetTypesClient) Get(ctx context.Context, id TargetTypeId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/targettypes/method_list.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/targettypes/method_list.go new file mode 100644 index 0000000000000..3aed30bcc1fae --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/targettypes/method_list.go @@ -0,0 +1,119 @@ +package targettypes + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]TargetType +} + +type ListCompleteResult struct { + LatestHttpResponse *http.Response + Items []TargetType +} + +type ListOperationOptions struct { + ContinuationToken *string +} + +func DefaultListOperationOptions() ListOperationOptions { + return ListOperationOptions{} +} + +func (o ListOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.ContinuationToken != nil { + out.Append("continuationToken", fmt.Sprintf("%v", *o.ContinuationToken)) + } + return &out +} + +// List ... +func (c TargetTypesClient) List(ctx context.Context, id LocationId, options ListOperationOptions) (result ListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/targetTypes", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]TargetType `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListComplete retrieves all the results into a single object +func (c TargetTypesClient) ListComplete(ctx context.Context, id LocationId, options ListOperationOptions) (ListCompleteResult, error) { + return c.ListCompleteMatchingPredicate(ctx, id, options, TargetTypeOperationPredicate{}) +} + +// ListCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c TargetTypesClient) ListCompleteMatchingPredicate(ctx context.Context, id LocationId, options ListOperationOptions, predicate TargetTypeOperationPredicate) (result ListCompleteResult, err error) { + items := make([]TargetType, 0) + + resp, err := c.List(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/targettypes/model_targettype.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/targettypes/model_targettype.go new file mode 100644 index 0000000000000..8572edd35e4b4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/targettypes/model_targettype.go @@ -0,0 +1,17 @@ +package targettypes + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TargetType struct { + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties TargetTypeProperties `json:"properties"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/targettypes/model_targettypeproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/targettypes/model_targettypeproperties.go new file mode 100644 index 0000000000000..aa3a5e69fddc2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/targettypes/model_targettypeproperties.go @@ -0,0 +1,11 @@ +package targettypes + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TargetTypeProperties struct { + Description *string `json:"description,omitempty"` + DisplayName *string `json:"displayName,omitempty"` + PropertiesSchema *string `json:"propertiesSchema,omitempty"` + ResourceTypes *[]string `json:"resourceTypes,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/targettypes/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/targettypes/predicates.go new file mode 100644 index 0000000000000..2e7238df56b1f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/targettypes/predicates.go @@ -0,0 +1,32 @@ +package targettypes + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TargetTypeOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p TargetTypeOperationPredicate) Matches(input TargetType) bool { + + if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { + return false + } + + if p.Location != nil && (input.Location == nil || *p.Location != *input.Location) { + return false + } + + if p.Name != nil && (input.Name == nil || *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil || *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/targettypes/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/targettypes/version.go new file mode 100644 index 0000000000000..3ee9241126a56 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/targettypes/version.go @@ -0,0 +1,12 @@ +package targettypes + +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 = "2023-11-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/targettypes/%s", defaultApiVersion) +} diff --git a/vendor/modules.txt b/vendor/modules.txt index 293b424a355b1..572f761e0d77a 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -288,6 +288,12 @@ github.com/hashicorp/go-azure-sdk/resource-manager/batch/2023-05-01/pool github.com/hashicorp/go-azure-sdk/resource-manager/blueprints/2018-11-01-preview/assignment github.com/hashicorp/go-azure-sdk/resource-manager/blueprints/2018-11-01-preview/blueprint github.com/hashicorp/go-azure-sdk/resource-manager/blueprints/2018-11-01-preview/publishedblueprint +github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01 +github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/capabilities +github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/capabilitytypes +github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments +github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/targets +github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/targettypes github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2023-05-01/cognitiveservicesaccounts github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2023-05-01/deployments github.com/hashicorp/go-azure-sdk/resource-manager/communication/2023-03-31/communicationservices