diff --git a/.github/labeler-issue-triage.yml b/.github/labeler-issue-triage.yml index ed75fbafa56c..9ae02d984c14 100644 --- a/.github/labeler-issue-triage.yml +++ b/.github/labeler-issue-triage.yml @@ -131,6 +131,9 @@ service/dns: service/domain-services: - '### (|New or )Affected Resource\(s\)\/Data Source\(s\)((.|\n)*)azurerm_active_directory_domain_service((.|\n)*)###' +service/durable-task: + - '### (|New or )Affected Resource\(s\)\/Data Source\(s\)((.|\n)*)azurerm_durable_task_((.|\n)*)###' + service/dynatrace: - '### (|New or )Affected Resource\(s\)\/Data Source\(s\)((.|\n)*)azurerm_dynatrace_((.|\n)*)###' diff --git a/.github/labeler-pull-request-triage.yml b/.github/labeler-pull-request-triage.yml index 6bb19d21f6f1..ada972771f23 100644 --- a/.github/labeler-pull-request-triage.yml +++ b/.github/labeler-pull-request-triage.yml @@ -219,6 +219,11 @@ service/domain-services: - any-glob-to-any-file: - internal/services/domainservices/**/* +service/durable-task: +- changed-files: + - any-glob-to-any-file: + - internal/services/durabletask/**/* + service/dynatrace: - changed-files: - any-glob-to-any-file: diff --git a/.teamcity/components/generated/services.kt b/.teamcity/components/generated/services.kt index adf8613e23f9..5dbbb74bd08d 100644 --- a/.teamcity/components/generated/services.kt +++ b/.teamcity/components/generated/services.kt @@ -48,6 +48,7 @@ var services = mapOf( "devtestlabs" to "Dev Test", "digitaltwins" to "Digital Twins", "domainservices" to "DomainServices", + "durabletask" to "Durable Task", "dynatrace" to "Dynatrace", "elastic" to "Elastic", "elasticsan" to "ElasticSan", diff --git a/internal/clients/client.go b/internal/clients/client.go index 8e51e268146d..32a077cdf878 100644 --- a/internal/clients/client.go +++ b/internal/clients/client.go @@ -67,6 +67,7 @@ import ( digitaltwins "github.com/hashicorp/terraform-provider-azurerm/internal/services/digitaltwins/client" dns "github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/client" domainservices "github.com/hashicorp/terraform-provider-azurerm/internal/services/domainservices/client" + durabletask "github.com/hashicorp/terraform-provider-azurerm/internal/services/durabletask/client" dynatrace "github.com/hashicorp/terraform-provider-azurerm/internal/services/dynatrace/client" elastic "github.com/hashicorp/terraform-provider-azurerm/internal/services/elastic/client" elasticsan "github.com/hashicorp/terraform-provider-azurerm/internal/services/elasticsan/client" @@ -205,6 +206,7 @@ type Client struct { DigitalTwins *digitaltwins.Client Dns *dns_v2018_05_01.Client DomainServices *domainservices.Client + DurableTask *durabletask.Client Dynatrace *dynatrace.Client Elastic *elastic.Client ElasticSan *elasticsan.Client @@ -438,6 +440,9 @@ func (client *Client) Build(ctx context.Context, o *common.ClientOptions) error if client.DomainServices, err = domainservices.NewClient(o); err != nil { return fmt.Errorf("building clients for DomainServices: %+v", err) } + if client.DurableTask, err = durabletask.NewClient(o); err != nil { + return fmt.Errorf("building clients for DurableTask: %+v", err) + } if client.Elastic, err = elastic.NewClient(o); err != nil { return fmt.Errorf("building clients for Elastic: %+v", err) } diff --git a/internal/provider/services.go b/internal/provider/services.go index 407040b2df34..db92701110a9 100644 --- a/internal/provider/services.go +++ b/internal/provider/services.go @@ -51,6 +51,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/services/digitaltwins" "github.com/hashicorp/terraform-provider-azurerm/internal/services/dns" "github.com/hashicorp/terraform-provider-azurerm/internal/services/domainservices" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/durabletask" "github.com/hashicorp/terraform-provider-azurerm/internal/services/dynatrace" "github.com/hashicorp/terraform-provider-azurerm/internal/services/elastic" "github.com/hashicorp/terraform-provider-azurerm/internal/services/elasticsan" @@ -174,6 +175,7 @@ func SupportedTypedServices() []sdk.TypedServiceRegistration { digitaltwins.Registration{}, dns.Registration{}, domainservices.Registration{}, + durabletask.Registration{}, dynatrace.Registration{}, elasticsan.Registration{}, eventgrid.Registration{}, diff --git a/internal/services/durabletask/client/client.go b/internal/services/durabletask/client/client.go new file mode 100644 index 000000000000..5f0d0cc0b4e2 --- /dev/null +++ b/internal/services/durabletask/client/client.go @@ -0,0 +1,45 @@ +// Copyright IBM Corp. 2014, 2025 +// SPDX-License-Identifier: MPL-2.0 + +package client + +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/retentionpolicies" + "github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/schedulers" + "github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/taskhubs" + "github.com/hashicorp/terraform-provider-azurerm/internal/common" +) + +type Client struct { + SchedulersClient *schedulers.SchedulersClient + TaskHubsClient *taskhubs.TaskHubsClient + RetentionPoliciesClient *retentionpolicies.RetentionPoliciesClient +} + +func NewClient(o *common.ClientOptions) (*Client, error) { + schedulersClient, err := schedulers.NewSchedulersClientWithBaseURI(o.Environment.ResourceManager) + if err != nil { + return nil, fmt.Errorf("building Schedulers client: %+v", err) + } + o.Configure(schedulersClient.Client, o.Authorizers.ResourceManager) + + taskHubsClient, err := taskhubs.NewTaskHubsClientWithBaseURI(o.Environment.ResourceManager) + if err != nil { + return nil, fmt.Errorf("building TaskHubs client: %+v", err) + } + o.Configure(taskHubsClient.Client, o.Authorizers.ResourceManager) + + retentionPoliciesClient, err := retentionpolicies.NewRetentionPoliciesClientWithBaseURI(o.Environment.ResourceManager) + if err != nil { + return nil, fmt.Errorf("building RetentionPolicies client: %+v", err) + } + o.Configure(retentionPoliciesClient.Client, o.Authorizers.ResourceManager) + + return &Client{ + SchedulersClient: schedulersClient, + TaskHubsClient: taskHubsClient, + RetentionPoliciesClient: retentionPoliciesClient, + }, nil +} diff --git a/internal/services/durabletask/durable_task_hub_resource.go b/internal/services/durabletask/durable_task_hub_resource.go new file mode 100644 index 000000000000..f179fe63d673 --- /dev/null +++ b/internal/services/durabletask/durable_task_hub_resource.go @@ -0,0 +1,174 @@ +// Copyright IBM Corp. 2014, 2025 +// SPDX-License-Identifier: MPL-2.0 + +package durabletask + +import ( + "context" + "fmt" + "time" + + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/schedulers" + "github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/taskhubs" + "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/durabletask/validate" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" +) + +type TaskHubResourceModel struct { + Name string `tfschema:"name"` + SchedulerId string `tfschema:"scheduler_id"` + DashboardUrl string `tfschema:"dashboard_url"` +} + +type TaskHubResource struct{} + +var _ sdk.Resource = TaskHubResource{} + +func (r TaskHubResource) ResourceType() string { + return "azurerm_durable_task_hub" +} + +func (r TaskHubResource) ModelObject() interface{} { + return &TaskHubResourceModel{} +} + +func (r TaskHubResource) IDValidationFunc() pluginsdk.SchemaValidateFunc { + return taskhubs.ValidateTaskHubID +} + +func (r TaskHubResource) Arguments() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validate.TaskHubName, + }, + + "scheduler_id": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: schedulers.ValidateSchedulerID, + }, + } +} + +func (r TaskHubResource) Attributes() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ + "dashboard_url": { + Type: pluginsdk.TypeString, + Computed: true, + }, + } +} + +func (r TaskHubResource) Create() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.DurableTask.TaskHubsClient + + var model TaskHubResourceModel + if err := metadata.Decode(&model); err != nil { + return fmt.Errorf("decoding: %+v", err) + } + + schedulerId, err := schedulers.ParseSchedulerID(model.SchedulerId) + if err != nil { + return fmt.Errorf("parsing scheduler ID: %+v", err) + } + + id := taskhubs.NewTaskHubID(schedulerId.SubscriptionId, schedulerId.ResourceGroupName, schedulerId.SchedulerName, model.Name) + + metadata.Logger.Infof("Import check for %s", id) + existing, err := client.Get(ctx, id) + if err != nil && !response.WasNotFound(existing.HttpResponse) { + return fmt.Errorf("checking for presence of existing %s: %+v", id, err) + } + + if !response.WasNotFound(existing.HttpResponse) { + return metadata.ResourceRequiresImport(r.ResourceType(), id) + } + + metadata.Logger.Infof("Creating %s", id) + + properties := taskhubs.TaskHub{ + Properties: &taskhubs.TaskHubProperties{}, + } + + if err := client.CreateOrUpdateThenPoll(ctx, id, properties); err != nil { + return fmt.Errorf("creating %s: %+v", id, err) + } + + metadata.SetID(id) + return nil + }, + } +} + +func (r TaskHubResource) Read() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 5 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.DurableTask.TaskHubsClient + + id, err := taskhubs.ParseTaskHubID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + metadata.Logger.Infof("Reading %s", id) + resp, err := client.Get(ctx, *id) + if err != nil { + if response.WasNotFound(resp.HttpResponse) { + return metadata.MarkAsGone(id) + } + return fmt.Errorf("retrieving %s: %+v", *id, err) + } + + model := resp.Model + if model == nil { + return fmt.Errorf("retrieving %s: model was nil", id) + } + + schedulerId := schedulers.NewSchedulerID(id.SubscriptionId, id.ResourceGroupName, id.SchedulerName) + + state := TaskHubResourceModel{ + Name: id.TaskHubName, + SchedulerId: schedulerId.ID(), + } + + if props := model.Properties; props != nil { + state.DashboardUrl = pointer.From(props.DashboardURL) + } + + return metadata.Encode(&state) + }, + } +} + +func (r TaskHubResource) Delete() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.DurableTask.TaskHubsClient + + id, err := taskhubs.ParseTaskHubID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + metadata.Logger.Infof("Deleting %s", id) + + if err := client.DeleteThenPoll(ctx, *id); err != nil { + return fmt.Errorf("deleting %s: %+v", id, err) + } + + return nil + }, + } +} diff --git a/internal/services/durabletask/durable_task_hub_resource_test.go b/internal/services/durabletask/durable_task_hub_resource_test.go new file mode 100644 index 000000000000..45db49f43cf2 --- /dev/null +++ b/internal/services/durabletask/durable_task_hub_resource_test.go @@ -0,0 +1,107 @@ +// Copyright IBM Corp. 2014, 2025 +// SPDX-License-Identifier: MPL-2.0 + +package durabletask_test + +import ( + "context" + "fmt" + "testing" + + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/taskhubs" + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" + "github.com/hashicorp/terraform-provider-azurerm/internal/clients" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" +) + +type TaskHubResource struct{} + +func TestAccDurableTaskHub_basic(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_durable_task_hub", "test") + r := TaskHubResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func TestAccDurableTaskHub_requiresImport(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_durable_task_hub", "test") + r := TaskHubResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.RequiresImportErrorStep(r.requiresImport), + }) +} + +func (r TaskHubResource) Exists(ctx context.Context, client *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { + id, err := taskhubs.ParseTaskHubID(state.ID) + if err != nil { + return nil, err + } + + if _, err = client.DurableTask.TaskHubsClient.Get(ctx, *id); err != nil { + return nil, fmt.Errorf("retrieving %s: %v", id, err) + } + + return pointer.To(true), nil +} + +func (r TaskHubResource) template(data acceptance.TestData) string { + return fmt.Sprintf(` +provider "azurerm" { + features {} +} + +resource "azurerm_resource_group" "test" { + name = "acctestRG-durabletask-%d" + location = "%s" +} + +resource "azurerm_durable_task_scheduler" "test" { + name = "acctestdts%s" + resource_group_name = azurerm_resource_group.test.name + location = azurerm_resource_group.test.location + sku_name = "Consumption" + ip_allow_list = ["0.0.0.0/0"] +} +`, data.RandomInteger, data.Locations.Primary, data.RandomString) +} + +func (r TaskHubResource) basic(data acceptance.TestData) string { + template := r.template(data) + return fmt.Sprintf(` +%s + +resource "azurerm_durable_task_hub" "test" { + name = "acctestdth%s" + scheduler_id = azurerm_durable_task_scheduler.test.id +} +`, template, data.RandomString) +} + +func (r TaskHubResource) requiresImport(data acceptance.TestData) string { + template := r.basic(data) + return fmt.Sprintf(` +%s + +resource "azurerm_durable_task_hub" "import" { + name = azurerm_durable_task_hub.test.name + scheduler_id = azurerm_durable_task_hub.test.scheduler_id +} +`, template) +} diff --git a/internal/services/durabletask/durable_task_retention_policy_resource.go b/internal/services/durabletask/durable_task_retention_policy_resource.go new file mode 100644 index 000000000000..9fe6d5d3b69e --- /dev/null +++ b/internal/services/durabletask/durable_task_retention_policy_resource.go @@ -0,0 +1,273 @@ +// Copyright IBM Corp. 2014, 2025 +// SPDX-License-Identifier: MPL-2.0 + +package durabletask + +import ( + "context" + "fmt" + "time" + + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/retentionpolicies" + "github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/schedulers" + "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" +) + +type RetentionPolicyResourceModel struct { + SchedulerId string `tfschema:"scheduler_id"` + RetentionPolicy []RetentionPolicyItemModel `tfschema:"retention_policy"` +} + +type RetentionPolicyItemModel struct { + RetentionPeriodInDays int64 `tfschema:"retention_period_in_days"` + OrchestrationState string `tfschema:"orchestration_state"` +} + +type RetentionPolicyResource struct{} + +var ( + _ sdk.Resource = RetentionPolicyResource{} + _ sdk.ResourceWithUpdate = RetentionPolicyResource{} +) + +func (r RetentionPolicyResource) ResourceType() string { + return "azurerm_durable_task_retention_policy" +} + +func (r RetentionPolicyResource) ModelObject() interface{} { + return &RetentionPolicyResourceModel{} +} + +func (r RetentionPolicyResource) IDValidationFunc() pluginsdk.SchemaValidateFunc { + return ValidateRetentionPolicyID +} + +func (r RetentionPolicyResource) Arguments() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ + "scheduler_id": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: schedulers.ValidateSchedulerID, + }, + + "retention_policy": { + Type: pluginsdk.TypeList, + Required: true, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "retention_period_in_days": { + Type: pluginsdk.TypeInt, + Required: true, + ValidateFunc: validation.IntBetween(1, 90), + }, + + "orchestration_state": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: validation.StringInSlice(retentionpolicies.PossibleValuesForPurgeableOrchestrationState(), false), + }, + }, + }, + }, + } +} + +func (r RetentionPolicyResource) Attributes() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{} +} + +func (r RetentionPolicyResource) Create() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.DurableTask.RetentionPoliciesClient + + var model RetentionPolicyResourceModel + if err := metadata.Decode(&model); err != nil { + return fmt.Errorf("decoding: %+v", err) + } + + parsedId, err := schedulers.ParseSchedulerID(model.SchedulerId) + if err != nil { + return fmt.Errorf("parsing scheduler ID: %+v", err) + } + + schedulerId := retentionpolicies.NewSchedulerID(parsedId.SubscriptionId, parsedId.ResourceGroupName, parsedId.SchedulerName) + // Custom ID type needed because the retention policy is a singleton child resource with a + // fixed path `/retentionPolicies/default` under the parent scheduler. The SDK only provides + // scheduler ID helpers, but the Terraform resource's state/import ID must be the full child + // resource path (ending in `/retentionPolicies/default`) to uniquely identify this singleton. + id := NewRetentionPolicyID(parsedId.SubscriptionId, parsedId.ResourceGroupName, parsedId.SchedulerName) + + metadata.Logger.Infof("Import check for retention policy on %s", schedulerId.ID()) + existing, err := client.Get(ctx, schedulerId) + if err != nil && !response.WasNotFound(existing.HttpResponse) { + return fmt.Errorf("checking for presence of existing retention policy on %s: %+v", schedulerId.ID(), err) + } + + if !response.WasNotFound(existing.HttpResponse) { + return metadata.ResourceRequiresImport(r.ResourceType(), id) + } + + metadata.Logger.Infof("Creating retention policy on %s", schedulerId.ID()) + + policies := make([]retentionpolicies.RetentionPolicyDetails, 0) + for _, item := range model.RetentionPolicy { + policy := retentionpolicies.RetentionPolicyDetails{ + RetentionPeriodInDays: item.RetentionPeriodInDays, + } + + if item.OrchestrationState != "" { + state := retentionpolicies.PurgeableOrchestrationState(item.OrchestrationState) + policy.OrchestrationState = &state + } + + policies = append(policies, policy) + } + + properties := retentionpolicies.RetentionPolicy{ + Properties: &retentionpolicies.RetentionPolicyProperties{ + RetentionPolicies: &policies, + }, + } + + if err := client.CreateOrReplaceThenPoll(ctx, schedulerId, properties); err != nil { + return fmt.Errorf("creating retention policy on %s: %+v", schedulerId.ID(), err) + } + + metadata.SetID(id) + return nil + }, + } +} + +func (r RetentionPolicyResource) Read() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 5 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.DurableTask.RetentionPoliciesClient + + id, err := ParseRetentionPolicyID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + schedulerId := retentionpolicies.NewSchedulerID(id.SubscriptionId, id.ResourceGroupName, id.SchedulerName) + + metadata.Logger.Infof("Reading retention policy on %s", schedulerId.ID()) + resp, err := client.Get(ctx, schedulerId) + if err != nil { + if response.WasNotFound(resp.HttpResponse) { + return metadata.MarkAsGone(id) + } + return fmt.Errorf("retrieving retention policy on %s: %+v", schedulerId.ID(), err) + } + + model := resp.Model + if model == nil { + return fmt.Errorf("retrieving retention policy on %s: model was nil", schedulerId.ID()) + } + + state := RetentionPolicyResourceModel{ + SchedulerId: schedulerId.ID(), + RetentionPolicy: make([]RetentionPolicyItemModel, 0), + } + + if props := model.Properties; props != nil && props.RetentionPolicies != nil { + for _, policy := range *props.RetentionPolicies { + item := RetentionPolicyItemModel{ + RetentionPeriodInDays: policy.RetentionPeriodInDays, + } + if policy.OrchestrationState != nil { + item.OrchestrationState = string(*policy.OrchestrationState) + } + state.RetentionPolicy = append(state.RetentionPolicy, item) + } + } + + return metadata.Encode(&state) + }, + } +} + +func (r RetentionPolicyResource) Update() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.DurableTask.RetentionPoliciesClient + + id, err := ParseRetentionPolicyID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + var model RetentionPolicyResourceModel + if err := metadata.Decode(&model); err != nil { + return fmt.Errorf("decoding: %+v", err) + } + + schedulerId := retentionpolicies.NewSchedulerID(id.SubscriptionId, id.ResourceGroupName, id.SchedulerName) + + metadata.Logger.Infof("Updating retention policy on %s", schedulerId.ID()) + + if !metadata.ResourceData.HasChanges("retention_policy") { + metadata.Logger.Infof("No changes detected for retention_policy on %s", schedulerId.ID()) + return nil + } + + policies := make([]retentionpolicies.RetentionPolicyDetails, 0) + for _, item := range model.RetentionPolicy { + policy := retentionpolicies.RetentionPolicyDetails{ + RetentionPeriodInDays: item.RetentionPeriodInDays, + } + + if item.OrchestrationState != "" { + state := retentionpolicies.PurgeableOrchestrationState(item.OrchestrationState) + policy.OrchestrationState = &state + } + + policies = append(policies, policy) + } + + properties := retentionpolicies.RetentionPolicyUpdate{ + Properties: &retentionpolicies.RetentionPolicyProperties{ + RetentionPolicies: &policies, + }, + } + + if err := client.UpdateThenPoll(ctx, schedulerId, properties); err != nil { + return fmt.Errorf("updating retention policy on %s: %+v", schedulerId.ID(), err) + } + + return nil + }, + } +} + +func (r RetentionPolicyResource) Delete() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.DurableTask.RetentionPoliciesClient + + id, err := ParseRetentionPolicyID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + schedulerId := retentionpolicies.NewSchedulerID(id.SubscriptionId, id.ResourceGroupName, id.SchedulerName) + + metadata.Logger.Infof("Deleting retention policy on %s", schedulerId.ID()) + + if err := client.DeleteThenPoll(ctx, schedulerId); err != nil { + return fmt.Errorf("deleting retention policy on %s: %+v", schedulerId.ID(), err) + } + + return nil + }, + } +} diff --git a/internal/services/durabletask/durable_task_retention_policy_resource_test.go b/internal/services/durabletask/durable_task_retention_policy_resource_test.go new file mode 100644 index 000000000000..3ee6db289f84 --- /dev/null +++ b/internal/services/durabletask/durable_task_retention_policy_resource_test.go @@ -0,0 +1,186 @@ +// Copyright IBM Corp. 2014, 2025 +// SPDX-License-Identifier: MPL-2.0 + +package durabletask_test + +import ( + "context" + "fmt" + "testing" + + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/retentionpolicies" + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" + "github.com/hashicorp/terraform-provider-azurerm/internal/clients" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/durabletask" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" +) + +type RetentionPolicyResource struct{} + +func TestAccDurableTaskRetentionPolicy_basic(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_durable_task_retention_policy", "test") + r := RetentionPolicyResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func TestAccDurableTaskRetentionPolicy_requiresImport(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_durable_task_retention_policy", "test") + r := RetentionPolicyResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.RequiresImportErrorStep(r.requiresImport), + }) +} + +func TestAccDurableTaskRetentionPolicy_complete(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_durable_task_retention_policy", "test") + r := RetentionPolicyResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.complete(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func TestAccDurableTaskRetentionPolicy_update(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_durable_task_retention_policy", "test") + r := RetentionPolicyResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + { + Config: r.complete(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func (r RetentionPolicyResource) Exists(ctx context.Context, client *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { + id, err := durabletask.ParseRetentionPolicyID(state.ID) + if err != nil { + return nil, err + } + + schedulerId := retentionpolicies.NewSchedulerID(id.SubscriptionId, id.ResourceGroupName, id.SchedulerName) + + if _, err = client.DurableTask.RetentionPoliciesClient.Get(ctx, schedulerId); err != nil { + return nil, fmt.Errorf("retrieving retention policy for %s: %v", schedulerId, err) + } + + return pointer.To(true), nil +} + +func (r RetentionPolicyResource) template(data acceptance.TestData) string { + return fmt.Sprintf(` +provider "azurerm" { + features {} +} + +resource "azurerm_resource_group" "test" { + name = "acctestRG-durabletask-%d" + location = "%s" +} + +resource "azurerm_durable_task_scheduler" "test" { + name = "acctestdts%s" + resource_group_name = azurerm_resource_group.test.name + location = azurerm_resource_group.test.location + sku_name = "Consumption" + ip_allow_list = ["0.0.0.0/0"] +} +`, data.RandomInteger, data.Locations.Primary, data.RandomString) +} + +func (r RetentionPolicyResource) basic(data acceptance.TestData) string { + template := r.template(data) + return fmt.Sprintf(` +%s + +resource "azurerm_durable_task_retention_policy" "test" { + scheduler_id = azurerm_durable_task_scheduler.test.id + + retention_policy { + retention_period_in_days = 30 + } +} +`, template) +} + +func (r RetentionPolicyResource) requiresImport(data acceptance.TestData) string { + template := r.basic(data) + return fmt.Sprintf(` +%s + +resource "azurerm_durable_task_retention_policy" "import" { + scheduler_id = azurerm_durable_task_retention_policy.test.scheduler_id + + retention_policy { + retention_period_in_days = 30 + } +} +`, template) +} + +func (r RetentionPolicyResource) complete(data acceptance.TestData) string { + template := r.template(data) + return fmt.Sprintf(` +%s + +resource "azurerm_durable_task_retention_policy" "test" { + scheduler_id = azurerm_durable_task_scheduler.test.id + + retention_policy { + retention_period_in_days = 30 + orchestration_state = "Completed" + } + + retention_policy { + retention_period_in_days = 7 + orchestration_state = "Failed" + } + + retention_policy { + retention_period_in_days = 14 + orchestration_state = "Terminated" + } +} +`, template) +} diff --git a/internal/services/durabletask/durable_task_scheduler_data_source.go b/internal/services/durabletask/durable_task_scheduler_data_source.go new file mode 100644 index 000000000000..8f095fa001ad --- /dev/null +++ b/internal/services/durabletask/durable_task_scheduler_data_source.go @@ -0,0 +1,125 @@ +// Copyright IBM Corp. 2014, 2025 +// SPDX-License-Identifier: MPL-2.0 + +package durabletask + +import ( + "context" + "fmt" + "time" + + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/schedulers" + "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/durabletask/validate" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" +) + +type SchedulerDataSourceModel struct { + Name string `tfschema:"name"` + ResourceGroupName string `tfschema:"resource_group_name"` + Location string `tfschema:"location"` + SkuName string `tfschema:"sku_name"` + IpAllowList []string `tfschema:"ip_allow_list"` + Capacity int64 `tfschema:"capacity"` + Tags map[string]string `tfschema:"tags"` + Endpoint string `tfschema:"endpoint"` +} + +type SchedulerDataSource struct{} + +var _ sdk.DataSource = SchedulerDataSource{} + +func (d SchedulerDataSource) ResourceType() string { + return "azurerm_durable_task_scheduler" +} + +func (d SchedulerDataSource) ModelObject() interface{} { + return &SchedulerDataSourceModel{} +} + +func (d SchedulerDataSource) Arguments() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validate.SchedulerName, + }, + + "resource_group_name": commonschema.ResourceGroupNameForDataSource(), + } +} + +func (d SchedulerDataSource) Attributes() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ + "location": commonschema.LocationComputed(), + + "sku_name": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "ip_allow_list": { + Type: pluginsdk.TypeList, + Computed: true, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + }, + }, + + "capacity": { + Type: pluginsdk.TypeInt, + Computed: true, + }, + + "tags": commonschema.TagsDataSource(), + + "endpoint": { + Type: pluginsdk.TypeString, + Computed: true, + }, + } +} + +func (d SchedulerDataSource) Read() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 5 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.DurableTask.SchedulersClient + + var state SchedulerDataSourceModel + if err := metadata.Decode(&state); err != nil { + return fmt.Errorf("decoding: %+v", err) + } + + id := schedulers.NewSchedulerID(metadata.Client.Account.SubscriptionId, state.ResourceGroupName, state.Name) + + resp, err := client.Get(ctx, id) + if err != nil { + if response.WasNotFound(resp.HttpResponse) { + return fmt.Errorf("%s was not found", id) + } + return fmt.Errorf("retrieving %s: %+v", id, err) + } + + if model := resp.Model; model != nil { + state.Location = location.Normalize(model.Location) + state.Tags = pointer.From(model.Tags) + + if props := model.Properties; props != nil { + state.SkuName = string(props.Sku.Name) + state.Capacity = pointer.From(props.Sku.Capacity) + state.IpAllowList = props.IPAllowlist + state.Endpoint = pointer.From(props.Endpoint) + } + } + + metadata.SetID(id) + + return metadata.Encode(&state) + }, + } +} diff --git a/internal/services/durabletask/durable_task_scheduler_data_source_test.go b/internal/services/durabletask/durable_task_scheduler_data_source_test.go new file mode 100644 index 000000000000..9d0e55dbf99d --- /dev/null +++ b/internal/services/durabletask/durable_task_scheduler_data_source_test.go @@ -0,0 +1,78 @@ +// Copyright IBM Corp. 2014, 2025 +// SPDX-License-Identifier: MPL-2.0 + +package durabletask_test + +import ( + "fmt" + "testing" + + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" +) + +type SchedulerDataSource struct{} + +func TestAccDurableTaskSchedulerDataSource_basic(t *testing.T) { + data := acceptance.BuildTestData(t, "data.azurerm_durable_task_scheduler", "test") + r := SchedulerDataSource{} + + data.DataSourceTest(t, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).Key("id").Exists(), + check.That(data.ResourceName).Key("sku_name").HasValue("Consumption"), + check.That(data.ResourceName).Key("location").Exists(), + check.That(data.ResourceName).Key("endpoint").Exists(), + check.That(data.ResourceName).Key("ip_allow_list.#").Exists(), + check.That(data.ResourceName).Key("tags.%").HasValue("0"), + ), + }, + }) +} + +func TestAccDurableTaskSchedulerDataSource_complete(t *testing.T) { + data := acceptance.BuildTestData(t, "data.azurerm_durable_task_scheduler", "test") + r := SchedulerDataSource{} + + data.DataSourceTest(t, []acceptance.TestStep{ + { + Config: r.complete(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).Key("id").Exists(), + check.That(data.ResourceName).Key("sku_name").HasValue("Dedicated"), + check.That(data.ResourceName).Key("location").Exists(), + check.That(data.ResourceName).Key("endpoint").Exists(), + check.That(data.ResourceName).Key("ip_allow_list.#").HasValue("2"), + check.That(data.ResourceName).Key("capacity").HasValue("2"), + check.That(data.ResourceName).Key("tags.environment").HasValue("test"), + check.That(data.ResourceName).Key("tags.purpose").HasValue("acceptance-testing"), + ), + }, + }) +} + +func (r SchedulerDataSource) basic(data acceptance.TestData) string { + template := SchedulerResource{}.basic(data) + return fmt.Sprintf(` +%s + +data "azurerm_durable_task_scheduler" "test" { + name = azurerm_durable_task_scheduler.test.name + resource_group_name = azurerm_durable_task_scheduler.test.resource_group_name +} +`, template) +} + +func (r SchedulerDataSource) complete(data acceptance.TestData) string { + template := SchedulerResource{}.complete(data) + return fmt.Sprintf(` +%s + +data "azurerm_durable_task_scheduler" "test" { + name = azurerm_durable_task_scheduler.test.name + resource_group_name = azurerm_durable_task_scheduler.test.resource_group_name +} +`, template) +} diff --git a/internal/services/durabletask/durable_task_scheduler_resource.go b/internal/services/durabletask/durable_task_scheduler_resource.go new file mode 100644 index 000000000000..4a0efa74d45d --- /dev/null +++ b/internal/services/durabletask/durable_task_scheduler_resource.go @@ -0,0 +1,287 @@ +// Copyright IBM Corp. 2014, 2025 +// SPDX-License-Identifier: MPL-2.0 + +package durabletask + +import ( + "context" + "errors" + "fmt" + "time" + + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/schedulers" + "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/durabletask/validate" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" +) + +type SchedulerResourceModel struct { + Name string `tfschema:"name"` + ResourceGroupName string `tfschema:"resource_group_name"` + Location string `tfschema:"location"` + IpAllowList []string `tfschema:"ip_allow_list"` + SkuName string `tfschema:"sku_name"` + Capacity int64 `tfschema:"capacity"` + Tags map[string]string `tfschema:"tags"` + Endpoint string `tfschema:"endpoint"` +} + +type SchedulerResource struct{} + +var ( + _ sdk.Resource = SchedulerResource{} + _ sdk.ResourceWithUpdate = SchedulerResource{} + _ sdk.ResourceWithCustomizeDiff = SchedulerResource{} +) + +func (r SchedulerResource) ResourceType() string { + return "azurerm_durable_task_scheduler" +} + +func (r SchedulerResource) ModelObject() interface{} { + return &SchedulerResourceModel{} +} + +func (r SchedulerResource) IDValidationFunc() pluginsdk.SchemaValidateFunc { + return schedulers.ValidateSchedulerID +} + +func (r SchedulerResource) Arguments() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validate.SchedulerName, + }, + + "resource_group_name": commonschema.ResourceGroupName(), + + "location": commonschema.Location(), + + "ip_allow_list": { + Type: pluginsdk.TypeList, + Required: true, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + ValidateFunc: validation.Any(validation.IsIPAddress, validation.IsCIDR), + }, + }, + + "sku_name": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice(schedulers.PossibleValuesForSchedulerSkuName(), false), + }, + + "capacity": { + Type: pluginsdk.TypeInt, + Optional: true, + ValidateFunc: validation.IntAtLeast(1), + }, + + "tags": commonschema.Tags(), + } +} + +func (r SchedulerResource) Attributes() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ + "endpoint": { + Type: pluginsdk.TypeString, + Computed: true, + }, + } +} + +func (r SchedulerResource) CustomizeDiff() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 5 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + if metadata.ResourceDiff == nil { + return nil + } + + rawConfig := metadata.ResourceDiff.GetRawConfig().AsValueMap() + rawCapacity := rawConfig["capacity"] + + if !rawCapacity.IsNull() { + skuName := metadata.ResourceDiff.Get("sku_name").(string) + if skuName != string(schedulers.SchedulerSkuNameDedicated) { + return errors.New("`capacity` can only be configured when `sku_name` is set to `Dedicated`") + } + } + + return nil + }, + } +} + +func (r SchedulerResource) Create() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.DurableTask.SchedulersClient + subscriptionId := metadata.Client.Account.SubscriptionId + + var model SchedulerResourceModel + if err := metadata.Decode(&model); err != nil { + return fmt.Errorf("decoding: %+v", err) + } + + id := schedulers.NewSchedulerID(subscriptionId, model.ResourceGroupName, model.Name) + + metadata.Logger.Infof("Import check for %s", id) + existing, err := client.Get(ctx, id) + if err != nil && !response.WasNotFound(existing.HttpResponse) { + return fmt.Errorf("checking for presence of existing %s: %+v", id, err) + } + + if !response.WasNotFound(existing.HttpResponse) { + return metadata.ResourceRequiresImport(r.ResourceType(), id) + } + + metadata.Logger.Infof("Creating %s", id) + + properties := schedulers.Scheduler{ + Location: location.Normalize(model.Location), + Properties: &schedulers.SchedulerProperties{ + Sku: schedulers.SchedulerSku{ + Name: schedulers.SchedulerSkuName(model.SkuName), + }, + IPAllowlist: model.IpAllowList, + }, + Tags: &model.Tags, + } + + if model.Capacity != 0 { + properties.Properties.Sku.Capacity = pointer.To(model.Capacity) + } + + if err := client.CreateOrUpdateThenPoll(ctx, id, properties); err != nil { + return fmt.Errorf("creating %s: %+v", id, err) + } + + metadata.SetID(id) + return nil + }, + } +} + +func (r SchedulerResource) Read() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 5 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.DurableTask.SchedulersClient + + id, err := schedulers.ParseSchedulerID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + metadata.Logger.Infof("Reading %s", id) + resp, err := client.Get(ctx, *id) + if err != nil { + if response.WasNotFound(resp.HttpResponse) { + return metadata.MarkAsGone(id) + } + return fmt.Errorf("retrieving %s: %+v", *id, err) + } + + model := resp.Model + if model == nil { + return fmt.Errorf("retrieving %s: model was nil", id) + } + + state := SchedulerResourceModel{ + Name: id.SchedulerName, + ResourceGroupName: id.ResourceGroupName, + Location: location.Normalize(model.Location), + } + + state.Tags = pointer.From(model.Tags) + + if props := model.Properties; props != nil { + state.SkuName = string(props.Sku.Name) + state.Capacity = pointer.From(props.Sku.Capacity) + state.IpAllowList = props.IPAllowlist + state.Endpoint = pointer.From(props.Endpoint) + } + + return metadata.Encode(&state) + }, + } +} + +func (r SchedulerResource) Update() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.DurableTask.SchedulersClient + + id, err := schedulers.ParseSchedulerID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + var model SchedulerResourceModel + if err := metadata.Decode(&model); err != nil { + return fmt.Errorf("decoding: %+v", err) + } + + metadata.Logger.Infof("Updating %s", id) + + properties := schedulers.SchedulerUpdate{ + Properties: &schedulers.SchedulerPropertiesUpdate{}, + } + + if metadata.ResourceData.HasChange("ip_allow_list") { + properties.Properties.IPAllowlist = &model.IpAllowList + } + + if metadata.ResourceData.HasChange("capacity") { + if properties.Properties.Sku == nil { + properties.Properties.Sku = &schedulers.SchedulerSkuUpdate{} + } + properties.Properties.Sku.Capacity = pointer.To(model.Capacity) + } + + if metadata.ResourceData.HasChange("tags") { + properties.Tags = &model.Tags + } + + if err := client.UpdateThenPoll(ctx, *id, properties); err != nil { + return fmt.Errorf("updating %s: %+v", id, err) + } + + return nil + }, + } +} + +func (r SchedulerResource) Delete() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.DurableTask.SchedulersClient + + id, err := schedulers.ParseSchedulerID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + metadata.Logger.Infof("Deleting %s", id) + + if err := client.DeleteThenPoll(ctx, *id); err != nil { + return fmt.Errorf("deleting %s: %+v", id, err) + } + + return nil + }, + } +} diff --git a/internal/services/durabletask/durable_task_scheduler_resource_test.go b/internal/services/durabletask/durable_task_scheduler_resource_test.go new file mode 100644 index 000000000000..04664c5e57bd --- /dev/null +++ b/internal/services/durabletask/durable_task_scheduler_resource_test.go @@ -0,0 +1,249 @@ +// Copyright IBM Corp. 2014, 2025 +// SPDX-License-Identifier: MPL-2.0 + +package durabletask_test + +import ( + "context" + "fmt" + "regexp" + "testing" + + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/schedulers" + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" + "github.com/hashicorp/terraform-provider-azurerm/internal/clients" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" +) + +type SchedulerResource struct{} + +func TestAccDurableTaskScheduler_basic(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_durable_task_scheduler", "test") + r := SchedulerResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func TestAccDurableTaskScheduler_requiresImport(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_durable_task_scheduler", "test") + r := SchedulerResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.RequiresImportErrorStep(r.requiresImport), + }) +} + +func TestAccDurableTaskScheduler_complete(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_durable_task_scheduler", "test") + r := SchedulerResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.complete(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func TestAccDurableTaskScheduler_update(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_durable_task_scheduler", "test") + r := SchedulerResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + { + Config: r.update(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func TestAccDurableTaskScheduler_dedicatedWithCapacity(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_durable_task_scheduler", "test") + r := SchedulerResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.dedicatedWithCapacity(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func TestAccDurableTaskScheduler_consumptionWithCapacityFails(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_durable_task_scheduler", "test") + r := SchedulerResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.consumptionWithCapacity(data), + ExpectError: regexp.MustCompile("`capacity` can only be configured when `sku_name` is set to `Dedicated`"), + }, + }) +} + +func (r SchedulerResource) Exists(ctx context.Context, client *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { + id, err := schedulers.ParseSchedulerID(state.ID) + if err != nil { + return nil, err + } + + if _, err = client.DurableTask.SchedulersClient.Get(ctx, *id); err != nil { + return nil, fmt.Errorf("retrieving %s: %v", id, err) + } + + return pointer.To(true), nil +} + +func (r SchedulerResource) template(data acceptance.TestData) string { + return fmt.Sprintf(` +provider "azurerm" { + features {} +} + +resource "azurerm_resource_group" "test" { + name = "acctestRG-durabletask-%d" + location = "%s" +} +`, data.RandomInteger, data.Locations.Primary) +} + +func (r SchedulerResource) basic(data acceptance.TestData) string { + template := r.template(data) + return fmt.Sprintf(` +%s + +resource "azurerm_durable_task_scheduler" "test" { + name = "acctestdts%s" + resource_group_name = azurerm_resource_group.test.name + location = azurerm_resource_group.test.location + sku_name = "Consumption" + ip_allow_list = ["0.0.0.0/0"] +} +`, template, data.RandomString) +} + +func (r SchedulerResource) requiresImport(data acceptance.TestData) string { + template := r.basic(data) + return fmt.Sprintf(` +%s + +resource "azurerm_durable_task_scheduler" "import" { + name = azurerm_durable_task_scheduler.test.name + resource_group_name = azurerm_durable_task_scheduler.test.resource_group_name + location = azurerm_durable_task_scheduler.test.location + sku_name = azurerm_durable_task_scheduler.test.sku_name + ip_allow_list = azurerm_durable_task_scheduler.test.ip_allow_list +} +`, template) +} + +func (r SchedulerResource) update(data acceptance.TestData) string { + template := r.template(data) + return fmt.Sprintf(` +%s + +resource "azurerm_durable_task_scheduler" "test" { + name = "acctestdts%s" + resource_group_name = azurerm_resource_group.test.name + location = azurerm_resource_group.test.location + sku_name = "Consumption" + ip_allow_list = ["10.0.0.0/8", "192.168.0.0/16"] + + tags = { + environment = "staging" + } +} +`, template, data.RandomString) +} + +func (r SchedulerResource) complete(data acceptance.TestData) string { + template := r.template(data) + return fmt.Sprintf(` +%s + +resource "azurerm_durable_task_scheduler" "test" { + name = "acctestdts%s" + resource_group_name = azurerm_resource_group.test.name + location = azurerm_resource_group.test.location + sku_name = "Dedicated" + ip_allow_list = ["10.0.0.0/8", "192.168.0.0/16"] + capacity = 2 + + tags = { + environment = "test" + purpose = "acceptance-testing" + } +} +`, template, data.RandomString) +} + +func (r SchedulerResource) dedicatedWithCapacity(data acceptance.TestData) string { + template := r.template(data) + return fmt.Sprintf(` +%s + +resource "azurerm_durable_task_scheduler" "test" { + name = "acctestdts%s" + resource_group_name = azurerm_resource_group.test.name + location = azurerm_resource_group.test.location + sku_name = "Dedicated" + ip_allow_list = ["0.0.0.0/0"] + capacity = 2 +} +`, template, data.RandomString) +} + +func (r SchedulerResource) consumptionWithCapacity(data acceptance.TestData) string { + template := r.template(data) + return fmt.Sprintf(` +%s + +resource "azurerm_durable_task_scheduler" "test" { + name = "acctestdts%s" + resource_group_name = azurerm_resource_group.test.name + location = azurerm_resource_group.test.location + sku_name = "Consumption" + ip_allow_list = ["0.0.0.0/0"] + capacity = 1 +} +`, template, data.RandomString) +} diff --git a/internal/services/durabletask/parse.go b/internal/services/durabletask/parse.go new file mode 100644 index 000000000000..df5350cf71d0 --- /dev/null +++ b/internal/services/durabletask/parse.go @@ -0,0 +1,106 @@ +// Copyright IBM Corp. 2014, 2025 +// SPDX-License-Identifier: MPL-2.0 + +package durabletask + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// RetentionPolicyID is a synthetic Terraform ID used to represent the full singleton child path +// ending in /retentionPolicies/default. This design choice allows the state/import ID for this +// resource to include the retention policy endpoint, rather than just the parent scheduler ID. +type RetentionPolicyID struct { + SubscriptionId string + ResourceGroupName string + SchedulerName string +} + +var _ resourceids.ResourceId = &RetentionPolicyID{} + +func NewRetentionPolicyID(subscriptionId, resourceGroupName, schedulerName string) RetentionPolicyID { + return RetentionPolicyID{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + SchedulerName: schedulerName, + } +} + +func (id RetentionPolicyID) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DurableTask/schedulers/%s/retentionPolicies/default" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.SchedulerName) +} + +func (id RetentionPolicyID) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Scheduler Name: %q", id.SchedulerName), + } + return fmt.Sprintf("Retention Policy (%s)", strings.Join(components, "\n")) +} + +func (id RetentionPolicyID) 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("staticMicrosoftDurableTask", "Microsoft.DurableTask", "Microsoft.DurableTask"), + resourceids.StaticSegment("staticSchedulers", "schedulers", "schedulers"), + resourceids.UserSpecifiedSegment("schedulerName", "schedulerName"), + resourceids.StaticSegment("staticRetentionPolicies", "retentionPolicies", "retentionPolicies"), + resourceids.StaticSegment("staticDefault", "default", "default"), + } +} + +func (id *RetentionPolicyID) 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.SchedulerName, ok = input.Parsed["schedulerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "schedulerName", input) + } + + return nil +} + +func ParseRetentionPolicyID(input string) (*RetentionPolicyID, error) { + parser := resourceids.NewParserFromResourceIdType(&RetentionPolicyID{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := RetentionPolicyID{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func ValidateRetentionPolicyID(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 := ParseRetentionPolicyID(v); err != nil { + errors = append(errors, err) + } + + return +} diff --git a/internal/services/durabletask/parse_test.go b/internal/services/durabletask/parse_test.go new file mode 100644 index 000000000000..c2621e2aa6d4 --- /dev/null +++ b/internal/services/durabletask/parse_test.go @@ -0,0 +1,122 @@ +// Copyright IBM Corp. 2014, 2025 +// SPDX-License-Identifier: MPL-2.0 + +package durabletask_test + +import ( + "testing" + + "github.com/hashicorp/terraform-provider-azurerm/internal/services/durabletask" +) + +func TestParseRetentionPolicyID(t *testing.T) { + testCases := []struct { + Input string + Valid bool + Expected *durabletask.RetentionPolicyID + }{ + { + Input: "/subscriptions/12345678-1234-1234-1234-123456789012/resourceGroups/rg1/providers/Microsoft.DurableTask/schedulers/scheduler1/retentionPolicies/default", + Valid: true, + Expected: &durabletask.RetentionPolicyID{ + SubscriptionId: "12345678-1234-1234-1234-123456789012", + ResourceGroupName: "rg1", + SchedulerName: "scheduler1", + }, + }, + { + Input: "/subscriptions/12345678-1234-1234-1234-123456789012/resourceGroups/test-rg/providers/Microsoft.DurableTask/schedulers/test-scheduler/retentionPolicies/default", + Valid: true, + Expected: &durabletask.RetentionPolicyID{ + SubscriptionId: "12345678-1234-1234-1234-123456789012", + ResourceGroupName: "test-rg", + SchedulerName: "test-scheduler", + }, + }, + { + Input: "/subscriptions/12345/resourceGroups/rg1/providers/Microsoft.Network/policies/policy1", + Valid: false, + }, + { + Input: "", + Valid: false, + }, + { + Input: "this-is-not-a-valid-resource-id", + Valid: false, + }, + } + + for _, tc := range testCases { + t.Run(tc.Input, func(t *testing.T) { + result, err := durabletask.ParseRetentionPolicyID(tc.Input) + valid := err == nil + if tc.Valid != valid { + t.Fatalf("expected valid=%t for %q, got valid=%t: %+v", tc.Valid, tc.Input, valid, err) + } + if tc.Valid { + if result == nil { + t.Fatalf("expected non-nil result for %q", tc.Input) + } + if result.SubscriptionId != tc.Expected.SubscriptionId { + t.Fatalf("expected SubscriptionId %q, got %q", tc.Expected.SubscriptionId, result.SubscriptionId) + } + if result.ResourceGroupName != tc.Expected.ResourceGroupName { + t.Fatalf("expected ResourceGroupName %q, got %q", tc.Expected.ResourceGroupName, result.ResourceGroupName) + } + if result.SchedulerName != tc.Expected.SchedulerName { + t.Fatalf("expected SchedulerName %q, got %q", tc.Expected.SchedulerName, result.SchedulerName) + } + } + }) + } +} + +func TestRetentionPolicyID_ID(t *testing.T) { + id := durabletask.RetentionPolicyID{ + SubscriptionId: "12345678-1234-1234-1234-123456789012", + ResourceGroupName: "test-rg", + SchedulerName: "test-scheduler", + } + + expected := "/subscriptions/12345678-1234-1234-1234-123456789012/resourceGroups/test-rg/providers/Microsoft.DurableTask/schedulers/test-scheduler/retentionPolicies/default" + actual := id.ID() + + if expected != actual { + t.Fatalf("expected %q, got %q", expected, actual) + } +} + +func TestValidateRetentionPolicyID(t *testing.T) { + cases := []struct { + Input string + Valid bool + }{ + {Input: "/subscriptions/12345678-1234-1234-1234-123456789012/resourceGroups/rg1/providers/Microsoft.DurableTask/schedulers/scheduler1/retentionPolicies/default", Valid: true}, + {Input: "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.DurableTask/schedulers/test-scheduler/retentionPolicies/default", Valid: true}, + {Input: "", Valid: false}, + {Input: "not-a-valid-id", Valid: false}, + } + + for _, tc := range cases { + _, errors := durabletask.ValidateRetentionPolicyID(tc.Input, "id") + valid := len(errors) == 0 + if tc.Valid != valid { + t.Fatalf("expected valid=%t for %q, got valid=%t", tc.Valid, tc.Input, valid) + } + } +} + +func TestNewRetentionPolicyID(t *testing.T) { + id := durabletask.NewRetentionPolicyID("sub-123", "rg-test", "scheduler-1") + + if id.SubscriptionId != "sub-123" { + t.Fatalf("expected SubscriptionId %q, got %q", "sub-123", id.SubscriptionId) + } + if id.ResourceGroupName != "rg-test" { + t.Fatalf("expected ResourceGroupName %q, got %q", "rg-test", id.ResourceGroupName) + } + if id.SchedulerName != "scheduler-1" { + t.Fatalf("expected SchedulerName %q, got %q", "scheduler-1", id.SchedulerName) + } +} diff --git a/internal/services/durabletask/registration.go b/internal/services/durabletask/registration.go new file mode 100644 index 000000000000..23c120b638be --- /dev/null +++ b/internal/services/durabletask/registration.go @@ -0,0 +1,52 @@ +// Copyright IBM Corp. 2014, 2025 +// SPDX-License-Identifier: MPL-2.0 + +package durabletask + +import ( + "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" +) + +type Registration struct{} + +var ( + _ sdk.TypedServiceRegistration = Registration{} + _ sdk.UntypedServiceRegistrationWithAGitHubLabel = Registration{} +) + +func (r Registration) AssociatedGitHubLabel() string { + return "service/durable-task" +} + +func (r Registration) DataSources() []sdk.DataSource { + return []sdk.DataSource{ + SchedulerDataSource{}, + } +} + +func (r Registration) Resources() []sdk.Resource { + return []sdk.Resource{ + RetentionPolicyResource{}, + SchedulerResource{}, + TaskHubResource{}, + } +} + +func (r Registration) Name() string { + return "Durable Task" +} + +func (r Registration) WebsiteCategories() []string { + return []string{ + "Durable Task", + } +} + +func (r Registration) SupportedDataSources() map[string]*pluginsdk.Resource { + return map[string]*pluginsdk.Resource{} +} + +func (r Registration) SupportedResources() map[string]*pluginsdk.Resource { + return map[string]*pluginsdk.Resource{} +} diff --git a/internal/services/durabletask/validate/scheduler_name.go b/internal/services/durabletask/validate/scheduler_name.go new file mode 100644 index 000000000000..931f621097a5 --- /dev/null +++ b/internal/services/durabletask/validate/scheduler_name.go @@ -0,0 +1,24 @@ +// Copyright IBM Corp. 2014, 2025 +// SPDX-License-Identifier: MPL-2.0 + +package validate + +import ( + "fmt" + "regexp" +) + +func SchedulerName(v interface{}, k string) (warnings []string, errors []error) { + value := v.(string) + + if len(value) < 3 || len(value) > 63 { + errors = append(errors, fmt.Errorf("property `%s` must be between 3 and 63 characters, got %d", k, len(value))) + return warnings, errors + } + + if matched := regexp.MustCompile(`^[a-zA-Z0-9][a-zA-Z0-9-]*[a-zA-Z0-9]$`).MatchString(value); !matched { + errors = append(errors, fmt.Errorf("property `%s` must start and end with alphanumeric characters and can contain hyphens", k)) + } + + return warnings, errors +} diff --git a/internal/services/durabletask/validate/scheduler_name_test.go b/internal/services/durabletask/validate/scheduler_name_test.go new file mode 100644 index 000000000000..a841f21aa5fb --- /dev/null +++ b/internal/services/durabletask/validate/scheduler_name_test.go @@ -0,0 +1,41 @@ +// Copyright IBM Corp. 2014, 2025 +// SPDX-License-Identifier: MPL-2.0 + +package validate_test + +import ( + "strings" + "testing" + + "github.com/hashicorp/terraform-provider-azurerm/internal/services/durabletask/validate" +) + +func TestSchedulerName(t *testing.T) { + cases := []struct { + Input string + Valid bool + }{ + {Input: "validname", Valid: true}, + {Input: "valid-name", Valid: true}, + {Input: "valid123", Valid: true}, + {Input: "name-with-numbers-123", Valid: true}, + {Input: "abc", Valid: true}, + {Input: strings.Repeat("a", 63), Valid: true}, + {Input: "scheduler-1", Valid: true}, + {Input: "my-scheduler", Valid: true}, + {Input: "test123scheduler", Valid: true}, + {Input: "", Valid: false}, + {Input: "ab", Valid: false}, + {Input: "-invalid", Valid: false}, + {Input: "invalid-", Valid: false}, + {Input: strings.Repeat("a", 64), Valid: false}, + } + + for _, tc := range cases { + _, errors := validate.SchedulerName(tc.Input, "scheduler_name") + valid := len(errors) == 0 + if tc.Valid != valid { + t.Fatalf("expected valid=%t for %q, got valid=%t", tc.Valid, tc.Input, valid) + } + } +} diff --git a/internal/services/durabletask/validate/task_hub_name.go b/internal/services/durabletask/validate/task_hub_name.go new file mode 100644 index 000000000000..b94ee84aebf5 --- /dev/null +++ b/internal/services/durabletask/validate/task_hub_name.go @@ -0,0 +1,24 @@ +// Copyright IBM Corp. 2014, 2025 +// SPDX-License-Identifier: MPL-2.0 + +package validate + +import ( + "fmt" + "regexp" +) + +func TaskHubName(v interface{}, k string) (warnings []string, errors []error) { + value := v.(string) + + if len(value) < 3 || len(value) > 63 { + errors = append(errors, fmt.Errorf("property `%s` must be between 3 and 63 characters, got %d", k, len(value))) + return warnings, errors + } + + if matched := regexp.MustCompile(`^[a-zA-Z0-9][a-zA-Z0-9-]*[a-zA-Z0-9]$`).MatchString(value); !matched { + errors = append(errors, fmt.Errorf("property `%s` must start and end with alphanumeric characters and can contain hyphens", k)) + } + + return warnings, errors +} diff --git a/internal/services/durabletask/validate/task_hub_name_test.go b/internal/services/durabletask/validate/task_hub_name_test.go new file mode 100644 index 000000000000..0ab9966da498 --- /dev/null +++ b/internal/services/durabletask/validate/task_hub_name_test.go @@ -0,0 +1,40 @@ +// Copyright IBM Corp. 2014, 2025 +// SPDX-License-Identifier: MPL-2.0 + +package validate_test + +import ( + "strings" + "testing" + + "github.com/hashicorp/terraform-provider-azurerm/internal/services/durabletask/validate" +) + +func TestTaskHubName(t *testing.T) { + cases := []struct { + Input string + Valid bool + }{ + {Input: "validhub", Valid: true}, + {Input: "valid-hub", Valid: true}, + {Input: "hub123", Valid: true}, + {Input: "my-task-hub", Valid: true}, + {Input: "abc", Valid: true}, + {Input: strings.Repeat("a", 63), Valid: true}, + {Input: "taskhub-1", Valid: true}, + {Input: "test123hub", Valid: true}, + {Input: "", Valid: false}, + {Input: "ab", Valid: false}, + {Input: "-invalid", Valid: false}, + {Input: "invalid-", Valid: false}, + {Input: strings.Repeat("a", 64), Valid: false}, + } + + for _, tc := range cases { + _, errors := validate.TaskHubName(tc.Input, "task_hub_name") + valid := len(errors) == 0 + if tc.Valid != valid { + t.Fatalf("expected valid=%t for %q, got valid=%t", tc.Valid, tc.Input, valid) + } + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/retentionpolicies/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/retentionpolicies/README.md new file mode 100644 index 000000000000..eabc1fda07dc --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/retentionpolicies/README.md @@ -0,0 +1,99 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/retentionpolicies` Documentation + +The `retentionpolicies` SDK allows for interaction with Azure Resource Manager `durabletask` (API Version `2025-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/durabletask/2025-11-01/retentionpolicies" +``` + + +### Client Initialization + +```go +client := retentionpolicies.NewRetentionPoliciesClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `RetentionPoliciesClient.CreateOrReplace` + +```go +ctx := context.TODO() +id := retentionpolicies.NewSchedulerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "schedulerName") + +payload := retentionpolicies.RetentionPolicy{ + // ... +} + + +if err := client.CreateOrReplaceThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `RetentionPoliciesClient.Delete` + +```go +ctx := context.TODO() +id := retentionpolicies.NewSchedulerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "schedulerName") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `RetentionPoliciesClient.Get` + +```go +ctx := context.TODO() +id := retentionpolicies.NewSchedulerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "schedulerName") + +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: `RetentionPoliciesClient.ListByScheduler` + +```go +ctx := context.TODO() +id := retentionpolicies.NewSchedulerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "schedulerName") + +// alternatively `client.ListByScheduler(ctx, id)` can be used to do batched pagination +items, err := client.ListBySchedulerComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `RetentionPoliciesClient.Update` + +```go +ctx := context.TODO() +id := retentionpolicies.NewSchedulerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "schedulerName") + +payload := retentionpolicies.RetentionPolicyUpdate{ + // ... +} + + +if err := client.UpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/retentionpolicies/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/retentionpolicies/client.go new file mode 100644 index 000000000000..010219f303d3 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/retentionpolicies/client.go @@ -0,0 +1,26 @@ +package retentionpolicies + +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 RetentionPoliciesClient struct { + Client *resourcemanager.Client +} + +func NewRetentionPoliciesClientWithBaseURI(sdkApi sdkEnv.Api) (*RetentionPoliciesClient, error) { + client, err := resourcemanager.NewClient(sdkApi, "retentionpolicies", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating RetentionPoliciesClient: %+v", err) + } + + return &RetentionPoliciesClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/retentionpolicies/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/retentionpolicies/constants.go new file mode 100644 index 000000000000..7460b7fe699f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/retentionpolicies/constants.go @@ -0,0 +1,113 @@ +package retentionpolicies + +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 ProvisioningState string + +const ( + ProvisioningStateAccepted ProvisioningState = "Accepted" + ProvisioningStateCanceled ProvisioningState = "Canceled" + ProvisioningStateDeleting ProvisioningState = "Deleting" + ProvisioningStateFailed ProvisioningState = "Failed" + ProvisioningStateProvisioning ProvisioningState = "Provisioning" + ProvisioningStateSucceeded ProvisioningState = "Succeeded" + ProvisioningStateUpdating ProvisioningState = "Updating" +) + +func PossibleValuesForProvisioningState() []string { + return []string{ + string(ProvisioningStateAccepted), + string(ProvisioningStateCanceled), + string(ProvisioningStateDeleting), + string(ProvisioningStateFailed), + string(ProvisioningStateProvisioning), + 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{ + "accepted": ProvisioningStateAccepted, + "canceled": ProvisioningStateCanceled, + "deleting": ProvisioningStateDeleting, + "failed": ProvisioningStateFailed, + "provisioning": ProvisioningStateProvisioning, + "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 PurgeableOrchestrationState string + +const ( + PurgeableOrchestrationStateCanceled PurgeableOrchestrationState = "Canceled" + PurgeableOrchestrationStateCompleted PurgeableOrchestrationState = "Completed" + PurgeableOrchestrationStateFailed PurgeableOrchestrationState = "Failed" + PurgeableOrchestrationStateTerminated PurgeableOrchestrationState = "Terminated" +) + +func PossibleValuesForPurgeableOrchestrationState() []string { + return []string{ + string(PurgeableOrchestrationStateCanceled), + string(PurgeableOrchestrationStateCompleted), + string(PurgeableOrchestrationStateFailed), + string(PurgeableOrchestrationStateTerminated), + } +} + +func (s *PurgeableOrchestrationState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePurgeableOrchestrationState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parsePurgeableOrchestrationState(input string) (*PurgeableOrchestrationState, error) { + vals := map[string]PurgeableOrchestrationState{ + "canceled": PurgeableOrchestrationStateCanceled, + "completed": PurgeableOrchestrationStateCompleted, + "failed": PurgeableOrchestrationStateFailed, + "terminated": PurgeableOrchestrationStateTerminated, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PurgeableOrchestrationState(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/retentionpolicies/id_scheduler.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/retentionpolicies/id_scheduler.go new file mode 100644 index 000000000000..757b70859490 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/retentionpolicies/id_scheduler.go @@ -0,0 +1,130 @@ +package retentionpolicies + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "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. + +func init() { + recaser.RegisterResourceId(&SchedulerId{}) +} + +var _ resourceids.ResourceId = &SchedulerId{} + +// SchedulerId is a struct representing the Resource ID for a Scheduler +type SchedulerId struct { + SubscriptionId string + ResourceGroupName string + SchedulerName string +} + +// NewSchedulerID returns a new SchedulerId struct +func NewSchedulerID(subscriptionId string, resourceGroupName string, schedulerName string) SchedulerId { + return SchedulerId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + SchedulerName: schedulerName, + } +} + +// ParseSchedulerID parses 'input' into a SchedulerId +func ParseSchedulerID(input string) (*SchedulerId, error) { + parser := resourceids.NewParserFromResourceIdType(&SchedulerId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := SchedulerId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseSchedulerIDInsensitively parses 'input' case-insensitively into a SchedulerId +// note: this method should only be used for API response data and not user input +func ParseSchedulerIDInsensitively(input string) (*SchedulerId, error) { + parser := resourceids.NewParserFromResourceIdType(&SchedulerId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := SchedulerId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SchedulerId) 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.SchedulerName, ok = input.Parsed["schedulerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "schedulerName", input) + } + + return nil +} + +// ValidateSchedulerID checks that 'input' can be parsed as a Scheduler ID +func ValidateSchedulerID(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 := ParseSchedulerID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Scheduler ID +func (id SchedulerId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DurableTask/schedulers/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.SchedulerName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Scheduler ID +func (id SchedulerId) 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("staticMicrosoftDurableTask", "Microsoft.DurableTask", "Microsoft.DurableTask"), + resourceids.StaticSegment("staticSchedulers", "schedulers", "schedulers"), + resourceids.UserSpecifiedSegment("schedulerName", "schedulerName"), + } +} + +// String returns a human-readable description of this Scheduler ID +func (id SchedulerId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Scheduler Name: %q", id.SchedulerName), + } + return fmt.Sprintf("Scheduler (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/retentionpolicies/method_createorreplace.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/retentionpolicies/method_createorreplace.go new file mode 100644 index 000000000000..f68db1606dea --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/retentionpolicies/method_createorreplace.go @@ -0,0 +1,75 @@ +package retentionpolicies + +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 CreateOrReplaceOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *RetentionPolicy +} + +// CreateOrReplace ... +func (c RetentionPoliciesClient) CreateOrReplace(ctx context.Context, id SchedulerId, input RetentionPolicy) (result CreateOrReplaceOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: fmt.Sprintf("%s/retentionPolicies/default", 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 +} + +// CreateOrReplaceThenPoll performs CreateOrReplace then polls until it's completed +func (c RetentionPoliciesClient) CreateOrReplaceThenPoll(ctx context.Context, id SchedulerId, input RetentionPolicy) error { + result, err := c.CreateOrReplace(ctx, id, input) + if err != nil { + return fmt.Errorf("performing CreateOrReplace: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after CreateOrReplace: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/retentionpolicies/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/retentionpolicies/method_delete.go new file mode 100644 index 000000000000..f5865194fbd9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/retentionpolicies/method_delete.go @@ -0,0 +1,70 @@ +package retentionpolicies + +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 RetentionPoliciesClient) Delete(ctx context.Context, id SchedulerId) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + }, + HttpMethod: http.MethodDelete, + Path: fmt.Sprintf("%s/retentionPolicies/default", 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 RetentionPoliciesClient) DeleteThenPoll(ctx context.Context, id SchedulerId) 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/durabletask/2025-11-01/retentionpolicies/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/retentionpolicies/method_get.go new file mode 100644 index 000000000000..66716f51bcf4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/retentionpolicies/method_get.go @@ -0,0 +1,54 @@ +package retentionpolicies + +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 GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *RetentionPolicy +} + +// Get ... +func (c RetentionPoliciesClient) Get(ctx context.Context, id SchedulerId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/retentionPolicies/default", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model RetentionPolicy + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/retentionpolicies/method_listbyscheduler.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/retentionpolicies/method_listbyscheduler.go new file mode 100644 index 000000000000..ae8610e44a4f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/retentionpolicies/method_listbyscheduler.go @@ -0,0 +1,105 @@ +package retentionpolicies + +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 ListBySchedulerOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]RetentionPolicy +} + +type ListBySchedulerCompleteResult struct { + LatestHttpResponse *http.Response + Items []RetentionPolicy +} + +type ListBySchedulerCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ListBySchedulerCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// ListByScheduler ... +func (c RetentionPoliciesClient) ListByScheduler(ctx context.Context, id SchedulerId) (result ListBySchedulerOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &ListBySchedulerCustomPager{}, + Path: fmt.Sprintf("%s/retentionPolicies", 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 *[]RetentionPolicy `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListBySchedulerComplete retrieves all the results into a single object +func (c RetentionPoliciesClient) ListBySchedulerComplete(ctx context.Context, id SchedulerId) (ListBySchedulerCompleteResult, error) { + return c.ListBySchedulerCompleteMatchingPredicate(ctx, id, RetentionPolicyOperationPredicate{}) +} + +// ListBySchedulerCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c RetentionPoliciesClient) ListBySchedulerCompleteMatchingPredicate(ctx context.Context, id SchedulerId, predicate RetentionPolicyOperationPredicate) (result ListBySchedulerCompleteResult, err error) { + items := make([]RetentionPolicy, 0) + + resp, err := c.ListByScheduler(ctx, id) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + 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 = ListBySchedulerCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/retentionpolicies/method_update.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/retentionpolicies/method_update.go new file mode 100644 index 000000000000..09f1039bf263 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/retentionpolicies/method_update.go @@ -0,0 +1,75 @@ +package retentionpolicies + +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 + Model *RetentionPolicy +} + +// Update ... +func (c RetentionPoliciesClient) Update(ctx context.Context, id SchedulerId, input RetentionPolicyUpdate) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: fmt.Sprintf("%s/retentionPolicies/default", 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 RetentionPoliciesClient) UpdateThenPoll(ctx context.Context, id SchedulerId, input RetentionPolicyUpdate) 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/durabletask/2025-11-01/retentionpolicies/model_retentionpolicy.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/retentionpolicies/model_retentionpolicy.go new file mode 100644 index 000000000000..74dc6098d3a6 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/retentionpolicies/model_retentionpolicy.go @@ -0,0 +1,16 @@ +package retentionpolicies + +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 RetentionPolicy struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *RetentionPolicyProperties `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/durabletask/2025-11-01/retentionpolicies/model_retentionpolicydetails.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/retentionpolicies/model_retentionpolicydetails.go new file mode 100644 index 000000000000..512d6bc39917 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/retentionpolicies/model_retentionpolicydetails.go @@ -0,0 +1,9 @@ +package retentionpolicies + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RetentionPolicyDetails struct { + OrchestrationState *PurgeableOrchestrationState `json:"orchestrationState,omitempty"` + RetentionPeriodInDays int64 `json:"retentionPeriodInDays"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/retentionpolicies/model_retentionpolicyproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/retentionpolicies/model_retentionpolicyproperties.go new file mode 100644 index 000000000000..cde26e01dd38 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/retentionpolicies/model_retentionpolicyproperties.go @@ -0,0 +1,9 @@ +package retentionpolicies + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RetentionPolicyProperties struct { + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` + RetentionPolicies *[]RetentionPolicyDetails `json:"retentionPolicies,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/retentionpolicies/model_retentionpolicyupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/retentionpolicies/model_retentionpolicyupdate.go new file mode 100644 index 000000000000..bab081757b24 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/retentionpolicies/model_retentionpolicyupdate.go @@ -0,0 +1,16 @@ +package retentionpolicies + +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 RetentionPolicyUpdate struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *RetentionPolicyProperties `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/durabletask/2025-11-01/retentionpolicies/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/retentionpolicies/predicates.go new file mode 100644 index 000000000000..23d3129eab00 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/retentionpolicies/predicates.go @@ -0,0 +1,27 @@ +package retentionpolicies + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RetentionPolicyOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p RetentionPolicyOperationPredicate) Matches(input RetentionPolicy) 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/durabletask/2025-11-01/retentionpolicies/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/retentionpolicies/version.go new file mode 100644 index 000000000000..2ff4688a57f8 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/retentionpolicies/version.go @@ -0,0 +1,10 @@ +package retentionpolicies + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2025-11-01" + +func userAgent() string { + return "hashicorp/go-azure-sdk/retentionpolicies/2025-11-01" +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/schedulers/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/schedulers/README.md new file mode 100644 index 000000000000..e2614862e68b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/schedulers/README.md @@ -0,0 +1,117 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/schedulers` Documentation + +The `schedulers` SDK allows for interaction with Azure Resource Manager `durabletask` (API Version `2025-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-helpers/resourcemanager/commonids" +import "github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/schedulers" +``` + + +### Client Initialization + +```go +client := schedulers.NewSchedulersClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `SchedulersClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := schedulers.NewSchedulerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "schedulerName") + +payload := schedulers.Scheduler{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `SchedulersClient.Delete` + +```go +ctx := context.TODO() +id := schedulers.NewSchedulerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "schedulerName") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `SchedulersClient.Get` + +```go +ctx := context.TODO() +id := schedulers.NewSchedulerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "schedulerName") + +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: `SchedulersClient.ListByResourceGroup` + +```go +ctx := context.TODO() +id := commonids.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") + +// alternatively `client.ListByResourceGroup(ctx, id)` can be used to do batched pagination +items, err := client.ListByResourceGroupComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `SchedulersClient.ListBySubscription` + +```go +ctx := context.TODO() +id := commonids.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +// alternatively `client.ListBySubscription(ctx, id)` can be used to do batched pagination +items, err := client.ListBySubscriptionComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `SchedulersClient.Update` + +```go +ctx := context.TODO() +id := schedulers.NewSchedulerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "schedulerName") + +payload := schedulers.SchedulerUpdate{ + // ... +} + + +if err := client.UpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/schedulers/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/schedulers/client.go new file mode 100644 index 000000000000..a10b0bee1cc6 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/schedulers/client.go @@ -0,0 +1,26 @@ +package schedulers + +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 SchedulersClient struct { + Client *resourcemanager.Client +} + +func NewSchedulersClientWithBaseURI(sdkApi sdkEnv.Api) (*SchedulersClient, error) { + client, err := resourcemanager.NewClient(sdkApi, "schedulers", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating SchedulersClient: %+v", err) + } + + return &SchedulersClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/schedulers/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/schedulers/constants.go new file mode 100644 index 000000000000..eacae3ce383c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/schedulers/constants.go @@ -0,0 +1,148 @@ +package schedulers + +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 ProvisioningState string + +const ( + ProvisioningStateAccepted ProvisioningState = "Accepted" + ProvisioningStateCanceled ProvisioningState = "Canceled" + ProvisioningStateDeleting ProvisioningState = "Deleting" + ProvisioningStateFailed ProvisioningState = "Failed" + ProvisioningStateProvisioning ProvisioningState = "Provisioning" + ProvisioningStateSucceeded ProvisioningState = "Succeeded" + ProvisioningStateUpdating ProvisioningState = "Updating" +) + +func PossibleValuesForProvisioningState() []string { + return []string{ + string(ProvisioningStateAccepted), + string(ProvisioningStateCanceled), + string(ProvisioningStateDeleting), + string(ProvisioningStateFailed), + string(ProvisioningStateProvisioning), + 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{ + "accepted": ProvisioningStateAccepted, + "canceled": ProvisioningStateCanceled, + "deleting": ProvisioningStateDeleting, + "failed": ProvisioningStateFailed, + "provisioning": ProvisioningStateProvisioning, + "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 RedundancyState string + +const ( + RedundancyStateNone RedundancyState = "None" + RedundancyStateZone RedundancyState = "Zone" +) + +func PossibleValuesForRedundancyState() []string { + return []string{ + string(RedundancyStateNone), + string(RedundancyStateZone), + } +} + +func (s *RedundancyState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseRedundancyState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseRedundancyState(input string) (*RedundancyState, error) { + vals := map[string]RedundancyState{ + "none": RedundancyStateNone, + "zone": RedundancyStateZone, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := RedundancyState(input) + return &out, nil +} + +type SchedulerSkuName string + +const ( + SchedulerSkuNameConsumption SchedulerSkuName = "Consumption" + SchedulerSkuNameDedicated SchedulerSkuName = "Dedicated" +) + +func PossibleValuesForSchedulerSkuName() []string { + return []string{ + string(SchedulerSkuNameConsumption), + string(SchedulerSkuNameDedicated), + } +} + +func (s *SchedulerSkuName) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSchedulerSkuName(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseSchedulerSkuName(input string) (*SchedulerSkuName, error) { + vals := map[string]SchedulerSkuName{ + "consumption": SchedulerSkuNameConsumption, + "dedicated": SchedulerSkuNameDedicated, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SchedulerSkuName(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/schedulers/id_scheduler.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/schedulers/id_scheduler.go new file mode 100644 index 000000000000..6728f8e1797f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/schedulers/id_scheduler.go @@ -0,0 +1,130 @@ +package schedulers + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "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. + +func init() { + recaser.RegisterResourceId(&SchedulerId{}) +} + +var _ resourceids.ResourceId = &SchedulerId{} + +// SchedulerId is a struct representing the Resource ID for a Scheduler +type SchedulerId struct { + SubscriptionId string + ResourceGroupName string + SchedulerName string +} + +// NewSchedulerID returns a new SchedulerId struct +func NewSchedulerID(subscriptionId string, resourceGroupName string, schedulerName string) SchedulerId { + return SchedulerId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + SchedulerName: schedulerName, + } +} + +// ParseSchedulerID parses 'input' into a SchedulerId +func ParseSchedulerID(input string) (*SchedulerId, error) { + parser := resourceids.NewParserFromResourceIdType(&SchedulerId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := SchedulerId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseSchedulerIDInsensitively parses 'input' case-insensitively into a SchedulerId +// note: this method should only be used for API response data and not user input +func ParseSchedulerIDInsensitively(input string) (*SchedulerId, error) { + parser := resourceids.NewParserFromResourceIdType(&SchedulerId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := SchedulerId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SchedulerId) 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.SchedulerName, ok = input.Parsed["schedulerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "schedulerName", input) + } + + return nil +} + +// ValidateSchedulerID checks that 'input' can be parsed as a Scheduler ID +func ValidateSchedulerID(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 := ParseSchedulerID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Scheduler ID +func (id SchedulerId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DurableTask/schedulers/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.SchedulerName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Scheduler ID +func (id SchedulerId) 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("staticMicrosoftDurableTask", "Microsoft.DurableTask", "Microsoft.DurableTask"), + resourceids.StaticSegment("staticSchedulers", "schedulers", "schedulers"), + resourceids.UserSpecifiedSegment("schedulerName", "schedulerName"), + } +} + +// String returns a human-readable description of this Scheduler ID +func (id SchedulerId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Scheduler Name: %q", id.SchedulerName), + } + return fmt.Sprintf("Scheduler (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/schedulers/method_createorupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/schedulers/method_createorupdate.go new file mode 100644 index 000000000000..341e480c8eee --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/schedulers/method_createorupdate.go @@ -0,0 +1,75 @@ +package schedulers + +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 + Model *Scheduler +} + +// CreateOrUpdate ... +func (c SchedulersClient) CreateOrUpdate(ctx context.Context, id SchedulerId, input Scheduler) (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 SchedulersClient) CreateOrUpdateThenPoll(ctx context.Context, id SchedulerId, input Scheduler) 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/durabletask/2025-11-01/schedulers/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/schedulers/method_delete.go new file mode 100644 index 000000000000..0281f7bf786d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/schedulers/method_delete.go @@ -0,0 +1,70 @@ +package schedulers + +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 SchedulersClient) Delete(ctx context.Context, id SchedulerId) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + }, + 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 SchedulersClient) DeleteThenPoll(ctx context.Context, id SchedulerId) 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/durabletask/2025-11-01/schedulers/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/schedulers/method_get.go new file mode 100644 index 000000000000..b75eecc0c79f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/schedulers/method_get.go @@ -0,0 +1,53 @@ +package schedulers + +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 *Scheduler +} + +// Get ... +func (c SchedulersClient) Get(ctx context.Context, id SchedulerId) (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 + } + + var model Scheduler + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/schedulers/method_listbyresourcegroup.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/schedulers/method_listbyresourcegroup.go new file mode 100644 index 000000000000..bc5827f2f106 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/schedulers/method_listbyresourcegroup.go @@ -0,0 +1,106 @@ +package schedulers + +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 ListByResourceGroupOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]Scheduler +} + +type ListByResourceGroupCompleteResult struct { + LatestHttpResponse *http.Response + Items []Scheduler +} + +type ListByResourceGroupCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ListByResourceGroupCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// ListByResourceGroup ... +func (c SchedulersClient) ListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (result ListByResourceGroupOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &ListByResourceGroupCustomPager{}, + Path: fmt.Sprintf("%s/providers/Microsoft.DurableTask/schedulers", 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 *[]Scheduler `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByResourceGroupComplete retrieves all the results into a single object +func (c SchedulersClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (ListByResourceGroupCompleteResult, error) { + return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, SchedulerOperationPredicate{}) +} + +// ListByResourceGroupCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c SchedulersClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate SchedulerOperationPredicate) (result ListByResourceGroupCompleteResult, err error) { + items := make([]Scheduler, 0) + + resp, err := c.ListByResourceGroup(ctx, id) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + 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 = ListByResourceGroupCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/schedulers/method_listbysubscription.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/schedulers/method_listbysubscription.go new file mode 100644 index 000000000000..07ef73a92b32 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/schedulers/method_listbysubscription.go @@ -0,0 +1,106 @@ +package schedulers + +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 ListBySubscriptionOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]Scheduler +} + +type ListBySubscriptionCompleteResult struct { + LatestHttpResponse *http.Response + Items []Scheduler +} + +type ListBySubscriptionCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ListBySubscriptionCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// ListBySubscription ... +func (c SchedulersClient) ListBySubscription(ctx context.Context, id commonids.SubscriptionId) (result ListBySubscriptionOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &ListBySubscriptionCustomPager{}, + Path: fmt.Sprintf("%s/providers/Microsoft.DurableTask/schedulers", 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 *[]Scheduler `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListBySubscriptionComplete retrieves all the results into a single object +func (c SchedulersClient) ListBySubscriptionComplete(ctx context.Context, id commonids.SubscriptionId) (ListBySubscriptionCompleteResult, error) { + return c.ListBySubscriptionCompleteMatchingPredicate(ctx, id, SchedulerOperationPredicate{}) +} + +// ListBySubscriptionCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c SchedulersClient) ListBySubscriptionCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate SchedulerOperationPredicate) (result ListBySubscriptionCompleteResult, err error) { + items := make([]Scheduler, 0) + + resp, err := c.ListBySubscription(ctx, id) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + 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 = ListBySubscriptionCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/schedulers/method_update.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/schedulers/method_update.go new file mode 100644 index 000000000000..6d531a183c75 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/schedulers/method_update.go @@ -0,0 +1,75 @@ +package schedulers + +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 + Model *Scheduler +} + +// Update ... +func (c SchedulersClient) Update(ctx context.Context, id SchedulerId, input SchedulerUpdate) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// UpdateThenPoll performs Update then polls until it's completed +func (c SchedulersClient) UpdateThenPoll(ctx context.Context, id SchedulerId, input SchedulerUpdate) 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/durabletask/2025-11-01/schedulers/model_scheduler.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/schedulers/model_scheduler.go new file mode 100644 index 000000000000..a83241dca40b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/schedulers/model_scheduler.go @@ -0,0 +1,18 @@ +package schedulers + +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 Scheduler struct { + Id *string `json:"id,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties *SchedulerProperties `json:"properties,omitempty"` + 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/durabletask/2025-11-01/schedulers/model_schedulerproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/schedulers/model_schedulerproperties.go new file mode 100644 index 000000000000..40c9ba173821 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/schedulers/model_schedulerproperties.go @@ -0,0 +1,11 @@ +package schedulers + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SchedulerProperties struct { + Endpoint *string `json:"endpoint,omitempty"` + IPAllowlist []string `json:"ipAllowlist"` + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` + Sku SchedulerSku `json:"sku"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/schedulers/model_schedulerpropertiesupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/schedulers/model_schedulerpropertiesupdate.go new file mode 100644 index 000000000000..5ce215f730d1 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/schedulers/model_schedulerpropertiesupdate.go @@ -0,0 +1,11 @@ +package schedulers + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SchedulerPropertiesUpdate struct { + Endpoint *string `json:"endpoint,omitempty"` + IPAllowlist *[]string `json:"ipAllowlist,omitempty"` + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` + Sku *SchedulerSkuUpdate `json:"sku,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/schedulers/model_schedulersku.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/schedulers/model_schedulersku.go new file mode 100644 index 000000000000..9edbeef4f710 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/schedulers/model_schedulersku.go @@ -0,0 +1,10 @@ +package schedulers + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SchedulerSku struct { + Capacity *int64 `json:"capacity,omitempty"` + Name SchedulerSkuName `json:"name"` + RedundancyState *RedundancyState `json:"redundancyState,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/schedulers/model_schedulerskuupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/schedulers/model_schedulerskuupdate.go new file mode 100644 index 000000000000..d30a2441d856 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/schedulers/model_schedulerskuupdate.go @@ -0,0 +1,10 @@ +package schedulers + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SchedulerSkuUpdate struct { + Capacity *int64 `json:"capacity,omitempty"` + Name *SchedulerSkuName `json:"name,omitempty"` + RedundancyState *RedundancyState `json:"redundancyState,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/schedulers/model_schedulerupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/schedulers/model_schedulerupdate.go new file mode 100644 index 000000000000..c470ce1d3c5c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/schedulers/model_schedulerupdate.go @@ -0,0 +1,9 @@ +package schedulers + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SchedulerUpdate struct { + Properties *SchedulerPropertiesUpdate `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/schedulers/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/schedulers/predicates.go new file mode 100644 index 000000000000..334d9b638a32 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/schedulers/predicates.go @@ -0,0 +1,32 @@ +package schedulers + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SchedulerOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p SchedulerOperationPredicate) Matches(input Scheduler) 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 +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/schedulers/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/schedulers/version.go new file mode 100644 index 000000000000..85dd47d3ba2f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/schedulers/version.go @@ -0,0 +1,10 @@ +package schedulers + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2025-11-01" + +func userAgent() string { + return "hashicorp/go-azure-sdk/schedulers/2025-11-01" +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/taskhubs/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/taskhubs/README.md new file mode 100644 index 000000000000..d179329b0aa8 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/taskhubs/README.md @@ -0,0 +1,82 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/taskhubs` Documentation + +The `taskhubs` SDK allows for interaction with Azure Resource Manager `durabletask` (API Version `2025-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/durabletask/2025-11-01/taskhubs" +``` + + +### Client Initialization + +```go +client := taskhubs.NewTaskHubsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `TaskHubsClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := taskhubs.NewTaskHubID("12345678-1234-9876-4563-123456789012", "example-resource-group", "schedulerName", "taskHubName") + +payload := taskhubs.TaskHub{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `TaskHubsClient.Delete` + +```go +ctx := context.TODO() +id := taskhubs.NewTaskHubID("12345678-1234-9876-4563-123456789012", "example-resource-group", "schedulerName", "taskHubName") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `TaskHubsClient.Get` + +```go +ctx := context.TODO() +id := taskhubs.NewTaskHubID("12345678-1234-9876-4563-123456789012", "example-resource-group", "schedulerName", "taskHubName") + +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: `TaskHubsClient.ListByScheduler` + +```go +ctx := context.TODO() +id := taskhubs.NewSchedulerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "schedulerName") + +// alternatively `client.ListByScheduler(ctx, id)` can be used to do batched pagination +items, err := client.ListBySchedulerComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/taskhubs/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/taskhubs/client.go new file mode 100644 index 000000000000..cefad0c297f5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/taskhubs/client.go @@ -0,0 +1,26 @@ +package taskhubs + +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 TaskHubsClient struct { + Client *resourcemanager.Client +} + +func NewTaskHubsClientWithBaseURI(sdkApi sdkEnv.Api) (*TaskHubsClient, error) { + client, err := resourcemanager.NewClient(sdkApi, "taskhubs", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating TaskHubsClient: %+v", err) + } + + return &TaskHubsClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/taskhubs/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/taskhubs/constants.go new file mode 100644 index 000000000000..49a8610d42a2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/taskhubs/constants.go @@ -0,0 +1,66 @@ +package taskhubs + +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 ProvisioningState string + +const ( + ProvisioningStateAccepted ProvisioningState = "Accepted" + ProvisioningStateCanceled ProvisioningState = "Canceled" + ProvisioningStateDeleting ProvisioningState = "Deleting" + ProvisioningStateFailed ProvisioningState = "Failed" + ProvisioningStateProvisioning ProvisioningState = "Provisioning" + ProvisioningStateSucceeded ProvisioningState = "Succeeded" + ProvisioningStateUpdating ProvisioningState = "Updating" +) + +func PossibleValuesForProvisioningState() []string { + return []string{ + string(ProvisioningStateAccepted), + string(ProvisioningStateCanceled), + string(ProvisioningStateDeleting), + string(ProvisioningStateFailed), + string(ProvisioningStateProvisioning), + 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{ + "accepted": ProvisioningStateAccepted, + "canceled": ProvisioningStateCanceled, + "deleting": ProvisioningStateDeleting, + "failed": ProvisioningStateFailed, + "provisioning": ProvisioningStateProvisioning, + "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 +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/taskhubs/id_scheduler.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/taskhubs/id_scheduler.go new file mode 100644 index 000000000000..c315e1895a06 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/taskhubs/id_scheduler.go @@ -0,0 +1,130 @@ +package taskhubs + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "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. + +func init() { + recaser.RegisterResourceId(&SchedulerId{}) +} + +var _ resourceids.ResourceId = &SchedulerId{} + +// SchedulerId is a struct representing the Resource ID for a Scheduler +type SchedulerId struct { + SubscriptionId string + ResourceGroupName string + SchedulerName string +} + +// NewSchedulerID returns a new SchedulerId struct +func NewSchedulerID(subscriptionId string, resourceGroupName string, schedulerName string) SchedulerId { + return SchedulerId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + SchedulerName: schedulerName, + } +} + +// ParseSchedulerID parses 'input' into a SchedulerId +func ParseSchedulerID(input string) (*SchedulerId, error) { + parser := resourceids.NewParserFromResourceIdType(&SchedulerId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := SchedulerId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseSchedulerIDInsensitively parses 'input' case-insensitively into a SchedulerId +// note: this method should only be used for API response data and not user input +func ParseSchedulerIDInsensitively(input string) (*SchedulerId, error) { + parser := resourceids.NewParserFromResourceIdType(&SchedulerId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := SchedulerId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SchedulerId) 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.SchedulerName, ok = input.Parsed["schedulerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "schedulerName", input) + } + + return nil +} + +// ValidateSchedulerID checks that 'input' can be parsed as a Scheduler ID +func ValidateSchedulerID(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 := ParseSchedulerID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Scheduler ID +func (id SchedulerId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DurableTask/schedulers/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.SchedulerName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Scheduler ID +func (id SchedulerId) 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("staticMicrosoftDurableTask", "Microsoft.DurableTask", "Microsoft.DurableTask"), + resourceids.StaticSegment("staticSchedulers", "schedulers", "schedulers"), + resourceids.UserSpecifiedSegment("schedulerName", "schedulerName"), + } +} + +// String returns a human-readable description of this Scheduler ID +func (id SchedulerId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Scheduler Name: %q", id.SchedulerName), + } + return fmt.Sprintf("Scheduler (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/taskhubs/id_taskhub.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/taskhubs/id_taskhub.go new file mode 100644 index 000000000000..06d8b7a8a585 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/taskhubs/id_taskhub.go @@ -0,0 +1,139 @@ +package taskhubs + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "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. + +func init() { + recaser.RegisterResourceId(&TaskHubId{}) +} + +var _ resourceids.ResourceId = &TaskHubId{} + +// TaskHubId is a struct representing the Resource ID for a Task Hub +type TaskHubId struct { + SubscriptionId string + ResourceGroupName string + SchedulerName string + TaskHubName string +} + +// NewTaskHubID returns a new TaskHubId struct +func NewTaskHubID(subscriptionId string, resourceGroupName string, schedulerName string, taskHubName string) TaskHubId { + return TaskHubId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + SchedulerName: schedulerName, + TaskHubName: taskHubName, + } +} + +// ParseTaskHubID parses 'input' into a TaskHubId +func ParseTaskHubID(input string) (*TaskHubId, error) { + parser := resourceids.NewParserFromResourceIdType(&TaskHubId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := TaskHubId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseTaskHubIDInsensitively parses 'input' case-insensitively into a TaskHubId +// note: this method should only be used for API response data and not user input +func ParseTaskHubIDInsensitively(input string) (*TaskHubId, error) { + parser := resourceids.NewParserFromResourceIdType(&TaskHubId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := TaskHubId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *TaskHubId) 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.SchedulerName, ok = input.Parsed["schedulerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "schedulerName", input) + } + + if id.TaskHubName, ok = input.Parsed["taskHubName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "taskHubName", input) + } + + return nil +} + +// ValidateTaskHubID checks that 'input' can be parsed as a Task Hub ID +func ValidateTaskHubID(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 := ParseTaskHubID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Task Hub ID +func (id TaskHubId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DurableTask/schedulers/%s/taskHubs/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.SchedulerName, id.TaskHubName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Task Hub ID +func (id TaskHubId) 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("staticMicrosoftDurableTask", "Microsoft.DurableTask", "Microsoft.DurableTask"), + resourceids.StaticSegment("staticSchedulers", "schedulers", "schedulers"), + resourceids.UserSpecifiedSegment("schedulerName", "schedulerName"), + resourceids.StaticSegment("staticTaskHubs", "taskHubs", "taskHubs"), + resourceids.UserSpecifiedSegment("taskHubName", "taskHubName"), + } +} + +// String returns a human-readable description of this Task Hub ID +func (id TaskHubId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Scheduler Name: %q", id.SchedulerName), + fmt.Sprintf("Task Hub Name: %q", id.TaskHubName), + } + return fmt.Sprintf("Task Hub (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/taskhubs/method_createorupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/taskhubs/method_createorupdate.go new file mode 100644 index 000000000000..27baa0ee9833 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/taskhubs/method_createorupdate.go @@ -0,0 +1,75 @@ +package taskhubs + +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 + Model *TaskHub +} + +// CreateOrUpdate ... +func (c TaskHubsClient) CreateOrUpdate(ctx context.Context, id TaskHubId, input TaskHub) (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 TaskHubsClient) CreateOrUpdateThenPoll(ctx context.Context, id TaskHubId, input TaskHub) 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/durabletask/2025-11-01/taskhubs/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/taskhubs/method_delete.go new file mode 100644 index 000000000000..89a6200b917d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/taskhubs/method_delete.go @@ -0,0 +1,70 @@ +package taskhubs + +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 TaskHubsClient) Delete(ctx context.Context, id TaskHubId) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + }, + 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 TaskHubsClient) DeleteThenPoll(ctx context.Context, id TaskHubId) 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/durabletask/2025-11-01/taskhubs/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/taskhubs/method_get.go new file mode 100644 index 000000000000..9fecdce332a9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/taskhubs/method_get.go @@ -0,0 +1,53 @@ +package taskhubs + +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 *TaskHub +} + +// Get ... +func (c TaskHubsClient) Get(ctx context.Context, id TaskHubId) (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 + } + + var model TaskHub + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/taskhubs/method_listbyscheduler.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/taskhubs/method_listbyscheduler.go new file mode 100644 index 000000000000..55aa25831d76 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/taskhubs/method_listbyscheduler.go @@ -0,0 +1,105 @@ +package taskhubs + +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 ListBySchedulerOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]TaskHub +} + +type ListBySchedulerCompleteResult struct { + LatestHttpResponse *http.Response + Items []TaskHub +} + +type ListBySchedulerCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ListBySchedulerCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// ListByScheduler ... +func (c TaskHubsClient) ListByScheduler(ctx context.Context, id SchedulerId) (result ListBySchedulerOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &ListBySchedulerCustomPager{}, + Path: fmt.Sprintf("%s/taskHubs", 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 *[]TaskHub `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListBySchedulerComplete retrieves all the results into a single object +func (c TaskHubsClient) ListBySchedulerComplete(ctx context.Context, id SchedulerId) (ListBySchedulerCompleteResult, error) { + return c.ListBySchedulerCompleteMatchingPredicate(ctx, id, TaskHubOperationPredicate{}) +} + +// ListBySchedulerCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c TaskHubsClient) ListBySchedulerCompleteMatchingPredicate(ctx context.Context, id SchedulerId, predicate TaskHubOperationPredicate) (result ListBySchedulerCompleteResult, err error) { + items := make([]TaskHub, 0) + + resp, err := c.ListByScheduler(ctx, id) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + 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 = ListBySchedulerCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/taskhubs/model_taskhub.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/taskhubs/model_taskhub.go new file mode 100644 index 000000000000..88ef9c837faa --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/taskhubs/model_taskhub.go @@ -0,0 +1,16 @@ +package taskhubs + +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 TaskHub struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *TaskHubProperties `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/durabletask/2025-11-01/taskhubs/model_taskhubproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/taskhubs/model_taskhubproperties.go new file mode 100644 index 000000000000..13e1e9c4984d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/taskhubs/model_taskhubproperties.go @@ -0,0 +1,9 @@ +package taskhubs + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TaskHubProperties struct { + DashboardURL *string `json:"dashboardUrl,omitempty"` + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/taskhubs/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/taskhubs/predicates.go new file mode 100644 index 000000000000..35fccc4f584c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/taskhubs/predicates.go @@ -0,0 +1,27 @@ +package taskhubs + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TaskHubOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p TaskHubOperationPredicate) Matches(input TaskHub) 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/durabletask/2025-11-01/taskhubs/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/taskhubs/version.go new file mode 100644 index 000000000000..3e05d82efe01 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/taskhubs/version.go @@ -0,0 +1,10 @@ +package taskhubs + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2025-11-01" + +func userAgent() string { + return "hashicorp/go-azure-sdk/taskhubs/2025-11-01" +} diff --git a/vendor/modules.txt b/vendor/modules.txt index 3a9577c4f3ca..0e5f78f18fea 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -547,6 +547,9 @@ github.com/hashicorp/go-azure-sdk/resource-manager/dnsresolver/2022-07-01/forwar github.com/hashicorp/go-azure-sdk/resource-manager/dnsresolver/2022-07-01/inboundendpoints github.com/hashicorp/go-azure-sdk/resource-manager/dnsresolver/2022-07-01/outboundendpoints github.com/hashicorp/go-azure-sdk/resource-manager/dnsresolver/2022-07-01/virtualnetworklinks +github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/retentionpolicies +github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/schedulers +github.com/hashicorp/go-azure-sdk/resource-manager/durabletask/2025-11-01/taskhubs github.com/hashicorp/go-azure-sdk/resource-manager/dynatrace/2023-04-27/monitors github.com/hashicorp/go-azure-sdk/resource-manager/dynatrace/2023-04-27/tagrules github.com/hashicorp/go-azure-sdk/resource-manager/elastic/2023-06-01/monitorsresource diff --git a/website/allowed-subcategories b/website/allowed-subcategories index 9f9012eb96ba..8944472c4777 100644 --- a/website/allowed-subcategories +++ b/website/allowed-subcategories @@ -49,6 +49,7 @@ Desktop Virtualization Dev Center Dev Test Digital Twins +Durable Task Dynatrace Elastic Elastic SAN diff --git a/website/docs/d/durable_task_scheduler.html.markdown b/website/docs/d/durable_task_scheduler.html.markdown new file mode 100644 index 000000000000..7791b70b2f00 --- /dev/null +++ b/website/docs/d/durable_task_scheduler.html.markdown @@ -0,0 +1,62 @@ +--- +subcategory: "Durable Task" +layout: "azurerm" +page_title: "Azure Resource Manager: Data Source: azurerm_durable_task_scheduler" +description: |- + Gets information about an existing Durable Task Scheduler. +--- + +# Data Source: azurerm_durable_task_scheduler + +Use this data source to access information about an existing Durable Task Scheduler. + +## Example Usage + +```hcl +data "azurerm_durable_task_scheduler" "example" { + name = "existing-durable-task-scheduler" + resource_group_name = "existing-resources" +} + +output "endpoint" { + value = data.azurerm_durable_task_scheduler.example.endpoint +} +``` + +## Arguments Reference + +The following arguments are supported: + +* `name` - (Required) The name of the Durable Task Scheduler. + +* `resource_group_name` - (Required) The name of the Resource Group where the Durable Task Scheduler exists. + +## Attributes Reference + +In addition to the Arguments listed above - the following Attributes are exported: + +* `id` - The ID of the Durable Task Scheduler. + +* `capacity` - The capacity of the Durable Task Scheduler. + +* `endpoint` - The endpoint URL of the Durable Task Scheduler. + +* `ip_allow_list` - A list of IP addresses or CIDR ranges that are allowed to access the Durable Task Scheduler. + +* `location` - The Azure Region where the Durable Task Scheduler exists. + +* `sku_name` - The SKU of the Durable Task Scheduler. + +* `tags` - A mapping of tags assigned to the Durable Task Scheduler. + +## Timeouts + +The `timeouts` block allows you to specify [timeouts](https://developer.hashicorp.com/terraform/language/resources/configure#define-operation-timeouts) for certain actions: + +* `read` - (Defaults to 5 minutes) Used when retrieving the Durable Task Scheduler. + +## API Providers + +This data source uses the following Azure API Providers: + +* `Microsoft.DurableTask` - 2025-11-01 diff --git a/website/docs/r/durable_task_hub.html.markdown b/website/docs/r/durable_task_hub.html.markdown new file mode 100644 index 000000000000..1747698c71cc --- /dev/null +++ b/website/docs/r/durable_task_hub.html.markdown @@ -0,0 +1,71 @@ +--- +subcategory: "Durable Task" +layout: "azurerm" +page_title: "Azure Resource Manager: azurerm_durable_task_hub" +description: |- + Manages a Durable Task Hub. +--- + +# azurerm_durable_task_hub + +Manages a Durable Task Hub. + +## Example Usage + +```hcl +resource "azurerm_resource_group" "example" { + name = "example-resources" + location = "West Europe" +} + +resource "azurerm_durable_task_scheduler" "example" { + name = "example-durable-task-scheduler" + resource_group_name = azurerm_resource_group.example.name + location = azurerm_resource_group.example.location + sku_name = "Consumption" + ip_allow_list = ["0.0.0.0/0"] +} + +resource "azurerm_durable_task_hub" "example" { + name = "example-durable-task-hub" + scheduler_id = azurerm_durable_task_scheduler.example.id +} +``` + +## Arguments Reference + +The following arguments are supported: + +* `name` - (Required) The name which should be used for this Durable Task Hub. Changing this forces a new resource to be created. + +* `scheduler_id` - (Required) The ID of the Durable Task Scheduler where the Task Hub should be created. Changing this forces a new resource to be created. + +## Attributes Reference + +In addition to the Arguments listed above - the following Attributes are exported: + +* `id` - The ID of the Durable Task Hub. + +* `dashboard_url` - The URL of the dashboard for the Durable Task Hub. + +## Timeouts + +The `timeouts` block allows you to specify [timeouts](https://developer.hashicorp.com/terraform/language/resources/configure#define-operation-timeouts) for certain actions: + +* `create` - (Defaults to 30 minutes) Used when creating the Durable Task Hub. +* `read` - (Defaults to 5 minutes) Used when retrieving the Durable Task Hub. +* `delete` - (Defaults to 30 minutes) Used when deleting the Durable Task Hub. + +## Import + +A Durable Task Hub can be imported using the `resource id`, e.g. + +```shell +terraform import azurerm_durable_task_hub.example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourceGroup1/providers/Microsoft.DurableTask/schedulers/scheduler1/taskHubs/taskHub1 +``` + +## API Providers + +This resource uses the following Azure API Providers: + +* `Microsoft.DurableTask` - 2025-11-01 diff --git a/website/docs/r/durable_task_retention_policy.html.markdown b/website/docs/r/durable_task_retention_policy.html.markdown new file mode 100644 index 000000000000..1bcddb1c3ee3 --- /dev/null +++ b/website/docs/r/durable_task_retention_policy.html.markdown @@ -0,0 +1,87 @@ +--- +subcategory: "Durable Task" +layout: "azurerm" +page_title: "Azure Resource Manager: azurerm_durable_task_retention_policy" +description: |- + Manages a Durable Task Retention Policy. +--- + +# azurerm_durable_task_retention_policy + +Manages a Durable Task Retention Policy for a Durable Task Scheduler. + +## Example Usage + +```hcl +resource "azurerm_resource_group" "example" { + name = "example-resources" + location = "West Europe" +} + +resource "azurerm_durable_task_scheduler" "example" { + name = "example-durable-task-scheduler" + resource_group_name = azurerm_resource_group.example.name + location = azurerm_resource_group.example.location + sku_name = "Consumption" + ip_allow_list = ["0.0.0.0/0"] +} + +resource "azurerm_durable_task_retention_policy" "example" { + scheduler_id = azurerm_durable_task_scheduler.example.id + + retention_policy { + retention_period_in_days = 30 + orchestration_state = "Completed" + } + + retention_policy { + retention_period_in_days = 7 + orchestration_state = "Failed" + } +} +``` + +## Arguments Reference + +The following arguments are supported: + +* `scheduler_id` - (Required) The ID of the Durable Task Scheduler where the Retention Policy should be applied. Changing this forces a new resource to be created. + +* `retention_policy` - (Required) One or more `retention_policy` blocks as defined below. + +--- + +A `retention_policy` block supports the following: + +* `retention_period_in_days` - (Required) The number of days to retain orchestration data. + +* `orchestration_state` - (Optional) The orchestration state to which this retention policy applies. Possible values are `Canceled`, `Completed`, `Failed`, and `Terminated`. + +## Attributes Reference + +In addition to the Arguments listed above - the following Attributes are exported: + +* `id` - The ID of the Durable Task Retention Policy. + +## Timeouts + +The `timeouts` block allows you to specify [timeouts](https://developer.hashicorp.com/terraform/language/resources/configure#define-operation-timeouts) for certain actions: + +* `create` - (Defaults to 30 minutes) Used when creating the Durable Task Retention Policy. +* `read` - (Defaults to 5 minutes) Used when retrieving the Durable Task Retention Policy. +* `update` - (Defaults to 30 minutes) Used when updating the Durable Task Retention Policy. +* `delete` - (Defaults to 30 minutes) Used when deleting the Durable Task Retention Policy. + +## Import + +A Durable Task Retention Policy can be imported using the `resource id`, e.g. + +```shell +terraform import azurerm_durable_task_retention_policy.example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourceGroup1/providers/Microsoft.DurableTask/schedulers/scheduler1/retentionPolicies/default +``` + +## API Providers + +This resource uses the following Azure API Providers: + +* `Microsoft.DurableTask` - 2025-11-01 diff --git a/website/docs/r/durable_task_scheduler.html.markdown b/website/docs/r/durable_task_scheduler.html.markdown new file mode 100644 index 000000000000..41d2c3b76540 --- /dev/null +++ b/website/docs/r/durable_task_scheduler.html.markdown @@ -0,0 +1,85 @@ +--- +subcategory: "Durable Task" +layout: "azurerm" +page_title: "Azure Resource Manager: azurerm_durable_task_scheduler" +description: |- + Manages a Durable Task Scheduler. +--- + +# azurerm_durable_task_scheduler + +Manages a Durable Task Scheduler. + +## Example Usage + +```hcl +resource "azurerm_resource_group" "example" { + name = "example-resources" + location = "West Europe" +} + +resource "azurerm_durable_task_scheduler" "example" { + name = "example-durable-task-scheduler" + resource_group_name = azurerm_resource_group.example.name + location = azurerm_resource_group.example.location + sku_name = "Consumption" + ip_allow_list = ["0.0.0.0/0"] + + tags = { + environment = "production" + } +} +``` + +## Arguments Reference + +The following arguments are supported: + +* `name` - (Required) The name which should be used for this Durable Task Scheduler. Changing this forces a new resource to be created. + +* `resource_group_name` - (Required) The name of the Resource Group where the Durable Task Scheduler should exist. Changing this forces a new resource to be created. + +* `location` - (Required) The Azure Region where the Durable Task Scheduler should exist. Changing this forces a new resource to be created. + +* `ip_allow_list` - (Required) A list of IP addresses or CIDR ranges that are allowed to access the Durable Task Scheduler. + +* `sku_name` - (Required) The SKU of the Durable Task Scheduler. Possible values include `Consumption` and `Dedicated`. Changing this forces a new resource to be created. + +--- + +* `capacity` - (Optional) The capacity of the Durable Task Scheduler. + +-> **Note:** `capacity` is only applicable when `sku_name` is set to `Dedicated`. + +* `tags` - (Optional) A mapping of tags which should be assigned to the Durable Task Scheduler. + +## Attributes Reference + +In addition to the Arguments listed above - the following Attributes are exported: + +* `id` - The ID of the Durable Task Scheduler. + +* `endpoint` - The endpoint URL of the Durable Task Scheduler. + +## Timeouts + +The `timeouts` block allows you to specify [timeouts](https://developer.hashicorp.com/terraform/language/resources/configure#define-operation-timeouts) for certain actions: + +* `create` - (Defaults to 30 minutes) Used when creating the Durable Task Scheduler. +* `read` - (Defaults to 5 minutes) Used when retrieving the Durable Task Scheduler. +* `update` - (Defaults to 30 minutes) Used when updating the Durable Task Scheduler. +* `delete` - (Defaults to 30 minutes) Used when deleting the Durable Task Scheduler. + +## Import + +A Durable Task Scheduler can be imported using the `resource id`, e.g. + +```shell +terraform import azurerm_durable_task_scheduler.example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourceGroup1/providers/Microsoft.DurableTask/schedulers/scheduler1 +``` + +## API Providers + +This resource uses the following Azure API Providers: + +* `Microsoft.DurableTask` - 2025-11-01